wave-agent-sdk 0.14.0 → 0.14.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.
Files changed (88) hide show
  1. package/builtin/skills/settings/HOOKS.md +69 -0
  2. package/builtin/skills/settings/PLUGINS.md +171 -0
  3. package/builtin/skills/settings/SKILL.md +8 -3
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.d.ts.map +1 -1
  6. package/dist/agent.js +12 -3
  7. package/dist/core/plugin.d.ts +2 -2
  8. package/dist/core/plugin.d.ts.map +1 -1
  9. package/dist/core/plugin.js +7 -7
  10. package/dist/managers/aiManager.d.ts +6 -6
  11. package/dist/managers/aiManager.d.ts.map +1 -1
  12. package/dist/managers/aiManager.js +122 -59
  13. package/dist/managers/backgroundTaskManager.d.ts.map +1 -1
  14. package/dist/managers/backgroundTaskManager.js +28 -30
  15. package/dist/managers/hookManager.d.ts +16 -1
  16. package/dist/managers/hookManager.d.ts.map +1 -1
  17. package/dist/managers/hookManager.js +97 -8
  18. package/dist/managers/messageManager.d.ts +19 -4
  19. package/dist/managers/messageManager.d.ts.map +1 -1
  20. package/dist/managers/messageManager.js +63 -18
  21. package/dist/managers/pluginManager.d.ts.map +1 -1
  22. package/dist/managers/pluginManager.js +1 -1
  23. package/dist/prompts/index.d.ts +1 -1
  24. package/dist/prompts/index.d.ts.map +1 -1
  25. package/dist/prompts/index.js +1 -1
  26. package/dist/services/MarketplaceService.d.ts +42 -12
  27. package/dist/services/MarketplaceService.d.ts.map +1 -1
  28. package/dist/services/MarketplaceService.js +225 -105
  29. package/dist/services/aiService.d.ts +3 -3
  30. package/dist/services/aiService.d.ts.map +1 -1
  31. package/dist/services/aiService.js +7 -7
  32. package/dist/services/configurationService.d.ts +17 -1
  33. package/dist/services/configurationService.d.ts.map +1 -1
  34. package/dist/services/configurationService.js +104 -0
  35. package/dist/services/hook.d.ts.map +1 -1
  36. package/dist/services/hook.js +15 -0
  37. package/dist/services/initializationService.d.ts.map +1 -1
  38. package/dist/services/initializationService.js +24 -1
  39. package/dist/services/interactionService.js +1 -1
  40. package/dist/services/pluginLoader.d.ts.map +1 -1
  41. package/dist/services/pluginLoader.js +7 -1
  42. package/dist/services/session.d.ts +1 -1
  43. package/dist/services/session.js +7 -7
  44. package/dist/services/taskManager.d.ts +1 -1
  45. package/dist/services/taskManager.js +1 -1
  46. package/dist/types/configuration.d.ts +7 -0
  47. package/dist/types/configuration.d.ts.map +1 -1
  48. package/dist/types/core.d.ts +1 -1
  49. package/dist/types/core.d.ts.map +1 -1
  50. package/dist/types/hooks.d.ts +9 -1
  51. package/dist/types/hooks.d.ts.map +1 -1
  52. package/dist/types/hooks.js +2 -0
  53. package/dist/types/marketplace.d.ts +2 -0
  54. package/dist/types/marketplace.d.ts.map +1 -1
  55. package/dist/types/messaging.d.ts +3 -3
  56. package/dist/types/messaging.d.ts.map +1 -1
  57. package/dist/utils/convertMessagesForAPI.d.ts +1 -1
  58. package/dist/utils/convertMessagesForAPI.js +7 -7
  59. package/dist/utils/groupMessagesByApiRound.d.ts +1 -1
  60. package/dist/utils/groupMessagesByApiRound.js +6 -6
  61. package/dist/utils/messageOperations.d.ts.map +1 -1
  62. package/dist/utils/messageOperations.js +3 -3
  63. package/package.json +1 -1
  64. package/src/agent.ts +16 -3
  65. package/src/core/plugin.ts +13 -7
  66. package/src/managers/aiManager.ts +142 -63
  67. package/src/managers/backgroundTaskManager.ts +33 -42
  68. package/src/managers/hookManager.ts +125 -10
  69. package/src/managers/messageManager.ts +76 -22
  70. package/src/managers/pluginManager.ts +4 -1
  71. package/src/prompts/index.ts +1 -1
  72. package/src/services/MarketplaceService.ts +301 -111
  73. package/src/services/aiService.ts +11 -11
  74. package/src/services/configurationService.ts +131 -0
  75. package/src/services/hook.ts +17 -0
  76. package/src/services/initializationService.ts +33 -1
  77. package/src/services/interactionService.ts +1 -1
  78. package/src/services/pluginLoader.ts +7 -1
  79. package/src/services/session.ts +7 -7
  80. package/src/services/taskManager.ts +1 -1
  81. package/src/types/configuration.ts +8 -0
  82. package/src/types/core.ts +1 -1
  83. package/src/types/hooks.ts +16 -2
  84. package/src/types/marketplace.ts +2 -0
  85. package/src/types/messaging.ts +3 -3
  86. package/src/utils/convertMessagesForAPI.ts +8 -8
  87. package/src/utils/groupMessagesByApiRound.ts +6 -6
  88. package/src/utils/messageOperations.ts +3 -5
