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,87 @@
1
+ # User Testing Summary - Final Response for Linear
2
+
3
+ Generate a comprehensive summary of the user testing session for posting to Linear.
4
+
5
+ ## Your Task
6
+
7
+ Create a clear, structured summary that covers:
8
+
9
+ ### 1. Testing Overview
10
+ - What was tested (features, workflows, integrations)
11
+ - Testing approach and methodology used
12
+ - Scope of the testing session
13
+
14
+ ### 2. Test Results
15
+ - Total number of scenarios/tests executed
16
+ - Pass/fail breakdown
17
+ - Key observations and findings
18
+
19
+ ### 3. Issues Discovered (if any)
20
+ - Description of each issue found
21
+ - Severity assessment (critical/high/medium/low)
22
+ - Reproduction steps for failures
23
+ - Relevant error messages or logs
24
+
25
+ ### 4. Recommendations
26
+ - Suggested fixes or follow-up actions
27
+ - Areas that may need additional testing
28
+ - Any improvements identified during testing
29
+
30
+ ## Format Requirements
31
+
32
+ - **Be concise but comprehensive** - aim for a well-structured summary
33
+ - Use clear, professional language suitable for Linear
34
+ - Use markdown formatting for readability
35
+ - Focus on what matters to stakeholders
36
+ - **To mention someone**: Use `https://linear.app/linear/profiles/username` syntax where `username` is the Linear username (e.g., `https://linear.app/linear/profiles/alice` to mention @alice)
37
+
38
+ ## Constraints
39
+
40
+ - **You have exactly 1 turn** - generate the summary in a single response
41
+ - This is the final output that will be posted to Linear
42
+ - Make it informative and actionable
43
+
44
+ ## Example Format
45
+
46
+ ```
47
+ ## Testing Summary
48
+
49
+ [Brief overview of what was tested and the testing approach]
50
+
51
+ ### Results
52
+
53
+ | Status | Count |
54
+ |--------|-------|
55
+ | ✅ Passed | X |
56
+ | ❌ Failed | Y |
57
+ | ⚠️ Observations | Z |
58
+
59
+ +++Test Details
60
+ - [Test 1]: [Result and notes]
61
+ - [Test 2]: [Result and notes]
62
+ +++
63
+
64
+ +++Issues Found
65
+ 1. **[Issue title]** - [Severity]
66
+ - Description: [What went wrong]
67
+ - Steps to reproduce: [How to trigger]
68
+ - Notes: [Additional context]
69
+ +++
70
+
71
+ ## Recommendations
72
+
73
+ [Next steps and suggested actions]
74
+
75
+ ## Status
76
+
77
+ [Overall testing status and conclusions]
78
+ ```
79
+
80
+ ## Collapsible Sections
81
+
82
+ **IMPORTANT**: When creating your summary, make the following sections collapsible (collapsed by default):
83
+
84
+ - **"Test Details"** section - Wrap with `+++Test Details\n...\n+++`
85
+ - **"Issues Found"** section - Wrap with `+++Issues Found\n...\n+++`
86
+
87
+ This keeps the summary concise while preserving detailed information for those who want to expand and read it.
@@ -0,0 +1,48 @@
1
+ # User Testing Phase
2
+
3
+ Perform testing as requested by the user. This subroutine allows interactive testing based on user instructions.
4
+
5
+ ## Your Task
6
+
7
+ Execute the testing activities requested by the user:
8
+
9
+ ### 1. Understand the Testing Request
10
+ - Review the user's testing requirements from the issue description
11
+ - Identify what needs to be tested (features, workflows, integrations, etc.)
12
+ - Clarify the scope and success criteria for the testing
13
+
14
+ ### 2. Execute Tests
15
+ - Run the tests or testing scenarios as requested
16
+ - Follow any specific testing instructions provided by the user
17
+ - Document test results and observations as you go
18
+ - Note any unexpected behavior or issues discovered
19
+
20
+ ### 3. Interactive Testing
21
+ - Be responsive to user feedback during the testing process
22
+ - The user may provide additional instructions or adjustments mid-session
23
+ - Adapt your testing approach based on user guidance
24
+ - Report progress and findings to enable real-time feedback
25
+
26
+ ### 4. Document Findings
27
+ - Track all test results (pass/fail/observations)
28
+ - Note any bugs, issues, or areas of concern discovered
29
+ - Document reproduction steps for any failures
30
+ - Capture relevant logs, error messages, or screenshots if applicable
31
+
32
+ ## Important Notes
33
+
34
+ - **Do NOT commit or push changes** - that happens in a separate subroutine if needed
35
+ - **Do NOT create or update PRs** - focus on testing only
36
+ - **Be thorough and methodical** - test systematically based on user requirements
37
+ - **Communicate clearly** - report findings as you discover them
38
+ - **Follow user instructions** - this is a user-driven testing session
39
+
40
+ ## Expected Output
41
+
42
+ Provide a completion message summarizing the testing session:
43
+
44
+ ```
45
+ Testing complete - [X] scenarios tested, [Y] passed, [Z] issues found.
46
+ ```
47
+
48
+ Example: "Testing complete - 5 scenarios tested, 4 passed, 1 issue found (login redirect failure)."
@@ -0,0 +1,56 @@
1
+ # Validation Fixer - Fix Verification Failures
2
+
3
+ The previous verification step failed. Your task is to fix the specific issues identified.
4
+
5
+ ## Failure Context
6
+
7
+ <validation_failure>
8
+ {{FAILURE_REASON}}
9
+ </validation_failure>
10
+
11
+ <iteration_info>
12
+ Attempt {{ITERATION}} of {{MAX_ITERATIONS}}
13
+ </iteration_info>
14
+
15
+ {{#if PREVIOUS_ATTEMPTS}}
16
+ <previous_attempts>
17
+ {{PREVIOUS_ATTEMPTS}}
18
+ </previous_attempts>
19
+ {{/if}}
20
+
21
+ ## Your Task
22
+
23
+ Fix ONLY the specific issues mentioned in the failure reason above. Do not make unrelated changes.
24
+
25
+ ### Guidelines
26
+
27
+ 1. **Focus on the specific failures** - Address only what failed, nothing else
28
+ 2. **Read error messages carefully** - The failure reason contains specific error details
29
+ 3. **Make minimal changes** - Fix the issue with the smallest possible change
30
+ 4. **Avoid introducing new issues** - Be careful not to break other things while fixing
31
+ 5. **If you've seen this error before** - Check the previous attempts to understand what didn't work
32
+
33
+ ### Common Fix Patterns
34
+
35
+ - **Acceptance criteria failures**: Re-read the specific criterion that failed, understand what's missing, and implement the missing functionality
36
+ - **Test failures**: Read the failing test, understand the expected vs actual behavior, fix the code or test
37
+ - **TypeScript errors**: Check the type definitions and ensure proper typing
38
+ - **Linting errors**: Run the linter with auto-fix first, then manually fix what remains
39
+ - **Build errors**: Check imports, exports, and module resolution
40
+
41
+ ## Important Notes
42
+
43
+ - **Do NOT commit or push changes** - just fix the issues
44
+ - **Do NOT create or update PRs** - that happens in a later subroutine
45
+ - **Do NOT post Linear comments** - your output is for internal workflow only
46
+ - Be thorough but efficient - we have limited retry attempts
47
+
48
+ ## Expected Output
49
+
50
+ After fixing the issues, provide a brief completion message (1 sentence max):
51
+
52
+ ```
53
+ Fixed: [brief description of what was fixed]
54
+ ```
55
+
56
+ Example: "Fixed: Corrected type error in UserService.ts by adding missing optional chaining"
@@ -0,0 +1,46 @@
1
+ # Summary Phase - Final Response Generation
2
+
3
+ You have completed both the primary work and closure review. Now generate a comprehensive summary of everything accomplished.
4
+
5
+ ## Your Task
6
+
7
+ Create a clear, concise summary for Linear that covers:
8
+
9
+ ### 1. Work Completed
10
+ - What features were implemented or bugs were fixed
11
+ - Key technical decisions made
12
+ - Any changes to the original scope or approach
13
+
14
+ ### 2. Implementation Details
15
+ - High-level overview of the implementation approach
16
+ - Key files modified or created
17
+ - Any new dependencies, tools, or patterns introduced
18
+
19
+ ### 3. Testing & Quality Assurance
20
+ - What testing was performed
21
+ - Test results and coverage
22
+ - Any known limitations or edge cases
23
+
24
+ ### 4. Pull Request Information
25
+ - Link to the GitHub PR
26
+ - Status of the PR (ready for review, needs attention, etc.)
27
+ - Any special review notes or areas that need extra attention
28
+
29
+ ### 5. Next Steps (if applicable)
30
+ - Any follow-up tasks or future improvements identified
31
+ - Configuration or deployment steps required
32
+ - Notes for reviewers
33
+
34
+ ## Format Requirements
35
+
36
+ - Use clear, professional language suitable for Linear
37
+ - Be concise but comprehensive
38
+ - Use markdown formatting for readability
39
+ - Focus on what matters to stakeholders and reviewers
40
+ - **To mention someone**: Use `https://linear.app/linear/profiles/username` syntax where `username` is the Linear username (e.g., `https://linear.app/linear/profiles/alice` to mention @alice)
41
+
42
+ ## Constraints
43
+
44
+ - **You have exactly 1 turn** - generate the summary in a single response
45
+ - This is the final output that will be posted to Linear
46
+ - Make it informative and actionable
@@ -0,0 +1,77 @@
1
+ # Verifications - Testing and Quality Checks
2
+
3
+ You have completed the primary work on this issue. Now perform thorough verification to ensure everything works correctly and meets quality standards.
4
+
5
+ ## Your Tasks
6
+
7
+ ### 1. Acceptance Criteria Validation (CRITICAL - Do This First)
8
+
9
+ Use the issue tracker `get_issue` tool to fetch the current issue details. The issue identifier is available in your conversation context (e.g., "CYPACK-123").
10
+
11
+ **Steps:**
12
+ 1. Fetch the issue using the issue tracker `get_issue` tool with the issue identifier
13
+ 2. Extract ALL acceptance criteria from the issue description (look for bullet points, numbered lists, checkboxes, or sections labeled "Acceptance Criteria", "Requirements", "Definition of Done", etc.)
14
+ 3. For EACH acceptance criterion, verify that the implementation satisfies it
15
+ 4. Document which criteria pass and which fail
16
+
17
+ **Important:** If no explicit acceptance criteria are found, extract implied requirements from the issue title and description. Every issue has requirements that must be verified.
18
+
19
+ ### 2. Code Quality Review
20
+ - Review all code changes for quality, consistency, and best practices
21
+ - Ensure proper error handling and edge cases are covered
22
+ - Verify code follows project conventions and patterns
23
+ - Check for any code smells or areas that need refactoring
24
+
25
+ ### 3. Testing & Verification
26
+ - Run all relevant tests and ensure they pass
27
+ - **Do NOT fix failing tests yourself** - just report the failures
28
+ - Verify the implementation meets all requirements from the issue description
29
+ - Check that existing functionality wasn't broken by the changes
30
+
31
+ ### 4. Linting & Type Checking
32
+ - Run linting tools and report any issues
33
+ - Run TypeScript type checking (if applicable) and report any errors
34
+ - **Do NOT fix linting/type errors yourself** - just report them
35
+
36
+ ### 5. Documentation Review
37
+ - Check if relevant documentation needs updating
38
+ - Note any debug code, console.logs, or commented-out sections that should be removed
39
+
40
+ ## Important Notes
41
+
42
+ - **Do NOT commit or push changes** - that happens in a later subroutine
43
+ - **Do NOT create or update PRs** - that also happens in a later subroutine
44
+ - **Do NOT touch the changelog** - a separate subroutine handles changelog updates
45
+ - **Do NOT fix issues yourself** - your job is to verify and report
46
+ - **Do NOT post Linear comments** - your output is for internal workflow only
47
+ - Be thorough in running and reporting verification results
48
+ - **Acceptance criteria validation is MANDATORY** - failing to validate against acceptance criteria counts as a failed verification
49
+
50
+ ## Expected FINAL Message Output Format
51
+
52
+ You MUST respond in your FINAL message with a JSON object in exactly this format:
53
+
54
+ ```json
55
+ {
56
+ "pass": true,
57
+ "reason": "All 3 acceptance criteria met. 47 tests passing, linting clean, types valid"
58
+ }
59
+ ```
60
+
61
+ Or if there are failures:
62
+
63
+ ```json
64
+ {
65
+ "pass": false,
66
+ "reason": "Acceptance criteria failed: 'Support pagination' not implemented. TypeScript error in src/services/UserService.ts:42 - Property 'email' does not exist on type 'User'. 3 tests failing in auth.test.ts"
67
+ }
68
+ ```
69
+
70
+ ### Output Rules
71
+
72
+ 1. **pass**: Set to `true` if ALL verifications pass (including ALL acceptance criteria), `false` if ANY fail
73
+ 2. **reason**:
74
+ - If passing: Brief summary that mentions acceptance criteria status, e.g., "All X acceptance criteria met. Y tests passing, linting clean, types valid"
75
+ - If failing: Specific error details that would help someone fix the issues. **Always list any failing acceptance criteria first**, then other failures.
76
+
77
+ **CRITICAL**: Your entire final response message must be valid JSON matching the schema above. Do not include any text before or after the JSON.
@@ -0,0 +1,15 @@
1
+ <task_management_instructions>
2
+ CRITICAL: You MUST use the TodoWrite and TodoRead tools extensively:
3
+ - IMMEDIATELY create a comprehensive task list at the beginning of your work
4
+ - Break down complex tasks into smaller, actionable items
5
+ - Mark tasks as 'in_progress' when you start them
6
+ - Mark tasks as 'completed' immediately after finishing them
7
+ - Only have ONE task 'in_progress' at a time
8
+ - Add new tasks as you discover them during your work
9
+ - Your first response should focus on creating a thorough task breakdown
10
+
11
+ Remember: Your first message is internal planning. Use this time to:
12
+ 1. Thoroughly analyze the issue and requirements
13
+ 2. Create detailed todos using TodoWrite
14
+ 3. Plan your approach systematically
15
+ </task_management_instructions>
@@ -0,0 +1,60 @@
1
+ import type { AgentActivityContent } from "sylas-core";
2
+ /**
3
+ * String literal type for activity signals.
4
+ * Maps to platform-specific signal enums (e.g., Linear's AgentActivitySignal).
5
+ */
6
+ export type ActivitySignal = "auth" | "select" | "stop" | "continue";
7
+ /**
8
+ * Options for posting an activity.
9
+ */
10
+ export interface ActivityPostOptions {
11
+ /** Whether the activity is ephemeral (disappears when replaced by next activity) */
12
+ ephemeral?: boolean;
13
+ /** Signal modifier for how the activity should be interpreted */
14
+ signal?: ActivitySignal;
15
+ /** Additional metadata for the signal */
16
+ signalMetadata?: Record<string, unknown>;
17
+ }
18
+ /**
19
+ * Result of posting an activity.
20
+ */
21
+ export interface ActivityPostResult {
22
+ /** The ID of the created activity, if available */
23
+ activityId?: string;
24
+ }
25
+ /**
26
+ * Interface for activity sinks that receive and process agent session activities.
27
+ *
28
+ * IActivitySink decouples activity posting from IIssueTrackerService, enabling
29
+ * multiple activity sinks (Linear workspaces, GitHub, etc.) to receive session
30
+ * activities based on session context.
31
+ *
32
+ * Implementations should:
33
+ * - Provide a unique identifier (workspace ID, org ID, etc.)
34
+ * - Support posting activities to agent sessions
35
+ * - Support creating new agent sessions on issues
36
+ */
37
+ export interface IActivitySink {
38
+ /**
39
+ * Unique identifier for this sink (e.g., Linear workspace ID, GitHub org ID).
40
+ * Used by GlobalSessionRegistry to route activities to the correct sink.
41
+ */
42
+ readonly id: string;
43
+ /**
44
+ * Post an activity to an existing agent session.
45
+ *
46
+ * @param sessionId - The agent session ID to post to
47
+ * @param activity - The activity content (thought, action, response, error, etc.)
48
+ * @param options - Optional settings for ephemeral, signal, signalMetadata
49
+ * @returns Promise that resolves with the result of the activity post
50
+ */
51
+ postActivity(sessionId: string, activity: AgentActivityContent, options?: ActivityPostOptions): Promise<ActivityPostResult>;
52
+ /**
53
+ * Create a new agent session on an issue.
54
+ *
55
+ * @param issueId - The issue ID to attach the session to
56
+ * @returns Promise that resolves with the created session ID
57
+ */
58
+ createAgentSession(issueId: string): Promise<string>;
59
+ }
60
+ //# sourceMappingURL=IActivitySink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IActivitySink.d.ts","sourceRoot":"","sources":["../../src/sinks/IActivitySink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iEAAiE;IACjE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,yCAAyC;IACzC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,YAAY,CACX,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE/B;;;;;OAKG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACrD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IActivitySink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IActivitySink.js","sourceRoot":"","sources":["../../src/sinks/IActivitySink.ts"],"names":[],"mappings":""}
@@ -0,0 +1,69 @@
1
+ import { type AgentActivityContent, type IIssueTrackerService } from "sylas-core";
2
+ import type { ActivityPostOptions, ActivityPostResult, IActivitySink } from "./IActivitySink.js";
3
+ /**
4
+ * Linear-specific implementation of IActivitySink.
5
+ *
6
+ * LinearActivitySink wraps an IIssueTrackerService instance to provide activity
7
+ * sink functionality for Linear workspaces. It delegates activity posting and
8
+ * session creation to the underlying issue tracker service.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const issueTracker = new LinearIssueTrackerService(linearClient, {
13
+ * workspaceId: 'workspace-123',
14
+ * // ... other OAuth config
15
+ * });
16
+ *
17
+ * const sink = new LinearActivitySink(issueTracker, 'workspace-123');
18
+ *
19
+ * // Create a session
20
+ * const sessionId = await sink.createAgentSession('issue-id-456');
21
+ *
22
+ * // Post activities
23
+ * const result = await sink.postActivity(sessionId, {
24
+ * type: 'thought',
25
+ * body: 'Analyzing the issue...'
26
+ * });
27
+ * ```
28
+ */
29
+ export declare class LinearActivitySink implements IActivitySink {
30
+ /**
31
+ * Unique identifier for this sink (Linear workspace ID).
32
+ */
33
+ readonly id: string;
34
+ private readonly issueTracker;
35
+ /**
36
+ * Create a new LinearActivitySink.
37
+ *
38
+ * @param issueTracker - The IIssueTrackerService instance to delegate to
39
+ * @param workspaceId - The Linear workspace ID (used as sink ID)
40
+ */
41
+ constructor(issueTracker: IIssueTrackerService, workspaceId: string);
42
+ /**
43
+ * Map a platform-agnostic ActivitySignal string to Linear's AgentActivitySignal enum.
44
+ */
45
+ private mapSignal;
46
+ /**
47
+ * Post an activity to an existing agent session.
48
+ *
49
+ * Wraps IIssueTrackerService.createAgentActivity() to provide a simplified
50
+ * interface for activity posting.
51
+ *
52
+ * @param sessionId - The agent session ID to post to
53
+ * @param activity - The activity content (thought, action, response, error, etc.)
54
+ * @param options - Optional settings for ephemeral, signal, signalMetadata
55
+ * @returns Promise that resolves with the activity post result
56
+ */
57
+ postActivity(sessionId: string, activity: AgentActivityContent, options?: ActivityPostOptions): Promise<ActivityPostResult>;
58
+ /**
59
+ * Create a new agent session on an issue.
60
+ *
61
+ * Wraps IIssueTrackerService.createAgentSessionOnIssue() to provide a simplified
62
+ * interface for session creation.
63
+ *
64
+ * @param issueId - The issue ID to attach the session to
65
+ * @returns Promise that resolves with the created session ID
66
+ */
67
+ createAgentSession(issueId: string): Promise<string>;
68
+ }
69
+ //# sourceMappingURL=LinearActivitySink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinearActivitySink.d.ts","sourceRoot":"","sources":["../../src/sinks/LinearActivitySink.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EACzB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACX,mBAAmB,EACnB,kBAAkB,EAElB,aAAa,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,kBAAmB,YAAW,aAAa;IACvD;;OAEG;IACH,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuB;IAEpD;;;;;OAKG;gBACS,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM;IAKnE;;OAEG;IACH,OAAO,CAAC,SAAS;IAajB;;;;;;;;;;OAUG;IACG,YAAY,CACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC;IAmB9B;;;;;;;;OAQG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAqB1D"}
@@ -0,0 +1,111 @@
1
+ import { AgentActivitySignal, } from "sylas-core";
2
+ /**
3
+ * Linear-specific implementation of IActivitySink.
4
+ *
5
+ * LinearActivitySink wraps an IIssueTrackerService instance to provide activity
6
+ * sink functionality for Linear workspaces. It delegates activity posting and
7
+ * session creation to the underlying issue tracker service.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const issueTracker = new LinearIssueTrackerService(linearClient, {
12
+ * workspaceId: 'workspace-123',
13
+ * // ... other OAuth config
14
+ * });
15
+ *
16
+ * const sink = new LinearActivitySink(issueTracker, 'workspace-123');
17
+ *
18
+ * // Create a session
19
+ * const sessionId = await sink.createAgentSession('issue-id-456');
20
+ *
21
+ * // Post activities
22
+ * const result = await sink.postActivity(sessionId, {
23
+ * type: 'thought',
24
+ * body: 'Analyzing the issue...'
25
+ * });
26
+ * ```
27
+ */
28
+ export class LinearActivitySink {
29
+ /**
30
+ * Unique identifier for this sink (Linear workspace ID).
31
+ */
32
+ id;
33
+ issueTracker;
34
+ /**
35
+ * Create a new LinearActivitySink.
36
+ *
37
+ * @param issueTracker - The IIssueTrackerService instance to delegate to
38
+ * @param workspaceId - The Linear workspace ID (used as sink ID)
39
+ */
40
+ constructor(issueTracker, workspaceId) {
41
+ this.issueTracker = issueTracker;
42
+ this.id = workspaceId;
43
+ }
44
+ /**
45
+ * Map a platform-agnostic ActivitySignal string to Linear's AgentActivitySignal enum.
46
+ */
47
+ mapSignal(signal) {
48
+ switch (signal) {
49
+ case "auth":
50
+ return AgentActivitySignal.Auth;
51
+ case "select":
52
+ return AgentActivitySignal.Select;
53
+ case "stop":
54
+ return AgentActivitySignal.Stop;
55
+ case "continue":
56
+ return AgentActivitySignal.Continue;
57
+ }
58
+ }
59
+ /**
60
+ * Post an activity to an existing agent session.
61
+ *
62
+ * Wraps IIssueTrackerService.createAgentActivity() to provide a simplified
63
+ * interface for activity posting.
64
+ *
65
+ * @param sessionId - The agent session ID to post to
66
+ * @param activity - The activity content (thought, action, response, error, etc.)
67
+ * @param options - Optional settings for ephemeral, signal, signalMetadata
68
+ * @returns Promise that resolves with the activity post result
69
+ */
70
+ async postActivity(sessionId, activity, options) {
71
+ const result = await this.issueTracker.createAgentActivity({
72
+ agentSessionId: sessionId,
73
+ content: activity,
74
+ ...(options?.ephemeral !== undefined && { ephemeral: options.ephemeral }),
75
+ ...(options?.signal && { signal: this.mapSignal(options.signal) }),
76
+ ...(options?.signalMetadata && {
77
+ signalMetadata: options.signalMetadata,
78
+ }),
79
+ });
80
+ if (result.success && result.agentActivity) {
81
+ const agentActivity = await result.agentActivity;
82
+ return { activityId: agentActivity.id };
83
+ }
84
+ return {};
85
+ }
86
+ /**
87
+ * Create a new agent session on an issue.
88
+ *
89
+ * Wraps IIssueTrackerService.createAgentSessionOnIssue() to provide a simplified
90
+ * interface for session creation.
91
+ *
92
+ * @param issueId - The issue ID to attach the session to
93
+ * @returns Promise that resolves with the created session ID
94
+ */
95
+ async createAgentSession(issueId) {
96
+ const result = await this.issueTracker.createAgentSessionOnIssue({
97
+ issueId,
98
+ });
99
+ if (!result.success) {
100
+ throw new Error(`Failed to create agent session for issue ${issueId}: request was not successful`);
101
+ }
102
+ // Extract session ID from the result
103
+ // Result has `agentSession` property that may be a Promise
104
+ const session = await result.agentSession;
105
+ if (!session) {
106
+ throw new Error(`Failed to create agent session for issue ${issueId}: session is undefined`);
107
+ }
108
+ return session.id;
109
+ }
110
+ }
111
+ //# sourceMappingURL=LinearActivitySink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinearActivitySink.js","sourceRoot":"","sources":["../../src/sinks/LinearActivitySink.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,mBAAmB,GAEnB,MAAM,YAAY,CAAC;AAQpB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;OAEG;IACa,EAAE,CAAS;IAEV,YAAY,CAAuB;IAEpD;;;;;OAKG;IACH,YAAY,YAAkC,EAAE,WAAmB;QAClE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,WAAW,CAAC;IACvB,CAAC;IAED;;OAEG;IACK,SAAS,CAAC,MAAsB;QACvC,QAAQ,MAAM,EAAE,CAAC;YAChB,KAAK,MAAM;gBACV,OAAO,mBAAmB,CAAC,IAAI,CAAC;YACjC,KAAK,QAAQ;gBACZ,OAAO,mBAAmB,CAAC,MAAM,CAAC;YACnC,KAAK,MAAM;gBACV,OAAO,mBAAmB,CAAC,IAAI,CAAC;YACjC,KAAK,UAAU;gBACd,OAAO,mBAAmB,CAAC,QAAQ,CAAC;QACtC,CAAC;IACF,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,YAAY,CACjB,SAAiB,EACjB,QAA8B,EAC9B,OAA6B;QAE7B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC;YAC1D,cAAc,EAAE,SAAS;YACzB,OAAO,EAAE,QAAQ;YACjB,GAAG,CAAC,OAAO,EAAE,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;YACzE,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClE,GAAG,CAAC,OAAO,EAAE,cAAc,IAAI;gBAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;aACtC,CAAC;SACF,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YAC5C,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;YACjD,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC;QACzC,CAAC;QAED,OAAO,EAAE,CAAC;IACX,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,kBAAkB,CAAC,OAAe;QACvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC;YAChE,OAAO;SACP,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CACd,4CAA4C,OAAO,8BAA8B,CACjF,CAAC;QACH,CAAC;QAED,qCAAqC;QACrC,2DAA2D;QAC3D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CACd,4CAA4C,OAAO,wBAAwB,CAC3E,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,EAAE,CAAC;IACnB,CAAC;CACD"}
@@ -0,0 +1,13 @@
1
+ import type { AgentActivityContent } from "sylas-core";
2
+ import type { ActivityPostOptions, ActivityPostResult, IActivitySink } from "./IActivitySink.js";
3
+ /**
4
+ * A no-op activity sink that silently discards all activities.
5
+ * Used for platforms like Slack where activities are not posted to an external tracker.
6
+ */
7
+ export declare class NoopActivitySink implements IActivitySink {
8
+ readonly id: string;
9
+ constructor(id?: string);
10
+ postActivity(_sessionId: string, _activity: AgentActivityContent, _options?: ActivityPostOptions): Promise<ActivityPostResult>;
11
+ createAgentSession(_issueId: string): Promise<string>;
12
+ }
13
+ //# sourceMappingURL=NoopActivitySink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopActivitySink.d.ts","sourceRoot":"","sources":["../../src/sinks/NoopActivitySink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EACX,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,aAAa;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;gBAER,EAAE,SAAS;IAIjB,YAAY,CACjB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,oBAAoB,EAC/B,QAAQ,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,kBAAkB,CAAC;IAIxB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAG3D"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A no-op activity sink that silently discards all activities.
3
+ * Used for platforms like Slack where activities are not posted to an external tracker.
4
+ */
5
+ export class NoopActivitySink {
6
+ id;
7
+ constructor(id = "noop") {
8
+ this.id = id;
9
+ }
10
+ async postActivity(_sessionId, _activity, _options) {
11
+ return {};
12
+ }
13
+ async createAgentSession(_issueId) {
14
+ return "";
15
+ }
16
+ }
17
+ //# sourceMappingURL=NoopActivitySink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NoopActivitySink.js","sourceRoot":"","sources":["../../src/sinks/NoopActivitySink.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACnB,EAAE,CAAS;IAEpB,YAAY,EAAE,GAAG,MAAM;QACtB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACd,CAAC;IAED,KAAK,CAAC,YAAY,CACjB,UAAkB,EAClB,SAA+B,EAC/B,QAA8B;QAE9B,OAAO,EAAE,CAAC;IACX,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,QAAgB;QACxC,OAAO,EAAE,CAAC;IACX,CAAC;CACD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Activity sinks for posting agent session activities to various platforms.
3
+ *
4
+ * @module sinks
5
+ */
6
+ export type { ActivityPostOptions, ActivityPostResult, ActivitySignal, IActivitySink, } from "./IActivitySink.js";
7
+ export { LinearActivitySink } from "./LinearActivitySink.js";
8
+ export { NoopActivitySink } from "./NoopActivitySink.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sinks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Activity sinks for posting agent session activities to various platforms.
3
+ *
4
+ * @module sinks
5
+ */
6
+ export { LinearActivitySink } from "./LinearActivitySink.js";
7
+ export { NoopActivitySink } from "./NoopActivitySink.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sinks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}