vit 0.6.6 → 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 +18 -18
- package/src/cmd/doctor.js +1 -1
- package/src/cmd/hack.js +1 -1
- package/src/cmd/learn.js +10 -8
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: using-vit
|
|
3
3
|
description: >-
|
|
4
4
|
Helps coding agents use vit to discover, follow, skim, and ship software
|
|
5
|
-
capabilities (caps) over ATProto. Activates when the
|
|
5
|
+
capabilities (caps) over ATProto. Activates when the operator mentions vit,
|
|
6
6
|
beacons, caps, shipping, skimming, following, vetting, or social coding.
|
|
7
7
|
Provides command reference for: vit init, vit skim, vit ship, vit follow,
|
|
8
8
|
vit following, vit learn, vit remix, vit doctor, vit config, vit beacon,
|
|
@@ -11,7 +11,7 @@ description: >-
|
|
|
11
11
|
|
|
12
12
|
## 1. Overview
|
|
13
13
|
|
|
14
|
-
vit is a Node CLI for social software capabilities. Agents use it to initialize projects, follow accounts, skim caps from followed accounts, and ship new caps. Some commands (login, adopt, vet) require human interaction - the agent should tell the
|
|
14
|
+
vit is a Node CLI for social software capabilities. Agents use it to initialize projects, follow accounts, skim caps from followed accounts, and ship new caps. Some commands (login, adopt, vet) require human interaction - the agent should tell the operator to run those in their terminal.
|
|
15
15
|
|
|
16
16
|
Pi is recognised through `AI_AGENT=pi` or `PI_CODING_AGENT=true`. The agent commands work under Pi, with the existing trust gates. Pi-specific skill installation, doctor integration, and the Pi sandbox launcher are not yet available.
|
|
17
17
|
|
|
@@ -29,12 +29,12 @@ Dependency chain: `login → init → follow → skim/ship`.
|
|
|
29
29
|
4. Run `vit ship --title <t> --description <d> --ref <ref> <<'EOF' ... EOF` to publish a cap (body on stdin).
|
|
30
30
|
|
|
31
31
|
Handoffs:
|
|
32
|
-
- If no DID is configured, tell the
|
|
32
|
+
- If no DID is configured, tell the operator to run `vit login <handle>`.
|
|
33
33
|
- If `vit login <handle>` says “Already logged in” but a session has been
|
|
34
|
-
revoked or later fails server authentication, tell the
|
|
34
|
+
revoked or later fails server authentication, tell the operator to rerun
|
|
35
35
|
`vit login <handle> --force`. The ordinary login check only sees local
|
|
36
36
|
session material and can false-green a revoked token.
|
|
37
|
-
- If the
|
|
37
|
+
- If the operator wants to review a cap, tell them to run `vit vet <ref>` in their terminal.
|
|
38
38
|
|
|
39
39
|
## 4. Commands the Agent Runs
|
|
40
40
|
|
|
@@ -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
|
|
@@ -80,7 +80,7 @@ Handoffs:
|
|
|
80
80
|
- Common errors: generic runtime or config read failures.
|
|
81
81
|
|
|
82
82
|
### `vit config [action] [key] [value]`
|
|
83
|
-
- Description: Read and mutate
|
|
83
|
+
- Description: Read and mutate global vit config values.
|
|
84
84
|
- Usage: `vit config [action] [key] [value]`
|
|
85
85
|
- Key flags: none.
|
|
86
86
|
- Output: `key=value` lines for `list`; silent success for `set` and `delete`.
|
|
@@ -118,7 +118,7 @@ Handoffs:
|
|
|
118
118
|
|
|
119
119
|
#### Shipping guide
|
|
120
120
|
|
|
121
|
-
When the
|
|
121
|
+
When the operator says "ship it", "vit ship", or asks you to publish a cap for work you've done:
|
|
122
122
|
|
|
123
123
|
1. **Identify what to ship** — summarize the feature or fix you just completed. A cap describes a self-contained capability, not a commit message.
|
|
124
124
|
2. **Craft the fields:**
|
|
@@ -171,10 +171,10 @@ When the user says "ship it", "vit ship", or asks you to publish a cap for work
|
|
|
171
171
|
|
|
172
172
|
## 5. Commands the Agent Must NOT Run
|
|
173
173
|
|
|
174
|
-
These commands require human interaction. Tell the
|
|
175
|
-
- `vit login <handle>` - Tell
|
|
176
|
-
- `vit adopt <beacon>` - Tell
|
|
177
|
-
- `vit vet <ref>` - Human review command. Tell the
|
|
174
|
+
These commands require human interaction. Tell the operator exactly what to run:
|
|
175
|
+
- `vit login <handle>` - Tell operator: "Run `vit login <handle>` in your terminal to authenticate via browser OAuth." If it falsely reports an existing login after revocation or a server-auth failure, add `--force` to restart authentication.
|
|
176
|
+
- `vit adopt <beacon>` - Tell operator: "Run `vit adopt <beacon>` in your terminal to fork and clone a project."
|
|
177
|
+
- `vit vet <ref>` - Human review command. Tell the operator to run it in their terminal.
|
|
178
178
|
**Exception: sandboxed sub-agent vetting.** If you are a dedicated sub-agent
|
|
179
179
|
spawned specifically to evaluate a cap or skill, you can vet directly:
|
|
180
180
|
`vit vet <ref> --trust --confirm`. Only do this if:
|
|
@@ -184,7 +184,7 @@ These commands require human interaction. Tell the user exactly what to run:
|
|
|
184
184
|
|
|
185
185
|
Do NOT use --confirm as the primary agent. The vetting step exists so a
|
|
186
186
|
separate context evaluates the content independently.
|
|
187
|
-
- `vit vet --dangerous-accept` - Human only. Permanently disables vet gate for the project. Tell the
|
|
187
|
+
- `vit vet --dangerous-accept` - Human only. Permanently disables vet gate for the project. Tell the operator if they want autonomous mode.
|
|
188
188
|
|
|
189
189
|
These are human-only because they call `requireNotAgent()` (or require browser interaction for login) and will fail or be inappropriate when run by an agent.
|
|
190
190
|
|
|
@@ -192,10 +192,10 @@ These are human-only because they call `requireNotAgent()` (or require browser i
|
|
|
192
192
|
|
|
193
193
|
| Error | Cause | Resolution |
|
|
194
194
|
|-------|-------|------------|
|
|
195
|
-
| `no DID configured` |
|
|
195
|
+
| `no DID configured` | Operator hasn't logged in | Tell operator to run `vit login <handle>` |
|
|
196
196
|
| `no beacon set` | `.vit/` not initialized or no beacon | Run `vit init` |
|
|
197
197
|
| `no followings` / empty skim results | No accounts followed | Run `vit follow <handle>` |
|
|
198
|
-
| Session errors (deleted/expired) | OAuth session invalid | Tell
|
|
198
|
+
| Session errors (deleted/expired) | OAuth session invalid | Tell operator to run `vit login <handle>` |
|
|
199
199
|
| Invalid ref format | Ref doesn't match `^[a-z]+-[a-z]+-[a-z]+$` | Use three lowercase words joined by hyphens |
|
|
200
200
|
|
|
201
201
|
## 7. Data Files
|
|
@@ -203,9 +203,9 @@ 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
|
-
- `~/.config/vit/vit
|
|
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
|
|
|
210
210
|
## 8. Reference
|
|
211
211
|
|
package/src/cmd/doctor.js
CHANGED
|
@@ -144,7 +144,7 @@ export default function register(program) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
if (!opts.json && userSkills.length > 0) {
|
|
147
|
-
console.log(`${mark}
|
|
147
|
+
console.log(`${mark} global skills:${userSkills.length} installed`);
|
|
148
148
|
for (const s of userSkills) {
|
|
149
149
|
const ver = s.version ? ` v${s.version}` : '';
|
|
150
150
|
console.log(` ${s.name}${ver}`);
|
package/src/cmd/hack.js
CHANGED
|
@@ -12,7 +12,7 @@ export default function register(program) {
|
|
|
12
12
|
program
|
|
13
13
|
.command('hack')
|
|
14
14
|
.description('Fork and install vit from source')
|
|
15
|
-
.option('--from <repo>', 'Clone an existing fork instead of creating a new one (e.g.
|
|
15
|
+
.option('--from <repo>', 'Clone an existing fork instead of creating a new one (e.g. your-name/vit)')
|
|
16
16
|
.action(async (opts) => {
|
|
17
17
|
try {
|
|
18
18
|
const ghPath = which('gh');
|
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';
|
|
@@ -100,7 +100,7 @@ async function installSkill({ match, skillName, isGlobal, opts, ref }) {
|
|
|
100
100
|
jsonOk({ ref, name: skillName, installedTo: installDir, scope, version: record.version || null });
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
|
-
console.log(`${mark} learned: ${ref} (${
|
|
103
|
+
console.log(`${mark} learned: ${ref} (${isGlobal ? 'global' : 'project'})`);
|
|
104
104
|
console.log(`installed to: ${installDir}`);
|
|
105
105
|
if (record.version) console.log(`version: ${record.version}`);
|
|
106
106
|
}
|
|
@@ -220,19 +220,19 @@ export default function register(program) {
|
|
|
220
220
|
.argument('<ref>', 'Skill reference: @handle/name or skill-{name}')
|
|
221
221
|
.description('Install a skill from the network')
|
|
222
222
|
.option('--did <did>', 'DID to use (skill-{name} path only)')
|
|
223
|
-
.option('--user', 'Install to
|
|
223
|
+
.option('--user', 'Install globally to ~/.claude/skills/ (skill-{name} path, requires vet)')
|
|
224
224
|
.option('--project', 'Install to project .claude/skills/ (@handle/ path)')
|
|
225
225
|
.option('--dry-run', 'Show skill contents without installing')
|
|
226
226
|
.option('--json', 'Output as JSON')
|
|
227
227
|
.option('-v, --verbose', 'Show step-by-step details')
|
|
228
228
|
.addHelpText('after', `
|
|
229
229
|
Examples:
|
|
230
|
-
vit learn @solpbc.org/using-vit Install from publisher (
|
|
230
|
+
vit learn @solpbc.org/using-vit Install from publisher (global)
|
|
231
231
|
vit learn @solpbc.org/using-vit. Install from publisher (project-local)
|
|
232
232
|
vit learn @solpbc.org/using-vit --project Same as trailing dot
|
|
233
233
|
vit learn @solpbc.org/using-vit --dry-run Inspect without installing
|
|
234
234
|
vit learn skill-agent-test-patterns Install from followed accounts (project-local)
|
|
235
|
-
vit learn skill-agent-test-patterns --user Install from followed (
|
|
235
|
+
vit learn skill-agent-test-patterns --user Install from followed (global, requires vet)
|
|
236
236
|
`)
|
|
237
237
|
.action(async (ref, opts) => {
|
|
238
238
|
try {
|
|
@@ -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
|
|
@@ -291,7 +292,7 @@ Examples:
|
|
|
291
292
|
jsonError(`skill '${ref}' is not yet vetted`, 'user-wide install requires vetting');
|
|
292
293
|
return;
|
|
293
294
|
}
|
|
294
|
-
console.error(`skill '${ref}' is not yet vetted.
|
|
295
|
+
console.error(`skill '${ref}' is not yet vetted. global install requires vetting.`);
|
|
295
296
|
console.error(`tell your operator to vet it first:`);
|
|
296
297
|
console.error('');
|
|
297
298
|
console.error(` vit vet ${ref}`);
|
|
@@ -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 }.
|