@larkup/marketplace 0.2.0 → 0.2.2
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/.env +6 -0
- package/.turbo/turbo-test.log +8 -0
- package/.turbo/turbo-type-check.log +4 -0
- package/CHANGELOG.md +18 -0
- package/db/dist/builtin-tools.d.ts +2 -0
- package/db/dist/builtin-tools.js +116 -0
- package/db/dist/client.d.ts +7 -0
- package/db/dist/client.js +20 -0
- package/db/dist/repo.d.ts +67 -0
- package/db/dist/repo.js +236 -0
- package/db/dist/schema/audit.d.ts +128 -0
- package/db/dist/schema/audit.js +18 -0
- package/db/dist/schema/extensions.d.ts +326 -0
- package/db/dist/schema/extensions.js +36 -0
- package/db/dist/schema/index.d.ts +5 -0
- package/db/dist/schema/index.js +5 -0
- package/db/dist/schema/installations.d.ts +93 -0
- package/db/dist/schema/installations.js +15 -0
- package/db/dist/schema/publishers.d.ts +110 -0
- package/db/dist/schema/publishers.js +12 -0
- package/db/dist/schema/versions.d.ts +127 -0
- package/db/dist/schema/versions.js +17 -0
- package/db/dist/seed.d.ts +2 -0
- package/db/dist/seed.js +31 -0
- package/db/dist/validate.d.ts +6 -0
- package/db/dist/validate.js +51 -0
- package/package.json +3 -3
- package/src/db/builtin-tools.ts +1 -1
- package/src/tool-installer.ts +2 -1
- package/src/tool-registry.test.ts +15 -0
- package/src/tool-registry.ts +11 -45
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/** Immutable published extension versions. */
|
|
2
|
+
export declare const extensionVersions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
3
|
+
name: "extension_versions";
|
|
4
|
+
schema: undefined;
|
|
5
|
+
columns: {
|
|
6
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
7
|
+
name: "id";
|
|
8
|
+
tableName: "extension_versions";
|
|
9
|
+
dataType: "string";
|
|
10
|
+
columnType: "PgText";
|
|
11
|
+
data: string;
|
|
12
|
+
driverParam: string;
|
|
13
|
+
notNull: true;
|
|
14
|
+
hasDefault: false;
|
|
15
|
+
isPrimaryKey: true;
|
|
16
|
+
isAutoincrement: false;
|
|
17
|
+
hasRuntimeDefault: false;
|
|
18
|
+
enumValues: [string, ...string[]];
|
|
19
|
+
baseColumn: never;
|
|
20
|
+
identity: undefined;
|
|
21
|
+
generated: undefined;
|
|
22
|
+
}, {}, {}>;
|
|
23
|
+
extensionId: import("drizzle-orm/pg-core").PgColumn<{
|
|
24
|
+
name: "extension_id";
|
|
25
|
+
tableName: "extension_versions";
|
|
26
|
+
dataType: "string";
|
|
27
|
+
columnType: "PgText";
|
|
28
|
+
data: string;
|
|
29
|
+
driverParam: string;
|
|
30
|
+
notNull: true;
|
|
31
|
+
hasDefault: false;
|
|
32
|
+
isPrimaryKey: false;
|
|
33
|
+
isAutoincrement: false;
|
|
34
|
+
hasRuntimeDefault: false;
|
|
35
|
+
enumValues: [string, ...string[]];
|
|
36
|
+
baseColumn: never;
|
|
37
|
+
identity: undefined;
|
|
38
|
+
generated: undefined;
|
|
39
|
+
}, {}, {}>;
|
|
40
|
+
version: import("drizzle-orm/pg-core").PgColumn<{
|
|
41
|
+
name: "version";
|
|
42
|
+
tableName: "extension_versions";
|
|
43
|
+
dataType: "string";
|
|
44
|
+
columnType: "PgText";
|
|
45
|
+
data: string;
|
|
46
|
+
driverParam: string;
|
|
47
|
+
notNull: true;
|
|
48
|
+
hasDefault: false;
|
|
49
|
+
isPrimaryKey: false;
|
|
50
|
+
isAutoincrement: false;
|
|
51
|
+
hasRuntimeDefault: false;
|
|
52
|
+
enumValues: [string, ...string[]];
|
|
53
|
+
baseColumn: never;
|
|
54
|
+
identity: undefined;
|
|
55
|
+
generated: undefined;
|
|
56
|
+
}, {}, {}>;
|
|
57
|
+
manifest: import("drizzle-orm/pg-core").PgColumn<{
|
|
58
|
+
name: "manifest";
|
|
59
|
+
tableName: "extension_versions";
|
|
60
|
+
dataType: "json";
|
|
61
|
+
columnType: "PgJsonb";
|
|
62
|
+
data: unknown;
|
|
63
|
+
driverParam: unknown;
|
|
64
|
+
notNull: true;
|
|
65
|
+
hasDefault: false;
|
|
66
|
+
isPrimaryKey: false;
|
|
67
|
+
isAutoincrement: false;
|
|
68
|
+
hasRuntimeDefault: false;
|
|
69
|
+
enumValues: undefined;
|
|
70
|
+
baseColumn: never;
|
|
71
|
+
identity: undefined;
|
|
72
|
+
generated: undefined;
|
|
73
|
+
}, {}, {}>;
|
|
74
|
+
integrity: import("drizzle-orm/pg-core").PgColumn<{
|
|
75
|
+
name: "integrity";
|
|
76
|
+
tableName: "extension_versions";
|
|
77
|
+
dataType: "string";
|
|
78
|
+
columnType: "PgText";
|
|
79
|
+
data: string;
|
|
80
|
+
driverParam: string;
|
|
81
|
+
notNull: true;
|
|
82
|
+
hasDefault: false;
|
|
83
|
+
isPrimaryKey: false;
|
|
84
|
+
isAutoincrement: false;
|
|
85
|
+
hasRuntimeDefault: false;
|
|
86
|
+
enumValues: [string, ...string[]];
|
|
87
|
+
baseColumn: never;
|
|
88
|
+
identity: undefined;
|
|
89
|
+
generated: undefined;
|
|
90
|
+
}, {}, {}>;
|
|
91
|
+
publishedBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
92
|
+
name: "published_by";
|
|
93
|
+
tableName: "extension_versions";
|
|
94
|
+
dataType: "string";
|
|
95
|
+
columnType: "PgText";
|
|
96
|
+
data: string;
|
|
97
|
+
driverParam: string;
|
|
98
|
+
notNull: true;
|
|
99
|
+
hasDefault: false;
|
|
100
|
+
isPrimaryKey: false;
|
|
101
|
+
isAutoincrement: false;
|
|
102
|
+
hasRuntimeDefault: false;
|
|
103
|
+
enumValues: [string, ...string[]];
|
|
104
|
+
baseColumn: never;
|
|
105
|
+
identity: undefined;
|
|
106
|
+
generated: undefined;
|
|
107
|
+
}, {}, {}>;
|
|
108
|
+
publishedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
109
|
+
name: "published_at";
|
|
110
|
+
tableName: "extension_versions";
|
|
111
|
+
dataType: "date";
|
|
112
|
+
columnType: "PgTimestamp";
|
|
113
|
+
data: Date;
|
|
114
|
+
driverParam: string;
|
|
115
|
+
notNull: true;
|
|
116
|
+
hasDefault: true;
|
|
117
|
+
isPrimaryKey: false;
|
|
118
|
+
isAutoincrement: false;
|
|
119
|
+
hasRuntimeDefault: false;
|
|
120
|
+
enumValues: undefined;
|
|
121
|
+
baseColumn: never;
|
|
122
|
+
identity: undefined;
|
|
123
|
+
generated: undefined;
|
|
124
|
+
}, {}, {}>;
|
|
125
|
+
};
|
|
126
|
+
dialect: "pg";
|
|
127
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { index, jsonb, pgTable, text, timestamp, unique } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { extensions } from './extensions.js';
|
|
3
|
+
/** Immutable published extension versions. */
|
|
4
|
+
export const extensionVersions = pgTable('extension_versions', {
|
|
5
|
+
id: text('id').primaryKey(),
|
|
6
|
+
extensionId: text('extension_id')
|
|
7
|
+
.notNull()
|
|
8
|
+
.references(() => extensions.id),
|
|
9
|
+
version: text('version').notNull(),
|
|
10
|
+
manifest: jsonb('manifest').notNull(),
|
|
11
|
+
integrity: text('integrity').notNull(),
|
|
12
|
+
publishedBy: text('published_by').notNull(),
|
|
13
|
+
publishedAt: timestamp('published_at', { withTimezone: true }).notNull().defaultNow(),
|
|
14
|
+
}, (table) => [
|
|
15
|
+
unique('extension_versions_extension_version_unique').on(table.extensionId, table.version),
|
|
16
|
+
index('extension_versions_extension_id_idx').on(table.extensionId),
|
|
17
|
+
]);
|
package/db/dist/seed.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Seeds built-in Marketplace tools. */
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import { BUILTIN_TOOLS } from './builtin-tools.js';
|
|
4
|
+
import { getMarketplaceDb } from './client.js';
|
|
5
|
+
import { publishExtension, VersionExistsError } from './repo.js';
|
|
6
|
+
async function main() {
|
|
7
|
+
const db = getMarketplaceDb();
|
|
8
|
+
for (const manifest of BUILTIN_TOOLS) {
|
|
9
|
+
try {
|
|
10
|
+
await publishExtension(db, {
|
|
11
|
+
manifest,
|
|
12
|
+
publisherId: 'larkup',
|
|
13
|
+
publisherName: 'Larkup',
|
|
14
|
+
});
|
|
15
|
+
console.log(`seeded ${manifest.id}@${manifest.version}`);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
if (err instanceof VersionExistsError) {
|
|
19
|
+
console.log(`already seeded: ${manifest.id}@${manifest.version}`);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
throw err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
main()
|
|
27
|
+
.then(() => process.exit(0))
|
|
28
|
+
.catch((err) => {
|
|
29
|
+
console.error(err);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Validates Marketplace tool manifests. */
|
|
2
|
+
const ID_PATTERN = /^[a-z0-9][a-z0-9-]*[a-z0-9]$/;
|
|
3
|
+
const VERSION_PATTERN = /^\d+\.\d+\.\d+/;
|
|
4
|
+
const CATEGORIES = [
|
|
5
|
+
'media',
|
|
6
|
+
'search',
|
|
7
|
+
'analytics',
|
|
8
|
+
'integration',
|
|
9
|
+
'embedding',
|
|
10
|
+
'ai',
|
|
11
|
+
'automation',
|
|
12
|
+
'utility',
|
|
13
|
+
];
|
|
14
|
+
const PRICING = ['free', 'pro', 'enterprise'];
|
|
15
|
+
export function validateToolManifest(manifest) {
|
|
16
|
+
const errors = [];
|
|
17
|
+
if (!manifest || typeof manifest !== 'object') {
|
|
18
|
+
return { valid: false, errors: ['manifest must be an object'] };
|
|
19
|
+
}
|
|
20
|
+
const m = manifest;
|
|
21
|
+
const requireString = (key) => {
|
|
22
|
+
if (typeof m[key] !== 'string' || !m[key])
|
|
23
|
+
errors.push(`"${key}" is required`);
|
|
24
|
+
};
|
|
25
|
+
requireString('id');
|
|
26
|
+
if (typeof m.id === 'string' && !ID_PATTERN.test(m.id)) {
|
|
27
|
+
errors.push('"id" must be lowercase alphanumeric with hyphens, e.g. "video-audio"');
|
|
28
|
+
}
|
|
29
|
+
requireString('name');
|
|
30
|
+
requireString('description');
|
|
31
|
+
requireString('icon');
|
|
32
|
+
requireString('packageName');
|
|
33
|
+
requireString('installSize');
|
|
34
|
+
requireString('author');
|
|
35
|
+
if (typeof m.category !== 'string' || !CATEGORIES.includes(m.category)) {
|
|
36
|
+
errors.push(`"category" must be one of: ${CATEGORIES.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
if (typeof m.pricing !== 'string' || !PRICING.includes(m.pricing)) {
|
|
39
|
+
errors.push(`"pricing" must be one of: ${PRICING.join(', ')}`);
|
|
40
|
+
}
|
|
41
|
+
if (typeof m.version !== 'string' || !VERSION_PATTERN.test(m.version)) {
|
|
42
|
+
errors.push('"version" must be semver, e.g. "1.0.0"');
|
|
43
|
+
}
|
|
44
|
+
if (!Array.isArray(m.capabilities) || m.capabilities.length === 0) {
|
|
45
|
+
errors.push('"capabilities" must be a non-empty array');
|
|
46
|
+
}
|
|
47
|
+
if (m.requiresSandbox !== undefined && typeof m.requiresSandbox !== 'boolean') {
|
|
48
|
+
errors.push('"requiresSandbox" must be a boolean when provided');
|
|
49
|
+
}
|
|
50
|
+
return { valid: errors.length === 0, errors };
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/marketplace",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"@aws-sdk/s3-request-presigner": "^3.700.0",
|
|
26
26
|
"drizzle-orm": "^0.45.2",
|
|
27
27
|
"postgres": "^3.4.9",
|
|
28
|
-
"
|
|
28
|
+
"tsx": "^4.23.5",
|
|
29
|
+
"@larkup/core": "0.5.2"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/node": "^26",
|
|
32
33
|
"dotenv": "^17.4.2",
|
|
33
34
|
"drizzle-kit": "^0.31.10",
|
|
34
|
-
"tsx": "^4.23.5",
|
|
35
35
|
"typescript": "^7.0.2",
|
|
36
36
|
"vitest": "^4.1.10"
|
|
37
37
|
},
|
package/src/db/builtin-tools.ts
CHANGED
|
@@ -10,7 +10,7 @@ export const BUILTIN_TOOLS: Record<string, unknown>[] = [
|
|
|
10
10
|
longDescription:
|
|
11
11
|
'Turn videos into knowledge your AI can understand. It listens to what is said, reads what appears on screen, and helps you find the moments that matter.',
|
|
12
12
|
category: 'media',
|
|
13
|
-
version: '0.
|
|
13
|
+
version: '0.2.2',
|
|
14
14
|
pricing: 'free',
|
|
15
15
|
emoji: '🎬',
|
|
16
16
|
icon: 'Film',
|
package/src/tool-installer.ts
CHANGED
|
@@ -39,7 +39,8 @@ function serializePackageMutation<T>(fn: () => Promise<T>): Promise<T> {
|
|
|
39
39
|
|
|
40
40
|
/** Root directory for tool installations. */
|
|
41
41
|
function getToolsDir(): string {
|
|
42
|
-
|
|
42
|
+
const dataDir = process.env.LARKUP_DATA_DIR?.trim();
|
|
43
|
+
return path.join(dataDir ? path.resolve(dataDir) : path.join(process.cwd(), '.larkup'), 'tools');
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
/** Path to the installed tools manifest. */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { buildRegistry, invalidateRegistryCache } from './tool-registry';
|
|
3
|
+
|
|
4
|
+
describe('tool registry fallback catalog', () => {
|
|
5
|
+
it('keeps Video Intelligence installable when a remote catalog is stale or incomplete', async () => {
|
|
6
|
+
invalidateRegistryCache();
|
|
7
|
+
const registry = await buildRegistry({ skipHub: true });
|
|
8
|
+
|
|
9
|
+
expect(registry['video-intelligence']).toMatchObject({
|
|
10
|
+
id: 'video-intelligence',
|
|
11
|
+
packageName: '@larkup/tool-video-intelligence',
|
|
12
|
+
version: '0.2.2',
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
});
|
package/src/tool-registry.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import type { ToolDescriptor } from './types';
|
|
4
4
|
import { DEFAULT_HUB_URL } from './types';
|
|
5
|
+
import { BUILTIN_TOOLS } from './db/builtin-tools';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Tool registry — resolves tool descriptors from multiple sources.
|
|
@@ -61,12 +62,16 @@ async function discoverLocalManifests(): Promise<Record<string, ToolDescriptor>>
|
|
|
61
62
|
const registry: Record<string, ToolDescriptor> = {};
|
|
62
63
|
|
|
63
64
|
// Try multiple possible tool directories
|
|
65
|
+
const persistentDataDir = process.env.LARKUP_DATA_DIR?.trim();
|
|
64
66
|
const searchPaths = [
|
|
65
67
|
// Monorepo development: packages/marketplace-tools/*
|
|
66
68
|
path.resolve(process.cwd(), 'packages', 'marketplace-tools'),
|
|
67
69
|
// Next.js dev server runs in apps/web
|
|
68
70
|
path.resolve(process.cwd(), '..', '..', 'packages', 'marketplace-tools'),
|
|
69
71
|
// Installed tools: .larkup/tools/node_modules/@larkup
|
|
72
|
+
...(persistentDataDir
|
|
73
|
+
? [path.resolve(persistentDataDir, 'tools', 'node_modules', '@larkup')]
|
|
74
|
+
: []),
|
|
70
75
|
path.resolve(process.cwd(), '.larkup', 'tools', 'node_modules', '@larkup'),
|
|
71
76
|
path.resolve(process.cwd(), '..', '..', '.larkup', 'tools', 'node_modules', '@larkup'),
|
|
72
77
|
];
|
|
@@ -160,51 +165,12 @@ export async function fetchToolFromHub(
|
|
|
160
165
|
* Minimal hardcoded registry for offline / first-run scenarios
|
|
161
166
|
* where neither manifests nor Hub are available.
|
|
162
167
|
*/
|
|
163
|
-
const FALLBACK_REGISTRY: Record<string, ToolDescriptor> =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
version: '0.1.0',
|
|
170
|
-
pricing: 'free',
|
|
171
|
-
emoji: '🔍',
|
|
172
|
-
icon: 'ScanEye',
|
|
173
|
-
packageName: '@larkup/tool-clip-embeddings',
|
|
174
|
-
installSize: '~200 MB',
|
|
175
|
-
requiresSandbox: true,
|
|
176
|
-
author: 'Larkup',
|
|
177
|
-
capabilities: ['clip-embeddings', 'image-similarity'],
|
|
178
|
-
tags: ['clip', 'siglip', 'image-search', 'visual-similarity'],
|
|
179
|
-
downloads: 0,
|
|
180
|
-
repositoryUrl: 'https://github.com/Larkup-AI/larkup',
|
|
181
|
-
license: 'Apache-2.0',
|
|
182
|
-
updatedAt: '2026-07-20',
|
|
183
|
-
comingSoon: true,
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
'doc-editor': {
|
|
187
|
-
id: 'doc-editor',
|
|
188
|
-
name: 'Document Editor',
|
|
189
|
-
description: 'AI-powered form filling and document editing with Canvas-style live preview.',
|
|
190
|
-
category: 'utility',
|
|
191
|
-
version: '0.2.3',
|
|
192
|
-
pricing: 'free',
|
|
193
|
-
emoji: '📝',
|
|
194
|
-
icon: 'FileEdit',
|
|
195
|
-
packageName: '@larkup/tool-doc-editor',
|
|
196
|
-
installSize: '~5 MB',
|
|
197
|
-
systemDeps: ['docker'],
|
|
198
|
-
requiresSandbox: true,
|
|
199
|
-
author: 'Larkup',
|
|
200
|
-
capabilities: ['document-editing', 'form-filling', 'document-preview'],
|
|
201
|
-
tags: ['pdf', 'docx', 'pptx', 'form', 'canvas', 'editor', 'fill'],
|
|
202
|
-
downloads: 0,
|
|
203
|
-
repositoryUrl: 'https://github.com/Larkup-AI/larkup',
|
|
204
|
-
license: 'Apache-2.0',
|
|
205
|
-
updatedAt: '2026-07-20',
|
|
206
|
-
},
|
|
207
|
-
};
|
|
168
|
+
const FALLBACK_REGISTRY: Record<string, ToolDescriptor> = Object.fromEntries(
|
|
169
|
+
BUILTIN_TOOLS.map((tool) => {
|
|
170
|
+
const descriptor = normalizeToolDescriptor(tool as unknown as ToolDescriptor);
|
|
171
|
+
return [descriptor.id, descriptor];
|
|
172
|
+
}),
|
|
173
|
+
);
|
|
208
174
|
|
|
209
175
|
/**
|
|
210
176
|
* Build the full tool registry by merging sources. The deployed Hub is the
|