@@ -9,6 +9,7 @@ export class MessageManager {
9
9
  this.container = container;
10
10
  this.filesInContext = new Set(); // Track files mentioned in the conversation
11
11
  this.recentFileReads = new Map(); // Track file read contents
12
+ this.invokedSkills = new Map(); // Track invoked skill names
12
13
  this._usages = [];
13
14
  this.sessionId = generateSessionId();
14
15
  this.rootSessionId = this.sessionId;
@@ -152,11 +153,13 @@ export class MessageManager {
152
153
  for (const message of newMessages) {
153
154
  this.addPathsFromMessage(message);
154
155
  this.extractFileReadsFromMessage(message);
156
+ this.extractSkillInvocationsFromMessage(message);
155
157
  }
156
158
  // Also check if the last message was updated (common for tool blocks)
157
159
  if (messages.length > 0 && messages.length === oldLength) {
158
160
  this.addPathsFromMessage(messages[messages.length - 1]);
159
161
  this.extractFileReadsFromMessage(messages[messages.length - 1]);
162
+ this.extractSkillInvocationsFromMessage(messages[messages.length - 1]);
160
163
  }
161
164
  this.callbacks.onMessagesChange?.([...messages]);
162
165
  }
@@ -317,26 +320,26 @@ export class MessageManager {
317
320
  }
318
321
  }
319
322
  /**
320
- * Compress messages and update session, delete compressed messages, only keep compressed messages and last 3 messages
323
+ * Compact messages and update session, delete compacted messages, only keep compacted messages and last 3 messages
321
324
  */
