@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/README.md
CHANGED
|
@@ -19,9 +19,9 @@ reader.
|
|
|
19
19
|
|
|
20
20
|
`knolo compose`, `knolo attest`, and `knolo verify-attestation` cite local
|
|
21
21
|
Knowledge Images and write an attestation sidecar. This tree's `@knolo/cli`
|
|
22
|
-
package file is `6.2.
|
|
23
|
-
`@knolo/exchange` `^0.1.1`. npm `latest` is `6.2.8`. `knolo kite`, `knolo research verify`, and `knolo exchange relay` are in this
|
|
24
|
-
package and in
|
|
22
|
+
package file is `6.2.10` and depends on `@knolo/core` `^6.2.3` and
|
|
23
|
+
`@knolo/exchange` `^0.1.1`. npm `latest` is `6.2.9` and includes `knolo ask` and `--category`. `@knolo/cli@6.2.8` has no `ask.mjs` and no `--category`. `knolo kite`, `knolo research verify`, and `knolo exchange relay` are in this
|
|
24
|
+
package and in `@knolo/cli@6.2.8`. `knolo kite` is not in published `@knolo/cli@6.2.5`. `knolo exchange` hands
|
|
25
25
|
a verified V5 image to another agent. Shipped configs keep `adopt: deny`.
|
|
26
26
|
Discover reads a public advertisement and does not download a pack. They do
|
|
27
27
|
not fetch Hub for that handoff. Verification
|
|
@@ -49,6 +49,13 @@ a model. A receipt is an integrity check. It does not mean a claim is proven.
|
|
|
49
49
|
`SATISFIED` means the evidence requirements were met. See
|
|
50
50
|
[Skills](../../docs/skills/README.md).
|
|
51
51
|
|
|
52
|
+
`knolo persona` builds a signed persona pack from style exemplars, a profile,
|
|
53
|
+
a disclosure line, and KITE boundary obligations. The creator signs the consent
|
|
54
|
+
manifest. The private key stays out of the image. `npm latest` `6.2.9` does
|
|
55
|
+
not include `knolo persona`. A receipt is an integrity check. A KITE verdict
|
|
56
|
+
describes the contract. It does not mean the claim is true. The host owns the
|
|
57
|
+
model. See [Persona packs](../../docs/guides/persona-packs.md).
|
|
58
|
+
|
|
52
59
|
`knolo research package` writes one V5 image from local files. `--agent` is
|
|
53
60
|
the host-supplied caller. An optional Cortex trace is verified against
|
|
54
61
|
`--cite` before the write. A cited pack stores a digest-bound composition
|
|
@@ -410,7 +417,7 @@ This ensures:
|
|
|
410
417
|
## 🗺 Roadmap
|
|
411
418
|
|
|
412
419
|
The active roadmap is maintained in [`../../docs/ROADMAP.md`](../../docs/ROADMAP.md).
|
|
413
|
-
The published npm release is `6.2.
|
|
420
|
+
The published npm release is `6.2.9`. This tree's package file is `6.2.10` and adds `knolo persona`. `knolo persona` is not in the published release. The published release includes `knolo ask` and `--category`. `@knolo/cli@6.2.8` has no `ask.mjs` and no `--category`. `@knolo/cli@6.2.7` does not include `knolo research verify` or `knolo exchange relay`. `@knolo/cli@6.2.5` does not include `knolo kite`. The published release preserves the V4 CLI, keeps V5 verification,
|
|
414
421
|
migration, diagnostics, and read-only Studio management, and adds offline
|
|
415
422
|
composition, attestation, and `knolo cortex`. Cortex verification does not
|
|
416
423
|
mean an answer is true.
|
package/bin/compose.mjs
CHANGED
|
@@ -9,7 +9,8 @@ import { createHash } from 'node:crypto';
|
|
|
9
9
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
10
10
|
import { homedir, tmpdir } from 'node:os';
|
|
11
11
|
import path from 'node:path';
|
|
12
|
-
import { fileURLToPath
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { loadCoreModule } from './load-core.mjs';
|
|
13
14
|
import { KAR_CLI_MAX_IMAGE_BYTES, readBounded, readBoundedJson } from './kar-limits.mjs';
|
|
14
15
|
|
|
15
16
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -688,52 +689,55 @@ function resolve(file) {
|
|
|
688
689
|
}
|
|
689
690
|
|
|
690
691
|
async function loadAuthorityRoot() {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
}
|
|
692
|
+
try {
|
|
693
|
+
const loaded = await loadCoreModule(
|
|
694
|
+
[
|
|
695
|
+
path.resolve(__dirname, '../../core/dist/knowledge_key_rotation_v5.js'),
|
|
696
|
+
'@knolo/core',
|
|
697
|
+
],
|
|
698
|
+
(mod) => Boolean(mod?.authorityKeyringRootV1)
|
|
699
|
+
);
|
|
700
|
+
return loaded.authorityKeyringRootV1;
|
|
701
|
+
} catch (error) {
|
|
702
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
703
|
+
throw new Error(`Could not load authorityKeyringRootV1. Build packages/core first. (${detail})`);
|
|
703
704
|
}
|
|
704
|
-
throw new Error('Could not load authorityKeyringRootV1. Build packages/core first.');
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
async function loadComposition() {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
708
|
+
try {
|
|
709
|
+
return await loadCoreModule(
|
|
710
|
+
[
|
|
711
|
+
path.resolve(__dirname, '../../core/dist/composition/index.js'),
|
|
712
|
+
'@knolo/core/composition',
|
|
713
|
+
],
|
|
714
|
+
(loaded) =>
|
|
715
|
+
Boolean(
|
|
716
|
+
loaded?.createCompositionRecord &&
|
|
717
|
+
loaded?.verifyCompositionRecord &&
|
|
718
|
+
loaded?.karCompositionBinder
|
|
719
|
+
)
|
|
720
|
+
);
|
|
721
|
+
} catch (error) {
|
|
722
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
723
|
+
throw new Error(`Could not load @knolo/core/composition. Build packages/core first. (${detail})`);
|
|
720
724
|
}
|
|
721
|
-
throw new Error('Could not load @knolo/core/composition. Build packages/core first.');
|
|
722
725
|
}
|
|
723
726
|
|
|
724
727
|
async function loadAuthoring() {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
728
|
+
try {
|
|
729
|
+
return await loadCoreModule(
|
|
730
|
+
[
|
|
731
|
+
path.resolve(__dirname, '../../core/dist/experimental/kar/authoring/index.js'),
|
|
732
|
+
'@knolo/core/experimental/kar/authoring',
|
|
733
|
+
],
|
|
734
|
+
(loaded) =>
|
|
735
|
+
Boolean(
|
|
736
|
+
loaded?.domainPackRoot && loaded?.parseAuthoringDocument && loaded?.interpretDomainPack
|
|
737
|
+
)
|
|
738
|
+
);
|
|
739
|
+
} catch (error) {
|
|
740
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
741
|
+
throw new Error(`Could not load @knolo/core/kar/authoring. Build packages/core first. (${detail})`);
|
|
737
742
|
}
|
|
738
|
-
throw new Error('Could not load @knolo/core/kar/authoring. Build packages/core first.');
|
|
739
743
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// A failed ESM graph stays cached for the exact URLs that failed. Retrying
|
|
2
|
+
// only the entry file links it against those failed dependencies and reports
|
|
3
|
+
// a missing export that the built file has. Copy the entry's knolo-epoch
|
|
4
|
+
// query onto every other file in that dist tree so the retry is a new graph.
|
|
5
|
+
|
|
6
|
+
export async function resolve(specifier, context, nextResolve) {
|
|
7
|
+
const next = await nextResolve(specifier, context);
|
|
8
|
+
const parent = context.parentURL;
|
|
9
|
+
if (!parent) return next;
|
|
10
|
+
let epoch;
|
|
11
|
+
try {
|
|
12
|
+
epoch = new URL(parent).searchParams.get('knolo-epoch');
|
|
13
|
+
} catch {
|
|
14
|
+
return next;
|
|
15
|
+
}
|
|
16
|
+
if (!epoch) return next;
|
|
17
|
+
let nextUrl;
|
|
18
|
+
let parentUrl;
|
|
19
|
+
try {
|
|
20
|
+
nextUrl = new URL(next.url);
|
|
21
|
+
parentUrl = new URL(parent);
|
|
22
|
+
} catch {
|
|
23
|
+
return next;
|
|
24
|
+
}
|
|
25
|
+
if (nextUrl.protocol !== 'file:') return next;
|
|
26
|
+
const distAt = parentUrl.pathname.lastIndexOf('/dist/');
|
|
27
|
+
if (distAt < 0) return next;
|
|
28
|
+
const distRoot = parentUrl.pathname.slice(0, distAt + '/dist/'.length);
|
|
29
|
+
if (!nextUrl.pathname.startsWith(distRoot)) return next;
|
|
30
|
+
if (nextUrl.searchParams.get('knolo-epoch') === epoch) return next;
|
|
31
|
+
nextUrl.searchParams.set('knolo-epoch', epoch);
|
|
32
|
+
return { format: next.format, shortCircuit: true, url: nextUrl.href };
|
|
33
|
+
}
|
package/bin/flight.mjs
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
9
|
import { createReadStream, existsSync, statSync, 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 { KAR_CLI_MAX_IMAGE_BYTES, readBounded } from './kar-limits.mjs';
|
|
13
14
|
|
|
14
15
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -384,20 +385,15 @@ async function inspectLog(file) {
|
|
|
384
385
|
}
|
|
385
386
|
|
|
386
387
|
async function loadImageApi() {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
if (loaded.createKnowledgeImageV5) return loaded;
|
|
396
|
-
} catch {
|
|
397
|
-
// Try the next candidate.
|
|
398
|
-
}
|
|
388
|
+
try {
|
|
389
|
+
return await loadCoreModule(
|
|
390
|
+
[path.resolve(__dirname, '../../core/dist/index.js'), '@knolo/core'],
|
|
391
|
+
(loaded) => Boolean(loaded?.createKnowledgeImageV5)
|
|
392
|
+
);
|
|
393
|
+
} catch (error) {
|
|
394
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
395
|
+
throw new Error(`Could not load @knolo/core. Build packages/core first. (${detail})`);
|
|
399
396
|
}
|
|
400
|
-
throw new Error('Could not load @knolo/core. Build packages/core first.');
|
|
401
397
|
}
|
|
402
398
|
|
|
403
399
|
function parseArgs(argv) {
|
package/bin/knolo.mjs
CHANGED
|
@@ -19,6 +19,7 @@ import { tmpdir } from 'node:os';
|
|
|
19
19
|
import path from 'node:path';
|
|
20
20
|
import process from 'node:process';
|
|
21
21
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
22
|
+
import { loadCoreModule } from './load-core.mjs';
|
|
22
23
|
import { createRequire } from 'node:module';
|
|
23
24
|
import {
|
|
24
25
|
isHubAddInvocation,
|
|
@@ -82,6 +83,7 @@ const SUBCOMMANDS = new Set([
|
|
|
82
83
|
'kite',
|
|
83
84
|
'flight',
|
|
84
85
|
'skill',
|
|
86
|
+
'persona',
|
|
85
87
|
'setup',
|
|
86
88
|
'exchange',
|
|
87
89
|
'research',
|
|
@@ -121,24 +123,28 @@ async function tryImport(filePath) {
|
|
|
121
123
|
return null;
|
|
122
124
|
}
|
|
123
125
|
|
|
126
|
+
function coreNamespaceReady(mod) {
|
|
127
|
+
return Boolean(
|
|
128
|
+
(mod?.buildPack && mod?.mountPack && mod?.query) ||
|
|
129
|
+
(mod?.default?.buildPack && mod?.default?.mountPack && mod?.default?.query)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
124
133
|
async function loadCore() {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)
|
|
137
|
-
return mod.default;
|
|
134
|
+
let mod;
|
|
135
|
+
try {
|
|
136
|
+
mod = await loadCoreModule(
|
|
137
|
+
[path.resolve(__dirname, '../../core/dist/index.js'), '@knolo/core'],
|
|
138
|
+
coreNamespaceReady
|
|
139
|
+
);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
142
|
+
throw createError(
|
|
143
|
+
`Could not load @knolo/core. Build packages/core first (npm run build --workspace @knolo/core). (${detail})`
|
|
144
|
+
);
|
|
138
145
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
);
|
|
146
|
+
if (mod?.buildPack && mod?.mountPack && mod?.query) return mod;
|
|
147
|
+
return mod.default;
|
|
142
148
|
}
|
|
143
149
|
|
|
144
150
|
function printVersion() {
|
|
@@ -187,6 +193,7 @@ Commands:
|
|
|
187
193
|
kite Check a typed contract and replay its certificate
|
|
188
194
|
flight Pack a flight-events-1 document into a V5 Knowledge Image
|
|
189
195
|
skill Create and share a Knolo skill pack
|
|
196
|
+
persona Build a signed persona pack and check its boundaries
|
|
190
197
|
research Package local research files into a V5 Knowledge Image
|
|
191
198
|
setup Prepare a local index and print the hub next steps
|
|
192
199
|
exchange Offer or pull a verified Knowledge Image from a peer or relay
|
|
@@ -291,6 +298,21 @@ local directory. install checks the pin before it writes. It writes into
|
|
|
291
298
|
--dir, or into ~/.knolo/skills when --dir is omitted. A pin mismatch
|
|
292
299
|
writes nothing. list prints every publisher/name from the public catalog.
|
|
293
300
|
The hub stores packs and does not answer questions.`,
|
|
301
|
+
persona: `Usage: knolo persona <init|build|verify|eval>
|
|
302
|
+
|
|
303
|
+
knolo persona init <name> [--dir <parent>]
|
|
304
|
+
knolo persona build <dir> [--out <file>] [--json]
|
|
305
|
+
knolo persona verify <image> [--withdrawn <id>] [--json]
|
|
306
|
+
knolo persona eval <image> --fixtures <file> [--json]
|
|
307
|
+
|
|
308
|
+
Builds a persona pack on the current V5 image.
|
|
309
|
+
Knolo core does not call a model. The host owns the model.
|
|
310
|
+
A receipt is an integrity check. It does not mean a claim is proven.
|
|
311
|
+
SATISFIED means the evidence requirements were met.
|
|
312
|
+
A KITE verdict describes the contract. It does not mean the claim is true.
|
|
313
|
+
verify fails when a withdrawn source id is still in the image.
|
|
314
|
+
An opt-out rebuild drops that file and produces a new pin.
|
|
315
|
+
The example adapter is examples/persona-chat.`,
|
|
294
316
|
'verify-attestation': 'Usage: knolo verify-attestation <attestation.json> [--composition composition.json] [--public-key key.json] [--keyring keyring.json] [--now <ms>] [--content-only]\n\nSame check as knolo attest verify. A bad signature exits 1 even when the content root matches. --content-only checks the content root and ignores the envelope. statement used is not a truth verdict. Hub attested: true is unrelated.',
|
|
295
317
|
icp: 'Usage: knolo icp <command> [options]',
|
|
296
318
|
'semantic:index':
|
|
@@ -1965,6 +1987,10 @@ async function main() {
|
|
|
1965
1987
|
const { runSkillCli } = await import('./skill.mjs');
|
|
1966
1988
|
return await runSkillCli(commandArgs);
|
|
1967
1989
|
}
|
|
1990
|
+
if (command === 'persona') {
|
|
1991
|
+
const { runPersonaCli } = await import('./persona.mjs');
|
|
1992
|
+
return await runPersonaCli(commandArgs);
|
|
1993
|
+
}
|
|
1968
1994
|
if (command === 'exchange') {
|
|
1969
1995
|
const { runExchangeCli } = await import('./exchange.mjs');
|
|
1970
1996
|
return await runExchangeCli(commandArgs);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { register } from 'node:module';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
|
|
4
|
+
const RETRIES = 2;
|
|
5
|
+
|
|
6
|
+
let hookRegistration;
|
|
7
|
+
|
|
8
|
+
function ensureHook() {
|
|
9
|
+
hookRegistration ??= register(
|
|
10
|
+
new URL('./core-load-hook.mjs', import.meta.url).href,
|
|
11
|
+
import.meta.url
|
|
12
|
+
);
|
|
13
|
+
return hookRegistration;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function specifierFor(candidate) {
|
|
17
|
+
if (
|
|
18
|
+
candidate.startsWith('file:') ||
|
|
19
|
+
candidate.startsWith('node:') ||
|
|
20
|
+
candidate.startsWith('data:')
|
|
21
|
+
) {
|
|
22
|
+
return candidate;
|
|
23
|
+
}
|
|
24
|
+
if (
|
|
25
|
+
candidate.startsWith('/') ||
|
|
26
|
+
candidate.startsWith('.') ||
|
|
27
|
+
/^[A-Za-z]:[\\/]/.test(candidate)
|
|
28
|
+
) {
|
|
29
|
+
return pathToFileURL(candidate).href;
|
|
30
|
+
}
|
|
31
|
+
return candidate;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function isNotFound(error) {
|
|
35
|
+
return error?.code === 'ERR_MODULE_NOT_FOUND' || error?.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function withEpoch(specifier, epoch) {
|
|
39
|
+
await ensureHook();
|
|
40
|
+
const href = specifier.startsWith('file:') ? specifier : import.meta.resolve(specifier);
|
|
41
|
+
const url = new URL(href);
|
|
42
|
+
url.searchParams.set('knolo-epoch', String(epoch));
|
|
43
|
+
return url.href;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function delay(ms) {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
setTimeout(resolve, ms);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function loadCoreModule(candidates, ready) {
|
|
53
|
+
let lastError = null;
|
|
54
|
+
for (const candidate of candidates) {
|
|
55
|
+
const specifier = specifierFor(candidate);
|
|
56
|
+
let missing = false;
|
|
57
|
+
for (let epoch = 0; epoch <= RETRIES; epoch += 1) {
|
|
58
|
+
try {
|
|
59
|
+
const href = epoch === 0 ? specifier : await withEpoch(specifier, epoch);
|
|
60
|
+
const loaded = await import(href);
|
|
61
|
+
if (ready(loaded)) return loaded;
|
|
62
|
+
lastError = new Error('module did not export the expected API');
|
|
63
|
+
} catch (error) {
|
|
64
|
+
lastError = error;
|
|
65
|
+
if (isNotFound(error)) {
|
|
66
|
+
missing = true;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (epoch < RETRIES) await delay(25 * (epoch + 1));
|
|
71
|
+
}
|
|
72
|
+
if (missing) continue;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
throw lastError ?? new Error('module did not export the expected API');
|
|
76
|
+
}
|