crewly 1.4.39 → 1.4.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.
Files changed (190) hide show
  1. package/config/constants.ts +5 -11
  2. package/config/orchestrator_tasks/prompts/orchestrator-prompt.md +11 -12
  3. package/config/roles/architect/prompt.md +1 -5
  4. package/config/roles/backend-developer/prompt.md +1 -5
  5. package/config/roles/content-strategist/prompt.md +1 -5
  6. package/config/roles/designer/prompt.md +1 -5
  7. package/config/roles/developer/prompt.md +1 -7
  8. package/config/roles/developer/soul.md +18 -0
  9. package/config/roles/frontend-developer/prompt.md +1 -5
  10. package/config/roles/fullstack-dev/prompt.md +1 -5
  11. package/config/roles/generalist/prompt.md +1 -7
  12. package/config/roles/ops/prompt.md +1 -7
  13. package/config/roles/orchestrator/prompt.md +44 -44
  14. package/config/roles/orchestrator/soul.md +18 -0
  15. package/config/roles/product-manager/prompt.md +1 -5
  16. package/config/roles/qa/prompt.md +1 -5
  17. package/config/roles/qa-engineer/prompt.md +1 -5
  18. package/config/roles/researcher/prompt.md +1 -5
  19. package/config/roles/researcher/soul.md +18 -0
  20. package/config/roles/sales/prompt.md +1 -5
  21. package/config/roles/support/prompt.md +1 -5
  22. package/config/roles/team-leader/prompt.md +2 -6
  23. package/config/roles/tpm/prompt.md +1 -5
  24. package/config/roles/ux-designer/prompt.md +1 -5
  25. package/config/skills/_common/lib.sh +2 -8
  26. package/config/skills/agent/chrome-attach/SKILL.md +84 -0
  27. package/config/skills/agent/core/complete-task/execute.sh +1 -1
  28. package/config/skills/agent/vnc-browser/SKILL.md +140 -0
  29. package/config/souls/developer.md +30 -0
  30. package/config/souls/orchestrator.md +30 -0
  31. package/config/souls/researcher.md +30 -0
  32. package/config/templates/agent-agents-md.md +18 -7
  33. package/config/templates/agent-claude-md.md +1 -1
  34. package/config/templates/agent-gemini-md.md +18 -7
  35. package/config/templates/content-generation-team/team-config.json +1 -2
  36. package/dist/backend/backend/src/constants.d.ts +5 -5
  37. package/dist/backend/backend/src/constants.d.ts.map +1 -1
  38. package/dist/backend/backend/src/constants.js +3 -3
  39. package/dist/backend/backend/src/constants.js.map +1 -1
  40. package/dist/backend/backend/src/controllers/approvals/approvals.controller.d.ts +0 -44
  41. package/dist/backend/backend/src/controllers/approvals/approvals.controller.d.ts.map +1 -1
  42. package/dist/backend/backend/src/controllers/approvals/approvals.controller.js +0 -74
  43. package/dist/backend/backend/src/controllers/approvals/approvals.controller.js.map +1 -1
  44. package/dist/backend/backend/src/controllers/approvals/approvals.routes.d.ts +1 -1
  45. package/dist/backend/backend/src/controllers/approvals/approvals.routes.d.ts.map +1 -1
  46. package/dist/backend/backend/src/controllers/approvals/approvals.routes.js +2 -4
  47. package/dist/backend/backend/src/controllers/approvals/approvals.routes.js.map +1 -1
  48. package/dist/backend/backend/src/controllers/quality-gate/quality-gate.controller.js +3 -3
  49. package/dist/backend/backend/src/controllers/quality-gate/quality-gate.controller.js.map +1 -1
  50. package/dist/backend/backend/src/controllers/slack/slack.controller.d.ts.map +1 -1
  51. package/dist/backend/backend/src/controllers/slack/slack.controller.js +0 -12
  52. package/dist/backend/backend/src/controllers/slack/slack.controller.js.map +1 -1
  53. package/dist/backend/backend/src/routes/api.routes.d.ts.map +1 -1
  54. package/dist/backend/backend/src/routes/api.routes.js +0 -13
  55. package/dist/backend/backend/src/routes/api.routes.js.map +1 -1
  56. package/dist/backend/backend/src/services/agent/agent-registration.service.d.ts.map +1 -1
  57. package/dist/backend/backend/src/services/agent/agent-registration.service.js +16 -16
  58. package/dist/backend/backend/src/services/agent/agent-registration.service.js.map +1 -1
  59. package/dist/backend/backend/src/services/agent/auditor-scheduler.service.d.ts.map +1 -1
  60. package/dist/backend/backend/src/services/agent/auditor-scheduler.service.js +3 -18
  61. package/dist/backend/backend/src/services/agent/auditor-scheduler.service.js.map +1 -1
  62. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.d.ts +1 -20
  63. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.d.ts.map +1 -1
  64. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.js +8 -64
  65. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.js.map +1 -1
  66. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.d.ts.map +1 -1
  67. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.js +16 -4
  68. package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.js.map +1 -1
  69. package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.d.ts.map +1 -1
  70. package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.js +11 -0
  71. package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.js.map +1 -1
  72. package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts +46 -0
  73. package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts.map +1 -0
  74. package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js +145 -0
  75. package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js.map +1 -0
  76. package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.d.ts +129 -0
  77. package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.d.ts.map +1 -0
  78. package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.js +202 -0
  79. package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.js.map +1 -0
  80. package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.d.ts +28 -0
  81. package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.d.ts.map +1 -0
  82. package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.js +47 -0
  83. package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.js.map +1 -0
  84. package/dist/backend/backend/src/services/ai/prompt-modules/index.d.ts +22 -0
  85. package/dist/backend/backend/src/services/ai/prompt-modules/index.d.ts.map +1 -0
  86. package/dist/backend/backend/src/services/ai/prompt-modules/index.js +26 -0
  87. package/dist/backend/backend/src/services/ai/prompt-modules/index.js.map +1 -0
  88. package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.d.ts +28 -0
  89. package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.d.ts.map +1 -0
  90. package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.js +55 -0
  91. package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.js.map +1 -0
  92. package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.d.ts +44 -0
  93. package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.d.ts.map +1 -0
  94. package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.js +112 -0
  95. package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.js.map +1 -0
  96. package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.d.ts +28 -0
  97. package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.d.ts.map +1 -0
  98. package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.js +46 -0
  99. package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.js.map +1 -0
  100. package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.d.ts +29 -0
  101. package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.d.ts.map +1 -0
  102. package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.js +50 -0
  103. package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.js.map +1 -0
  104. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.d.ts +86 -0
  105. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.d.ts.map +1 -0
  106. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.js +212 -0
  107. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.js.map +1 -0
  108. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.d.ts +100 -0
  109. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.d.ts.map +1 -0
  110. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.js +23 -0
  111. package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.js.map +1 -0
  112. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.d.ts +34 -0
  113. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.d.ts.map +1 -0
  114. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.js +61 -0
  115. package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.js.map +1 -0
  116. package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.d.ts +55 -0
  117. package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.d.ts.map +1 -0
  118. package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.js +96 -0
  119. package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.js.map +1 -0
  120. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts +28 -0
  121. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -0
  122. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +65 -0
  123. package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -0
  124. package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.d.ts +60 -0
  125. package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.d.ts.map +1 -0
  126. package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.js +112 -0
  127. package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.js.map +1 -0
  128. package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.d.ts +54 -0
  129. package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.d.ts.map +1 -0
  130. package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.js +149 -0
  131. package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.js.map +1 -0
  132. package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.d.ts +28 -0
  133. package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.d.ts.map +1 -0
  134. package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.js +53 -0
  135. package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.js.map +1 -0
  136. package/dist/backend/backend/src/services/cloud/cloud-auth.middleware.d.ts +12 -0
  137. package/dist/backend/backend/src/services/cloud/cloud-auth.middleware.d.ts.map +1 -1
  138. package/dist/backend/backend/src/services/cloud/cloud-auth.middleware.js +41 -6
  139. package/dist/backend/backend/src/services/cloud/cloud-auth.middleware.js.map +1 -1
  140. package/dist/backend/backend/src/services/core/storage.service.d.ts +7 -0
  141. package/dist/backend/backend/src/services/core/storage.service.d.ts.map +1 -1
  142. package/dist/backend/backend/src/services/core/storage.service.js +9 -0
  143. package/dist/backend/backend/src/services/core/storage.service.js.map +1 -1
  144. package/dist/backend/backend/src/services/messaging/queue-processor.service.d.ts.map +1 -1
  145. package/dist/backend/backend/src/services/messaging/queue-processor.service.js +3 -24
  146. package/dist/backend/backend/src/services/messaging/queue-processor.service.js.map +1 -1
  147. package/dist/backend/backend/src/services/prompt/prompt-generator.service.d.ts.map +1 -1
  148. package/dist/backend/backend/src/services/prompt/prompt-generator.service.js +9 -11
  149. package/dist/backend/backend/src/services/prompt/prompt-generator.service.js.map +1 -1
  150. package/dist/backend/backend/src/services/skill/skill-catalog.service.d.ts.map +1 -1
  151. package/dist/backend/backend/src/services/skill/skill-catalog.service.js +3 -1
  152. package/dist/backend/backend/src/services/skill/skill-catalog.service.js.map +1 -1
  153. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.d.ts +0 -12
  154. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.d.ts.map +1 -1
  155. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.js +0 -28
  156. package/dist/backend/backend/src/services/slack/slack-orchestrator-bridge.js.map +1 -1
  157. package/dist/backend/backend/src/services/workflow/scheduler.service.d.ts +18 -0
  158. package/dist/backend/backend/src/services/workflow/scheduler.service.d.ts.map +1 -1
  159. package/dist/backend/backend/src/services/workflow/scheduler.service.js +98 -10
  160. package/dist/backend/backend/src/services/workflow/scheduler.service.js.map +1 -1
  161. package/dist/backend/config/constants.d.ts +5 -11
  162. package/dist/backend/config/constants.d.ts.map +1 -1
  163. package/dist/backend/config/constants.js +5 -11
  164. package/dist/backend/config/constants.js.map +1 -1
  165. package/dist/cli/backend/src/constants.d.ts +5 -5
  166. package/dist/cli/backend/src/constants.d.ts.map +1 -1
  167. package/dist/cli/backend/src/constants.js +3 -3
  168. package/dist/cli/backend/src/constants.js.map +1 -1
  169. package/dist/cli/backend/src/services/core/storage.service.d.ts +7 -0
  170. package/dist/cli/backend/src/services/core/storage.service.d.ts.map +1 -1
  171. package/dist/cli/backend/src/services/core/storage.service.js +9 -0
  172. package/dist/cli/backend/src/services/core/storage.service.js.map +1 -1
  173. package/dist/cli/cli/src/index.js +0 -8
  174. package/dist/cli/cli/src/index.js.map +1 -1
  175. package/dist/cli/config/constants.d.ts +5 -11
  176. package/dist/cli/config/constants.d.ts.map +1 -1
  177. package/dist/cli/config/constants.js +5 -11
  178. package/dist/cli/config/constants.js.map +1 -1
  179. package/frontend/dist/assets/{index-e8b8498d.js → index-7357dbef.js} +101 -101
  180. package/frontend/dist/assets/{index-8772d402.css → index-a393888e.css} +1 -1
  181. package/frontend/dist/index.html +2 -2
  182. package/package.json +1 -1
  183. package/config/templates/content-generation-team/norms/brand-guidelines.md +0 -75
  184. package/config/templates/content-generation-team/norms/content-review.md +0 -74
  185. package/config/templates/dev-fullstack/norms/code-commit-sop.md +0 -114
  186. package/config/templates/dev-fullstack/norms/quality-gates.md +0 -62
  187. package/config/templates/research-analysis/norms/research-methodology.md +0 -77
  188. package/config/templates/research-analysis/norms/source-citation.md +0 -85
  189. package/config/templates/social-media-ops/norms/engagement-rules.md +0 -35
  190. package/config/templates/social-media-ops/norms/posting-schedule.md +0 -43
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Skills reference module — tells the agent how to discover and use skills.
3
+ *
4
+ * Consolidates skill authorization, communication skill references,
5
+ * and catalog location into a single module.
6
+ *
7
+ * Sources: Path A Step 1+6, Path B Section 8, Path C skill instructions.
8
+ */
9
+ export class SkillsReferenceModule {
10
+ name = 'skills_references';
11
+ priority = 5;
12
+ maxTokens = 500;
13
+ compactable = true;
14
+ /**
15
+ * Always included — agents need to know how to use skills.
16
+ */
17
+ shouldInclude(_config) {
18
+ return true;
19
+ }
20
+ /**
21
+ * Build the skills reference section with catalog location,
22
+ * commonly-used skills, and memory tool instructions.
23
+ *
24
+ * @param config - Module configuration with skill paths
25
+ * @returns Formatted markdown skills reference section
26
+ */
27
+ async build(config) {
28
+ return `## Available Skills
29
+
30
+ Bash skills at \`${config.agentSkillsPath}/\`:
31
+ - \`core/recall\` — retrieve relevant knowledge from memory
32
+ - \`core/remember\` — store knowledge for future reference
33
+ - \`core/record-learning\` — record learnings while working
34
+ - \`core/report-status\` — report status to orchestrator
35
+ - \`core/send-message\` — communicate with other agents
36
+ - \`core/get-sops\` — request relevant SOPs for current situation
37
+
38
+ Skills catalog: \`~/.crewly/skills/AGENT_SKILLS_CATALOG.md\`
39
+
40
+ ## Authorized Operations
41
+
42
+ The following operations are pre-approved for this session:
43
+ - Execute bash scripts in \`${config.agentSkillsPath}/\` and \`${config.tlSkillsPath}/\`
44
+ - Read and write files within the project directory
45
+ - Use browser automation skills when available (e.g., remote-browser)
46
+
47
+ ## Communication
48
+
49
+ Use bash skills at \`${config.agentSkillsPath}/\` for all team communication. Read \`~/.crewly/skills/AGENT_SKILLS_CATALOG.md\` for a full reference.
50
+ - \`send-message\` to communicate with other agents
51
+ - \`report-progress\` to update on task status
52
+ - \`remember\` to store important learnings (always pass your \`agentId\` and \`projectPath\`)
53
+ - \`recall\` to retrieve relevant knowledge (always pass your \`agentId\` and \`projectPath\`)
54
+ - \`record-learning\` to record learnings (always pass your \`agentId\` and \`projectPath\`)
55
+ - \`get-sops\` to request relevant SOPs for your current situation
56
+
57
+ **IMPORTANT for memory tools:** When calling \`remember\`, \`recall\`, or \`record-learning\`, you MUST pass:
58
+ - \`agentId\`: Your **Session Name** from the Identity section above
59
+ - \`projectPath\`: Your **Project Path** from the Identity section above
60
+ This ensures your knowledge is stored under your identity and in the correct project.
61
+
62
+ **IMPORTANT for recall:** Before answering questions about the project, deployment, architecture, or past decisions, ALWAYS call \`recall\` first to check your stored knowledge.`;
63
+ }
64
+ }
65
+ //# sourceMappingURL=skills-reference.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skills-reference.module.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/skills-reference.module.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAqB;IACjC,IAAI,GAAG,mBAAmB,CAAC;IAC3B,QAAQ,GAAG,CAAC,CAAC;IACb,SAAS,GAAG,GAAG,CAAC;IAChB,WAAW,GAAG,IAAI,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,OAAqB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,MAAoB;QAC/B,OAAO;;mBAEU,MAAM,CAAC,eAAe;;;;;;;;;;;;;8BAaX,MAAM,CAAC,eAAe,aAAa,MAAM,CAAC,YAAY;;;;;;uBAM7D,MAAM,CAAC,eAAe;;;;;;;;;;;;;kLAaqI,CAAC;IAClL,CAAC;CACD"}
@@ -0,0 +1,60 @@
1
+ import { PromptModule, ModuleConfig } from './prompt-module.interface.js';
2
+ /**
3
+ * Soul module — provides the agent's personality, tone, and working style.
4
+ *
5
+ * Loads the agent's "soul" from the resolution chain:
6
+ * 1. Per-member soul (~/.crewly/teams/{teamId}/members/{memberId}/soul.md)
7
+ * 2. Role default soul (config/roles/{role}/soul.md)
8
+ * 3. Reusable archetype (config/souls/{archetype}.md)
9
+ * 4. Hardcoded minimal fallback
10
+ *
11
+ * Sources: Path A Step 5, Path B Section 9, Soul System Design (Section 6).
12
+ */
13
+ export declare class SoulModule implements PromptModule {
14
+ name: string;
15
+ priority: number;
16
+ maxTokens: number;
17
+ compactable: boolean;
18
+ /**
19
+ * Always included — every agent benefits from personality definition.
20
+ */
21
+ shouldInclude(_config: ModuleConfig): boolean;
22
+ /**
23
+ * Build the soul section by resolving the soul file from the resolution chain.
24
+ *
25
+ * @param config - Module configuration with role and project details
26
+ * @returns Formatted markdown soul section
27
+ */
28
+ build(config: ModuleConfig): Promise<string>;
29
+ /**
30
+ * Resolve the soul content by checking each level of the resolution chain.
31
+ *
32
+ * @param config - Module configuration
33
+ * @returns Soul content string
34
+ */
35
+ private resolveSoul;
36
+ /**
37
+ * Get the path to a member's personal soul file.
38
+ *
39
+ * @param teamId - Team ID
40
+ * @param memberId - Member ID
41
+ * @returns Absolute path to the member soul file
42
+ */
43
+ private getMemberSoulPath;
44
+ /**
45
+ * Read a file if it exists, returning its content or null.
46
+ *
47
+ * @param filePath - Path to the file
48
+ * @returns File content string or null if not found
49
+ */
50
+ private readFileIfExists;
51
+ /**
52
+ * Format the soul content with a source annotation.
53
+ *
54
+ * @param content - Raw soul file content
55
+ * @param source - Where the soul was resolved from
56
+ * @returns Formatted soul section
57
+ */
58
+ private formatSoul;
59
+ }
60
+ //# sourceMappingURL=soul.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"soul.module.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/soul.module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAS1E;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,YAAW,YAAY;IAC9C,IAAI,SAAU;IACd,QAAQ,SAAK;IACb,SAAS,SAAO;IAChB,WAAW,UAAS;IAEpB;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;IAI7C;;;;;OAKG;IACG,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAKlD;;;;;OAKG;YACW,WAAW;IAgCzB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAKzB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;CAIlB"}
@@ -0,0 +1,112 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ /**
4
+ * Default minimal soul fallback when no soul file is found.
5
+ */
6
+ const DEFAULT_SOUL = `## Your Soul
7
+
8
+ You are a professional, reliable team member. Communicate clearly, ask when uncertain, and report blockers promptly.`;
9
+ /**
10
+ * Soul module — provides the agent's personality, tone, and working style.
11
+ *
12
+ * Loads the agent's "soul" from the resolution chain:
13
+ * 1. Per-member soul (~/.crewly/teams/{teamId}/members/{memberId}/soul.md)
14
+ * 2. Role default soul (config/roles/{role}/soul.md)
15
+ * 3. Reusable archetype (config/souls/{archetype}.md)
16
+ * 4. Hardcoded minimal fallback
17
+ *
18
+ * Sources: Path A Step 5, Path B Section 9, Soul System Design (Section 6).
19
+ */
20
+ export class SoulModule {
21
+ name = 'soul';
22
+ priority = 2;
23
+ maxTokens = 830;
24
+ compactable = false;
25
+ /**
26
+ * Always included — every agent benefits from personality definition.
27
+ */
28
+ shouldInclude(_config) {
29
+ return true;
30
+ }
31
+ /**
32
+ * Build the soul section by resolving the soul file from the resolution chain.
33
+ *
34
+ * @param config - Module configuration with role and project details
35
+ * @returns Formatted markdown soul section
36
+ */
37
+ async build(config) {
38
+ const soul = await this.resolveSoul(config);
39
+ return soul;
40
+ }
41
+ /**
42
+ * Resolve the soul content by checking each level of the resolution chain.
43
+ *
44
+ * @param config - Module configuration
45
+ * @returns Soul content string
46
+ */
47
+ async resolveSoul(config) {
48
+ // 1. Per-member soul
49
+ if (config.teamId && config.memberId) {
50
+ const memberSoulPath = this.getMemberSoulPath(config.teamId, config.memberId);
51
+ const content = this.readFileIfExists(memberSoulPath);
52
+ if (content) {
53
+ return this.formatSoul(content, 'member');
54
+ }
55
+ }
56
+ // 2. Role default soul (config/roles/{role}/soul.md)
57
+ if (config.role) {
58
+ const roleSoulPath = path.join(config.projectRoot, 'config', 'roles', config.role, 'soul.md');
59
+ const content = this.readFileIfExists(roleSoulPath);
60
+ if (content) {
61
+ return this.formatSoul(content, 'role');
62
+ }
63
+ }
64
+ // 3. Reusable archetype (config/souls/{role}.md as fallback archetype)
65
+ if (config.role) {
66
+ const archetypePath = path.join(config.projectRoot, 'config', 'souls', `${config.role}.md`);
67
+ const content = this.readFileIfExists(archetypePath);
68
+ if (content) {
69
+ return this.formatSoul(content, 'archetype');
70
+ }
71
+ }
72
+ // 4. Hardcoded minimal fallback
73
+ return DEFAULT_SOUL;
74
+ }
75
+ /**
76
+ * Get the path to a member's personal soul file.
77
+ *
78
+ * @param teamId - Team ID
79
+ * @param memberId - Member ID
80
+ * @returns Absolute path to the member soul file
81
+ */
82
+ getMemberSoulPath(teamId, memberId) {
83
+ const homeDir = process.env.HOME || process.env.USERPROFILE || '/tmp';
84
+ return path.join(homeDir, '.crewly', 'teams', teamId, 'members', memberId, 'soul.md');
85
+ }
86
+ /**
87
+ * Read a file if it exists, returning its content or null.
88
+ *
89
+ * @param filePath - Path to the file
90
+ * @returns File content string or null if not found
91
+ */
92
+ readFileIfExists(filePath) {
93
+ try {
94
+ return fs.readFileSync(filePath, 'utf-8').trim();
95
+ }
96
+ catch {
97
+ return null;
98
+ }
99
+ }
100
+ /**
101
+ * Format the soul content with a source annotation.
102
+ *
103
+ * @param content - Raw soul file content
104
+ * @param source - Where the soul was resolved from
105
+ * @returns Formatted soul section
106
+ */
107
+ formatSoul(content, source) {
108
+ const sourceLabel = source === 'member' ? 'personal' : source === 'role' ? 'role default' : 'archetype';
109
+ return `## Your Soul\n_Source: ${sourceLabel}_\n\n${content}`;
110
+ }
111
+ }
112
+ //# sourceMappingURL=soul.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"soul.module.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/soul.module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;GAEG;AACH,MAAM,YAAY,GAAG;;qHAEgG,CAAC;AAEtH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAU;IACtB,IAAI,GAAG,MAAM,CAAC;IACd,QAAQ,GAAG,CAAC,CAAC;IACb,SAAS,GAAG,GAAG,CAAC;IAChB,WAAW,GAAG,KAAK,CAAC;IAEpB;;OAEG;IACH,aAAa,CAAC,OAAqB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAK,CAAC,MAAoB;QAC/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,WAAW,CAAC,MAAoB;QAC7C,qBAAqB;QACrB,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACtC,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC9E,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;YACtD,IAAI,OAAO,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC3C,CAAC;QACF,CAAC;QAED,qDAAqD;QACrD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MA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MAAuC;QAC1E,MAAM,WAAW,GAAG,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC;QACxG,OAAO,0BAA0B,WAAW,QAAQ,OAAO,EAAE,CAAC;IAC/D,CAAC;CACD"}
@@ -0,0 +1,54 @@
1
+ import { PromptModule, ModuleConfig } from './prompt-module.interface.js';
2
+ /**
3
+ * Team reference module — provides team hierarchy, TL duties, and norms references.
4
+ *
5
+ * Wraps the existing `buildTeamLeadSection` and `buildTeamNormsSection` logic
6
+ * from PromptBuilderService. The TL addon is conditionally loaded only when
7
+ * the agent has `canDelegate=true` and subordinates.
8
+ *
9
+ * Sources: Path A Step 7, Path B Sections 4+5.
10
+ */
11
+ export declare class TeamReferenceModule implements PromptModule {
12
+ name: string;
13
+ priority: number;
14
+ maxTokens: number;
15
+ compactable: boolean;
16
+ /**
17
+ * Include when agent has a team (teamId set) or has subordinates.
18
+ */
19
+ shouldInclude(config: ModuleConfig): boolean;
20
+ /**
21
+ * Build team reference section. Includes TL addon if agent can delegate,
22
+ * and team norms if available.
23
+ *
24
+ * @param config - Module configuration with team and subordinate details
25
+ * @returns Formatted markdown team reference section
26
+ */
27
+ build(config: ModuleConfig): Promise<string>;
28
+ /**
29
+ * Build Team Lead section by loading tl-addon.md and resolving variables.
30
+ * Falls back to inline section if addon file not found.
31
+ *
32
+ * @param config - Module configuration with subordinate details
33
+ * @returns Formatted TL section or empty string
34
+ */
35
+ private buildTeamLeadSection;
36
+ /**
37
+ * Build minimal inline TL section as fallback when tl-addon.md is not found.
38
+ *
39
+ * @param workerList - Pre-formatted worker list
40
+ * @param subordinateCount - Number of subordinates
41
+ * @returns Formatted inline TL section
42
+ */
43
+ private buildInlineTeamLeadSection;
44
+ /**
45
+ * Build team norms section by loading norms files from team directory.
46
+ * Only includes norms whose role list matches the agent's role or '*'.
47
+ *
48
+ * @param teamId - Team ID to load norms for
49
+ * @param role - Agent's role for filtering
50
+ * @returns Formatted norms markdown or empty string
51
+ */
52
+ private buildTeamNormsSection;
53
+ }
54
+ //# sourceMappingURL=team-reference.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-reference.module.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/team-reference.module.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IACvD,IAAI,SAAqB;IACzB,QAAQ,SAAK;IACb,SAAS,SAAQ;IACjB,WAAW,UAAS;IAEpB;;OAEG;IACH,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO;IAI5C;;;;;;OAMG;IACG,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBlD;;;;;;OAMG;YACW,oBAAoB;IAoClC;;;;;;OAMG;IACH,OAAO,CAAC,0BAA0B;IAgBlC;;;;;;;OAOG;YACW,qBAAqB;CAmCnC"}
@@ -0,0 +1,149 @@
1
+ import { readFile, access } from 'fs/promises';
2
+ import * as path from 'path';
3
+ /**
4
+ * Team reference module — provides team hierarchy, TL duties, and norms references.
5
+ *
6
+ * Wraps the existing `buildTeamLeadSection` and `buildTeamNormsSection` logic
7
+ * from PromptBuilderService. The TL addon is conditionally loaded only when
8
+ * the agent has `canDelegate=true` and subordinates.
9
+ *
10
+ * Sources: Path A Step 7, Path B Sections 4+5.
11
+ */
12
+ export class TeamReferenceModule {
13
+ name = 'team_references';
14
+ priority = 6;
15
+ maxTokens = 8000;
16
+ compactable = false; // TL core is not compactable
17
+ /**
18
+ * Include when agent has a team (teamId set) or has subordinates.
19
+ */
20
+ shouldInclude(config) {
21
+ return !!(config.teamId || (config.canDelegate && config.subordinates && config.subordinates.length > 0));
22
+ }
23
+ /**
24
+ * Build team reference section. Includes TL addon if agent can delegate,
25
+ * and team norms if available.
26
+ *
27
+ * @param config - Module configuration with team and subordinate details
28
+ * @returns Formatted markdown team reference section
29
+ */
30
+ async build(config) {
31
+ const sections = [];
32
+ // Build TL section if agent can delegate
33
+ if (config.canDelegate && config.subordinates && config.subordinates.length > 0) {
34
+ const tlSection = await this.buildTeamLeadSection(config);
35
+ if (tlSection) {
36
+ sections.push(tlSection);
37
+ }
38
+ }
39
+ // Build team norms section if team exists
40
+ if (config.teamId) {
41
+ const normsSection = await this.buildTeamNormsSection(config.teamId, config.role);
42
+ if (normsSection) {
43
+ sections.push(normsSection);
44
+ }
45
+ }
46
+ return sections.join('\n\n---\n\n');
47
+ }
48
+ /**
49
+ * Build Team Lead section by loading tl-addon.md and resolving variables.
50
+ * Falls back to inline section if addon file not found.
51
+ *
52
+ * @param config - Module configuration with subordinate details
53
+ * @returns Formatted TL section or empty string
54
+ */
55
+ async buildTeamLeadSection(config) {
56
+ if (!config.subordinates || config.subordinates.length === 0) {
57
+ return '';
58
+ }
59
+ const workerList = config.subordinates
60
+ .map((sub) => `- **${sub.name}** (session: \`${sub.sessionName}\`, memberId: \`${sub.memberId}\`) — ${sub.role}`)
61
+ .join('\n');
62
+ // Try loading the comprehensive TL addon from file
63
+ const addonPath = path.join(config.projectRoot, 'config', 'roles', 'team-leader', 'tl-addon.md');
64
+ try {
65
+ await access(addonPath);
66
+ let addonContent = await readFile(addonPath, 'utf8');
67
+ // Resolve template variables
68
+ const variables = {
69
+ WORKER_LIST: workerList,
70
+ TL_SKILLS_PATH: config.tlSkillsPath,
71
+ TEAM_ID: config.teamId || '',
72
+ MEMBER_ID: config.memberId || '',
73
+ PROJECT_PATH: config.projectPath || '',
74
+ AGENT_SKILLS_PATH: config.agentSkillsPath,
75
+ };
76
+ for (const [key, value] of Object.entries(variables)) {
77
+ addonContent = addonContent.replace(new RegExp(`\\{\\{${key}\\}\\}`, 'g'), value);
78
+ }
79
+ return addonContent.trim();
80
+ }
81
+ catch {
82
+ // Fallback to minimal inline section
83
+ return this.buildInlineTeamLeadSection(workerList, config.subordinates.length);
84
+ }
85
+ }
86
+ /**
87
+ * Build minimal inline TL section as fallback when tl-addon.md is not found.
88
+ *
89
+ * @param workerList - Pre-formatted worker list
90
+ * @param subordinateCount - Number of subordinates
91
+ * @returns Formatted inline TL section
92
+ */
93
+ buildInlineTeamLeadSection(workerList, subordinateCount) {
94
+ return `## Team Lead Responsibilities
95
+
96
+ You manage ${subordinateCount} subordinate(s):
97
+
98
+ ${workerList}
99
+
100
+ ### Your TL Duties
101
+
102
+ 1. **Task Decomposition** — Break down large tasks into actionable sub-tasks
103
+ 2. **Delegation** — Assign sub-tasks to subordinates using \`send-message\`
104
+ 3. **Quality Review** — Review subordinates' work before reporting completion
105
+ 4. **Progress Reporting** — Report progress to the orchestrator via \`report-status\`
106
+ 5. **Unblocking** — Help subordinates when they are stuck`;
107
+ }
108
+ /**
109
+ * Build team norms section by loading norms files from team directory.
110
+ * Only includes norms whose role list matches the agent's role or '*'.
111
+ *
112
+ * @param teamId - Team ID to load norms for
113
+ * @param role - Agent's role for filtering
114
+ * @returns Formatted norms markdown or empty string
115
+ */
116
+ async buildTeamNormsSection(teamId, role) {
117
+ if (!teamId)
118
+ return '';
119
+ try {
120
+ const { existsSync, readdirSync, readFileSync } = await import('fs');
121
+ const crewlyHome = path.join(process.env['HOME'] || '/tmp', '.crewly');
122
+ const normsDir = path.join(crewlyHome, 'teams', teamId, 'norms');
123
+ if (!existsSync(normsDir))
124
+ return '';
125
+ const normFiles = readdirSync(normsDir).filter((f) => f.endsWith('.md'));
126
+ if (normFiles.length === 0)
127
+ return '';
128
+ const normalizedRole = role.toLowerCase().replace(/\s+/g, '-');
129
+ const sections = ['## Team Norms'];
130
+ for (const file of normFiles) {
131
+ const content = readFileSync(path.join(normsDir, file), 'utf8');
132
+ // Check if norm applies to this role (roles: line at top)
133
+ const rolesMatch = content.match(/^roles:\s*(.+)$/m);
134
+ if (rolesMatch) {
135
+ const roles = rolesMatch[1].split(',').map((r) => r.trim().toLowerCase());
136
+ if (!roles.includes('*') && !roles.includes(normalizedRole)) {
137
+ continue;
138
+ }
139
+ }
140
+ sections.push(content.trim());
141
+ }
142
+ return sections.length > 1 ? sections.join('\n\n') : '';
143
+ }
144
+ catch {
145
+ return '';
146
+ }
147
+ }
148
+ }
149
+ //# sourceMappingURL=team-reference.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"team-reference.module.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/team-reference.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAC/B,IAAI,GAAG,iBAAiB,CAAC;IACzB,QAAQ,GAAG,CAAC,CAAC;IACb,SAAS,GAAG,IAAI,CAAC;IACjB,WAAW,GAAG,KAAK,CAAC,CAAC,6BAA6B;IAElD;;OAEG;IACH,aAAa,CAAC,MAAoB;QACjC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3G,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,MAAoB;QAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,yCAAyC;QACzC,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAC1D,IAAI,SAAS,EAAE,CAAC;gBACf,QAAQ,CAAC,IAAI,CAA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C,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,28 @@
1
+ import { PromptModule, ModuleConfig } from './prompt-module.interface.js';
2
+ /**
3
+ * User profile reference module — tells the agent how to access user preferences.
4
+ *
5
+ * Provides instructions for language matching, communication style adaptation,
6
+ * and accessing stored user preferences via recall/remember skills.
7
+ *
8
+ * Sources: Path B Section 10 (language matching), new user prefs system.
9
+ */
10
+ export declare class UserProfileReferenceModule implements PromptModule {
11
+ name: string;
12
+ priority: number;
13
+ maxTokens: number;
14
+ compactable: boolean;
15
+ /**
16
+ * Always included — agents should know how to adapt to user preferences.
17
+ */
18
+ shouldInclude(_config: ModuleConfig): boolean;
19
+ /**
20
+ * Build the user profile reference section with instructions
21
+ * on how to discover and adapt to user preferences.
22
+ *
23
+ * @param config - Module configuration with agent skill paths
24
+ * @returns Formatted markdown user profile reference section
25
+ */
26
+ build(config: ModuleConfig): Promise<string>;
27
+ }
28
+ //# sourceMappingURL=user-profile-reference.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-profile-reference.module.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/user-profile-reference.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;GAOG;AACH,qBAAa,0BAA2B,YAAW,YAAY;IAC9D,IAAI,SAA4B;IAChC,QAAQ,SAAK;IACb,SAAS,SAAO;IAChB,WAAW,UAAQ;IAEnB;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;IAI7C;;;;;;OAMG;IACG,KAAK,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;CAyBlD"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * User profile reference module — tells the agent how to access user preferences.
3
+ *
4
+ * Provides instructions for language matching, communication style adaptation,
5
+ * and accessing stored user preferences via recall/remember skills.
6
+ *
7
+ * Sources: Path B Section 10 (language matching), new user prefs system.
8
+ */
9
+ export class UserProfileReferenceModule {
10
+ name = 'user_profile_reference';
11
+ priority = 9;
12
+ maxTokens = 200;
13
+ compactable = true;
14
+ /**
15
+ * Always included — agents should know how to adapt to user preferences.
16
+ */
17
+ shouldInclude(_config) {
18
+ return true;
19
+ }
20
+ /**
21
+ * Build the user profile reference section with instructions
22
+ * on how to discover and adapt to user preferences.
23
+ *
24
+ * @param config - Module configuration with agent skill paths
25
+ * @returns Formatted markdown user profile reference section
26
+ */
27
+ async build(config) {
28
+ return `## User Preferences
29
+
30
+ ### Language Matching
31
+ Match the user's language automatically:
32
+ - If the user writes in Chinese, respond in Chinese
33
+ - If the user writes in English, respond in English
34
+ - For mixed-language messages, follow the dominant language
35
+
36
+ ### Accessing Preferences
37
+ Use your memory tools to recall user-specific preferences:
38
+ \`\`\`bash
39
+ bash ${config.agentSkillsPath}/core/recall/execute.sh '{"agentId":"${config.sessionName}","context":"user preferences, communication style","projectPath":"${config.projectPath || ''}"}'
40
+ \`\`\`
41
+
42
+ When you discover a user preference (e.g., preferred detail level, communication style), store it:
43
+ \`\`\`bash
44
+ bash ${config.agentSkillsPath}/core/remember/execute.sh '{"agentId":"${config.sessionName}","content":"<preference>","category":"preference","scope":"agent","projectPath":"${config.projectPath || ''}"}'
45
+ \`\`\`
46
+
47
+ ### Adaptation Rules
48
+ - Adapt verbosity to user preference (concise vs detailed)
49
+ - Mirror the user's formality level
50
+ - Respect timezone and working hours when mentioned`;
51
+ }
52
+ }
53
+ //# sourceMappingURL=user-profile-reference.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-profile-reference.module.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/user-profile-reference.module.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IACtC,IAAI,GAAG,wBAAwB,CAAC;IAChC,QAAQ,GAAG,CAAC,CAAC;IACb,SAAS,GAAG,GAAG,CAAC;IAChB,WAAW,GAAG,IAAI,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,OAAqB;QAClC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CAAC,MAAoB;QAC/B,OAAO;;;;;;;;;;;OAWF,MAAM,CAAC,eAAe,wCAAwC,MAAM,CAAC,WAAW,sEAAsE,MAAM,CAAC,WAAW,IAAI,EAAE;;;;;OAK9K,MAAM,CAAC,eAAe,0CAA0C,MAAM,CAAC,WAAW,qFAAqF,MAAM,CAAC,WAAW,IAAI,EAAE;;;;;;oDAMlJ,CAAC;IACpD,CAAC;CACD"}
@@ -7,6 +7,16 @@
7
7
  * @module services/cloud/cloud-auth.middleware
