@cleocode/adapters 2026.4.30 → 2026.4.35
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.
- package/dist/index.js +641 -5
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code/adapter.js +184 -0
- package/dist/providers/claude-code/adapter.js.map +1 -0
- package/dist/providers/claude-code/context-monitor.js +159 -0
- package/dist/providers/claude-code/context-monitor.js.map +1 -0
- package/dist/providers/claude-code/hooks.js +286 -0
- package/dist/providers/claude-code/hooks.js.map +1 -0
- package/dist/providers/claude-code/index.js +41 -0
- package/dist/providers/claude-code/index.js.map +1 -0
- package/dist/providers/claude-code/install.js +199 -0
- package/dist/providers/claude-code/install.js.map +1 -0
- package/dist/providers/claude-code/paths.js +41 -0
- package/dist/providers/claude-code/paths.js.map +1 -0
- package/dist/providers/claude-code/spawn.js +171 -0
- package/dist/providers/claude-code/spawn.js.map +1 -0
- package/dist/providers/claude-code/statusline.js +130 -0
- package/dist/providers/claude-code/statusline.js.map +1 -0
- package/dist/providers/claude-code/task-sync.js +119 -0
- package/dist/providers/claude-code/task-sync.js.map +1 -0
- package/dist/providers/claude-code/transport.js +29 -0
- package/dist/providers/claude-code/transport.js.map +1 -0
- package/dist/providers/codex/adapter.js +146 -0
- package/dist/providers/codex/adapter.js.map +1 -0
- package/dist/providers/codex/hooks.js +113 -0
- package/dist/providers/codex/hooks.js.map +1 -0
- package/dist/providers/codex/index.js +39 -0
- package/dist/providers/codex/index.js.map +1 -0
- package/dist/providers/codex/install.js +124 -0
- package/dist/providers/codex/install.js.map +1 -0
- package/dist/providers/cursor/adapter.js +151 -0
- package/dist/providers/cursor/adapter.js.map +1 -0
- package/dist/providers/cursor/hooks.js +208 -0
- package/dist/providers/cursor/hooks.js.map +1 -0
- package/dist/providers/cursor/index.js +36 -0
- package/dist/providers/cursor/index.js.map +1 -0
- package/dist/providers/cursor/install.js +180 -0
- package/dist/providers/cursor/install.js.map +1 -0
- package/dist/providers/cursor/spawn.js +59 -0
- package/dist/providers/cursor/spawn.js.map +1 -0
- package/dist/providers/gemini-cli/adapter.js +158 -0
- package/dist/providers/gemini-cli/adapter.js.map +1 -0
- package/dist/providers/gemini-cli/hooks.js +128 -0
- package/dist/providers/gemini-cli/hooks.js.map +1 -0
- package/dist/providers/gemini-cli/index.js +39 -0
- package/dist/providers/gemini-cli/index.js.map +1 -0
- package/dist/providers/gemini-cli/install.js +124 -0
- package/dist/providers/gemini-cli/install.js.map +1 -0
- package/dist/providers/kimi/adapter.js +145 -0
- package/dist/providers/kimi/adapter.js.map +1 -0
- package/dist/providers/kimi/hooks.js +79 -0
- package/dist/providers/kimi/hooks.js.map +1 -0
- package/dist/providers/kimi/index.js +39 -0
- package/dist/providers/kimi/index.js.map +1 -0
- package/dist/providers/kimi/install.js +124 -0
- package/dist/providers/kimi/install.js.map +1 -0
- package/dist/providers/opencode/adapter.js +166 -0
- package/dist/providers/opencode/adapter.js.map +1 -0
- package/dist/providers/opencode/hooks.js +206 -0
- package/dist/providers/opencode/hooks.js.map +1 -0
- package/dist/providers/opencode/index.js +37 -0
- package/dist/providers/opencode/index.js.map +1 -0
- package/dist/providers/opencode/install.js +115 -0
- package/dist/providers/opencode/install.js.map +1 -0
- package/dist/providers/opencode/spawn.js +241 -0
- package/dist/providers/opencode/spawn.js.map +1 -0
- package/dist/providers/pi/adapter.d.ts +102 -0
- package/dist/providers/pi/adapter.d.ts.map +1 -0
- package/dist/providers/pi/adapter.js +220 -0
- package/dist/providers/pi/adapter.js.map +1 -0
- package/dist/providers/pi/hooks.d.ts +149 -0
- package/dist/providers/pi/hooks.d.ts.map +1 -0
- package/dist/providers/pi/hooks.js +223 -0
- package/dist/providers/pi/hooks.js.map +1 -0
- package/dist/providers/pi/index.d.ts +36 -0
- package/dist/providers/pi/index.d.ts.map +1 -0
- package/dist/providers/pi/index.js +38 -0
- package/dist/providers/pi/index.js.map +1 -0
- package/dist/providers/pi/install.d.ts +68 -0
- package/dist/providers/pi/install.d.ts.map +1 -0
- package/dist/providers/pi/install.js +175 -0
- package/dist/providers/pi/install.js.map +1 -0
- package/dist/providers/pi/spawn.d.ts +68 -0
- package/dist/providers/pi/spawn.d.ts.map +1 -0
- package/dist/providers/pi/spawn.js +187 -0
- package/dist/providers/pi/spawn.js.map +1 -0
- package/dist/providers/shared/transcript-reader.js +124 -0
- package/dist/providers/shared/transcript-reader.js.map +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +92 -0
- package/dist/registry.js.map +1 -0
- package/package.json +3 -3
- package/src/providers/pi/adapter.ts +240 -0
- package/src/providers/pi/hooks.ts +232 -0
- package/src/providers/pi/index.ts +41 -0
- package/src/providers/pi/install.ts +189 -0
- package/src/providers/pi/manifest.json +40 -0
- package/src/providers/pi/spawn.ts +207 -0
- package/src/registry.ts +6 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Adapter
|
|
3
|
+
*
|
|
4
|
+
* Main CLEOProviderAdapter implementation for Cursor AI code editor.
|
|
5
|
+
* Provides install capabilities for CLEO integration. Hooks and spawn
|
|
6
|
+
* are not supported since Cursor lacks CLI-based lifecycle events
|
|
7
|
+
* and subagent spawning.
|
|
8
|
+
*
|
|
9
|
+
* @task T5240
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync } from 'node:fs';
|
|
12
|
+
import { join } from 'node:path';
|
|
13
|
+
import { CursorHookProvider } from './hooks.js';
|
|
14
|
+
import { CursorInstallProvider } from './install.js';
|
|
15
|
+
/**
|
|
16
|
+
* CLEO provider adapter for Cursor AI code editor.
|
|
17
|
+
*
|
|
18
|
+
* Bridges CLEO's adapter system with Cursor's capabilities:
|
|
19
|
+
* - Install: Manages .cursorrules and .cursor/rules/cleo.mdc rule files
|
|
20
|
+
* - Hooks: Stub provider (Cursor has no lifecycle event system)
|
|
21
|
+
* - Spawn: Not supported (Cursor has no CLI for subagent spawning)
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* Cursor is a GUI-based editor, so many CLI-oriented capabilities
|
|
25
|
+
* (spawn, transport, task sync, context monitor) are unsupported.
|
|
26
|
+
* Integration is primarily through instruction rule files placed in
|
|
27
|
+
* `.cursor/rules/` (modern MDC format) and `.cursorrules` (legacy).
|
|
28
|
+
*/
|
|
29
|
+
export class CursorAdapter {
|
|
30
|
+
/** Unique provider identifier. */
|
|
31
|
+
id = 'cursor';
|
|
32
|
+
/** Human-readable provider name. */
|
|
33
|
+
name = 'Cursor';
|
|
34
|
+
/** Adapter version string. */
|
|
35
|
+
version = '1.0.0';
|
|
36
|
+
/** Declared capabilities for this provider. */
|
|
37
|
+
capabilities = {
|
|
38
|
+
supportsHooks: true,
|
|
39
|
+
// 10/16 canonical events — derived from getProviderHookProfile('cursor') in CAAMP 1.9.1.
|
|
40
|
+
// PermissionRequest, PreModel, PostModel, PostCompact, Notification, ConfigChange are
|
|
41
|
+
// not supported by Cursor's hook system.
|
|
42
|
+
supportedHookEvents: [
|
|
43
|
+
'SessionStart',
|
|
44
|
+
'SessionEnd',
|
|
45
|
+
'PromptSubmit',
|
|
46
|
+
'ResponseComplete',
|
|
47
|
+
'PreToolUse',
|
|
48
|
+
'PostToolUse',
|
|
49
|
+
'PostToolUseFailure',
|
|
50
|
+
'SubagentStart',
|
|
51
|
+
'SubagentStop',
|
|
52
|
+
'PreCompact',
|
|
53
|
+
],
|
|
54
|
+
supportsSpawn: false,
|
|
55
|
+
supportsInstall: true,
|
|
56
|
+
supportsInstructionFiles: true,
|
|
57
|
+
instructionFilePattern: '.cursor/rules/*.mdc',
|
|
58
|
+
supportsContextMonitor: false,
|
|
59
|
+
supportsStatusline: false,
|
|
60
|
+
supportsProviderPaths: true,
|
|
61
|
+
supportsTransport: false,
|
|
62
|
+
supportsTaskSync: false,
|
|
63
|
+
};
|
|
64
|
+
/** Hook provider for CAAMP event mapping. */
|
|
65
|
+
hooks;
|
|
66
|
+
/** Install provider for managing rule files. */
|
|
67
|
+
install;
|
|
68
|
+
/** Project directory this adapter was initialized with, or null. */
|
|
69
|
+
projectDir = null;
|
|
70
|
+
/** Whether {@link initialize} has been called. */
|
|
71
|
+
initialized = false;
|
|
72
|
+
constructor() {
|
|
73
|
+
this.hooks = new CursorHookProvider();
|
|
74
|
+
this.install = new CursorInstallProvider();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Initialize the adapter for a given project directory.
|
|
78
|
+
*
|
|
79
|
+
* @param projectDir - Root directory of the project
|
|
80
|
+
*/
|
|
81
|
+
async initialize(projectDir) {
|
|
82
|
+
this.projectDir = projectDir;
|
|
83
|
+
this.initialized = true;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Dispose the adapter and clean up resources.
|
|
87
|
+
*/
|
|
88
|
+
async dispose() {
|
|
89
|
+
if (this.hooks.isRegistered()) {
|
|
90
|
+
await this.hooks.unregisterNativeHooks();
|
|
91
|
+
}
|
|
92
|
+
this.initialized = false;
|
|
93
|
+
this.projectDir = null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Run a health check to verify Cursor is accessible.
|
|
97
|
+
*
|
|
98
|
+
* Checks:
|
|
99
|
+
* 1. Adapter has been initialized
|
|
100
|
+
* 2. .cursor/ configuration directory exists in the project
|
|
101
|
+
* 3. CURSOR_EDITOR env var is set
|
|
102
|
+
*
|
|
103
|
+
* @returns Health status with details about each check
|
|
104
|
+
*/
|
|
105
|
+
async healthCheck() {
|
|
106
|
+
const details = {};
|
|
107
|
+
if (!this.initialized) {
|
|
108
|
+
return {
|
|
109
|
+
healthy: false,
|
|
110
|
+
provider: this.id,
|
|
111
|
+
details: { error: 'Adapter not initialized' },
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// Check for Cursor config directory in the project
|
|
115
|
+
let configExists = false;
|
|
116
|
+
if (this.projectDir) {
|
|
117
|
+
const cursorConfigDir = join(this.projectDir, '.cursor');
|
|
118
|
+
configExists = existsSync(cursorConfigDir);
|
|
119
|
+
details.configDirExists = configExists;
|
|
120
|
+
}
|
|
121
|
+
// Check for CURSOR_EDITOR env var
|
|
122
|
+
const editorEnvSet = process.env.CURSOR_EDITOR !== undefined;
|
|
123
|
+
details.editorEnvSet = editorEnvSet;
|
|
124
|
+
// Check for legacy .cursorrules file
|
|
125
|
+
if (this.projectDir) {
|
|
126
|
+
const legacyRulesExist = existsSync(join(this.projectDir, '.cursorrules'));
|
|
127
|
+
details.legacyRulesExist = legacyRulesExist;
|
|
128
|
+
}
|
|
129
|
+
// Healthy if we detect Cursor presence (config dir or env var)
|
|
130
|
+
const healthy = configExists || editorEnvSet;
|
|
131
|
+
details.detected = healthy;
|
|
132
|
+
return {
|
|
133
|
+
healthy,
|
|
134
|
+
provider: this.id,
|
|
135
|
+
details,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Check whether the adapter has been initialized.
|
|
140
|
+
*/
|
|
141
|
+
isInitialized() {
|
|
142
|
+
return this.initialized;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get the project directory this adapter was initialized with.
|
|
146
|
+
*/
|
|
147
|
+
getProjectDir() {
|
|
148
|
+
return this.projectDir;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/providers/cursor/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,aAAa;IACxB,kCAAkC;IACzB,EAAE,GAAG,QAAQ,CAAC;IACvB,o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;OAEG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Hook Provider
|
|
3
|
+
*
|
|
4
|
+
* Maps Cursor's native hook events to CAAMP canonical hook events.
|
|
5
|
+
* Cursor supports 10 of 16 canonical events through its config-based hook system.
|
|
6
|
+
*
|
|
7
|
+
* Event translation uses CAAMP normalizer APIs:
|
|
8
|
+
* - `toCanonical(nativeName, 'cursor')` for runtime event name resolution
|
|
9
|
+
* - `getSupportedEvents('cursor')` to enumerate supported canonical events
|
|
10
|
+
* - `getProviderHookProfile('cursor')` for the full provider profile
|
|
11
|
+
*
|
|
12
|
+
* Cursor uses camelCase native event names (e.g. `sessionStart`, `preToolUse`).
|
|
13
|
+
* Hooks are configured via `.cursor/hooks.json`. Supported handler types:
|
|
14
|
+
* command, prompt.
|
|
15
|
+
*
|
|
16
|
+
* Unsupported events: PermissionRequest, PreModel, PostModel, PostCompact,
|
|
17
|
+
* Notification, ConfigChange.
|
|
18
|
+
*
|
|
19
|
+
* @task T165
|
|
20
|
+
* @epic T134
|
|
21
|
+
*/
|
|
22
|
+
/** CAAMP provider identifier for Cursor. */
|
|
23
|
+
const PROVIDER_ID = 'cursor';
|
|
24
|
+
/**
|
|
25
|
+
* Fallback map from Cursor native event names to CAAMP canonical names.
|
|
26
|
+
*
|
|
27
|
+
* Derived from `getProviderHookProfile('cursor').mappings` in CAAMP 1.9.1.
|
|
28
|
+
* Covers all 10 supported events. PermissionRequest, PreModel, PostModel,
|
|
29
|
+
* PostCompact, Notification, and ConfigChange are not supported by Cursor.
|
|
30
|
+
*
|
|
31
|
+
* Cursor uses camelCase names while CAAMP canonical names are PascalCase.
|
|
32
|
+
*/
|
|
33
|
+
const CURSOR_EVENT_MAP = {
|
|
34
|
+
// CAAMP: toNative('SessionStart', 'cursor') = 'sessionStart'
|
|
35
|
+
sessionStart: 'SessionStart',
|
|
36
|
+
// CAAMP: toNative('SessionEnd', 'cursor') = 'sessionEnd'
|
|
37
|
+
sessionEnd: 'SessionEnd',
|
|
38
|
+
// CAAMP: toNative('PromptSubmit', 'cursor') = 'beforeSubmitPrompt'
|
|
39
|
+
beforeSubmitPrompt: 'PromptSubmit',
|
|
40
|
+
// CAAMP: toNative('ResponseComplete', 'cursor') = 'stop'
|
|
41
|
+
stop: 'ResponseComplete',
|
|
42
|
+
// CAAMP: toNative('PreToolUse', 'cursor') = 'preToolUse'
|
|
43
|
+
preToolUse: 'PreToolUse',
|
|
44
|
+
// CAAMP: toNative('PostToolUse', 'cursor') = 'postToolUse'
|
|
45
|
+
postToolUse: 'PostToolUse',
|
|
46
|
+
// CAAMP: toNative('PostToolUseFailure', 'cursor') = 'postToolUseFailure'
|
|
47
|
+
postToolUseFailure: 'PostToolUseFailure',
|
|
48
|
+
// CAAMP: toNative('SubagentStart', 'cursor') = 'subagentStart'
|
|
49
|
+
subagentStart: 'SubagentStart',
|
|
50
|
+
// CAAMP: toNative('SubagentStop', 'cursor') = 'subagentStop'
|
|
51
|
+
subagentStop: 'SubagentStop',
|
|
52
|
+
// CAAMP: toNative('PreCompact', 'cursor') = 'preCompact'
|
|
53
|
+
preCompact: 'PreCompact',
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Hook provider for Cursor.
|
|
57
|
+
*
|
|
58
|
+
* Cursor registers hooks via its config system at `.cursor/hooks.json`.
|
|
59
|
+
* Supported handler types: command, prompt.
|
|
60
|
+
*
|
|
61
|
+
* CAAMP 1.9.1 reveals Cursor supports 10 of 16 canonical events. Previously
|
|
62
|
+
* this provider was a no-op stub. It now provides full event mapping and CAAMP
|
|
63
|
+
* normalizer integration.
|
|
64
|
+
*
|
|
65
|
+
* Event mapping is based on `getProviderHookProfile('cursor')` from CAAMP 1.9.1.
|
|
66
|
+
* Async accessors (`getSupportedCanonicalEvents`, `getProviderProfile`) call
|
|
67
|
+
* CAAMP directly when available.
|
|
68
|
+
*
|
|
69
|
+
* Since hooks are registered through the config system (managed by the install
|
|
70
|
+
* provider), `registerNativeHooks` and `unregisterNativeHooks` track registration
|
|
71
|
+
* state without performing filesystem operations.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* This provider was originally a no-op stub. It now provides full event
|
|
75
|
+
* mapping for all 10 canonical events supported by Cursor, plus CAAMP
|
|
76
|
+
* normalizer integration via async accessors. Registration state is
|
|
77
|
+
* tracked in-memory because Cursor manages hooks through its own config.
|
|
78
|
+
*
|
|
79
|
+
* @task T165
|
|
80
|
+
* @epic T134
|
|
81
|
+
*/
|
|
82
|
+
export class CursorHookProvider {
|
|
83
|
+
/** Whether hooks have been registered for the current session. */
|
|
84
|
+
registered = false;
|
|
85
|
+
/**
|
|
86
|
+
* Map a Cursor native event name to a CAAMP canonical hook event name.
|
|
87
|
+
*
|
|
88
|
+
* Looks up the native event name in the map derived from
|
|
89
|
+
* `getProviderHookProfile('cursor').mappings` (CAAMP 1.9.1). Cursor uses
|
|
90
|
+
* camelCase names (e.g. "preToolUse", "sessionStart").
|
|
91
|
+
*
|
|
92
|
+
* Returns null for unsupported events (PermissionRequest, PreModel,
|
|
93
|
+
* PostModel, PostCompact, Notification, ConfigChange).
|
|
94
|
+
*
|
|
95
|
+
* @param providerEvent - Cursor native event name (e.g. "preToolUse", "sessionStart")
|
|
96
|
+
* @returns CAAMP canonical event name, or null if unmapped
|
|
97
|
+
* @task T165
|
|
98
|
+
*/
|
|
99
|
+
mapProviderEvent(providerEvent) {
|
|
100
|
+
return CURSOR_EVENT_MAP[providerEvent] ?? null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Register native hooks for a project.
|
|
104
|
+
*
|
|
105
|
+
* For Cursor, hooks are registered via the config system
|
|
106
|
+
* (`.cursor/hooks.json`), managed by the install provider.
|
|
107
|
+
* This method marks hooks as registered without performing filesystem operations.
|
|
108
|
+
*
|
|
109
|
+
* Iterating supported events is handled at install time using
|
|
110
|
+
* `getSupportedCanonicalEvents()` to enumerate all 10 supported hooks.
|
|
111
|
+
*
|
|
112
|
+
* @param _projectDir - Project directory (unused; Cursor config manages registration)
|
|
113
|
+
* @task T165
|
|
114
|
+
*/
|
|
115
|
+
async registerNativeHooks(_projectDir) {
|
|
116
|
+
this.registered = true;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Unregister native hooks.
|
|
120
|
+
*
|
|
121
|
+
* For Cursor, this is a no-op since hooks are managed through the config
|
|
122
|
+
* system. Unregistration happens via the install provider's uninstall method.
|
|
123
|
+
*
|
|
124
|
+
* @task T165
|
|
125
|
+
*/
|
|
126
|
+
async unregisterNativeHooks() {
|
|
127
|
+
this.registered = false;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check whether hooks have been registered via `registerNativeHooks`.
|
|
131
|
+
*/
|
|
132
|
+
isRegistered() {
|
|
133
|
+
return this.registered;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Get the native→canonical event mapping for introspection and debugging.
|
|
137
|
+
*
|
|
138
|
+
* Returns the map derived from `getProviderHookProfile('cursor').mappings`
|
|
139
|
+
* (CAAMP 1.9.1). Use `getSupportedCanonicalEvents()` to enumerate canonical
|
|
140
|
+
* names via live CAAMP APIs.
|
|
141
|
+
*
|
|
142
|
+
* @returns Immutable record of native event name → canonical event name
|
|
143
|
+
*/
|
|
144
|
+
getEventMap() {
|
|
145
|
+
return { ...CURSOR_EVENT_MAP };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Enumerate supported canonical events via CAAMP's `getSupportedEvents()`.
|
|
149
|
+
*
|
|
150
|
+
* Calls `getSupportedEvents('cursor')` from the CAAMP normalizer to get the
|
|
151
|
+
* authoritative list. Cursor supports 10 of 16 canonical events. Falls back
|
|
152
|
+
* to the values of the static event map when CAAMP is unavailable at runtime.
|
|
153
|
+
*
|
|
154
|
+
* @returns Array of CAAMP canonical event names supported by Cursor
|
|
155
|
+
* @task T165
|
|
156
|
+
*/
|
|
157
|
+
async getSupportedCanonicalEvents() {
|
|
158
|
+
try {
|
|
159
|
+
const { getSupportedEvents } = await import('@cleocode/caamp');
|
|
160
|
+
return getSupportedEvents(PROVIDER_ID);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return [...new Set(Object.values(CURSOR_EVENT_MAP))];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Retrieve the full provider hook profile from CAAMP.
|
|
168
|
+
*
|
|
169
|
+
* Calls `getProviderHookProfile('cursor')` from the CAAMP normalizer to
|
|
170
|
+
* get the complete profile: hook system type (`config`), config path
|
|
171
|
+
* (`.cursor/hooks.json`), handler types (command, prompt), and all event
|
|
172
|
+
* mappings. Returns null when CAAMP is unavailable at runtime.
|
|
173
|
+
*
|
|
174
|
+
* @returns Provider hook profile or null if CAAMP is unavailable
|
|
175
|
+
* @task T165
|
|
176
|
+
*/
|
|
177
|
+
async getProviderProfile() {
|
|
178
|
+
try {
|
|
179
|
+
const { getProviderHookProfile } = await import('@cleocode/caamp');
|
|
180
|
+
return getProviderHookProfile(PROVIDER_ID) ?? null;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Translate a CAAMP canonical event to its Cursor native name via CAAMP.
|
|
188
|
+
*
|
|
189
|
+
* Calls `toNative(canonical, 'cursor')` from the CAAMP normalizer.
|
|
190
|
+
* Returns null for unsupported events or when CAAMP is unavailable.
|
|
191
|
+
*
|
|
192
|
+
* @param canonical - CAAMP canonical event name (e.g. "PreToolUse")
|
|
193
|
+
* @returns Cursor native event name (e.g. "preToolUse") or null
|
|
194
|
+
* @task T165
|
|
195
|
+
*/
|
|
196
|
+
async toNativeEvent(canonical) {
|
|
197
|
+
try {
|
|
198
|
+
const { toNative } = await import('@cleocode/caamp');
|
|
199
|
+
return toNative(canonical, PROVIDER_ID);
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Invert the static map as fallback
|
|
203
|
+
const entry = Object.entries(CURSOR_EVENT_MAP).find(([, v]) => v === canonical);
|
|
204
|
+
return entry?.[0] ?? null;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/providers/cursor/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,4CAA4C;AAC5C,MAAM,WAAW,GAAG,QAAiB,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAA2B;IAC/C,mEAAmE;IACnE,YAAY,EAAE,cAAc;IAC5B,iEAAiE;IACjE,UAAU,EAAE,YAAY;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,cAAc;IAClC,2DAA2D;IAC3D,IAAI,EAAE,kBAAkB;IACxB,iEAAiE;IACjE,UAAU,EAAE,YAAY;IACxB,kEAAkE;IAClE,WAAW,EAAE,aAAa;IAC1B,yEAAyE;IACzE,kBAAkB,EAAE,oBAAoB;IACxC,oEAAoE;IACpE,aAAa,EAAE,eAAe;IAC9B,mEAAmE;IACnE,YAAY,EAAE,cAAc;IAC5B,iEAAiE;IACjE,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,OAAO,kBAAkB;IAC7B,kEAAkE;IAC1D,UAAU,GAAG,KAAK,CAAC;IAE3B;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CAAC,aAAqB;QACpC,OAAO,gBAAgB,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC;IACjD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,mBAAmB,CAAC,WAAmB;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC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AAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;YAChF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* CLEO provider adapter for Cursor AI code editor.
|
|
5
|
+
* Default export is the adapter class for dynamic loading by AdapterManager.
|
|
6
|
+
*
|
|
7
|
+
* @task T5240
|
|
8
|
+
*/
|
|
9
|
+
import { CursorAdapter } from './adapter.js';
|
|
10
|
+
export { CursorAdapter } from './adapter.js';
|
|
11
|
+
export { CursorHookProvider } from './hooks.js';
|
|
12
|
+
export { CursorInstallProvider } from './install.js';
|
|
13
|
+
export default CursorAdapter;
|
|
14
|
+
/**
|
|
15
|
+
* Factory function for creating adapter instances.
|
|
16
|
+
* Used by AdapterManager's dynamic import fallback.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* This is the primary entry point for dynamic adapter loading.
|
|
20
|
+
* AdapterManager calls this function when it resolves the cursor
|
|
21
|
+
* provider via its import-based discovery mechanism.
|
|
22
|
+
*
|
|
23
|
+
* @returns A new {@link CursorAdapter} instance ready for initialization
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createAdapter } from '@cleocode/adapters/providers/cursor';
|
|
28
|
+
*
|
|
29
|
+
* const adapter = createAdapter();
|
|
30
|
+
* await adapter.initialize('/path/to/project');
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function createAdapter() {
|
|
34
|
+
return new CursorAdapter();
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/providers/cursor/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,eAAe,aAAa,CAAC;AAE7B;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Install Provider
|
|
3
|
+
*
|
|
4
|
+
* Handles CLEO installation into Cursor environments:
|
|
5
|
+
* - Ensures .cursorrules has CLEO @-references (legacy format)
|
|
6
|
+
* - Creates .cursor/rules/cleo.mdc with CLEO references (modern format)
|
|
7
|
+
*
|
|
8
|
+
* Cursor supports two instruction file formats:
|
|
9
|
+
* 1. Legacy: .cursorrules (flat file, project root)
|
|
10
|
+
* 2. Modern: .cursor/rules/*.mdc (MDC format, per-rule files)
|
|
11
|
+
*
|
|
12
|
+
* This provider writes to both for maximum compatibility.
|
|
13
|
+
*
|
|
14
|
+
* @task T5240
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import { join } from 'node:path';
|
|
18
|
+
/** Lines that should appear in instruction files to reference CLEO. */
|
|
19
|
+
const INSTRUCTION_REFERENCES = ['@~/.cleo/templates/CLEO-INJECTION.md', '@.cleo/memory-bridge.md'];
|
|
20
|
+
/**
|
|
21
|
+
* Install provider for Cursor.
|
|
22
|
+
*
|
|
23
|
+
* Manages CLEO's integration with Cursor by:
|
|
24
|
+
* 1. Creating/updating .cursorrules with @-references (legacy)
|
|
25
|
+
* 2. Creating .cursor/rules/cleo.mdc with @-references (modern)
|
|
26
|
+
*
|
|
27
|
+
* @remarks
|
|
28
|
+
* Installation is idempotent and writes to both instruction file formats
|
|
29
|
+
* for maximum compatibility. The legacy `.cursorrules` file is only modified
|
|
30
|
+
* if it already exists (never created from scratch). The modern MDC file
|
|
31
|
+
* is always created or updated to ensure Cursor's rule engine picks it up.
|
|
32
|
+
*/
|
|
33
|
+
export class CursorInstallProvider {
|
|
34
|
+
/**
|
|
35
|
+
* Install CLEO into a Cursor project.
|
|
36
|
+
*
|
|
37
|
+
* @param options - Installation options including project directory
|
|
38
|
+
* @returns Result describing what was installed
|
|
39
|
+
*/
|
|
40
|
+
async install(options) {
|
|
41
|
+
const { projectDir } = options;
|
|
42
|
+
const installedAt = new Date().toISOString();
|
|
43
|
+
let instructionFileUpdated = false;
|
|
44
|
+
const details = {};
|
|
45
|
+
// Step 1: Ensure instruction files have @-references
|
|
46
|
+
instructionFileUpdated = this.updateInstructionFiles(projectDir);
|
|
47
|
+
if (instructionFileUpdated) {
|
|
48
|
+
details.instructionFiles = this.getUpdatedFileList(projectDir);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
success: true,
|
|
52
|
+
installedAt,
|
|
53
|
+
instructionFileUpdated,
|
|
54
|
+
details,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Uninstall CLEO from the current Cursor project.
|
|
59
|
+
*
|
|
60
|
+
* Does not remove instruction file references (they are harmless if CLEO is not present).
|
|
61
|
+
*/
|
|
62
|
+
async uninstall() { }
|
|
63
|
+
/**
|
|
64
|
+
* Check whether CLEO is installed in the current environment.
|
|
65
|
+
*
|
|
66
|
+
* Checks for .cursor/rules/cleo.mdc or .cursorrules with CLEO references.
|
|
67
|
+
*/
|
|
68
|
+
async isInstalled() {
|
|
69
|
+
const mdcPath = join(process.cwd(), '.cursor', 'rules', 'cleo.mdc');
|
|
70
|
+
if (existsSync(mdcPath)) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
const rulesPath = join(process.cwd(), '.cursorrules');
|
|
74
|
+
if (existsSync(rulesPath)) {
|
|
75
|
+
try {
|
|
76
|
+
const content = readFileSync(rulesPath, 'utf-8');
|
|
77
|
+
if (INSTRUCTION_REFERENCES.some((ref) => content.includes(ref))) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Fall through
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Ensure instruction files contain @-references to CLEO.
|
|
89
|
+
*
|
|
90
|
+
* Updates .cursorrules (legacy) and creates .cursor/rules/cleo.mdc (modern).
|
|
91
|
+
*
|
|
92
|
+
* @param projectDir - Project root directory
|
|
93
|
+
*/
|
|
94
|
+
async ensureInstructionReferences(projectDir) {
|
|
95
|
+
this.updateInstructionFiles(projectDir);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Update instruction files with CLEO @-references.
|
|
99
|
+
*
|
|
100
|
+
* Handles both legacy (.cursorrules) and modern (.cursor/rules/cleo.mdc) formats.
|
|
101
|
+
*
|
|
102
|
+
* @returns true if any file was created or modified
|
|
103
|
+
*/
|
|
104
|
+
updateInstructionFiles(projectDir) {
|
|
105
|
+
let updated = false;
|
|
106
|
+
// Update legacy .cursorrules if it exists
|
|
107
|
+
if (this.updateLegacyRules(projectDir)) {
|
|
108
|
+
updated = true;
|
|
109
|
+
}
|
|
110
|
+
// Create/update modern .cursor/rules/cleo.mdc
|
|
111
|
+
if (this.updateModernRules(projectDir)) {
|
|
112
|
+
updated = true;
|
|
113
|
+
}
|
|
114
|
+
return updated;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Update legacy .cursorrules file with @-references.
|
|
118
|
+
* Only modifies the file if it already exists (does not create it).
|
|
119
|
+
*
|
|
120
|
+
* @returns true if the file was modified
|
|
121
|
+
*/
|
|
122
|
+
updateLegacyRules(projectDir) {
|
|
123
|
+
const rulesPath = join(projectDir, '.cursorrules');
|
|
124
|
+
if (!existsSync(rulesPath)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
let content = readFileSync(rulesPath, 'utf-8');
|
|
128
|
+
const missingRefs = INSTRUCTION_REFERENCES.filter((ref) => !content.includes(ref));
|
|
129
|
+
if (missingRefs.length === 0) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
const separator = content.endsWith('\n') ? '' : '\n';
|
|
133
|
+
content = content + separator + missingRefs.join('\n') + '\n';
|
|
134
|
+
writeFileSync(rulesPath, content, 'utf-8');
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Create or update .cursor/rules/cleo.mdc with CLEO references.
|
|
139
|
+
*
|
|
140
|
+
* MDC (Markdown Component) format is Cursor's modern rule file format.
|
|
141
|
+
* Each .mdc file in .cursor/rules/ is loaded as a rule set.
|
|
142
|
+
*
|
|
143
|
+
* @returns true if the file was created or modified
|
|
144
|
+
*/
|
|
145
|
+
updateModernRules(projectDir) {
|
|
146
|
+
const rulesDir = join(projectDir, '.cursor', 'rules');
|
|
147
|
+
const mdcPath = join(rulesDir, 'cleo.mdc');
|
|
148
|
+
const expectedContent = [
|
|
149
|
+
'---',
|
|
150
|
+
'description: CLEO task management protocol references',
|
|
151
|
+
'globs: "**/*"',
|
|
152
|
+
'alwaysApply: true',
|
|
153
|
+
'---',
|
|
154
|
+
'',
|
|
155
|
+
...INSTRUCTION_REFERENCES,
|
|
156
|
+
'',
|
|
157
|
+
].join('\n');
|
|
158
|
+
if (existsSync(mdcPath)) {
|
|
159
|
+
const existing = readFileSync(mdcPath, 'utf-8');
|
|
160
|
+
if (existing === expectedContent) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
mkdirSync(rulesDir, { recursive: true });
|
|
165
|
+
writeFileSync(mdcPath, expectedContent, 'utf-8');
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get list of instruction files that were updated.
|
|
170
|
+
*/
|
|
171
|
+
getUpdatedFileList(projectDir) {
|
|
172
|
+
const files = [];
|
|
173
|
+
if (existsSync(join(projectDir, '.cursorrules'))) {
|
|
174
|
+
files.push(join(projectDir, '.cursorrules'));
|
|
175
|
+
}
|
|
176
|
+
files.push(join(projectDir, '.cursor', 'rules', 'cleo.mdc'));
|
|
177
|
+
return files;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/providers/cursor/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,CAAC,sCAAsC,EAAE,yBAAyB,CAAC,CAAC;AAEnG;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,qBAAqB;IAChC;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,OAAuB;QACnC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAC/B,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC7C,IAAI,sBAAsB,GAAG,KAAK,CAAC;QACnC,MAAM,OAAO,GAA4B,EAAE,CAAC;QAE5C,qDAAqD;QACrD,sBAAsB,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACjE,IAAI,sBAAsB,EAAE,CAAC;YAC3B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACjE,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI;YACb,WAAW;YACX,sBAAsB;YACtB,OAAO;SACR,CAAC;IACJ,CAAC;IAED;;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YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAChD,IAAI,QAAQ,KAAK,eAAe,EAAE,CAAC;gBACjC,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACK,kBAAkB,CAAC,UAAkB;QAC3C,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YACjD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Spawn Provider
|
|
3
|
+
*
|
|
4
|
+
* Cursor is a GUI-based AI code editor and does not support
|
|
5
|
+
* CLI-based subagent spawning. This provider implements
|
|
6
|
+
* the AdapterSpawnProvider interface with appropriate rejections.
|
|
7
|
+
*
|
|
8
|
+
* @task T5240
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Spawn provider for Cursor.
|
|
12
|
+
*
|
|
13
|
+
* Cursor does not support subagent spawning via CLI. The adapter
|
|
14
|
+
* declares supportsSpawn: false in its capabilities. All methods
|
|
15
|
+
* either reject or return empty results.
|
|
16
|
+
*/
|
|
17
|
+
export class CursorSpawnProvider {
|
|
18
|
+
/**
|
|
19
|
+
* Check if Cursor supports spawning subagents.
|
|
20
|
+
*
|
|
21
|
+
* @returns false (Cursor does not support CLI spawning)
|
|
22
|
+
*/
|
|
23
|
+
async canSpawn() {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Attempt to spawn a subagent via Cursor.
|
|
28
|
+
*
|
|
29
|
+
* Always throws because Cursor does not support subagent spawning.
|
|
30
|
+
* Callers should check canSpawn() before calling this method.
|
|
31
|
+
*
|
|
32
|
+
* @param _context - Unused; spawning is not supported
|
|
33
|
+
* @throws Error explaining that Cursor does not support subagent spawning
|
|
34
|
+
*/
|
|
35
|
+
async spawn(_context) {
|
|
36
|
+
throw new Error('Cursor does not support subagent spawning. ' +
|
|
37
|
+
'Cursor is a GUI-based editor without CLI subagent capabilities. ' +
|
|
38
|
+
'Use a provider that supports spawning (e.g., Claude Code or OpenCode).');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* List running Cursor subagent processes.
|
|
42
|
+
*
|
|
43
|
+
* @returns Empty array (no processes can be spawned)
|
|
44
|
+
*/
|
|
45
|
+
async listRunning() {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Terminate a Cursor subagent process.
|
|
50
|
+
*
|
|
51
|
+
* No-op because Cursor cannot spawn processes.
|
|
52
|
+
*
|
|
53
|
+
* @param _instanceId - Unused; no processes to terminate
|
|
54
|
+
*/
|
|
55
|
+
async terminate(_instanceId) {
|
|
56
|
+
// No-op: Cursor does not spawn processes.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=spawn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../../src/providers/cursor/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IAC9B;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CAAC,QAAsB;QAChC,MAAM,IAAI,KAAK,CACb,6CAA6C;YAC3C,kEAAkE;YAClE,wEAAwE,CAC3E,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,SAAS,CAAC,WAAmB;QACjC,0CAA0C;IAC5C,CAAC;CACF"}
|