322
- compressMessagesAndUpdateSession(compressedContent, usage) {
325
+ compactMessagesAndUpdateSession(compactedContent, usage) {
323
326
  // Get last 2 API rounds to preserve (structurally safe boundary)
324
327
  const lastThreeMessages = getLastApiRounds(this.messages, 2);
325
- // Create compressed message
326
- const compressMessage = {
328
+ // Create compacted message
329
+ const compactMessage = {
327
330
  id: generateMessageId(),
328
331
  role: "assistant",
329
332
  blocks: [
330
333
  {
331
- type: "compress",
332
- content: compressedContent,
334
+ type: "compact",
335
+ content: compactedContent,
333
336
  sessionId: this.sessionId,
334
337
  },
335
338
  ],
336
339
  ...(usage && { usage }),
337
340
  };
338
- // Build new message array: keep the compressed message and last 3 messages
339
- const newMessages = [compressMessage, ...lastThreeMessages];
341
+ // Build new message array: keep the compacted message and last 3 messages
342
+ const newMessages = [compactMessage, ...lastThreeMessages];
340
343
  // Update sessionId and parentSessionId
341
344
  const oldSessionId = this.sessionId;
342
345
  this.setSessionId(generateSessionId());
@@ -352,14 +355,14 @@ export class MessageManager {
352
355
  for (const message of this.messages) {
353
356
  this.addPathsFromMessage(message);
354
357
  }
355
- // Scan compressedContent for file mentions
358
+ // Scan compactedContent for file mentions
356
359
  const fileMentionRegex = /(?:^|\s)@([\w.\-/]+)/g;
357
360
  let match;
358
- while ((match = fileMentionRegex.exec(compressedContent)) !== null) {
361
+ while ((match = fileMentionRegex.exec(compactedContent)) !== null) {
359
362
  this.touchFile(match[1]);
360
363
  }
361
- // Trigger compression callback
362
- this.callbacks.onCompressBlockAdded?.(compressedContent);
364
+ // Trigger compaction callback
365
+ this.callbacks.onCompactBlockAdded?.(compactedContent);
363
366
  }
364
367
  addFileHistoryBlock(snapshots) {
365
368
  if (snapshots.length === 0)
@@ -597,7 +600,7 @@ export class MessageManager {
597
600
  // Find which session the index belongs to
598
601
  let targetSessionId = this.sessionId;
599
602
  let targetIndexInSession = index;
600
- // We need to be careful here because loadFullMessageThread might have removed "compress" blocks
603
+ // We need to be careful here because loadFullMessageThread might have removed "compact" blocks
601
604
  // Let's re-calculate based on the actual messages returned.
602
605
  // Actually, it's easier to just load sessions one by one again or keep track of counts.
603
606
  // For simplicity, let's assume we want to truncate the WHOLE thread.
@@ -615,15 +618,15 @@ export class MessageManager {
615
618
  if (!sessionData)
616
619
  continue;
617
620
  const sessionMessages = sessionData.messages;
618
- // If this is not the first session in the thread, it might have a compress block at the start
621
+ // If this is not the first session in the thread, it might have a compact block at the start
619
622
  // that was removed in getFullMessageThread.
620
- const hasCompressBlock = sessionMessages[0]?.blocks.some((b) => b.type === "compress");
621
- const effectiveMessages = hasCompressBlock && sid !== sessionIds[0]
623
+ const hasCompactBlock = sessionMessages[0]?.blocks.some((b) => b.type === "compact");
624
+ const effectiveMessages = hasCompactBlock && sid !== sessionIds[0]
622
625
  ? sessionMessages.slice(1)
623
626
  : sessionMessages;
624
627
  if (remainingIndex < effectiveMessages.length) {
625
628
  targetSessionId = sid;
626
- targetIndexInSession = hasCompressBlock
629
+ targetIndexInSession = hasCompactBlock
627
630
  ? remainingIndex + 1
628
631
  : remainingIndex;
629
632
  break;
@@ -653,7 +656,7 @@ export class MessageManager {
653
656
  await this.rewriteSessionFile(newMessagesInSession);
654
657
  // Update in-memory messages to the truncated session messages
655
658
  // We do NOT include ancestor messages here to avoid exceeding context limits.
656
- // The 'compress' block at the start of the session (if any) already summarizes them.
659
+ // The 'compact' block at the start of the session (if any) already summarizes them.
657
660
  this.setMessages(newMessagesInSession);
658
661
  // Update saved message count
659
662
  this.savedMessageCount = newMessagesInSession.length;
@@ -751,4 +754,46 @@ export class MessageManager {
751
754
  }
752
755
  return result;
753
756
  }
757
+ /**
758
+ * Extract skill invocations from tool blocks in a message.
759
+ */
760
+ extractSkillInvocationsFromMessage(message) {
761
+ for (const block of message.blocks) {
762
+ if (block.type === "tool" &&
763
+ block.name === "Skill" &&
764
+ block.stage === "end" &&
765
+ block.parameters) {
766
+ try {
767
+ const params = JSON.parse(block.parameters);
768
+ const skillName = params.skill_name;
769
+ if (skillName) {
770
+ this.invokedSkills.set(skillName, {
771
+ skillName,
772
+ timestamp: Date.now(),
773
+ });
774
+ }
775
+ }
776
+ catch {
777
+ // Ignore parse errors
778
+ }
779
+ }
780
+ }
781
+ }
782
+ /**
783
+ * Get recently invoked skill names, sorted by timestamp (newest first).
784
+ * @param maxSkills - Maximum number of skills to return
785
+ * @returns Array of skill names sorted by recency
786
+ */
787
+ getInvokedSkillNames(maxSkills = 10) {
788
+ const sorted = Array.from(this.invokedSkills.entries())
789
+ .sort(([, a], [, b]) => b.timestamp - a.timestamp)
790
+ .slice(0, maxSkills);
791
+ return sorted.map(([, { skillName }]) => skillName);
792
+ }
793
+ /**
794
+ * Clear all invoked skills (e.g., after compaction).
795
+ */
796
+ clearInvokedSkills() {
797
+ this.invokedSkills.clear();
798
+ }
754
799
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../../src/managers/pluginManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED,qBAAa,aAAa;IAMtB,OAAO,CAAC,SAAS;IALnB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAA0B;gBAGtC,SAAS,EAAE,SAAS,EAC5B,OAAO,EAAE,oBAAoB;IAM/B,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,mBAAmB,GAE9B;IAED,OAAO,KAAK,oBAAoB,GAE/B;IAED;;OAEG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAInE;;OAEG;YACW,oBAAoB;IAuElC;;OAEG;YACW,gBAAgB;IA2D9B;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzD;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE;IAItB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG5C"}
1
+ {"version":3,"file":"pluginManager.d.ts","sourceRoot":"","sources":["../../src/managers/pluginManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED,qBAAa,aAAa;IAMtB,OAAO,CAAC,SAAS;IALnB,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAA0B;gBAGtC,SAAS,EAAE,SAAS,EAC5B,OAAO,EAAE,oBAAoB;IAM/B,OAAO,KAAK,YAAY,GAEvB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,mBAAmB,GAE9B;IAED,OAAO,KAAK,oBAAoB,GAE/B;IAED;;OAEG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAInE;;OAEG;YACW,oBAAoB;IA0ElC;;OAEG;YACW,gBAAgB;IA2D9B;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzD;;OAEG;IACH,UAAU,IAAI,MAAM,EAAE;IAItB;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAG5C"}
@@ -42,7 +42,7 @@ export class PluginManager {
42
42
  if (this.configurationService) {
43
43
  this.enabledPlugins = this.configurationService.getMergedEnabledPlugins(this.workdir);
44
44
  }
45
- const marketplaceService = new MarketplaceService();
45
+ const marketplaceService = new MarketplaceService(this.workdir, this.configurationService);
46
46
  // Trigger auto-update for marketplaces in the background
47
47
  if (!process.env.VITEST) {
48
48
  marketplaceService.autoUpdateAll().catch((error) => {
@@ -12,7 +12,7 @@ export declare const OUTPUT_EFFICIENCY_PROMPT = "# Output efficiency\n\nIMPORTAN
12
12
  export declare const TONE_AND_STYLE_PROMPT = "# Tone and style\n\n- Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.\n- Your responses should be short and concise.\n- When referencing specific functions or pieces of code include the pattern file_path:line_number to allow the user to easily navigate to the source code location.\n- When referencing GitHub issues or pull requests, use the owner/repo#123 format (e.g. anthropics/claude-code#100) so they render as clickable links.\n- Do not use a colon before tool calls. Your tool calls may not be shown directly in the output, so text like \"Let me read the file:\" followed by a read tool call should just be \"Let me read the file.\" with a period.";
13
13
  export declare function buildPlanModePrompt(planFilePath: string, planExists: boolean, isSubagent?: boolean): string;
14
14
  export declare const DEFAULT_SYSTEM_PROMPT = "You are an interactive CLI tool that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.";
15
- export declare const COMPRESS_MESSAGES_SYSTEM_PROMPT = "You are continuing work on a software engineering task. Write a detailed continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.\n\nFirst, write your analysis in <analysis> tags as a thinking scratchpad:\n- Chronologically review the conversation\n- Identify user intents and goals\n- Note files read/modified, approaches tried, decisions made\n- Check for accuracy and completeness \u2014 ensure nothing critical is missing\n\nThen produce a structured summary in <summary> tags with these sections:\n\n## Primary Request and Intent\n- The user's core request and success criteria\n- Clarifications, constraints, or scope changes\n\n## Key Technical Concepts\n- Frameworks, libraries, patterns, architectural decisions\n\n## Files and Code Sections\n- Files read, modified, created (with full paths)\n- Critical code snippets (function signatures, bug fixes, key logic)\n- Focus on recent messages \u2014 include full code for important sections\n\n## Errors and Fixes\n- Errors encountered, root causes, how they were resolved\n- Approaches tried that didn't work and why\n\n## Problem Solving\n- Approach evolution, trade-offs considered, decisions made\n\n## All User Messages\n- Complete list of all user messages (non-tool content)\n- Preserve exact wording where load-bearing\n\n## Pending Tasks\n- Outstanding work, TODOs, unresolved questions\n\n## Current Work\n- What was being worked on at the time of summarization\n- Exact state of in-progress changes\n\n## Optional Next Step\n- Immediate next action needed\n- Include verbatim quotes from recent conversation if relevant\n\nBe concise but complete \u2014 include information that prevents duplicate work or repeated mistakes.\nRespond with text only. Do NOT call any tools.\nWrap your summary in <summary></summary> tags.";
15
+ export declare const COMPACT_MESSAGES_SYSTEM_PROMPT = "You are continuing work on a software engineering task. Write a detailed continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.\n\nFirst, write your analysis in <analysis> tags as a thinking scratchpad:\n- Chronologically review the conversation\n- Identify user intents and goals\n- Note files read/modified, approaches tried, decisions made\n- Check for accuracy and completeness \u2014 ensure nothing critical is missing\n\nThen produce a structured summary in <summary> tags with these sections:\n\n## Primary Request and Intent\n- The user's core request and success criteria\n- Clarifications, constraints, or scope changes\n\n## Key Technical Concepts\n- Frameworks, libraries, patterns, architectural decisions\n\n## Files and Code Sections\n- Files read, modified, created (with full paths)\n- Critical code snippets (function signatures, bug fixes, key logic)\n- Focus on recent messages \u2014 include full code for important sections\n\n## Errors and Fixes\n- Errors encountered, root causes, how they were resolved\n- Approaches tried that didn't work and why\n\n## Problem Solving\n- Approach evolution, trade-offs considered, decisions made\n\n## All User Messages\n- Complete list of all user messages (non-tool content)\n- Preserve exact wording where load-bearing\n\n## Pending Tasks\n- Outstanding work, TODOs, unresolved questions\n\n## Current Work\n- What was being worked on at the time of summarization\n- Exact state of in-progress changes\n\n## Optional Next Step\n- Immediate next action needed\n- Include verbatim quotes from recent conversation if relevant\n\nBe concise but complete \u2014 include information that prevents duplicate work or repeated mistakes.\nRespond with text only. Do NOT call any tools.\nWrap your summary in <summary></summary> tags.";
16
16
  export declare const WEB_CONTENT_SYSTEM_PROMPT = "You are a helpful assistant that extracts information from web content. The content is provided in Markdown format.";
17
17
  export declare const BTW_SYSTEM_PROMPT = "You are a helpful assistant. Answer the user's side question based on the conversation history. \nDo NOT say things like \"Let me try...\", \"I'll now...\", \"Let me check...\", or promise to take any action. \nIf you don't know the answer, say so - do not offer to look it up or investigate. \nSimply answer the question with the information you have.";
18
18
  export declare function buildSystemPrompt(basePrompt: string | undefined, tools: ToolPlugin[], options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAiBzD,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,eAAO,MAAM,kBAAkB,oKAAoK,CAAC;AAEpM,eAAO,MAAM,kBAAkB,opIAcqQ,CAAC;AAErS,eAAO,MAAM,wBAAwB,25DASqmB,CAAC;AAE3oB,eAAO,MAAM,WAAW,knDAYqH,CAAC;AAE9I;;GAEG;AACH,eAAO,MAAM,wBAAwB,+uBAWiH,CAAC;AAEvJ,eAAO,MAAM,qBAAqB,6sBAMuL,CAAC;AAE1N,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,OAAO,EACnB,UAAU,GAAE,OAAe,GAC1B,MAAM,CAmFR;AAED,eAAO,MAAM,qBAAqB,oKAAqB,CAAC;AAExD,eAAO,MAAM,+BAA+B,44DA8CG,CAAC;AAEhD,eAAO,MAAM,yBAAyB,wHAAwH,CAAC;AAC/J,eAAO,MAAM,iBAAiB,qWAG4B,CAAC;AAE3D,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC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AC;AAE3D,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,UAAU,EAAE,EACnB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,cAAc,CAAC;CAC5B,GACL,MAAM,CA+DR;AAED,wBAAgB,iCAAiC,CAC/C,oBAAoB,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,GACd,MAAM,CAgCR"}
@@ -148,7 +148,7 @@ This is critical - your turn should only end with either using the ${ASK_USER_QU
148
148
  NOTE: At any point in time through this workflow you should feel free to ask the user questions or clarifications using the ${ASK_USER_QUESTION_TOOL_NAME} tool. Don't make large assumptions about user intent. The goal is to present a well researched plan to the user, and tie any loose ends before implementation begins.`;
149
149
  }
150
150
  export const DEFAULT_SYSTEM_PROMPT = BASE_SYSTEM_PROMPT;
151
- export const COMPRESS_MESSAGES_SYSTEM_PROMPT = `You are continuing work on a software engineering task. Write a detailed continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.
151
+ export const COMPACT_MESSAGES_SYSTEM_PROMPT = `You are continuing work on a software engineering task. Write a detailed continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary.
152
152
 
153
153
  First, write your analysis in <analysis> tags as a thinking scratchpad:
154
154
  - Chronologically review the conversation
@@ -1,9 +1,14 @@
1
- import { KnownMarketplace, KnownMarketplacesRegistry, InstalledPlugin, InstalledPluginsRegistry, MarketplaceManifest } from "../types/marketplace.js";
1
+ import { KnownMarketplace, KnownMarketplacesRegistry, InstalledPlugin, InstalledPluginsRegistry, MarketplaceManifest, MarketplaceSource } from "../types/marketplace.js";
2
+ import { ConfigurationService } from "./configurationService.js";
3
+ import type { Scope } from "../types/configuration.js";
2
4
  /**
3
5
  * Marketplace Service
4
6
  *
5
7
  * Handles local plugin marketplace registration, plugin installation,
6
8
  * and state management for installed plugins.
9
+ *
10
+ * Marketplace declarations are now scoped (user/project/local) via settings files.
11
+ * known_marketplaces.json is kept as a cache for installLocation/lastUpdated metadata.
7
12
  */
8
13
  export declare class MarketplaceService {
9
14
  private static isLockedInProcess;
@@ -15,12 +20,19 @@ export declare class MarketplaceService {
15
20
  private cacheDir;
16
21
  private marketplacesDir;
17
22
  private gitService;
23
+ private configurationService;
24
+ private workdir;
18
25
  private static readonly BUILTIN_MARKETPLACE;
19
- constructor();
26
+ constructor(workdir?: string, configurationService?: ConfigurationService);
20
27
  /**
21
28
  * Ensures the required directory structure exists in ~/.wave/plugins
22
29
  */
23
30
  private ensureDirectoryStructure;
31
+ /**
32
+ * Backwards compatibility migration: migrate entries from known_marketplaces.json
33
+ * to user-level settings if they aren't already declared there.
34
+ */
35
+ private runMigration;
24
36
  /**
25
37
  * Check if a lock file is stale by reading its PID and checking if the process is alive.
26
38
  * Returns true if the lock is stale and safe to remove.
@@ -32,17 +44,27 @@ export declare class MarketplaceService {
32
44
  */
33
45
  private withLock;
34
46
  /**
35
- * Loads the known marketplaces registry
47
+ * Loads the cache registry from known_marketplaces.json
48
+ * Returns null if the file doesn't exist or has no parseable content (for first-run detection).
49
+ */
50
+ getCacheRegistry(): Promise<KnownMarketplacesRegistry | null>;
51
+ /**
52
+ * Legacy method: loads known marketplaces with builtin injection.
53
+ * @deprecated Use listMarketplaces() instead, which combines scoped settings.
36
54
  */
37
55
  getKnownMarketplaces(): Promise<KnownMarketplacesRegistry>;
38
56
  /**
39
- * Loads the installed plugins registry
57
+ * Updates the cache registry with metadata for a marketplace
40
58
  */
41
- getInstalledPlugins(): Promise<InstalledPluginsRegistry>;
59
+ private updateCacheMarketplace;
42
60
  /**
43
- * Saves the known marketplaces registry
61
+ * Removes a marketplace from the cache registry
44
62
  */
45
- saveKnownMarketplaces(registry: KnownMarketplacesRegistry): Promise<void>;
63
+ private removeFromCache;
64
+ /**
65
+ * Loads the installed plugins registry
66
+ */
67
+ getInstalledPlugins(): Promise<InstalledPluginsRegistry>;
46
68
  /**
47
69
  * Saves the installed plugins registry
48
70
  */
@@ -54,19 +76,27 @@ export declare class MarketplaceService {
54
76
  /**
55
77
  * Resolves the local path for a marketplace
56
78
  */
57
- getMarketplacePath(marketplace: KnownMarketplace): string;
79
+ getMarketplacePath(source: MarketplaceSource): string;
80
+ /**
81
+ * Builds a KnownMarketplace from a scoped config, enriched with cache metadata
82
+ */
83
+ private buildMarketplaceEntry;
84
+ /**
85
+ * Finds which scope declared a marketplace (user, project, local, or builtin)
86
+ */
87
+ getMarketplaceDeclaringSource(name: string): Scope | "builtin" | null;
58
88
  /**
59
89
  * Adds a new marketplace (local directory, GitHub repo, or Git URL)
60
90
  */
61
- addMarketplace(input: string): Promise<KnownMarketplace>;
91
+ addMarketplace(input: string, scope?: Scope): Promise<KnownMarketplace>;
62
92
  /**
63
- * Lists all registered marketplaces
93
+ * Lists all registered marketplaces by combining scoped settings + built-in
64
94
  */
65
95
  listMarketplaces(): Promise<KnownMarketplace[]>;
66
96
  /**
67
- * Removes a marketplace by name
97
+ * Removes a marketplace by name from the specified scope
68
98
  */
69
- removeMarketplace(name: string): Promise<void>;
99
+ removeMarketplace(name: string, scope?: Scope): Promise<void>;
70
100
  /**
71
101
  * Updates a specific marketplace or all marketplaces
72
102
  */
@@ -1 +1 @@
1
- {"version":3,"file":"MarketplaceService.d.ts","sourceRoot":"","sources":["../../src/services/MarketplaceService.ts"],"names":[],"mappings":"AAIA,OAAO,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