8
8
  */
9
9
  import type { Request, Response, NextFunction } from 'express';
10
+ /**
11
+ * Throttle interval for repeated warning logs (5 minutes).
12
+ * Prevents log flooding from high-frequency polling endpoints like /devices.
13
+ */
14
+ export declare const WARN_THROTTLE_MS: number;
15
+ /**
16
+ * Map tracking last warn timestamps by key (reason:path).
17
+ * Exported for testing purposes.
18
+ */
19
+ export declare const _warnTimestamps: Map<string, number>;
10
20
  /**
11
21
  * Check whether the local Crewly instance is connected to CrewlyAI Cloud.
12
22
  *
@@ -33,6 +43,8 @@ export declare function requireCloudConnection(req: Request, res: Response, next
33
43
  *
34
44
  * The middleware first checks cloud connectivity, then verifies that the
35
45
  * current subscription tier meets or exceeds the required level.
46
+ * Warning logs are throttled to once per 5 minutes per path to prevent
47
+ * log flooding from high-frequency polling endpoints (#212).
36
48
  *
37
49
  * @param tier - Minimum required tier ('pro' or 'enterprise')
38
50
  * @returns Express middleware function
@@ -1 +1 @@
1
- {"version":3,"file":"cloud-auth.middleware.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-auth.middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAe/D;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAU5F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAgCjH"}
1
+ {"version":3,"file":"cloud-auth.middleware.d.ts","sourceRoot":"","sources":["../../../../../../backend/src/services/cloud/cloud-auth.middleware.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQ/D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAgB,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,CAAC;AA2B9D;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI,CAU5F;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAsCjH"}