@vincentwei1021/synapse-openclaw-plugin 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/event-router.ts +15 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincentwei1021/synapse-openclaw-plugin",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "OpenClaw plugin for Synapse research orchestration — SSE notifications, MCP tools, experiment lifecycle, autonomous loop",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -323,33 +323,38 @@ Proposed experiments will enter "pending_review" status and require human approv
323
323
  );
324
324
  }
325
325
 
326
+ private static readonly DEFAULT_DEEP_RESEARCH_MSG = "Generate a deep research literature review for this project.";
327
+ private static readonly DEFAULT_AUTO_SEARCH_MSG = "Search for related papers for this project.";
328
+
326
329
  private handleDeepResearchRequested(n: NotificationDetail): void {
327
330
  const projectUuid = n.projectUuid ?? n.researchProjectUuid ?? "";
331
+ const hasCustomPrompt = n.message !== SynapseEventRouter.DEFAULT_DEEP_RESEARCH_MSG;
328
332
 
329
- this.triggerAgent(
330
- `[Synapse] Deep research literature review requested for project (projectUuid: ${projectUuid}).
331
-
332
- 1. Use synapse_get_related_works with researchProjectUuid "${projectUuid}" to read all collected papers
333
+ const defaultPrompt = `1. Use synapse_get_related_works with researchProjectUuid "${projectUuid}" to read all collected papers
333
334
  2. Use synapse_get_project_full_context with researchProjectUuid "${projectUuid}" to understand the research objectives
334
335
  3. Analyze how each paper relates to the project's goals — identify key methods, findings, and gaps in the literature
335
- 4. Create a comprehensive literature review document summarizing your analysis`,
336
+ 4. Create a comprehensive literature review document summarizing your analysis`;
337
+
338
+ this.triggerAgent(
339
+ `[Synapse] Deep research literature review requested for project (projectUuid: ${projectUuid}).\n\n${hasCustomPrompt ? n.message : defaultPrompt}`,
336
340
  { notificationUuid: n.uuid, action: "deep_research_requested", entityUuid: n.entityUuid, projectUuid }
337
341
  );
338
342
  }
339
343
 
340
344
  private handleAutoSearchTriggered(n: NotificationDetail): void {
341
345
  const projectUuid = n.projectUuid ?? n.researchProjectUuid ?? "";
346
+ const hasCustomPrompt = n.message !== SynapseEventRouter.DEFAULT_AUTO_SEARCH_MSG;
342
347
 
343
- this.triggerAgent(
344
- `[Synapse] Paper search requested for project "${n.entityTitle}" (projectUuid: ${projectUuid}).
345
-
346
- Search for academic papers related to this research project:
348
+ const defaultPrompt = `Search for academic papers related to this research project:
347
349
  1. Use synapse_get_related_works with researchProjectUuid "${projectUuid}" to see what papers are already collected — avoid searching for topics already well-covered
348
350
  2. Use synapse_get_project_full_context with researchProjectUuid "${projectUuid}" to understand the research objectives, datasets, and methods
349
351
  3. Based on the project context and gaps in existing papers, use synapse_search_papers to find new relevant academic papers
350
352
  4. For each relevant paper found, use synapse_add_related_work with researchProjectUuid "${projectUuid}" to add it (duplicates are automatically skipped — if isNew=false, the paper already existed)
351
353
  5. Search with multiple query variations to maximize coverage, but call synapse_search_papers sequentially (one at a time) to avoid rate limits
352
- 6. Focus on papers that fill gaps not covered by existing related works`,
354
+ 6. Focus on papers that fill gaps not covered by existing related works`;
355
+
356
+ this.triggerAgent(
357
+ `[Synapse] Paper search requested for project "${n.entityTitle}" (projectUuid: ${projectUuid}).\n\n${hasCustomPrompt ? n.message : defaultPrompt}`,
353
358
  { notificationUuid: n.uuid, action: "auto_search_triggered", entityUuid: n.entityUuid, projectUuid }
354
359
  );
355
360
  }