vit 0.6.7 → 0.6.8
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 +1 -1
- package/skills/vit/SKILL.md +3 -3
- package/src/cmd/learn.js +5 -3
- package/src/cmd/remix.js +5 -2
- package/src/cmd/vet.js +10 -0
- package/src/cmd/vouch.js +6 -1
- package/src/lib/trust-gate.js +10 -0
package/package.json
CHANGED
package/skills/vit/SKILL.md
CHANGED
|
@@ -59,7 +59,7 @@ Handoffs:
|
|
|
59
59
|
- Usage: `vit remix <ref>`
|
|
60
60
|
- Key flags: `--did <did>`, `--verbose`
|
|
61
61
|
- Output: text pretext block with cap content to stdout (consumed by the calling agent).
|
|
62
|
-
- Trust gate: requires the ref
|
|
62
|
+
- Trust gate: requires trust for the selected record's ref, URI, and CID (via `vit vet <ref> --trust`) OR dangerous-accept to be active. A changed record or an older trust entry without a CID requires re-vetting.
|
|
63
63
|
- Common errors: not running inside agent, invalid ref, no DID, no beacon, cap not trusted, cap not found.
|
|
64
64
|
|
|
65
65
|
### `vit learn <ref>`
|
|
@@ -67,7 +67,7 @@ Handoffs:
|
|
|
67
67
|
- Usage: `vit learn <ref>`
|
|
68
68
|
- Key flags: `--did <did>`, `--user`, `--verbose`
|
|
69
69
|
- Output: confirmation of install location.
|
|
70
|
-
- Trust gate: requires the ref
|
|
70
|
+
- Trust gate: requires trust for the selected record's ref, URI, and CID (via `vit vet <ref> --trust`) OR dangerous-accept to be active. A changed record or an older trust entry without a CID requires re-vetting. `--user` always requires matching vetting regardless of dangerous-accept.
|
|
71
71
|
- Common errors: not running inside agent, invalid skill ref, no DID, skill not trusted, skill not found.
|
|
72
72
|
|
|
73
73
|
### Agent-usable commands
|
|
@@ -203,7 +203,7 @@ These are human-only because they call `requireNotAgent()` (or require browser i
|
|
|
203
203
|
- `.vit/config.json` - `{ "beacon": "vit:host/org/repo" }`
|
|
204
204
|
- `.vit/following.json` - `[{ "handle": "...", "did": "...", "followedAt": "..." }]`
|
|
205
205
|
- `.vit/caps.jsonl` - Append-only shipped cap log
|
|
206
|
-
- `.vit/trusted.jsonl` - Append-only vetted
|
|
206
|
+
- `.vit/trusted.jsonl` - Append-only cap and skill trust log, binding each ref to the vetted record's URI and CID. Entries without a CID require re-vetting.
|
|
207
207
|
- `.vit/dangerous-accept` - Project-wide vet bypass flag (written by `vit vet --dangerous-accept --confirm`)
|
|
208
208
|
- `vit.json` in vit's config directory (`~/.config/vit/` on Linux, `~/Library/Preferences/vit/` on macOS, `%APPDATA%\vit\Config\` on Windows) - Global config with `did`, timestamps
|
|
209
209
|
|
package/src/cmd/learn.js
CHANGED
|
@@ -10,7 +10,7 @@ import { SKILL_COLLECTION } from '../lib/constants.js';
|
|
|
10
10
|
import { restoreAgent } from '../lib/oauth.js';
|
|
11
11
|
import { readFollowing, readLog, appendLog, vitDir } from '../lib/vit-dir.js';
|
|
12
12
|
import { requireAgent, detectCodingAgent } from '../lib/agent.js';
|
|
13
|
-
import { shouldBypassVet } from '../lib/trust-gate.js';
|
|
13
|
+
import { shouldBypassVet, requireTrustedRecord } from '../lib/trust-gate.js';
|
|
14
14
|
import { isSkillRef, nameFromSkillRef, isValidSkillRef, isValidSkillName } from '../lib/skill-ref.js';
|
|
15
15
|
import { mark, name } from '../lib/brand.js';
|
|
16
16
|
import { resolvePds, resolveHandle, listRecordsFromPds, batchQuery } from '../lib/pds.js';
|
|
@@ -280,10 +280,11 @@ Examples:
|
|
|
280
280
|
const skillName = nameFromSkillRef(ref);
|
|
281
281
|
if (verbose) vlog(`[verbose] skill name: ${skillName}`);
|
|
282
282
|
|
|
283
|
-
//
|
|
283
|
+
// Preflight only; check the selected record's URI and CID before use.
|
|
284
284
|
const isUserInstall = !!opts.user;
|
|
285
285
|
const trusted = readLog('trusted.jsonl');
|
|
286
286
|
const trustedEntry = trusted.find(e => e.ref === ref);
|
|
287
|
+
const trustGate = isUserInstall ? { bypass: false } : shouldBypassVet();
|
|
287
288
|
|
|
288
289
|
if (isUserInstall && !trustedEntry) {
|
|
289
290
|
// --user ALWAYS requires vet
|
|
@@ -305,7 +306,6 @@ Examples:
|
|
|
305
306
|
|
|
306
307
|
if (!isUserInstall && !trustedEntry) {
|
|
307
308
|
// Project-level: requires vet UNLESS dangerous-accept
|
|
308
|
-
const trustGate = shouldBypassVet();
|
|
309
309
|
if (!trustGate.bypass) {
|
|
310
310
|
if (opts.json) {
|
|
311
311
|
jsonError(`skill '${ref}' is not yet vetted`, `run 'vit vet ${ref}' first`);
|
|
@@ -380,6 +380,8 @@ Examples:
|
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
if (!trustGate.bypass) requireTrustedRecord(ref, match, trusted);
|
|
384
|
+
|
|
383
385
|
const record = match.value;
|
|
384
386
|
if (verbose) vlog(`[verbose] found skill: ${record.name} from ${match.uri}`);
|
|
385
387
|
|
package/src/cmd/remix.js
CHANGED
|
@@ -6,7 +6,7 @@ import { CAP_COLLECTION } from '../lib/constants.js';
|
|
|
6
6
|
import { restoreAgent } from '../lib/oauth.js';
|
|
7
7
|
import { readBeaconSet, readFollowing, readLog } from '../lib/vit-dir.js';
|
|
8
8
|
import { requireAgent, detectCodingAgent } from '../lib/agent.js';
|
|
9
|
-
import { shouldBypassVet } from '../lib/trust-gate.js';
|
|
9
|
+
import { shouldBypassVet, requireTrustedRecord } from '../lib/trust-gate.js';
|
|
10
10
|
import { resolveRef, REF_PATTERN } from '../lib/cap-ref.js';
|
|
11
11
|
import { brand, name } from '../lib/brand.js';
|
|
12
12
|
import { resolvePds, listRecordsFromPds, batchQuery } from '../lib/pds.js';
|
|
@@ -70,10 +70,11 @@ export default function register(program) {
|
|
|
70
70
|
}
|
|
71
71
|
if (verbose) vlog(`[verbose] beacons: ${[...beaconSet].join(', ')}`);
|
|
72
72
|
|
|
73
|
+
// Preflight only; check the selected record's URI and CID before use.
|
|
73
74
|
const trusted = readLog('trusted.jsonl');
|
|
74
75
|
const trustedEntry = trusted.find(e => e.ref === ref);
|
|
76
|
+
const trustGate = shouldBypassVet();
|
|
75
77
|
if (!trustedEntry) {
|
|
76
|
-
const trustGate = shouldBypassVet();
|
|
77
78
|
if (!trustGate.bypass) {
|
|
78
79
|
if (opts.json) {
|
|
79
80
|
jsonError(`cap '${ref}' is not trusted`, `tell your operator to run 'vit vet ${ref} --trust'`);
|
|
@@ -144,6 +145,8 @@ export default function register(program) {
|
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
146
147
|
|
|
148
|
+
if (!trustGate.bypass) requireTrustedRecord(ref, match, trusted);
|
|
149
|
+
|
|
147
150
|
const record = match.value;
|
|
148
151
|
const author = match.uri.split('/')[2];
|
|
149
152
|
const title = record.title || ref;
|
package/src/cmd/vet.js
CHANGED
|
@@ -320,6 +320,9 @@ export default function register(program) {
|
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
if (opts.trust && (typeof match.cid !== 'string' || !match.cid)) {
|
|
324
|
+
throw new Error(`cannot trust '${ref}': the record has no CID. fetch it again with 'vit vet ${ref}'.`);
|
|
325
|
+
}
|
|
323
326
|
const record = match.value;
|
|
324
327
|
|
|
325
328
|
if (opts.sandbox) {
|
|
@@ -337,6 +340,7 @@ export default function register(program) {
|
|
|
337
340
|
appendLog('trusted.jsonl', {
|
|
338
341
|
ref,
|
|
339
342
|
uri: match.uri,
|
|
343
|
+
cid: match.cid,
|
|
340
344
|
trustedAt: new Date().toISOString(),
|
|
341
345
|
sandboxVerdict: verdict,
|
|
342
346
|
});
|
|
@@ -398,6 +402,7 @@ export default function register(program) {
|
|
|
398
402
|
appendLog('trusted.jsonl', {
|
|
399
403
|
ref,
|
|
400
404
|
uri: match.uri,
|
|
405
|
+
cid: match.cid,
|
|
401
406
|
trustedAt: new Date().toISOString(),
|
|
402
407
|
});
|
|
403
408
|
if (opts.json) {
|
|
@@ -491,6 +496,9 @@ export default function register(program) {
|
|
|
491
496
|
return;
|
|
492
497
|
}
|
|
493
498
|
|
|
499
|
+
if (opts.trust && (typeof match.cid !== 'string' || !match.cid)) {
|
|
500
|
+
throw new Error(`cannot trust '${ref}': the record has no CID. fetch it again with 'vit vet ${ref}'.`);
|
|
501
|
+
}
|
|
494
502
|
const record = match.value;
|
|
495
503
|
|
|
496
504
|
if (opts.sandbox) {
|
|
@@ -518,6 +526,7 @@ export default function register(program) {
|
|
|
518
526
|
appendLog('trusted.jsonl', {
|
|
519
527
|
ref,
|
|
520
528
|
uri: match.uri,
|
|
529
|
+
cid: match.cid,
|
|
521
530
|
trustedAt: new Date().toISOString(),
|
|
522
531
|
sandboxVerdict: verdict,
|
|
523
532
|
});
|
|
@@ -570,6 +579,7 @@ export default function register(program) {
|
|
|
570
579
|
appendLog('trusted.jsonl', {
|
|
571
580
|
ref,
|
|
572
581
|
uri: match.uri,
|
|
582
|
+
cid: match.cid,
|
|
573
583
|
trustedAt: new Date().toISOString(),
|
|
574
584
|
});
|
|
575
585
|
if (opts.json) {
|
package/src/cmd/vouch.js
CHANGED
|
@@ -14,6 +14,7 @@ import { loadConfig } from '../lib/config.js';
|
|
|
14
14
|
import { jsonOk, jsonError } from '../lib/json-output.js';
|
|
15
15
|
import { formatError } from '../lib/error-format.js';
|
|
16
16
|
import { tryNormalizeBeacon } from '../lib/beacon.js';
|
|
17
|
+
import { requireTrustedRecord } from '../lib/trust-gate.js';
|
|
17
18
|
|
|
18
19
|
export default function register(program) {
|
|
19
20
|
program
|
|
@@ -136,6 +137,8 @@ export default function register(program) {
|
|
|
136
137
|
return;
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
requireTrustedRecord(ref, match, trusted);
|
|
141
|
+
|
|
139
142
|
const now = new Date().toISOString();
|
|
140
143
|
const vouchRecord = {
|
|
141
144
|
$type: VOUCH_COLLECTION,
|
|
@@ -178,6 +181,7 @@ export default function register(program) {
|
|
|
178
181
|
} else {
|
|
179
182
|
const vouchKind = opts.kind || 'endorse';
|
|
180
183
|
const isWant = vouchKind === 'want';
|
|
184
|
+
const trusted = readLog('trusted.jsonl');
|
|
181
185
|
|
|
182
186
|
// Cap vouch — beacon required unless want-vouching (demand signal)
|
|
183
187
|
const beaconSet = readBeaconSet();
|
|
@@ -194,7 +198,6 @@ export default function register(program) {
|
|
|
194
198
|
}
|
|
195
199
|
if (verbose) vlog(`[verbose] beacons: ${[...beaconSet].join(', ')}`);
|
|
196
200
|
|
|
197
|
-
const trusted = readLog('trusted.jsonl');
|
|
198
201
|
const trustedEntry = trusted.find(e => e.ref === ref);
|
|
199
202
|
if (!trustedEntry) {
|
|
200
203
|
if (opts.json) {
|
|
@@ -254,6 +257,8 @@ export default function register(program) {
|
|
|
254
257
|
return;
|
|
255
258
|
}
|
|
256
259
|
|
|
260
|
+
if (!isWant) requireTrustedRecord(ref, match, trusted);
|
|
261
|
+
|
|
257
262
|
const now = new Date().toISOString();
|
|
258
263
|
const projBeacon = beaconSet.size > 0
|
|
259
264
|
? [...beaconSet][0]
|
package/src/lib/trust-gate.js
CHANGED
|
@@ -7,6 +7,16 @@ import { vitDir } from './vit-dir.js';
|
|
|
7
7
|
|
|
8
8
|
const ACCEPT_FILE = 'dangerous-accept';
|
|
9
9
|
|
|
10
|
+
// A ref is a discovery label. Authorization belongs to the reviewed record.
|
|
11
|
+
export function requireTrustedRecord(ref, record, trusted) {
|
|
12
|
+
if (typeof record.uri === 'string' && record.uri.length > 0 &&
|
|
13
|
+
typeof record.cid === 'string' && record.cid.length > 0 &&
|
|
14
|
+
trusted.some(entry => entry.ref === ref && entry.uri === record.uri && entry.cid === record.cid)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
throw new Error(`'${ref}' is not vetted at this URI and CID. review it again with 'vit vet ${ref}', then trust it with 'vit vet ${ref} --trust'.`);
|
|
18
|
+
}
|
|
19
|
+
|
|
10
20
|
/**
|
|
11
21
|
* Check if dangerous-accept flag is active.
|
|
12
22
|
* Returns { accepted: true } or { accepted: false }.
|