@knolo/cli 6.2.9 → 6.2.10
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/README.md +11 -4
- package/bin/compose.mjs +44 -40
- package/bin/core-load-hook.mjs +33 -0
- package/bin/flight.mjs +10 -14
- package/bin/knolo.mjs +42 -16
- package/bin/load-core.mjs +76 -0
- package/bin/persona.mjs +981 -0
- package/bin/research.mjs +7 -12
- package/bin/skill.mjs +15 -27
- package/package.json +2 -2
package/bin/research.mjs
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
9
|
import { existsSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
10
10
|
import path from 'node:path';
|
|
11
|
-
import { fileURLToPath
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
import { loadCoreModule } from './load-core.mjs';
|
|
12
13
|
import {
|
|
13
14
|
KAR_CLI_MAX_IMAGE_BYTES,
|
|
14
15
|
KAR_CLI_MAX_TEXT_BYTES,
|
|
@@ -512,18 +513,12 @@ async function loadApis() {
|
|
|
512
513
|
}
|
|
513
514
|
|
|
514
515
|
async function importFirst(candidates, check) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
const loaded = await import(href);
|
|
521
|
-
if (check(loaded)) return loaded;
|
|
522
|
-
} catch {
|
|
523
|
-
// Try the next candidate.
|
|
524
|
-
}
|
|
516
|
+
try {
|
|
517
|
+
return await loadCoreModule(candidates, check);
|
|
518
|
+
} catch (error) {
|
|
519
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
520
|
+
throw new Error(`Could not load @knolo/core. Build packages/core first. (${detail})`);
|
|
525
521
|
}
|
|
526
|
-
throw new Error('Could not load @knolo/core. Build packages/core first.');
|
|
527
522
|
}
|
|
528
523
|
|
|
529
524
|
function parseVerifyFlags(argv) {
|
package/bin/skill.mjs
CHANGED
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
} from 'node:fs/promises';
|
|
22
22
|
import { homedir, tmpdir } from 'node:os';
|
|
23
23
|
import path from 'node:path';
|
|
24
|
-
import { fileURLToPath
|
|
24
|
+
import { fileURLToPath } from 'node:url';
|
|
25
|
+
import { loadCoreModule } from './load-core.mjs';
|
|
25
26
|
import { normalizeCategories } from './registry/categories.mjs';
|
|
26
27
|
import {
|
|
27
28
|
normalizeRegistryUrl,
|
|
@@ -904,32 +905,19 @@ function coreModuleReady(loaded) {
|
|
|
904
905
|
);
|
|
905
906
|
}
|
|
906
907
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
if (coreModuleReady(loaded)) return loaded;
|
|
921
|
-
lastError = new Error('module did not export the Knowledge Image API');
|
|
922
|
-
} catch (error) {
|
|
923
|
-
lastError = error;
|
|
924
|
-
}
|
|
925
|
-
}
|
|
926
|
-
if (attempt < 2) {
|
|
927
|
-
await new Promise((resolve) => setTimeout(resolve, 25 * (attempt + 1)));
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
throw new Error(
|
|
931
|
-
`Could not load @knolo/core. Build packages/core first. (${coreLoadDetail(lastError)})`
|
|
932
|
-
);
|
|
908
|
+
let corePromise;
|
|
909
|
+
|
|
910
|
+
function loadCore() {
|
|
911
|
+
corePromise ??= loadCoreModule(
|
|
912
|
+
[path.resolve(__dirname, '../../core/dist/index.js'), '@knolo/core'],
|
|
913
|
+
coreModuleReady
|
|
914
|
+
).catch((error) => {
|
|
915
|
+
corePromise = undefined;
|
|
916
|
+
throw new Error(
|
|
917
|
+
`Could not load @knolo/core. Build packages/core first. (${coreLoadDetail(error)})`
|
|
918
|
+
);
|
|
919
|
+
});
|
|
920
|
+
return corePromise;
|
|
933
921
|
}
|
|
934
922
|
|
|
935
923
|
const SKILL_ARCHIVE_FORMAT = 'knolo-skill-archive-v1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knolo/cli",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"knolo": "bin/knolo.mjs"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "node -e \"console.log('cli is executable via bin/knolo.mjs')\"",
|
|
31
|
-
"test": "npm run build --prefix ../core && npm run build --prefix ../exchange && node --test test/cli.test.mjs test/ask.test.mjs test/kar.test.mjs test/kar-graph.test.mjs test/kar-produce.test.mjs test/hub.integration.test.mjs test/compose.test.mjs test/cortex.test.mjs test/flight.test.mjs test/skill.test.mjs test/setup.test.mjs test/exchange.test.mjs test/research.test.mjs test/kite.test.mjs",
|
|
31
|
+
"test": "npm run build --prefix ../core && npm run build --prefix ../exchange && node --test test/cli.test.mjs test/ask.test.mjs test/kar.test.mjs test/kar-graph.test.mjs test/kar-produce.test.mjs test/hub.integration.test.mjs test/compose.test.mjs test/cortex.test.mjs test/flight.test.mjs test/skill.test.mjs test/persona.test.mjs test/setup.test.mjs test/exchange.test.mjs test/research.test.mjs test/kite.test.mjs",
|
|
32
32
|
"test:hub": "node --test test/hub.integration.test.mjs"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|