stagent 0.7.0 → 0.8.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/package.json +1 -1
- package/src/app/globals.css +14 -0
- package/src/components/book/book-reader.tsx +62 -9
- package/src/components/book/content-blocks.tsx +6 -1
- package/src/components/tables/table-cell-editor.tsx +3 -3
- package/src/components/tables/table-row-sheet.tsx +271 -0
- package/src/components/tables/table-spreadsheet.tsx +55 -160
- package/src/components/workflows/workflow-form-view.tsx +6 -6
- package/src/lib/agents/profiles/builtins/document-writer/SKILL.md +23 -0
- package/src/lib/agents/profiles/builtins/technical-writer/SKILL.md +10 -0
- package/src/lib/agents/profiles/builtins/technical-writer/profile.yaml +1 -1
- package/src/lib/book/chapter-generator.ts +81 -5
- package/src/lib/book/chapter-mapping.ts +58 -24
- package/src/lib/book/content.ts +83 -47
- package/src/lib/book/markdown-parser.ts +1 -1
- package/src/lib/book/reading-paths.ts +8 -8
- package/src/lib/book/types.ts +1 -1
- package/src/lib/book/update-detector.ts +4 -1
- package/src/lib/chat/tools/workflow-tools.ts +9 -1
- package/src/lib/workflows/types.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Maps book chapters to Playbook feature docs and
|
|
1
|
+
/** Maps book chapters to Playbook feature docs, journeys, and case studies */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Single source of truth: chapter ID → markdown filename slug.
|
|
@@ -6,15 +6,18 @@
|
|
|
6
6
|
* Slug corresponds to files in book/chapters/ (without .md extension).
|
|
7
7
|
*/
|
|
8
8
|
export const CHAPTER_SLUGS: Record<string, string> = {
|
|
9
|
-
"ch-1": "ch-1-
|
|
10
|
-
"ch-2": "ch-2-
|
|
11
|
-
"ch-3": "ch-3-
|
|
12
|
-
"ch-4": "ch-4-
|
|
13
|
-
"ch-5": "ch-5-
|
|
14
|
-
"ch-6": "ch-6-
|
|
15
|
-
"ch-7": "ch-7-
|
|
16
|
-
"ch-8": "ch-8-
|
|
17
|
-
"ch-9": "ch-9-
|
|
9
|
+
"ch-1": "ch-1-from-hierarchy-to-intelligence",
|
|
10
|
+
"ch-2": "ch-2-the-ai-native-blueprint",
|
|
11
|
+
"ch-3": "ch-3-the-refinery",
|
|
12
|
+
"ch-4": "ch-4-the-forge",
|
|
13
|
+
"ch-5": "ch-5-blueprints",
|
|
14
|
+
"ch-6": "ch-6-the-arena",
|
|
15
|
+
"ch-7": "ch-7-institutional-memory",
|
|
16
|
+
"ch-8": "ch-8-the-swarm",
|
|
17
|
+
"ch-9": "ch-9-the-governance-layer",
|
|
18
|
+
"ch-10": "ch-10-the-world-model",
|
|
19
|
+
"ch-11": "ch-11-the-machine-that-builds-machines",
|
|
20
|
+
"ch-12": "ch-12-the-road-ahead",
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
interface ChapterMapping {
|
|
@@ -22,53 +25,79 @@ interface ChapterMapping {
|
|
|
22
25
|
journey?: string;
|
|
23
26
|
/** Source code files this chapter references (for staleness detection) */
|
|
24
27
|
sourceFiles?: string[];
|
|
28
|
+
/** Case study article slugs from ai-native-notes/ */
|
|
29
|
+
caseStudies?: string[];
|
|
25
30
|
}
|
|
26
31
|
|
|
27
32
|
/**
|
|
28
33
|
* Static mapping from chapter IDs to related Playbook content.
|
|
29
34
|
* Doc slugs correspond to files in docs/features/.
|
|
30
35
|
* Journey slugs correspond to files in docs/journeys/.
|
|
36
|
+
* Case study slugs correspond to files in ai-native-notes/ (without .md extension).
|
|
31
37
|
*/
|
|
32
38
|
export const CHAPTER_MAPPING: Record<string, ChapterMapping> = {
|
|
33
39
|
"ch-1": {
|
|
34
|
-
docs: [
|
|
35
|
-
|
|
36
|
-
sourceFiles: ["src/lib/db/schema.ts", "src/lib/agents/profiles/general.ts"],
|
|
40
|
+
docs: [],
|
|
41
|
+
caseStudies: ["sequoa-hierarchy-to-intelligence", "harvey-legal-is-next", "making-machine-that-builds-machines"],
|
|
37
42
|
},
|
|
38
43
|
"ch-2": {
|
|
39
|
-
docs: ["
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
docs: ["home-workspace", "dashboard-kanban"],
|
|
45
|
+
sourceFiles: ["src/lib/db/schema.ts"],
|
|
46
|
+
caseStudies: ["stripe-minions", "ramp-background-agent", "karpathy-one-gpu-research-lab", "making-machine-that-builds-machines"],
|
|
42
47
|
},
|
|
43
48
|
"ch-3": {
|
|
44
|
-
docs: ["documents", "
|
|
45
|
-
|
|
49
|
+
docs: ["projects", "documents", "home-workspace"],
|
|
50
|
+
journey: "personal-use",
|
|
51
|
+
sourceFiles: ["src/lib/db/schema.ts", "src/lib/documents/processor.ts", "src/lib/documents/registry.ts", "src/lib/documents/context-builder.ts"],
|
|
52
|
+
caseStudies: ["making-machine-that-builds-machines", "stripe-minions", "ramp-background-agent"],
|
|
46
53
|
},
|
|
47
54
|
"ch-4": {
|
|
55
|
+
docs: ["agent-intelligence", "profiles", "monitoring"],
|
|
56
|
+
journey: "work-use",
|
|
57
|
+
sourceFiles: ["src/lib/agents/profiles/registry.ts", "src/lib/agents/execution-manager.ts"],
|
|
58
|
+
caseStudies: ["stripe-minions", "ramp-background-agent", "harvey-legal-is-next"],
|
|
59
|
+
},
|
|
60
|
+
"ch-5": {
|
|
48
61
|
docs: ["workflows", "agent-intelligence"],
|
|
49
62
|
journey: "power-user",
|
|
50
63
|
sourceFiles: ["src/lib/workflows/engine.ts", "src/lib/workflows/types.ts"],
|
|
64
|
+
caseStudies: ["stripe-minions", "karpathy-one-gpu-research-lab", "making-machine-that-builds-machines"],
|
|
51
65
|
},
|
|
52
|
-
"ch-
|
|
66
|
+
"ch-6": {
|
|
53
67
|
docs: ["schedules", "monitoring"],
|
|
54
68
|
sourceFiles: ["src/lib/schedules/scheduler.ts", "src/lib/schedules/interval-parser.ts"],
|
|
69
|
+
caseStudies: ["karpathy-one-gpu-research-lab"],
|
|
55
70
|
},
|
|
56
|
-
"ch-
|
|
71
|
+
"ch-7": {
|
|
57
72
|
docs: ["agent-intelligence", "profiles"],
|
|
58
73
|
journey: "developer",
|
|
59
74
|
sourceFiles: ["src/lib/db/schema.ts", "src/lib/agents/profiles/"],
|
|
75
|
+
caseStudies: ["making-machine-that-builds-machines", "karpathy-one-gpu-research-lab"],
|
|
60
76
|
},
|
|
61
|
-
"ch-
|
|
77
|
+
"ch-8": {
|
|
62
78
|
docs: ["profiles", "agent-intelligence"],
|
|
63
79
|
sourceFiles: ["src/lib/agents/profiles/"],
|
|
80
|
+
caseStudies: ["karpathy-one-gpu-research-lab", "harvey-legal-is-next", "stripe-minions"],
|
|
64
81
|
},
|
|
65
|
-
"ch-
|
|
82
|
+
"ch-9": {
|
|
66
83
|
docs: ["inbox-notifications", "tool-permissions", "settings"],
|
|
67
84
|
sourceFiles: ["src/lib/agents/claude-agent.ts", "src/lib/data/notifications.ts"],
|
|
85
|
+
caseStudies: ["harvey-legal-is-next", "ramp-background-agent", "stripe-minions"],
|
|
68
86
|
},
|
|
69
|
-
"ch-
|
|
87
|
+
"ch-10": {
|
|
88
|
+
docs: ["workflows", "profiles", "schedules"],
|
|
89
|
+
sourceFiles: ["src/lib/workflows/engine.ts", "src/lib/schedules/scheduler.ts", "src/lib/db/schema.ts"],
|
|
90
|
+
caseStudies: ["sequoa-hierarchy-to-intelligence", "harvey-legal-is-next"],
|
|
91
|
+
},
|
|
92
|
+
"ch-11": {
|
|
93
|
+
docs: [],
|
|
94
|
+
sourceFiles: ["src/lib/book/chapter-generator.ts", "src/lib/book/update-detector.ts", "src/lib/book/content.ts"],
|
|
95
|
+
caseStudies: ["making-machine-that-builds-machines", "karpathy-one-gpu-research-lab"],
|
|
96
|
+
},
|
|
97
|
+
"ch-12": {
|
|
70
98
|
docs: ["workflows", "profiles", "schedules"],
|
|
71
|
-
sourceFiles: [
|
|
99
|
+
sourceFiles: [],
|
|
100
|
+
caseStudies: ["stripe-minions", "ramp-background-agent", "harvey-legal-is-next", "sequoa-hierarchy-to-intelligence", "karpathy-one-gpu-research-lab", "making-machine-that-builds-machines"],
|
|
72
101
|
},
|
|
73
102
|
};
|
|
74
103
|
|
|
@@ -87,6 +116,11 @@ export function getSourceFiles(chapterId: string): string[] {
|
|
|
87
116
|
return CHAPTER_MAPPING[chapterId]?.sourceFiles ?? [];
|
|
88
117
|
}
|
|
89
118
|
|
|
119
|
+
/** Get case study slugs for a chapter */
|
|
120
|
+
export function getCaseStudies(chapterId: string): string[] {
|
|
121
|
+
return CHAPTER_MAPPING[chapterId]?.caseStudies ?? [];
|
|
122
|
+
}
|
|
123
|
+
|
|
90
124
|
/** Reverse lookup: find which chapter a Playbook doc belongs to */
|
|
91
125
|
export function getChapterForDoc(docSlug: string): string | undefined {
|
|
92
126
|
for (const [chapterId, mapping] of Object.entries(CHAPTER_MAPPING)) {
|
package/src/lib/book/content.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import type { Book, BookChapter, BookPart } from "./types";
|
|
2
2
|
import { CHAPTER_SLUGS } from "./chapter-mapping";
|
|
3
3
|
|
|
4
|
-
/** The
|
|
4
|
+
/** The four parts of the AI Native book */
|
|
5
5
|
export const PARTS: BookPart[] = [
|
|
6
6
|
{
|
|
7
7
|
number: 1,
|
|
8
|
-
title: "
|
|
9
|
-
description: "
|
|
8
|
+
title: "The Thesis",
|
|
9
|
+
description: "Why AI-Native? — from hierarchy to intelligence",
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
number: 2,
|
|
13
|
-
title: "
|
|
14
|
-
description: "
|
|
13
|
+
title: "The Factory Floor",
|
|
14
|
+
description: "Building Blocks — the stations of an AI-native system",
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
number: 3,
|
|
18
|
-
title: "
|
|
19
|
-
description: "
|
|
18
|
+
title: "The Intelligence Layer",
|
|
19
|
+
description: "What Makes It Learn — memory, coordination, and trust",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
number: 4,
|
|
23
|
+
title: "The Autonomous Organization",
|
|
24
|
+
description: "The Vision — world models, self-building, and the road ahead",
|
|
20
25
|
},
|
|
21
26
|
];
|
|
22
27
|
|
|
@@ -26,100 +31,131 @@ export const PARTS: BookPart[] = [
|
|
|
26
31
|
* Sections are populated by tryLoadMarkdownChapter().
|
|
27
32
|
*/
|
|
28
33
|
export const CHAPTERS: BookChapter[] = [
|
|
34
|
+
// Part 1: The Thesis
|
|
29
35
|
{
|
|
30
36
|
id: "ch-1",
|
|
31
37
|
number: 1,
|
|
32
|
-
title: "
|
|
33
|
-
subtitle: "
|
|
38
|
+
title: "From Hierarchy to Intelligence",
|
|
39
|
+
subtitle: "The 2,000-Year Problem and Why It's Finally Solvable",
|
|
34
40
|
part: PARTS[0],
|
|
35
|
-
readingTime:
|
|
36
|
-
relatedDocs: ["projects", "home-workspace", "dashboard-kanban"],
|
|
37
|
-
relatedJourney: "personal-use",
|
|
41
|
+
readingTime: 14,
|
|
38
42
|
sections: [],
|
|
39
43
|
},
|
|
40
44
|
{
|
|
41
45
|
id: "ch-2",
|
|
42
46
|
number: 2,
|
|
43
|
-
title: "
|
|
44
|
-
subtitle: "
|
|
47
|
+
title: "The AI-Native Blueprint",
|
|
48
|
+
subtitle: "Anatomy of the Factory",
|
|
45
49
|
part: PARTS[0],
|
|
46
|
-
readingTime:
|
|
47
|
-
relatedDocs: ["
|
|
48
|
-
relatedJourney: "work-use",
|
|
50
|
+
readingTime: 12,
|
|
51
|
+
relatedDocs: ["home-workspace", "dashboard-kanban"],
|
|
49
52
|
sections: [],
|
|
50
53
|
},
|
|
54
|
+
// Part 2: The Factory Floor
|
|
51
55
|
{
|
|
52
56
|
id: "ch-3",
|
|
53
57
|
number: 3,
|
|
54
|
-
title: "
|
|
55
|
-
subtitle: "
|
|
56
|
-
part: PARTS[
|
|
57
|
-
readingTime:
|
|
58
|
-
relatedDocs: ["documents", "
|
|
58
|
+
title: "The Refinery",
|
|
59
|
+
subtitle: "From Intent to Structured Work",
|
|
60
|
+
part: PARTS[1],
|
|
61
|
+
readingTime: 15,
|
|
62
|
+
relatedDocs: ["projects", "documents", "home-workspace"],
|
|
63
|
+
relatedJourney: "personal-use",
|
|
59
64
|
sections: [],
|
|
60
65
|
},
|
|
61
66
|
{
|
|
62
67
|
id: "ch-4",
|
|
63
68
|
number: 4,
|
|
64
|
-
title: "
|
|
65
|
-
subtitle: "
|
|
69
|
+
title: "The Forge",
|
|
70
|
+
subtitle: "Task Execution at Scale",
|
|
66
71
|
part: PARTS[1],
|
|
67
|
-
readingTime:
|
|
68
|
-
relatedDocs: ["
|
|
69
|
-
relatedJourney: "
|
|
72
|
+
readingTime: 16,
|
|
73
|
+
relatedDocs: ["agent-intelligence", "profiles", "monitoring"],
|
|
74
|
+
relatedJourney: "work-use",
|
|
70
75
|
sections: [],
|
|
71
76
|
},
|
|
72
77
|
{
|
|
73
78
|
id: "ch-5",
|
|
74
79
|
number: 5,
|
|
75
|
-
title: "
|
|
76
|
-
subtitle: "
|
|
80
|
+
title: "Blueprints",
|
|
81
|
+
subtitle: "Workflow Orchestration",
|
|
77
82
|
part: PARTS[1],
|
|
78
|
-
readingTime:
|
|
79
|
-
relatedDocs: ["
|
|
83
|
+
readingTime: 14,
|
|
84
|
+
relatedDocs: ["workflows", "agent-intelligence"],
|
|
85
|
+
relatedJourney: "power-user",
|
|
80
86
|
sections: [],
|
|
81
87
|
},
|
|
82
88
|
{
|
|
83
89
|
id: "ch-6",
|
|
84
90
|
number: 6,
|
|
85
|
-
title: "
|
|
86
|
-
subtitle: "
|
|
91
|
+
title: "The Arena",
|
|
92
|
+
subtitle: "Scheduled Intelligence",
|
|
87
93
|
part: PARTS[1],
|
|
88
|
-
readingTime:
|
|
89
|
-
relatedDocs: ["
|
|
90
|
-
relatedJourney: "developer",
|
|
94
|
+
readingTime: 12,
|
|
95
|
+
relatedDocs: ["schedules", "monitoring"],
|
|
91
96
|
sections: [],
|
|
92
97
|
},
|
|
98
|
+
// Part 3: The Intelligence Layer
|
|
93
99
|
{
|
|
94
100
|
id: "ch-7",
|
|
95
101
|
number: 7,
|
|
96
|
-
title: "
|
|
97
|
-
subtitle: "
|
|
102
|
+
title: "Institutional Memory",
|
|
103
|
+
subtitle: "The Knowledge Graph",
|
|
98
104
|
part: PARTS[2],
|
|
99
|
-
readingTime:
|
|
100
|
-
relatedDocs: ["
|
|
105
|
+
readingTime: 14,
|
|
106
|
+
relatedDocs: ["agent-intelligence", "profiles"],
|
|
107
|
+
relatedJourney: "developer",
|
|
101
108
|
sections: [],
|
|
102
109
|
},
|
|
103
110
|
{
|
|
104
111
|
id: "ch-8",
|
|
105
112
|
number: 8,
|
|
106
|
-
title: "
|
|
107
|
-
subtitle: "
|
|
113
|
+
title: "The Swarm",
|
|
114
|
+
subtitle: "Multi-Agent Coordination",
|
|
108
115
|
part: PARTS[2],
|
|
109
|
-
readingTime:
|
|
110
|
-
relatedDocs: ["
|
|
116
|
+
readingTime: 16,
|
|
117
|
+
relatedDocs: ["profiles", "agent-intelligence"],
|
|
111
118
|
sections: [],
|
|
112
119
|
},
|
|
113
120
|
{
|
|
114
121
|
id: "ch-9",
|
|
115
122
|
number: 9,
|
|
116
|
-
title: "The
|
|
117
|
-
subtitle: "
|
|
123
|
+
title: "The Governance Layer",
|
|
124
|
+
subtitle: "Trust at Scale",
|
|
118
125
|
part: PARTS[2],
|
|
119
|
-
readingTime:
|
|
126
|
+
readingTime: 13,
|
|
127
|
+
relatedDocs: ["inbox-notifications", "tool-permissions", "settings"],
|
|
128
|
+
sections: [],
|
|
129
|
+
},
|
|
130
|
+
// Part 4: The Autonomous Organization
|
|
131
|
+
{
|
|
132
|
+
id: "ch-10",
|
|
133
|
+
number: 10,
|
|
134
|
+
title: "The World Model",
|
|
135
|
+
subtitle: "From Project State to Organizational Intelligence",
|
|
136
|
+
part: PARTS[3],
|
|
137
|
+
readingTime: 15,
|
|
120
138
|
relatedDocs: ["workflows", "profiles", "schedules"],
|
|
121
139
|
sections: [],
|
|
122
140
|
},
|
|
141
|
+
{
|
|
142
|
+
id: "ch-11",
|
|
143
|
+
number: 11,
|
|
144
|
+
title: "The Machine That Builds Machines",
|
|
145
|
+
subtitle: "Stagent Building Itself Using Itself",
|
|
146
|
+
part: PARTS[3],
|
|
147
|
+
readingTime: 14,
|
|
148
|
+
sections: [],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "ch-12",
|
|
152
|
+
number: 12,
|
|
153
|
+
title: "The Road Ahead",
|
|
154
|
+
subtitle: "What the Case Studies Tell Us About the Future",
|
|
155
|
+
part: PARTS[3],
|
|
156
|
+
readingTime: 10,
|
|
157
|
+
sections: [],
|
|
158
|
+
},
|
|
123
159
|
];
|
|
124
160
|
|
|
125
161
|
/**
|
|
@@ -166,7 +166,7 @@ function parseContentBlocks(lines: string[]): ContentBlock[] {
|
|
|
166
166
|
|
|
167
167
|
// --- Callout blockquote: > [!variant] ---
|
|
168
168
|
const calloutMatch = line.match(
|
|
169
|
-
/^>\s*\[!(tip|warning|info|lesson|authors-note)\]\s*$/
|
|
169
|
+
/^>\s*\[!(tip|warning|info|lesson|authors-note|case-study)\]\s*$/
|
|
170
170
|
);
|
|
171
171
|
if (calloutMatch) {
|
|
172
172
|
flushText();
|
|
@@ -13,33 +13,33 @@ export const READING_PATHS: ReadingPath[] = [
|
|
|
13
13
|
{
|
|
14
14
|
id: "getting-started",
|
|
15
15
|
name: "Getting Started",
|
|
16
|
-
description: "
|
|
16
|
+
description: "The thesis and first building blocks — understand why AI-native matters",
|
|
17
17
|
persona: "new",
|
|
18
|
-
chapterIds: ["ch-1", "ch-2", "ch-3"],
|
|
18
|
+
chapterIds: ["ch-1", "ch-2", "ch-3", "ch-4"],
|
|
19
19
|
usageStage: "new",
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
id: "team-lead",
|
|
23
23
|
name: "Team Lead",
|
|
24
|
-
description: "
|
|
24
|
+
description: "Workflows, scheduling, and governance — orchestrate your team's AI",
|
|
25
25
|
persona: "work",
|
|
26
|
-
chapterIds: ["ch-1", "ch-
|
|
26
|
+
chapterIds: ["ch-1", "ch-5", "ch-6", "ch-9", "ch-10"],
|
|
27
27
|
usageStage: "early",
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
id: "power-user",
|
|
31
31
|
name: "Power User",
|
|
32
|
-
description: "
|
|
32
|
+
description: "Deep dive into the intelligence layer — memory, swarms, and world models",
|
|
33
33
|
persona: "active",
|
|
34
|
-
chapterIds: ["ch-
|
|
34
|
+
chapterIds: ["ch-5", "ch-6", "ch-7", "ch-8", "ch-9", "ch-10"],
|
|
35
35
|
usageStage: "active",
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
id: "developer",
|
|
39
39
|
name: "Developer",
|
|
40
|
-
description: "
|
|
40
|
+
description: "The complete journey — every chapter, thesis to roadmap",
|
|
41
41
|
persona: "developer",
|
|
42
|
-
chapterIds: ["ch-1", "ch-2", "ch-3", "ch-4", "ch-5", "ch-6", "ch-7", "ch-8", "ch-9"],
|
|
42
|
+
chapterIds: ["ch-1", "ch-2", "ch-3", "ch-4", "ch-5", "ch-6", "ch-7", "ch-8", "ch-9", "ch-10", "ch-11", "ch-12"],
|
|
43
43
|
usageStage: "power",
|
|
44
44
|
},
|
|
45
45
|
];
|
package/src/lib/book/types.ts
CHANGED
|
@@ -29,7 +29,7 @@ export interface ImageBlock {
|
|
|
29
29
|
|
|
30
30
|
export interface CalloutBlock {
|
|
31
31
|
type: "callout";
|
|
32
|
-
variant: "tip" | "warning" | "info" | "lesson" | "authors-note";
|
|
32
|
+
variant: "tip" | "warning" | "info" | "lesson" | "authors-note" | "case-study";
|
|
33
33
|
title?: string;
|
|
34
34
|
markdown: string;
|
|
35
35
|
/** Image source for authors-note variant */
|
|
@@ -99,7 +99,10 @@ export function detectStaleChapters(): ChapterStaleness[] {
|
|
|
99
99
|
|
|
100
100
|
for (const chapterId of Object.keys(CHAPTER_SLUGS)) {
|
|
101
101
|
const mapping = CHAPTER_MAPPING[chapterId];
|
|
102
|
-
const
|
|
102
|
+
const docFiles = mapping?.docs?.map((d) => `docs/features/${d}.md`) ?? [];
|
|
103
|
+
const caseStudyFiles = mapping?.caseStudies?.map((cs) => `ai-native-notes/${cs}.md`) ?? [];
|
|
104
|
+
const codeFiles = mapping?.sourceFiles ?? [];
|
|
105
|
+
const sourceFiles = [...docFiles, ...caseStudyFiles, ...codeFiles];
|
|
103
106
|
const lastGenerated = getLastGenerated(chapterId);
|
|
104
107
|
|
|
105
108
|
if (!gitAvailable) {
|
|
@@ -79,7 +79,7 @@ export function workflowTools(ctx: ToolContext) {
|
|
|
79
79
|
definition: z
|
|
80
80
|
.string()
|
|
81
81
|
.describe(
|
|
82
|
-
'Workflow definition as JSON string. Must include "pattern" and "steps" array. Example: {"pattern":"sequence","steps":[{"name":"step1","prompt":"Do X","assignedAgent":"claude"}]}'
|
|
82
|
+
'Workflow definition as JSON string. Must include "pattern" and "steps" array. Example: {"pattern":"sequence","steps":[{"id":"step-1","name":"step1","prompt":"Do X","assignedAgent":"claude"}]}'
|
|
83
83
|
),
|
|
84
84
|
documentIds: z
|
|
85
85
|
.array(z.string())
|
|
@@ -102,6 +102,14 @@ export function workflowTools(ctx: ToolContext) {
|
|
|
102
102
|
return err('Definition must include "pattern" and "steps" array');
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
// Auto-assign IDs to steps that don't have them (chat LLMs often omit IDs)
|
|
106
|
+
for (const step of parsedDef.steps) {
|
|
107
|
+
if (!step.id) {
|
|
108
|
+
step.id = crypto.randomUUID();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
args.definition = JSON.stringify(parsedDef);
|
|
112
|
+
|
|
105
113
|
const effectiveProjectId = args.projectId ?? ctx.projectId ?? null;
|
|
106
114
|
const now = new Date();
|
|
107
115
|
const id = crypto.randomUUID();
|
|
@@ -119,7 +119,7 @@ export function createInitialState(definition: WorkflowDefinition): WorkflowStat
|
|
|
119
119
|
return {
|
|
120
120
|
currentStepIndex: 0,
|
|
121
121
|
stepStates: definition.steps.map((step) => ({
|
|
122
|
-
stepId: step.id,
|
|
122
|
+
stepId: step.id ?? crypto.randomUUID(),
|
|
123
123
|
status: "pending",
|
|
124
124
|
})),
|
|
125
125
|
status: "running",
|