@elliotding/ai-agent-mcp 0.2.22 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +4 -1
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +7 -1
- package/dist/api/client.js.map +1 -1
- package/dist/client-adapters/codex-adapter.d.ts +1 -0
- package/dist/client-adapters/codex-adapter.d.ts.map +1 -1
- package/dist/client-adapters/codex-adapter.js +3 -0
- package/dist/client-adapters/codex-adapter.js.map +1 -1
- package/dist/client-adapters/cursor-adapter.d.ts +1 -0
- package/dist/client-adapters/cursor-adapter.d.ts.map +1 -1
- package/dist/client-adapters/cursor-adapter.js +3 -0
- package/dist/client-adapters/cursor-adapter.js.map +1 -1
- package/dist/client-adapters/index.d.ts +2 -0
- package/dist/client-adapters/index.d.ts.map +1 -1
- package/dist/client-adapters/index.js.map +1 -1
- package/dist/prompts/manager.d.ts +55 -0
- package/dist/prompts/manager.d.ts.map +1 -1
- package/dist/prompts/manager.js +196 -6
- package/dist/prompts/manager.js.map +1 -1
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/http.js +49 -2
- package/dist/server/http.js.map +1 -1
- package/dist/server/streamable-http.d.ts.map +1 -1
- package/dist/server/streamable-http.js +21 -0
- package/dist/server/streamable-http.js.map +1 -1
- package/dist/tools/manage-subscription.d.ts.map +1 -1
- package/dist/tools/manage-subscription.js +135 -24
- package/dist/tools/manage-subscription.js.map +1 -1
- package/dist/tools/query-usage-stats.d.ts +8 -0
- package/dist/tools/query-usage-stats.d.ts.map +1 -1
- package/dist/tools/query-usage-stats.js +26 -1
- package/dist/tools/query-usage-stats.js.map +1 -1
- package/dist/tools/resolve-prompt-content.d.ts.map +1 -1
- package/dist/tools/resolve-prompt-content.js +25 -0
- package/dist/tools/resolve-prompt-content.js.map +1 -1
- package/dist/tools/search-resources.d.ts +5 -0
- package/dist/tools/search-resources.d.ts.map +1 -1
- package/dist/tools/search-resources.js +52 -10
- package/dist/tools/search-resources.js.map +1 -1
- package/dist/tools/sync-resources.d.ts.map +1 -1
- package/dist/tools/sync-resources.js +171 -81
- package/dist/tools/sync-resources.js.map +1 -1
- package/dist/tools/uninstall-resource.d.ts.map +1 -1
- package/dist/tools/uninstall-resource.js +90 -20
- package/dist/tools/uninstall-resource.js.map +1 -1
- package/dist/types/tools.d.ts +55 -5
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/utils/codex-paths.d.ts +4 -0
- package/dist/utils/codex-paths.d.ts.map +1 -1
- package/dist/utils/codex-paths.js +7 -0
- package/dist/utils/codex-paths.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-prompt-content.js","sourceRoot":"","sources":["../../src/tools/resolve-prompt-content.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resolve-prompt-content.js","sourceRoot":"","sources":["../../src/tools/resolve-prompt-content.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBH,oDAiIC;AA/ID,2CAA6B;AAC7B,4CAAyC;AACzC,kDAAoD;AACpD,gDAA6C;AAC7C,4EAAuE;AACvE,gFAAuE;AACvE,oDAAkD;AAQ3C,KAAK,UAAU,oBAAoB,CACxC,MAAe;IAEf,MAAM,CAAC,GAAG,MAAoC,CAAC;IAC/C,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE;QACjF,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE;QACtB,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,WAAW,KAA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,EAAE,wBAAwB;IAC9B,WAAW,EACT,0GAA0G;QAC1G,2IAA2I;QAC3I,gFAAgF;QAChF,kFAAkF;QAClF,4GAA4G;QAC5G,uGAAuG;IACzG,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+DAA+D;aAC7E;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qDAAqD;aACnE;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qEAAqE;aACnF;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+CAA+C;aAC7D;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,mFAAmF;oBACnF,sGAAsG;oBACtG,kFAAkF;aACrF;SACF;KACF;IACD,OAAO,EAAE,oBAAoB;CAC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-resources.d.ts","sourceRoot":"","sources":["../../src/tools/search-resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"search-resources.d.ts","sourceRoot":"","sources":["../../src/tools/search-resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,KAAK,EAAyB,qBAAqB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA0D/F,wBAAsB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAkLjG;AAGD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC/B,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.searchResourcesTool = void 0;
|
|
8
8
|
exports.searchResources = searchResources;
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
9
10
|
const logger_1 = require("../utils/logger");
|
|
10
11
|
const client_1 = require("../api/client");
|
|
11
12
|
const manager_1 = require("../filesystem/manager");
|
|
@@ -13,6 +14,7 @@ const cursor_paths_js_1 = require("../utils/cursor-paths.js");
|
|
|
13
14
|
const errors_1 = require("../types/errors");
|
|
14
15
|
const search_1 = require("../search");
|
|
15
16
|
const index_js_1 = require("../prompts/index.js");
|
|
17
|
+
const index_js_2 = require("../config/index.js");
|
|
16
18
|
// Search coordinator singleton
|
|
17
19
|
const searchCoordinator = new search_1.SearchCoordinator();
|
|
18
20
|
// Simple in-memory cache
|
|
@@ -22,10 +24,14 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
|
|
22
24
|
* Generate cache key from search parameters
|
|
23
25
|
*/
|
|
24
26
|
function getCacheKey(params) {
|
|
27
|
+
const userToken = params.user_token ?? '';
|
|
25
28
|
return JSON.stringify({
|
|
26
29
|
team: params.team || '',
|
|
27
30
|
type: params.type || '',
|
|
28
31
|
keyword: params.keyword || '',
|
|
32
|
+
agent_profile: params.agent_profile || index_js_2.config.agentProfile || 'cursor',
|
|
33
|
+
user: userToken ? (0, crypto_1.createHash)('sha256').update(userToken).digest('hex').slice(0, 16) : '',
|
|
34
|
+
subscription_state_version: index_js_1.promptManager.getSubscriptionStateVersion(userToken),
|
|
29
35
|
});
|
|
30
36
|
}
|
|
31
37
|
/**
|
|
@@ -103,25 +109,54 @@ async function searchResources(params) {
|
|
|
103
109
|
// Normalize API resource names the same way buildPromptName does so the
|
|
104
110
|
// comparison is case/whitespace insensitive.
|
|
105
111
|
const normalizeResourceName = (name) => name.toLowerCase().replace(/\s+/g, '-');
|
|
112
|
+
// Resolve agent profile for is_installed check strategy.
|
|
113
|
+
const resolvedSearchProfile = typedParams.agent_profile ?? index_js_2.config.agentProfile ?? 'cursor';
|
|
106
114
|
// Check subscription and installation status for each result
|
|
107
115
|
const finalResults = await Promise.all(enhancedResults.map(async (resource) => {
|
|
108
|
-
|
|
116
|
+
const normalizedName = normalizeResourceName(resource.name);
|
|
117
|
+
const locallySubscribed = localSubscribedNames.has(normalizedName);
|
|
118
|
+
const locallySuppressed = index_js_1.promptManager.isSubscriptionSuppressed(userToken, resource.id);
|
|
119
|
+
const isSubscribed = locallySuppressed
|
|
120
|
+
? locallySubscribed
|
|
121
|
+
: locallySubscribed || Boolean(resource.is_subscribed);
|
|
122
|
+
// Check if installed locally.
|
|
123
|
+
//
|
|
124
|
+
// Cursor: check the local filesystem path (server-side filesystem matches
|
|
125
|
+
// the user's machine when running as a local stdio MCP).
|
|
126
|
+
//
|
|
127
|
+
// Codex: commands are prompt-only, but skills/rules/MCP installs may
|
|
128
|
+
// still have pending local_actions_required that were cached for the
|
|
129
|
+
// setup prompt and not yet consumed. Treat those resources as NOT
|
|
130
|
+
// installed until pending setup is cleared; otherwise use the best
|
|
131
|
+
// available subscription/prompt signal.
|
|
109
132
|
let isInstalled = false;
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
133
|
+
if (resolvedSearchProfile === 'codex') {
|
|
134
|
+
const hasPendingSetup = index_js_1.promptManager.hasPendingSyncActionsForResource(userToken, resource.name);
|
|
135
|
+
if (resource.type === 'command') {
|
|
136
|
+
isInstalled = isSubscribed;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
isInstalled = isSubscribed && !hasPendingSetup;
|
|
140
|
+
}
|
|
113
141
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
142
|
+
else {
|
|
143
|
+
try {
|
|
144
|
+
const resourcePath = (0, cursor_paths_js_1.getCursorResourcePath)(resource.type, resource.name);
|
|
145
|
+
isInstalled = await manager_1.filesystemManager.fileExists(resourcePath);
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// Unknown type or path check failed — treat as not installed
|
|
149
|
+
isInstalled = false;
|
|
150
|
+
}
|
|
117
151
|
}
|
|
118
152
|
// Override is_subscribed with the local promptManager state.
|
|
119
153
|
// Local state is authoritative: if the prompt is registered in-memory,
|
|
120
154
|
// the resource is definitely subscribed regardless of the API response.
|
|
121
|
-
const locallySubscribed = localSubscribedNames.has(normalizeResourceName(resource.name));
|
|
122
|
-
const isSubscribed = locallySubscribed || Boolean(resource.is_subscribed);
|
|
123
155
|
if (locallySubscribed && !resource.is_subscribed) {
|
|
124
|
-
logger_1.logger.debug({ resourceName: resource.name, normalizedName
|
|
156
|
+
logger_1.logger.debug({ resourceName: resource.name, normalizedName, apiIsSubscribed: resource.is_subscribed }, 'search_resources: overriding is_subscribed=false from API with local promptManager state (true)');
|
|
157
|
+
}
|
|
158
|
+
if (locallySuppressed && resource.is_subscribed && !locallySubscribed) {
|
|
159
|
+
logger_1.logger.debug({ resourceName: resource.name, resourceId: resource.id }, 'search_resources: overriding is_subscribed=true from API with local unsubscribe suppression (false)');
|
|
125
160
|
}
|
|
126
161
|
return {
|
|
127
162
|
...resource,
|
|
@@ -182,6 +217,13 @@ exports.searchResourcesTool = {
|
|
|
182
217
|
type: 'string',
|
|
183
218
|
description: 'Search keyword (searches in name, description, tags)',
|
|
184
219
|
},
|
|
220
|
+
agent_profile: {
|
|
221
|
+
type: 'string',
|
|
222
|
+
description: 'AI client profile: "cursor" (default) or "codex". ' +
|
|
223
|
+
'Affects is_installed detection strategy: Cursor checks local filesystem paths; ' +
|
|
224
|
+
'Codex uses prompt-registry membership (remote MCP cannot access user filesystem).',
|
|
225
|
+
enum: ['cursor', 'codex'],
|
|
226
|
+
},
|
|
185
227
|
user_token: {
|
|
186
228
|
type: 'string',
|
|
187
229
|
description: 'DO NOT set this field — it is automatically injected by the MCP server from ' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-resources.js","sourceRoot":"","sources":["../../src/tools/search-resources.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"search-resources.js","sourceRoot":"","sources":["../../src/tools/search-resources.ts"],"names":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;SACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,+BAA+B;AAClB,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,0DAA0D;IACvE,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oCAAoC;aAClD;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yBAAyB;gBACtC,IAAI,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;aAC9C;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sDAAsD;aACpE;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,oDAAoD;oBACpD,iFAAiF;oBACjF,mFAAmF;gBACrF,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;aAC1B;YACD,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,8EAA8E;oBAC9E,iFAAiF;aACpF;SACF;QACD,QAAQ,EAAE,CAAC,SAAS,CAAC;KACtB;IACD,OAAO,EAAE,eAAe;CACzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-resources.d.ts","sourceRoot":"","sources":["../../src/tools/sync-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"sync-resources.d.ts","sourceRoot":"","sources":["../../src/tools/sync-resources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH,OAAO,KAAK,EAEV,mBAAmB,EAEnB,UAAU,EACX,MAAM,gBAAgB,CAAC;AA2PxB,wBAAsB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAgrC7F;AAGD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8J7B,CAAC"}
|
|
@@ -142,6 +142,36 @@ function encodeForRender(filePath, rawContent, priorEncoding) {
|
|
|
142
142
|
encoding: 'base64',
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
|
+
function codexMcpUrl(url) {
|
|
146
|
+
// Codex consumes Streamable HTTP MCP endpoints. Server-side MCP resource
|
|
147
|
+
// packages may still ship Cursor/SSE URLs for backward compatibility.
|
|
148
|
+
return url.replace(/\/sse\/?$/, '/mcp');
|
|
149
|
+
}
|
|
150
|
+
function toCodexMcpTomlEntry(entry) {
|
|
151
|
+
const converted = { ...entry };
|
|
152
|
+
if (typeof converted.url === 'string') {
|
|
153
|
+
converted.url = codexMcpUrl(converted.url);
|
|
154
|
+
}
|
|
155
|
+
if (converted.headers && !converted.http_headers) {
|
|
156
|
+
converted.http_headers = converted.headers;
|
|
157
|
+
delete converted.headers;
|
|
158
|
+
}
|
|
159
|
+
// Codex infers HTTP MCP transport from `url`; keeping Cursor's `sse`
|
|
160
|
+
// transport marker in config.toml makes the generated config misleading.
|
|
161
|
+
if (converted.transport === 'sse' || converted.transport === 'streamable_http' || converted.transport === 'streamable-http') {
|
|
162
|
+
delete converted.transport;
|
|
163
|
+
}
|
|
164
|
+
return converted;
|
|
165
|
+
}
|
|
166
|
+
function queueCodexMcpTomlAction(localActions, tomlPath, serverName, entry) {
|
|
167
|
+
localActions.push({
|
|
168
|
+
action: 'merge_toml',
|
|
169
|
+
toml_path: tomlPath,
|
|
170
|
+
key: `mcp_servers.${serverName}`,
|
|
171
|
+
value: toCodexMcpTomlEntry(entry),
|
|
172
|
+
overwrite: false,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
145
175
|
/**
|
|
146
176
|
* Same as encodeForRender, but produces the field shape required by
|
|
147
177
|
* CheckFileAction (`expected_content` + a sibling encoding hint stored as
|
|
@@ -155,6 +185,52 @@ function encodeForCheck(filePath, rawContent, priorEncoding) {
|
|
|
155
185
|
expected_content_encoding: enc.encoding,
|
|
156
186
|
};
|
|
157
187
|
}
|
|
188
|
+
async function loadPromptResourceFiles(resourceId, resourceName, resourceType, userToken) {
|
|
189
|
+
const downloadResult = await client_1.apiClient.downloadResource(resourceId, userToken);
|
|
190
|
+
if (downloadResult.files.length > 0) {
|
|
191
|
+
return downloadResult.files;
|
|
192
|
+
}
|
|
193
|
+
return multi_source_manager_1.multiSourceGitManager.readResourceFiles(resourceName, resourceType);
|
|
194
|
+
}
|
|
195
|
+
function getPrimaryPromptFile(sourceFiles, resourceName, isSkill) {
|
|
196
|
+
return isSkill
|
|
197
|
+
? (sourceFiles.find((f) => path.basename(f.path) === 'SKILL.md') ??
|
|
198
|
+
sourceFiles.find((f) => f.path.endsWith('.md')) ??
|
|
199
|
+
sourceFiles[0])
|
|
200
|
+
: (sourceFiles.find((f) => path.basename(f.path).replace(/\.md$/, '') === resourceName) ??
|
|
201
|
+
sourceFiles.find((f) => f.path.endsWith('.md')) ??
|
|
202
|
+
sourceFiles[0]);
|
|
203
|
+
}
|
|
204
|
+
function getLocalScriptFiles(sourceFiles) {
|
|
205
|
+
return sourceFiles.filter(f => !f.path.endsWith('.md') &&
|
|
206
|
+
f.path !== 'SKILL.md' &&
|
|
207
|
+
!f.path.endsWith('/SKILL.md'));
|
|
208
|
+
}
|
|
209
|
+
function queueComplexSkillCheckActions(localActions, clientAdapter, resourceId, resourceName, scriptFiles, manifestContent) {
|
|
210
|
+
if (scriptFiles.length === 0) {
|
|
211
|
+
return 0;
|
|
212
|
+
}
|
|
213
|
+
const skillDir = clientAdapter.getSkillDir(resourceName);
|
|
214
|
+
for (const scriptFile of scriptFiles) {
|
|
215
|
+
localActions.push({
|
|
216
|
+
action: 'check_file',
|
|
217
|
+
path: `${skillDir}/${scriptFile.path}`,
|
|
218
|
+
...encodeForCheck(scriptFile.path, scriptFile.content, scriptFile.encoding),
|
|
219
|
+
resource_id: resourceId,
|
|
220
|
+
resource_name: resourceName,
|
|
221
|
+
resource_type: 'skill',
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
localActions.push({
|
|
225
|
+
action: 'check_file',
|
|
226
|
+
path: `${clientAdapter.getManifestDir()}/${resourceName}.md`,
|
|
227
|
+
...encodeForCheck('SKILL.md', manifestContent),
|
|
228
|
+
resource_id: resourceId,
|
|
229
|
+
resource_name: resourceName,
|
|
230
|
+
resource_type: 'skill',
|
|
231
|
+
});
|
|
232
|
+
return scriptFiles.length + 1;
|
|
233
|
+
}
|
|
158
234
|
async function syncResources(params) {
|
|
159
235
|
const startTime = Date.now();
|
|
160
236
|
const typedParams = params;
|
|
@@ -218,16 +294,21 @@ async function syncResources(params) {
|
|
|
218
294
|
(0, logger_1.logToolStep)('sync_resources', 'Step 1: Fetching subscriptions from API', { scope, types });
|
|
219
295
|
const t1 = Date.now();
|
|
220
296
|
const allSubscriptions = await client_1.apiClient.getSubscriptions({ types }, userToken);
|
|
297
|
+
const visibleAllSubscriptions = {
|
|
298
|
+
...allSubscriptions,
|
|
299
|
+
subscriptions: index_js_2.promptManager.filterSuppressedSubscriptions(userToken ?? '', allSubscriptions.subscriptions),
|
|
300
|
+
};
|
|
301
|
+
visibleAllSubscriptions.total = visibleAllSubscriptions.subscriptions.length;
|
|
221
302
|
// Apply resource_ids filter if provided — only process the specified resources.
|
|
222
303
|
// This is done client-side: the subscription list API has no resource_ids filter,
|
|
223
304
|
// but downloadResource(id) is already a single-resource endpoint so per-resource
|
|
224
305
|
// processing is efficient regardless.
|
|
225
306
|
const subscriptions = resourceIds
|
|
226
307
|
? {
|
|
227
|
-
total:
|
|
228
|
-
subscriptions:
|
|
308
|
+
total: visibleAllSubscriptions.subscriptions.filter(s => resourceIds.has(s.id)).length,
|
|
309
|
+
subscriptions: visibleAllSubscriptions.subscriptions.filter(s => resourceIds.has(s.id)),
|
|
229
310
|
}
|
|
230
|
-
:
|
|
311
|
+
: visibleAllSubscriptions;
|
|
231
312
|
(0, logger_1.logToolStep)('sync_resources', 'Subscriptions fetched', {
|
|
232
313
|
totalFromApi: allSubscriptions.total,
|
|
233
314
|
afterFilter: subscriptions.total,
|
|
@@ -306,47 +387,34 @@ async function syncResources(params) {
|
|
|
306
387
|
};
|
|
307
388
|
const isRegistered = index_js_2.promptManager.has(index_js_2.promptManager.buildPromptName(meta), userToken ?? '');
|
|
308
389
|
if (isRegistered) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
//
|
|
312
|
-
//
|
|
313
|
-
//
|
|
390
|
+
let checkAction = 'cached';
|
|
391
|
+
// Complex skills need local script and manifest checks in the
|
|
392
|
+
// active client subtree. Use the same API/Git source-file path
|
|
393
|
+
// as incremental sync; Git metadata alone misses API-backed
|
|
394
|
+
// skills such as zoom-build and can falsely report "cached".
|
|
314
395
|
if (sub.type === 'skill') {
|
|
315
396
|
try {
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
|
|
397
|
+
const sourceFiles = await loadPromptResourceFiles(sub.id, sub.name, sub.type, userToken);
|
|
398
|
+
const scriptFiles = getLocalScriptFiles(sourceFiles);
|
|
399
|
+
const primaryFile = getPrimaryPromptFile(sourceFiles, sub.name, true);
|
|
400
|
+
const actionCount = queueComplexSkillCheckActions(localActions, clientAdapter, sub.id, sub.name, scriptFiles, primaryFile?.content ?? '');
|
|
401
|
+
if (actionCount > 0) {
|
|
402
|
+
checkAction = 'failed';
|
|
403
|
+
(0, logger_1.logToolStep)('sync_resources', 'Complex skill check actions queued for AI Agent', {
|
|
319
404
|
resourceId: sub.id,
|
|
320
|
-
scriptCount:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const skillDir = `${(0, cursor_paths_1.getCspAgentDirForClient)('skills')}/${sub.name}`;
|
|
324
|
-
for (const scriptFile of metadata.script_files) {
|
|
325
|
-
localActions.push({
|
|
326
|
-
action: 'check_file',
|
|
327
|
-
path: `${skillDir}/${scriptFile.relative_path}`,
|
|
328
|
-
...encodeForCheck(scriptFile.relative_path, scriptFile.content, scriptFile.encoding),
|
|
329
|
-
resource_id: sub.id,
|
|
330
|
-
resource_name: sub.name,
|
|
331
|
-
resource_type: sub.type,
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
// Also check the manifest file
|
|
335
|
-
const proxyScript = metadata.script_files[0];
|
|
336
|
-
localActions.push({
|
|
337
|
-
action: 'check_file',
|
|
338
|
-
path: `${(0, cursor_paths_1.getCspAgentRootDirForClient)()}/.manifests/${sub.name}.md`,
|
|
339
|
-
...encodeForCheck(proxyScript?.relative_path ?? '', proxyScript?.content ?? '', proxyScript?.encoding), // Use first script as proxy
|
|
340
|
-
resource_id: sub.id,
|
|
341
|
-
resource_name: sub.name,
|
|
342
|
-
resource_type: sub.type,
|
|
405
|
+
scriptCount: scriptFiles.length,
|
|
406
|
+
manifestPath: `${clientAdapter.getManifestDir()}/${sub.name}.md`,
|
|
407
|
+
actionCount,
|
|
343
408
|
});
|
|
344
409
|
}
|
|
345
410
|
}
|
|
346
|
-
catch {
|
|
347
|
-
|
|
411
|
+
catch (err) {
|
|
412
|
+
checkAction = 'failed';
|
|
413
|
+
logger_1.logger.warn({ resourceId: sub.id, resourceName: sub.name, error: err.message }, 'Failed to prepare complex skill local checks');
|
|
348
414
|
}
|
|
349
415
|
}
|
|
416
|
+
tally[checkAction]++;
|
|
417
|
+
details.push({ id: sub.id, name: sub.name, action: checkAction, version: resourceVersion });
|
|
350
418
|
}
|
|
351
419
|
else {
|
|
352
420
|
tally.failed++;
|
|
@@ -437,12 +505,14 @@ async function syncResources(params) {
|
|
|
437
505
|
});
|
|
438
506
|
}
|
|
439
507
|
}
|
|
440
|
-
//
|
|
441
|
-
|
|
508
|
+
// Server cannot access the user's local filesystem. Once
|
|
509
|
+
// check_file actions are queued, report the resource as failed
|
|
510
|
+
// until the Agent executes those checks and observes matches.
|
|
511
|
+
tally.failed++;
|
|
442
512
|
details.push({
|
|
443
513
|
id: sub.id,
|
|
444
514
|
name: sub.name,
|
|
445
|
-
action: '
|
|
515
|
+
action: 'failed',
|
|
446
516
|
version: resourceVersion,
|
|
447
517
|
});
|
|
448
518
|
(0, logger_1.logToolStep)('sync_resources', 'Check actions queued for AI Agent', {
|
|
@@ -494,13 +564,7 @@ async function syncResources(params) {
|
|
|
494
564
|
// - command: prefer the file whose name matches the resource name
|
|
495
565
|
// - fallback: first .md file, then first file of any type
|
|
496
566
|
const isSkill = sub.type === 'skill';
|
|
497
|
-
const primaryFile = isSkill
|
|
498
|
-
? (sourceFiles.find((f) => path.basename(f.path) === 'SKILL.md') ??
|
|
499
|
-
sourceFiles.find((f) => f.path.endsWith('.md')) ??
|
|
500
|
-
sourceFiles[0])
|
|
501
|
-
: (sourceFiles.find((f) => path.basename(f.path).replace(/\.md$/, '') === sub.name) ??
|
|
502
|
-
sourceFiles.find((f) => f.path.endsWith('.md')) ??
|
|
503
|
-
sourceFiles[0]);
|
|
567
|
+
const primaryFile = getPrimaryPromptFile(sourceFiles, sub.name, isSkill);
|
|
504
568
|
const rawContent = primaryFile?.content ?? '';
|
|
505
569
|
// Extract description from frontmatter (---\ndescription: ...\n---)
|
|
506
570
|
// falling back to the subscription's description field or resource name.
|
|
@@ -537,9 +601,7 @@ async function syncResources(params) {
|
|
|
537
601
|
// WHY: zoom-build and other complex skills are NOT in git but ARE in API response
|
|
538
602
|
try {
|
|
539
603
|
// Filter out markdown files from sourceFiles to identify scripts
|
|
540
|
-
const scriptFiles = sourceFiles
|
|
541
|
-
f.path !== 'SKILL.md' &&
|
|
542
|
-
!f.path.endsWith('/SKILL.md'));
|
|
604
|
+
const scriptFiles = getLocalScriptFiles(sourceFiles);
|
|
543
605
|
if (scriptFiles.length > 0) {
|
|
544
606
|
// Complex skill detected via API download
|
|
545
607
|
(0, logger_1.logToolStep)('sync_resources', 'Complex skill detected (via API) — generating local actions', {
|
|
@@ -547,10 +609,15 @@ async function syncResources(params) {
|
|
|
547
609
|
scriptCount: scriptFiles.length,
|
|
548
610
|
source: 'API',
|
|
549
611
|
});
|
|
550
|
-
// Use
|
|
551
|
-
//
|
|
552
|
-
//
|
|
553
|
-
|
|
612
|
+
// Use client-adapter-resolved directory so Cursor and Codex each get
|
|
613
|
+
// their own isolated subtree:
|
|
614
|
+
// Cursor → ~/.csp-ai-agent/skills/<name>/
|
|
615
|
+
// Codex → ~/.csp-ai-agent/codex/skills/<name>/
|
|
616
|
+
// SKILL.md is NOT downloaded — only scripts are cached locally.
|
|
617
|
+
// This prevents the client from auto-discovering the skill while
|
|
618
|
+
// enabling script execution.
|
|
619
|
+
const skillDir = clientAdapter.getSkillDir(sub.name);
|
|
620
|
+
const manifestPath = `${clientAdapter.getManifestDir()}/${sub.name}.md`;
|
|
554
621
|
// Generate write_file actions for script files ONLY (exclude SKILL.md)
|
|
555
622
|
// First script file carries is_skill_manifest marker for atomic update check
|
|
556
623
|
// 1. First script file (with manifest check marker)
|
|
@@ -563,9 +630,10 @@ async function syncResources(params) {
|
|
|
563
630
|
action: 'write_file',
|
|
564
631
|
path: `${skillDir}/${firstScript.path}`,
|
|
565
632
|
...encodeForRender(firstScript.path, firstScript.content),
|
|
566
|
-
mode: firstScript.path.includes('
|
|
633
|
+
mode: firstScript.path.includes('scripts/') ? '0755' : undefined,
|
|
567
634
|
// Atomic update marker: client checks manifest FIRST
|
|
568
635
|
is_skill_manifest: true,
|
|
636
|
+
manifest_path: manifestPath,
|
|
569
637
|
// SKILL.md content for version comparison (stored separately in .manifests/)
|
|
570
638
|
skill_manifest_content: Buffer.from(rawContent, "utf8").toString("base64"),
|
|
571
639
|
});
|
|
@@ -579,7 +647,7 @@ async function syncResources(params) {
|
|
|
579
647
|
action: 'write_file',
|
|
580
648
|
path: `${skillDir}/${scriptFile.path}`,
|
|
581
649
|
...encodeForRender(scriptFile.path, scriptFile.content),
|
|
582
|
-
mode: scriptFile.path.includes('
|
|
650
|
+
mode: scriptFile.path.includes('scripts/') ? '0755' : undefined,
|
|
583
651
|
});
|
|
584
652
|
}
|
|
585
653
|
(0, logger_1.logToolStep)('sync_resources', 'Script files added to local_actions_required (SKILL.md excluded)', {
|
|
@@ -598,7 +666,9 @@ async function syncResources(params) {
|
|
|
598
666
|
scriptCount: metadata.script_files.length,
|
|
599
667
|
source: 'Git',
|
|
600
668
|
});
|
|
601
|
-
|
|
669
|
+
// Use client-adapter-resolved directory (Cursor vs Codex subtree).
|
|
670
|
+
const skillDir = clientAdapter.getSkillDir(sub.name);
|
|
671
|
+
const manifestPath = `${clientAdapter.getManifestDir()}/${sub.name}.md`;
|
|
602
672
|
if (metadata.script_files.length > 0) {
|
|
603
673
|
const firstScript = metadata.script_files[0];
|
|
604
674
|
if (!firstScript) {
|
|
@@ -609,8 +679,9 @@ async function syncResources(params) {
|
|
|
609
679
|
action: 'write_file',
|
|
610
680
|
path: `${skillDir}/${firstScript.relative_path}`,
|
|
611
681
|
...encodeForRender(firstScript.relative_path, firstScript.content, firstScript.encoding),
|
|
612
|
-
mode: firstScript.mode,
|
|
682
|
+
mode: firstScript.mode ?? (firstScript.relative_path.includes('scripts/') ? '0755' : undefined),
|
|
613
683
|
is_skill_manifest: true,
|
|
684
|
+
manifest_path: manifestPath,
|
|
614
685
|
skill_manifest_content: Buffer.from(rawContent, "utf8").toString("base64"),
|
|
615
686
|
});
|
|
616
687
|
}
|
|
@@ -622,7 +693,7 @@ async function syncResources(params) {
|
|
|
622
693
|
action: 'write_file',
|
|
623
694
|
path: `${skillDir}/${scriptFile.relative_path}`,
|
|
624
695
|
...encodeForRender(scriptFile.relative_path, scriptFile.content, scriptFile.encoding),
|
|
625
|
-
mode: scriptFile.mode,
|
|
696
|
+
mode: scriptFile.mode ?? (scriptFile.relative_path.includes('scripts/') ? '0755' : undefined),
|
|
626
697
|
});
|
|
627
698
|
}
|
|
628
699
|
}
|
|
@@ -800,20 +871,28 @@ async function syncResources(params) {
|
|
|
800
871
|
if (resolvedProfile === 'codex') {
|
|
801
872
|
// ── Codex MCP: inject server entry into config.toml via merge_toml ──
|
|
802
873
|
// The Codex CLI reads MCP server configuration from ~/.codex/config.toml.
|
|
803
|
-
//
|
|
804
|
-
//
|
|
805
|
-
//
|
|
874
|
+
// Format A becomes [mcp_servers.<name>]. Format B emits one
|
|
875
|
+
// table per remote server entry. URL entries are normalised from
|
|
876
|
+
// Cursor/SSE (`/sse`) to Codex Streamable HTTP (`/mcp`).
|
|
806
877
|
const tomlPath = clientAdapter.getMcpConfigPath();
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
878
|
+
const queuedServers = [];
|
|
879
|
+
if (typeof cfg['command'] === 'string') {
|
|
880
|
+
const serverName = cfg['name'] ?? sub.name;
|
|
881
|
+
queueCodexMcpTomlAction(localActions, tomlPath, serverName, cfg);
|
|
882
|
+
queuedServers.push(serverName);
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
for (const [serverName, entry] of Object.entries(cfg)) {
|
|
886
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
887
|
+
logger_1.logger.warn({ resourceId: sub.id, resourceName: sub.name, serverName }, 'sync_resources: skipping invalid Codex MCP config entry');
|
|
888
|
+
continue;
|
|
889
|
+
}
|
|
890
|
+
queueCodexMcpTomlAction(localActions, tomlPath, serverName, entry);
|
|
891
|
+
queuedServers.push(serverName);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
logger_1.logger.info({ resourceId: sub.id, resourceName: sub.name, serverKeys: queuedServers, tomlPath, profile: 'codex' }, 'sync_resources: Codex MCP — merge_toml action queued');
|
|
895
|
+
(0, logger_1.logToolStep)('sync_resources', 'Codex MCP: merge_toml queued', { resourceId: sub.id, serverKeys: queuedServers });
|
|
817
896
|
}
|
|
818
897
|
else if (typeof cfg['command'] === 'string') {
|
|
819
898
|
// ── Format A: local executable ──────────────────────────────────
|
|
@@ -900,13 +979,7 @@ async function syncResources(params) {
|
|
|
900
979
|
if (resolvedProfile === 'codex') {
|
|
901
980
|
// Codex: emit a bare merge_toml with minimal entry
|
|
902
981
|
const tomlPath = clientAdapter.getMcpConfigPath();
|
|
903
|
-
localActions.
|
|
904
|
-
action: 'merge_toml',
|
|
905
|
-
toml_path: tomlPath,
|
|
906
|
-
key: `mcp.servers.${sub.name}`,
|
|
907
|
-
value: JSON.stringify({ command: 'node', args: [] }),
|
|
908
|
-
overwrite: false,
|
|
909
|
-
});
|
|
982
|
+
queueCodexMcpTomlAction(localActions, tomlPath, sub.name, { command: 'node', args: [] });
|
|
910
983
|
logger_1.logger.info({ resourceId: sub.id, resourceName: sub.name, tomlPath, profile: 'codex' }, 'sync_resources: Codex MCP heuristic — merge_toml action queued (no mcp-config.json)');
|
|
911
984
|
}
|
|
912
985
|
else {
|
|
@@ -1078,7 +1151,9 @@ async function syncResources(params) {
|
|
|
1078
1151
|
content: policyContent,
|
|
1079
1152
|
encoding: 'utf8',
|
|
1080
1153
|
});
|
|
1081
|
-
// 2. Inject the policy file reference into developer_instructions
|
|
1154
|
+
// 2. Inject the policy file reference into developer_instructions.
|
|
1155
|
+
// overwrite: false keeps this action idempotent after the first
|
|
1156
|
+
// successful setup, so restart hints do not force a re-apply loop.
|
|
1082
1157
|
localActions.push({
|
|
1083
1158
|
action: 'merge_toml',
|
|
1084
1159
|
toml_path: tomlPath,
|
|
@@ -1098,12 +1173,27 @@ async function syncResources(params) {
|
|
|
1098
1173
|
const healthScore = tally.total > 0
|
|
1099
1174
|
? Math.round(((tally.synced + tally.cached + tally.skipped) / tally.total) * 100)
|
|
1100
1175
|
: 100;
|
|
1176
|
+
const pendingSetup = localActions.flatMap((action) => {
|
|
1177
|
+
if (action.action !== 'merge_mcp_json' || !action.missing_env || action.missing_env.length === 0) {
|
|
1178
|
+
return [];
|
|
1179
|
+
}
|
|
1180
|
+
return [{
|
|
1181
|
+
server_name: action.server_name,
|
|
1182
|
+
mcp_json_path: action.mcp_json_path,
|
|
1183
|
+
missing_env: action.missing_env,
|
|
1184
|
+
command_needs_verification: typeof action.entry.command === 'string',
|
|
1185
|
+
command: typeof action.entry.command === 'string' ? action.entry.command : '',
|
|
1186
|
+
setup_hint: action.setup_hint ?? `Fill in env vars for MCP server "${action.server_name}".`,
|
|
1187
|
+
...(action.setup_doc ? { setup_doc: action.setup_doc } : {}),
|
|
1188
|
+
}];
|
|
1189
|
+
});
|
|
1101
1190
|
const result = {
|
|
1102
1191
|
mode,
|
|
1103
1192
|
health_score: healthScore,
|
|
1104
1193
|
summary: tally,
|
|
1105
1194
|
details,
|
|
1106
1195
|
...(skippedResources.length > 0 ? { skipped_resources: skippedResources } : {}),
|
|
1196
|
+
...(pendingSetup.length > 0 ? { pending_setup: pendingSetup } : {}),
|
|
1107
1197
|
...(localActions.length > 0 ? { local_actions_required: localActions } : {}),
|
|
1108
1198
|
...(restartRequired ? { restart_required: true, restart_hint: restartHint } : {}),
|
|
1109
1199
|
};
|
|
@@ -1229,7 +1319,7 @@ exports.syncResourcesTool = {
|
|
|
1229
1319
|
'For write_file actions: ' +
|
|
1230
1320
|
' SPECIAL HANDLING FOR COMPLEX SKILLS (when action has `is_skill_manifest: true`): ' +
|
|
1231
1321
|
' (1) This action is the FIRST script file — check skill version using manifest FIRST. ' +
|
|
1232
|
-
' (2) Read manifest file at {CSP_AGENT_ROOT}/.manifests/<skill-name>.md
|
|
1322
|
+
' (2) Read manifest file at action.manifest_path when present; otherwise read {CSP_AGENT_ROOT}/.manifests/<skill-name>.md. ' +
|
|
1233
1323
|
' Where {CSP_AGENT_ROOT} is a SIBLING of {CURSOR_ROOT} (same parent directory). ' +
|
|
1234
1324
|
' (3) action.skill_manifest_content is ALWAYS base64-encoded — first decode it: ' +
|
|
1235
1325
|
' decodedManifest = Buffer.from(action.skill_manifest_content, "base64").toString("utf8") ' +
|
|
@@ -1238,7 +1328,7 @@ exports.syncResourcesTool = {
|
|
|
1238
1328
|
' (5) If different or manifest missing: ' +
|
|
1239
1329
|
' - PROCEED with this action and all subsequent write_file actions for this skill. ' +
|
|
1240
1330
|
' - After writing all script files, write decodedManifest (the UTF-8 form, NOT the raw base64 string) ' +
|
|
1241
|
-
' to {CSP_AGENT_ROOT}/.manifests/<skill-name>.md ' +
|
|
1331
|
+
' to action.manifest_path when present, otherwise {CSP_AGENT_ROOT}/.manifests/<skill-name>.md ' +
|
|
1242
1332
|
' (6) NOTE: SKILL.md is NEVER written to the skills directory (only to .manifests/) to prevent Cursor auto-discovery. ' +
|
|
1243
1333
|
' GENERAL HANDLING (when action has NO `is_skill_manifest` marker): ' +
|
|
1244
1334
|
' (1) Read the existing file at `path` (if it exists) using fs.readFile() or equivalent. ' +
|