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,69 @@
1
+ import type { UserAccessControlConfig } from "sylas-core";
2
+ /**
3
+ * Result of an access check operation.
4
+ */
5
+ export type AccessCheckResult = {
6
+ allowed: true;
7
+ } | {
8
+ allowed: false;
9
+ reason: string;
10
+ };
11
+ /**
12
+ * Default message shown when a user is blocked and blockBehavior is 'comment'.
13
+ * Supports template variables:
14
+ * - {{userName}} - The user's display name
15
+ * - {{userId}} - The user's Linear ID
16
+ */
17
+ export declare const DEFAULT_BLOCK_MESSAGE = "{{userName}}, you are not authorized to delegate issues to this agent.";
18
+ /**
19
+ * User access control manager for Linear user whitelisting/blacklisting.
20
+ *
21
+ * Access Check Logic:
22
+ * 1. Build effective blocklist: global blockedUsers + repo blockedUsers (union)
23
+ * 2. Check if user matches any entry in effective blocklist -> BLOCKED
24
+ * 3. Determine effective allowlist:
25
+ * - If repo has allowedUsers -> use repo allowlist only
26
+ * - Else if global has allowedUsers -> use global allowlist
27
+ * - Else -> no allowlist (everyone allowed)
28
+ * 4. If effective allowlist exists and user NOT in it -> BLOCKED
29
+ * 5. Otherwise -> ALLOWED
30
+ */
31
+ export declare class UserAccessControl {
32
+ private globalConfig;
33
+ private repoConfigs;
34
+ /**
35
+ * Creates a new UserAccessControl instance.
36
+ * @param globalConfig - Global access control configuration
37
+ * @param repoConfigs - Map of repository ID to repository-specific access control config
38
+ */
39
+ constructor(globalConfig: UserAccessControlConfig | undefined, repoConfigs: Map<string, UserAccessControlConfig | undefined>);
40
+ /**
41
+ * Check if a user is allowed to delegate issues to a specific repository.
42
+ * @param userId - The user's Linear ID
43
+ * @param userEmail - The user's email address
44
+ * @param repositoryId - The target repository ID
45
+ * @returns AccessCheckResult indicating if access is allowed
46
+ */
47
+ checkAccess(userId: string | undefined, userEmail: string | undefined, repositoryId: string): AccessCheckResult;
48
+ /**
49
+ * Get the effective block behavior for a repository.
50
+ * Repo config overrides global config.
51
+ * @param repositoryId - The repository ID
52
+ * @returns 'silent' or 'comment'
53
+ */
54
+ getBlockBehavior(repositoryId: string): "silent" | "comment";
55
+ /**
56
+ * Get the effective block message for a repository.
57
+ * Repo config overrides global config.
58
+ * @param repositoryId - The repository ID
59
+ * @returns The block message to display
60
+ */
61
+ getBlockMessage(repositoryId: string): string;
62
+ /**
63
+ * Check if any access control is configured (either globally or for any repository).
64
+ * Useful for short-circuiting when no access control is needed.
65
+ * @returns true if any access control configuration exists
66
+ */
67
+ hasAnyConfiguration(): boolean;
68
+ }
69
+ //# sourceMappingURL=UserAccessControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserAccessControl.d.ts","sourceRoot":"","sources":["../src/UserAccessControl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAkB,MAAM,YAAY,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAC1B;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GACjB;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,2EACuC,CAAC;AA6C1E;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,WAAW,CAAmD;IAEtE;;;;OAIG;gBAEF,YAAY,EAAE,uBAAuB,GAAG,SAAS,EACjD,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAM9D;;;;;;OAMG;IACH,WAAW,CACV,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,YAAY,EAAE,MAAM,GAClB,iBAAiB;IAmDpB;;;;;OAKG;IACH,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAgB5D;;;;;OAKG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAgB7C;;;;OAIG;IACH,mBAAmB,IAAI,OAAO;CAqB9B"}
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Default message shown when a user is blocked and blockBehavior is 'comment'.
3
+ * Supports template variables:
4
+ * - {{userName}} - The user's display name
5
+ * - {{userId}} - The user's Linear ID
6
+ */
7
+ export const DEFAULT_BLOCK_MESSAGE = "{{userName}}, you are not authorized to delegate issues to this agent.";
8
+ /**
9
+ * Checks if a user matches a given identifier.
10
+ * @param userId - The user's Linear ID
11
+ * @param userEmail - The user's email address
12
+ * @param identifier - The identifier to match against
13
+ * @returns true if the user matches the identifier
14
+ */
15
+ function userMatchesIdentifier(userId, userEmail, identifier) {
16
+ if (typeof identifier === "string") {
17
+ // String is treated as user ID
18
+ return userId === identifier;
19
+ }
20
+ if ("id" in identifier) {
21
+ return userId === identifier.id;
22
+ }
23
+ if ("email" in identifier) {
24
+ // Case-insensitive email comparison
25
+ return userEmail?.toLowerCase() === identifier.email.toLowerCase();
26
+ }
27
+ return false;
28
+ }
29
+ /**
30
+ * Checks if a user matches any identifier in a list.
31
+ * @param userId - The user's Linear ID
32
+ * @param userEmail - The user's email address
33
+ * @param identifiers - List of identifiers to check against
34
+ * @returns true if the user matches any identifier
35
+ */
36
+ function userMatchesAny(userId, userEmail, identifiers) {
37
+ return identifiers.some((identifier) => userMatchesIdentifier(userId, userEmail, identifier));
38
+ }
39
+ /**
40
+ * User access control manager for Linear user whitelisting/blacklisting.
41
+ *
42
+ * Access Check Logic:
43
+ * 1. Build effective blocklist: global blockedUsers + repo blockedUsers (union)
44
+ * 2. Check if user matches any entry in effective blocklist -> BLOCKED
45
+ * 3. Determine effective allowlist:
46
+ * - If repo has allowedUsers -> use repo allowlist only
47
+ * - Else if global has allowedUsers -> use global allowlist
48
+ * - Else -> no allowlist (everyone allowed)
49
+ * 4. If effective allowlist exists and user NOT in it -> BLOCKED
50
+ * 5. Otherwise -> ALLOWED
51
+ */
52
+ export class UserAccessControl {
53
+ globalConfig;
54
+ repoConfigs;
55
+ /**
56
+ * Creates a new UserAccessControl instance.
57
+ * @param globalConfig - Global access control configuration
58
+ * @param repoConfigs - Map of repository ID to repository-specific access control config
59
+ */
60
+ constructor(globalConfig, repoConfigs) {
61
+ this.globalConfig = globalConfig;
62
+ this.repoConfigs = repoConfigs;
63
+ }
64
+ /**
65
+ * Check if a user is allowed to delegate issues to a specific repository.
66
+ * @param userId - The user's Linear ID
67
+ * @param userEmail - The user's email address
68
+ * @param repositoryId - The target repository ID
69
+ * @returns AccessCheckResult indicating if access is allowed
70
+ */
71
+ checkAccess(userId, userEmail, repositoryId) {
72
+ const repoConfig = this.repoConfigs.get(repositoryId);
73
+ // Step 1: Build effective blocklist (global + repo, union)
74
+ const effectiveBlocklist = [
75
+ ...(this.globalConfig?.blockedUsers ?? []),
76
+ ...(repoConfig?.blockedUsers ?? []),
77
+ ];
78
+ // Step 2: Check if user is in blocklist
79
+ if (effectiveBlocklist.length > 0 &&
80
+ userMatchesAny(userId, userEmail, effectiveBlocklist)) {
81
+ return {
82
+ allowed: false,
83
+ reason: "User is in blocklist",
84
+ };
85
+ }
86
+ // Step 3: Determine effective allowlist
87
+ // Repo allowlist OVERRIDES global (not merged)
88
+ let effectiveAllowlist;
89
+ if (repoConfig?.allowedUsers !== undefined) {
90
+ effectiveAllowlist = repoConfig.allowedUsers;
91
+ }
92
+ else if (this.globalConfig?.allowedUsers !== undefined) {
93
+ effectiveAllowlist = this.globalConfig.allowedUsers;
94
+ }
95
+ // Step 4: If allowlist exists, check if user is in it
96
+ if (effectiveAllowlist !== undefined) {
97
+ // Empty allowlist means no one is allowed
98
+ if (effectiveAllowlist.length === 0) {
99
+ return {
100
+ allowed: false,
101
+ reason: "No users are allowed (empty allowlist)",
102
+ };
103
+ }
104
+ if (!userMatchesAny(userId, userEmail, effectiveAllowlist)) {
105
+ return {
106
+ allowed: false,
107
+ reason: "User is not in allowlist",
108
+ };
109
+ }
110
+ }
111
+ // Step 5: User is allowed
112
+ return { allowed: true };
113
+ }
114
+ /**
115
+ * Get the effective block behavior for a repository.
116
+ * Repo config overrides global config.
117
+ * @param repositoryId - The repository ID
118
+ * @returns 'silent' or 'comment'
119
+ */
120
+ getBlockBehavior(repositoryId) {
121
+ const repoConfig = this.repoConfigs.get(repositoryId);
122
+ // Repo blockBehavior overrides global
123
+ if (repoConfig?.blockBehavior !== undefined) {
124
+ return repoConfig.blockBehavior;
125
+ }
126
+ if (this.globalConfig?.blockBehavior !== undefined) {
127
+ return this.globalConfig.blockBehavior;
128
+ }
129
+ // Default to silent
130
+ return "silent";
131
+ }
132
+ /**
133
+ * Get the effective block message for a repository.
134
+ * Repo config overrides global config.
135
+ * @param repositoryId - The repository ID
136
+ * @returns The block message to display
137
+ */
138
+ getBlockMessage(repositoryId) {
139
+ const repoConfig = this.repoConfigs.get(repositoryId);
140
+ // Repo blockMessage overrides global
141
+ if (repoConfig?.blockMessage !== undefined) {
142
+ return repoConfig.blockMessage;
143
+ }
144
+ if (this.globalConfig?.blockMessage !== undefined) {
145
+ return this.globalConfig.blockMessage;
146
+ }
147
+ // Default message
148
+ return DEFAULT_BLOCK_MESSAGE;
149
+ }
150
+ /**
151
+ * Check if any access control is configured (either globally or for any repository).
152
+ * Useful for short-circuiting when no access control is needed.
153
+ * @returns true if any access control configuration exists
154
+ */
155
+ hasAnyConfiguration() {
156
+ // Check global config
157
+ if (this.globalConfig?.allowedUsers !== undefined ||
158
+ this.globalConfig?.blockedUsers !== undefined) {
159
+ return true;
160
+ }
161
+ // Check repo configs
162
+ for (const config of this.repoConfigs.values()) {
163
+ if (config?.allowedUsers !== undefined ||
164
+ config?.blockedUsers !== undefined) {
165
+ return true;
166
+ }
167
+ }
168
+ return false;
169
+ }
170
+ }
171
+ //# sourceMappingURL=UserAccessControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserAccessControl.js","sourceRoot":"","sources":["../src/UserAccessControl.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GACjC,wEAAwE,CAAC;AAE1E;;;;;;GAMG;AACH,SAAS,qBAAqB,CAC7B,MAA0B,EAC1B,SAA6B,EAC7B,UAA0B;IAE1B,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACpC,+BAA+B;QAC/B,OAAO,MAAM,KAAK,UAAU,CAAC;IAC9B,CAAC;IACD,IAAI,IAAI,IAAI,UAAU,EAAE,CAAC;QACxB,OAAO,MAAM,KAAK,UAAU,CAAC,EAAE,CAAC;IACjC,CAAC;IACD,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;QAC3B,oCAAoC;QACpC,OAAO,SAAS,EAAE,WAAW,EAAE,KAAK,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;;;;GAMG;AACH,SAAS,cAAc,CACtB,MAA0B,EAC1B,SAA6B,EAC7B,WAA6B;IAE7B,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CACtC,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CACpD,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,iBAAiB;IACrB,YAAY,CAAsC;IAClD,WAAW,CAAmD;IAEtE;;;;OAIG;IACH,YACC,YAAiD,EACjD,WAA6D;QAE7D,IAAI,CAAC,YAAY,GAAG,YAAY,C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,MAAM,EAAE,EAAE,CAAC;YAChD,IACC,MAAM,EAAE,YAAY,KAAK,SAAS;gBAClC,MAAM,EAAE,YAAY,KAAK,SAAS,EACjC,CAAC;gBACF,OAAO,IAAI,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
@@ -0,0 +1,32 @@
1
+ import { type ILogger } from "sylas-core";
2
+ /**
3
+ * Service responsible for handling .worktreeinclude file processing
4
+ *
5
+ * The .worktreeinclude file specifies which files ignored by .gitignore
6
+ * should be copied from the main repository to new worktrees.
7
+ *
8
+ * Files must match BOTH .worktreeinclude AND .gitignore patterns to be copied.
9
+ * This ensures only intended ignored files are duplicated.
10
+ */
11
+ export declare class WorktreeIncludeService {
12
+ private logger;
13
+ constructor(logger?: ILogger);
14
+ /**
15
+ * Process .worktreeinclude and copy matching ignored files to the worktree
16
+ *
17
+ * @param repositoryPath - Path to the main repository
18
+ * @param worktreePath - Path to the newly created worktree
19
+ */
20
+ copyIgnoredFiles(repositoryPath: string, worktreePath: string): Promise<void>;
21
+ /**
22
+ * Parse a pattern file (like .gitignore or .worktreeinclude)
23
+ * Returns an array of non-empty, non-comment lines
24
+ */
25
+ private parsePatternFile;
26
+ /**
27
+ * Recursively find all files in the repository that match both
28
+ * .worktreeinclude AND .gitignore patterns
29
+ */
30
+ private findMatchingFiles;
31
+ }
32
+ //# sourceMappingURL=WorktreeIncludeService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorktreeIncludeService.d.ts","sourceRoot":"","sources":["../src/WorktreeIncludeService.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IAClC,OAAO,CAAC,MAAM,CAAU;gBAEZ,MAAM,CAAC,EAAE,OAAO;IAK5B;;;;;OAKG;IACG,gBAAgB,CACrB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IA2EhB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;CAuCzB"}
@@ -0,0 +1,123 @@
1
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, } from "node:fs";
2
+ import { dirname, join, relative } from "node:path";
3
+ import ignore from "ignore";
4
+ import { createLogger } from "sylas-core";
5
+ /**
6
+ * Service responsible for handling .worktreeinclude file processing
7
+ *
8
+ * The .worktreeinclude file specifies which files ignored by .gitignore
9
+ * should be copied from the main repository to new worktrees.
10
+ *
11
+ * Files must match BOTH .worktreeinclude AND .gitignore patterns to be copied.
12
+ * This ensures only intended ignored files are duplicated.
13
+ */
14
+ export class WorktreeIncludeService {
15
+ logger;
16
+ constructor(logger) {
17
+ this.logger =
18
+ logger ?? createLogger({ component: "WorktreeIncludeService" });
19
+ }
20
+ /**
21
+ * Process .worktreeinclude and copy matching ignored files to the worktree
22
+ *
23
+ * @param repositoryPath - Path to the main repository
24
+ * @param worktreePath - Path to the newly created worktree
25
+ */
26
+ async copyIgnoredFiles(repositoryPath, worktreePath) {
27
+ const worktreeIncludePath = join(repositoryPath, ".worktreeinclude");
28
+ // Check if .worktreeinclude exists
29
+ if (!existsSync(worktreeIncludePath)) {
30
+ // No .worktreeinclude file, nothing to do
31
+ return;
32
+ }
33
+ this.logger.info("Found .worktreeinclude file, processing...");
34
+ // Parse .worktreeinclude patterns
35
+ const worktreeIncludePatterns = this.parsePatternFile(worktreeIncludePath);
36
+ if (worktreeIncludePatterns.length === 0) {
37
+ this.logger.info(".worktreeinclude is empty, nothing to copy");
38
+ return;
39
+ }
40
+ // Parse .gitignore patterns
41
+ const gitignorePath = join(repositoryPath, ".gitignore");
42
+ const gitignorePatterns = existsSync(gitignorePath)
43
+ ? this.parsePatternFile(gitignorePath)
44
+ : [];
45
+ if (gitignorePatterns.length === 0) {
46
+ this.logger.warn("No .gitignore found or empty, .worktreeinclude requires files to be gitignored");
47
+ return;
48
+ }
49
+ // Create ignore matchers
50
+ const worktreeIncludeMatcher = ignore().add(worktreeIncludePatterns);
51
+ const gitignoreMatcher = ignore().add(gitignorePatterns);
52
+ // Find files that match both patterns
53
+ const filesToCopy = this.findMatchingFiles(repositoryPath, worktreeIncludeMatcher, gitignoreMatcher);
54
+ if (filesToCopy.length === 0) {
55
+ this.logger.info("No files match both .worktreeinclude and .gitignore");
56
+ return;
57
+ }
58
+ this.logger.info(`Copying ${filesToCopy.length} ignored file(s) to worktree...`);
59
+ // Copy each matching file
60
+ for (const relativePath of filesToCopy) {
61
+ const sourcePath = join(repositoryPath, relativePath);
62
+ const destPath = join(worktreePath, relativePath);
63
+ try {
64
+ // Ensure destination directory exists
65
+ const destDir = dirname(destPath);
66
+ if (!existsSync(destDir)) {
67
+ mkdirSync(destDir, { recursive: true });
68
+ }
69
+ copyFileSync(sourcePath, destPath);
70
+ this.logger.info(` Copied: ${relativePath}`);
71
+ }
72
+ catch (error) {
73
+ this.logger.warn(` Failed to copy ${relativePath}: ${error.message}`);
74
+ }
75
+ }
76
+ this.logger.info("Finished copying ignored files");
77
+ }
78
+ /**
79
+ * Parse a pattern file (like .gitignore or .worktreeinclude)
80
+ * Returns an array of non-empty, non-comment lines
81
+ */
82
+ parsePatternFile(filePath) {
83
+ const content = readFileSync(filePath, "utf-8");
84
+ return content
85
+ .split("\n")
86
+ .map((line) => line.trim())
87
+ .filter((line) => line.length > 0 && !line.startsWith("#"));
88
+ }
89
+ /**
90
+ * Recursively find all files in the repository that match both
91
+ * .worktreeinclude AND .gitignore patterns
92
+ */
93
+ findMatchingFiles(repositoryPath, worktreeIncludeMatcher, gitignoreMatcher) {
94
+ const matchingFiles = [];
95
+ const walkDirectory = (currentPath) => {
96
+ const entries = readdirSync(currentPath, { withFileTypes: true });
97
+ for (const entry of entries) {
98
+ const fullPath = join(currentPath, entry.name);
99
+ const relativePath = relative(repositoryPath, fullPath);
100
+ // Skip .git directory
101
+ if (entry.name === ".git") {
102
+ continue;
103
+ }
104
+ if (entry.isDirectory()) {
105
+ // Walk into directories to find specific files
106
+ // We don't add directories themselves to the copy list
107
+ walkDirectory(fullPath);
108
+ }
109
+ else if (entry.isFile()) {
110
+ // Check if file matches both patterns
111
+ const isGitignored = gitignoreMatcher.ignores(relativePath);
112
+ const isWorktreeIncluded = worktreeIncludeMatcher.ignores(relativePath);
113
+ if (isGitignored && isWorktreeIncluded) {
114
+ matchingFiles.push(relativePath);
115
+ }
116
+ }
117
+ }
118
+ };
119
+ walkDirectory(repositoryPath);
120
+ return matchingFiles;
121
+ }
122
+ }
123
+ //# sourceMappingURL=WorktreeIncludeService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorktreeIncludeService.js","sourceRoot":"","sources":["../src/WorktreeIncludeService.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,MAAuB,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAsB;IAC1B,MAAM,CAAU;IAExB,YAAY,MAAgB;QAC3B,IAAI,CAAC,MAAM;YACV,MAAM,IAAI,YAAY,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAClE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,gBAAgB,CACrB,cAAsB,EACtB,YAAoB;QAEpB,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAErE,mCAAmC;QACnC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACtC,0CAA0C;YAC1C,OAAO;QACR,CAAC;QAED,IAAI,CAAC,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AAQ,EAAE;YACnD,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;YAElE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;gBAExD,sBAAsB;gBACtB,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBAC3B,SAAS;gBACV,CAAC;gBAED,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;oBACzB,+CAA+C;oBAC/C,uDAAuD;oBACvD,aAAa,CAAC,QAAQ,CAAC,CAAC;gBACzB,CAAC;qBAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;oBAC3B,sCAAsC;oBACtC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;oBAC5D,MAAM,kBAAkB,GACvB,sBAAsB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;oBAE9C,IAAI,YAAY,IAAI,kBAAkB,EAAE,CAAC;wBACxC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBAClC,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC,CAAC;QAEF,aAAa,CAAC,cAAc,CAAC,CAAC;QAC9B,OAAO,aAAa,CAAC;IACtB,CAAC;CACD"}
@@ -0,0 +1,22 @@
1
+ export type { SDKMessage } from "sylas-claude-runner";
2
+ export { getAllTools, readOnlyTools } from "sylas-claude-runner";
3
+ export type { EdgeConfig, EdgeWorkerConfig, OAuthCallbackHandler, RepositoryConfig, UserAccessControlConfig, UserIdentifier, Workspace, } from "sylas-core";
4
+ export { AgentSessionManager } from "./AgentSessionManager.js";
5
+ export type { AskUserQuestionHandlerConfig, AskUserQuestionHandlerDeps, } from "./AskUserQuestionHandler.js";
6
+ export { AskUserQuestionHandler } from "./AskUserQuestionHandler.js";
7
+ export type { ChatPlatformAdapter, ChatPlatformName, ChatSessionHandlerDeps, } from "./ChatSessionHandler.js";
8
+ export { ChatSessionHandler } from "./ChatSessionHandler.js";
9
+ export { EdgeWorker } from "./EdgeWorker.js";
10
+ export { GitService } from "./GitService.js";
11
+ export type { SerializedGlobalRegistryState } from "./GlobalSessionRegistry.js";
12
+ export { GlobalSessionRegistry } from "./GlobalSessionRegistry.js";
13
+ export { RepositoryRouter } from "./RepositoryRouter.js";
14
+ export { SharedApplicationServer } from "./SharedApplicationServer.js";
15
+ export { SlackChatAdapter } from "./SlackChatAdapter.js";
16
+ export type { ActivityPostOptions, ActivityPostResult, ActivitySignal, IActivitySink, } from "./sinks/index.js";
17
+ export { LinearActivitySink } from "./sinks/index.js";
18
+ export type { EdgeWorkerEvents } from "./types.js";
19
+ export { type AccessCheckResult, DEFAULT_BLOCK_MESSAGE, UserAccessControl, } from "./UserAccessControl.js";
20
+ export { DEFAULT_VALIDATION_LOOP_CONFIG, parseValidationResult, VALIDATION_RESULT_SCHEMA, type ValidationFixerContext, type ValidationLoopConfig, type ValidationLoopState, type ValidationResult, } from "./validation/index.js";
21
+ export { WorktreeIncludeService } from "./WorktreeIncludeService.js";
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EACX,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EACX,4BAA4B,EAC5B,0BAA0B,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EACX,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EACN,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,iBAAiB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ export { getAllTools, readOnlyTools } from "sylas-claude-runner";
2
+ export { AgentSessionManager } from "./AgentSessionManager.js";
3
+ export { AskUserQuestionHandler } from "./AskUserQuestionHandler.js";
4
+ export { ChatSessionHandler } from "./ChatSessionHandler.js";
5
+ export { EdgeWorker } from "./EdgeWorker.js";
6
+ export { GitService } from "./GitService.js";
7
+ export { GlobalSessionRegistry } from "./GlobalSessionRegistry.js";
8
+ export { RepositoryRouter } from "./RepositoryRouter.js";
9
+ export { SharedApplicationServer } from "./SharedApplicationServer.js";
10
+ export { SlackChatAdapter } from "./SlackChatAdapter.js";
11
+ export { LinearActivitySink } from "./sinks/index.js";
12
+ // User access control
13
+ export { DEFAULT_BLOCK_MESSAGE, UserAccessControl, } from "./UserAccessControl.js";
14
+ // Export validation loop module
15
+ export { DEFAULT_VALIDATION_LOOP_CONFIG, parseValidationResult, VALIDATION_RESULT_SCHEMA, } from "./validation/index.js";
16
+ export { WorktreeIncludeService } from "./WorktreeIncludeService.js";
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAUjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAK/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAMrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,sBAAsB;AACtB,OAAO,EAEN,qBAAqB,EACrB,iBAAiB,GACjB,MAAM,wBAAwB,CAAC;AAChC,gCAAgC;AAChC,OAAO,EACN,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,GAKxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,27 @@
1
+ <git_context>
2
+ <repository>{{repository_name}}</repository>
3
+ <base_branch>{{base_branch}}</base_branch>
4
+ </git_context>
5
+
6
+ <linear_issue>
7
+ <id>{{issue_id}}</id>
8
+ <identifier>{{issue_identifier}}</identifier>
9
+ <title>{{issue_title}}</title>
10
+ <description>{{issue_description}}</description>
11
+ <url>{{issue_url}}</url>
12
+ <assignee>
13
+ <id>{{assignee_id}}</id>
14
+ <name>{{assignee_name}}</name>
15
+ </assignee>
16
+ </linear_issue>
17
+
18
+ <workspace_context>
19
+ <teams>
20
+ {{workspace_teams}}
21
+ </teams>
22
+ <labels>
23
+ {{workspace_labels}}
24
+ </labels>
25
+ </workspace_context>
26
+
27
+ {{routing_context}}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * ProcedureAnalyzer - Intelligent analysis of agent sessions to determine procedures
3
+ *
4
+ * Uses a SimpleAgentRunner (Claude or Gemini) to analyze requests and determine
5
+ * which procedure (sequence of subroutines) should be executed.
6
+ */
7
+ import { type ILogger, type SylasAgentSession } from "sylas-core";
8
+ import type { ProcedureAnalysisDecision, ProcedureDefinition, SubroutineDefinition } from "./types.js";
9
+ export type SimpleRunnerType = "claude" | "gemini" | "opencode";
10
+ export interface ProcedureAnalyzerConfig {
11
+ sylasHome: string;
12
+ model?: string;
13
+ timeoutMs?: number;
14
+ runnerType?: SimpleRunnerType;
15
+ logger?: ILogger;
16
+ }
17
+ export declare class ProcedureAnalyzer {
18
+ private analysisRunner;
19
+ private procedures;
20
+ private logger;
21
+ constructor(config: ProcedureAnalyzerConfig);
22
+ /**
23
+ * Build the system prompt for request analysis and classification
24
+ */
25
+ private buildAnalysisSystemPrompt;
26
+ /**
27
+ * Load predefined procedures from registry
28
+ */
29
+ private loadPredefinedProcedures;
30
+ /**
31
+ * Analyze a request and determine which procedure to use
32
+ */
33
+ determineRoutine(requestText: string): Promise<ProcedureAnalysisDecision>;
34
+ /**
35
+ * Get the next subroutine for a session
36
+ * Returns null if procedure is complete
37
+ */
38
+ getNextSubroutine(session: SylasAgentSession): SubroutineDefinition | null;
39
+ /**
40
+ * Get the current subroutine for a session
41
+ */
42
+ getCurrentSubroutine(session: SylasAgentSession): SubroutineDefinition | null;
43
+ /**
44
+ * Initialize procedure metadata for a new session
45
+ */
46
+ initializeProcedureMetadata(session: SylasAgentSession, procedure: ProcedureDefinition): void;
47
+ /**
48
+ * Record subroutine completion and advance to next
49
+ */
50
+ advanceToNextSubroutine(session: SylasAgentSession, sessionId: string | null, result?: string): void;
51
+ /**
52
+ * Get the result from the last completed subroutine in the history.
53
+ * Returns null if there is no history or no result stored.
54
+ */
55
+ getLastSubroutineResult(session: SylasAgentSession): string | null;
56
+ /**
57
+ * Check if procedure is complete
58
+ */
59
+ isProcedureComplete(session: SylasAgentSession): boolean;
60
+ /**
61
+ * Register a custom procedure
62
+ */
63
+ registerProcedure(procedure: ProcedureDefinition): void;
64
+ /**
65
+ * Get procedure by name
66
+ */
67
+ getProcedure(name: string): ProcedureDefinition | undefined;
68
+ }
69
+ //# sourceMappingURL=ProcedureAnalyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcedureAnalyzer.d.ts","sourceRoot":"","sources":["../../src/procedures/ProcedureAnalyzer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEN,KAAK,OAAO,EAEZ,KAAK,iBAAiB,EACtB,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EACX,yBAAyB,EACzB,mBAAmB,EAGnB,oBAAoB,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM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