@nookplot/runtime 0.5.71 → 0.5.73
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/__tests__/apiMarketplace.test.d.ts +2 -0
- package/dist/__tests__/apiMarketplace.test.d.ts.map +1 -0
- package/dist/__tests__/apiMarketplace.test.js +102 -0
- package/dist/__tests__/apiMarketplace.test.js.map +1 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.js +152 -71
- package/dist/__tests__/autonomous.getAvailableActions.test.js.map +1 -1
- package/dist/__tests__/autonomous.latentSpace.test.d.ts +2 -0
- package/dist/__tests__/autonomous.latentSpace.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.latentSpace.test.js +224 -0
- package/dist/__tests__/autonomous.latentSpace.test.js.map +1 -0
- package/dist/actionCatalog.d.ts +13 -6
- package/dist/actionCatalog.d.ts.map +1 -1
- package/dist/actionCatalog.generated.d.ts +1 -1
- package/dist/actionCatalog.generated.d.ts.map +1 -1
- package/dist/actionCatalog.generated.js +665 -11
- package/dist/actionCatalog.generated.js.map +1 -1
- package/dist/actionCatalog.js +32 -27
- package/dist/actionCatalog.js.map +1 -1
- package/dist/api-marketplace.d.ts +111 -0
- package/dist/api-marketplace.d.ts.map +1 -0
- package/dist/api-marketplace.js +154 -0
- package/dist/api-marketplace.js.map +1 -0
- package/dist/artifactEmbeddings.d.ts +69 -0
- package/dist/artifactEmbeddings.d.ts.map +1 -0
- package/dist/artifactEmbeddings.js +52 -0
- package/dist/artifactEmbeddings.js.map +1 -0
- package/dist/autonomous.d.ts +3 -1
- package/dist/autonomous.d.ts.map +1 -1
- package/dist/autonomous.js +58 -233
- package/dist/autonomous.js.map +1 -1
- package/dist/bundles.d.ts +73 -0
- package/dist/bundles.d.ts.map +1 -1
- package/dist/bundles.js +90 -0
- package/dist/bundles.js.map +1 -1
- package/dist/cognitiveWorkspace.d.ts +107 -0
- package/dist/cognitiveWorkspace.d.ts.map +1 -0
- package/dist/cognitiveWorkspace.js +94 -0
- package/dist/cognitiveWorkspace.js.map +1 -0
- package/dist/cro.d.ts +243 -0
- package/dist/cro.d.ts.map +1 -0
- package/dist/cro.js +263 -0
- package/dist/cro.js.map +1 -0
- package/dist/embeddingExchange.d.ts +141 -0
- package/dist/embeddingExchange.d.ts.map +1 -0
- package/dist/embeddingExchange.js +95 -0
- package/dist/embeddingExchange.js.map +1 -0
- package/dist/evaluator.d.ts +113 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +144 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.d.ts +127 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +123 -0
- package/dist/manifest.js.map +1 -0
- package/dist/signalActionMap.d.ts +28 -0
- package/dist/signalActionMap.d.ts.map +1 -0
- package/dist/signalActionMap.js +199 -0
- package/dist/signalActionMap.js.map +1 -0
- package/package.json +1 -1
- package/dist/cliques.d.ts +0 -89
- package/dist/cliques.d.ts.map +0 -1
- package/dist/cliques.js +0 -102
- package/dist/cliques.js.map +0 -1
package/dist/autonomous.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export interface AutonomousAgentOptions {
|
|
|
124
124
|
* // → "- reply: Send a text reply in the current context. Params: content (string)\n..."
|
|
125
125
|
* ```
|
|
126
126
|
*/
|
|
127
|
-
export declare function getAvailableActions(signalType: string): string[];
|
|
127
|
+
export declare function getAvailableActions(signalType: string, loadedCategories?: Set<string>): string[];
|
|
128
128
|
export declare class AutonomousAgent {
|
|
129
129
|
private readonly runtime;
|
|
130
130
|
private readonly verbose;
|
|
@@ -137,6 +137,8 @@ export declare class AutonomousAgent {
|
|
|
137
137
|
private channelCooldowns;
|
|
138
138
|
/** Dedup: tracks signal keys already processed. Entries expire after 1h. */
|
|
139
139
|
private processedSignals;
|
|
140
|
+
/** Dynamic tool browsing: categories loaded via browse_tools. */
|
|
141
|
+
private loadedCategories;
|
|
140
142
|
constructor(runtime: NookplotRuntime, options?: AutonomousAgentOptions);
|
|
141
143
|
/** Start listening for proactive signals and action requests. */
|
|
142
144
|
start(): void;
|
package/dist/autonomous.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autonomous.d.ts","sourceRoot":"","sources":["../src/autonomous.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"autonomous.d.ts","sourceRoot":"","sources":["../src/autonomous.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlD,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,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B;YA8BnB,yBAAyB;YA+BzB,2BAA2B;YAwC3B,yBAAyB;YAazB,wBAAwB;YAMxB,0BAA0B;YAQ1B,4BAA4B;YAY5B,iBAAiB;IAc/B;;OAEG;YACW,wBAAwB;IA0EtC;;OAEG;YACW,mBAAmB;IAyDjC;;;;;OAKG;YACW,mBAAmB;YAmEnB,mBAAmB;YA0JnB,sBAAsB;YAuCtB,sBAAsB;YA+BtB,uBAAuB;YAgCvB,yBAAyB;YAkCzB,4BAA4B;YAuC5B,yBAAyB;YAgCzB,6BAA6B;YAkC7B,mBAAmB;YAkCnB,mBAAmB;YAoCnB,oBAAoB;YA6BpB,sBAAsB;YAsCtB,iBAAiB;YA8BjB,gBAAgB;CA6B/B"}
|
package/dist/autonomous.js
CHANGED
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
*/
|
|
42
42
|
import { prepareSignRelay } from "./signing.js";
|
|
43
43
|
import { wrapUntrusted, sanitizeForPrompt, UNTRUSTED_CONTENT_INSTRUCTION } from "./contentSafety.js";
|
|
44
|
-
import {
|
|
44
|
+
import { getAvailableActionsFromMap } from "./signalActionMap.js";
|
|
45
|
+
import { getCategoryListing, getToolsInCategory } from "./actionCatalog.js";
|
|
45
46
|
// ----------------------------------------------------------------
|
|
46
47
|
// AutonomousAgent
|
|
47
48
|
// ----------------------------------------------------------------
|
|
@@ -64,6 +65,28 @@ const ON_CHAIN_ACTIONS = new Set([
|
|
|
64
65
|
"block_agent", "unblock_agent",
|
|
65
66
|
"gpu_submit_attestation", "gpu_update_attestation", "gpu_revoke_attestation",
|
|
66
67
|
"gpu_rent",
|
|
68
|
+
// Bounty work actions
|
|
69
|
+
"submit_bounty_work", "select_bounty_submission", "reject_bounty_application",
|
|
70
|
+
// Teaching exchange
|
|
71
|
+
"accept_teaching", "reject_teaching", "deliver_teaching", "approve_teaching",
|
|
72
|
+
// Credit agreements
|
|
73
|
+
"accept_credit_agreement", "complete_credit_agreement",
|
|
74
|
+
"cancel_credit_agreement", "deliver_credit_work",
|
|
75
|
+
// Communication (state-changing)
|
|
76
|
+
"reply_email", "send_email", "send_dm",
|
|
77
|
+
// Intent matching
|
|
78
|
+
"submit_proposal", "browse_intents", "complete_intent",
|
|
79
|
+
// Mining state-changing actions
|
|
80
|
+
"stake_for_mining", "unstake_mining",
|
|
81
|
+
"stake_mining_onchain", "request_mining_unstake",
|
|
82
|
+
"cancel_mining_unstake", "complete_mining_unstake",
|
|
83
|
+
"claim_mining_pool_reward",
|
|
84
|
+
"create_mining_guild", "join_guild_mining", "leave_guild_mining",
|
|
85
|
+
"submit_reasoning_trace", "verify_reasoning_submission",
|
|
86
|
+
"claim_mining_reward", "claim_inference",
|
|
87
|
+
"vote_kick_guild_member",
|
|
88
|
+
"mining_counter_argument", "mining_defend_trace",
|
|
89
|
+
// API marketplace on-chain actions use existing service/* prepare endpoints
|
|
67
90
|
]);
|
|
68
91
|
/**
|
|
69
92
|
* Get the list of available actions for a given signal type.
|
|
@@ -82,237 +105,8 @@ const ON_CHAIN_ACTIONS = new Set([
|
|
|
82
105
|
* // → "- reply: Send a text reply in the current context. Params: content (string)\n..."
|
|
83
106
|
* ```
|
|
84
107
|
*/
|
|
85
|
-
export function getAvailableActions(signalType) {
|
|
86
|
-
return
|
|
87
|
-
}
|
|
88
|
-
/** Raw action lists per signal type (before profile filtering). */
|
|
89
|
-
function _getAvailableActionsRaw(signalType) {
|
|
90
|
-
switch (signalType) {
|
|
91
|
-
case "dm_received":
|
|
92
|
-
return [
|
|
93
|
-
"reply", "send_dm", "follow_back", "attest_back", "propose_collab",
|
|
94
|
-
"vote", "publish", "create_post", "create_bounty", "create_project",
|
|
95
|
-
"create_community", "create_listing", "commit_files", "create_task",
|
|
96
|
-
"link_project_to_guild", "propose_guild", "deploy_preview",
|
|
97
|
-
"egress_request", "execute_tool", "exec_code", "call_mcp_tool", "register_webhook",
|
|
98
|
-
"workspace_create", "publish_insight",
|
|
99
|
-
"create_intent", "browse_intents",
|
|
100
|
-
"launch_token", "preview_token_launch",
|
|
101
|
-
"search_skills", "install_skill", "store_memory", "recall_memory",
|
|
102
|
-
"propose_teaching", "search_teachers",
|
|
103
|
-
"credit_hire",
|
|
104
|
-
"ignore",
|
|
105
|
-
];
|
|
106
|
-
case "channel_message":
|
|
107
|
-
case "channel_mention":
|
|
108
|
-
case "project_discussion":
|
|
109
|
-
return [
|
|
110
|
-
"reply", "publish", "vote", "follow", "attest", "propose_collab",
|
|
111
|
-
"create_post", "create_bounty", "create_project", "commit_files",
|
|
112
|
-
"create_task", "link_project_to_guild", "propose_guild",
|
|
113
|
-
"egress_request", "execute_tool", "exec_code", "call_mcp_tool",
|
|
114
|
-
"workspace_create", "publish_insight",
|
|
115
|
-
"create_intent", "browse_intents",
|
|
116
|
-
"search_skills", "install_skill", "store_memory",
|
|
117
|
-
"ignore",
|
|
118
|
-
];
|
|
119
|
-
case "new_follower":
|
|
120
|
-
return ["follow_back", "send_dm", "ignore"];
|
|
121
|
-
case "attestation_received":
|
|
122
|
-
return ["attest_back", "endorse_agent", "send_dm", "ignore"];
|
|
123
|
-
case "endorsement_received":
|
|
124
|
-
return ["endorse_agent", "attest_back", "send_dm", "ignore"];
|
|
125
|
-
case "files_committed":
|
|
126
|
-
case "pending_review":
|
|
127
|
-
return ["review", "comment", "request_ai_review", "list_project_files", "read_project_file", "list_commits", "get_commit_detail", "list_merge_requests", "get_merge_request", "ignore"];
|
|
128
|
-
case "merge_request_created":
|
|
129
|
-
return ["get_merge_request", "merge_merge_request", "close_merge_request", "reply", "ignore"];
|
|
130
|
-
case "project_forked":
|
|
131
|
-
return ["acknowledge", "send_dm", "ignore"];
|
|
132
|
-
case "review_submitted":
|
|
133
|
-
return ["reply", "ignore"];
|
|
134
|
-
case "collaborator_added":
|
|
135
|
-
return ["send_message", "reply", "ignore"];
|
|
136
|
-
case "new_post_in_community":
|
|
137
|
-
case "post_reply":
|
|
138
|
-
case "reply_to_own_post":
|
|
139
|
-
return ["reply", "post_reply", "vote", "publish", "ignore"];
|
|
140
|
-
case "bounty":
|
|
141
|
-
return ["claim", "apply_bounty", "create_bounty", "reply", "ignore"];
|
|
142
|
-
case "community_gap":
|
|
143
|
-
return ["create_community", "ignore"];
|
|
144
|
-
case "potential_friend":
|
|
145
|
-
return ["follow", "send_dm", "attest", "endorse_agent", "ignore"];
|
|
146
|
-
case "attestation_opportunity":
|
|
147
|
-
return ["attest", "endorse_agent", "send_dm", "ignore"];
|
|
148
|
-
case "directive":
|
|
149
|
-
return [
|
|
150
|
-
"execute", "reply", "publish", "create_project", "commit_files",
|
|
151
|
-
"create_task", "assign_task", "complete_task", "update_task",
|
|
152
|
-
"link_project_to_guild", "propose_guild", "approve_guild", "reject_guild", "leave_guild",
|
|
153
|
-
"create_bounty", "create_bundle", "propose_collab", "assemble_team",
|
|
154
|
-
"find_agents", "deploy_preview", "add_collaborator",
|
|
155
|
-
"fork_project", "create_merge_request", "list_merge_requests", "get_merge_request", "merge_merge_request", "close_merge_request",
|
|
156
|
-
"create_listing", "create_agreement", "cancel_agreement",
|
|
157
|
-
"workspace_create", "workspace_set", "workspace_snapshot",
|
|
158
|
-
"propose_action", "vote_proposal", "cancel_proposal",
|
|
159
|
-
"egress_request", "execute_tool", "exec_code", "call_mcp_tool", "connect_mcp_server", "disconnect_mcp_server", "register_webhook",
|
|
160
|
-
"publish_insight", "cite_insight", "apply_insight",
|
|
161
|
-
"deposit_treasury", "withdraw_treasury", "fund_bounty_from_treasury", "distribute_revenue",
|
|
162
|
-
"create_swarm", "claim_subtask", "submit_swarm_result", "aggregate_swarm",
|
|
163
|
-
"record_gap", "update_proficiency", "generate_recommendations",
|
|
164
|
-
"create_intent", "browse_intents", "submit_proposal", "accept_proposal", "reject_proposal",
|
|
165
|
-
"cancel_intent", "complete_intent", "withdraw_proposal", "query_oracle",
|
|
166
|
-
"launch_token", "preview_token_launch", "claim_clawnch_fees", "get_token_analytics",
|
|
167
|
-
"create_search_subscription",
|
|
168
|
-
"send_email", "reply_email", "check_email", "create_email_inbox",
|
|
169
|
-
"search_skills", "publish_skill", "install_skill", "review_skill", "update_skill", "trending_skills",
|
|
170
|
-
"store_memory", "recall_memory", "list_memories", "memory_stats", "export_memories", "import_memories",
|
|
171
|
-
"forge_deploy", "forge_spawn", "forge_update_soul",
|
|
172
|
-
"propose_teaching", "accept_teaching", "deliver_teaching", "approve_teaching", "reject_teaching", "search_teachers",
|
|
173
|
-
"credit_hire", "accept_credit_agreement", "deliver_credit_work", "complete_credit_agreement", "cancel_credit_agreement",
|
|
174
|
-
"claim_reward",
|
|
175
|
-
"endorse_agent", "revoke_endorsement",
|
|
176
|
-
"block_agent", "unblock_agent",
|
|
177
|
-
"list_project_files", "read_project_file", "list_commits", "get_commit_detail",
|
|
178
|
-
"gpu_search", "gpu_heartbeat", "gpu_challenge", "gpu_submit_challenge",
|
|
179
|
-
"gpu_submit_attestation", "gpu_update_attestation", "gpu_revoke_attestation",
|
|
180
|
-
"gpu_rent",
|
|
181
|
-
"ignore",
|
|
182
|
-
];
|
|
183
|
-
case "collab_request":
|
|
184
|
-
return ["add_collaborator", "propose_collab", "reply", "ignore"];
|
|
185
|
-
case "service":
|
|
186
|
-
return ["reply", "update_service", "create_listing", "create_agreement", "ignore"];
|
|
187
|
-
case "time_to_post":
|
|
188
|
-
return ["create_post", "create_bounty", "create_bundle", "publish_insight", "create_listing", "publish_skill", "ignore"];
|
|
189
|
-
case "time_to_create_project":
|
|
190
|
-
return ["create_project", "assemble_team", "ignore"];
|
|
191
|
-
case "task_assigned":
|
|
192
|
-
return ["accept", "update_task", "complete_task", "assign_task", "assemble_team", "reply", "ignore"];
|
|
193
|
-
case "task_completed":
|
|
194
|
-
return ["reply", "review", "create_task", "ignore"];
|
|
195
|
-
case "milestone_reached":
|
|
196
|
-
return ["reply", "ignore"];
|
|
197
|
-
case "review_comment_added":
|
|
198
|
-
return ["reply", "ignore"];
|
|
199
|
-
case "agent_mentioned":
|
|
200
|
-
return ["reply", "acknowledge", "ignore"];
|
|
201
|
-
case "project_status_update":
|
|
202
|
-
return ["reply", "ignore"];
|
|
203
|
-
case "file_shared":
|
|
204
|
-
return ["reply", "ignore"];
|
|
205
|
-
case "bounty_posted_to_project":
|
|
206
|
-
return ["reply", "claim", "ignore"];
|
|
207
|
-
case "bounty_access_requested":
|
|
208
|
-
return ["grant", "deny", "ignore"];
|
|
209
|
-
case "bounty_access_granted":
|
|
210
|
-
return ["reply", "claim", "ignore"];
|
|
211
|
-
case "project_bounty_claimed":
|
|
212
|
-
return ["reply", "ignore"];
|
|
213
|
-
case "project_bounty_completed":
|
|
214
|
-
return ["reply", "ignore"];
|
|
215
|
-
case "team_assembly_suggested":
|
|
216
|
-
return ["assemble_team", "ignore"];
|
|
217
|
-
case "team_invitation":
|
|
218
|
-
return ["accept_invitation", "decline_invitation", "ignore"];
|
|
219
|
-
case "team_invitation_accepted":
|
|
220
|
-
case "team_invitation_declined":
|
|
221
|
-
return ["reply", "ignore"];
|
|
222
|
-
case "xmtp_message":
|
|
223
|
-
return ["reply", "ignore"];
|
|
224
|
-
// Marketplace signals
|
|
225
|
-
case "agreement_created":
|
|
226
|
-
return ["deliver_work", "cancel_agreement", "send_agreement_message", "ignore"];
|
|
227
|
-
case "work_delivered":
|
|
228
|
-
return ["settle_agreement", "dispute_agreement", "send_agreement_message", "expire_delivered", "ignore"];
|
|
229
|
-
case "agreement_settled":
|
|
230
|
-
return ["submit_review", "ignore"];
|
|
231
|
-
case "agreement_disputed":
|
|
232
|
-
return ["send_agreement_message", "expire_dispute", "ignore"];
|
|
233
|
-
case "agreement_cancelled":
|
|
234
|
-
return ["ignore"];
|
|
235
|
-
case "revision_requested":
|
|
236
|
-
return ["deliver_work", "send_agreement_message", "ignore"];
|
|
237
|
-
case "review_received":
|
|
238
|
-
return ["ignore"];
|
|
239
|
-
// Bounty application/submission signals
|
|
240
|
-
case "bounty_application_submitted":
|
|
241
|
-
return ["approve_bounty_claimer", "reject_bounty_application", "ignore"];
|
|
242
|
-
case "bounty_application_approved":
|
|
243
|
-
return ["claim_bounty", "ignore"];
|
|
244
|
-
case "bounty_application_rejected":
|
|
245
|
-
return ["ignore"];
|
|
246
|
-
case "bounty_work_submitted":
|
|
247
|
-
return ["select_bounty_submission", "ignore"];
|
|
248
|
-
case "bounty_submission_selected":
|
|
249
|
-
return ["claim_bounty", "ignore"];
|
|
250
|
-
case "bounty_submission_not_selected":
|
|
251
|
-
return ["ignore"];
|
|
252
|
-
// On-chain bounty lifecycle signals
|
|
253
|
-
case "bounty_claimed":
|
|
254
|
-
return ["approve_bounty_work", "approve_bounty_claimer", "dispute_bounty_work", "unclaim_bounty", "ignore"];
|
|
255
|
-
case "bounty_work_approved":
|
|
256
|
-
return ["ignore"];
|
|
257
|
-
case "bounty_disputed":
|
|
258
|
-
return ["cancel_bounty", "ignore"];
|
|
259
|
-
case "bounty_cancelled":
|
|
260
|
-
return ["ignore"];
|
|
261
|
-
case "bounty_claimer_approved":
|
|
262
|
-
return ["claim_bounty", "ignore"];
|
|
263
|
-
case "guild_opportunity":
|
|
264
|
-
return ["join_guild", "approve_guild", "reject_guild", "leave_guild", "propose_guild", "link_project_to_guild", "reply", "ignore"];
|
|
265
|
-
// Intent signals
|
|
266
|
-
case "intent_matched":
|
|
267
|
-
return ["submit_proposal", "browse_intents", "reply", "ignore"];
|
|
268
|
-
case "proposal_received":
|
|
269
|
-
return ["accept_proposal", "reject_proposal", "reply", "ignore"];
|
|
270
|
-
case "intent_accepted":
|
|
271
|
-
return ["complete_intent", "reply", "ignore"];
|
|
272
|
-
// Signals handled by runtime dispatchers but informational in getAvailableActions
|
|
273
|
-
case "new_project":
|
|
274
|
-
case "interesting_project":
|
|
275
|
-
return ["propose_collab", "reply", "ignore"];
|
|
276
|
-
case "bounty_access_denied":
|
|
277
|
-
return ["ignore"];
|
|
278
|
-
case "task_created":
|
|
279
|
-
case "task_deleted":
|
|
280
|
-
case "status_updated":
|
|
281
|
-
return ["reply", "ignore"];
|
|
282
|
-
case "welcome_guide":
|
|
283
|
-
return ["reply", "create_post", "ignore"];
|
|
284
|
-
case "onboarding_suggestion":
|
|
285
|
-
return ["reply", "ignore"];
|
|
286
|
-
case "specialization_path":
|
|
287
|
-
return ["reply", "record_gap", "update_proficiency", "search_skills", "install_skill", "store_memory", "ignore"];
|
|
288
|
-
case "new_bundle_in_domain":
|
|
289
|
-
return ["cite_insight", "reply", "ignore"];
|
|
290
|
-
case "bundle_cited":
|
|
291
|
-
return ["ignore"];
|
|
292
|
-
case "webhook_received":
|
|
293
|
-
case "webhook.received":
|
|
294
|
-
return ["reply", "egress_request", "execute_tool", "ignore"];
|
|
295
|
-
case "email_received":
|
|
296
|
-
return ["reply_email", "send_email", "send_dm", "ignore"];
|
|
297
|
-
case "teaching_proposed":
|
|
298
|
-
return ["accept_teaching", "reject_teaching", "reply", "ignore"];
|
|
299
|
-
case "teaching_accepted":
|
|
300
|
-
return ["deliver_teaching", "reply", "ignore"];
|
|
301
|
-
case "teaching_delivered":
|
|
302
|
-
return ["approve_teaching", "reject_teaching", "reply", "ignore"];
|
|
303
|
-
case "teaching_opportunity":
|
|
304
|
-
return ["propose_teaching", "search_teachers", "reply", "ignore"];
|
|
305
|
-
case "credit_agreement_created":
|
|
306
|
-
return ["accept_credit_agreement", "cancel_credit_agreement", "reply", "ignore"];
|
|
307
|
-
case "credit_work_delivered":
|
|
308
|
-
return ["complete_credit_agreement", "cancel_credit_agreement", "reply", "ignore"];
|
|
309
|
-
case "credit_agreement_accepted":
|
|
310
|
-
return ["deliver_credit_work", "cancel_credit_agreement", "reply", "ignore"];
|
|
311
|
-
case "bounty_opportunity":
|
|
312
|
-
return ["apply_bounty", "send_dm", "reply", "ignore"];
|
|
313
|
-
default:
|
|
314
|
-
return ["reply", "ignore"];
|
|
315
|
-
}
|
|
108
|
+
export function getAvailableActions(signalType, loadedCategories) {
|
|
109
|
+
return getAvailableActionsFromMap(signalType, loadedCategories ?? new Set());
|
|
316
110
|
}
|
|
317
111
|
export class AutonomousAgent {
|
|
318
112
|
runtime;
|
|
@@ -326,6 +120,8 @@ export class AutonomousAgent {
|
|
|
326
120
|
channelCooldowns = new Map();
|
|
327
121
|
/** Dedup: tracks signal keys already processed. Entries expire after 1h. */
|
|
328
122
|
processedSignals = new Map();
|
|
123
|
+
/** Dynamic tool browsing: categories loaded via browse_tools. */
|
|
124
|
+
loadedCategories = new Set();
|
|
329
125
|
constructor(runtime, options = {}) {
|
|
330
126
|
this.runtime = runtime;
|
|
331
127
|
this.verbose = options.verbose ?? true;
|
|
@@ -510,11 +306,23 @@ export class AutonomousAgent {
|
|
|
510
306
|
const now = Date.now();
|
|
511
307
|
// Prune old entries (>24h) — long TTL prevents duplicate replies to the same
|
|
512
308
|
// post/signal when the server-side scan re-discovers content before the indexer
|
|
513
|
-
// updates comment_count.
|
|
309
|
+
// updates comment_count. Also cap map size to prevent unbounded growth.
|
|
514
310
|
for (const [k, ts] of this.processedSignals) {
|
|
515
311
|
if (now - ts > 86_400_000)
|
|
516
312
|
this.processedSignals.delete(k);
|
|
517
313
|
}
|
|
314
|
+
if (this.processedSignals.size > 10_000) {
|
|
315
|
+
// Evict oldest half to prevent memory leak in long-lived agents
|
|
316
|
+
const entries = [...this.processedSignals.entries()].sort((a, b) => a[1] - b[1]);
|
|
317
|
+
for (let i = 0; i < entries.length / 2; i++)
|
|
318
|
+
this.processedSignals.delete(entries[i][0]);
|
|
319
|
+
}
|
|
320
|
+
// Prune expired channel cooldowns (older than 2x cooldown period)
|
|
321
|
+
const cooldownTtl = this.cooldownSec * 2000;
|
|
322
|
+
for (const [ch, ts] of this.channelCooldowns) {
|
|
323
|
+
if (now - ts > cooldownTtl)
|
|
324
|
+
this.channelCooldowns.delete(ch);
|
|
325
|
+
}
|
|
518
326
|
if (this.processedSignals.has(dedupKey)) {
|
|
519
327
|
if (this.verbose) {
|
|
520
328
|
console.log(`[autonomous] Duplicate signal skipped: ${signalType} (${dedupKey})`);
|
|
@@ -2596,6 +2404,23 @@ export class AutonomousAgent {
|
|
|
2596
2404
|
try {
|
|
2597
2405
|
let txHash;
|
|
2598
2406
|
let result;
|
|
2407
|
+
// ── Intercept browse_tools (client-side, no gateway call needed) ──
|
|
2408
|
+
if (actionType === "browse_tools") {
|
|
2409
|
+
const category = payload?.category;
|
|
2410
|
+
if (!category) {
|
|
2411
|
+
const listing = getCategoryListing();
|
|
2412
|
+
if (this.verbose) {
|
|
2413
|
+
console.log(`[autonomous] browse_tools — ${listing.length} categories: ${listing.map((c) => `${c.name} (${c.count})`).join(", ")}`);
|
|
2414
|
+
}
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
this.loadedCategories.add(category);
|
|
2418
|
+
const tools = getToolsInCategory(category);
|
|
2419
|
+
if (this.verbose) {
|
|
2420
|
+
console.log(`[autonomous] browse_tools — loaded ${tools.length} tools from "${category}"`);
|
|
2421
|
+
}
|
|
2422
|
+
return;
|
|
2423
|
+
}
|
|
2599
2424
|
// ── Unified dispatch via POST /v1/actions/execute ──
|
|
2600
2425
|
// The gateway's ToolDispatcher routes the call to the correct internal
|
|
2601
2426
|
// endpoint, replacing the 2000+ line switch statement that was here before.
|