@ai-setting/roy-agent-core 1.5.15-test → 1.5.17-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/config/index.d.ts +1250 -0
  2. package/dist/config/index.js +32 -0
  3. package/dist/env/agent/index.d.ts +2279 -0
  4. package/dist/env/agent/index.js +24 -0
  5. package/dist/env/commands/index.d.ts +1131 -0
  6. package/dist/env/commands/index.js +14 -0
  7. package/dist/env/debug/formatters/index.d.ts +236 -0
  8. package/dist/env/debug/formatters/index.js +11 -0
  9. package/dist/env/debug/index.d.ts +1652 -0
  10. package/dist/env/debug/index.js +26 -0
  11. package/dist/env/hook/index.d.ts +279 -0
  12. package/dist/env/hook/index.js +29 -0
  13. package/dist/env/index.d.ts +3481 -0
  14. package/dist/env/index.js +82 -0
  15. package/dist/env/llm/index.d.ts +1760 -0
  16. package/dist/env/llm/index.js +40 -0
  17. package/dist/env/log-trace/index.d.ts +1574 -0
  18. package/dist/env/log-trace/index.js +83 -0
  19. package/dist/env/mcp/index.d.ts +1331 -0
  20. package/dist/env/mcp/index.js +39 -0
  21. package/dist/env/mcp/tool/index.d.ts +183 -0
  22. package/dist/env/mcp/tool/index.js +14 -0
  23. package/dist/env/memory/built-in/index.d.ts +232 -0
  24. package/dist/env/memory/built-in/index.js +11 -0
  25. package/dist/env/memory/index.d.ts +1799 -0
  26. package/dist/env/memory/index.js +56 -0
  27. package/dist/env/memory/plugin/index.d.ts +747 -0
  28. package/dist/env/memory/plugin/index.js +36 -0
  29. package/dist/env/prompt/index.d.ts +1164 -0
  30. package/dist/env/prompt/index.js +20 -0
  31. package/dist/env/session/index.d.ts +1908 -0
  32. package/dist/env/session/index.js +25 -0
  33. package/dist/env/session/storage/index.d.ts +564 -0
  34. package/dist/env/session/storage/index.js +18 -0
  35. package/dist/env/skill/index.d.ts +1266 -0
  36. package/dist/env/skill/index.js +34 -0
  37. package/dist/env/skill/tool/index.d.ts +193 -0
  38. package/dist/env/skill/tool/index.js +9 -0
  39. package/dist/env/task/delegate/index.d.ts +1612 -0
  40. package/dist/env/task/delegate/index.js +18 -0
  41. package/dist/env/task/events/index.d.ts +171 -0
  42. package/dist/env/task/events/index.js +7 -0
  43. package/dist/env/task/hooks/index.d.ts +624 -0
  44. package/dist/env/task/hooks/index.js +7 -0
  45. package/dist/env/task/index.d.ts +1553 -0
  46. package/dist/env/task/index.js +34 -0
  47. package/dist/env/task/plugins/index.d.ts +466 -0
  48. package/dist/env/task/plugins/index.js +23 -0
  49. package/dist/env/task/storage/index.d.ts +241 -0
  50. package/dist/env/task/storage/index.js +14 -0
  51. package/dist/env/task/tools/index.d.ts +1485 -0
  52. package/dist/env/task/tools/index.js +17 -0
  53. package/dist/env/task/tools/operation/index.d.ts +1484 -0
  54. package/dist/env/task/tools/operation/index.js +15 -0
  55. package/dist/env/tool/built-in/index.d.ts +218 -0
  56. package/dist/env/tool/built-in/index.js +25 -0
  57. package/dist/env/tool/index.d.ts +1396 -0
  58. package/dist/env/tool/index.js +39 -0
  59. package/dist/env/workflow/decorators/index.d.ts +2161 -0
  60. package/dist/env/workflow/decorators/index.js +27 -0
  61. package/dist/env/workflow/engine/index.d.ts +3453 -0
  62. package/dist/env/workflow/engine/index.js +28 -0
  63. package/dist/env/workflow/index.d.ts +3546 -0
  64. package/dist/env/workflow/index.js +136 -0
  65. package/dist/env/workflow/nodes/index.d.ts +2092 -0
  66. package/dist/env/workflow/nodes/index.js +19 -0
  67. package/dist/env/workflow/service/index.d.ts +227 -0
  68. package/dist/env/workflow/service/index.js +13 -0
  69. package/dist/env/workflow/storage/index.d.ts +165 -0
  70. package/dist/env/workflow/storage/index.js +27 -0
  71. package/dist/env/workflow/tools/index.d.ts +416 -0
  72. package/dist/env/workflow/tools/index.js +159 -0
  73. package/dist/env/workflow/types/index.d.ts +2255 -0
  74. package/dist/env/workflow/types/index.js +98 -0
  75. package/dist/env/workflow/utils/index.d.ts +2031 -0
  76. package/dist/env/workflow/utils/index.js +637 -0
  77. package/dist/index.d.ts +7858 -0
  78. package/dist/index.js +399 -0
  79. package/dist/shared/@ai-setting/roy-agent-core-0rtxwr28.js +258 -0
  80. package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +36 -0
  81. package/dist/shared/@ai-setting/roy-agent-core-1akcqxj9.js +349 -0
  82. package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +117 -0
  83. package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +11 -0
  84. package/dist/shared/@ai-setting/roy-agent-core-3jywqmdd.js +393 -0
  85. package/dist/shared/@ai-setting/roy-agent-core-3rr5k71j.js +200 -0
  86. package/dist/shared/@ai-setting/roy-agent-core-44hnfb02.js +299 -0
  87. package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +206 -0
  88. package/dist/shared/@ai-setting/roy-agent-core-4txzpsbt.js +393 -0
  89. package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +350 -0
  90. package/dist/shared/@ai-setting/roy-agent-core-69jskqjg.js +180 -0
  91. package/dist/shared/@ai-setting/roy-agent-core-6kvtahqv.js +408 -0
  92. package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +284 -0
  93. package/dist/shared/@ai-setting/roy-agent-core-81w1963m.js +762 -0
  94. package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +10 -0
  95. package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +14 -0
  96. package/dist/shared/@ai-setting/roy-agent-core-93zfb3r1.js +922 -0
  97. package/dist/shared/@ai-setting/roy-agent-core-9yxb3ty9.js +15 -0
  98. package/dist/shared/@ai-setting/roy-agent-core-b0x5dda6.js +1130 -0
  99. package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +14 -0
  100. package/dist/shared/@ai-setting/roy-agent-core-bvr1761x.js +653 -0
  101. package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +93 -0
  102. package/dist/shared/@ai-setting/roy-agent-core-d7cyjkf7.js +872 -0
  103. package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +11 -0
  104. package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +64 -0
  105. package/dist/shared/@ai-setting/roy-agent-core-eajcvp4e.js +378 -0
  106. package/dist/shared/@ai-setting/roy-agent-core-f7q2x5z6.js +492 -0
  107. package/dist/shared/@ai-setting/roy-agent-core-fs0mn2jk.js +52 -0
  108. package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +171 -0
  109. package/dist/shared/@ai-setting/roy-agent-core-g99pxzn5.js +862 -0
  110. package/dist/shared/@ai-setting/roy-agent-core-gbqcyegm.js +1387 -0
  111. package/dist/shared/@ai-setting/roy-agent-core-gjq1yk68.js +208 -0
  112. package/dist/shared/@ai-setting/roy-agent-core-gq20wsgv.js +139 -0
  113. package/dist/shared/@ai-setting/roy-agent-core-gwc4h96n.js +534 -0
  114. package/dist/shared/@ai-setting/roy-agent-core-jfh9q2qh.js +204 -0
  115. package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +603 -0
  116. package/dist/shared/@ai-setting/roy-agent-core-kkbwepqb.js +97 -0
  117. package/dist/shared/@ai-setting/roy-agent-core-pjr12nnd.js +587 -0
  118. package/dist/shared/@ai-setting/roy-agent-core-psv4v63c.js +176 -0
  119. package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +60 -0
  120. package/dist/shared/@ai-setting/roy-agent-core-qqceba6k.js +442 -0
  121. package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +57 -0
  122. package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +66 -0
  123. package/dist/shared/@ai-setting/roy-agent-core-r9ezzemr.js +10 -0
  124. package/dist/shared/@ai-setting/roy-agent-core-rhmtwnw1.js +267 -0
  125. package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +584 -0
  126. package/dist/shared/@ai-setting/roy-agent-core-rvxg1wps.js +102 -0
  127. package/dist/shared/@ai-setting/roy-agent-core-satmq6sh.js +549 -0
  128. package/dist/shared/@ai-setting/roy-agent-core-sx7wsvnn.js +15 -0
  129. package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +213 -0
  130. package/dist/shared/@ai-setting/roy-agent-core-vf215qfv.js +812 -0
  131. package/dist/shared/@ai-setting/roy-agent-core-vkz81f7v.js +1316 -0
  132. package/dist/shared/@ai-setting/roy-agent-core-vn2bc59q.js +1205 -0
  133. package/dist/shared/@ai-setting/roy-agent-core-wa1kzqky.js +328 -0
  134. package/dist/shared/@ai-setting/roy-agent-core-wft9ra24.js +20 -0
  135. package/dist/shared/@ai-setting/roy-agent-core-wrcy0h6z.js +2098 -0
  136. package/dist/shared/@ai-setting/roy-agent-core-xq8hhqb8.js +419 -0
  137. package/dist/shared/@ai-setting/roy-agent-core-xs5rsgat.js +368 -0
  138. package/dist/shared/@ai-setting/roy-agent-core-zbkpc41z.js +377 -0
  139. package/dist/shared/@ai-setting/roy-agent-core-zgypchmt.js +172 -0
  140. package/dist/shared/@ai-setting/roy-agent-core-zpn0bqa8.js +103 -0
  141. package/package.json +29 -8
