dot-agents 0.4.1 → 0.6.0
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 +152 -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 +5 -12
- 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 +102 -25
- package/dist/cli/lib/runner.js.map +1 -1
- package/dist/daemon/api/server.d.ts.map +1 -1
- package/dist/daemon/api/server.js +4 -2
- package/dist/daemon/api/server.js.map +1 -1
- package/dist/daemon/daemon.d.ts +12 -3
- package/dist/daemon/daemon.d.ts.map +1 -1
- package/dist/daemon/daemon.js +138 -35
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/lib/executor.d.ts +12 -2
- package/dist/daemon/lib/executor.d.ts.map +1 -1
- package/dist/daemon/lib/executor.js +52 -34
- package/dist/daemon/lib/executor.js.map +1 -1
- package/dist/daemon/lib/watcher.d.ts +14 -2
- package/dist/daemon/lib/watcher.d.ts.map +1 -1
- package/dist/daemon/lib/watcher.js +43 -3
- package/dist/daemon/lib/watcher.js.map +1 -1
- 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/channel.test.d.ts +2 -0
- package/dist/lib/channel.test.d.ts.map +1 -0
- package/dist/lib/channel.test.js +33 -0
- package/dist/lib/channel.test.js.map +1 -0
- 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 +87 -0
- package/dist/lib/environment.d.ts.map +1 -0
- package/dist/lib/environment.js +224 -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/frontmatter.test.d.ts +2 -0
- package/dist/lib/frontmatter.test.d.ts.map +1 -0
- package/dist/lib/frontmatter.test.js +60 -0
- package/dist/lib/frontmatter.test.js.map +1 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +8 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/integration.test.d.ts +2 -0
- package/dist/lib/integration.test.d.ts.map +1 -0
- package/dist/lib/integration.test.js +445 -0
- package/dist/lib/integration.test.js.map +1 -0
- package/dist/lib/invoke.d.ts +23 -0
- package/dist/lib/invoke.d.ts.map +1 -0
- package/dist/lib/invoke.js +158 -0
- package/dist/lib/invoke.js.map +1 -0
- package/dist/lib/invoke.test.d.ts +2 -0
- package/dist/lib/invoke.test.d.ts.map +1 -0
- package/dist/lib/invoke.test.js +82 -0
- package/dist/lib/invoke.test.js.map +1 -0
- package/dist/lib/persona.d.ts +41 -0
- package/dist/lib/persona.d.ts.map +1 -1
- package/dist/lib/persona.js +233 -31
- package/dist/lib/persona.js.map +1 -1
- package/dist/lib/persona.test.d.ts +2 -0
- package/dist/lib/persona.test.d.ts.map +1 -0
- package/dist/lib/persona.test.js +324 -0
- package/dist/lib/persona.test.js.map +1 -0
- package/dist/lib/processor.d.ts +50 -0
- package/dist/lib/processor.d.ts.map +1 -0
- package/dist/lib/processor.js +135 -0
- package/dist/lib/processor.js.map +1 -0
- package/dist/lib/processor.test.d.ts +2 -0
- package/dist/lib/processor.test.d.ts.map +1 -0
- package/dist/lib/processor.test.js +134 -0
- package/dist/lib/processor.test.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/registry.test.d.ts +2 -0
- package/dist/lib/registry.test.d.ts.map +1 -0
- package/dist/lib/registry.test.js +236 -0
- package/dist/lib/registry.test.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-thread.test.d.ts +2 -0
- package/dist/lib/session-thread.test.d.ts.map +1 -0
- package/dist/lib/session-thread.test.js +235 -0
- package/dist/lib/session-thread.test.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/session.test.d.ts +2 -0
- package/dist/lib/session.test.d.ts.map +1 -0
- package/dist/lib/session.test.js +336 -0
- package/dist/lib/session.test.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 +51 -0
- package/dist/lib/types/persona.d.ts.map +1 -1
- package/dist/lib/types/triggers.d.ts +11 -0
- package/dist/lib/types/triggers.d.ts.map +1 -1
- package/dist/lib/version.d.ts +26 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +61 -0
- package/dist/lib/version.js.map +1 -0
- package/internal/personas/_base/PERSONA.md +251 -0
- package/internal/skills/channels/list/SKILL.md +76 -0
- package/internal/skills/channels/publish/SKILL.md +129 -0
- package/internal/skills/channels/read/SKILL.md +124 -0
- package/internal/skills/channels/reply/SKILL.md +138 -0
- package/package.json +7 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { DotAgentsConfig } from "./types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Persona info for environment context
|
|
4
|
+
*/
|
|
5
|
+
interface PersonaInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Workflow info for environment context
|
|
11
|
+
*/
|
|
12
|
+
interface WorkflowInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Channel info for environment context
|
|
18
|
+
*/
|
|
19
|
+
interface ChannelInfo {
|
|
20
|
+
name: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Registered project info for environment context
|
|
24
|
+
*/
|
|
25
|
+
interface RegisteredProjectInfo {
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
daemonRunning: boolean;
|
|
29
|
+
daemonPid?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Environment context data
|
|
33
|
+
*/
|
|
34
|
+
export interface EnvironmentContext {
|
|
35
|
+
projectName: string | null;
|
|
36
|
+
daemonRunning: boolean;
|
|
37
|
+
daemonPid?: number;
|
|
38
|
+
registeredProjects: RegisteredProjectInfo[];
|
|
39
|
+
personas: PersonaInfo[];
|
|
40
|
+
workflows: WorkflowInfo[];
|
|
41
|
+
channels: ChannelInfo[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Build environment context by discovering project resources.
|
|
45
|
+
*
|
|
46
|
+
* This function:
|
|
47
|
+
* 1. Gets current project info from registry
|
|
48
|
+
* 2. Lists all registered projects with daemon status
|
|
49
|
+
* 3. Lists personas (name + description)
|
|
50
|
+
* 4. Lists workflows (name + description)
|
|
51
|
+
* 5. Lists channels
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildEnvironmentContext(config: DotAgentsConfig): Promise<EnvironmentContext>;
|
|
54
|
+
/**
|
|
55
|
+
* Format environment context as markdown for injection into persona prompt.
|
|
56
|
+
*
|
|
57
|
+
* Example output:
|
|
58
|
+
* ```markdown
|
|
59
|
+
* ## Your Environment
|
|
60
|
+
*
|
|
61
|
+
* **Project:** docs (registered as @docs) ○ daemon stopped
|
|
62
|
+
*
|
|
63
|
+
* **Personas:** (3)
|
|
64
|
+
* - dottie - Executive assistant
|
|
65
|
+
* - researcher - Deep research with web search
|
|
66
|
+
* - handyman - Routine maintenance fixes
|
|
67
|
+
*
|
|
68
|
+
* **Workflows:** (2)
|
|
69
|
+
* - process-inbox - Process inbox files
|
|
70
|
+
* - daily-review - Review daily sessions
|
|
71
|
+
*
|
|
72
|
+
* **Channels:** (4)
|
|
73
|
+
* #sessions, #issues, #journals, @human
|
|
74
|
+
*
|
|
75
|
+
* **Other Registered Projects:** (2)
|
|
76
|
+
* - @dot-agents ○ daemon stopped
|
|
77
|
+
* - @scoutos ● daemon running (pid 12345)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export declare function formatEnvironmentContext(context: EnvironmentContext): string;
|
|
81
|
+
/**
|
|
82
|
+
* Build and format environment context as markdown.
|
|
83
|
+
* Convenience function that combines buildEnvironmentContext and formatEnvironmentContext.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getEnvironmentContextMarkdown(config: DotAgentsConfig): Promise<string>;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=environ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-0,0 +1,224 @@
|
|
|
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
|
+
projectName,
|
|
91
|
+
daemonRunning: daemonStatus.running,
|
|
92
|
+
daemonPid: daemonStatus.pid,
|
|
93
|
+
registeredProjects,
|
|
94
|
+
personas,
|
|
95
|
+
workflows,
|
|
96
|
+
channels,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Format a list of items with length management.
|
|
101
|
+
*
|
|
102
|
+
* | Items | Behavior |
|
|
103
|
+
* |-------|----------|
|
|
104
|
+
* | ≤ 10 | Include full list with descriptions |
|
|
105
|
+
* | 11-25 | Include names only, no descriptions |
|
|
106
|
+
* | > 25 | Truncate + "Run `dot-agents list X` for full list" |
|
|
107
|
+
*/
|
|
108
|
+
function formatList(items, itemType) {
|
|
109
|
+
if (items.length === 0) {
|
|
110
|
+
return "(none)";
|
|
111
|
+
}
|
|
112
|
+
const count = items.length;
|
|
113
|
+
const lines = [];
|
|
114
|
+
if (count <= NAMES_ONLY_THRESHOLD) {
|
|
115
|
+
// Full list with descriptions
|
|
116
|
+
for (const item of items) {
|
|
117
|
+
if (item.description) {
|
|
118
|
+
lines.push(`- ${item.name} - ${item.description}`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
lines.push(`- ${item.name}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else if (count <= TRUNCATE_THRESHOLD) {
|
|
126
|
+
// Names only, no descriptions
|
|
127
|
+
for (const item of items) {
|
|
128
|
+
lines.push(`- ${item.name}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// Truncate and show first 10, then hint
|
|
133
|
+
for (let i = 0; i < 10; i++) {
|
|
134
|
+
lines.push(`- ${items[i].name}`);
|
|
135
|
+
}
|
|
136
|
+
lines.push(`- ... and ${count - 10} more`);
|
|
137
|
+
lines.push(`Run \`npx dot-agents list ${itemType}\` for full list`);
|
|
138
|
+
}
|
|
139
|
+
return lines.join("\n");
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Format environment context as markdown for injection into persona prompt.
|
|
143
|
+
*
|
|
144
|
+
* Example output:
|
|
145
|
+
* ```markdown
|
|
146
|
+
* ## Your Environment
|
|
147
|
+
*
|
|
148
|
+
* **Project:** docs (registered as @docs) ○ daemon stopped
|
|
149
|
+
*
|
|
150
|
+
* **Personas:** (3)
|
|
151
|
+
* - dottie - Executive assistant
|
|
152
|
+
* - researcher - Deep research with web search
|
|
153
|
+
* - handyman - Routine maintenance fixes
|
|
154
|
+
*
|
|
155
|
+
* **Workflows:** (2)
|
|
156
|
+
* - process-inbox - Process inbox files
|
|
157
|
+
* - daily-review - Review daily sessions
|
|
158
|
+
*
|
|
159
|
+
* **Channels:** (4)
|
|
160
|
+
* #sessions, #issues, #journals, @human
|
|
161
|
+
*
|
|
162
|
+
* **Other Registered Projects:** (2)
|
|
163
|
+
* - @dot-agents ○ daemon stopped
|
|
164
|
+
* - @scoutos ● daemon running (pid 12345)
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
export function formatEnvironmentContext(context) {
|
|
168
|
+
const lines = [];
|
|
169
|
+
lines.push("## Your Environment");
|
|
170
|
+
lines.push("");
|
|
171
|
+
// Project info with daemon status
|
|
172
|
+
const daemonIndicator = context.daemonRunning
|
|
173
|
+
? `● daemon running${context.daemonPid ? ` (pid ${context.daemonPid})` : ""}`
|
|
174
|
+
: "○ daemon stopped";
|
|
175
|
+
if (context.projectName) {
|
|
176
|
+
lines.push(`**Project:** ${context.projectName} (registered as @${context.projectName}) ${daemonIndicator}`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
lines.push(`**Project:** (not registered) ${daemonIndicator}`);
|
|
180
|
+
}
|
|
181
|
+
lines.push("");
|
|
182
|
+
// Personas
|
|
183
|
+
lines.push(`**Personas:** (${context.personas.length})`);
|
|
184
|
+
lines.push(formatList(context.personas, "personas"));
|
|
185
|
+
lines.push("");
|
|
186
|
+
// Workflows
|
|
187
|
+
lines.push(`**Workflows:** (${context.workflows.length})`);
|
|
188
|
+
lines.push(formatList(context.workflows, "workflows"));
|
|
189
|
+
lines.push("");
|
|
190
|
+
// Channels - format inline if short, otherwise as list
|
|
191
|
+
lines.push(`**Channels:** (${context.channels.length})`);
|
|
192
|
+
if (context.channels.length === 0) {
|
|
193
|
+
lines.push("(none)");
|
|
194
|
+
}
|
|
195
|
+
else if (context.channels.length <= 10) {
|
|
196
|
+
// Inline format for short lists
|
|
197
|
+
lines.push(context.channels.map((c) => c.name).join(", "));
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
lines.push(formatList(context.channels, "channels"));
|
|
201
|
+
}
|
|
202
|
+
lines.push("");
|
|
203
|
+
// Registered projects (other projects you can communicate with)
|
|
204
|
+
const otherProjects = context.registeredProjects.filter((p) => p.name !== context.projectName);
|
|
205
|
+
if (otherProjects.length > 0) {
|
|
206
|
+
lines.push(`**Other Registered Projects:** (${otherProjects.length})`);
|
|
207
|
+
for (const project of otherProjects) {
|
|
208
|
+
const daemonStatus = project.daemonRunning
|
|
209
|
+
? `● daemon running${project.daemonPid ? ` (pid ${project.daemonPid})` : ""}`
|
|
210
|
+
: "○ daemon stopped";
|
|
211
|
+
lines.push(`- @${project.name} ${daemonStatus}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return lines.join("\n");
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Build and format environment context as markdown.
|
|
218
|
+
* Convenience function that combines buildEnvironmentContext and formatEnvironmentContext.
|
|
219
|
+
*/
|
|
220
|
+
export async function getEnvironmentContextMarkdown(config) {
|
|
221
|
+
const context = await buildEnvironmentContext(config);
|
|
222
|
+
return formatEnvironmentContext(context);
|
|
223
|
+
}
|
|
224
|
+
//# 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;A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O,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.test.d.ts","sourceRoot":"","sources":["../../src/lib/frontmatter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { describe, it } from "node:test";
|
|
2
|
+
import assert from "node:assert";
|
|
3
|
+
import { parseFrontmatter, hasFrontmatter } from "./frontmatter.js";
|
|
4
|
+
describe("parseFrontmatter", () => {
|
|
5
|
+
it("parses valid frontmatter", () => {
|
|
6
|
+
const content = `---
|
|
7
|
+
title: Test
|
|
8
|
+
count: 42
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Body content here.`;
|
|
12
|
+
const result = parseFrontmatter(content);
|
|
13
|
+
assert.deepStrictEqual(result.frontmatter, { title: "Test", count: 42 });
|
|
14
|
+
assert.strictEqual(result.body, "Body content here.");
|
|
15
|
+
});
|
|
16
|
+
it("handles empty body", () => {
|
|
17
|
+
const content = `---
|
|
18
|
+
key: value
|
|
19
|
+
---
|
|
20
|
+
`;
|
|
21
|
+
const result = parseFrontmatter(content);
|
|
22
|
+
assert.deepStrictEqual(result.frontmatter, { key: "value" });
|
|
23
|
+
assert.strictEqual(result.body, "");
|
|
24
|
+
});
|
|
25
|
+
it("throws on missing frontmatter", () => {
|
|
26
|
+
const content = "Just plain markdown content";
|
|
27
|
+
assert.throws(() => parseFrontmatter(content), {
|
|
28
|
+
message: "No YAML frontmatter found",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
it("throws on malformed frontmatter (missing closing)", () => {
|
|
32
|
+
const content = `---
|
|
33
|
+
title: Test
|
|
34
|
+
No closing delimiter`;
|
|
35
|
+
assert.throws(() => parseFrontmatter(content), {
|
|
36
|
+
message: "No YAML frontmatter found",
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
describe("hasFrontmatter", () => {
|
|
41
|
+
it("returns true for content with frontmatter", () => {
|
|
42
|
+
const content = `---
|
|
43
|
+
title: Test
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
Body`;
|
|
47
|
+
assert.strictEqual(hasFrontmatter(content), true);
|
|
48
|
+
});
|
|
49
|
+
it("returns false for content without frontmatter", () => {
|
|
50
|
+
const content = "Just plain markdown";
|
|
51
|
+
assert.strictEqual(hasFrontmatter(content), false);
|
|
52
|
+
});
|
|
53
|
+
it("returns false for partial frontmatter", () => {
|
|
54
|
+
const content = `---
|
|
55
|
+
title: Test
|
|
56
|
+
Missing closing`;
|
|
57
|
+
assert.strictEqual(hasFrontmatter(content), false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=frontmatter.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.test.js","sourceRoot":"","sources":["../../src/lib/frontmatter.test.ts"],"names":[],"mappings":"AAAA,OA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M,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE;YAC7C,OAAO,EAAE,2BAA2B;SACrC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,OAAO,GAAG;;;;KAIf,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,OAAO,GAAG,qBAAqB,CAAC;QAEtC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG;;gBAEJ,CAAC;QAEb,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -5,5 +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";
|
|
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";
|
|
8
16
|
export * from "./validation/index.js";
|
|
9
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;
|
|
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,6 +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";
|
|
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";
|
|
10
18
|
// Validation
|
|
11
19
|
export * from "./validation/index.js";
|
|
12
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;
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"integration.test.d.ts","sourceRoot":"","sources":["../../src/lib/integration.test.ts"],"names":[],"mappings":""}
|