@larkup/marketplace 0.3.8 → 0.3.9
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/package.json +2 -2
- package/src/db/builtin-tools.ts +2 -2
- package/src/tool-extension.ts +8 -1
- package/src/tool-installer.test.ts +35 -1
- package/src/tool-installer.ts +3 -0
- package/src/tool-loader.test.ts +25 -0
- package/src/tool-loader.ts +4 -1
- package/src/tool-registry.test.ts +1 -1
- package/src/tool-registry.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@larkup/marketplace",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"drizzle-orm": "^0.45.2",
|
|
32
32
|
"postgres": "^3.4.9",
|
|
33
33
|
"tsx": "^4.23.5",
|
|
34
|
-
"@larkup/core": "0.
|
|
34
|
+
"@larkup/core": "0.8.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^26",
|
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.3.
|
|
13
|
+
version: '0.3.6',
|
|
14
14
|
pricing: 'free',
|
|
15
15
|
emoji: '🎬',
|
|
16
16
|
icon: 'Film',
|
|
@@ -595,7 +595,7 @@ export const BUILTIN_TOOLS: Record<string, unknown>[] = [
|
|
|
595
595
|
'Supports PDF form fields (AcroForm), DOCX paragraphs/tables, PPTX slide text, and plain text editing. ' +
|
|
596
596
|
'Uses pdf-lib (native) for PDF and the Docker sandbox for DOCX/PPTX via python-docx/python-pptx.',
|
|
597
597
|
category: 'utility',
|
|
598
|
-
version: '0.
|
|
598
|
+
version: '0.3.0',
|
|
599
599
|
pricing: 'free',
|
|
600
600
|
emoji: '📝',
|
|
601
601
|
icon: 'FileEdit',
|
package/src/tool-extension.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface AgentToolExecutionContext {
|
|
|
32
32
|
durationSecs?: number;
|
|
33
33
|
fileName?: string;
|
|
34
34
|
originalUrl?: string;
|
|
35
|
+
/** Detected language of the source recording, when the host persisted it. */
|
|
36
|
+
sourceLanguage?: string;
|
|
35
37
|
}
|
|
36
38
|
| undefined
|
|
37
39
|
>;
|
|
@@ -170,7 +172,12 @@ export interface AgentToolExecutionContext {
|
|
|
170
172
|
*/
|
|
171
173
|
scan?: (
|
|
172
174
|
mediaAssetId: string,
|
|
173
|
-
input: {
|
|
175
|
+
input: {
|
|
176
|
+
kind: 'source-inventory' | 'all-evidence';
|
|
177
|
+
cursor?: number;
|
|
178
|
+
limit?: number;
|
|
179
|
+
modalities?: Array<'transcript' | 'ocr' | 'visual' | 'computed'>;
|
|
180
|
+
},
|
|
174
181
|
) => Promise<
|
|
175
182
|
| {
|
|
176
183
|
resultHandle: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import { runWithWorkspaceHost, type WorkspaceHost } from '@larkup/core/workspace-host';
|
|
3
|
+
import { buildNpmInstallArgs, getInstalledTools } from './tool-installer';
|
|
3
4
|
|
|
4
5
|
describe('buildNpmInstallArgs', () => {
|
|
5
6
|
it('refreshes registry metadata and preserves scoped package specifiers', () => {
|
|
@@ -17,3 +18,36 @@ describe('buildNpmInstallArgs', () => {
|
|
|
17
18
|
]);
|
|
18
19
|
});
|
|
19
20
|
});
|
|
21
|
+
|
|
22
|
+
describe('getInstalledTools', () => {
|
|
23
|
+
it('uses managed host tools without a mutable filesystem manifest', async () => {
|
|
24
|
+
const tools = await runWithWorkspaceHost(
|
|
25
|
+
{
|
|
26
|
+
tools: [
|
|
27
|
+
{
|
|
28
|
+
id: 'hosted-fixture',
|
|
29
|
+
version: '1.0.0',
|
|
30
|
+
installedAt: new Date(0).toISOString(),
|
|
31
|
+
packageName: '@larkup/hosted-fixture',
|
|
32
|
+
resolvedPath: '@larkup/hosted-fixture',
|
|
33
|
+
source: 'local',
|
|
34
|
+
config: { mode: 'managed' },
|
|
35
|
+
module: { ready: true },
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
} as unknown as WorkspaceHost,
|
|
39
|
+
() => getInstalledTools(),
|
|
40
|
+
);
|
|
41
|
+
expect(tools).toEqual([
|
|
42
|
+
{
|
|
43
|
+
id: 'hosted-fixture',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
installedAt: new Date(0).toISOString(),
|
|
46
|
+
packageName: '@larkup/hosted-fixture',
|
|
47
|
+
resolvedPath: '@larkup/hosted-fixture',
|
|
48
|
+
source: 'local',
|
|
49
|
+
config: { mode: 'managed' },
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
});
|
|
53
|
+
});
|
package/src/tool-installer.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
ToolSource,
|
|
13
13
|
} from './types';
|
|
14
14
|
import { getToolById, invalidateRegistryCache } from './tool-registry';
|
|
15
|
+
import { workspaceHost } from '@larkup/core/workspace-host';
|
|
15
16
|
|
|
16
17
|
const installingTools = new Set<string>();
|
|
17
18
|
const uninstallingTools = new Set<string>();
|
|
@@ -88,6 +89,8 @@ async function writeManifest(manifest: InstalledToolsManifest) {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
export async function getInstalledTools(): Promise<InstalledTool[]> {
|
|
92
|
+
const hosted = workspaceHost()?.tools;
|
|
93
|
+
if (hosted) return hosted.map(({ module: _module, ...tool }) => tool);
|
|
91
94
|
const manifest = await readManifest();
|
|
92
95
|
return [...manifest.tools];
|
|
93
96
|
}
|
package/src/tool-loader.test.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { promises as fs } from 'node:fs';
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import type { InstalledTool } from './types';
|
|
6
|
+
import { runWithWorkspaceHost, type WorkspaceHost } from '@larkup/core/workspace-host';
|
|
6
7
|
|
|
7
8
|
const mocks = vi.hoisted(() => ({
|
|
8
9
|
getInstalledTool: vi.fn(),
|
|
@@ -30,6 +31,30 @@ afterEach(async () => {
|
|
|
30
31
|
});
|
|
31
32
|
|
|
32
33
|
describe('loadTool', () => {
|
|
34
|
+
it('uses the module injected by a managed workspace host', async () => {
|
|
35
|
+
const module = { ready: true };
|
|
36
|
+
await expect(
|
|
37
|
+
runWithWorkspaceHost(
|
|
38
|
+
{
|
|
39
|
+
tools: [
|
|
40
|
+
{
|
|
41
|
+
id: 'hosted-fixture',
|
|
42
|
+
version: '1.0.0',
|
|
43
|
+
installedAt: new Date(0).toISOString(),
|
|
44
|
+
packageName: '@larkup/hosted-fixture',
|
|
45
|
+
resolvedPath: '@larkup/hosted-fixture',
|
|
46
|
+
source: 'local',
|
|
47
|
+
config: {},
|
|
48
|
+
module,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
} as unknown as WorkspaceHost,
|
|
52
|
+
() => loadTool<{ ready: boolean }>('hosted-fixture'),
|
|
53
|
+
),
|
|
54
|
+
).resolves.toBe(module);
|
|
55
|
+
expect(mocks.getInstalledTool).not.toHaveBeenCalled();
|
|
56
|
+
});
|
|
57
|
+
|
|
33
58
|
it('loads an unlinked workspace package from its resolved directory', async () => {
|
|
34
59
|
const packageDirectory = await fs.mkdtemp(path.join(os.tmpdir(), 'larkup-tool-loader-'));
|
|
35
60
|
temporaryDirectories.push(packageDirectory);
|
package/src/tool-loader.ts
CHANGED
|
@@ -3,6 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
4
|
import type { InstalledTool } from './types';
|
|
5
5
|
import { getInstalledTool, resolveWorkspaceToolPath } from './tool-installer';
|
|
6
|
+
import { workspaceHost } from '@larkup/core/workspace-host';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Dynamic tool loader — loads an installed tool's module at runtime.
|
|
@@ -47,6 +48,8 @@ async function getScopedImport(revision: string) {
|
|
|
47
48
|
* Load a tool's exported API. Returns `null` if the tool is not installed.
|
|
48
49
|
*/
|
|
49
50
|
export async function loadTool<T = any>(toolId: string): Promise<T | null> {
|
|
51
|
+
const hosted = workspaceHost()?.tools?.find((tool) => tool.id === toolId);
|
|
52
|
+
if (hosted) return hosted.module as T;
|
|
50
53
|
const installed = await getInstalledTool(toolId);
|
|
51
54
|
if (!installed) return null;
|
|
52
55
|
// Determine what to import
|
|
@@ -146,7 +149,7 @@ async function resolvePackageEntry(packageDir: string): Promise<string> {
|
|
|
146
149
|
const rootExport =
|
|
147
150
|
typeof manifest.exports === 'object' ? manifest.exports['.'] : manifest.exports;
|
|
148
151
|
const entry =
|
|
149
|
-
(typeof rootExport === 'object' ? rootExport.import ?? rootExport.default : rootExport) ??
|
|
152
|
+
(typeof rootExport === 'object' ? (rootExport.import ?? rootExport.default) : rootExport) ??
|
|
150
153
|
manifest.main ??
|
|
151
154
|
'index.js';
|
|
152
155
|
|
package/src/tool-registry.ts
CHANGED
|
@@ -25,7 +25,7 @@ function normalizeToolDescriptor(descriptor: ToolDescriptor): ToolDescriptor {
|
|
|
25
25
|
*/
|
|
26
26
|
export function compareToolVersions(left: string, right: string): number {
|
|
27
27
|
const parse = (version: string) => {
|
|
28
|
-
const [core, suffix = ''] = version.split('-', 2);
|
|
28
|
+
const [core = '', suffix = ''] = version.split('-', 2);
|
|
29
29
|
const parts = core.split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
30
30
|
return { parts, stable: suffix.length === 0 };
|
|
31
31
|
};
|