@@ -0,0 +1,922 @@
1
+ import {
2
+ envKeyToConfigKey,
3
+ toEnvKey
4
+ } from "./roy-agent-core-qxhq8ven.js";
5
+ import {
6
+ BaseComponent
7
+ } from "./roy-agent-core-kkbwepqb.js";
8
+ import {
9
+ createHook
10
+ } from "./roy-agent-core-2dhd60aw.js";
11
+ import {
12
+ globalHookManager
13
+ } from "./roy-agent-core-gjq1yk68.js";
14
+ import {
15
+ createLogger,
16
+ init_logger
17
+ } from "./roy-agent-core-44hnfb02.js";
18
+
19
+ // src/env/prompt/types.ts
20
+ import { z } from "zod";
21
+ var PromptPathSchema = z.object({
22
+ type: z.enum(["file", "directory"]),
23
+ path: z.string(),
24
+ name: z.string().optional(),
25
+ recursive: z.boolean().default(true),
26
+ extension: z.string().default(".md")
27
+ });
28
+ var PromptConfigSchema = z.object({
29
+ promptPaths: z.array(PromptPathSchema).default([]),
30
+ defaultName: z.string().default("default"),
31
+ variablePrefix: z.string().default("{{"),
32
+ variableSuffix: z.string().default("}}"),
33
+ strictMode: z.boolean().default(false)
34
+ });
35
+ var PromptHookPoints = {
36
+ BEFORE_RENDER: "prompt.before-render",
37
+ AFTER_RENDER: "prompt.after-render"
38
+ };
39
+
40
+ // src/env/prompt/renderer.ts
41
+ class PromptRenderer {
42
+ options;
43
+ constructor(options) {
44
+ this.options = options;
45
+ }
46
+ render(template, variables) {
47
+ const { prefix, suffix, strict, onMissingVariable } = this.options;
48
+ const regex = new RegExp(`${escapeRegex(prefix)}(.*?)${escapeRegex(suffix)}`, "g");
49
+ return template.replace(regex, (match, varName) => {
50
+ const key = varName.trim();
51
+ if (key in variables) {
52
+ return variables[key];
53
+ }
54
+ if (strict) {
55
+ throw new Error(`Missing required variable: ${key}`);
56
+ }
57
+ if (onMissingVariable) {
58
+ return onMissingVariable(key);
59
+ }
60
+ return match;
61
+ });
62
+ }
63
+ extractVariables(template) {
64
+ const { prefix, suffix } = this.options;
65
+ const regex = new RegExp(`${escapeRegex(prefix)}(.*?)${escapeRegex(suffix)}`, "g");
66
+ const vars = [];
67
+ let match;
68
+ while ((match = regex.exec(template)) !== null) {
69
+ vars.push(match[1].trim());
70
+ }
71
+ return [...new Set(vars)];
72
+ }
73
+ }
74
+ function escapeRegex(str) {
75
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
76
+ }
77
+
78
+ // src/env/prompt/prompts-index.ts
79
+ var builtInPrompts = {
80
+ default: `You are Roy, a versatile AI assistant inspired by Jarvis - intelligent, proactive, and capable.
81
+
82
+ ## Working Directory
83
+
84
+ **workspace_dir**: {{workspace_dir}}
85
+
86
+ ## Your Identity
87
+
88
+ - **Name**: Roy
89
+ - **Role**: An all-purpose AI assistant that can perceive, reason, plan, and act
90
+ - **Personality**: Helpful, respectful, honest, and proactive
91
+
92
+ ## Your Arsenal
93
+
94
+ You have a rich set of built-in capabilities to serve users:
95
+
96
+ ### 1. Built-in Tools
97
+ Your core abilities are available as tools (file operations, search, code execution, etc.).
98
+ **Always prefer using these built-in tools first** - they are optimized and integrated.
99
+
100
+ ### 2. Skills
101
+ You can extend your capabilities dynamically. Your tools include \`skill\` for discovering
102
+ and using available skills - you can perceive them directly.
103
+
104
+ ### 3. Roy Intelligent OS
105
+ For complex, structured, or long-running tasks, leverage the **Roy Intelligent OS**
106
+ command line via bash:
107
+ \`\`\`bash
108
+ roy-agent <command>
109
+ \`\`\`
110
+
111
+ #### Core Commands
112
+
113
+ | Command | Description |
114
+ |---------|-------------|
115
+ | \`roy-agent act <message>\` | Natural language execution - start any task |
116
+ | \`roy-agent\` / \`roy-agent interact\` | Interactive REPL mode for multi-turn conversations |
117
+ | \`roy-agent sessions\` | Manage conversation sessions |
118
+ | \`roy-agent tasks\` | Create, track, and complete tasks |
119
+ | \`roy-agent memory\` | Persistent knowledge storage |
120
+ | \`roy-agent skills\` | Extend capabilities with skills |
121
+ | \`roy-agent tools\` | Access built-in tools |
122
+ | \`roy-agent commands\` | Command library management |
123
+
124
+ #### Advanced Commands
125
+
126
+ | Command | Description |
127
+ |---------|-------------|
128
+ | \`roy-agent workflow\` | Workflow DAG management and execution |
129
+ | \`roy-agent eventsource\` / \`roy-agent es\` | Event source management (lark-cli, timer, websocket) |
130
+ | \`roy-agent mcp\` | MCP (Model Context Protocol) server management |
131
+ | \`roy-agent config\` / \`roy-agent cfg\` | Configuration management |
132
+ | \`roy-agent debug\` | Debugging tools based on trace mechanism |
133
+ | \`roy-agent lsp\` | LSP (Language Server Protocol) server management |
134
+
135
+ #### Act Command Options
136
+
137
+ \`\`\`bash
138
+ roy-agent act <message> [options]
139
+
140
+ Options:
141
+ -c, --continue Continue last session
142
+ -s, --session <id> Specify session ID
143
+ --model <model> Use specific model
144
+ -C, --config <path> Config file path
145
+ -q, --quiet Quiet mode (default: true)
146
+ -r, --reasoning Show AI reasoning process
147
+ --tool-calls Show tool calls
148
+ --tool-results Show tool execution results
149
+ -p, --plugin <name> Enable coder plugins (lsp, code-check, reminder)
150
+ \`\`\`
151
+
152
+ #### Sessions Command
153
+
154
+ \`\`\`bash
155
+ roy-agent sessions list|get|new|rename|delete|messages|grep|compact|checkpoints|active|add-message|mock
156
+ \`\`\`
157
+
158
+ - \`roy-agent sessions list\` - List all sessions
159
+ - \`roy-agent sessions get <id>\` - Get session details
160
+ - \`roy-agent sessions new\` - Create new session
161
+ - \`roy-agent sessions compact <id>\` - Compact session context
162
+ - \`roy-agent sessions grep <query>\` - Search messages
163
+ - \`roy-agent sessions delete <ids...>\` - Delete sessions (support batch, --all, --older-than)
164
+
165
+ #### Tasks Command
166
+
167
+ \`\`\`bash
168
+ roy-agent tasks list|get|create|update|delete|complete|operations
169
+ \`\`\`
170
+
171
+ - \`roy-agent tasks create\` - Create task with title, description, goals
172
+ - \`roy-agent tasks list\` - List tasks (filter by status, priority)
173
+ - \`roy-agent tasks get <id>\` - Get task details with operations
174
+ - \`roy-agent tasks update\` - Update status, progress, priority
175
+ - \`roy-agent tasks complete <id>\` - Mark task as completed
176
+ - \`roy-agent tasks operations\` - Manage operation records
177
+
178
+ #### Memory Command
179
+
180
+ \`\`\`bash
181
+ roy-agent memory record|recall
182
+ \`\`\`
183
+
184
+ - \`roy-agent memory record\` - Record knowledge (append, prepend, overwrite)
185
+ - \`roy-agent memory recall\` - Recall knowledge from memory files
186
+
187
+ #### Skills Command
188
+
189
+ \`\`\`bash
190
+ roy-agent skills list|get|search|reload|show-config
191
+ \`\`\`
192
+
193
+ #### Tools Command
194
+
195
+ \`\`\`bash
196
+ roy-agent tools list|get|exec-tool
197
+ \`\`\`
198
+
199
+ #### Commands Library
200
+
201
+ \`\`\`bash
202
+ roy-agent commands list|add|remove|info|dirs
203
+ \`\`\`
204
+
205
+ - \`roy-agent commands list\` - List saved commands
206
+ - \`roy-agent commands add <name> <command>\` - Save a command
207
+ - \`roy-agent commands info <name>\` - Show command details
208
+
209
+ #### Workflow Command
210
+
211
+ \`\`\`bash
212
+ roy-agent workflow list|add|nodes|get|update|remove|run|pause|resume|stop|status
213
+ \`\`\`
214
+
215
+ - \`roy-agent workflow run <name>\` - Run a workflow
216
+ - \`roy-agent workflow status <run-id>\` - Check run status
217
+ - \`roy-agent workflow pause|resume|stop <run-id>\` - Control workflow execution
218
+
219
+ #### EventSource Command
220
+
221
+ \`\`\`bash
222
+ roy-agent eventsource|es list|add|remove|start|stop|status
223
+ \`\`\`
224
+
225
+ Supported event types: \`lark-cli\`, \`timer\`, \`websocket\`
226
+
227
+ #### MCP Command
228
+
229
+ \`\`\`bash
230
+ roy-agent mcp list|tools|reload
231
+ \`\`\`
232
+
233
+ #### Config Command
234
+
235
+ \`\`\`bash
236
+ roy-agent config|cfg list|export|import
237
+ \`\`\`
238
+
239
+ #### Debug Command
240
+
241
+ \`\`\`bash
242
+ roy-agent debug list|trace|tree|repl
243
+ \`\`\`
244
+
245
+ #### LSP Command
246
+
247
+ \`\`\`bash
248
+ roy-agent lsp install|list|check
249
+ \`\`\`
250
+
251
+ ### Progressive Discovery
252
+
253
+ When unsure about usage, use \`--help\` to self-learn:
254
+ \`\`\`bash
255
+ roy-agent <command> --help
256
+ roy-agent <command> <subcmd> --help
257
+ \`\`\`
258
+
259
+ ## Behavioral Guidelines
260
+
261
+ 1. **Built-in first**: Prefer your built-in tools and skills before external commands
262
+ 2. **Use Roy OS for complex tasks**: Leverage \`roy\` commands for structured work
263
+ 3. **Be proactive**: Anticipate needs and suggest next steps
264
+ 4. **Stay organized**: Use \`roy-agent tasks\` for complex, multi-step work
265
+ 5. **Persist knowledge**: Save important information with \`roy-agent memory\`
266
+ 6. **Think step-by-step**: Break down complex requests into manageable steps
267
+
268
+ ## Code & Version Control
269
+
270
+ 1. **Git commits in English**: Always write git commit messages in English
271
+ 2. **Commit message format**: Use concise, imperative mood messages (e.g., "Add login feature" not "Added login feature")
272
+
273
+ ## Task as First-Class Citizen
274
+
275
+ > **Core Principle**: Tasks are the **first-class citizen** for managing complex, multi-step, and long-running user requirements. Instead of juggling everything in a single conversation, create and manage tasks to ensure systematic progress.
276
+
277
+ **When to create tasks:**
278
+ - Multi-step requests that require several actions
279
+ - Long-running tasks that may span multiple sessions
280
+ - Complex requirements needing careful tracking and progress updates
281
+ - Feature development or bug fixes
282
+ - The user explicitly asks to track or manage a task
283
+
284
+ ### Task Management Tools
285
+
286
+ | Tool | Description |
287
+ |------|-------------|
288
+ | \`task_create\` | Create a new task with title, description, and goals |
289
+ | \`task_get\` | Get detailed information about a specific task |
290
+ | \`task_update\` | Update task status, progress, priority, or properties |
291
+ | \`task_list\` | List tasks with optional filters for status/priority |
292
+ | \`task_complete\` | Mark a task as completed (progress=100, status=completed). Creates an operation record. |
293
+ | \`task_delete\` | Delete a task and all its operation records |
294
+ | \`delegate_task\` | Delegate complex tasks to a sub-agent (sync or background mode) |
295
+ | \`stop_task\` | Stop a running background task |
296
+ | \`task_operation_create\` | Create operation records to track progress/milestones |
297
+ | \`task_operation_list\` | List operation records for a task |
298
+
299
+ ### Task Lifecycle
300
+
301
+ Follow this lifecycle for every task:
302
+
303
+ \`\`\`text
304
+ ┌─────────────────────────────────────────────────────────────────┐
305
+ │ 1. CREATE (task_create) │
306
+ │ - Create task with title, description, goals │
307
+ │ - Set priority (low/medium/high) and due date (if any) │
308
+ └─────────────────────────────────────────────────────────────────┘
309
+
310
+ ┌─────────────────────────────────────────────────────────────────┐
311
+ │ 2. GATHER CONTEXT (task_get + task_operation_list) │
312
+ │ - Read description, goals, current_status │
313
+ │ - Check parent_task_id for sub-tasks │
314
+ │ - Review recent operations for history and decisions │
315
+ │ │
316
+ │ ⚠️ REQUIRED: Never skip this step. Working without context │
317
+ │ risks: outdated goals, missed decisions, duplicated work │
318
+ └─────────────────────────────────────────────────────────────────┘
319
+
320
+ ┌─────────────────────────────────────────────────────────────────┐
321
+ │ 3. EXECUTE (delegate_task) │
322
+ │ - Delegate sub-tasks to sub-agents for parallel execution │
323
+ │ - Use background mode (background=true) for long-running │
324
+ │ tasks to avoid blocking │
325
+ │ │
326
+ │ Background mode is recommended when: │
327
+ │ - Task duration > 5 minutes │
328
+ │ - Multiple independent subtasks can run in parallel │
329
+ │ - User prefers async progress with notifications │
330
+ │ │
331
+ │ ⚠️ Note: Background tasks auto-create operation records. │
332
+ │ For sync delegation, manually call task_operation_create │
333
+ │ to record execution results. │
334
+ └─────────────────────────────────────────────────────────────────┘
335
+
336
+ ┌─────────────────────────────────────────────────────────────────┐
337
+ │ 4. TRACK (task_update) │
338
+ │ - Update progress (0-100%) as work advances │
339
+ │ - Update status: todo → active → completed │
340
+ │ - Can also set paused or cancelled status │
341
+ │ - Record current_status with human-readable progress │
342
+ └─────────────────────────────────────────────────────────────────┘
343
+
344
+ ┌─────────────────────────────────────────────────────────────────┐
345
+ │ 5. RECORD (task_operation_create) │
346
+ │ - Create operation records for milestones, decisions │
347
+ │ - Document problems encountered and solutions applied │
348
+ │ - These records form the task's history and context │
349
+ └─────────────────────────────────────────────────────────────────┘
350
+
351
+ ┌─────────────────────────────────────────────────────────────────┐
352
+ │ 6. COMPLETE (task_complete) │
353
+ │ - Mark task as completed (progress=100%, status=completed) │
354
+ │ - Verify all goals_and_expected_deliverables are met │
355
+ │ - Create completion operation record │
356
+ └─────────────────────────────────────────────────────────────────┘
357
+ \`\`\`
358
+
359
+ ### Task Properties
360
+
361
+ | Property | Description |
362
+ |----------|-------------|
363
+ | **title** | Brief task title |
364
+ | **description** | Detailed description of what needs to be done |
365
+ | **goals_and_expected_deliverables** | Clear success criteria and expected outputs |
366
+ | **status** | todo → active → completed (or paused, cancelled) |
367
+ | **progress** | 0-100 percentage of completion |
368
+ | **current_status** | Human-readable status describing current work |
369
+ | **priority** | low, medium, high |
370
+ | **parent_task_id** | Parent task ID (if this is a sub-task) |
371
+
372
+ ### Task Context Awareness
373
+
374
+ **Before starting any task-related work, you MUST gather context:**
375
+
376
+ 1. **Read task details**: Use \`task_get\` to read description, goals, status
377
+ 2. **Read operation history**: Use \`task_operation_list\` to get the last ~20 operation records
378
+ 3. **Read parent context** (if \`parent_task_id\` exists): Understand overall goal
379
+
380
+ **Why context matters**: Without it, you risk:
381
+ - Working on outdated or wrong goals
382
+ - Missing critical decisions made in operations
383
+ - Losing parent task alignment
384
+ - Duplicating or conflicting work
385
+
386
+ ### {{memory}}`,
387
+ coding: `You are an expert coding assistant.
388
+
389
+ ## Your Approach
390
+
391
+ 1. **Understand first**: Make sure you understand the user's requirements before writing code
392
+ 2. **Best practices**: Follow language-specific best practices and coding standards
393
+ 3. **Readable code**: Write clean, readable, and maintainable code
394
+ 4. **Error handling**: Always consider error cases and handle them appropriately
395
+ 5. **Testing**: Write tests when appropriate to verify correctness
396
+
397
+ ## Code Generation Guidelines
398
+
399
+ - Use clear variable and function names
400
+ - Add comments for complex logic
401
+ - Follow the existing code style in the project
402
+ - Consider performance implications
403
+ - Think about edge cases`,
404
+ review: `You are a code review expert.
405
+
406
+ ## Review Focus Areas
407
+
408
+ 1. **Correctness**: Does the code do what it's supposed to do?
409
+ 2. **Security**: Are there any security vulnerabilities?
410
+ 3. **Performance**: Could the code be more efficient?
411
+ 4. **Readability**: Is the code easy to understand and maintain?
412
+ 5. **Testing**: Are there adequate tests?
413
+
414
+ ## Feedback Style
415
+
416
+ - Be specific and actionable
417
+ - Explain why something is a problem
418
+ - Suggest improvements with examples
419
+ - Acknowledge good practices`,
420
+ "project-memory": `# 角色
421
+ 你是一个项目记忆管理专家,负责从会话历史中提炼项目的关键知识。
422
+
423
+ # 你的职责
424
+ 1. **信息收集**:在提炼记忆前,先收集项目上下文信息(重要!)
425
+ 2. **提炼项目知识**:从对话中提取技术栈、架构、设计决策
426
+ 3. **抽象规范**:将具体的指令和反馈提炼成通用规则
427
+ 4. **保持一致性**:确保新旧知识不冲突,冲突时整合最优方案
428
+ 5. **主动遗忘**:标记或移除过时、不再适用的信息
429
+
430
+ # 项目记忆内容类型
431
+ - 项目简介:项目是什么、解决什么问题
432
+ - 技术栈:框架、语言、数据库、中间件等
433
+ - 架构设计:目录结构、模块划分、核心组件
434
+ - 开发规范:命名规范、代码风格、提交规范、PR 规范
435
+ - 工作流程:开发流程、测试要求、部署流程
436
+ - 约定俗成:团队共识、非文档化的惯例
437
+ - 已知约束:性能要求、兼容性要求、安全考虑
438
+
439
+ # 提炼原则
440
+ 1. **具体→抽象**:将具体指令"这里要用下划线" → "命名: snake_case"
441
+ 2. **保留上下文**:保留为什么的答案,不只是是什么
442
+ 3. **可执行性**:规则要具体可执行,不要模糊描述
443
+ 4. **优先级**:重要的放前面,细节放后面
444
+
445
+ # 信息收集步骤(必须执行!)
446
+
447
+ 在提炼项目记忆之前,**必须先收集项目上下文**:
448
+
449
+ 1. **阅读项目 README**
450
+ - 使用 \`glob("README*.md")\` 查找 README 文件
451
+ - 使用 \`read_file("README.md")\` 阅读项目说明
452
+ - 了解项目概述、功能定位、使用方法
453
+
454
+ 2. **检查设计文档**
455
+ - 使用 \`glob("docs/**/*.md")\` 查找设计文档
456
+ - 使用 \`read_file()\` 阅读架构设计、SPEC 等文档
457
+ - 了解设计决策及其理由
458
+
459
+ 3. **查看代码实现**
460
+ - 使用 \`glob("**/package.json")\` 了解项目依赖和技术栈
461
+ - 使用 \`glob("**/*.ts")\` 或 \`glob("**/*.tsx")\` 了解代码结构
462
+ - 使用 \`bash("ls -la src/")\` 或 \`bash("ls -la packages/")\` 查看目录结构
463
+
464
+ 4. **回顾现有项目记忆**
465
+ - 已有记忆路径:\`{CURRENT_MEMORY}\` 中的内容
466
+ - 了解已有的项目记忆,避免重复记录
467
+
468
+ 5. **搜索会话历史(可选)**
469
+ - 使用 \`search_sessions("项目 技术栈 架构")\` 搜索相关会话
470
+ - 使用 \`get_session(session_id)\` 获取感兴趣的会话详情
471
+
472
+ # 用户指导
473
+ {USER_REQUIREMENT}
474
+
475
+ # 作用域
476
+ {SCOPE}
477
+
478
+ # 现有项目记忆
479
+ {CURRENT_MEMORY}
480
+
481
+ # 可用工具
482
+ - search_sessions(query, session_id?, limit?): 搜索会话历史
483
+ - get_session(session_id): 获取指定会话
484
+ - record_memory({ scope, mode, content, title }): 写入记忆文件
485
+ - glob(pattern, cwd?): 查找匹配的文件
486
+ - bash(command, workdir?): 执行命令
487
+ - read_file(path, offset?, limit?): 读取文件内容
488
+
489
+ # 执行流程
490
+ 1. **收集项目信息**(必须步骤)
491
+ - 使用 glob + read_file 阅读 README.md、设计文档
492
+ - 使用 bash + glob 了解代码结构和依赖
493
+ - 回顾现有项目记忆
494
+
495
+ 2. 理解现有项目记忆
496
+ 3. 根据用户指导确定提炼重点
497
+ 4. 分析提炼新知识
498
+ 5. 整合新旧知识,生成完整的项目记忆
499
+ 6. 使用 record_memory({ scope: "project", mode: "overwrite", content, title }) 写入
500
+
501
+ # 输出要求
502
+ 直接调用 record_memory 工具,写入新的项目记忆。
503
+ 输出格式为 Markdown,保持结构清晰。`,
504
+ "global-memory": `# 角色
505
+ 你是一个全局记忆管理专家,负责提炼跨项目的通用知识和用户偏好。
506
+
507
+ # 你的职责
508
+ 1. **用户画像**:提炼用户的沟通风格、技术偏好、工作习惯
509
+ 2. **目标追踪**:记录用户的长期目标、当前任务、进度
510
+ 3. **通用规则**:提炼跨项目都适用的行为规范
511
+ 4. **遗忘处理**:标记或移除不再相关的目标和信息
512
+
513
+ # 全局记忆内容类型
514
+ - 用户偏好:沟通风格(简洁/详细)、反馈偏好、决策风格
515
+ - 技术倾向:偏好的技术栈、框架、语言、开发工具
516
+ - 工作习惯:工作时间、专注周期、偏好时段
517
+ - 当前目标:正在进行的事项、短期目标(1-3月)
518
+ - 长期愿景:大方向、战略目标、人生阶段
519
+ - 跨项目规范:所有项目都遵循的通用规则
520
+
521
+ # 提炼原则
522
+ 1. **以用户为中心**:关注用户怎么说、怎么想,不只是做什么
523
+ 2. **目标导向**:区分已完成、进行中、计划中
524
+ 3. **可操作性**:偏好要具体,如"用户喜欢先看结论"而非"用户很忙"
525
+ 4. **时间敏感**:标记有时间限制的目标
526
+
527
+ # 用户指导
528
+ {USER_REQUIREMENT}
529
+
530
+ # 作用域
531
+ {SCOPE}
532
+
533
+ # 现有全局记忆
534
+ {CURRENT_MEMORY}
535
+
536
+ # 可用工具
537
+ - search_sessions(query, session_id?, limit?): 搜索会话历史
538
+ - get_session(session_id): 获取指定会话
539
+ - record_memory({ scope, mode, content, title }): 写入记忆文件
540
+
541
+ # 执行流程
542
+ 1. 理解现有全局记忆
543
+ 2. 根据用户指导确定提炼重点
544
+ 3. 使用工具搜索相关会话历史
545
+ 4. 分析提炼新知识
546
+ 5. 整合新旧知识,生成完整的全局记忆
547
+ 6. 使用 record_memory({ scope: "global", mode: "overwrite", content, title }) 写入
548
+
549
+ # 输出要求
550
+ 直接调用 record_memory 工具,写入新的全局记忆。
551
+ 输出格式为 Markdown,保持结构清晰。`
552
+ };
553
+ function getBuiltInPromptNames() {
554
+ return Object.keys(builtInPrompts);
555
+ }
556
+ function getBuiltInPrompt(name) {
557
+ return builtInPrompts[name];
558
+ }
559
+
560
+ // src/env/prompt/prompt-component.ts
561
+ init_logger();
562
+ import { readFile, readdir } from "fs/promises";
563
+ import { join, basename, extname } from "path";
564
+
565
+ // src/env/prompt/prompt-config-registration.ts
566
+ var PROMPT_DEFAULTS = {
567
+ "prompt.defaultName": "default",
568
+ "prompt.variablePrefix": "{{",
569
+ "prompt.variableSuffix": "}}"
570
+ };
571
+ var PROMPT_CONFIG_REGISTRATION = {
572
+ name: "prompt",
573
+ sources: [
574
+ { type: "env", envPrefix: "PROMPT", priority: 20, watch: false }
575
+ ],
576
+ keys: [
577
+ { key: "prompt.promptPaths", sources: ["env", "file"] },
578
+ { key: "prompt.defaultName", sources: ["env", "file"] },
579
+ { key: "prompt.variablePrefix", sources: ["env", "file"] },
580
+ { key: "prompt.variableSuffix", sources: ["env", "file"] }
581
+ ]
582
+ };
583
+
584
+ // src/env/prompt/prompt-component.ts
585
+ var logger = createLogger("prompt");
586
+
587
+ class PromptComponent extends BaseComponent {
588
+ name = "prompt";
589
+ version = "1.0.0";
590
+ prompts = new Map;
591
+ config;
592
+ configComponent;
593
+ renderer;
594
+ configWatcher;
595
+ constructor() {
596
+ super();
597
+ }
598
+ async init(config) {
599
+ await super.init(config);
600
+ const options = config.options;
601
+ if (!options?.configComponent) {
602
+ throw new Error("ConfigComponent is required for PromptComponent initialization");
603
+ }
604
+ this.configComponent = options.configComponent;
605
+ await this.registerConfig(options);
606
+ this.initRenderer();
607
+ await this.loadPrompts();
608
+ this.setStatus("running");
609
+ logger.info(`[PromptComponent] Initialized with ${this.prompts.size} prompts`);
610
+ }
611
+ async registerConfig(options) {
612
+ const configComponent = options.configComponent;
613
+ if (!configComponent)
614
+ return;
615
+ const { config, defaultName, promptPaths, variablePrefix, variableSuffix } = options;
616
+ configComponent.registerComponent(PROMPT_CONFIG_REGISTRATION);
617
+ await configComponent.load("prompt");
618
+ const prefix = "PROMPT";
619
+ const promptKeys = [
620
+ "prompt.defaultName",
621
+ "prompt.promptPaths",
622
+ "prompt.variablePrefix",
623
+ "prompt.variableSuffix",
624
+ "prompt.strictMode"
625
+ ];
626
+ for (const key of promptKeys) {
627
+ const envKey = toEnvKey(key, prefix);
628
+ const value = process.env[envKey];
629
+ if (value !== undefined) {
630
+ await configComponent.set(key, value);
631
+ }
632
+ }
633
+ const loadedKeys = new Set(promptKeys);
634
+ for (const envKey of Object.keys(process.env)) {
635
+ const configKey = envKeyToConfigKey(envKey, prefix, "prompt");
636
+ if (!configKey)
637
+ continue;
638
+ if (loadedKeys.has(configKey))
639
+ continue;
640
+ loadedKeys.add(configKey);
641
+ const value = process.env[envKey];
642
+ if (value !== undefined) {
643
+ await configComponent.set(configKey, value);
644
+ }
645
+ }
646
+ for (const [key, value] of Object.entries(PROMPT_DEFAULTS)) {
647
+ if (configComponent.get(key) === undefined) {
648
+ await configComponent.set(key, value);
649
+ }
650
+ }
651
+ if (config) {
652
+ const flatConfig = this.flattenConfig(config);
653
+ for (const [key, value] of Object.entries(flatConfig)) {
654
+ await configComponent.set(key, value);
655
+ }
656
+ }
657
+ if (defaultName !== undefined) {
658
+ await configComponent.set("prompt.defaultName", defaultName);
659
+ }
660
+ if (promptPaths !== undefined) {
661
+ await configComponent.set("prompt.promptPaths", promptPaths);
662
+ }
663
+ if (variablePrefix !== undefined) {
664
+ await configComponent.set("prompt.variablePrefix", variablePrefix);
665
+ }
666
+ if (variableSuffix !== undefined) {
667
+ await configComponent.set("prompt.variableSuffix", variableSuffix);
668
+ }
669
+ this.registerConfigWatcher(configComponent);
670
+ this.config = {
671
+ defaultName: configComponent.get("prompt.defaultName") || "default",
672
+ promptPaths: configComponent.get("prompt.promptPaths") || [],
673
+ variablePrefix: configComponent.get("prompt.variablePrefix") || "{{",
674
+ variableSuffix: configComponent.get("prompt.variableSuffix") || "}}",
675
+ strictMode: configComponent.get("prompt.strictMode") || false
676
+ };
677
+ }
678
+ flattenConfig(obj, prefix = "prompt") {
679
+ const result = {};
680
+ for (const [key, value] of Object.entries(obj)) {
681
+ const fullKey = `${prefix}.${key}`;
682
+ if (value && typeof value === "object" && !Array.isArray(value)) {
683
+ Object.assign(result, this.flattenConfig(value, fullKey));
684
+ } else {
685
+ result[fullKey] = value;
686
+ }
687
+ }
688
+ return result;
689
+ }
690
+ registerConfigWatcher(configComponent) {
691
+ if (typeof configComponent.watch !== "function") {
692
+ return;
693
+ }
694
+ this.configWatcher = configComponent.watch("prompt.*", (event) => {
695
+ this.onConfigChange(event);
696
+ });
697
+ }
698
+ onConfigChange(event) {
699
+ const key = event.key;
700
+ const value = event.newValue;
701
+ if (value === undefined)
702
+ return;
703
+ logger.debug(`[PromptComponent] Config updated: ${key} = ${JSON.stringify(value)}`);
704
+ switch (key) {
705
+ case "prompt.defaultName":
706
+ if (this.config)
707
+ this.config.defaultName = value;
708
+ break;
709
+ case "prompt.promptPaths":
710
+ if (this.config)
711
+ this.config.promptPaths = value;
712
+ break;
713
+ case "prompt.variablePrefix":
714
+ if (this.config) {
715
+ this.config.variablePrefix = value;
716
+ this.initRenderer();
717
+ }
718
+ break;
719
+ case "prompt.variableSuffix":
720
+ if (this.config) {
721
+ this.config.variableSuffix = value;
722
+ this.initRenderer();
723
+ }
724
+ break;
725
+ case "prompt.strictMode":
726
+ if (this.config)
727
+ this.config.strictMode = value;
728
+ break;
729
+ }
730
+ }
731
+ initRenderer() {
732
+ const config = this.config || {
733
+ defaultName: "default",
734
+ promptPaths: [],
735
+ variablePrefix: "{{",
736
+ variableSuffix: "}}",
737
+ strictMode: false
738
+ };
739
+ this.renderer = new PromptRenderer({
740
+ prefix: config.variablePrefix,
741
+ suffix: config.variableSuffix,
742
+ strict: config.strictMode,
743
+ onMissingVariable: (name) => {
744
+ logger.warn(`Undefined variable: ${name}`);
745
+ return `{{${name}}}`;
746
+ }
747
+ });
748
+ }
749
+ async onStart() {
750
+ logger.info("[PromptComponent] Started");
751
+ }
752
+ async onStop() {
753
+ this.prompts.clear();
754
+ this.setStatus("stopped");
755
+ logger.info("[PromptComponent] Stopped");
756
+ }
757
+ getPromptConfig(key, defaultValue) {
758
+ if (this.config && key in this.config) {
759
+ return this.config[key] ?? defaultValue;
760
+ }
761
+ return defaultValue;
762
+ }
763
+ add(name, content, source = "inline") {
764
+ const entry = {
765
+ name,
766
+ content,
767
+ source,
768
+ overridable: true,
769
+ loadedAt: Date.now()
770
+ };
771
+ const existing = this.prompts.get(name);
772
+ if (existing && !existing.overridable) {
773
+ logger.debug(`[PromptComponent] Skip override for non-overridable prompt: ${name}`);
774
+ return;
775
+ }
776
+ this.prompts.set(name, entry);
777
+ logger.debug(`[PromptComponent] Added prompt: ${name} (${source})`);
778
+ }
779
+ get(name) {
780
+ return this.prompts.get(name)?.content;
781
+ }
782
+ getEntry(name) {
783
+ return this.prompts.get(name);
784
+ }
785
+ has(name) {
786
+ return this.prompts.has(name);
787
+ }
788
+ delete(name) {
789
+ return this.prompts.delete(name);
790
+ }
791
+ list() {
792
+ return Array.from(this.prompts.keys());
793
+ }
794
+ size() {
795
+ return this.prompts.size;
796
+ }
797
+ async getPrompt(name, variables = {}) {
798
+ const defaultName = this.getPromptConfig("defaultName", "default");
799
+ const targetName = this.has(name) ? name : defaultName;
800
+ const entry = this.prompts.get(targetName);
801
+ if (!entry) {
802
+ logger.warn(`[PromptComponent] Prompt not found: ${name}, using fallback`);
803
+ return "You are a helpful assistant.";
804
+ }
805
+ return this.render(entry.content, variables, { name: targetName });
806
+ }
807
+ async render(content, variables = {}, context) {
808
+ const hookContext = {
809
+ name: context?.name || "anonymous",
810
+ originalContent: content,
811
+ renderedContent: content,
812
+ variables
813
+ };
814
+ await globalHookManager.execute(PromptHookPoints.BEFORE_RENDER, hookContext);
815
+ hookContext.renderedContent = this.renderer.render(hookContext.originalContent, variables);
816
+ await globalHookManager.execute(PromptHookPoints.AFTER_RENDER, hookContext);
817
+ return hookContext.renderedContent;
818
+ }
819
+ extractVariables(content) {
820
+ return this.renderer.extractVariables(content);
821
+ }
822
+ async loadPrompts() {
823
+ await this.loadBuiltInPrompts();
824
+ await this.loadExternalPrompts();
825
+ }
826
+ async loadBuiltInPrompts() {
827
+ for (const [name, content] of Object.entries(builtInPrompts)) {
828
+ if (content) {
829
+ this.prompts.set(name, {
830
+ name,
831
+ content,
832
+ source: "built-in",
833
+ overridable: false,
834
+ loadedAt: Date.now()
835
+ });
836
+ logger.debug(`[PromptComponent] Loaded built-in prompt: ${name}`);
837
+ }
838
+ }
839
+ logger.info(`[PromptComponent] Loaded ${this.prompts.size} built-in prompts`);
840
+ }
841
+ async loadExternalPrompts() {
842
+ const promptPaths = this.getPromptConfig("promptPaths", []);
843
+ for (const pathConfig of promptPaths) {
844
+ try {
845
+ if (pathConfig.type === "file") {
846
+ await this.loadFromFile(pathConfig.path, pathConfig.name);
847
+ } else if (pathConfig.type === "directory") {
848
+ await this.loadFromDirectory(pathConfig.path, pathConfig.extension || ".md", pathConfig.recursive !== false);
849
+ }
850
+ } catch (error) {
851
+ logger.error(`[PromptComponent] Failed to load from ${pathConfig.path}:`, error);
852
+ }
853
+ }
854
+ }
855
+ async loadFromFile(filePath, name) {
856
+ try {
857
+ const content = await readFile(filePath, "utf-8");
858
+ const promptName = name || basename(filePath, extname(filePath));
859
+ this.add(promptName, content.trim(), "file");
860
+ const entry = this.prompts.get(promptName);
861
+ if (entry)
862
+ entry.filePath = filePath;
863
+ logger.debug(`[PromptComponent] Loaded prompt from file: ${filePath}`);
864
+ return true;
865
+ } catch (error) {
866
+ logger.error(`[PromptComponent] Failed to load file ${filePath}:`, error);
867
+ return false;
868
+ }
869
+ }
870
+ async loadFromDirectory(directory, extension = ".md", recursive = true) {
871
+ let loaded = 0;
872
+ try {
873
+ const files = await this.findFiles(directory, extension, recursive);
874
+ for (const filePath of files) {
875
+ const relativePath = filePath.replace(directory + "/", "");
876
+ const promptName = relativePath.replace(/\\/g, "/").replace(new RegExp(escapeRegex2(extension) + "$"), "").replace(/\//g, "-");
877
+ const content = await readFile(filePath, "utf-8");
878
+ this.add(promptName, content.trim(), "directory");
879
+ const entry = this.prompts.get(promptName);
880
+ if (entry)
881
+ entry.filePath = filePath;
882
+ loaded++;
883
+ }
884
+ logger.info(`[PromptComponent] Loaded ${loaded} prompts from directory: ${directory}`);
885
+ } catch (error) {
886
+ logger.error(`[PromptComponent] Failed to load directory ${directory}:`, error);
887
+ }
888
+ return loaded;
889
+ }
890
+ async findFiles(dir, extension, recursive) {
891
+ const files = [];
892
+ try {
893
+ const entries = await readdir(dir, { withFileTypes: true });
894
+ for (const entry of entries) {
895
+ const fullPath = join(dir, entry.name);
896
+ if (entry.isDirectory() && recursive) {
897
+ const subFiles = await this.findFiles(fullPath, extension, true);
898
+ files.push(...subFiles);
899
+ } else if (entry.isFile() && entry.name.endsWith(extension)) {
900
+ files.push(fullPath);
901
+ }
902
+ }
903
+ } catch (error) {
904
+ logger.warn(`[PromptComponent] Cannot read directory ${dir}:`, error);
905
+ }
906
+ return files;
907
+ }
908
+ registerPromptHook(hookPoint, name, fn, priority) {
909
+ globalHookManager.register(hookPoint, createHook({ name, priority }, fn));
910
+ }
911
+ unregisterPromptHook(hookPoint, name) {
912
+ return globalHookManager.unregister(hookPoint, name);
913
+ }
914
+ getHookPoints() {
915
+ return [PromptHookPoints.BEFORE_RENDER, PromptHookPoints.AFTER_RENDER];
916
+ }
917
+ }
918
+ function escapeRegex2(str) {
919
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
920
+ }
921
+
922
+ export { PromptPathSchema, PromptConfigSchema, PromptRenderer, getBuiltInPromptNames, getBuiltInPrompt, PromptComponent };