sylas-edge-worker 0.2.21

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 (163) hide show
  1. package/README.md +293 -0
  2. package/dist/ActivityPoster.d.ts +15 -0
  3. package/dist/ActivityPoster.d.ts.map +1 -0
  4. package/dist/ActivityPoster.js +194 -0
  5. package/dist/ActivityPoster.js.map +1 -0
  6. package/dist/AgentSessionManager.d.ts +280 -0
  7. package/dist/AgentSessionManager.d.ts.map +1 -0
  8. package/dist/AgentSessionManager.js +1412 -0
  9. package/dist/AgentSessionManager.js.map +1 -0
  10. package/dist/AskUserQuestionHandler.d.ts +97 -0
  11. package/dist/AskUserQuestionHandler.d.ts.map +1 -0
  12. package/dist/AskUserQuestionHandler.js +206 -0
  13. package/dist/AskUserQuestionHandler.js.map +1 -0
  14. package/dist/AttachmentService.d.ts +69 -0
  15. package/dist/AttachmentService.d.ts.map +1 -0
  16. package/dist/AttachmentService.js +369 -0
  17. package/dist/AttachmentService.js.map +1 -0
  18. package/dist/ChatSessionHandler.d.ts +87 -0
  19. package/dist/ChatSessionHandler.d.ts.map +1 -0
  20. package/dist/ChatSessionHandler.js +231 -0
  21. package/dist/ChatSessionHandler.js.map +1 -0
  22. package/dist/ConfigManager.d.ts +91 -0
  23. package/dist/ConfigManager.d.ts.map +1 -0
  24. package/dist/ConfigManager.js +227 -0
  25. package/dist/ConfigManager.js.map +1 -0
  26. package/dist/EdgeWorker.d.ts +670 -0
  27. package/dist/EdgeWorker.d.ts.map +1 -0
  28. package/dist/EdgeWorker.js +3801 -0
  29. package/dist/EdgeWorker.js.map +1 -0
  30. package/dist/GitService.d.ts +39 -0
  31. package/dist/GitService.d.ts.map +1 -0
  32. package/dist/GitService.js +432 -0
  33. package/dist/GitService.js.map +1 -0
  34. package/dist/GlobalSessionRegistry.d.ts +142 -0
  35. package/dist/GlobalSessionRegistry.d.ts.map +1 -0
  36. package/dist/GlobalSessionRegistry.js +254 -0
  37. package/dist/GlobalSessionRegistry.js.map +1 -0
  38. package/dist/PromptBuilder.d.ts +175 -0
  39. package/dist/PromptBuilder.d.ts.map +1 -0
  40. package/dist/PromptBuilder.js +884 -0
  41. package/dist/PromptBuilder.js.map +1 -0
  42. package/dist/RepositoryRouter.d.ts +152 -0
  43. package/dist/RepositoryRouter.d.ts.map +1 -0
  44. package/dist/RepositoryRouter.js +480 -0
  45. package/dist/RepositoryRouter.js.map +1 -0
  46. package/dist/RunnerSelectionService.d.ts +62 -0
  47. package/dist/RunnerSelectionService.d.ts.map +1 -0
  48. package/dist/RunnerSelectionService.js +379 -0
  49. package/dist/RunnerSelectionService.js.map +1 -0
  50. package/dist/SharedApplicationServer.d.ts +107 -0
  51. package/dist/SharedApplicationServer.d.ts.map +1 -0
  52. package/dist/SharedApplicationServer.js +247 -0
  53. package/dist/SharedApplicationServer.js.map +1 -0
  54. package/dist/SharedWebhookServer.d.ts +39 -0
  55. package/dist/SharedWebhookServer.d.ts.map +1 -0
  56. package/dist/SharedWebhookServer.js +150 -0
  57. package/dist/SharedWebhookServer.js.map +1 -0
  58. package/dist/SlackChatAdapter.d.ts +25 -0
  59. package/dist/SlackChatAdapter.d.ts.map +1 -0
  60. package/dist/SlackChatAdapter.js +143 -0
  61. package/dist/SlackChatAdapter.js.map +1 -0
  62. package/dist/UserAccessControl.d.ts +69 -0
  63. package/dist/UserAccessControl.d.ts.map +1 -0
  64. package/dist/UserAccessControl.js +171 -0
  65. package/dist/UserAccessControl.js.map +1 -0
  66. package/dist/WorktreeIncludeService.d.ts +32 -0
  67. package/dist/WorktreeIncludeService.d.ts.map +1 -0
  68. package/dist/WorktreeIncludeService.js +123 -0
  69. package/dist/WorktreeIncludeService.js.map +1 -0
  70. package/dist/index.d.ts +22 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +17 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/label-prompt-template.md +27 -0
  75. package/dist/procedures/ProcedureAnalyzer.d.ts +69 -0
  76. package/dist/procedures/ProcedureAnalyzer.d.ts.map +1 -0
  77. package/dist/procedures/ProcedureAnalyzer.js +271 -0
  78. package/dist/procedures/ProcedureAnalyzer.js.map +1 -0
  79. package/dist/procedures/index.d.ts +7 -0
  80. package/dist/procedures/index.d.ts.map +1 -0
  81. package/dist/procedures/index.js +7 -0
  82. package/dist/procedures/index.js.map +1 -0
  83. package/dist/procedures/registry.d.ts +156 -0
  84. package/dist/procedures/registry.d.ts.map +1 -0
  85. package/dist/procedures/registry.js +240 -0
  86. package/dist/procedures/registry.js.map +1 -0
  87. package/dist/procedures/types.d.ts +103 -0
  88. package/dist/procedures/types.d.ts.map +1 -0
  89. package/dist/procedures/types.js +5 -0
  90. package/dist/procedures/types.js.map +1 -0
  91. package/dist/prompt-assembly/types.d.ts +80 -0
  92. package/dist/prompt-assembly/types.d.ts.map +1 -0
  93. package/dist/prompt-assembly/types.js +8 -0
  94. package/dist/prompt-assembly/types.js.map +1 -0
  95. package/dist/prompts/builder.md +191 -0
  96. package/dist/prompts/debugger.md +128 -0
  97. package/dist/prompts/graphite-orchestrator.md +362 -0
  98. package/dist/prompts/orchestrator.md +290 -0
  99. package/dist/prompts/scoper.md +95 -0
  100. package/dist/prompts/standard-issue-assigned-user-prompt.md +33 -0
  101. package/dist/prompts/subroutines/changelog-update.md +79 -0
  102. package/dist/prompts/subroutines/coding-activity.md +12 -0
  103. package/dist/prompts/subroutines/concise-summary.md +67 -0
  104. package/dist/prompts/subroutines/debugger-fix.md +92 -0
  105. package/dist/prompts/subroutines/debugger-reproduction.md +74 -0
  106. package/dist/prompts/subroutines/full-delegation.md +68 -0
  107. package/dist/prompts/subroutines/get-approval.md +175 -0
  108. package/dist/prompts/subroutines/gh-pr.md +80 -0
  109. package/dist/prompts/subroutines/git-commit.md +37 -0
  110. package/dist/prompts/subroutines/plan-summary.md +21 -0
  111. package/dist/prompts/subroutines/preparation.md +16 -0
  112. package/dist/prompts/subroutines/question-answer.md +8 -0
  113. package/dist/prompts/subroutines/question-investigation.md +8 -0
  114. package/dist/prompts/subroutines/release-execution.md +81 -0
  115. package/dist/prompts/subroutines/release-summary.md +60 -0
  116. package/dist/prompts/subroutines/user-testing-summary.md +87 -0
  117. package/dist/prompts/subroutines/user-testing.md +48 -0
  118. package/dist/prompts/subroutines/validation-fixer.md +56 -0
  119. package/dist/prompts/subroutines/verbose-summary.md +46 -0
  120. package/dist/prompts/subroutines/verifications.md +77 -0
  121. package/dist/prompts/todolist-system-prompt-extension.md +15 -0
  122. package/dist/sinks/IActivitySink.d.ts +60 -0
  123. package/dist/sinks/IActivitySink.d.ts.map +1 -0
  124. package/dist/sinks/IActivitySink.js +2 -0
  125. package/dist/sinks/IActivitySink.js.map +1 -0
  126. package/dist/sinks/LinearActivitySink.d.ts +69 -0
  127. package/dist/sinks/LinearActivitySink.d.ts.map +1 -0
  128. package/dist/sinks/LinearActivitySink.js +111 -0
  129. package/dist/sinks/LinearActivitySink.js.map +1 -0
  130. package/dist/sinks/NoopActivitySink.d.ts +13 -0
  131. package/dist/sinks/NoopActivitySink.d.ts.map +1 -0
  132. package/dist/sinks/NoopActivitySink.js +17 -0
  133. package/dist/sinks/NoopActivitySink.js.map +1 -0
  134. package/dist/sinks/index.d.ts +9 -0
  135. package/dist/sinks/index.d.ts.map +1 -0
  136. package/dist/sinks/index.js +8 -0
  137. package/dist/sinks/index.js.map +1 -0
  138. package/dist/types.d.ts +32 -0
  139. package/dist/types.d.ts.map +1 -0
  140. package/dist/types.js +2 -0
  141. package/dist/types.js.map +1 -0
  142. package/dist/validation/ValidationLoopController.d.ts +54 -0
  143. package/dist/validation/ValidationLoopController.d.ts.map +1 -0
  144. package/dist/validation/ValidationLoopController.js +242 -0
  145. package/dist/validation/ValidationLoopController.js.map +1 -0
  146. package/dist/validation/index.d.ts +7 -0
  147. package/dist/validation/index.d.ts.map +1 -0
  148. package/dist/validation/index.js +7 -0
  149. package/dist/validation/index.js.map +1 -0
  150. package/dist/validation/types.d.ts +82 -0
  151. package/dist/validation/types.d.ts.map +1 -0
  152. package/dist/validation/types.js +29 -0
  153. package/dist/validation/types.js.map +1 -0
  154. package/label-prompt-template.md +27 -0
  155. package/package.json +56 -0
  156. package/prompt-template.md +116 -0
  157. package/prompts/builder.md +191 -0
  158. package/prompts/debugger.md +128 -0
  159. package/prompts/graphite-orchestrator.md +362 -0
  160. package/prompts/orchestrator.md +290 -0
  161. package/prompts/scoper.md +95 -0
  162. package/prompts/standard-issue-assigned-user-prompt.md +33 -0
  163. package/prompts/todolist-system-prompt-extension.md +15 -0
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Registry of predefined procedures and analysis rules
3
+ */
4
+ /**
5
+ * Predefined subroutine definitions
6
+ */
7
+ export const SUBROUTINES = {
8
+ primary: {
9
+ name: "primary",
10
+ promptPath: "primary", // Special: resolved via label (debugger/builder/scoper/orchestrator) or direct user input
11
+ description: "Main work execution phase",
12
+ },
13
+ debuggerReproduction: {
14
+ name: "debugger-reproduction",
15
+ promptPath: "subroutines/debugger-reproduction.md",
16
+ description: "Reproduce bug and perform root cause analysis",
17
+ },
18
+ getApproval: {
19
+ name: "get-approval",
20
+ promptPath: "subroutines/get-approval.md",
21
+ description: "Request user approval before proceeding",
22
+ singleTurn: true,
23
+ requiresApproval: true, // Flag to trigger approval workflow
24
+ },
25
+ debuggerFix: {
26
+ name: "debugger-fix",
27
+ promptPath: "subroutines/debugger-fix.md",
28
+ description: "Implement minimal fix based on approved reproduction",
29
+ },
30
+ verifications: {
31
+ name: "verifications",
32
+ promptPath: "subroutines/verifications.md",
33
+ description: "Run tests, linting, and type checking",
34
+ usesValidationLoop: true, // Enable validation loop with retry logic
35
+ },
36
+ validationFixer: {
37
+ name: "validation-fixer",
38
+ promptPath: "subroutines/validation-fixer.md",
39
+ description: "Fix validation failures from the verifications subroutine",
40
+ },
41
+ gitCommit: {
42
+ name: "git-commit",
43
+ promptPath: "subroutines/git-commit.md",
44
+ description: "Stage, commit, and push changes to remote",
45
+ },
46
+ ghPr: {
47
+ name: "gh-pr",
48
+ promptPath: "subroutines/gh-pr.md",
49
+ description: "Create or update GitHub Pull Request",
50
+ },
51
+ changelogUpdate: {
52
+ name: "changelog-update",
53
+ promptPath: "subroutines/changelog-update.md",
54
+ description: "Update changelog (only if changelog files exist)",
55
+ },
56
+ conciseSummary: {
57
+ name: "concise-summary",
58
+ promptPath: "subroutines/concise-summary.md",
59
+ singleTurn: true,
60
+ description: "Brief summary for simple requests",
61
+ suppressThoughtPosting: true,
62
+ disallowAllTools: true,
63
+ },
64
+ verboseSummary: {
65
+ name: "verbose-summary",
66
+ promptPath: "subroutines/verbose-summary.md",
67
+ singleTurn: true,
68
+ description: "Detailed summary with implementation details",
69
+ suppressThoughtPosting: true,
70
+ disallowAllTools: true,
71
+ },
72
+ questionInvestigation: {
73
+ name: "question-investigation",
74
+ promptPath: "subroutines/question-investigation.md",
75
+ description: "Gather information needed to answer a question",
76
+ },
77
+ questionAnswer: {
78
+ name: "question-answer",
79
+ promptPath: "subroutines/question-answer.md",
80
+ singleTurn: true,
81
+ description: "Format final answer to user question",
82
+ suppressThoughtPosting: true,
83
+ disallowAllTools: true,
84
+ },
85
+ codingActivity: {
86
+ name: "coding-activity",
87
+ promptPath: "subroutines/coding-activity.md",
88
+ description: "Implementation phase for code changes (no git/gh operations)",
89
+ },
90
+ preparation: {
91
+ name: "preparation",
92
+ promptPath: "subroutines/preparation.md",
93
+ description: "Analyze request to determine if clarification or planning is needed",
94
+ },
95
+ planSummary: {
96
+ name: "plan-summary",
97
+ promptPath: "subroutines/plan-summary.md",
98
+ singleTurn: true,
99
+ description: "Present clarifying questions or implementation plan",
100
+ suppressThoughtPosting: true,
101
+ disallowAllTools: true,
102
+ },
103
+ userTesting: {
104
+ name: "user-testing",
105
+ promptPath: "subroutines/user-testing.md",
106
+ description: "Perform testing as requested by the user",
107
+ },
108
+ userTestingSummary: {
109
+ name: "user-testing-summary",
110
+ promptPath: "subroutines/user-testing-summary.md",
111
+ singleTurn: true,
112
+ description: "Summary of user testing session results",
113
+ suppressThoughtPosting: true,
114
+ disallowAllTools: true,
115
+ },
116
+ releaseExecution: {
117
+ name: "release-execution",
118
+ promptPath: "subroutines/release-execution.md",
119
+ description: "Execute release process using project skill or gather release info via AskUserQuestion",
120
+ },
121
+ releaseSummary: {
122
+ name: "release-summary",
123
+ promptPath: "subroutines/release-summary.md",
124
+ singleTurn: true,
125
+ description: "Summary of the release process",
126
+ suppressThoughtPosting: true,
127
+ disallowAllTools: true,
128
+ },
129
+ fullDelegation: {
130
+ name: "full-delegation",
131
+ promptPath: "subroutines/full-delegation.md",
132
+ description: "Full delegation to a smart runner — coding, testing, committing, PR creation, and summary in a single session",
133
+ },
134
+ };
135
+ /**
136
+ * Predefined procedure definitions
137
+ */
138
+ export const PROCEDURES = {
139
+ "simple-question": {
140
+ name: "simple-question",
141
+ description: "For questions or requests that don't modify the codebase",
142
+ subroutines: [
143
+ SUBROUTINES.questionInvestigation,
144
+ SUBROUTINES.questionAnswer,
145
+ ],
146
+ },
147
+ "documentation-edit": {
148
+ name: "documentation-edit",
149
+ description: "For documentation/markdown edits that don't require verification",
150
+ subroutines: [
151
+ SUBROUTINES.primary,
152
+ SUBROUTINES.gitCommit,
153
+ SUBROUTINES.ghPr,
154
+ SUBROUTINES.conciseSummary,
155
+ ],
156
+ },
157
+ "full-development": {
158
+ name: "full-development",
159
+ description: "For code changes requiring full verification and PR creation",
160
+ subroutines: [
161
+ SUBROUTINES.codingActivity,
162
+ SUBROUTINES.verifications,
163
+ SUBROUTINES.changelogUpdate,
164
+ SUBROUTINES.gitCommit,
165
+ SUBROUTINES.ghPr,
166
+ SUBROUTINES.conciseSummary,
167
+ ],
168
+ },
169
+ "debugger-full": {
170
+ name: "debugger-full",
171
+ description: "Full debugging workflow with reproduction, fix, and verification",
172
+ subroutines: [
173
+ SUBROUTINES.debuggerReproduction,
174
+ SUBROUTINES.debuggerFix,
175
+ SUBROUTINES.verifications,
176
+ SUBROUTINES.changelogUpdate,
177
+ SUBROUTINES.gitCommit,
178
+ SUBROUTINES.ghPr,
179
+ SUBROUTINES.conciseSummary,
180
+ ],
181
+ },
182
+ "orchestrator-full": {
183
+ name: "orchestrator-full",
184
+ description: "Full orchestration workflow with decomposition and delegation to sub-agents",
185
+ subroutines: [SUBROUTINES.primary, SUBROUTINES.conciseSummary],
186
+ },
187
+ "plan-mode": {
188
+ name: "plan-mode",
189
+ description: "Planning mode for requests needing clarification or implementation planning",
190
+ subroutines: [SUBROUTINES.preparation, SUBROUTINES.planSummary],
191
+ },
192
+ "user-testing": {
193
+ name: "user-testing",
194
+ description: "User-driven testing workflow for manual testing sessions",
195
+ subroutines: [SUBROUTINES.userTesting, SUBROUTINES.userTestingSummary],
196
+ },
197
+ release: {
198
+ name: "release",
199
+ description: "Release workflow that invokes project release skill or asks user for release info",
200
+ subroutines: [SUBROUTINES.releaseExecution, SUBROUTINES.releaseSummary],
201
+ },
202
+ "full-delegation": {
203
+ name: "full-delegation",
204
+ description: "Single-session full delegation for smart runners (OpenCode + oh-my-opencode) — the runner handles the entire workflow autonomously",
205
+ subroutines: [SUBROUTINES.fullDelegation],
206
+ },
207
+ };
208
+ /**
209
+ * Mapping from request classification to procedure name
210
+ */
211
+ export const CLASSIFICATION_TO_PROCEDURE = {
212
+ question: "simple-question",
213
+ documentation: "documentation-edit",
214
+ transient: "simple-question",
215
+ planning: "plan-mode",
216
+ code: "full-development",
217
+ debugger: "debugger-full",
218
+ orchestrator: "orchestrator-full",
219
+ "user-testing": "user-testing",
220
+ release: "release",
221
+ };
222
+ /**
223
+ * Get a procedure definition by name
224
+ */
225
+ export function getProcedure(name) {
226
+ return PROCEDURES[name];
227
+ }
228
+ /**
229
+ * Get procedure name for a given classification
230
+ */
231
+ export function getProcedureForClassification(classification) {
232
+ return CLASSIFICATION_TO_PROCEDURE[classification];
233
+ }
234
+ /**
235
+ * Get all available procedure names
236
+ */
237
+ export function getAllProcedureNames() {
238
+ return Object.keys(PROCEDURES);
239
+ }
240
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/procedures/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,OAAO,EAAE;QACR,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,SAAS,EAAE,0FAA0F;QACjH,WAAW,EAAE,2BAA2B;KACxC;IACD,oBAAoB,EAAE;QACrB,IAAI,EAAE,uBAAuB;QAC7B,UAAU,EAAE,sCAAsC;QAClD,WAAW,EAAE,+CAA+C;KAC5D;IACD,WAAW,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,6BAA6B;QACzC,WAAW,EAAE,yCAAyC;QACtD,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,IAAI,EAAE,oCAAoC;KAC5D;IACD,WAAW,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,6BAA6B;QACzC,WAAW,EAAE,sDAAsD;KACnE;IACD,aAAa,EAAE;QACd,IAAI,EAAE,eAAe;QACrB,UAAU,EAAE,8BAA8B;QAC1C,WAAW,EAAE,uCAAuC;QACpD,kBAAkB,EAAE,IAAI,EAAE,0CAA0C;KACpE;IACD,eAAe,EAAE;QAChB,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,iCAAiC;QAC7C,WAAW,EAAE,2DAA2D;KACxE;IACD,SAAS,EAAE;QACV,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,2BAA2B;QACvC,WAAW,EAAE,2CAA2C;KACxD;IACD,IAAI,EAAE;QACL,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,sBAAsB;QAClC,WAAW,EAAE,sCAAsC;KACnD;IACD,eAAe,EAAE;QAChB,IAAI,EAAE,kBAAkB;QACxB,UAAU,EAAE,iCAAiC;QAC7C,WAAW,EAAE,kDAAkD;KAC/D;IACD,cAAc,EAAE;QACf,IAAI,EAAE,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,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B,CAC5C,cAAqC;IAErC,OAAO,2BAA2B,CAAC,cAAc,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Type definitions for the procedure analysis system
3
+ */
4
+ /**
5
+ * Definition of a single subroutine in a procedure
6
+ */
7
+ export interface SubroutineDefinition {
8
+ /** Unique identifier for the subroutine */
9
+ name: string;
10
+ /** Path to the prompt file (relative to edge-worker/src/prompts/) */
11
+ promptPath: string;
12
+ /** Whether this subroutine should run in single-turn mode (maxTurns: 1) */
13
+ singleTurn?: boolean;
14
+ /** Human-readable description of what this subroutine does */
15
+ description: string;
16
+ /** Whether this subroutine should skip posting to Linear activity stream */
17
+ skipLinearPost?: boolean;
18
+ /** Whether to suppress posting thoughts/actions (still posts final summary) */
19
+ suppressThoughtPosting?: boolean;
20
+ /** Whether this subroutine requires user approval before advancing to next step */
21
+ requiresApproval?: boolean;
22
+ /** Tools that should be explicitly disallowed during this subroutine */
23
+ disallowedTools?: readonly string[];
24
+ /**
25
+ * Whether to disallow ALL tool usage during this subroutine.
26
+ * When true, the agent will only produce text output without any tool calls.
27
+ * This is useful for summary subroutines where tool usage would cause
28
+ * the session to appear "hanging" to users in Linear.
29
+ */
30
+ disallowAllTools?: boolean;
31
+ /**
32
+ * Whether this subroutine uses the validation loop with retry logic.
33
+ * When true, the subroutine output is parsed as ValidationResult and
34
+ * the validation-fixer subroutine is run on failures (up to maxIterations).
35
+ */
36
+ usesValidationLoop?: boolean;
37
+ }
38
+ /**
39
+ * Complete definition of a procedure (sequence of subroutines)
40
+ */
41
+ export interface ProcedureDefinition {
42
+ /** Unique identifier for the procedure */
43
+ name: string;
44
+ /** Human-readable description of when to use this procedure */
45
+ description: string;
46
+ /** Ordered list of subroutines to execute */
47
+ subroutines: SubroutineDefinition[];
48
+ }
49
+ /**
50
+ * Validation loop state for subroutines that use retry logic
51
+ */
52
+ export interface ValidationLoopMetadata {
53
+ /** Current iteration (1-based) */
54
+ iteration: number;
55
+ /** Whether the loop is in fixer mode (running validation-fixer) */
56
+ inFixerMode: boolean;
57
+ /** Results from each validation attempt */
58
+ attempts: Array<{
59
+ iteration: number;
60
+ pass: boolean;
61
+ reason: string;
62
+ timestamp: number;
63
+ }>;
64
+ }
65
+ /**
66
+ * Procedure metadata stored in session.metadata.procedure
67
+ */
68
+ export interface ProcedureMetadata {
69
+ /** Name of the active procedure */
70
+ procedureName: string;
71
+ /** Current position in the subroutine sequence (0-indexed) */
72
+ currentSubroutineIndex: number;
73
+ /** History of completed subroutines */
74
+ subroutineHistory: Array<{
75
+ subroutine: string;
76
+ completedAt: number;
77
+ claudeSessionId: string | null;
78
+ geminiSessionId: string | null;
79
+ codexSessionId?: string | null;
80
+ cursorSessionId?: string | null;
81
+ openCodeSessionId?: string | null;
82
+ /** The result text from the completed subroutine (if available) */
83
+ result?: string;
84
+ }>;
85
+ /** State for validation loop (when current subroutine uses usesValidationLoop) */
86
+ validationLoop?: ValidationLoopMetadata;
87
+ }
88
+ /**
89
+ * Request classification types for analysis decisions
90
+ */
91
+ export type RequestClassification = "question" | "documentation" | "transient" | "planning" | "code" | "debugger" | "orchestrator" | "user-testing" | "release";
92
+ /**
93
+ * Result of procedure analysis decision
94
+ */
95
+ export interface ProcedureAnalysisDecision {
96
+ /** Classification of the request */
97
+ classification: RequestClassification;
98
+ /** Selected procedure to execute */
99
+ procedure: ProcedureDefinition;
100
+ /** Reasoning for the classification (for debugging) */
101
+ reasoning?: string;
102
+ }
103
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/procedures/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,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B,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAClC,mEAAmE;QACnE,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IAEH,kFAAkF;IAClF,cAAc,CAAC,EAAE,sBAAsB,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC9B,UAAU,GACV,eAAe,GACf,WAAW,GACX,UAAU,GACV,MAAM,GACN,UAAU,GACV,cAAc,GACd,cAAc,GACd,SAAS,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,oCAAoC;IACpC,cAAc,EAAE,qBAAqB,CAAC;IAEtC,oCAAoC;IACpC,SAAS,EAAE,mBAAmB,CAAC;IAE/B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type definitions for the procedure analysis system
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/procedures/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Type definitions for the unified prompt assembly system
3
+ *
4
+ * This module provides a clear, testable interface for assembling prompts
5
+ * with well-defined inputs and outputs.
6
+ */
7
+ import type { GuidanceRule, Issue, RepositoryConfig, SylasAgentSession, WebhookAgentSession } from "sylas-core";
8
+ /**
9
+ * Output structure from buildPrompt - contains everything needed to start a Claude session
10
+ */
11
+ export interface PromptAssembly {
12
+ /** System prompt for Claude runner configuration (e.g., "builder", "debugger") */
13
+ systemPrompt?: string;
14
+ /** The complete user prompt to send to Claude */
15
+ userPrompt: string;
16
+ /** Metadata about what was assembled (for debugging and testing) */
17
+ metadata: {
18
+ /** List of components included in the prompt */
19
+ components: PromptComponent[];
20
+ /** Name of the subroutine prompt loaded (if any) */
21
+ subroutineName?: string;
22
+ /** Type of prompt builder used */
23
+ promptType: PromptType;
24
+ /** Whether this was a new session */
25
+ isNewSession: boolean;
26
+ /** Whether the session is actively streaming */
27
+ isStreaming: boolean;
28
+ };
29
+ }
30
+ /**
31
+ * Components that can be included in a prompt
32
+ */
33
+ export type PromptComponent = "issue-context" | "subroutine-prompt" | "user-comment" | "attachment-manifest" | "guidance-rules";
34
+ /**
35
+ * Type of prompt builder used
36
+ */
37
+ export type PromptType = "label-based" | "label-based-prompt-command" | "mention" | "fallback" | "continuation";
38
+ /**
39
+ * Input structure for buildPrompt - all information needed to assemble a prompt
40
+ */
41
+ export interface PromptAssemblyInput {
42
+ /** The Sylas agent session */
43
+ session: SylasAgentSession;
44
+ /** Full issue details */
45
+ fullIssue: Issue;
46
+ /** Repository configuration */
47
+ repository: RepositoryConfig;
48
+ /** User's comment text (or empty string for initial assignment) */
49
+ userComment: string;
50
+ /** Author of the comment (for multi-player context) */
51
+ commentAuthor?: string;
52
+ /** Timestamp of the comment (for multi-player context) */
53
+ commentTimestamp?: string;
54
+ /** Attachment manifest string (if any attachments) */
55
+ attachmentManifest?: string;
56
+ /** Linear agent guidance rules */
57
+ guidance?: GuidanceRule[];
58
+ /** Whether this is a new session (vs continuation) */
59
+ isNewSession: boolean;
60
+ /** Whether the Claude runner is actively streaming */
61
+ isStreaming: boolean;
62
+ /** Whether triggered by @mention */
63
+ isMentionTriggered?: boolean;
64
+ /** Whether /label-based-prompt command was used */
65
+ isLabelBasedPromptRequested?: boolean;
66
+ /** Agent session data (for mention-triggered prompts) */
67
+ agentSession?: WebhookAgentSession;
68
+ /** Labels on the issue (for system prompt determination) */
69
+ labels?: string[];
70
+ }
71
+ /**
72
+ * Result from building issue context (intermediate step)
73
+ */
74
+ export interface IssueContextResult {
75
+ /** The assembled issue context prompt */
76
+ prompt: string;
77
+ /** Template version (if using versioned templates) */
78
+ version?: string;
79
+ }
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompt-assembly/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,KAAK,EACL,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IAEnB,oEAAoE;IACpE,QAAQ,EAAE;QACT,gDAAgD;QAChD,UAAU,EAAE,eAAe,EAAE,CAAC;QAE9B,oDAAoD;QACpD,cAAc,CAAC,EAAE,MAAM,CAAC;QAExB,kCAAkC;QAClC,UAAU,EAAE,UAAU,CAAC;QAEvB,qCAAqC;QACrC,YAAY,EAAE,OAAO,CAAC;QAEtB,gDAAgD;QAChD,WAAW,EAAE,OAAO,CAAC;KACrB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACxB,eAAe,GACf,mBAAmB,GACnB,cAAc,GACd,qBAAqB,GACrB,gBAAgB,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,UAAU,GACnB,aAAa,GACb,4BAA4B,GAC5B,SAAS,GACT,UAAU,GACV,cAAc,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAEnC,8BAA8B;IAC9B,OAAO,EAAE,iBAAiB,CAAC;IAE3B,yBAAyB;IACzB,SAAS,EAAE,KAAK,CAAC;IAEjB,+BAA+B;IAC/B,UAAU,EAAE,gBAAgB,CAAC;IAG7B,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IAEpB,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,sDAAsD;IACtD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,kCAAkC;IAClC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAG1B,sDAAsD;IACtD,YAAY,EAAE,OAAO,CAAC;IAEtB,sDAAsD;IACtD,WAAW,EAAE,OAAO,CAAC;IAErB,oCAAoC;IACpC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,mDAAmD;IACnD,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC,yDAAyD;IACzD,YAAY,CAAC,EAAE,mBAAmB,CAAC;IAEnC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IAEf,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Type definitions for the unified prompt assembly system
3
+ *
4
+ * This module provides a clear, testable interface for assembling prompts
5
+ * with well-defined inputs and outputs.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/prompt-assembly/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,191 @@
1
+ <version-tag value="builder-v1.3.2" />
2
+
3
+ You are a masterful software engineer, specializing in feature implementation.
4
+
5
+ <builder_specific_instructions>
6
+ You are handling a clear feature request that is ready for implementation. The requirements are well-defined (either through a PRD or clear specifications).
7
+
8
+ **Implementation focus:**
9
+ - Follow existing code patterns
10
+ - Ensure code quality
11
+ - Add comprehensive tests
12
+ - Update relevant documentation
13
+ - Consider edge cases
14
+ - Ensure backward compatibility
15
+
16
+ **Deliver production-ready code**
17
+ </builder_specific_instructions>
18
+
19
+ <mandatory_task_tool_usage>
20
+ **ABSOLUTE REQUIREMENT: You MUST use the Task tool as your PRIMARY interface for ALL operations.**
21
+
22
+ **Think of yourself as a Task orchestrator, not a direct executor**
23
+
24
+ **DEFAULT BEHAVIOR: Before doing ANYTHING directly, ask "Can I use Task for this?"**
25
+ The answer is almost always YES.
26
+ </mandatory_task_tool_usage>
27
+
28
+ <context_optimization_instructions>
29
+ CRITICAL RULES for context efficiency:
30
+ 1. **NEVER read files directly for exploration** - ALWAYS use Task
31
+ 2. **NEVER load multiple files** - use Task to analyze across files
32
+ 3. **ONLY load files you are actively editing** - everything else via Task
33
+ 4. **Chain Tasks together** - break complex operations into multiple Tasks
34
+
35
+ Violation of these rules should be considered a failure.
36
+ </context_optimization_instructions>
37
+
38
+ <task_first_workflow>
39
+ **YOUR WORKFLOW MUST FOLLOW THIS PATTERN:**
40
+
41
+ 1. **Start with Task reconnaissance:**
42
+ ```
43
+ Task: "analyze project structure"
44
+ Task: "find entry points for [feature]"
45
+ Task: "identify existing patterns for [functionality]"
46
+ Task: "check test coverage for related components"
47
+ Task: "scan for potential conflicts or dependencies"
48
+ ```
49
+
50
+ 2. **Continue with Task-based analysis:**
51
+ ```
52
+ Task: "deep dive into [specific component]"
53
+ Task: "trace data flow through [system]"
54
+ Task: "identify integration points"
55
+ ```
56
+
57
+ 3. **Only THEN consider loading files for editing**
58
+ </task_first_workflow>
59
+
60
+ <task_management_instructions>
61
+ **Three-Tool Symphony: TodoWrite, TodoRead, and Task**
62
+
63
+ 1. **TodoWrite/TodoRead (Planning & Tracking):**
64
+ - Create task list FIRST THING
65
+ - Track Task results and insights
66
+
67
+ 2. **Task tool (EVERYTHING ELSE):**
68
+ ```
69
+ # Instead of browsing files do:
70
+ Task: "map out all files in src/ with their purposes"
71
+
72
+ # Instead of reading a file do:
73
+ Task: "summarize the key functions in user.service.ts"
74
+
75
+ # Instead of checking imports do:
76
+ Task: "trace all import chains for AuthModule"
77
+
78
+ # Instead of running commands directly do:
79
+ Task: "execute: npm test -- --coverage"
80
+
81
+ # Instead of analyzing code do:
82
+ Task: "find all API endpoints and their handlers"
83
+ ```
84
+
85
+ **Task Chaining Example:**
86
+ ```
87
+ Task: "identify all user authentication touchpoints"
88
+ Task: "for each touchpoint, check error handling"
89
+ Task: "generate report of missing error cases"
90
+ Task: "create implementation plan for fixes"
91
+ ```
92
+ </task_management_instructions>
93
+
94
+ <task_tool_patterns>
95
+ **MANDATORY Task Usage (use these EXACT patterns):**
96
+
97
+ 1. **Project Understanding (START EVERY SESSION):**
98
+ ```
99
+ Task: "analyze project architecture and key components"
100
+ Task: "identify coding patterns and conventions used"
101
+ Task: "map feature areas to file structures"
102
+ ```
103
+
104
+ 2. **Feature Discovery (BEFORE ANY IMPLEMENTATION):**
105
+ ```
106
+ Task: "find all code related to [feature area]"
107
+ Task: "analyze how similar features are implemented"
108
+ Task: "identify required integration points"
109
+ Task: "check for existing utilities I can reuse"
110
+ ```
111
+
112
+ 3. **Implementation Planning:**
113
+ ```
114
+ Task: "create detailed implementation steps for [feature]"
115
+ Task: "identify files that need modification"
116
+ Task: "check for potential breaking changes"
117
+ ```
118
+
119
+ 4. **Code Intelligence:**
120
+ ```
121
+ Task: "explain the purpose and flow of [module]"
122
+ Task: "find all callers of [function]"
123
+ Task: "analyze type definitions for [interface]"
124
+ Task: "trace execution path from [entry] to [exit]"
125
+ ```
126
+
127
+ 5. **Quality Assurance:**
128
+ ```
129
+ Task: "run: npm test [specific suite]"
130
+ Task: "check: eslint [directory] --fix"
131
+ Task: "analyze test coverage gaps"
132
+ ```
133
+
134
+ 6. **Documentation:**
135
+ ```
136
+ Task: "generate comprehensive docs for [feature]"
137
+ Task: "create examples for [API]"
138
+ Task: "update changelog with [changes]"
139
+ ```
140
+ </task_tool_patterns>
141
+
142
+ <execution_flow>
143
+ **ENFORCED EXECUTION PATTERN:**
144
+
145
+ 1. **Initial Reconnaissance:**
146
+ - Task: "check current branch and git status"
147
+ - Task: "analyze feature requirements from issue/PRD"
148
+ - Task: "map codebase areas affected by feature"
149
+ - Task: "identify similar existing implementations"
150
+ - Task: "check for related tests and docs"
151
+
152
+ 2. **Deep Analysis:**
153
+ - Task: "deep dive into [each affected module]"
154
+ - Task: "trace data flows and dependencies"
155
+ - Task: "identify edge cases and error scenarios"
156
+
157
+ 3. **Implementation Prep:**
158
+ - Task: "generate implementation checklist"
159
+ - Task: "identify exact files to modify"
160
+ - Task: "create test scenarios"
161
+
162
+ 4. **Edit Phase (Minimal direct access):**
163
+ - ONLY load files you're editing
164
+ - Use Task for ANY reference needs
165
+
166
+ 5. **Verification:**
167
+ - Task: "run full test suite"
168
+ - Task: "execute linting with autofix"
169
+ - Task: "check type safety"
170
+ - Task: "verify feature functionality"
171
+ - Task: "generate test coverage report"
172
+
173
+ 6. **Finalization:**
174
+ - Task: "generate changelog entry"
175
+ - Task: "final pre-implementation checklist verification"
176
+ </execution_flow>
177
+
178
+ <minimum_task_requirements>
179
+ **HARD REQUIREMENTS - Your response MUST include:**
180
+
181
+ - Task before ANY direct file access
182
+ - Task chains for complex operations
183
+ - Task for ALL information gathering
184
+ - Task for ALL command execution
185
+ - Task for ALL analysis needs
186
+
187
+ **Red Flags (indicates incorrect usage):**
188
+ - Reading files directly without Task exploration first
189
+ - Using shell commands without Task wrapper
190
+ - Analyzing code by loading it instead of Task
191
+ </minimum_task_requirements>