dot-agents 0.5.0 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +239 -122
- package/dist/cli/commands/channel.d.ts +19 -0
- package/dist/cli/commands/channel.d.ts.map +1 -1
- package/dist/cli/commands/channel.js +220 -13
- package/dist/cli/commands/channel.js.map +1 -1
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +61 -1
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/index.d.ts +2 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/personas.d.ts +3 -0
- package/dist/cli/commands/personas.d.ts.map +1 -0
- package/dist/cli/commands/personas.js +402 -0
- package/dist/cli/commands/personas.js.map +1 -0
- package/dist/cli/commands/projects.d.ts +3 -0
- package/dist/cli/commands/projects.d.ts.map +1 -0
- package/dist/cli/commands/projects.js +138 -0
- package/dist/cli/commands/projects.js.map +1 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +4 -5
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/index.js +3 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/lib/runner.d.ts +2 -0
- package/dist/cli/lib/runner.d.ts.map +1 -1
- package/dist/cli/lib/runner.js +67 -8
- package/dist/cli/lib/runner.js.map +1 -1
- package/dist/daemon/api/channels.d.ts +6 -0
- package/dist/daemon/api/channels.d.ts.map +1 -0
- package/dist/daemon/api/channels.js +143 -0
- package/dist/daemon/api/channels.js.map +1 -0
- package/dist/daemon/api/server.d.ts.map +1 -1
- package/dist/daemon/api/server.js +56 -0
- package/dist/daemon/api/server.js.map +1 -1
- package/dist/daemon/daemon.d.ts +28 -3
- package/dist/daemon/daemon.d.ts.map +1 -1
- package/dist/daemon/daemon.js +142 -26
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/lib/executor.d.ts +0 -4
- package/dist/daemon/lib/executor.d.ts.map +1 -1
- package/dist/daemon/lib/executor.js +48 -135
- package/dist/daemon/lib/executor.js.map +1 -1
- package/dist/daemon/lib/index.d.ts +1 -0
- package/dist/daemon/lib/index.d.ts.map +1 -1
- package/dist/daemon/lib/index.js +1 -0
- package/dist/daemon/lib/index.js.map +1 -1
- package/dist/daemon/lib/safeguards.d.ts +68 -0
- package/dist/daemon/lib/safeguards.d.ts.map +1 -0
- package/dist/daemon/lib/safeguards.js +135 -0
- package/dist/daemon/lib/safeguards.js.map +1 -0
- package/dist/daemon/lib/watcher.d.ts.map +1 -1
- package/dist/daemon/lib/watcher.js +48 -8
- package/dist/daemon/lib/watcher.js.map +1 -1
- package/dist/daemon/web/app.js +433 -0
- package/dist/daemon/web/index.html +68 -0
- package/dist/daemon/web/styles.css +452 -0
- package/dist/lib/channel.d.ts +53 -1
- package/dist/lib/channel.d.ts.map +1 -1
- package/dist/lib/channel.js +221 -30
- package/dist/lib/channel.js.map +1 -1
- package/dist/lib/daemon-status.d.ts +26 -0
- package/dist/lib/daemon-status.d.ts.map +1 -0
- package/dist/lib/daemon-status.js +64 -0
- package/dist/lib/daemon-status.js.map +1 -0
- package/dist/lib/environment.d.ts +88 -0
- package/dist/lib/environment.d.ts.map +1 -0
- package/dist/lib/environment.js +238 -0
- package/dist/lib/environment.js.map +1 -0
- package/dist/lib/frontmatter.d.ts +8 -0
- package/dist/lib/frontmatter.d.ts.map +1 -1
- package/dist/lib/frontmatter.js +16 -3
- package/dist/lib/frontmatter.js.map +1 -1
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +7 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/invoke.d.ts +31 -0
- package/dist/lib/invoke.d.ts.map +1 -0
- package/dist/lib/invoke.js +170 -0
- package/dist/lib/invoke.js.map +1 -0
- package/dist/lib/persona.d.ts +22 -1
- package/dist/lib/persona.d.ts.map +1 -1
- package/dist/lib/persona.js +176 -31
- package/dist/lib/persona.js.map +1 -1
- package/dist/lib/processor.d.ts +58 -0
- package/dist/lib/processor.d.ts.map +1 -0
- package/dist/lib/processor.js +149 -0
- package/dist/lib/processor.js.map +1 -0
- package/dist/lib/registry.d.ts +109 -0
- package/dist/lib/registry.d.ts.map +1 -0
- package/dist/lib/registry.js +192 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/session-thread.d.ts +75 -0
- package/dist/lib/session-thread.d.ts.map +1 -0
- package/dist/lib/session-thread.js +132 -0
- package/dist/lib/session-thread.js.map +1 -0
- package/dist/lib/session.d.ts +150 -0
- package/dist/lib/session.d.ts.map +1 -0
- package/dist/lib/session.js +183 -0
- package/dist/lib/session.js.map +1 -0
- package/dist/lib/types/channel.d.ts +4 -0
- package/dist/lib/types/channel.d.ts.map +1 -1
- package/dist/lib/types/persona.d.ts +49 -6
- package/dist/lib/types/persona.d.ts.map +1 -1
- package/dist/lib/validation/persona.d.ts.map +1 -1
- package/dist/lib/validation/persona.js +41 -4
- package/dist/lib/validation/persona.js.map +1 -1
- package/internal/personas/_base/PERSONA.md +222 -39
- package/internal/skills/channels/list/SKILL.md +76 -0
- package/package.json +15 -5
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { relative } from "node:path";
|
|
2
|
+
import { listPersonas, loadPersona, loadRootPersona } from "./persona.js";
|
|
3
|
+
import { listWorkflows, loadWorkflow } from "./workflow.js";
|
|
4
|
+
import { listChannels } from "./channel.js";
|
|
5
|
+
import { getProjectNameByPath, listProjects } from "./registry.js";
|
|
6
|
+
import { getDaemonStatus } from "./daemon-status.js";
|
|
7
|
+
/**
|
|
8
|
+
* Threshold for switching from full display to names-only
|
|
9
|
+
*/
|
|
10
|
+
const NAMES_ONLY_THRESHOLD = 10;
|
|
11
|
+
/**
|
|
12
|
+
* Threshold for truncating list with "Run X for full list" message
|
|
13
|
+
*/
|
|
14
|
+
const TRUNCATE_THRESHOLD = 25;
|
|
15
|
+
/**
|
|
16
|
+
* Build environment context by discovering project resources.
|
|
17
|
+
*
|
|
18
|
+
* This function:
|
|
19
|
+
* 1. Gets current project info from registry
|
|
20
|
+
* 2. Lists all registered projects with daemon status
|
|
21
|
+
* 3. Lists personas (name + description)
|
|
22
|
+
* 4. Lists workflows (name + description)
|
|
23
|
+
* 5. Lists channels
|
|
24
|
+
*/
|
|
25
|
+
export async function buildEnvironmentContext(config) {
|
|
26
|
+
// Get project name from registry
|
|
27
|
+
const projectName = await getProjectNameByPath(config.agentsDir);
|
|
28
|
+
// Get daemon status for current project
|
|
29
|
+
const daemonStatus = await getDaemonStatus(config.agentsDir);
|
|
30
|
+
// Get all registered projects with daemon status
|
|
31
|
+
const allProjects = await listProjects();
|
|
32
|
+
const registeredProjects = await Promise.all(allProjects.map(async (project) => {
|
|
33
|
+
const projectDaemonStatus = await getDaemonStatus(project.path);
|
|
34
|
+
return {
|
|
35
|
+
name: project.name,
|
|
36
|
+
path: project.path,
|
|
37
|
+
daemonRunning: projectDaemonStatus.running,
|
|
38
|
+
daemonPid: projectDaemonStatus.pid,
|
|
39
|
+
};
|
|
40
|
+
}));
|
|
41
|
+
// List personas
|
|
42
|
+
const personaPaths = await listPersonas(config.personasDir);
|
|
43
|
+
const personas = [];
|
|
44
|
+
// Check for root persona
|
|
45
|
+
const rootPersona = await loadRootPersona(config.agentsDir);
|
|
46
|
+
if (rootPersona) {
|
|
47
|
+
personas.push({
|
|
48
|
+
name: "root",
|
|
49
|
+
description: rootPersona.description,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
for (const personaPath of personaPaths) {
|
|
53
|
+
try {
|
|
54
|
+
const persona = await loadPersona(personaPath);
|
|
55
|
+
// Skip _project if root persona came from there (avoid duplicate)
|
|
56
|
+
const relPath = relative(config.personasDir, personaPath);
|
|
57
|
+
if (relPath === "_project" && rootPersona?.path === personaPath) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
personas.push({
|
|
61
|
+
name: relPath,
|
|
62
|
+
description: persona.description,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Skip invalid personas
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// List workflows
|
|
70
|
+
const workflowPaths = await listWorkflows(config.workflowsDir);
|
|
71
|
+
const workflows = [];
|
|
72
|
+
for (const workflowPath of workflowPaths) {
|
|
73
|
+
try {
|
|
74
|
+
const workflow = await loadWorkflow(workflowPath);
|
|
75
|
+
workflows.push({
|
|
76
|
+
name: workflow.name,
|
|
77
|
+
description: workflow.description,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Skip invalid workflows
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// List channels
|
|
85
|
+
const channelList = await listChannels(config.channelsDir);
|
|
86
|
+
const channels = channelList.map((c) => ({
|
|
87
|
+
name: c.name,
|
|
88
|
+
}));
|
|
89
|
+
return {
|
|
90
|
+
currentTime: new Date(),
|
|
91
|
+
projectName,
|
|
92
|
+
daemonRunning: daemonStatus.running,
|
|
93
|
+
daemonPid: daemonStatus.pid,
|
|
94
|
+
registeredProjects,
|
|
95
|
+
personas,
|
|
96
|
+
workflows,
|
|
97
|
+
channels,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Format a list of items with length management.
|
|
102
|
+
*
|
|
103
|
+
* | Items | Behavior |
|
|
104
|
+
* |-------|----------|
|
|
105
|
+
* | ≤ 10 | Include full list with descriptions |
|
|
106
|
+
* | 11-25 | Include names only, no descriptions |
|
|
107
|
+
* | > 25 | Truncate + "Run `dot-agents list X` for full list" |
|
|
108
|
+
*/
|
|
109
|
+
function formatList(items, itemType) {
|
|
110
|
+
if (items.length === 0) {
|
|
111
|
+
return "(none)";
|
|
112
|
+
}
|
|
113
|
+
const count = items.length;
|
|
114
|
+
const lines = [];
|
|
115
|
+
if (count <= NAMES_ONLY_THRESHOLD) {
|
|
116
|
+
// Full list with descriptions
|
|
117
|
+
for (const item of items) {
|
|
118
|
+
if (item.description) {
|
|
119
|
+
lines.push(`- ${item.name} - ${item.description}`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
lines.push(`- ${item.name}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (count <= TRUNCATE_THRESHOLD) {
|
|
127
|
+
// Names only, no descriptions
|
|
128
|
+
for (const item of items) {
|
|
129
|
+
lines.push(`- ${item.name}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
// Truncate and show first 10, then hint
|
|
134
|
+
for (let i = 0; i < 10; i++) {
|
|
135
|
+
lines.push(`- ${items[i].name}`);
|
|
136
|
+
}
|
|
137
|
+
lines.push(`- ... and ${count - 10} more`);
|
|
138
|
+
lines.push(`Run \`npx dot-agents list ${itemType}\` for full list`);
|
|
139
|
+
}
|
|
140
|
+
return lines.join("\n");
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Format environment context as markdown for injection into persona prompt.
|
|
144
|
+
*
|
|
145
|
+
* Example output:
|
|
146
|
+
* ```markdown
|
|
147
|
+
* ## Your Environment
|
|
148
|
+
*
|
|
149
|
+
* **Project:** docs (registered as @docs) ○ daemon stopped
|
|
150
|
+
*
|
|
151
|
+
* **Personas:** (3)
|
|
152
|
+
* - dottie - Executive assistant
|
|
153
|
+
* - researcher - Deep research with web search
|
|
154
|
+
* - handyman - Routine maintenance fixes
|
|
155
|
+
*
|
|
156
|
+
* **Workflows:** (2)
|
|
157
|
+
* - process-inbox - Process inbox files
|
|
158
|
+
* - daily-review - Review daily sessions
|
|
159
|
+
*
|
|
160
|
+
* **Channels:** (4)
|
|
161
|
+
* #sessions, #issues, #journals, @human
|
|
162
|
+
*
|
|
163
|
+
* **Other Registered Projects:** (2)
|
|
164
|
+
* - @dot-agents ○ daemon stopped
|
|
165
|
+
* - @scoutos ● daemon running (pid 12345)
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
export function formatEnvironmentContext(context) {
|
|
169
|
+
const lines = [];
|
|
170
|
+
lines.push("## Your Environment");
|
|
171
|
+
lines.push("");
|
|
172
|
+
// Current time with day of week
|
|
173
|
+
const dateOptions = {
|
|
174
|
+
weekday: "long",
|
|
175
|
+
year: "numeric",
|
|
176
|
+
month: "long",
|
|
177
|
+
day: "numeric",
|
|
178
|
+
hour: "numeric",
|
|
179
|
+
minute: "2-digit",
|
|
180
|
+
timeZoneName: "short",
|
|
181
|
+
};
|
|
182
|
+
const formattedTime = context.currentTime.toLocaleString(undefined, dateOptions);
|
|
183
|
+
lines.push(`**Current Time:** ${formattedTime}`);
|
|
184
|
+
lines.push("");
|
|
185
|
+
// Project info with daemon status
|
|
186
|
+
const daemonIndicator = context.daemonRunning
|
|
187
|
+
? `● daemon running${context.daemonPid ? ` (pid ${context.daemonPid})` : ""}`
|
|
188
|
+
: "○ daemon stopped";
|
|
189
|
+
if (context.projectName) {
|
|
190
|
+
lines.push(`**Project:** ${context.projectName} (registered as @${context.projectName}) ${daemonIndicator}`);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
lines.push(`**Project:** (not registered) ${daemonIndicator}`);
|
|
194
|
+
}
|
|
195
|
+
lines.push("");
|
|
196
|
+
// Personas
|
|
197
|
+
lines.push(`**Personas:** (${context.personas.length})`);
|
|
198
|
+
lines.push(formatList(context.personas, "personas"));
|
|
199
|
+
lines.push("");
|
|
200
|
+
// Workflows
|
|
201
|
+
lines.push(`**Workflows:** (${context.workflows.length})`);
|
|
202
|
+
lines.push(formatList(context.workflows, "workflows"));
|
|
203
|
+
lines.push("");
|
|
204
|
+
// Channels - format inline if short, otherwise as list
|
|
205
|
+
lines.push(`**Channels:** (${context.channels.length})`);
|
|
206
|
+
if (context.channels.length === 0) {
|
|
207
|
+
lines.push("(none)");
|
|
208
|
+
}
|
|
209
|
+
else if (context.channels.length <= 10) {
|
|
210
|
+
// Inline format for short lists
|
|
211
|
+
lines.push(context.channels.map((c) => c.name).join(", "));
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
lines.push(formatList(context.channels, "channels"));
|
|
215
|
+
}
|
|
216
|
+
lines.push("");
|
|
217
|
+
// Registered projects (other projects you can communicate with)
|
|
218
|
+
const otherProjects = context.registeredProjects.filter((p) => p.name !== context.projectName);
|
|
219
|
+
if (otherProjects.length > 0) {
|
|
220
|
+
lines.push(`**Other Registered Projects:** (${otherProjects.length})`);
|
|
221
|
+
for (const project of otherProjects) {
|
|
222
|
+
const daemonStatus = project.daemonRunning
|
|
223
|
+
? `● daemon running${project.daemonPid ? ` (pid ${project.daemonPid})` : ""}`
|
|
224
|
+
: "○ daemon stopped";
|
|
225
|
+
lines.push(`- @${project.name} ${daemonStatus}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return lines.join("\n");
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Build and format environment context as markdown.
|
|
232
|
+
* Convenience function that combines buildEnvironmentContext and formatEnvironmentContext.
|
|
233
|
+
*/
|
|
234
|
+
export async function getEnvironmentContextMarkdown(config) {
|
|
235
|
+
const context = await buildEnvironmentContext(config);
|
|
236
|
+
return formatEnvironmentContext(context);
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/lib/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,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IAChE,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,MAAM,CACrD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,WAAW,CACtC,CAAC;IACF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,mCAAmC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;QACvE,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,OAAO,CAAC,aAAa;gBACxC,CAAC,CAAC,mBAAmB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC7E,CAAC,CAAC,kBAAkB,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,MAAM,OAAO,CAAC,IAAI,IAAI,YAAY,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,MAAuB;IAEvB,MAAM,OAAO,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,CAAC;IACtD,OAAO,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -7,6 +7,10 @@ export interface ParsedMarkdown<T> {
|
|
|
7
7
|
/** Markdown body content (after frontmatter) */
|
|
8
8
|
body: string;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Check if content has YAML frontmatter
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasFrontmatter(content: string): boolean;
|
|
10
14
|
/**
|
|
11
15
|
* Parse YAML frontmatter from a markdown file
|
|
12
16
|
*/
|
|
@@ -15,4 +19,8 @@ export declare function parseFrontmatter<T>(content: string): ParsedMarkdown<T>;
|
|
|
15
19
|
* Load and parse a markdown file with YAML frontmatter
|
|
16
20
|
*/
|
|
17
21
|
export declare function loadMarkdownFile<T>(filePath: string): Promise<ParsedMarkdown<T>>;
|
|
22
|
+
/**
|
|
23
|
+
* Stringify frontmatter and body back to markdown format
|
|
24
|
+
*/
|
|
25
|
+
export declare function stringifyFrontmatter<T>(frontmatter: T, body: string): string;
|
|
18
26
|
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,8BAA8B;IAC9B,WAAW,EAAE,CAAC,CAAC;IACf,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CActE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAG5B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5E"}
|
package/dist/lib/frontmatter.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { parse as parseYaml } from "yaml";
|
|
2
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
3
|
+
const FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
4
|
+
/**
|
|
5
|
+
* Check if content has YAML frontmatter
|
|
6
|
+
*/
|
|
7
|
+
export function hasFrontmatter(content) {
|
|
8
|
+
return FRONTMATTER_REGEX.test(content);
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Parse YAML frontmatter from a markdown file
|
|
5
12
|
*/
|
|
6
13
|
export function parseFrontmatter(content) {
|
|
7
|
-
const
|
|
8
|
-
const match = content.match(frontmatterRegex);
|
|
14
|
+
const match = content.match(FRONTMATTER_REGEX);
|
|
9
15
|
if (!match) {
|
|
10
16
|
throw new Error("No YAML frontmatter found");
|
|
11
17
|
}
|
|
@@ -23,4 +29,11 @@ export async function loadMarkdownFile(filePath) {
|
|
|
23
29
|
const content = await readFile(filePath, "utf-8");
|
|
24
30
|
return parseFrontmatter(content);
|
|
25
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Stringify frontmatter and body back to markdown format
|
|
34
|
+
*/
|
|
35
|
+
export function stringifyFrontmatter(frontmatter, body) {
|
|
36
|
+
const yamlContent = stringifyYaml(frontmatter, { indent: 2 }).trim();
|
|
37
|
+
return `---\n${yamlContent}\n---\n\n${body}`;
|
|
38
|
+
}
|
|
26
39
|
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/lib/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAEtE,MAAM,iBAAiB,GAAG,6CAA6C,CAAC;AAYxE;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAI,OAAe;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;IACpC,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAM,CAAC;IAEhD,OAAO;QACL,WAAW;QACX,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;KAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAgB;IAEhB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,gBAAgB,CAAI,OAAO,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAI,WAAc,EAAE,IAAY;IAClE,MAAM,WAAW,GAAG,aAAa,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACrE,OAAO,QAAQ,WAAW,YAAY,IAAI,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ export * from "./workflow.js";
|
|
|
5
5
|
export * from "./variables.js";
|
|
6
6
|
export * from "./config.js";
|
|
7
7
|
export * from "./channel.js";
|
|
8
|
+
export * from "./registry.js";
|
|
8
9
|
export * from "./version.js";
|
|
10
|
+
export * from "./session.js";
|
|
11
|
+
export * from "./session-thread.js";
|
|
12
|
+
export * from "./invoke.js";
|
|
13
|
+
export * from "./processor.js";
|
|
14
|
+
export * from "./environment.js";
|
|
15
|
+
export * from "./daemon-status.js";
|
|
9
16
|
export * from "./validation/index.js";
|
|
10
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAGjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AAGjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,uBAAuB,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -7,7 +7,14 @@ export * from "./workflow.js";
|
|
|
7
7
|
export * from "./variables.js";
|
|
8
8
|
export * from "./config.js";
|
|
9
9
|
export * from "./channel.js";
|
|
10
|
+
export * from "./registry.js";
|
|
10
11
|
export * from "./version.js";
|
|
12
|
+
export * from "./session.js";
|
|
13
|
+
export * from "./session-thread.js";
|
|
14
|
+
export * from "./invoke.js";
|
|
15
|
+
export * from "./processor.js";
|
|
16
|
+
export * from "./environment.js";
|
|
17
|
+
export * from "./daemon-status.js";
|
|
11
18
|
// Validation
|
|
12
19
|
export * from "./validation/index.js";
|
|
13
20
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,kBAAkB,CAAC;AAEjC,oBAAoB;AACpB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,kBAAkB,CAAC;AAEjC,oBAAoB;AACpB,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AAEnC,aAAa;AACb,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type DotAgentsConfig, type ExecutionResult } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Execution mode for persona invocation
|
|
4
|
+
*/
|
|
5
|
+
export type ExecutionMode = "headless" | "interactive";
|
|
6
|
+
/**
|
|
7
|
+
* Options for invoking a persona directly
|
|
8
|
+
*/
|
|
9
|
+
export interface InvokePersonaOptions {
|
|
10
|
+
/** Extra context variables to include */
|
|
11
|
+
context?: Record<string, string>;
|
|
12
|
+
/** Source of the invocation (e.g., DM channel name) */
|
|
13
|
+
source?: string;
|
|
14
|
+
/** Goal description for the session */
|
|
15
|
+
goal?: string;
|
|
16
|
+
/** Timeout in milliseconds (default: 10 minutes) */
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
/** Execution mode: headless (default) or interactive */
|
|
19
|
+
mode?: ExecutionMode;
|
|
20
|
+
/** Stream stdout/stderr to console for visibility */
|
|
21
|
+
verbose?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Invoke a persona directly with a message (no workflow required)
|
|
25
|
+
*
|
|
26
|
+
* This is the shared implementation used by:
|
|
27
|
+
* - daemon/lib/executor.ts for DM-triggered invocations
|
|
28
|
+
* - lib/processor.ts for one-shot channel processing
|
|
29
|
+
*/
|
|
30
|
+
export declare function invokePersona(config: DotAgentsConfig, personaName: string, message: string, options?: InvokePersonaOptions): Promise<ExecutionResult>;
|
|
31
|
+
//# sourceMappingURL=invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../src/lib/invoke.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,eAAe,EAOrB,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,aAAa,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,eAAe,CAAC,CAgM1B"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { hostname } from "node:os";
|
|
3
|
+
import { execa } from "execa";
|
|
4
|
+
import { resolvePersona, createExecutionContext, processTemplate, expandVariables, createSession, finalizeSession, } from "./index.js";
|
|
5
|
+
import { getEnvironmentContextMarkdown } from "./environment.js";
|
|
6
|
+
/**
|
|
7
|
+
* Invoke a persona directly with a message (no workflow required)
|
|
8
|
+
*
|
|
9
|
+
* This is the shared implementation used by:
|
|
10
|
+
* - daemon/lib/executor.ts for DM-triggered invocations
|
|
11
|
+
* - lib/processor.ts for one-shot channel processing
|
|
12
|
+
*/
|
|
13
|
+
export async function invokePersona(config, personaName, message, options = {}) {
|
|
14
|
+
const startedAt = new Date();
|
|
15
|
+
const { context: extraContext = {}, source = "dm", goal = `DM invocation: ${personaName}`, timeoutMs = 10 * 60 * 1000, mode = "headless", verbose = false, } = options;
|
|
16
|
+
// Resolve persona path - handle root persona specially
|
|
17
|
+
const personaPath = personaName === "root"
|
|
18
|
+
? config.agentsDir
|
|
19
|
+
: join(config.personasDir, personaName);
|
|
20
|
+
const persona = await resolvePersona(personaPath, config.personasDir);
|
|
21
|
+
// Create session for DM invocation
|
|
22
|
+
const session = await createSession({
|
|
23
|
+
sessionsDir: config.sessionsDir,
|
|
24
|
+
runtime: {
|
|
25
|
+
hostname: hostname(),
|
|
26
|
+
executionMode: mode,
|
|
27
|
+
triggerType: "dm",
|
|
28
|
+
workingDir: config.agentsDir,
|
|
29
|
+
},
|
|
30
|
+
goal,
|
|
31
|
+
persona: {
|
|
32
|
+
name: persona.name,
|
|
33
|
+
inheritanceChain: persona.inheritanceChain,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const context = createExecutionContext({
|
|
37
|
+
PERSONA_NAME: persona.name,
|
|
38
|
+
PERSONA_DIR: persona.path,
|
|
39
|
+
AGENTS_DIR: config.agentsDir,
|
|
40
|
+
SESSION_DIR: session.path,
|
|
41
|
+
INVOCATION_SOURCE: source,
|
|
42
|
+
...extraContext,
|
|
43
|
+
});
|
|
44
|
+
// Merge environment
|
|
45
|
+
// Include FROM_ADDRESS, FROM_CHANNEL, FROM_THREAD from context if provided
|
|
46
|
+
const env = {
|
|
47
|
+
...process.env,
|
|
48
|
+
...persona.env,
|
|
49
|
+
DOT_AGENTS_PERSONA: persona.name,
|
|
50
|
+
DOT_AGENTS_INVOCATION: "dm",
|
|
51
|
+
// Pass session env vars from legacy session
|
|
52
|
+
SESSION_DIR: session.path,
|
|
53
|
+
// Pass callback routing from context (for cross-project delegation)
|
|
54
|
+
...(extraContext.FROM_ADDRESS && { FROM_ADDRESS: extraContext.FROM_ADDRESS }),
|
|
55
|
+
...(extraContext.FROM_CHANNEL && { FROM_CHANNEL: extraContext.FROM_CHANNEL }),
|
|
56
|
+
...(extraContext.FROM_THREAD && { FROM_THREAD: extraContext.FROM_THREAD }),
|
|
57
|
+
};
|
|
58
|
+
for (const [key, value] of Object.entries(env)) {
|
|
59
|
+
if (value) {
|
|
60
|
+
env[key] = expandVariables(value, context, env);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Build prompt: persona prompt + environment context + message
|
|
64
|
+
const parts = [];
|
|
65
|
+
if (persona.prompt) {
|
|
66
|
+
const expandedPrompt = processTemplate(persona.prompt, context, persona.env);
|
|
67
|
+
parts.push(expandedPrompt);
|
|
68
|
+
parts.push("\n---\n");
|
|
69
|
+
}
|
|
70
|
+
// Inject environment discovery context
|
|
71
|
+
const environmentContext = await getEnvironmentContextMarkdown(config);
|
|
72
|
+
parts.push(environmentContext);
|
|
73
|
+
parts.push("\n---\n");
|
|
74
|
+
parts.push(`You received a direct message:\n\n${message}`);
|
|
75
|
+
const prompt = parts.join("\n");
|
|
76
|
+
// Use commands based on mode
|
|
77
|
+
const cmds = mode === "interactive" ? persona.commands.interactive : persona.commands.headless;
|
|
78
|
+
if (!cmds) {
|
|
79
|
+
const endedAt = new Date();
|
|
80
|
+
const result = {
|
|
81
|
+
success: false,
|
|
82
|
+
exitCode: 1,
|
|
83
|
+
stdout: "",
|
|
84
|
+
stderr: `Persona '${persona.name}' does not support ${mode} mode`,
|
|
85
|
+
duration: endedAt.getTime() - startedAt.getTime(),
|
|
86
|
+
runId: context.RUN_ID,
|
|
87
|
+
startedAt,
|
|
88
|
+
endedAt,
|
|
89
|
+
error: `Persona does not support ${mode} mode`,
|
|
90
|
+
};
|
|
91
|
+
await finalizeSession(session, {
|
|
92
|
+
success: result.success,
|
|
93
|
+
exitCode: result.exitCode,
|
|
94
|
+
duration: result.duration,
|
|
95
|
+
error: result.error,
|
|
96
|
+
stderr: result.stderr,
|
|
97
|
+
});
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
// Try each command
|
|
101
|
+
let lastError = null;
|
|
102
|
+
let result = null;
|
|
103
|
+
for (const cmd of cmds) {
|
|
104
|
+
try {
|
|
105
|
+
const expandedCmd = expandVariables(cmd, context, env);
|
|
106
|
+
const [command, ...args] = expandedCmd.split(/\s+/);
|
|
107
|
+
// Execute with appropriate stdio based on verbose mode
|
|
108
|
+
const execResult = verbose
|
|
109
|
+
? await execa(command, args, {
|
|
110
|
+
input: prompt,
|
|
111
|
+
cwd: config.agentsDir,
|
|
112
|
+
env,
|
|
113
|
+
timeout: timeoutMs,
|
|
114
|
+
reject: false,
|
|
115
|
+
stdout: "inherit",
|
|
116
|
+
stderr: "inherit",
|
|
117
|
+
})
|
|
118
|
+
: await execa(command, args, {
|
|
119
|
+
input: prompt,
|
|
120
|
+
cwd: config.agentsDir,
|
|
121
|
+
env,
|
|
122
|
+
timeout: timeoutMs,
|
|
123
|
+
reject: false,
|
|
124
|
+
});
|
|
125
|
+
const endedAt = new Date();
|
|
126
|
+
result = {
|
|
127
|
+
success: execResult.exitCode === 0,
|
|
128
|
+
exitCode: execResult.exitCode ?? 1,
|
|
129
|
+
stdout: verbose ? "" : execResult.stdout || "",
|
|
130
|
+
stderr: verbose ? "" : execResult.stderr || "",
|
|
131
|
+
duration: endedAt.getTime() - startedAt.getTime(),
|
|
132
|
+
runId: context.RUN_ID,
|
|
133
|
+
startedAt,
|
|
134
|
+
endedAt,
|
|
135
|
+
};
|
|
136
|
+
if (result.success)
|
|
137
|
+
break;
|
|
138
|
+
const stderrStr = verbose ? "" : execResult.stderr || "";
|
|
139
|
+
lastError = new Error(`Command failed with exit code ${result.exitCode}${stderrStr ? `: ${stderrStr}` : ""}`);
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
lastError = error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (!result) {
|
|
146
|
+
const endedAt = new Date();
|
|
147
|
+
result = {
|
|
148
|
+
success: false,
|
|
149
|
+
exitCode: 1,
|
|
150
|
+
stdout: "",
|
|
151
|
+
stderr: lastError?.message ?? "All commands failed",
|
|
152
|
+
duration: endedAt.getTime() - startedAt.getTime(),
|
|
153
|
+
runId: context.RUN_ID,
|
|
154
|
+
startedAt,
|
|
155
|
+
endedAt,
|
|
156
|
+
error: lastError?.message,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// Finalize session
|
|
160
|
+
await finalizeSession(session, {
|
|
161
|
+
success: result.success,
|
|
162
|
+
exitCode: result.exitCode,
|
|
163
|
+
duration: result.duration,
|
|
164
|
+
error: result.error,
|
|
165
|
+
stdout: result.stdout,
|
|
166
|
+
stderr: result.stderr,
|
|
167
|
+
});
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=invoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../../src/lib/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAGL,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAyBjE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAuB,EACvB,WAAmB,EACnB,OAAe,EACf,UAAgC,EAAE;IAElC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC;IAC7B,MAAM,EACJ,OAAO,EAAE,YAAY,GAAG,EAAE,EAC1B,MAAM,GAAG,IAAI,EACb,IAAI,GAAG,kBAAkB,WAAW,EAAE,EACtC,SAAS,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAC1B,IAAI,GAAG,UAAU,EACjB,OAAO,GAAG,KAAK,GAChB,GAAG,OAAO,CAAC;IAEZ,uDAAuD;IACvD,MAAM,WAAW,GAAG,WAAW,KAAK,MAAM;QACxC,CAAC,CAAC,MAAM,CAAC,SAAS;QAClB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAE1C,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAEtE,mCAAmC;IACnC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC;QAClC,WAAW,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OAAO;SAC1B,CAAC;IACJ,CAAC;IAED,mBAAmB;IACnB,MAAM,eAAe,CAAC,OAAO,EAAE;QAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/lib/persona.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export declare function getInternalSkillsPath(): string;
|
|
|
17
17
|
* Resolve cmd field to ResolvedCommands structure
|
|
18
18
|
*/
|
|
19
19
|
export declare function resolveCommands(cmd: CommandSpec | CommandModes | undefined): ResolvedCommands;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a directory contains a PERSONA.md file
|
|
22
|
+
*/
|
|
23
|
+
declare function hasPersonaFile(dirPath: string): Promise<boolean>;
|
|
20
24
|
/**
|
|
21
25
|
* Load a single persona file
|
|
22
26
|
*/
|
|
@@ -26,6 +30,18 @@ export declare function loadPersona(personaPath: string): Promise<Persona>;
|
|
|
26
30
|
* Returns null if not found (graceful degradation)
|
|
27
31
|
*/
|
|
28
32
|
export declare function loadInternalBase(): Promise<Persona | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Load the project's _project persona if it exists
|
|
35
|
+
* Returns null if not found (graceful degradation)
|
|
36
|
+
* @deprecated Use loadRootPersona() instead
|
|
37
|
+
*/
|
|
38
|
+
export declare function loadProjectBase(personasRoot: string): Promise<Persona | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Load the root persona from .agents/PERSONA.md if it exists
|
|
41
|
+
* Falls back to _project for backwards compatibility
|
|
42
|
+
* Returns null if neither found
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadRootPersona(agentsRoot: string): Promise<Persona | null>;
|
|
29
45
|
/**
|
|
30
46
|
* Build the inheritance chain for a persona path
|
|
31
47
|
* Returns paths from root to leaf (e.g., ["claude", "claude/autonomous"])
|
|
@@ -44,9 +60,14 @@ export declare function deepMerge<T extends Record<string, unknown>>(parent: T,
|
|
|
44
60
|
* Merge two personas (child inherits from parent)
|
|
45
61
|
*/
|
|
46
62
|
export declare function mergePersonas(parent: Persona, child: Persona): Persona;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a directory contains a PERSONA.md file (exported for use in resolvePersona)
|
|
65
|
+
*/
|
|
66
|
+
export { hasPersonaFile };
|
|
47
67
|
/**
|
|
48
68
|
* Resolve a persona with full inheritance chain
|
|
49
|
-
*
|
|
69
|
+
* Uses directory-based inheritance: child inherits from parent directories
|
|
70
|
+
* Includes implicit inheritance from internal _base persona and root persona
|
|
50
71
|
*/
|
|
51
72
|
export declare function resolvePersona(personaPath: string, personasRoot: string): Promise<ResolvedPersona>;
|
|
52
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persona.d.ts","sourceRoot":"","sources":["../../src/lib/persona.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAEP,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"persona.d.ts","sourceRoot":"","sources":["../../src/lib/persona.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,OAAO,EAEP,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAM5B;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAMhD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAM9C;AAsBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,gBAAgB,CA0B7F;AAED;;G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