@knolo/cli 6.2.7 → 6.2.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/README.md +26 -3
- package/bin/exchange.mjs +22 -5
- package/bin/knolo.mjs +21 -8
- package/bin/registry/ask.mjs +334 -0
- package/bin/registry/categories.mjs +31 -0
- package/bin/registry/commands.mjs +14 -1
- package/bin/research.mjs +275 -7
- package/bin/skill.mjs +28 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ 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.
|
|
22
|
+
package file is `6.2.8` and depends on `@knolo/core` `^6.2.3` and
|
|
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
24
|
package and in that release. It 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
|
|
@@ -55,6 +55,9 @@ the host-supplied caller. An optional Cortex trace is verified against
|
|
|
55
55
|
record and does not copy the cited image. Pass `--graph` when that trace
|
|
56
56
|
records KAR evaluations. The checked graph is stored in the image. The
|
|
57
57
|
command does not call a model and does not download an image.
|
|
58
|
+
`knolo research verify <image>` re-checks those stored records.
|
|
59
|
+
`--cited` supplies the cited bytes. Without them, digest mode says the
|
|
60
|
+
bytes were not supplied. `--require-material` fails when they are missing.
|
|
58
61
|
`examples/skills/research-and-cite` and `examples/skills/share-findings`
|
|
59
62
|
install with `knolo skill install`. See
|
|
60
63
|
[Research packs](../../docs/guides/research-packs.md).
|
|
@@ -88,8 +91,28 @@ changing the local pack workflow:
|
|
|
88
91
|
knolo search "refund policy"
|
|
89
92
|
knolo search "refund policy" --research
|
|
90
93
|
knolo info acme/refund-policy
|
|
94
|
+
knolo ask "what is the refund window?" --category business --model llama3.2
|
|
95
|
+
knolo ask "how does rust ownership work" --category coding --category math --evidence
|
|
96
|
+
knolo ask "what changed overnight" --all --model llama3.2
|
|
91
97
|
```
|
|
92
98
|
|
|
99
|
+
`knolo ask` posts the question to `POST /api/v1/knowledge/query`, checks each
|
|
100
|
+
excerpt sha256, and sends the verified excerpts and skill instructions to an
|
|
101
|
+
OpenAI-compatible chat endpoint. The default is Ollama at
|
|
102
|
+
`http://127.0.0.1:11434/v1`. Set `KNOLO_MODEL_BASE_URL` and `KNOLO_MODEL` for
|
|
103
|
+
another local server or a cloud gateway such as `https://api.x.ai/v1`.
|
|
104
|
+
`KNOLO_MODEL_API_KEY` is sent only to that endpoint. Hub does not receive the
|
|
105
|
+
key or the answer, and it does not install a matched skill. Pass `--category`
|
|
106
|
+
one or more times, or pass `--all` to search the entire hub. With neither,
|
|
107
|
+
the command exits before the network call. `--evidence` prints skills first,
|
|
108
|
+
then excerpts, and does not call a model. A `402` plan limit does not call
|
|
109
|
+
the model. With no remaining evidence the command exits 1 and does not call
|
|
110
|
+
the model. If only a skill remains, the model still runs with that skill text.
|
|
111
|
+
|
|
112
|
+
`knolo publish` and `knolo skill publish` take the same repeatable
|
|
113
|
+
`--category`. A new pack and every skill publish use 1 to 3 of `coding`,
|
|
114
|
+
`math`, `science`, `news`, `business`, `security`, `writing`, `general`.
|
|
115
|
+
|
|
93
116
|
`--research` asks for packs whose image metadata role is `research-pack`.
|
|
94
117
|
`--agents` remains the agent-definition namespace.
|
|
95
118
|
|
|
@@ -387,7 +410,7 @@ This ensures:
|
|
|
387
410
|
## 🗺 Roadmap
|
|
388
411
|
|
|
389
412
|
The active roadmap is maintained in [`../../docs/ROADMAP.md`](../../docs/ROADMAP.md).
|
|
390
|
-
The published npm release is `6.2.
|
|
413
|
+
The published npm release is `6.2.8`. This tree's package file is `6.2.8` and adds `knolo research verify` and `knolo exchange relay`. `@knolo/cli@6.2.7` does not include those commands. `@knolo/cli@6.2.5` does not include `knolo kite`. The published release preserves the V4 CLI, keeps V5 verification,
|
|
391
414
|
migration, diagnostics, and read-only Studio management, and adds offline
|
|
392
415
|
composition, attestation, and `knolo cortex`. Cortex verification does not
|
|
393
416
|
mean an answer is true.
|
package/bin/exchange.mjs
CHANGED
|
@@ -4,17 +4,32 @@ import {
|
|
|
4
4
|
importExchangeDirectory,
|
|
5
5
|
inspectExchangeReceipt,
|
|
6
6
|
loadExchangeConfig,
|
|
7
|
+
loadRelayConfig,
|
|
7
8
|
publishExchangeOffer,
|
|
8
9
|
pullExchangeOffer,
|
|
10
|
+
startExchangeRelay,
|
|
9
11
|
startExchangeServer,
|
|
10
12
|
} from '@knolo/exchange';
|
|
11
13
|
import { registryApiUrl, resolveRegistryUrl } from './registry/config.mjs';
|
|
12
14
|
|
|
13
15
|
export async function runExchangeCli(argv) {
|
|
14
16
|
const { command, flags, positional } = parse(argv);
|
|
17
|
+
if (command === 'relay') {
|
|
18
|
+
if (!flags.config)
|
|
19
|
+
throw new Error('Usage: knolo exchange relay --config <relay.json>');
|
|
20
|
+
const relayConfig = loadRelayConfig(flags.config);
|
|
21
|
+
const server = await startExchangeRelay(relayConfig);
|
|
22
|
+
console.log(server.url);
|
|
23
|
+
await new Promise((resolve) => {
|
|
24
|
+
process.once('SIGINT', resolve);
|
|
25
|
+
process.once('SIGTERM', resolve);
|
|
26
|
+
});
|
|
27
|
+
await server.close();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
15
30
|
if (!flags.config && command !== 'inspect' && command !== 'discover')
|
|
16
31
|
throw new Error(
|
|
17
|
-
'Usage: knolo exchange <serve|offer|pull|export|import|adopt|discover|inspect> --config <exchange.json>'
|
|
32
|
+
'Usage: knolo exchange <serve|offer|pull|export|import|adopt|discover|inspect|relay> --config <exchange.json>'
|
|
18
33
|
);
|
|
19
34
|
const config = flags.config ? loadExchangeConfig(flags.config) : undefined;
|
|
20
35
|
const now = flags.now === undefined ? Date.now() : Number(flags.now);
|
|
@@ -39,13 +54,14 @@ export async function runExchangeCli(argv) {
|
|
|
39
54
|
const imagePath = positional[0];
|
|
40
55
|
if (!imagePath || !flags.to)
|
|
41
56
|
throw new Error(
|
|
42
|
-
'Usage: knolo exchange offer <image.knolo> --to <peer> --config <exchange.json>'
|
|
57
|
+
'Usage: knolo exchange offer <image.knolo> --to <peer> [--via <https-url>] --config <exchange.json>'
|
|
43
58
|
);
|
|
44
59
|
const published = await publishExchangeOffer(config, {
|
|
45
60
|
imagePath,
|
|
46
61
|
to: flags.to,
|
|
47
62
|
now,
|
|
48
63
|
...(flags.ttl === undefined ? {} : { ttlMs: Number(flags.ttl) }),
|
|
64
|
+
...(flags.via === undefined ? {} : { via: flags.via }),
|
|
49
65
|
});
|
|
50
66
|
console.log(published.offerId);
|
|
51
67
|
return;
|
|
@@ -54,7 +70,7 @@ export async function runExchangeCli(argv) {
|
|
|
54
70
|
const offerId = positional[0];
|
|
55
71
|
if (!offerId || !flags.from)
|
|
56
72
|
throw new Error(
|
|
57
|
-
'Usage: knolo exchange pull <offer-id> --from <peer> --config <exchange.json>'
|
|
73
|
+
'Usage: knolo exchange pull <offer-id> --from <peer-or-https-url> --config <exchange.json>'
|
|
58
74
|
);
|
|
59
75
|
const pulled = await pullExchangeOffer(config, {
|
|
60
76
|
offerId,
|
|
@@ -168,7 +184,7 @@ export async function runExchangeCli(argv) {
|
|
|
168
184
|
return;
|
|
169
185
|
}
|
|
170
186
|
throw new Error(
|
|
171
|
-
'Usage: knolo exchange <serve|offer|pull|export|import|adopt|discover|inspect>'
|
|
187
|
+
'Usage: knolo exchange <serve|offer|pull|export|import|adopt|discover|inspect|relay>'
|
|
172
188
|
);
|
|
173
189
|
}
|
|
174
190
|
|
|
@@ -195,7 +211,8 @@ function parse(argv) {
|
|
|
195
211
|
arg === '--now' ||
|
|
196
212
|
arg === '--out' ||
|
|
197
213
|
arg === '--store' ||
|
|
198
|
-
arg === '--registry'
|
|
214
|
+
arg === '--registry' ||
|
|
215
|
+
arg === '--via'
|
|
199
216
|
) {
|
|
200
217
|
flags[arg.slice(2)] = argv[++i];
|
|
201
218
|
} else if (arg.startsWith('--')) {
|
package/bin/knolo.mjs
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
runHubWhoami,
|
|
32
32
|
runHubYank,
|
|
33
33
|
} from './registry/commands.mjs';
|
|
34
|
+
import { runHubAsk } from './registry/ask.mjs';
|
|
34
35
|
|
|
35
36
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
36
37
|
const require = createRequire(import.meta.url);
|
|
@@ -63,6 +64,7 @@ const SUBCOMMANDS = new Set([
|
|
|
63
64
|
'dev',
|
|
64
65
|
'v5',
|
|
65
66
|
'search',
|
|
67
|
+
'ask',
|
|
66
68
|
'info',
|
|
67
69
|
'login',
|
|
68
70
|
'whoami',
|
|
@@ -162,6 +164,7 @@ Commands:
|
|
|
162
164
|
init Initialize knolo.config.json and starter docs
|
|
163
165
|
add <name> <path> Add or update a local source entry, or install a Hub pack
|
|
164
166
|
search <query> Search the Knolo Hub registry
|
|
167
|
+
ask "<question>" Answer from Hub excerpts with your model
|
|
165
168
|
info <publisher>/<slug> Show a Hub registry pack
|
|
166
169
|
login Store a Hub token locally
|
|
167
170
|
whoami Show the stored Hub token prefix
|
|
@@ -186,7 +189,7 @@ Commands:
|
|
|
186
189
|
skill Create and share a Knolo skill pack
|
|
187
190
|
research Package local research files into a V5 Knowledge Image
|
|
188
191
|
setup Prepare a local index and print the hub next steps
|
|
189
|
-
exchange Offer or pull a verified Knowledge Image from a peer
|
|
192
|
+
exchange Offer or pull a verified Knowledge Image from a peer or relay
|
|
190
193
|
icp Scaffold and operate an ICP-native knowledge canister
|
|
191
194
|
|
|
192
195
|
Global options:
|
|
@@ -203,13 +206,15 @@ function printCommandHelp(command) {
|
|
|
203
206
|
add: 'Usage: knolo add <name> <path> | <publisher>/<slug>[@<version>] [--out <path>] [--force] [--json] [--registry <url>]',
|
|
204
207
|
search:
|
|
205
208
|
'Usage: knolo search <query> [--format V4|V5] [--license <id>] [--official] [--agents] [--research] [--json] [--registry <url>]',
|
|
209
|
+
ask:
|
|
210
|
+
'Usage: knolo ask "<question>" [--category <id>] [--all] [--model <name>] [--base-url <url>] [--limit <n>] [--evidence] [--hub <url>]\n\nPosts the question to Hub and sends the verified excerpts and skill instructions to an OpenAI-compatible chat endpoint. The default base URL is http://127.0.0.1:11434/v1 (Ollama). Set KNOLO_MODEL_BASE_URL and KNOLO_MODEL for another engine, including a cloud gateway such as https://api.x.ai/v1. KNOLO_MODEL_API_KEY is sent only to that endpoint.\nPass --category one or more times, or pass --all to search the entire hub. With neither, ask exits before the network call. --evidence prints skills first, then excerpts, and does not call a model. A plan limit does not call a model. --hub is the same registry override as --registry.',
|
|
206
211
|
info: 'Usage: knolo info <publisher>/<slug> [--json] [--registry <url>]',
|
|
207
212
|
login:
|
|
208
213
|
'Usage: knolo login [--token kno_…] [--stdin] [--registry <url>]\n\nStores the raw token locally. Hub write calls send Authorization: Bearer kno_….\nMint tokens at https://hub.knolo.dev/dashboard/tokens; login does not call POST /api/v1/tokens.',
|
|
209
214
|
whoami: 'Usage: knolo whoami',
|
|
210
215
|
logout: 'Usage: knolo logout',
|
|
211
216
|
publish:
|
|
212
|
-
'Usage: knolo publish <pack.knolo> --slug <slug> --version <version> --license <SPDX> [--publisher <handle>] [--readme <text>] [--sources <text>] [--intended-use <text>] [--private] [--json] [--registry <url>]\n\nUses the stored dashboard token as Authorization: Bearer kno_…. Hub issues a public Blob PUT grant; the CLI never needs PACKS_READ_WRITE_TOKEN.\nUploads go to the grant URL without the kno_ token. Complete sends the public Blob URL, then Hub verifies before release.\n--private releases an owner-only pack on a Business or Enterprise plan. The success text omits the Blob URL.',
|
|
217
|
+
'Usage: knolo publish <pack.knolo> --slug <slug> --version <version> --license <SPDX> [--publisher <handle>] [--readme <text>] [--sources <text>] [--intended-use <text>] [--category <id>] [--private] [--json] [--registry <url>]\n\nUses the stored dashboard token as Authorization: Bearer kno_…. Hub issues a public Blob PUT grant; the CLI never needs PACKS_READ_WRITE_TOKEN.\nUploads go to the grant URL without the kno_ token. Complete sends the public Blob URL, then Hub verifies before release.\n--category is repeatable, from 1 to 3 of coding, math, science, news, business, security, writing, general. A new pack needs at least one. --private releases an owner-only pack on a Business or Enterprise plan. The success text omits the Blob URL.',
|
|
213
218
|
yank: 'Usage: knolo yank <publisher>/<slug>@<version> [--json] [--registry <url>]\n\nUses the stored token as Authorization: Bearer kno_…. Yank is owner-only and leaves the public Blob in place.',
|
|
214
219
|
build: 'Usage: knolo build',
|
|
215
220
|
query:
|
|
@@ -228,7 +233,7 @@ function printCommandHelp(command) {
|
|
|
228
233
|
cortex: 'Usage: knolo cortex <find|ask|explain|verify> [options]\n\nBounded evidence retrieval. The CLI does not call a model.\n\n knolo cortex find <image> --question "..." [--top-k 100] --out candidates.json\n knolo cortex ask <image> --question "..." [--graph file] [--plan plan.json] [--mode find_relevant] --out answer.cortex.json\n knolo cortex explain answer.cortex.json\n knolo cortex verify --image <image> --answer answer.cortex.json [--graph file]\n\nVerification recomputes the trace roots. It does not mean the answer is true. A KAR status of SATISFIED means evidence requirements were met. It does not mean a claim is proven.',
|
|
229
234
|
kite: 'Usage: knolo kite <evaluate|verify> [options]\n\n knolo kite evaluate --image <image.knolo> --contract <contract.json> --rules <rules.json> [--completeness <file>] [--changes <file>] [--bounds <file>] [--graph <file>] [--as-of YYYY-MM-DD] [--out <result.json>] [--json]\n knolo kite verify --image <image.knolo> --contract <contract.json> --rules <rules.json> --certificate <certificate.json> [--completeness <file>] [--changes <file>] [--bounds <file>] [--graph <file>] [--as-of YYYY-MM-DD]\n\nEvaluation names unmet obligations and derives a verdict inside the declared changes. Verification recomputes that derivation. A certificate is an integrity check. It does not mean the claim is true. BOUND_EXCEEDED means the search did not finish and is not a certificate. This command ships in this package. It loads @knolo/core/kite.',
|
|
230
235
|
research:
|
|
231
|
-
'Usage: knolo research package --question <text> --agent <id> --out <image.knolo> --source <file> [--source <file>] [--cite <image.knolo> --trace <answer.cortex.json> [--graph <file>]] [--json]\n\nPacks local files into one V5 Knowledge Image. --agent is the host-supplied caller. --cite and --trace are both required or both omitted. --graph is required when the trace contains KAR evaluations, and it is the same file knolo cortex verify would use. A trace is verified against --cite before any write. A failed check writes nothing. When --cite is set, the image stores a digest-bound composition record for that image and does not copy its bytes. When --graph is set, the checked graph is stored. The command does not call a model and does not download an image. A packed trace is an integrity check. It does not mean a claim is proven. SATISFIED means the trace evidence requirements were met.',
|
|
236
|
+
'Usage: knolo research package --question <text> --agent <id> --out <image.knolo> --source <file> [--source <file>] [--cite <image.knolo> --trace <answer.cortex.json> [--graph <file>]] [--json]\n\nPacks local files into one V5 Knowledge Image. --agent is the host-supplied caller. --cite and --trace are both required or both omitted. --graph is required when the trace contains KAR evaluations, and it is the same file knolo cortex verify would use. A trace is verified against --cite before any write. A failed check writes nothing. When --cite is set, the image stores a digest-bound composition record for that image and does not copy its bytes. When --graph is set, the checked graph is stored. The command does not call a model and does not download an image. A packed trace is an integrity check. It does not mean a claim is proven. SATISFIED means the trace evidence requirements were met.\n\nUsage: knolo research verify <image.knolo> [--cited <file>]... [--require-material] [--json]\n\nVerifies the image roots, then re-checks a stored composition record, Cortex trace, and KAR graph with the existing verifiers. --cited supplies member bytes in member order. Without those bytes, digest mode succeeds and says the cited bytes were not supplied. --require-material fails when a member has no bytes. The command does not call a model and does not download an image. A verified trace is an integrity check. It does not mean a claim is proven. SATISFIED means evidence requirements were met.',
|
|
232
237
|
flight: 'Usage: knolo flight <ingest|verify-log> [options]\n\n knolo flight ingest --events <events.json> --log <file> --out <image.knolo> [--json]\n knolo flight verify-log --image <image.knolo> --log <file> [--json]\n\ningest packs a flight-events-1 document into a V5 Knowledge Image. It hashes --log and writes nothing when the hash or byte length differs. verify-log hashes --log again and compares it with the flight-log object. It writes nothing. A missing flight-log object fails closed. Neither command decodes the log. log.format is ulog, dataflash, or rosbag2. A later KAR status of SATISFIED means evidence requirements were met. It does not mean a flight was safe, legal, or compliant.',
|
|
233
238
|
setup: `Usage: knolo setup [--registry <url>] [--root <dir>] [--agent <id>] [--auto-rebuild] [--reset] [--skills <path>] [--managed-skills <path>] [--memory <path>] [--transcripts <path>]
|
|
234
239
|
|
|
@@ -244,29 +249,32 @@ Pass --agent to set the caller name. Pass --auto-rebuild to rebuild on the next
|
|
|
244
249
|
Does not prompt. Does not install a pack or call the hub.
|
|
245
250
|
A missing knolo-box is printed, and setup still exits 0.
|
|
246
251
|
When more than one skill folder matches, pass --skills or --managed-skills.`,
|
|
247
|
-
exchange: `Usage: knolo exchange <serve|offer|pull|export|import|adopt|discover|inspect> --config <exchange.json>
|
|
252
|
+
exchange: `Usage: knolo exchange <serve|offer|pull|export|import|adopt|discover|inspect|relay> --config <exchange.json>
|
|
248
253
|
|
|
249
254
|
knolo exchange serve --config exchange.json
|
|
250
|
-
knolo exchange offer <image.knolo> --to <peer> --config exchange.json
|
|
251
|
-
knolo exchange pull <offer-id> --from <peer> --config exchange.json
|
|
255
|
+
knolo exchange offer <image.knolo> --to <peer> [--via <https-url>] --config exchange.json
|
|
256
|
+
knolo exchange pull <offer-id> --from <peer-or-https-url> --config exchange.json
|
|
252
257
|
knolo exchange export <image.knolo> --to <peer> --out <dir> --config exchange.json
|
|
253
258
|
knolo exchange import <dir> --config exchange.json
|
|
254
259
|
knolo exchange adopt <receipt-id> --store <file> --home <dir> --config exchange.json
|
|
255
260
|
knolo exchange discover <handle> [--registry <url>]
|
|
256
261
|
knolo exchange inspect <receipt-id> --home <dir> [--config exchange.json]
|
|
262
|
+
knolo exchange relay --config relay.json
|
|
257
263
|
|
|
258
264
|
Pull, export, and import do not call Knolo Hub and do not write knolo.lock.json.
|
|
259
265
|
export writes offer.cbor and the image into a directory. import reads that
|
|
260
266
|
directory. Receiving an image verifies SHA-256 and the V5 state root. It does
|
|
261
267
|
not mount the image into a store or activate a skill. adopt opens a local
|
|
262
268
|
store only when policy.adopt is allow. discover reads a public publisher
|
|
263
|
-
advertisement and does not download pack bytes
|
|
269
|
+
advertisement and does not download pack bytes. relay stores the offer and
|
|
270
|
+
the image so the sender can go offline. It does not verify, mount, or adopt,
|
|
271
|
+
and it is not Knolo Hub. offer --via uploads to that relay instead of serve.`,
|
|
264
272
|
skill: `Usage: knolo skill <init|check|pack|publish|install|search|info|list>
|
|
265
273
|
|
|
266
274
|
knolo skill init <name> [--dir <parent>]
|
|
267
275
|
knolo skill check [<dir>] [--query <text>] [--json]
|
|
268
276
|
knolo skill pack [<dir>] [--out <dir>] [--json]
|
|
269
|
-
knolo skill publish <pack> [--registry <url>] [--json]
|
|
277
|
+
knolo skill publish <pack> [--category <id>] [--registry <url>] [--json]
|
|
270
278
|
knolo skill publish <pack> --hub <dir> [--json]
|
|
271
279
|
knolo skill install <publisher>/<name> [--dir <path>] [--registry <url>] [--json]
|
|
272
280
|
knolo skill install <name> --hub <dir> [--dir <path>] [--json]
|
|
@@ -1968,6 +1976,11 @@ async function main() {
|
|
|
1968
1976
|
if (command === 'init') return await cmdInit();
|
|
1969
1977
|
if (command === 'add') return await cmdAdd(commandArgs);
|
|
1970
1978
|
if (command === 'search') return await runHubSearch(commandArgs);
|
|
1979
|
+
if (command === 'ask') {
|
|
1980
|
+
const result = await runHubAsk(commandArgs);
|
|
1981
|
+
if (result.exitCode) process.exit(result.exitCode);
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1971
1984
|
if (command === 'info') return await runHubInfo(commandArgs);
|
|
1972
1985
|
if (command === 'login') return await runHubLogin(commandArgs);
|
|
1973
1986
|
if (command === 'whoami') return await runHubWhoami(commandArgs);
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import {
|
|
3
|
+
normalizeRegistryUrl,
|
|
4
|
+
registryApiUrl,
|
|
5
|
+
resolveRegistryUrl,
|
|
6
|
+
} from './config.mjs';
|
|
7
|
+
import { normalizeCategories } from './categories.mjs';
|
|
8
|
+
import { loadCredentials } from './credentials.mjs';
|
|
9
|
+
import { RegistryError, RegistryNetworkError } from './errors.mjs';
|
|
10
|
+
import { postJson } from './http.mjs';
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_MODEL_BASE_URL = 'http://127.0.0.1:11434/v1';
|
|
13
|
+
export const ASK_SYSTEM_PROMPT =
|
|
14
|
+
'Answer only from the excerpts and any skill instructions in the prompt. Cite each knowledge claim with publisher/slug@version and the object id. Cite a skill as publisher/name. Do not use outside knowledge.';
|
|
15
|
+
|
|
16
|
+
const SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
17
|
+
|
|
18
|
+
export function excerptDigest(excerpt) {
|
|
19
|
+
return createHash('sha256').update(excerpt, 'utf8').digest('hex');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function citation(hit) {
|
|
23
|
+
return `${hit.publisher}/${hit.slug}@${hit.version} ${hit.objectId}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function normalizeModelBaseUrl(value) {
|
|
27
|
+
if (typeof value !== 'string' || !value.trim()) {
|
|
28
|
+
throw new Error('Model base URL must be an HTTP(S) URL.');
|
|
29
|
+
}
|
|
30
|
+
let url;
|
|
31
|
+
try {
|
|
32
|
+
url = new URL(value.trim());
|
|
33
|
+
} catch {
|
|
34
|
+
throw new Error(`Invalid model base URL: ${value}`);
|
|
35
|
+
}
|
|
36
|
+
if (!['http:', 'https:'].includes(url.protocol)) {
|
|
37
|
+
throw new Error('Model base URL must use http or https.');
|
|
38
|
+
}
|
|
39
|
+
if (url.username || url.password) {
|
|
40
|
+
throw new Error('Model base URL must not include credentials.');
|
|
41
|
+
}
|
|
42
|
+
url.search = '';
|
|
43
|
+
url.hash = '';
|
|
44
|
+
const pathname = url.pathname.replace(/\/+$/, '');
|
|
45
|
+
return `${url.origin}${pathname === '/' ? '' : pathname}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function chatCompletionsUrl(baseUrl) {
|
|
49
|
+
return `${normalizeModelBaseUrl(baseUrl)}/chat/completions`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function parseAskArgs(args) {
|
|
53
|
+
const positional = [];
|
|
54
|
+
const flags = {};
|
|
55
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
56
|
+
const arg = args[i];
|
|
57
|
+
if (arg === '--evidence') {
|
|
58
|
+
flags.evidence = true;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (arg === '--all') {
|
|
62
|
+
flags.all = true;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (arg === '--category') {
|
|
66
|
+
const value = args[++i];
|
|
67
|
+
if (value === undefined || value.startsWith('--')) {
|
|
68
|
+
throw new Error('Missing value for --category');
|
|
69
|
+
}
|
|
70
|
+
flags.categories = [...(flags.categories ?? []), value];
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (['--model', '--base-url', '--limit', '--hub', '--registry'].includes(arg)) {
|
|
74
|
+
const value = args[++i];
|
|
75
|
+
if (value === undefined || value.startsWith('--')) {
|
|
76
|
+
throw new Error(`Missing value for ${arg}`);
|
|
77
|
+
}
|
|
78
|
+
if (arg === '--hub' || arg === '--registry') flags.hub = value;
|
|
79
|
+
else flags[arg.slice(2)] = value;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (arg.startsWith('--')) throw new Error(`Unknown flag for ask: ${arg}`);
|
|
83
|
+
positional.push(arg);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const question = positional.join(' ').trim();
|
|
87
|
+
if (!question) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
'Usage: knolo ask "<question>" [--category <id>] [--all] [--model <name>] [--base-url <url>] [--limit <n>] [--evidence] [--hub <url>]'
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
if (flags.all && flags.categories) {
|
|
93
|
+
throw new Error('Use either --all or --category, not both.');
|
|
94
|
+
}
|
|
95
|
+
if (!flags.all && !flags.categories) {
|
|
96
|
+
throw new Error('Pick one category with --category, or pass --all to search the entire hub.');
|
|
97
|
+
}
|
|
98
|
+
if (flags.categories) {
|
|
99
|
+
flags.categories = normalizeCategories(flags.categories, { min: 1, max: 8 });
|
|
100
|
+
}
|
|
101
|
+
if (flags.limit !== undefined) {
|
|
102
|
+
if (!/^[1-9]\d*$/.test(flags.limit)) {
|
|
103
|
+
throw new Error('--limit must be an integer from 1 to 20.');
|
|
104
|
+
}
|
|
105
|
+
const limit = Number(flags.limit);
|
|
106
|
+
if (limit < 1 || limit > 20) {
|
|
107
|
+
throw new Error('--limit must be an integer from 1 to 20.');
|
|
108
|
+
}
|
|
109
|
+
flags.limit = limit;
|
|
110
|
+
}
|
|
111
|
+
return { question, flags };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function modelName(flags, env) {
|
|
115
|
+
const name = flags.model || env.KNOLO_MODEL;
|
|
116
|
+
return typeof name === 'string' && name.trim() ? name.trim() : '';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function modelBase(flags, env) {
|
|
120
|
+
return normalizeModelBaseUrl(
|
|
121
|
+
flags['base-url'] || env.KNOLO_MODEL_BASE_URL || DEFAULT_MODEL_BASE_URL
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async function hubToken(registry, { env, homeDir }) {
|
|
126
|
+
try {
|
|
127
|
+
const credentials = await loadCredentials({ env, homeDir });
|
|
128
|
+
if (normalizeRegistryUrl(credentials.registry) !== normalizeRegistryUrl(registry)) {
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
return credentials.token;
|
|
132
|
+
} catch (error) {
|
|
133
|
+
if (error instanceof Error && error.message.startsWith('Not logged in')) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function asHit(value) {
|
|
141
|
+
if (!value || typeof value !== 'object') return null;
|
|
142
|
+
const hit = value;
|
|
143
|
+
if (typeof hit.publisher !== 'string' || !hit.publisher.trim()) return null;
|
|
144
|
+
if (typeof hit.slug !== 'string' || !hit.slug.trim()) return null;
|
|
145
|
+
if (typeof hit.version !== 'string' || !hit.version.trim()) return null;
|
|
146
|
+
if (typeof hit.objectId !== 'string' || !hit.objectId.trim()) return null;
|
|
147
|
+
if (typeof hit.excerpt !== 'string' || !hit.excerpt) return null;
|
|
148
|
+
if (typeof hit.excerptSha256 !== 'string' || !SHA256_HEX.test(hit.excerptSha256.toLowerCase())) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (excerptDigest(hit.excerpt) !== hit.excerptSha256.toLowerCase()) return null;
|
|
152
|
+
return {
|
|
153
|
+
publisher: hit.publisher,
|
|
154
|
+
slug: hit.slug,
|
|
155
|
+
version: hit.version,
|
|
156
|
+
objectId: hit.objectId,
|
|
157
|
+
heading: typeof hit.heading === 'string' ? hit.heading : '',
|
|
158
|
+
excerpt: hit.excerpt,
|
|
159
|
+
excerptSha256: hit.excerptSha256.toLowerCase(),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function verifiedHits(hits) {
|
|
164
|
+
if (!Array.isArray(hits)) return [];
|
|
165
|
+
return hits.map(asHit).filter((hit) => hit !== null);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function asSkill(value) {
|
|
169
|
+
if (!value || typeof value !== 'object') return null;
|
|
170
|
+
const skill = value;
|
|
171
|
+
if (typeof skill.publisher !== 'string' || !skill.publisher.trim()) return null;
|
|
172
|
+
if (typeof skill.name !== 'string' || !skill.name.trim()) return null;
|
|
173
|
+
if (typeof skill.excerpt !== 'string' || !skill.excerpt) return null;
|
|
174
|
+
if (typeof skill.excerptSha256 !== 'string' || !SHA256_HEX.test(skill.excerptSha256.toLowerCase())) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
if (excerptDigest(skill.excerpt) !== skill.excerptSha256.toLowerCase()) return null;
|
|
178
|
+
if (typeof skill.skillSha256 !== 'string' || !SHA256_HEX.test(skill.skillSha256.toLowerCase())) {
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
publisher: skill.publisher,
|
|
183
|
+
name: skill.name,
|
|
184
|
+
description: typeof skill.description === 'string' ? skill.description : '',
|
|
185
|
+
excerpt: skill.excerpt,
|
|
186
|
+
excerptSha256: skill.excerptSha256.toLowerCase(),
|
|
187
|
+
skillSha256: skill.skillSha256.toLowerCase(),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function verifiedSkills(skills) {
|
|
192
|
+
if (!Array.isArray(skills)) return [];
|
|
193
|
+
return skills.map(asSkill).filter((skill) => skill !== null);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function printEvidence(skills, hits, print) {
|
|
197
|
+
for (const skill of skills) {
|
|
198
|
+
print(`${skill.publisher}/${skill.name}`);
|
|
199
|
+
if (skill.description) print(skill.description);
|
|
200
|
+
print(skill.excerpt);
|
|
201
|
+
print(skill.excerptSha256);
|
|
202
|
+
print('');
|
|
203
|
+
}
|
|
204
|
+
for (const hit of hits) {
|
|
205
|
+
print(citation(hit));
|
|
206
|
+
if (hit.heading) print(hit.heading);
|
|
207
|
+
print(hit.excerpt);
|
|
208
|
+
print(hit.excerptSha256);
|
|
209
|
+
print('');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function answerText(body) {
|
|
214
|
+
const content = body?.choices?.[0]?.message?.content;
|
|
215
|
+
return typeof content === 'string' ? content.trim() : '';
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Queries Hub, checks excerpt hashes, then asks the user's chat endpoint.
|
|
220
|
+
* The model key is sent only to that endpoint. Hub never receives it.
|
|
221
|
+
*/
|
|
222
|
+
export async function runHubAsk(
|
|
223
|
+
args,
|
|
224
|
+
{
|
|
225
|
+
env = process.env,
|
|
226
|
+
fetchImpl = globalThis.fetch,
|
|
227
|
+
homeDir,
|
|
228
|
+
print = console.log,
|
|
229
|
+
printError = console.error,
|
|
230
|
+
} = {}
|
|
231
|
+
) {
|
|
232
|
+
const { question, flags } = parseAskArgs(args);
|
|
233
|
+
const model = modelName(flags, env);
|
|
234
|
+
if (!flags.evidence && !model) {
|
|
235
|
+
throw new Error(
|
|
236
|
+
'Set --model or KNOLO_MODEL. Use --evidence to print Hub excerpts without a model.'
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const registry = resolveRegistryUrl({ value: flags.hub, env });
|
|
241
|
+
const url = registryApiUrl(registry, ['knowledge', 'query']);
|
|
242
|
+
const token = await hubToken(registry, { env, homeDir });
|
|
243
|
+
const headers = token ? { Authorization: `Bearer ${token}` } : {};
|
|
244
|
+
const body = { q: question };
|
|
245
|
+
if (flags.limit !== undefined) body.limit = flags.limit;
|
|
246
|
+
if (flags.categories) body.categories = flags.categories;
|
|
247
|
+
|
|
248
|
+
let response;
|
|
249
|
+
try {
|
|
250
|
+
response = await postJson(url, body, { fetchImpl, headers });
|
|
251
|
+
} catch (error) {
|
|
252
|
+
// A 402 plan_limit is a RegistryError. Do not call the model.
|
|
253
|
+
const message = error instanceof RegistryNetworkError || error instanceof RegistryError
|
|
254
|
+
? error.message
|
|
255
|
+
: 'Could not query Hub.';
|
|
256
|
+
printError(message);
|
|
257
|
+
return { exitCode: 1, registry, calls: 1 };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const hits = verifiedHits(response?.hits);
|
|
261
|
+
const skills = verifiedSkills(response?.skills);
|
|
262
|
+
if (!hits.length && !skills.length) {
|
|
263
|
+
printError('Hub has no matching evidence.');
|
|
264
|
+
return { exitCode: 1, registry, calls: 1 };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (flags.evidence) {
|
|
268
|
+
printEvidence(skills, hits, print);
|
|
269
|
+
return { exitCode: 0, registry, hits, skills, calls: 1 };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const baseUrl = modelBase(flags, env);
|
|
273
|
+
const endpoint = chatCompletionsUrl(baseUrl);
|
|
274
|
+
const apiKey = typeof env.KNOLO_MODEL_API_KEY === 'string' ? env.KNOLO_MODEL_API_KEY.trim() : '';
|
|
275
|
+
const modelHeaders = { 'content-type': 'application/json' };
|
|
276
|
+
if (apiKey) modelHeaders.authorization = `Bearer ${apiKey}`;
|
|
277
|
+
const promptParts = [`Question: ${question}`, ''];
|
|
278
|
+
if (skills.length) {
|
|
279
|
+
promptParts.push(
|
|
280
|
+
'Skills:',
|
|
281
|
+
...skills.map((skill) => `Skill: ${skill.publisher}/${skill.name}\n${skill.description}\n${skill.excerpt}`),
|
|
282
|
+
''
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
if (hits.length) {
|
|
286
|
+
promptParts.push(
|
|
287
|
+
'Excerpts:',
|
|
288
|
+
...hits.map((hit) => `Source: ${citation(hit)}\nHeading: ${hit.heading}\n${hit.excerpt}`)
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
const prompt = promptParts.join('\n');
|
|
292
|
+
|
|
293
|
+
let modelResponse;
|
|
294
|
+
try {
|
|
295
|
+
modelResponse = await fetchImpl(endpoint, {
|
|
296
|
+
method: 'POST',
|
|
297
|
+
headers: modelHeaders,
|
|
298
|
+
body: JSON.stringify({
|
|
299
|
+
model,
|
|
300
|
+
messages: [
|
|
301
|
+
{ role: 'system', content: ASK_SYSTEM_PROMPT },
|
|
302
|
+
{ role: 'user', content: prompt },
|
|
303
|
+
],
|
|
304
|
+
}),
|
|
305
|
+
});
|
|
306
|
+
} catch {
|
|
307
|
+
printError('Model endpoint is unavailable. Excerpts follow.');
|
|
308
|
+
printEvidence(skills, hits, print);
|
|
309
|
+
return { exitCode: 2, registry, hits, skills, calls: 2 };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let modelBody;
|
|
313
|
+
try {
|
|
314
|
+
const text = typeof modelResponse?.text === 'function' ? await modelResponse.text() : '';
|
|
315
|
+
modelBody = text ? JSON.parse(text) : undefined;
|
|
316
|
+
} catch {
|
|
317
|
+
modelBody = undefined;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const answer = modelResponse?.ok ? answerText(modelBody) : '';
|
|
321
|
+
if (!answer) {
|
|
322
|
+
const status = typeof modelResponse?.status === 'number' ? modelResponse.status : 'error';
|
|
323
|
+
printError(`Model endpoint returned HTTP ${status}. Excerpts follow.`);
|
|
324
|
+
printEvidence(skills, hits, print);
|
|
325
|
+
return { exitCode: 2, registry, hits, skills, calls: 2 };
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
print(answer);
|
|
329
|
+
print('');
|
|
330
|
+
print('Citations:');
|
|
331
|
+
for (const skill of skills) print(`${skill.publisher}/${skill.name}`);
|
|
332
|
+
for (const hit of hits) print(citation(hit));
|
|
333
|
+
return { exitCode: 0, registry, hits, skills, calls: 2 };
|
|
334
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const KNOWLEDGE_CATEGORIES = [
|
|
2
|
+
'coding',
|
|
3
|
+
'math',
|
|
4
|
+
'science',
|
|
5
|
+
'news',
|
|
6
|
+
'business',
|
|
7
|
+
'security',
|
|
8
|
+
'writing',
|
|
9
|
+
'general',
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
const IDS = new Set(KNOWLEDGE_CATEGORIES);
|
|
13
|
+
|
|
14
|
+
export function normalizeCategories(values, { min = 1, max = KNOWLEDGE_CATEGORIES.length } = {}) {
|
|
15
|
+
if (values == null) return null;
|
|
16
|
+
const list = Array.isArray(values) ? values : [values];
|
|
17
|
+
if (list.length === 0) {
|
|
18
|
+
throw new Error(`Choose ${min} to ${max} categories.`);
|
|
19
|
+
}
|
|
20
|
+
const seen = [];
|
|
21
|
+
for (const value of list) {
|
|
22
|
+
if (typeof value !== 'string' || !IDS.has(value)) {
|
|
23
|
+
throw new Error(`--category must be one of ${KNOWLEDGE_CATEGORIES.join(', ')}.`);
|
|
24
|
+
}
|
|
25
|
+
if (!seen.includes(value)) seen.push(value);
|
|
26
|
+
}
|
|
27
|
+
if (seen.length < min || seen.length > max) {
|
|
28
|
+
throw new Error(`Choose ${min} to ${max} categories.`);
|
|
29
|
+
}
|
|
30
|
+
return seen;
|
|
31
|
+
}
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
readArtifact,
|
|
23
23
|
stageCachedArtifact,
|
|
24
24
|
} from './artifacts.mjs';
|
|
25
|
+
import { normalizeCategories } from './categories.mjs';
|
|
25
26
|
import { RegistryError } from './errors.mjs';
|
|
26
27
|
import { getJson, postJson, putBytes } from './http.mjs';
|
|
27
28
|
import {
|
|
@@ -445,6 +446,7 @@ export async function runHubPublish(
|
|
|
445
446
|
...(flags.intendedUse !== undefined
|
|
446
447
|
? { intendedUse: flags.intendedUse }
|
|
447
448
|
: {}),
|
|
449
|
+
...(flags.categories ? { categories: flags.categories } : {}),
|
|
448
450
|
};
|
|
449
451
|
const draftResponse = await postHubJson(
|
|
450
452
|
registryApiUrl(registry, ['publish', 'drafts']),
|
|
@@ -561,6 +563,14 @@ export function parsePublishArgs(args) {
|
|
|
561
563
|
flags.private = true;
|
|
562
564
|
continue;
|
|
563
565
|
}
|
|
566
|
+
if (arg === '--category') {
|
|
567
|
+
const value = args[++i];
|
|
568
|
+
if (value === undefined || value.startsWith('--')) {
|
|
569
|
+
throw new Error('Missing value for --category');
|
|
570
|
+
}
|
|
571
|
+
flags.categories = [...(flags.categories ?? []), value];
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
564
574
|
if (valueFlags.has(arg)) {
|
|
565
575
|
const value = args[++i];
|
|
566
576
|
if (value === undefined || value.startsWith('--'))
|
|
@@ -580,7 +590,7 @@ export function parsePublishArgs(args) {
|
|
|
580
590
|
!flags.license
|
|
581
591
|
) {
|
|
582
592
|
throw new Error(
|
|
583
|
-
'Usage: knolo publish <pack.knolo> --slug <slug> --version <version> --license <SPDX> [--publisher <handle>] [--readme <text>] [--sources <text>] [--intended-use <text>] [--private] [--json] [--registry <url>]'
|
|
593
|
+
'Usage: knolo publish <pack.knolo> --slug <slug> --version <version> --license <SPDX> [--publisher <handle>] [--readme <text>] [--sources <text>] [--intended-use <text>] [--category <id>] [--private] [--json] [--registry <url>]'
|
|
584
594
|
);
|
|
585
595
|
}
|
|
586
596
|
if (!/^[a-z0-9-]+$/.test(flags.slug))
|
|
@@ -594,6 +604,9 @@ export function parsePublishArgs(args) {
|
|
|
594
604
|
throw new Error(
|
|
595
605
|
'Publish publisher must contain lowercase letters, numbers, and hyphens.'
|
|
596
606
|
);
|
|
607
|
+
if (flags.categories) {
|
|
608
|
+
flags.categories = normalizeCategories(flags.categories, { min: 1, max: 3 });
|
|
609
|
+
}
|
|
597
610
|
return { packPath: positional[0], flags };
|
|
598
611
|
}
|
|
599
612
|
|
package/bin/research.mjs
CHANGED
|
@@ -19,7 +19,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
19
19
|
const ACTOR = 'knolo-research';
|
|
20
20
|
const AGENT = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
21
21
|
|
|
22
|
-
const
|
|
22
|
+
const PACKAGE_USAGE = `Usage: knolo research package --question <text> --agent <id> --out <image.knolo> --source <file> [--source <file>] [--cite <image.knolo> --trace <answer.cortex.json> [--graph <file>]] [--json]
|
|
23
23
|
|
|
24
24
|
Packs local files into one V5 Knowledge Image. --agent is the host-supplied caller.
|
|
25
25
|
--cite and --trace are both required or both omitted. --graph is required when the
|
|
@@ -31,6 +31,17 @@ The command does not call a model and does not download an image.
|
|
|
31
31
|
A packed trace is an integrity check. It does not mean a claim is proven.
|
|
32
32
|
SATISFIED means the trace evidence requirements were met.`;
|
|
33
33
|
|
|
34
|
+
const VERIFY_USAGE = `Usage: knolo research verify <image.knolo> [--cited <file>]... [--require-material] [--json]
|
|
35
|
+
|
|
36
|
+
Verifies the image roots, then re-checks a stored composition record, Cortex trace,
|
|
37
|
+
and KAR graph with the existing verifiers. --cited supplies member bytes in member
|
|
38
|
+
order. Without those bytes, digest mode succeeds and says the cited bytes were not
|
|
39
|
+
supplied. --require-material fails when a member has no bytes. The command does not
|
|
40
|
+
call a model and does not download an image. A verified trace is an integrity check.
|
|
41
|
+
It does not mean a claim is proven. SATISFIED means evidence requirements were met.`;
|
|
42
|
+
|
|
43
|
+
const USAGE = `${PACKAGE_USAGE}\n\n${VERIFY_USAGE}`;
|
|
44
|
+
|
|
34
45
|
export async function runResearchCli(argv) {
|
|
35
46
|
if (
|
|
36
47
|
argv.length === 0 ||
|
|
@@ -41,15 +52,25 @@ export async function runResearchCli(argv) {
|
|
|
41
52
|
console.log(USAGE);
|
|
42
53
|
return;
|
|
43
54
|
}
|
|
44
|
-
if (argv[0]
|
|
45
|
-
|
|
55
|
+
if (argv[0] === 'package') {
|
|
56
|
+
const flags = parseFlags(argv.slice(1));
|
|
57
|
+
if (flags.help) {
|
|
58
|
+
console.log(PACKAGE_USAGE);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
await packageResearch(flags);
|
|
62
|
+
return;
|
|
46
63
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
if (argv[0] === 'verify') {
|
|
65
|
+
const flags = parseVerifyFlags(argv.slice(1));
|
|
66
|
+
if (flags.help) {
|
|
67
|
+
console.log(VERIFY_USAGE);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
await verifyResearch(flags);
|
|
50
71
|
return;
|
|
51
72
|
}
|
|
52
|
-
|
|
73
|
+
throw new Error(`Unknown research command "${argv[0]}".\n${USAGE}`);
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
async function packageResearch(flags) {
|
|
@@ -202,6 +223,211 @@ async function packageResearch(flags) {
|
|
|
202
223
|
);
|
|
203
224
|
}
|
|
204
225
|
|
|
226
|
+
async function verifyResearch(flags) {
|
|
227
|
+
if (!flags.image) {
|
|
228
|
+
throw new Error(`RESEARCH_PACK_INVALID: pass the research image.\n${VERIFY_USAGE}`);
|
|
229
|
+
}
|
|
230
|
+
const bytes = readBounded(flags.image, KAR_CLI_MAX_IMAGE_BYTES);
|
|
231
|
+
const apis = await loadApis();
|
|
232
|
+
let verification;
|
|
233
|
+
try {
|
|
234
|
+
verification = apis.core.verifyKnowledgeImageV5(bytes);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
237
|
+
throw new Error(`KNOWLEDGE_IMAGE_INVALID: ${message}`);
|
|
238
|
+
}
|
|
239
|
+
if (!verification.valid) {
|
|
240
|
+
throw new Error('KNOWLEDGE_IMAGE_INVALID: Image roots do not verify.');
|
|
241
|
+
}
|
|
242
|
+
const image = apis.core.mountKnowledgeImageV5(bytes);
|
|
243
|
+
const packs = byRole(image, 'research-pack');
|
|
244
|
+
const traces = byRole(image, 'cortex-trace');
|
|
245
|
+
const compositions = byRole(image, 'composition');
|
|
246
|
+
const graphs = byRole(image, 'kar-graph');
|
|
247
|
+
if (packs.length !== 1) {
|
|
248
|
+
throw new Error('RESEARCH_PACK_INVALID: the image needs one research-pack object.');
|
|
249
|
+
}
|
|
250
|
+
const agent = packs[0].meta.agent;
|
|
251
|
+
if (typeof agent !== 'string' || !AGENT.test(agent)) {
|
|
252
|
+
throw new Error('RESEARCH_PACK_INVALID: the research pack has no caller.');
|
|
253
|
+
}
|
|
254
|
+
if (traces.length > 1 || compositions.length > 1 || graphs.length > 1) {
|
|
255
|
+
throw new Error('RESEARCH_PACK_INVALID: a research role is repeated.');
|
|
256
|
+
}
|
|
257
|
+
if (Boolean(traces.length) !== Boolean(compositions.length) || (graphs.length && !traces.length)) {
|
|
258
|
+
throw new Error('RESEARCH_PACK_INVALID: the citation, trace, and graph do not belong together.');
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
let members = [];
|
|
262
|
+
let citedBytesSupplied = false;
|
|
263
|
+
let compositionRoot = null;
|
|
264
|
+
const supplied = new Map();
|
|
265
|
+
if (compositions.length === 1) {
|
|
266
|
+
const record = parseJson(compositions[0].bytes, 'COMPOSITION_INVALID');
|
|
267
|
+
let parsed;
|
|
268
|
+
try {
|
|
269
|
+
parsed = apis.composition.parseCompositionRecord(record);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
throw coded(error, 'COMPOSITION_INVALID');
|
|
272
|
+
}
|
|
273
|
+
if (compositions[0].meta.compositionRoot !== parsed.compositionRoot) {
|
|
274
|
+
throw new Error('COMPOSITION_ROOT_MISMATCH: Stored compositionRoot does not match the record.');
|
|
275
|
+
}
|
|
276
|
+
if (flags.cited.length > parsed.members.length) {
|
|
277
|
+
throw new Error('RESEARCH_PACK_INVALID: more --cited files than composition members.');
|
|
278
|
+
}
|
|
279
|
+
const material = {};
|
|
280
|
+
for (let index = 0; index < flags.cited.length; index += 1) {
|
|
281
|
+
const member = parsed.members[index];
|
|
282
|
+
const citedBytes = new Uint8Array(readBounded(flags.cited[index], KAR_CLI_MAX_IMAGE_BYTES));
|
|
283
|
+
material[member.alias] = { bytes: citedBytes };
|
|
284
|
+
supplied.set(member.alias, citedBytes);
|
|
285
|
+
}
|
|
286
|
+
citedBytesSupplied = flags.cited.length > 0;
|
|
287
|
+
const verdict = apis.composition.verifyCompositionRecord(record, {
|
|
288
|
+
members: material,
|
|
289
|
+
requireMaterial: flags.requireMaterial,
|
|
290
|
+
});
|
|
291
|
+
if (!verdict.ok) {
|
|
292
|
+
throw new Error(`${verdict.code}: composition check failed.`);
|
|
293
|
+
}
|
|
294
|
+
compositionRoot = verdict.compositionRoot;
|
|
295
|
+
members = verdict.members.map((status) => {
|
|
296
|
+
const member = parsed.members.find((item) => item.alias === status.alias);
|
|
297
|
+
return {
|
|
298
|
+
alias: status.alias,
|
|
299
|
+
status: status.status,
|
|
300
|
+
stateRoot: member && member.stateRoot ? member.stateRoot : null,
|
|
301
|
+
sha256: member && member.sha256 ? member.sha256 : null,
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
const cite = members.find((member) => member.alias === 'cite');
|
|
305
|
+
if (cite && compositions[0].meta.citedStateRoot !== cite.stateRoot) {
|
|
306
|
+
throw new Error('COMPOSITION_DIGEST_MISMATCH: Stored citedStateRoot does not match the record.');
|
|
307
|
+
}
|
|
308
|
+
} else if (flags.requireMaterial && flags.cited.length > 0) {
|
|
309
|
+
throw new Error('RESEARCH_PACK_INVALID: --cited was passed and the image has no composition record.');
|
|
310
|
+
} else if (flags.cited.length > 0) {
|
|
311
|
+
throw new Error('RESEARCH_PACK_INVALID: --cited was passed and the image has no composition record.');
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
let traceRoot = null;
|
|
315
|
+
let traceChecked = false;
|
|
316
|
+
let traceStatuses = [];
|
|
317
|
+
const citeBytes = supplied.get('cite');
|
|
318
|
+
if (traces.length === 1) {
|
|
319
|
+
const trace = parseJson(traces[0].bytes, 'CORTEX_TRACE_INVALID');
|
|
320
|
+
traceStatuses = Array.isArray(trace.karEvaluations)
|
|
321
|
+
? trace.karEvaluations.map((item) => item && item.status).filter((status) => typeof status === 'string')
|
|
322
|
+
: [];
|
|
323
|
+
if (citeBytes) {
|
|
324
|
+
const graph = graphs.length === 1 ? parseJson(graphs[0].bytes, 'KAR_SIDECAR_INVALID') : undefined;
|
|
325
|
+
if (graph !== undefined) {
|
|
326
|
+
const kar = await loadKar();
|
|
327
|
+
try {
|
|
328
|
+
kar.createKarSession({ image: citeBytes, graph });
|
|
329
|
+
} catch (error) {
|
|
330
|
+
throw coded(error, 'KAR_GRAPH_INVALID');
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const verified = await apis.cortex.verifyCortexAnswer({
|
|
334
|
+
image: citeBytes,
|
|
335
|
+
question: typeof trace.question === 'string' ? trace.question : '',
|
|
336
|
+
result: trace,
|
|
337
|
+
...(graph === undefined ? {} : { graph }),
|
|
338
|
+
});
|
|
339
|
+
if (!verified.ok) throw new Error(`${verified.code}: ${verified.message}`);
|
|
340
|
+
if (traces[0].meta.traceRoot !== verified.traceRoot) {
|
|
341
|
+
throw new Error('CORTEX_ROOT_MISMATCH: Stored traceRoot does not match the trace.');
|
|
342
|
+
}
|
|
343
|
+
traceRoot = verified.traceRoot;
|
|
344
|
+
traceChecked = true;
|
|
345
|
+
} else {
|
|
346
|
+
traceRoot = typeof traces[0].meta.traceRoot === 'string' ? traces[0].meta.traceRoot : null;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
let graphChecked = false;
|
|
351
|
+
if (graphs.length === 1) {
|
|
352
|
+
const graph = parseJson(graphs[0].bytes, 'KAR_SIDECAR_INVALID');
|
|
353
|
+
const kar = await loadKar();
|
|
354
|
+
if (citeBytes) {
|
|
355
|
+
if (!traceChecked) {
|
|
356
|
+
try {
|
|
357
|
+
kar.createKarSession({ image: citeBytes, graph });
|
|
358
|
+
} catch (error) {
|
|
359
|
+
throw coded(error, 'KAR_GRAPH_INVALID');
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
graphChecked = true;
|
|
363
|
+
} else {
|
|
364
|
+
const sidecar = kar.validateKarSidecar(graph);
|
|
365
|
+
if (!sidecar.ok) {
|
|
366
|
+
const issue = sidecar.errors[0];
|
|
367
|
+
throw new Error(`${issue.code}: ${issue.message}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const summary = {
|
|
373
|
+
ok: true,
|
|
374
|
+
stateRoot: verification.stateRoot,
|
|
375
|
+
sha256: digest(bytes),
|
|
376
|
+
agent,
|
|
377
|
+
compositionRoot,
|
|
378
|
+
citedBytesSupplied,
|
|
379
|
+
members,
|
|
380
|
+
traceRoot,
|
|
381
|
+
traceChecked,
|
|
382
|
+
traceStatuses,
|
|
383
|
+
graphChecked,
|
|
384
|
+
graphPresent: graphs.length === 1,
|
|
385
|
+
};
|
|
386
|
+
if (flags.json) {
|
|
387
|
+
console.log(JSON.stringify(summary, null, 2));
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const citedLines = members.length
|
|
391
|
+
? members
|
|
392
|
+
.map((member) => `${member.alias} ${member.status} ${member.sha256} ${member.stateRoot}`)
|
|
393
|
+
.join('\n ')
|
|
394
|
+
: 'none';
|
|
395
|
+
const traceLine = !traces.length
|
|
396
|
+
? 'none'
|
|
397
|
+
: traceChecked
|
|
398
|
+
? `${traceRoot}${traceStatuses.length ? ` ${traceStatuses.join(',')}` : ''}`
|
|
399
|
+
: `${traceRoot ?? 'stored'} not re-checked`;
|
|
400
|
+
const graphLine = !graphs.length ? 'none' : graphChecked ? 'checked' : 'present, cited bytes were not supplied';
|
|
401
|
+
const digestNote =
|
|
402
|
+
compositions.length === 1 && !citedBytesSupplied
|
|
403
|
+
? '\nCited bytes were not supplied.\n'
|
|
404
|
+
: '\n';
|
|
405
|
+
console.log(
|
|
406
|
+
`RESEARCH VERIFY\nstate root ${summary.stateRoot}\nfile sha256 ${summary.sha256}\nagent ${agent}\ncited ${citedLines}\ntrace ${traceLine}\ngraph ${graphLine}\n${digestNote}A verified trace is an integrity check. It does not mean a claim is proven.\nSATISFIED means evidence requirements were met.`
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function byRole(image, role) {
|
|
411
|
+
return image.objects.filter((object) => object.meta && object.meta.role === role);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function parseJson(bytes, code) {
|
|
415
|
+
try {
|
|
416
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
417
|
+
} catch {
|
|
418
|
+
throw new Error(`${code}: stored JSON is not valid.`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function coded(error, fallback) {
|
|
423
|
+
if (error && typeof error.code === 'string' && error.code.length > 0) {
|
|
424
|
+
return new Error(`${error.code}: ${error.message}`);
|
|
425
|
+
}
|
|
426
|
+
if (error instanceof Error && /^[A-Z0-9_]+:/.test(error.message)) return error;
|
|
427
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
428
|
+
return new Error(`${fallback}: ${message}`);
|
|
429
|
+
}
|
|
430
|
+
|
|
205
431
|
function writeNewFile(resolved, display, bytes) {
|
|
206
432
|
try {
|
|
207
433
|
writeFileSync(resolved, bytes, { flag: 'wx' });
|
|
@@ -260,6 +486,14 @@ function required(value, flag) {
|
|
|
260
486
|
return value;
|
|
261
487
|
}
|
|
262
488
|
|
|
489
|
+
async function loadKar() {
|
|
490
|
+
const dist = path.resolve(__dirname, '../../core/dist');
|
|
491
|
+
return importFirst(
|
|
492
|
+
[path.join(dist, 'experimental/kar/index.js'), '@knolo/core/experimental/kar'],
|
|
493
|
+
(loaded) => loaded.createKarSession && loaded.validateKarSidecar
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
|
|
263
497
|
async function loadApis() {
|
|
264
498
|
const dist = path.resolve(__dirname, '../../core/dist');
|
|
265
499
|
const core = await importFirst(
|
|
@@ -292,6 +526,40 @@ async function importFirst(candidates, check) {
|
|
|
292
526
|
throw new Error('Could not load @knolo/core. Build packages/core first.');
|
|
293
527
|
}
|
|
294
528
|
|
|
529
|
+
function parseVerifyFlags(argv) {
|
|
530
|
+
const flags = { cited: [], help: false, json: false, requireMaterial: false, image: '' };
|
|
531
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
532
|
+
const arg = argv[index];
|
|
533
|
+
if (arg === '--help' || arg === '-h') {
|
|
534
|
+
flags.help = true;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (arg === '--json') {
|
|
538
|
+
flags.json = true;
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
if (arg === '--require-material') {
|
|
542
|
+
flags.requireMaterial = true;
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
if (arg === '--cited') {
|
|
546
|
+
const value = argv[index + 1];
|
|
547
|
+
if (value === undefined || value.startsWith('--')) {
|
|
548
|
+
throw new Error('Missing value for --cited');
|
|
549
|
+
}
|
|
550
|
+
flags.cited.push(value);
|
|
551
|
+
index += 1;
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
if (arg.startsWith('--')) {
|
|
555
|
+
throw new Error(`Unknown option ${arg}.\n${VERIFY_USAGE}`);
|
|
556
|
+
}
|
|
557
|
+
if (flags.image) throw new Error(`Unexpected argument "${arg}".\n${VERIFY_USAGE}`);
|
|
558
|
+
flags.image = arg;
|
|
559
|
+
}
|
|
560
|
+
return flags;
|
|
561
|
+
}
|
|
562
|
+
|
|
295
563
|
function parseFlags(argv) {
|
|
296
564
|
const flags = { sources: [], help: false, json: false };
|
|
297
565
|
for (let index = 0; index < argv.length; index += 1) {
|
package/bin/skill.mjs
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import { homedir, tmpdir } from 'node:os';
|
|
23
23
|
import path from 'node:path';
|
|
24
24
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
25
|
+
import { normalizeCategories } from './registry/categories.mjs';
|
|
25
26
|
import {
|
|
26
27
|
normalizeRegistryUrl,
|
|
27
28
|
registryApiUrl,
|
|
@@ -44,7 +45,7 @@ const USAGE = `Usage: knolo skill <init|check|pack|publish|install|search|info|l
|
|
|
44
45
|
knolo skill init <name> [--dir <parent>]
|
|
45
46
|
knolo skill check [<dir>] [--query <text>] [--json]
|
|
46
47
|
knolo skill pack [<dir>] [--out <dir>] [--json]
|
|
47
|
-
knolo skill publish <pack> [--registry <url>] [--json]
|
|
48
|
+
knolo skill publish <pack> [--category <id>] [--registry <url>] [--json]
|
|
48
49
|
knolo skill publish <pack> --hub <dir> [--json]
|
|
49
50
|
knolo skill install <publisher>/<name> [--dir <path>] [--registry <url>] [--json]
|
|
50
51
|
knolo skill install <name> --hub <dir> [--dir <path>] [--json]
|
|
@@ -216,6 +217,14 @@ async function packSkill(dirArg, flags) {
|
|
|
216
217
|
|
|
217
218
|
async function publishSkill(packArg, flags) {
|
|
218
219
|
if (!packArg) throw new Error('SKILL_HUB: pass the pack directory.');
|
|
220
|
+
const categories = flags.category
|
|
221
|
+
? normalizeCategories(flags.category, { min: 1, max: 3 })
|
|
222
|
+
: null;
|
|
223
|
+
if (!flags.hub && !categories) {
|
|
224
|
+
throw new Error(
|
|
225
|
+
'Pass --category at least once. Choose 1 to 3 of coding, math, science, news, business, security, writing, general.'
|
|
226
|
+
);
|
|
227
|
+
}
|
|
219
228
|
if (flags.hub) {
|
|
220
229
|
if (flags.registry) {
|
|
221
230
|
throw new Error(
|
|
@@ -228,7 +237,7 @@ async function publishSkill(packArg, flags) {
|
|
|
228
237
|
const registry = resolveSkillRegistry(flags.registry, credentials.registry);
|
|
229
238
|
const summary = await publishSkillToRegistry(
|
|
230
239
|
path.resolve(process.cwd(), packArg),
|
|
231
|
-
{ registry, token: credentials.token }
|
|
240
|
+
{ registry, token: credentials.token, categories }
|
|
232
241
|
);
|
|
233
242
|
if (flags.json) console.log(JSON.stringify(summary));
|
|
234
243
|
else if (summary.unchanged) console.log(`unchanged ${summary.name}`);
|
|
@@ -982,8 +991,14 @@ export function decodeSkillArchive(bytes) {
|
|
|
982
991
|
|
|
983
992
|
export async function publishSkillToRegistry(
|
|
984
993
|
packDir,
|
|
985
|
-
{ fetchImpl = globalThis.fetch, registry, token }
|
|
994
|
+
{ fetchImpl = globalThis.fetch, registry, token, categories }
|
|
986
995
|
) {
|
|
996
|
+
const shelf = normalizeCategories(categories, { min: 1, max: 3 });
|
|
997
|
+
if (!shelf) {
|
|
998
|
+
throw new Error(
|
|
999
|
+
'Pass --category at least once. Choose 1 to 3 of coding, math, science, news, business, security, writing, general.'
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
987
1002
|
const pack = await readVerifiedPack(packDir);
|
|
988
1003
|
const archive = encodeSkillArchive(pack);
|
|
989
1004
|
const archiveSha256 = sha256(archive);
|
|
@@ -1016,7 +1031,7 @@ export async function publishSkillToRegistry(
|
|
|
1016
1031
|
try {
|
|
1017
1032
|
listed = await postJson(
|
|
1018
1033
|
registryApiUrl(registry, ['skills']),
|
|
1019
|
-
{ archiveSha256, url: blobUrl, sizeBytes: archive.length },
|
|
1034
|
+
{ archiveSha256, url: blobUrl, sizeBytes: archive.length, categories: shelf },
|
|
1020
1035
|
{ fetchImpl, headers: auth }
|
|
1021
1036
|
);
|
|
1022
1037
|
} catch (error) {
|
|
@@ -1360,7 +1375,15 @@ function parseArgs(argv) {
|
|
|
1360
1375
|
const arg = argv[index];
|
|
1361
1376
|
if (arg === '--json') flags.json = true;
|
|
1362
1377
|
else if (arg === '--help' || arg === '-h') flags.help = true;
|
|
1363
|
-
else if (arg
|
|
1378
|
+
else if (arg === '--category') {
|
|
1379
|
+
const value = argv[index + 1];
|
|
1380
|
+
if (value === undefined || value.startsWith('--')) {
|
|
1381
|
+
throw new Error('Missing value for --category');
|
|
1382
|
+
}
|
|
1383
|
+
const current = Array.isArray(flags.category) ? flags.category : [];
|
|
1384
|
+
flags.category = [...current, value];
|
|
1385
|
+
index += 1;
|
|
1386
|
+
} else if (arg.startsWith('--')) {
|
|
1364
1387
|
const key = arg.slice(2);
|
|
1365
1388
|
const value = argv[index + 1];
|
|
1366
1389
|
if (value === undefined || value.startsWith('--')) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knolo/cli",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"knolo": "bin/knolo.mjs"
|
|
@@ -28,12 +28,12 @@
|
|
|
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/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/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": {
|
|
35
35
|
"@knolo/core": "^6.2.3",
|
|
36
|
-
"@knolo/exchange": "^0.1.
|
|
36
|
+
"@knolo/exchange": "^0.1.1"
|
|
37
37
|
},
|
|
38
38
|
"private": false
|
|
39
39
|
}
|