@lifesi/genesis-mcp 0.1.2 → 0.1.3
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.
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Genesis } from '@lifesi/genesis';
|
|
2
|
+
/** Native and meta-tool dispatch share the typed no-replay Marketplace transport. */
|
|
3
|
+
export declare function callHivesMarketplaceTool(g: Genesis, id: string, a: Record<string, unknown>, signal?: AbortSignal): Promise<unknown>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function text(value) { if (typeof value !== 'string')
|
|
2
|
+
throw new Error('Invalid Hives Marketplace input.'); return value; }
|
|
3
|
+
/** Native and meta-tool dispatch share the typed no-replay Marketplace transport. */
|
|
4
|
+
export async function callHivesMarketplaceTool(g, id, a, signal) {
|
|
5
|
+
const m = g.hives.marketplace;
|
|
6
|
+
const p = text(a.project_id);
|
|
7
|
+
const options = { signal };
|
|
8
|
+
switch (id) {
|
|
9
|
+
case 'hives_marketplace_list_packages': return m.list(p, { q: a.q, category: a.category, free_only: a.free_only, verified_only: a.verified_only,
|
|
10
|
+
sort: a.sort, order: a.order, page: a.page, page_size: a.page_size }, options);
|
|
11
|
+
case 'hives_marketplace_get_package': return m.get(p, text(a.slug), { version: a.version }, options);
|
|
12
|
+
case 'hives_marketplace_list_versions': return m.versions(p, text(a.slug), { page: a.page, page_size: a.page_size }, options);
|
|
13
|
+
case 'hives_marketplace_categories': return m.categories(p, options);
|
|
14
|
+
case 'hives_marketplace_featured': return m.featured(p, options);
|
|
15
|
+
case 'hives_marketplace_publish': return m.publish(p, a.body, options);
|
|
16
|
+
case 'hives_marketplace_install': return m.install(p, text(a.slug), a.body, options);
|
|
17
|
+
case 'hives_marketplace_update': return m.update(p, text(a.slug), a.body, options);
|
|
18
|
+
case 'hives_marketplace_installed': return m.installed(p, { page: a.page, page_size: a.page_size }, options);
|
|
19
|
+
case 'hives_marketplace_get_installation': return m.getInstallation(p, text(a.installation_id), options);
|
|
20
|
+
case 'hives_marketplace_reconcile': return m.reconcile(p, text(a.installation_id), options);
|
|
21
|
+
case 'hives_marketplace_uninstall': return m.uninstall(p, text(a.installation_id), options);
|
|
22
|
+
default: throw new Error('Unknown Hives Marketplace operation.');
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/hives-resources.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { callHivesMarketplaceTool } from './hives-marketplace.js';
|
|
1
2
|
const OBJECT_BYTES = 10 * 1024 * 1024;
|
|
2
3
|
const keyProperties = { project_id: { type: 'string' }, bucket_id: { type: 'string' }, key: { type: 'string', minLength: 1, maxLength: 1024 } };
|
|
3
4
|
/** Binary data and plain keys are explicitly encoded for the actual native object API. */
|
|
@@ -7,7 +8,7 @@ export function hivesResourceInputSchema(id, fallback) {
|
|
|
7
8
|
const upload = id.startsWith('hives_upload_object');
|
|
8
9
|
return { type: 'object', properties: { ...keyProperties, ...(upload ? { body_base64: { type: 'string', maxLength: Math.ceil(OBJECT_BYTES / 3) * 4 }, content_type: { type: 'string', maxLength: 512 } } : {}) }, required: ['project_id', 'bucket_id', 'key', ...(upload ? ['body_base64'] : [])], additionalProperties: false };
|
|
9
10
|
}
|
|
10
|
-
export const isHivesResourceTool = (id) => /^(?:hives_.*_native_queue|hives_(?:list_buckets|create_bucket|get_bucket|delete_bucket|list_objects|upload_object(?:_by_key)?|delete_object(?:_by_key)?|download_object_by_key|get_cors_config|set_cors_config|generate_presigned_url|reconcile|list_runtimes|get_runtime|select_runtime|list_project_runtimes))$/.test(id);
|
|
11
|
+
export const isHivesResourceTool = (id) => /^(?:hives_marketplace_(?:categories|featured|installed|get_installation|uninstall|reconcile|list_packages|publish|get_package|install|update|list_versions)|hives_.*_native_queue|hives_(?:(?:list_volumes|create_volume|get_volume|delete_volume|mount_volume|unmount_volume)|list_buckets|create_bucket|get_bucket|delete_bucket|list_objects|upload_object(?:_by_key)?|delete_object(?:_by_key)?|download_object_by_key|get_cors_config|set_cors_config|generate_presigned_url|reconcile|list_runtimes|get_runtime|select_runtime|list_project_runtimes))$/.test(id);
|
|
11
12
|
function text(value) { if (typeof value !== 'string')
|
|
12
13
|
throw new Error('Invalid Hives resource input.'); return value; }
|
|
13
14
|
function decode(value) { const s = text(value); if (s.length > Math.ceil(OBJECT_BYTES / 3) * 4 || s.length % 4 || !/^[A-Za-z0-9+/]*={0,2}$/.test(s))
|
|
@@ -15,6 +16,8 @@ function decode(value) { const s = text(value); if (s.length > Math.ceil(OBJECT_
|
|
|
15
16
|
throw new Error('Invalid bounded object body.'); return Uint8Array.from(bytes); }
|
|
16
17
|
/** Called only by the reviewed Hives-only shared-dispatch proposal. No replay or external capability fetch. */
|
|
17
18
|
export async function callHivesResourceTool(g, id, a, signal) {
|
|
19
|
+
if (id.startsWith('hives_marketplace_'))
|
|
20
|
+
return callHivesMarketplaceTool(g, id, a, signal);
|
|
18
21
|
const options = { signal };
|
|
19
22
|
const project = () => text(a.project_id);
|
|
20
23
|
const bucket = () => text(a.bucket_id);
|
|
@@ -23,6 +26,12 @@ export async function callHivesResourceTool(g, id, a, signal) {
|
|
|
23
26
|
const cells = g.hives.cells;
|
|
24
27
|
const buzz = g.hives.queues;
|
|
25
28
|
switch (id) {
|
|
29
|
+
case 'hives_list_volumes': return g.hives.volumes.list(project(), { page: a.page, per_page: a.per_page }, options);
|
|
30
|
+
case 'hives_get_volume': return g.hives.volumes.get(project(), text(a.volume_id), options);
|
|
31
|
+
case 'hives_create_volume': return g.hives.volumes.create(project(), body(), options);
|
|
32
|
+
case 'hives_mount_volume': return g.hives.volumes.mount(project(), text(a.volume_id), body(), options);
|
|
33
|
+
case 'hives_unmount_volume': return g.hives.volumes.unmount(project(), text(a.volume_id), options);
|
|
34
|
+
case 'hives_delete_volume': return g.hives.volumes.remove(project(), text(a.volume_id), options);
|
|
26
35
|
case 'hives_list_buckets': return cells.list(project(), { page: a.page, per_page: a.per_page }, options);
|
|
27
36
|
case 'hives_get_bucket': return cells.get(project(), bucket(), options);
|
|
28
37
|
case 'hives_create_bucket': return cells.create(project(), body(), options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifesi/genesis-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/l1felabs/genesis-api.git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
20
20
|
"undici": "6.29.0",
|
|
21
|
-
"@lifesi/genesis": "0.1.
|
|
21
|
+
"@lifesi/genesis": "0.1.3"
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc -p tsconfig.json"
|