crewly 1.4.40 → 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.
- package/config/orchestrator_tasks/prompts/orchestrator-prompt.md +11 -11
- package/config/roles/architect/prompt.md +1 -5
- package/config/roles/backend-developer/prompt.md +1 -5
- package/config/roles/content-strategist/prompt.md +1 -5
- package/config/roles/designer/prompt.md +1 -5
- package/config/roles/developer/prompt.md +1 -7
- package/config/roles/developer/soul.md +18 -0
- package/config/roles/frontend-developer/prompt.md +1 -5
- package/config/roles/fullstack-dev/prompt.md +1 -5
- package/config/roles/generalist/prompt.md +1 -7
- package/config/roles/ops/prompt.md +1 -7
- package/config/roles/orchestrator/prompt.md +44 -44
- package/config/roles/orchestrator/soul.md +18 -0
- package/config/roles/product-manager/prompt.md +1 -5
- package/config/roles/qa/prompt.md +1 -5
- package/config/roles/qa-engineer/prompt.md +1 -5
- package/config/roles/researcher/prompt.md +1 -5
- package/config/roles/researcher/soul.md +18 -0
- package/config/roles/sales/prompt.md +1 -5
- package/config/roles/support/prompt.md +1 -5
- package/config/roles/team-leader/prompt.md +2 -6
- package/config/roles/tpm/prompt.md +1 -5
- package/config/roles/ux-designer/prompt.md +1 -5
- package/config/souls/developer.md +30 -0
- package/config/souls/orchestrator.md +30 -0
- package/config/souls/researcher.md +30 -0
- package/config/templates/agent-claude-md.md +1 -1
- package/dist/backend/backend/src/services/agent/agent-registration.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/agent/agent-registration.service.js +12 -7
- package/dist/backend/backend/src/services/agent/agent-registration.service.js.map +1 -1
- package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.js +16 -4
- package/dist/backend/backend/src/services/agent/oauth-relogin-monitor.service.js.map +1 -1
- package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.d.ts.map +1 -1
- package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.js +11 -0
- package/dist/backend/backend/src/services/agent/runtime-agent.service.abstract.js.map +1 -1
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts +46 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js +145 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/communication.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.d.ts +129 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.js +202 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/context-assembly.service.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.d.ts +28 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.js +47 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/identity.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/index.d.ts +22 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/index.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/index.js +26 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/index.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.d.ts +28 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.js +55 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/learning-reference.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.d.ts +44 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.js +112 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/lifecycle.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.d.ts +28 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.js +46 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/memory-reference.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.d.ts +29 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.js +50 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/project-reference.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.d.ts +86 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.js +212 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-assembly.service.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.d.ts +100 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.js +23 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/prompt-module.interface.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.d.ts +34 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.js +61 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/recovery.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.d.ts +55 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.js +96 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts +28 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js +65 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/skills-reference.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.d.ts +60 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.js +112 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/soul.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.d.ts +54 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.js +149 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/team-reference.module.js.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.d.ts +28 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.d.ts.map +1 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.js +53 -0
- package/dist/backend/backend/src/services/ai/prompt-modules/user-profile-reference.module.js.map +1 -0
- package/dist/backend/backend/src/services/prompt/prompt-generator.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/prompt/prompt-generator.service.js +9 -11
- package/dist/backend/backend/src/services/prompt/prompt-generator.service.js.map +1 -1
- package/dist/backend/backend/src/services/skill/skill-catalog.service.d.ts.map +1 -1
- package/dist/backend/backend/src/services/skill/skill-catalog.service.js +3 -1
- package/dist/backend/backend/src/services/skill/skill-catalog.service.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recovery module — unified session recovery protocol.
|
|
3
|
+
*
|
|
4
|
+
* Consolidates the restart/recovery flow that was previously scattered
|
|
5
|
+
* across prompt-builder.service.ts buildSessionRecoverySection(),
|
|
6
|
+
* agent-registration.service.ts hardcoded commands, role prompts
|
|
7
|
+
* (Session Recovery Protocol), and session-handoff.service.ts.
|
|
8
|
+
*
|
|
9
|
+
* Produces the mandatory startup sequence: recall → get-my-context → assess.
|
|
10
|
+
* This module is non-compactable because skipping recovery causes
|
|
11
|
+
* duplicate work and lost context.
|
|
12
|
+
*
|
|
13
|
+
* Sources: Path A Step 9, prompt-builder buildSessionRecoverySection(),
|
|
14
|
+
* developer/prompt.md §Session Recovery Protocol.
|
|
15
|
+
*/
|
|
16
|
+
export class RecoveryModule {
|
|
17
|
+
name = 'recovery';
|
|
18
|
+
priority = 2;
|
|
19
|
+
maxTokens = 600;
|
|
20
|
+
compactable = false;
|
|
21
|
+
/**
|
|
22
|
+
* Always included — every agent needs session recovery.
|
|
23
|
+
*/
|
|
24
|
+
shouldInclude(_config) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build the session recovery protocol with executable bash commands.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Module configuration with agent identity
|
|
31
|
+
* @returns Formatted markdown recovery section
|
|
32
|
+
*/
|
|
33
|
+
async build(config) {
|
|
34
|
+
const agentId = config.sessionName;
|
|
35
|
+
const role = config.role;
|
|
36
|
+
const projectPath = config.projectPath || config.projectRoot;
|
|
37
|
+
const skillsPath = config.agentSkillsPath;
|
|
38
|
+
return `## Session Recovery Protocol (MANDATORY)
|
|
39
|
+
|
|
40
|
+
**IMMEDIATELY after registering**, you MUST execute the following context recovery steps before saying "Ready" or accepting any tasks. This ensures you recover context from previous sessions and avoid repeating work or missing ongoing tasks.
|
|
41
|
+
|
|
42
|
+
### Step 1: Recall previous knowledge
|
|
43
|
+
\`\`\`bash
|
|
44
|
+
bash ${skillsPath}/core/recall/execute.sh '{"agentId":"${agentId}","context":"${role} session startup, recent tasks, unfinished work, blockers, key decisions","projectPath":"${projectPath}"}'
|
|
45
|
+
\`\`\`
|
|
46
|
+
|
|
47
|
+
### Step 2: Load your full context
|
|
48
|
+
\`\`\`bash
|
|
49
|
+
bash ${skillsPath}/core/get-my-context/execute.sh '{"agentId":"${agentId}","agentRole":"${role}","projectPath":"${projectPath}"}'
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
### Step 3: Assess and report
|
|
53
|
+
After reviewing the results from Steps 1 and 2:
|
|
54
|
+
1. **Check for unfinished work** — If you find tasks that were in progress but not completed, note them
|
|
55
|
+
2. **Check for pending blockers** — If previous sessions recorded blockers, note them
|
|
56
|
+
3. **Report status** — Include a brief summary of recovered context in your first status message
|
|
57
|
+
|
|
58
|
+
**Do NOT skip these steps.** Context recovery prevents duplicate work and ensures continuity across sessions.`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=recovery.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.module.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/recovery.module.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,cAAc;IAC1B,IAAI,GAAG,UAAU,CAAC;IAClB,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,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAC;QAC7D,MAAM,UAAU,GAAG,MAAM,CAAC,eAAe,CAAC;QAE1C,OAAO;;;;;;OAMF,UAAU,wCAAwC,OAAO,gBAAgB,IAAI,4FAA4F,WAAW;;;;;OAKpL,UAAU,gDAAgD,OAAO,kBAAkB,IAAI,oBAAoB,WAAW;;;;;;;;;8GASf,CAAC;IAC9G,CAAC;CACD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ContextLoaderConfig } from './context-assembly.service.js';
|
|
2
|
+
/**
|
|
3
|
+
* Scheduled messages context loader — loads agent's scheduled checks/messages state.
|
|
4
|
+
*
|
|
5
|
+
* This is a context module (dynamic data), registered with ContextAssemblyService
|
|
6
|
+
* rather than PromptAssemblyService. It loads the current scheduled checks and
|
|
7
|
+
* messages for the agent so they have awareness of pending/recurring tasks.
|
|
8
|
+
*
|
|
9
|
+
* Token budget: 0-500
|
|
10
|
+
*
|
|
11
|
+
* Sources: SchedulerService recurring/one-time checks.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Scheduled check data shape for the loader (minimal subset of ScheduledCheck).
|
|
15
|
+
*/
|
|
16
|
+
export interface ScheduledCheckInfo {
|
|
17
|
+
/** Unique check ID */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Target session name */
|
|
20
|
+
targetSession: string;
|
|
21
|
+
/** Message content */
|
|
22
|
+
message: string;
|
|
23
|
+
/** Next scheduled execution time (ISO string) */
|
|
24
|
+
scheduledFor: string;
|
|
25
|
+
/** Interval in minutes for recurring checks */
|
|
26
|
+
intervalMinutes?: number;
|
|
27
|
+
/** Whether this check repeats */
|
|
28
|
+
isRecurring: boolean;
|
|
29
|
+
/** Human-readable label */
|
|
30
|
+
label?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Provider function type that retrieves scheduled checks for an agent.
|
|
34
|
+
* This allows the loader to be decoupled from the SchedulerService directly.
|
|
35
|
+
*/
|
|
36
|
+
export type ScheduledChecksProvider = (agentId: string) => ScheduledCheckInfo[];
|
|
37
|
+
/**
|
|
38
|
+
* Create a scheduled messages context loader function.
|
|
39
|
+
*
|
|
40
|
+
* The loader is created with a provider function that retrieves the current
|
|
41
|
+
* scheduled checks. This allows dependency injection and easy testing.
|
|
42
|
+
*
|
|
43
|
+
* @param getChecks - Provider function that returns scheduled checks for an agent
|
|
44
|
+
* @returns Context loader function compatible with ContextAssemblyService
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* const loader = createScheduledMessagesLoader((agentId) => {
|
|
49
|
+
* return schedulerService.getChecksForAgent(agentId);
|
|
50
|
+
* });
|
|
51
|
+
* contextAssembly.registerLoader('scheduled_messages', loader);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function createScheduledMessagesLoader(getChecks: ScheduledChecksProvider): (config: ContextLoaderConfig) => Promise<string>;
|
|
55
|
+
//# sourceMappingURL=scheduled-messages.loader.d.ts.map
|
package/dist/backend/backend/src/services/ai/prompt-modules/scheduled-messages.loader.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduled-messages.loader.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/scheduled-messages.loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE;;;;;;;;;;GAUG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iCAAiC;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,kBAAkB,EAAE,CAAC;AAEhF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,CAC5C,SAAS,EAAE,uBAAuB,GAChC,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,CAAC,CA6ClD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a scheduled messages context loader function.
|
|
3
|
+
*
|
|
4
|
+
* The loader is created with a provider function that retrieves the current
|
|
5
|
+
* scheduled checks. This allows dependency injection and easy testing.
|
|
6
|
+
*
|
|
7
|
+
* @param getChecks - Provider function that returns scheduled checks for an agent
|
|
8
|
+
* @returns Context loader function compatible with ContextAssemblyService
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const loader = createScheduledMessagesLoader((agentId) => {
|
|
13
|
+
* return schedulerService.getChecksForAgent(agentId);
|
|
14
|
+
* });
|
|
15
|
+
* contextAssembly.registerLoader('scheduled_messages', loader);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function createScheduledMessagesLoader(getChecks) {
|
|
19
|
+
return async (config) => {
|
|
20
|
+
const checks = getChecks(config.agentId);
|
|
21
|
+
if (!checks || checks.length === 0) {
|
|
22
|
+
return '';
|
|
23
|
+
}
|
|
24
|
+
const recurring = checks.filter((c) => c.isRecurring);
|
|
25
|
+
const oneTime = checks.filter((c) => !c.isRecurring);
|
|
26
|
+
const lines = ['## Scheduled Messages'];
|
|
27
|
+
if (recurring.length > 0) {
|
|
28
|
+
lines.push('');
|
|
29
|
+
lines.push('### Recurring Checks');
|
|
30
|
+
lines.push('| Label | Interval | Next Run | Message |');
|
|
31
|
+
lines.push('|-------|----------|----------|---------|');
|
|
32
|
+
for (const check of recurring) {
|
|
33
|
+
const label = check.label || check.id;
|
|
34
|
+
const interval = check.intervalMinutes ? `${check.intervalMinutes}m` : 'N/A';
|
|
35
|
+
const nextRun = formatTime(check.scheduledFor);
|
|
36
|
+
const message = truncateMessage(check.message);
|
|
37
|
+
lines.push(`| ${label} | ${interval} | ${nextRun} | ${message} |`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (oneTime.length > 0) {
|
|
41
|
+
lines.push('');
|
|
42
|
+
lines.push('### One-Time Checks');
|
|
43
|
+
lines.push('| Label | Scheduled For | Message |');
|
|
44
|
+
lines.push('|-------|---------------|---------|');
|
|
45
|
+
for (const check of oneTime) {
|
|
46
|
+
const label = check.label || check.id;
|
|
47
|
+
const scheduledFor = formatTime(check.scheduledFor);
|
|
48
|
+
const message = truncateMessage(check.message);
|
|
49
|
+
lines.push(`| ${label} | ${scheduledFor} | ${message} |`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
lines.push('');
|
|
53
|
+
lines.push(`_Total: ${checks.length} scheduled (${recurring.length} recurring, ${oneTime.length} one-time)_`);
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Format an ISO timestamp to a short human-readable time.
|
|
59
|
+
*
|
|
60
|
+
* @param isoString - ISO 8601 timestamp
|
|
61
|
+
* @returns Formatted time string (e.g., "14:30" or "Mar 19 14:30")
|
|
62
|
+
*/
|
|
63
|
+
function formatTime(isoString) {
|
|
64
|
+
try {
|
|
65
|
+
const date = new Date(isoString);
|
|
66
|
+
const now = new Date();
|
|
67
|
+
const isToday = date.getFullYear() === now.getFullYear() &&
|
|
68
|
+
date.getMonth() === now.getMonth() &&
|
|
69
|
+
date.getDate() === now.getDate();
|
|
70
|
+
if (isToday) {
|
|
71
|
+
return date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false });
|
|
72
|
+
}
|
|
73
|
+
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) +
|
|
74
|
+
' ' +
|
|
75
|
+
date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false });
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return isoString;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Truncate a message for table display.
|
|
83
|
+
*
|
|
84
|
+
* @param message - Full message string
|
|
85
|
+
* @param maxLength - Maximum length before truncation
|
|
86
|
+
* @returns Truncated message
|
|
87
|
+
*/
|
|
88
|
+
function truncateMessage(message, maxLength = 60) {
|
|
89
|
+
if (!message)
|
|
90
|
+
return '';
|
|
91
|
+
const singleLine = message.replace(/\n/g, ' ').trim();
|
|
92
|
+
if (singleLine.length <= maxLength)
|
|
93
|
+
return singleLine;
|
|
94
|
+
return singleLine.substring(0, maxLength - 3) + '...';
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=scheduled-messages.loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduled-messages.loader.js","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/scheduled-messages.loader.ts"],"names":[],"mappings":"AAwCA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,6BAA6B,CAC5C,SAAkC;IAElC,OAAO,KAAK,EAAE,MAA2B,EAAmB,EAAE;QAC7D,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO,EAAE,CAAC;QACX,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QAErD,MAAM,KAAK,GAAa,CAAC,uBAAuB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F,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,OAAe,EAAE,YAAoB,EAAE;IAC/D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACtD,IAAI,UAAU,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,UAAU,CAAC;IACtD,OAAO,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PromptModule, ModuleConfig } from './prompt-module.interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* Skills reference module — tells the agent how to discover and use skills.
|
|
4
|
+
*
|
|
5
|
+
* Consolidates skill authorization, communication skill references,
|
|
6
|
+
* and catalog location into a single module.
|
|
7
|
+
*
|
|
8
|
+
* Sources: Path A Step 1+6, Path B Section 8, Path C skill instructions.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SkillsReferenceModule implements PromptModule {
|
|
11
|
+
name: string;
|
|
12
|
+
priority: number;
|
|
13
|
+
maxTokens: number;
|
|
14
|
+
compactable: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Always included — agents need to know how to use skills.
|
|
17
|
+
*/
|
|
18
|
+
shouldInclude(_config: ModuleConfig): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Build the skills reference section with catalog location,
|
|
21
|
+
* commonly-used skills, and memory tool instructions.
|
|
22
|
+
*
|
|
23
|
+
* @param config - Module configuration with skill paths
|
|
24
|
+
* @returns Formatted markdown skills reference section
|
|
25
|
+
*/
|
|
26
|
+
build(config: ModuleConfig): Promise<string>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=skills-reference.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills-reference.module.d.ts","sourceRoot":"","sources":["../../../../../../../backend/src/services/ai/prompt-modules/skills-reference.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;;;;GAOG;AACH,qBAAa,qBAAsB,YAAW,YAAY;IACzD,IAAI,SAAuB;IAC3B,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;CAqClD"}
|
|
@@ -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,CAA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AW,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"}
|