cyrus-edge-worker 0.2.21 → 0.2.23

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 (106) hide show
  1. package/dist/ActivityPoster.d.ts +15 -0
  2. package/dist/ActivityPoster.d.ts.map +1 -0
  3. package/dist/ActivityPoster.js +194 -0
  4. package/dist/ActivityPoster.js.map +1 -0
  5. package/dist/AgentSessionManager.d.ts +63 -21
  6. package/dist/AgentSessionManager.d.ts.map +1 -1
  7. package/dist/AgentSessionManager.js +413 -404
  8. package/dist/AgentSessionManager.js.map +1 -1
  9. package/dist/AskUserQuestionHandler.d.ts +3 -2
  10. package/dist/AskUserQuestionHandler.d.ts.map +1 -1
  11. package/dist/AskUserQuestionHandler.js +15 -12
  12. package/dist/AskUserQuestionHandler.js.map +1 -1
  13. package/dist/AttachmentService.d.ts +69 -0
  14. package/dist/AttachmentService.d.ts.map +1 -0
  15. package/dist/AttachmentService.js +369 -0
  16. package/dist/AttachmentService.js.map +1 -0
  17. package/dist/ChatSessionHandler.d.ts +87 -0
  18. package/dist/ChatSessionHandler.d.ts.map +1 -0
  19. package/dist/ChatSessionHandler.js +227 -0
  20. package/dist/ChatSessionHandler.js.map +1 -0
  21. package/dist/ConfigManager.d.ts +91 -0
  22. package/dist/ConfigManager.d.ts.map +1 -0
  23. package/dist/ConfigManager.js +229 -0
  24. package/dist/ConfigManager.js.map +1 -0
  25. package/dist/EdgeWorker.d.ts +152 -120
  26. package/dist/EdgeWorker.d.ts.map +1 -1
  27. package/dist/EdgeWorker.js +1335 -2125
  28. package/dist/EdgeWorker.js.map +1 -1
  29. package/dist/GitService.d.ts +14 -10
  30. package/dist/GitService.d.ts.map +1 -1
  31. package/dist/GitService.js +91 -12
  32. package/dist/GitService.js.map +1 -1
  33. package/dist/GlobalSessionRegistry.d.ts +142 -0
  34. package/dist/GlobalSessionRegistry.d.ts.map +1 -0
  35. package/dist/GlobalSessionRegistry.js +254 -0
  36. package/dist/GlobalSessionRegistry.js.map +1 -0
  37. package/dist/PromptBuilder.d.ts +182 -0
  38. package/dist/PromptBuilder.d.ts.map +1 -0
  39. package/dist/PromptBuilder.js +963 -0
  40. package/dist/PromptBuilder.js.map +1 -0
  41. package/dist/RepositoryRouter.d.ts +3 -2
  42. package/dist/RepositoryRouter.d.ts.map +1 -1
  43. package/dist/RepositoryRouter.js +39 -37
  44. package/dist/RepositoryRouter.js.map +1 -1
  45. package/dist/RunnerSelectionService.d.ts +71 -0
  46. package/dist/RunnerSelectionService.d.ts.map +1 -0
  47. package/dist/RunnerSelectionService.js +392 -0
  48. package/dist/RunnerSelectionService.js.map +1 -0
  49. package/dist/SharedApplicationServer.d.ts +3 -1
  50. package/dist/SharedApplicationServer.d.ts.map +1 -1
  51. package/dist/SharedApplicationServer.js +21 -17
  52. package/dist/SharedApplicationServer.js.map +1 -1
  53. package/dist/SharedWebhookServer.d.ts +3 -1
  54. package/dist/SharedWebhookServer.d.ts.map +1 -1
  55. package/dist/SharedWebhookServer.js +19 -16
  56. package/dist/SharedWebhookServer.js.map +1 -1
  57. package/dist/SlackChatAdapter.d.ts +25 -0
  58. package/dist/SlackChatAdapter.d.ts.map +1 -0
  59. package/dist/SlackChatAdapter.js +163 -0
  60. package/dist/SlackChatAdapter.js.map +1 -0
  61. package/dist/WorktreeIncludeService.d.ts +2 -9
  62. package/dist/WorktreeIncludeService.d.ts.map +1 -1
  63. package/dist/WorktreeIncludeService.js +3 -9
  64. package/dist/WorktreeIncludeService.js.map +1 -1
  65. package/dist/index.d.ts +7 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +4 -0
  68. package/dist/index.js.map +1 -1
  69. package/dist/label-prompt-template.md +6 -2
  70. package/dist/procedures/ProcedureAnalyzer.d.ts +6 -4
  71. package/dist/procedures/ProcedureAnalyzer.d.ts.map +1 -1
  72. package/dist/procedures/ProcedureAnalyzer.js +32 -12
  73. package/dist/procedures/ProcedureAnalyzer.js.map +1 -1
  74. package/dist/procedures/registry.d.ts +19 -19
  75. package/dist/procedures/registry.d.ts.map +1 -1
  76. package/dist/procedures/registry.js +19 -19
  77. package/dist/procedures/registry.js.map +1 -1
  78. package/dist/procedures/types.d.ts +1 -0
  79. package/dist/procedures/types.d.ts.map +1 -1
  80. package/dist/prompt-assembly/types.d.ts +2 -0
  81. package/dist/prompt-assembly/types.d.ts.map +1 -1
  82. package/dist/prompts/graphite-orchestrator.md +4 -2
  83. package/dist/prompts/orchestrator.md +5 -3
  84. package/dist/prompts/standard-issue-assigned-user-prompt.md +7 -0
  85. package/dist/prompts/subroutines/gh-pr.md +12 -0
  86. package/dist/sinks/IActivitySink.d.ts +60 -0
  87. package/dist/sinks/IActivitySink.d.ts.map +1 -0
  88. package/dist/sinks/IActivitySink.js +2 -0
  89. package/dist/sinks/IActivitySink.js.map +1 -0
  90. package/dist/sinks/LinearActivitySink.d.ts +69 -0
  91. package/dist/sinks/LinearActivitySink.d.ts.map +1 -0
  92. package/dist/sinks/LinearActivitySink.js +111 -0
  93. package/dist/sinks/LinearActivitySink.js.map +1 -0
  94. package/dist/sinks/NoopActivitySink.d.ts +13 -0
  95. package/dist/sinks/NoopActivitySink.d.ts.map +1 -0
  96. package/dist/sinks/NoopActivitySink.js +17 -0
  97. package/dist/sinks/NoopActivitySink.js.map +1 -0
  98. package/dist/sinks/index.d.ts +9 -0
  99. package/dist/sinks/index.d.ts.map +1 -0
  100. package/dist/sinks/index.js +8 -0
  101. package/dist/sinks/index.js.map +1 -0
  102. package/label-prompt-template.md +6 -2
  103. package/package.json +17 -11
  104. package/prompts/graphite-orchestrator.md +4 -2
  105. package/prompts/orchestrator.md +5 -3
  106. package/prompts/standard-issue-assigned-user-prompt.md +7 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalSessionRegistry.js","sourceRoot":"","sources":["../src/GlobalSessionRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAA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;QAC/B,KAAK,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC1E,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,QAAgB;QACvB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,GAAG,GAAG,QAAQ,CAAC;QAClC,IAAI,YAAY,GAAG,CAAC,CAAC;QAErB,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,cAAc,EAAE,CAAC;YACnD,IAAI,OAAO,CAAC,SAAS,GAAG,UAAU,EAAE,CAAC;gBACpC,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;gBAC9B,YAAY,EAAE,CAAC;YAChB,CAAC;QACF,CAAC;QAED,OAAO,YAAY,CAAC;IACrB,CAAC;CACD"}
@@ -0,0 +1,182 @@
1
+ import type { Comment, EdgeWorkerConfig, GuidanceRule, IIssueTrackerService, ILogger, Issue, IssueMinimal, RepositoryConfig, WebhookAgentSession, WebhookComment } from "cyrus-core";
2
+ import type { GitService } from "./GitService.js";
3
+ import type { SubroutineDefinition } from "./procedures/index.js";
4
+ /**
5
+ * Dependencies required by the PromptBuilder
6
+ */
7
+ export interface PromptBuilderDeps {
8
+ logger: ILogger;
9
+ repositories: Map<string, RepositoryConfig>;
10
+ issueTrackers: Map<string, IIssueTrackerService>;
11
+ gitService: GitService;
12
+ config: EdgeWorkerConfig;
13
+ }
14
+ /**
15
+ * System prompt result from label-based determination
16
+ */
17
+ export interface SystemPromptResult {
18
+ prompt: string;
19
+ version?: string;
20
+ type?: "debugger" | "builder" | "scoper" | "orchestrator" | "graphite-orchestrator";
21
+ }
22
+ /**
23
+ * Result from building a prompt (prompt text + optional version)
24
+ */
25
+ export interface PromptResult {
26
+ prompt: string;
27
+ version?: string;
28
+ }
29
+ /**
30
+ * Responsible for building various prompt types used in the EdgeWorker.
31
+ *
32
+ * Extracted from EdgeWorker to improve separation of concerns.
33
+ * Handles label-based prompts, mention prompts, issue context prompts,
34
+ * issue update prompts, subroutine prompt loading, and related utilities.
35
+ */
36
+ export declare class PromptBuilder {
37
+ private readonly logger;
38
+ private readonly repositories;
39
+ private readonly issueTrackers;
40
+ private readonly gitService;
41
+ private readonly config;
42
+ constructor(deps: PromptBuilderDeps);
43
+ /**
44
+ * Determine system prompt based on issue labels and repository configuration
45
+ */
46
+ determineSystemPromptFromLabels(labels: string[], repository: RepositoryConfig): Promise<SystemPromptResult | undefined>;
47
+ /**
48
+ * Build simplified prompt for label-based workflows
49
+ * @param issue Full Linear issue
50
+ * @param repository Repository configuration
51
+ * @param attachmentManifest Optional attachment manifest
52
+ * @param guidance Optional agent guidance rules from Linear
53
+ * @returns Formatted prompt string
54
+ */
55
+ buildLabelBasedPrompt(issue: Issue, repository: RepositoryConfig, attachmentManifest?: string, guidance?: GuidanceRule[]): Promise<PromptResult>;
56
+ /**
57
+ * Generate routing context for orchestrator mode
58
+ *
59
+ * This provides the orchestrator with information about available repositories
60
+ * and how to route sub-issues to them. The context includes:
61
+ * - List of configured repositories in the workspace
62
+ * - Routing rules for each repository (labels, teams, projects)
63
+ * - Instructions on using description tags for explicit routing
64
+ *
65
+ * @param currentRepository The repository handling the current orchestrator issue
66
+ * @returns XML-formatted routing context string, or empty string if no routing info available
67
+ */
68
+ generateRoutingContext(currentRepository: RepositoryConfig): string;
69
+ /**
70
+ * Build prompt for mention-triggered sessions
71
+ * @param issue Full Linear issue object
72
+ * @param agentSession The agent session containing the mention
73
+ * @param attachmentManifest Optional attachment manifest to append
74
+ * @param guidance Optional agent guidance rules from Linear
75
+ * @returns The constructed prompt and optional version tag
76
+ */
77
+ buildMentionPrompt(issue: Issue, agentSession: WebhookAgentSession, attachmentManifest?: string, guidance?: GuidanceRule[]): Promise<PromptResult>;
78
+ /**
79
+ * Build a prompt for Claude using the improved XML-style template
80
+ * @param issue Full Linear issue
81
+ * @param repository Repository configuration
82
+ * @param newComment Optional new comment to focus on (for handleNewRootComment)
83
+ * @param attachmentManifest Optional attachment manifest
84
+ * @param guidance Optional agent guidance rules from Linear
85
+ * @returns Formatted prompt string
86
+ */
87
+ buildIssueContextPrompt(issue: Issue, repository: RepositoryConfig, newComment?: WebhookComment, attachmentManifest?: string, guidance?: GuidanceRule[]): Promise<PromptResult>;
88
+ /**
89
+ * Build XML-formatted prompt for issue content updates (title/description/attachments)
90
+ *
91
+ * The prompt clearly shows what fields changed by comparing old vs new values,
92
+ * and includes guidance for the agent to evaluate whether these changes affect
93
+ * its current implementation or action plan.
94
+ */
95
+ buildIssueUpdatePrompt(issueIdentifier: string, issueData: {
96
+ title: string;
97
+ description?: string | null;
98
+ attachments?: unknown;
99
+ }, updatedFrom: {
100
+ title?: string;
101
+ description?: string;
102
+ attachments?: unknown;
103
+ }): string;
104
+ /**
105
+ * Format Linear comments into a threaded structure that mirrors the Linear UI
106
+ * @param comments Array of Linear comments
107
+ * @returns Formatted string showing comment threads
108
+ */
109
+ formatCommentThreads(comments: Comment[]): Promise<string>;
110
+ /**
111
+ * Format agent guidance rules as markdown for injection into prompts
112
+ * @param guidance Array of guidance rules from Linear
113
+ * @returns Formatted markdown string with guidance, or empty string if no guidance
114
+ */
115
+ formatAgentGuidance(guidance?: GuidanceRule[]): string;
116
+ /**
117
+ * Extract version tag from template content
118
+ * @param templateContent The template content to parse
119
+ * @returns The version value if found, undefined otherwise
120
+ */
121
+ extractVersionTag(templateContent: string): string | undefined;
122
+ /**
123
+ * Resolve a GitHub user ID (numeric string from Linear) to a GitHub username.
124
+ * Uses the public GitHub REST API: GET https://api.github.com/user/{id}
125
+ * @param gitHubUserId The numeric GitHub user ID from Linear's gitHubUserId field
126
+ * @returns The GitHub username (login), or undefined if resolution fails
127
+ */
128
+ resolveGitHubUsername(gitHubUserId: string): Promise<string | undefined>;
129
+ /**
130
+ * Load a subroutine prompt file
131
+ * Extracted helper to make prompt assembly more readable
132
+ */
133
+ loadSubroutinePrompt(subroutine: SubroutineDefinition, workspaceSlug?: string): Promise<string | null>;
134
+ /**
135
+ * Load shared instructions that get appended to all system prompts
136
+ */
137
+ loadSharedInstructions(): Promise<string>;
138
+ /**
139
+ * Determine the base branch for an issue, considering parent issues and blocked-by relationships
140
+ *
141
+ * Priority order:
142
+ * 1. If issue has graphite label AND has a "blocked by" relationship, use the blocking issue's branch
143
+ * (This enables Graphite stacking where each sub-issue branches off the previous)
144
+ * 2. If issue has a parent, use the parent's branch
145
+ * 3. Fall back to repository's default base branch
146
+ */
147
+ determineBaseBranch(issue: Issue, repository: RepositoryConfig): Promise<string>;
148
+ /**
149
+ * Check if an issue has the graphite label
150
+ *
151
+ * @param issue The issue to check
152
+ * @param repository The repository configuration
153
+ * @returns True if the issue has the graphite label
154
+ */
155
+ hasGraphiteLabel(issue: Issue, repository: RepositoryConfig): Promise<boolean>;
156
+ /**
157
+ * Fetch issues that block this issue (i.e., issues this one is "blocked by")
158
+ * Uses the inverseRelations field with type "blocks"
159
+ *
160
+ * Linear relations work like this:
161
+ * - When Issue A "blocks" Issue B, a relation is created with:
162
+ * - issue = A (the blocker)
163
+ * - relatedIssue = B (the blocked one)
164
+ * - type = "blocks"
165
+ *
166
+ * So to find "who blocks Issue B", we need inverseRelations (where B is the relatedIssue)
167
+ * and look for type === "blocks", then get the `issue` field (the blocker).
168
+ *
169
+ * @param issue The issue to fetch blocking issues for
170
+ * @returns Array of issues that block this one, or empty array if none
171
+ */
172
+ fetchBlockingIssues(issue: Issue): Promise<Issue[]>;
173
+ /**
174
+ * Convert full Linear SDK issue to CoreIssue interface for Session creation
175
+ */
176
+ convertLinearIssueToCore(issue: Issue): IssueMinimal;
177
+ /**
178
+ * Fetch issue labels for a given issue
179
+ */
180
+ fetchIssueLabels(issue: Issue): Promise<string[]>;
181
+ }
182
+ //# sourceMappingURL=PromptBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PromptBuilder.d.ts","sourceRoot":"","sources":["../src/PromptBuilder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,OAAO,EACP,KAAK,EACL,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC5C,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IACjD,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EACF,UAAU,GACV,SAAS,GACT,QAAQ,GACR,cAAc,GACd,uBAAuB,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,qBAAa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgC;IAC7D,OAAO,CAAC,QAAQ,CAAC,aAAa,C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