@ai-workbench/connect 0.7.23 → 0.7.27
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 +24 -69
- package/client/index.cjs +95 -70
- package/helper/host-directories.cjs +8 -1
- package/lib/api.d.ts +21 -163
- package/lib/component-download.d.ts +1 -1
- package/lib/component-download.js +1 -1
- package/lib/component-source.d.ts +6 -27
- package/lib/component-source.js +10 -138
- package/lib/components.d.ts +1 -1
- package/lib/components.js +86 -98
- package/lib/connect.d.ts +0 -3
- package/lib/connect.js +15 -62
- package/lib/connection-messages.d.ts +2 -3
- package/lib/connection-messages.js +5 -4
- package/lib/conversation-log.d.ts +9 -0
- package/lib/conversation-log.js +44 -0
- package/lib/cordis.d.ts +1 -4
- package/lib/defaults.d.ts +0 -10
- package/lib/defaults.js +1 -3
- package/lib/enrollment.js +1 -8
- package/lib/host-directories.d.ts +6 -4
- package/lib/host-directories.js +4 -4
- package/lib/host-session-projects.d.ts +8 -58
- package/lib/host-session-projects.js +45 -270
- package/lib/index.d.ts +3 -12
- package/lib/index.js +14 -26
- package/lib/integration.d.ts +2 -2
- package/lib/integration.js +0 -3
- package/lib/login.d.ts +0 -8
- package/lib/native-workspace.d.ts +10 -0
- package/lib/needs.js +15 -27
- package/lib/network.d.ts +0 -4
- package/lib/network.js +4 -88
- package/lib/ports.d.ts +1 -6
- package/lib/profile-activation.d.ts +0 -3
- package/lib/profile-activation.js +8 -2
- package/lib/profile-runtime.js +60 -153
- package/lib/profile-settings.d.ts +6 -1
- package/lib/profile-settings.js +3 -5
- package/lib/provider.d.ts +1 -15
- package/lib/provider.js +2 -18
- package/lib/startup.js +3 -3
- package/lib/workspace-directory-picker-types.d.ts +44 -0
- package/lib/workspace-directory-picker-types.js +1 -0
- package/lib/workspace-directory-picker.d.ts +30 -0
- package/lib/workspace-directory-picker.js +372 -0
- package/lib/workspace-location-types.d.ts +3 -7
- package/lib/workspace-locations.d.ts +5 -29
- package/lib/workspace-locations.js +81 -204
- package/package.json +3 -2
- package/helper/projects.cjs +0 -57
- package/lib/conversation-detail-settings.d.ts +0 -32
- package/lib/conversation-detail-settings.js +0 -119
- package/lib/conversation-details.d.ts +0 -30
- package/lib/conversation-details.js +0 -595
- package/lib/host-session-store.d.ts +0 -27
- package/lib/host-session-store.js +0 -130
- package/lib/local-acceptance-store.d.ts +0 -18
- package/lib/local-acceptance-store.js +0 -133
- package/lib/local-user-turn-acceptance.d.ts +0 -76
- package/lib/local-user-turn-acceptance.js +0 -289
- package/lib/local-user-turn-types.d.ts +0 -40
- package/lib/login-diagnostics.d.ts +0 -28
- package/lib/login-diagnostics.js +0 -57
- package/lib/projects.d.ts +0 -4
- package/lib/projects.js +0 -41
- package/lib/workspace-bindings.d.ts +0 -64
- package/lib/workspace-bindings.js +0 -379
- /package/lib/{local-user-turn-types.js → native-workspace.js} +0 -0
|
@@ -1,595 +0,0 @@
|
|
|
1
|
-
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
|
2
|
-
import { lstat, open, readdir, realpath, rename, rm } from 'node:fs/promises';
|
|
3
|
-
import { constants, renameSync } from 'node:fs';
|
|
4
|
-
import { isAbsolute, join, basename } from 'node:path';
|
|
5
|
-
import { fail, need, NeedError, ok } from "./needs.js";
|
|
6
|
-
import { privateDirectory, readPrivate } from "./private-files.js";
|
|
7
|
-
const queues = new Map();
|
|
8
|
-
const digest = (s) => createHash('sha256').update(s).digest('hex');
|
|
9
|
-
const text = (v) => typeof v === 'string' && v.length > 0 && !/[\x00-\x1f\x7f]/.test(v);
|
|
10
|
-
const integer = (v) => Number.isSafeInteger(v) && Number(v) >= 0;
|
|
11
|
-
const brand = (v) => v === 'claude' || v === 'codex';
|
|
12
|
-
const canonical = (v) => v === null || typeof v !== 'object' ? JSON.stringify(v) : Array.isArray(v) ? '[' + v.map(canonical).join(',') + ']' : '{' + Object.keys(v).sort().map(k => JSON.stringify(k) + ':' + canonical(v[k])).join(',') + '}';
|
|
13
|
-
const sensitiveText = /(?:\bBearer\s+\S+|\bsk-(?:ant-)?[a-zA-Z0-9_-]+|-----BEGIN (?:[A-Z ]*PRIVATE KEY)-----|https?:\/\/[^\s]*[?&](?:code|token|access_token|refresh_token|id_token|client_secret|device_code|user_code|password)=)/i;
|
|
14
|
-
const sensitiveKey = /^(?:headers?|body|cookies?|authorization|proxy-authorization|password|passwd|secret|client_secret|token|access_token|refresh_token|id_token|api[_-]?key|device[_-]?code|user[_-]?code|credentials?|prompt|messages|model[_-]?(?:input|output))$/i;
|
|
15
|
-
function json(v, seen = new Set()) {
|
|
16
|
-
if (v === null || typeof v === 'boolean')
|
|
17
|
-
return true;
|
|
18
|
-
if (typeof v === 'number')
|
|
19
|
-
return Number.isFinite(v);
|
|
20
|
-
if (typeof v === 'string')
|
|
21
|
-
return !sensitiveText.test(v);
|
|
22
|
-
if (typeof v !== 'object' || seen.has(v) || (!Array.isArray(v) && Object.getPrototypeOf(v) !== Object.prototype && Object.getPrototypeOf(v) !== null))
|
|
23
|
-
return false;
|
|
24
|
-
seen.add(v);
|
|
25
|
-
let valid = true;
|
|
26
|
-
for (const key of Reflect.ownKeys(v)) {
|
|
27
|
-
if (Array.isArray(v) && key === 'length')
|
|
28
|
-
continue;
|
|
29
|
-
if (typeof key !== 'string' || !Object.getOwnPropertyDescriptor(v, key)?.enumerable || !('value' in Object.getOwnPropertyDescriptor(v, key))) {
|
|
30
|
-
valid = false;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
if (sensitiveText.test(key) || (sensitiveKey.test(key) && v[key] !== '已脱敏') || !json(v[key], seen)) {
|
|
34
|
-
valid = false;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (Array.isArray(v) && Object.keys(v).length !== v.length)
|
|
39
|
-
valid = false;
|
|
40
|
-
seen.delete(v);
|
|
41
|
-
return valid;
|
|
42
|
-
}
|
|
43
|
-
export function validRemoteConversationDetail(v) {
|
|
44
|
-
if (!v || typeof v !== 'object' || !json(v))
|
|
45
|
-
return false;
|
|
46
|
-
const required = ['version', 'eventId', 'instanceId', 'epoch', 'sessionId', 'provider', 'turn', 'step', 'sequence', 'kind', 'severity', 'code', 'summary', 'payload'];
|
|
47
|
-
if (required.some(k => !Object.hasOwn(v, k)) || Object.keys(v).some(k => !required.includes(k) && k !== 'method'))
|
|
48
|
-
return false;
|
|
49
|
-
return v.version === 1 && text(v.eventId) && text(v.instanceId) && integer(v.epoch) && text(v.sessionId) && brand(v.provider) && integer(v.sequence) && [v.turn, v.step].every(x => x === null || text(x) || integer(x)) && text(v.kind) && ['info', 'warning', 'action-required'].includes(v.severity) && text(v.code) && typeof v.summary === 'string' && (v.method === undefined || text(v.method));
|
|
50
|
-
}
|
|
51
|
-
const header = (d) => ({ eventId: d.eventId, instanceId: d.instanceId, epoch: d.epoch, sessionId: d.sessionId, provider: d.provider, sequence: d.sequence, kind: d.kind, severity: d.severity });
|
|
52
|
-
const counts = (items, knownKinds = ['extensions', 'commands', 'tools', 'usage', 'action-required']) => ({ total: items.length, unknownCount: items.filter(d => !knownKinds.includes(d.kind)).length, actionRequiredCount: items.filter(d => d.severity === 'action-required' || d.kind === 'action-required').length });
|
|
53
|
-
export function createConversationDetails(options) {
|
|
54
|
-
const parent = join(options.profileDir, 'ai-workbench-connect'), root = join(parent, options.storageName ?? 'conversation-details');
|
|
55
|
-
const valid = (detail) => validRemoteConversationDetail(detail) && (!options.validate || options.validate(detail));
|
|
56
|
-
let disposed = false, uncertain = false, revision = 0, tail = Promise.resolve();
|
|
57
|
-
const localRefs = new WeakMap(), hostRefs = new WeakMap();
|
|
58
|
-
const reference = (d) => hostRefs.has(d) ? ['host', hostRefs.get(d)] : localRefs.get(d) ?? null;
|
|
59
|
-
let writeGuard, finalReadGuard;
|
|
60
|
-
const recordGuards = new WeakMap();
|
|
61
|
-
let snapshotGuards = [];
|
|
62
|
-
let snapshot = { ...connectionIds(), revision, phase: 'unavailable', sessions: [] };
|
|
63
|
-
const listeners = new Set();
|
|
64
|
-
// Only compact, validated metadata is retained: event bodies remain on disk.
|
|
65
|
-
const indexed = new Map(), storedDigests = new WeakMap();
|
|
66
|
-
const operationScopes = new Map();
|
|
67
|
-
function connectionIds() { const c = options.getConnectionState(); return { instanceId: c.instanceId, epoch: c.epoch }; }
|
|
68
|
-
function check(before) { const c = options.getConnectionState(); if (disposed || c.phase === 'disposed')
|
|
69
|
-
throw new NeedError(need('DISPOSED')); if (c.phase !== 'connected' || c.instanceId !== before.instanceId || c.epoch !== before.epoch)
|
|
70
|
-
throw new NeedError(need('CONNECTION_LOST')); writeGuard?.(); }
|
|
71
|
-
function start() { const c = options.getConnectionState(); check(c); return c; }
|
|
72
|
-
async function checked(p, before) { const value = await p; check(before); return value; }
|
|
73
|
-
function publish(phase, sessions = [], code) {
|
|
74
|
-
snapshot = { ...connectionIds(), revision: ++revision, phase, sessions, ...(code ? { need: need(code) } : {}) };
|
|
75
|
-
const visible = () => options.cacheContext || options.publicationRevision ? currentSnapshot() : structuredClone(snapshot);
|
|
76
|
-
options.onState?.(visible());
|
|
77
|
-
for (const listener of listeners)
|
|
78
|
-
listener(visible());
|
|
79
|
-
}
|
|
80
|
-
function currentSnapshot() { const c = options.getConnectionState(); if (disposed || c.phase === 'disposed')
|
|
81
|
-
return { ...connectionIds(), revision, phase: 'disposed', sessions: [], need: need('DISPOSED') }; if (c.phase !== 'connected' || snapshot.instanceId !== c.instanceId || snapshot.epoch !== c.epoch)
|
|
82
|
-
return { ...connectionIds(), revision, phase: 'unavailable', sessions: [], need: need('CONNECTION_LOST') }; try {
|
|
83
|
-
for (const guard of snapshotGuards)
|
|
84
|
-
guard();
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
return { ...connectionIds(), revision, phase: 'unavailable', sessions: [], need: need(e instanceof NeedError ? e.need.code : 'REMOTE_DETAIL_STORAGE_FAILED') };
|
|
88
|
-
} return structuredClone(snapshot); }
|
|
89
|
-
function error(e) { const code = e instanceof NeedError ? e.need.code : 'REMOTE_DETAIL_STORAGE_FAILED'; if (code === 'REMOTE_DETAIL_STORAGE_FAILED') {
|
|
90
|
-
indexed.clear();
|
|
91
|
-
uncertain = true;
|
|
92
|
-
publish('failed', [], code);
|
|
93
|
-
}
|
|
94
|
-
else if (code === 'DISPOSED')
|
|
95
|
-
publish('disposed', [], code);
|
|
96
|
-
else if (code === 'CONNECTION_LOST' || code === 'REMOTE_DETAIL_SCOPE_INVALID')
|
|
97
|
-
publish('unavailable', [], code); return fail(code); }
|
|
98
|
-
function serial(run) {
|
|
99
|
-
const pending = (queues.get(root) ?? Promise.resolve()).then(async () => { try {
|
|
100
|
-
operationScopes.clear();
|
|
101
|
-
return await run();
|
|
102
|
-
}
|
|
103
|
-
catch (e) {
|
|
104
|
-
return error(e);
|
|
105
|
-
} });
|
|
106
|
-
const done = pending.then(() => { }, () => { });
|
|
107
|
-
queues.set(root, done);
|
|
108
|
-
tail = done;
|
|
109
|
-
void done.then(() => { if (queues.get(root) === done)
|
|
110
|
-
queues.delete(root); });
|
|
111
|
-
return pending;
|
|
112
|
-
}
|
|
113
|
-
async function directory(path, before, create) {
|
|
114
|
-
if (create)
|
|
115
|
-
await checked(privateDirectory(path), before);
|
|
116
|
-
let st;
|
|
117
|
-
try {
|
|
118
|
-
st = await checked(lstat(path), before);
|
|
119
|
-
}
|
|
120
|
-
catch (e) {
|
|
121
|
-
if (!create && e.code === 'ENOENT')
|
|
122
|
-
return false;
|
|
123
|
-
throw e;
|
|
124
|
-
}
|
|
125
|
-
if (!st.isDirectory() || st.isSymbolicLink() || st.uid !== process.getuid() || (st.mode & 0o777) !== 0o700 || await checked(realpath(path), before) !== path)
|
|
126
|
-
throw Error('DETAIL_PATH_INVALID');
|
|
127
|
-
if (create)
|
|
128
|
-
await syncDir(join(path, '..'), before);
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
async function prepare(identity, before, create = false) {
|
|
132
|
-
if (!/^[a-f0-9]{64}$/.test(identity) || !isAbsolute(options.profileDir) || await checked(realpath(options.profileDir), before) !== options.profileDir)
|
|
133
|
-
throw Error('DETAIL_PROFILE_INVALID');
|
|
134
|
-
if (!await directory(parent, before, create) || !await directory(root, before, create))
|
|
135
|
-
return undefined;
|
|
136
|
-
const domain = join(root, identity);
|
|
137
|
-
return await directory(domain, before, create) ? domain : undefined;
|
|
138
|
-
}
|
|
139
|
-
async function syncDir(path, before) { const h = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW); try {
|
|
140
|
-
check(before);
|
|
141
|
-
const st = await checked(h.stat(), before);
|
|
142
|
-
if (!st.isDirectory())
|
|
143
|
-
throw Error('DETAIL_DIRECTORY_INVALID');
|
|
144
|
-
await checked(h.sync(), before);
|
|
145
|
-
}
|
|
146
|
-
finally {
|
|
147
|
-
await h.close();
|
|
148
|
-
} }
|
|
149
|
-
async function durable(file, bytes, before) {
|
|
150
|
-
const temp = file + '.' + randomUUID() + '.tmp';
|
|
151
|
-
let handle;
|
|
152
|
-
try {
|
|
153
|
-
handle = await open(temp, 'wx', 0o600);
|
|
154
|
-
check(before);
|
|
155
|
-
await checked(handle.writeFile(bytes), before);
|
|
156
|
-
await checked(handle.sync(), before);
|
|
157
|
-
await handle.close();
|
|
158
|
-
handle = undefined;
|
|
159
|
-
check(before);
|
|
160
|
-
try {
|
|
161
|
-
const existing = await checked(lstat(file), before);
|
|
162
|
-
if (existing.isSymbolicLink() || !existing.isFile() || existing.nlink !== 1)
|
|
163
|
-
throw Error('DETAIL_PATH_INVALID');
|
|
164
|
-
}
|
|
165
|
-
catch (e) {
|
|
166
|
-
if (e.code !== 'ENOENT')
|
|
167
|
-
throw e;
|
|
168
|
-
}
|
|
169
|
-
if (writeGuard) {
|
|
170
|
-
check(before);
|
|
171
|
-
renameSync(temp, file);
|
|
172
|
-
}
|
|
173
|
-
else
|
|
174
|
-
await checked(rename(temp, file), before);
|
|
175
|
-
await syncDir(join(file, '..'), before);
|
|
176
|
-
}
|
|
177
|
-
finally {
|
|
178
|
-
await handle?.close();
|
|
179
|
-
await rm(temp, { force: true });
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
// A readable record after reopen does not prove the previous rename was durable.
|
|
183
|
-
// O_RDONLY verification may sync existing inodes, but never creates or rewrites one.
|
|
184
|
-
async function verifyReceipt(domain, detail, before) {
|
|
185
|
-
const file = join(domain, digest(detail.eventId) + '.json'), h = await open(file, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
186
|
-
try {
|
|
187
|
-
check(before);
|
|
188
|
-
const st = await checked(h.stat(), before);
|
|
189
|
-
if (!st.isFile() || st.uid !== process.getuid() || st.nlink !== 1 || (st.mode & 0o777) !== 0o600)
|
|
190
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
191
|
-
const record = JSON.parse(await checked(h.readFile('utf8'), before));
|
|
192
|
-
if (!validStored(record) || canonical(record.detail) !== canonical(detail) || (record.localAcceptanceId ?? undefined) !== localRefs.get(detail) || (record.hostBindingRef ?? undefined) !== hostRefs.get(detail))
|
|
193
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
194
|
-
await checked(h.sync(), before);
|
|
195
|
-
}
|
|
196
|
-
finally {
|
|
197
|
-
await h.close();
|
|
198
|
-
}
|
|
199
|
-
for (const path of [domain, root, parent, options.profileDir])
|
|
200
|
-
await syncDir(path, before);
|
|
201
|
-
}
|
|
202
|
-
async function privateRead(path, before) {
|
|
203
|
-
const st = await checked(lstat(path), before);
|
|
204
|
-
if (!st.isFile() || st.isSymbolicLink() || st.nlink !== 1 || (st.mode & 0o777) !== 0o600)
|
|
205
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
206
|
-
return await checked(readPrivate(path), before);
|
|
207
|
-
}
|
|
208
|
-
async function key(before, create = false) {
|
|
209
|
-
const path = join(root, 'cursor-key');
|
|
210
|
-
try {
|
|
211
|
-
const value = await privateRead(path, before);
|
|
212
|
-
if (!/^[a-f0-9]{64}$/.test(value))
|
|
213
|
-
throw Error('DETAIL_CURSOR_KEY_INVALID');
|
|
214
|
-
return value;
|
|
215
|
-
}
|
|
216
|
-
catch (e) {
|
|
217
|
-
if (!create || e.code !== 'ENOENT')
|
|
218
|
-
throw e;
|
|
219
|
-
}
|
|
220
|
-
const value = randomBytes(32).toString('hex');
|
|
221
|
-
await durable(path, value, before);
|
|
222
|
-
return value;
|
|
223
|
-
}
|
|
224
|
-
function validStored(raw) {
|
|
225
|
-
if (!raw || !valid(raw.detail) || raw.digest !== digest(canonical(raw.detail)))
|
|
226
|
-
return false;
|
|
227
|
-
if (raw.version === 1)
|
|
228
|
-
return Object.keys(raw).sort().join(',') === 'detail,digest,version';
|
|
229
|
-
if (raw.version === 3)
|
|
230
|
-
return Object.keys(raw).sort().join(',') === 'detail,digest,hostBindingRef,scopeDigest,version' && text(raw.hostBindingRef) && raw.scopeDigest === digest(canonical(['host', raw.hostBindingRef, raw.detail]));
|
|
231
|
-
return raw.version === 2 && Object.keys(raw).sort().join(',') === 'detail,digest,localAcceptanceId,scopeDigest,version' && text(raw.localAcceptanceId) && raw.scopeDigest === digest(canonical([raw.localAcceptanceId, raw.detail]));
|
|
232
|
-
}
|
|
233
|
-
function metadata(st) {
|
|
234
|
-
if (!st.isFile() || st.isSymbolicLink() || st.uid !== BigInt(process.getuid()) || st.nlink !== 1n || (st.mode & 511n) !== 384n)
|
|
235
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
236
|
-
return [st.dev, st.ino, st.size, st.mtimeNs, st.ctimeNs, st.mode, st.uid, st.gid, st.nlink].join(':');
|
|
237
|
-
}
|
|
238
|
-
function recordScope(d, identity, before) {
|
|
239
|
-
const host = hostRefs.get(d), local = localRefs.get(d), ref = host ?? local;
|
|
240
|
-
if (!ref)
|
|
241
|
-
throw Error('DETAIL_CONTEXT_REQUIRED');
|
|
242
|
-
const id = canonical([identity, host ? 'host' : 'local', ref, d.sessionId, d.provider, d.instanceId, d.epoch]), cached = operationScopes.get(id);
|
|
243
|
-
if (cached)
|
|
244
|
-
return cached;
|
|
245
|
-
const admission = host ? options.hostAcceptance : options.localAcceptance;
|
|
246
|
-
if (!admission)
|
|
247
|
-
throw Error('DETAIL_CONTEXT_REQUIRED');
|
|
248
|
-
return checked(admission.readScope(d.sessionId, d.provider, ref, d, identity), before).then(r => { operationScopes.set(id, r); return r; });
|
|
249
|
-
}
|
|
250
|
-
async function rows(domain, before) {
|
|
251
|
-
const items = [], ids = new Set(), sequences = new Set(), previous = indexed.get(domain), next = new Map();
|
|
252
|
-
const names = await checked(readdir(domain), before);
|
|
253
|
-
for (const name of names)
|
|
254
|
-
if (!/^[a-f0-9]{64}\.json$/.test(name))
|
|
255
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
256
|
-
// Batch independent metadata reads under one post-await admission check. Never
|
|
257
|
-
// treat an unchanged directory mtime as evidence that file contents are intact.
|
|
258
|
-
const fingerprints = await checked(Promise.all(names.map(async (name) => metadata(await lstat(join(domain, name), { bigint: true })))), before);
|
|
259
|
-
for (let n = 0; n < names.length; n++) {
|
|
260
|
-
const name = names[n], fingerprint = fingerprints[n];
|
|
261
|
-
let entry = previous?.get(name);
|
|
262
|
-
if (!entry || entry.fingerprint !== fingerprint) {
|
|
263
|
-
const raw = JSON.parse(await privateRead(join(domain, name), before));
|
|
264
|
-
if (!validStored(raw) || name !== digest(raw.detail.eventId) + '.json' || metadata(await checked(lstat(join(domain, name), { bigint: true }), before)) !== fingerprint)
|
|
265
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
266
|
-
const d = header(raw.detail);
|
|
267
|
-
if (raw.version === 2)
|
|
268
|
-
localRefs.set(d, raw.localAcceptanceId);
|
|
269
|
-
if (raw.version === 3)
|
|
270
|
-
hostRefs.set(d, raw.hostBindingRef);
|
|
271
|
-
entry = { fingerprint, row: d, digest: raw.digest };
|
|
272
|
-
storedDigests.set(d, raw.digest);
|
|
273
|
-
}
|
|
274
|
-
const d = entry.row;
|
|
275
|
-
if (ids.has(d.eventId) || sequences.has(canonical([d.sessionId, d.provider, d.sequence])))
|
|
276
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
277
|
-
if (localRefs.has(d) || hostRefs.has(d)) {
|
|
278
|
-
const proof = recordScope(d, basename(domain), before), r = proof instanceof Promise ? await proof : proof;
|
|
279
|
-
if (!r.ok && r.error.code !== 'REMOTE_DETAIL_SCOPE_INVALID')
|
|
280
|
-
throw new NeedError(r.error);
|
|
281
|
-
}
|
|
282
|
-
ids.add(d.eventId);
|
|
283
|
-
sequences.add(canonical([d.sessionId, d.provider, d.sequence]));
|
|
284
|
-
items.push(d);
|
|
285
|
-
next.set(name, entry);
|
|
286
|
-
}
|
|
287
|
-
indexed.set(domain, next);
|
|
288
|
-
return items;
|
|
289
|
-
}
|
|
290
|
-
async function loadDetail(domain, row, before) {
|
|
291
|
-
const raw = JSON.parse(await privateRead(join(domain, digest(row.eventId) + '.json'), before));
|
|
292
|
-
if (!validStored(raw) || canonical(header(raw.detail)) !== canonical(row) || raw.digest !== storedDigests.get(row) || (raw.localAcceptanceId ?? undefined) !== localRefs.get(row) || (raw.hostBindingRef ?? undefined) !== hostRefs.get(row))
|
|
293
|
-
throw Error('DETAIL_RECORD_INVALID');
|
|
294
|
-
const d = raw.detail;
|
|
295
|
-
if (localRefs.has(row))
|
|
296
|
-
localRefs.set(d, localRefs.get(row));
|
|
297
|
-
if (hostRefs.has(row))
|
|
298
|
-
hostRefs.set(d, hostRefs.get(row));
|
|
299
|
-
return d;
|
|
300
|
-
}
|
|
301
|
-
async function scope(sessionId, provider, before) {
|
|
302
|
-
if (!text(sessionId) || !brand(provider))
|
|
303
|
-
throw new NeedError(need('REMOTE_DETAIL_SCOPE_INVALID'));
|
|
304
|
-
const result = await checked(options.scope(sessionId, provider), before);
|
|
305
|
-
if (!result.ok)
|
|
306
|
-
throw new NeedError(result.error);
|
|
307
|
-
return result.value.identity;
|
|
308
|
-
}
|
|
309
|
-
async function readScope(sessionId, provider, before) {
|
|
310
|
-
if (!text(sessionId) || !brand(provider))
|
|
311
|
-
throw new NeedError(need('REMOTE_DETAIL_SCOPE_INVALID'));
|
|
312
|
-
if (options.hostAcceptance?.hasSession(sessionId)) {
|
|
313
|
-
const host = await checked(options.hostAcceptance.readScope(sessionId, provider), before);
|
|
314
|
-
if (!host.ok)
|
|
315
|
-
throw new NeedError(host.error);
|
|
316
|
-
finalReadGuard = host.value.guard;
|
|
317
|
-
return host.value.identity;
|
|
318
|
-
}
|
|
319
|
-
const legacy = await checked(options.scope(sessionId, provider), before);
|
|
320
|
-
const local = options.localAcceptance ? await checked(options.localAcceptance.readScope(sessionId, provider), before) : undefined;
|
|
321
|
-
if (local && !local.ok && local.error.code !== 'REMOTE_DETAIL_SCOPE_INVALID')
|
|
322
|
-
throw new NeedError(local.error);
|
|
323
|
-
if (local?.ok) {
|
|
324
|
-
finalReadGuard = local.value.guard;
|
|
325
|
-
return local.value.identity;
|
|
326
|
-
}
|
|
327
|
-
finalReadGuard = undefined;
|
|
328
|
-
if (legacy.ok)
|
|
329
|
-
return legacy.value.identity;
|
|
330
|
-
throw new NeedError(legacy.error);
|
|
331
|
-
}
|
|
332
|
-
async function authorized(items, identity, sessionId, provider, before) {
|
|
333
|
-
const selected = items.filter(d => d.sessionId === sessionId && d.provider === provider), result = [];
|
|
334
|
-
const legacy = selected.some(d => !localRefs.has(d) && !hostRefs.has(d)) ? await checked(options.scope(sessionId, provider), before) : undefined;
|
|
335
|
-
for (const d of selected) {
|
|
336
|
-
const hostRef = hostRefs.get(d);
|
|
337
|
-
if (hostRef) {
|
|
338
|
-
const proof = recordScope(d, identity, before), r = proof instanceof Promise ? await proof : proof;
|
|
339
|
-
if (r.ok && r.value.identity === identity) {
|
|
340
|
-
recordGuards.set(d, { guard: r.value.guard, cacheGuard: r.value.cacheGuard });
|
|
341
|
-
result.push(d);
|
|
342
|
-
}
|
|
343
|
-
else if (!r.ok && r.error.code !== 'REMOTE_DETAIL_SCOPE_INVALID')
|
|
344
|
-
throw new NeedError(r.error);
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
const ref = localRefs.get(d);
|
|
348
|
-
if (ref) {
|
|
349
|
-
const proof = recordScope(d, identity, before), r = proof instanceof Promise ? await proof : proof;
|
|
350
|
-
if (r.ok && r.value.identity === identity) {
|
|
351
|
-
recordGuards.set(d, { guard: r.value.guard, cacheGuard: r.value.cacheGuard });
|
|
352
|
-
result.push(d);
|
|
353
|
-
}
|
|
354
|
-
else if (!r.ok && r.error.code !== 'REMOTE_DETAIL_SCOPE_INVALID')
|
|
355
|
-
throw new NeedError(r.error);
|
|
356
|
-
}
|
|
357
|
-
else if (legacy?.ok && legacy.value.identity === identity)
|
|
358
|
-
result.push(d);
|
|
359
|
-
}
|
|
360
|
-
return result;
|
|
361
|
-
}
|
|
362
|
-
function guardRecords(items) {
|
|
363
|
-
const guards = new Set(items.flatMap(d => { const proof = recordGuards.get(d); return proof ? [proof.guard] : []; }));
|
|
364
|
-
for (const guard of guards)
|
|
365
|
-
guard();
|
|
366
|
-
}
|
|
367
|
-
async function stateRows(items, identity, before) {
|
|
368
|
-
const publicationRevision = options.publicationRevision?.(), publicationCurrent = () => !options.publicationRevision || options.publicationRevision() === publicationRevision, publicationGuard = () => { if (!publicationCurrent())
|
|
369
|
-
throw new NeedError(need('REMOTE_DETAIL_SCOPE_INVALID')); };
|
|
370
|
-
const sessions = [], seen = new Set(), guards = [], cacheGuards = [];
|
|
371
|
-
let excluded = false;
|
|
372
|
-
for (const d of items) {
|
|
373
|
-
const pair = canonical([d.sessionId, d.provider]);
|
|
374
|
-
if (seen.has(pair))
|
|
375
|
-
continue;
|
|
376
|
-
seen.add(pair);
|
|
377
|
-
const accessible = await authorized(items, identity, d.sessionId, d.provider, before);
|
|
378
|
-
if (!accessible.length) {
|
|
379
|
-
excluded = true;
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
for (const item of accessible) {
|
|
383
|
-
const guard = recordGuards.get(item);
|
|
384
|
-
if (guard) {
|
|
385
|
-
guards.push(guard.guard);
|
|
386
|
-
cacheGuards.push(guard.cacheGuard);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
sessions.push({ sessionId: d.sessionId, provider: d.provider, ...counts(accessible, options.knownKinds) });
|
|
390
|
-
}
|
|
391
|
-
check(before);
|
|
392
|
-
for (const guard of new Set(guards))
|
|
393
|
-
guard();
|
|
394
|
-
if (!publicationCurrent())
|
|
395
|
-
return;
|
|
396
|
-
snapshotGuards = [...new Set(cacheGuards), ...(options.cacheContext ? [() => options.cacheContext(identity)] : []), ...(options.publicationRevision ? [publicationGuard] : [])];
|
|
397
|
-
publish('ready', sessions, excluded ? 'REMOTE_DETAIL_SCOPE_INVALID' : undefined);
|
|
398
|
-
}
|
|
399
|
-
function cursor(value, secret) { const payload = Buffer.from(canonical(value)).toString('base64url'); return payload + '.' + createHmac('sha256', secret).update(payload).digest('hex'); }
|
|
400
|
-
function readCursor(value, secret) {
|
|
401
|
-
if (!/^[A-Za-z0-9_-]+\.[a-f0-9]{64}$/.test(value))
|
|
402
|
-
throw new NeedError(need('REMOTE_DETAIL_CURSOR_INVALID'));
|
|
403
|
-
const [payload, mac] = value.split('.'), expected = createHmac('sha256', secret).update(payload).digest();
|
|
404
|
-
if (!timingSafeEqual(Buffer.from(mac, 'hex'), expected))
|
|
405
|
-
throw new NeedError(need('REMOTE_DETAIL_CURSOR_INVALID'));
|
|
406
|
-
try {
|
|
407
|
-
return JSON.parse(Buffer.from(payload, 'base64url').toString('utf8'));
|
|
408
|
-
}
|
|
409
|
-
catch {
|
|
410
|
-
throw new NeedError(need('REMOTE_DETAIL_CURSOR_INVALID'));
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
const api = {
|
|
414
|
-
appendRemoteConversationDetail(input, scopeInput) {
|
|
415
|
-
let detail, localId;
|
|
416
|
-
try {
|
|
417
|
-
if (!valid(input))
|
|
418
|
-
return Promise.resolve(fail('REMOTE_DETAIL_INVALID'));
|
|
419
|
-
detail = structuredClone(input);
|
|
420
|
-
if (scopeInput !== undefined) {
|
|
421
|
-
if (!scopeInput || Object.keys(scopeInput).join(',') !== 'localAcceptanceId' || !text(scopeInput.localAcceptanceId))
|
|
422
|
-
return Promise.resolve(fail('REMOTE_DETAIL_SCOPE_INVALID'));
|
|
423
|
-
localId = scopeInput.localAcceptanceId;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
catch {
|
|
427
|
-
return Promise.resolve(fail('REMOTE_DETAIL_INVALID'));
|
|
428
|
-
}
|
|
429
|
-
return serial(async () => {
|
|
430
|
-
const before = start();
|
|
431
|
-
if (detail.instanceId !== before.instanceId || detail.epoch !== before.epoch)
|
|
432
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
433
|
-
let admissionGuard;
|
|
434
|
-
const write = async (proof) => {
|
|
435
|
-
admissionGuard = proof?.guard;
|
|
436
|
-
writeGuard = proof?.guard;
|
|
437
|
-
try {
|
|
438
|
-
check(before);
|
|
439
|
-
if (!Number.isSafeInteger(options.maxEventBytes) || options.maxEventBytes < 1)
|
|
440
|
-
return fail('SETTINGS_REQUIRED');
|
|
441
|
-
const identity = proof?.identity ?? await scope(detail.sessionId, detail.provider, before), domain = (await prepare(identity, before, true)), items = await rows(domain, before), existing = items.find(d => d.eventId === detail.eventId);
|
|
442
|
-
if (existing && (storedDigests.get(existing) !== digest(canonical(detail)) || localRefs.get(existing) !== localId || hostRefs.get(existing) !== proof?.hostBindingRef))
|
|
443
|
-
return fail('REMOTE_DETAIL_CONFLICT');
|
|
444
|
-
if (!existing && Buffer.byteLength(JSON.stringify(detail), 'utf8') > options.maxEventBytes)
|
|
445
|
-
return fail('REMOTE_DETAIL_TOO_LARGE');
|
|
446
|
-
if (!existing && items.some(d => d.sessionId === detail.sessionId && d.provider === detail.provider && d.sequence >= detail.sequence))
|
|
447
|
-
return fail('REMOTE_DETAIL_SEQUENCE_INVALID');
|
|
448
|
-
if (!proof && await scope(detail.sessionId, detail.provider, before) !== identity)
|
|
449
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
450
|
-
check(before);
|
|
451
|
-
const file = join(domain, digest(detail.eventId) + '.json');
|
|
452
|
-
await key(before, true);
|
|
453
|
-
if (!existing) {
|
|
454
|
-
const envelope = proof?.hostBindingRef ? { version: 3, hostBindingRef: proof.hostBindingRef, scopeDigest: digest(canonical(['host', proof.hostBindingRef, detail])) } : localId ? { version: 2, localAcceptanceId: localId, scopeDigest: digest(canonical([localId, detail])) } : { version: 1 };
|
|
455
|
-
await durable(file, JSON.stringify({ ...envelope, digest: digest(canonical(detail)), detail }) + '\n', before);
|
|
456
|
-
if (localId)
|
|
457
|
-
localRefs.set(detail, localId);
|
|
458
|
-
if (proof?.hostBindingRef)
|
|
459
|
-
hostRefs.set(detail, proof.hostBindingRef);
|
|
460
|
-
items.push(detail);
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
if (localId)
|
|
464
|
-
localRefs.set(detail, localId);
|
|
465
|
-
if (proof?.hostBindingRef)
|
|
466
|
-
hostRefs.set(detail, proof.hostBindingRef);
|
|
467
|
-
await verifyReceipt(domain, detail, before);
|
|
468
|
-
}
|
|
469
|
-
await stateRows(items, identity, before);
|
|
470
|
-
if (!proof && await scope(detail.sessionId, detail.provider, before) !== identity)
|
|
471
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
472
|
-
check(before);
|
|
473
|
-
uncertain = false;
|
|
474
|
-
return ok({ eventId: detail.eventId, recorded: true });
|
|
475
|
-
}
|
|
476
|
-
finally {
|
|
477
|
-
writeGuard = undefined;
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
if (options.hostAcceptance?.hasSession(detail.sessionId)) {
|
|
481
|
-
if (localId)
|
|
482
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
483
|
-
const result = await options.hostAcceptance.withWrite(detail, write);
|
|
484
|
-
if (result.ok) {
|
|
485
|
-
admissionGuard?.();
|
|
486
|
-
check(before);
|
|
487
|
-
}
|
|
488
|
-
return !result.ok && result.error.code === 'REMOTE_DETAIL_STORAGE_FAILED' ? error(new NeedError(result.error)) : result;
|
|
489
|
-
}
|
|
490
|
-
if (localId) {
|
|
491
|
-
if (!options.localAcceptance)
|
|
492
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
493
|
-
const result = await options.localAcceptance.withWrite(localId, detail, write);
|
|
494
|
-
if (result.ok) {
|
|
495
|
-
admissionGuard?.();
|
|
496
|
-
check(before);
|
|
497
|
-
}
|
|
498
|
-
return !result.ok && result.error.code === 'REMOTE_DETAIL_STORAGE_FAILED' ? error(new NeedError(result.error)) : result;
|
|
499
|
-
}
|
|
500
|
-
return write();
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
getRemoteConversationDetailReceipt(query) {
|
|
504
|
-
let q;
|
|
505
|
-
try {
|
|
506
|
-
q = structuredClone(query);
|
|
507
|
-
}
|
|
508
|
-
catch {
|
|
509
|
-
return Promise.resolve(fail('REMOTE_DETAIL_INVALID'));
|
|
510
|
-
}
|
|
511
|
-
return serial(async () => {
|
|
512
|
-
const before = start();
|
|
513
|
-
if (!q || !text(q.eventId) || Object.keys(q).sort().join(',') !== 'eventId,provider,sessionId')
|
|
514
|
-
return fail('REMOTE_DETAIL_INVALID');
|
|
515
|
-
const identity = await readScope(q.sessionId, q.provider, before), domain = await prepare(identity, before), items = domain ? await rows(domain, before) : [], row = items.find(r => r.eventId === q.eventId);
|
|
516
|
-
const d = row ? await loadDetail(domain, row, before) : undefined;
|
|
517
|
-
if (d && (d.sessionId !== q.sessionId || d.provider !== q.provider || !(await authorized([d], identity, q.sessionId, q.provider, before)).length))
|
|
518
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
519
|
-
if (d)
|
|
520
|
-
await verifyReceipt(domain, d, before);
|
|
521
|
-
else if (uncertain)
|
|
522
|
-
return fail('REMOTE_DETAIL_STORAGE_FAILED');
|
|
523
|
-
if (await readScope(q.sessionId, q.provider, before) !== identity)
|
|
524
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
525
|
-
if (d)
|
|
526
|
-
uncertain = false;
|
|
527
|
-
if (d)
|
|
528
|
-
guardRecords([d]);
|
|
529
|
-
finalReadGuard?.();
|
|
530
|
-
check(before);
|
|
531
|
-
return ok(d ? { eventId: q.eventId, recorded: true, detail: structuredClone(d) } : { eventId: q.eventId, recorded: false });
|
|
532
|
-
});
|
|
533
|
-
},
|
|
534
|
-
listRemoteConversationDetails(query) {
|
|
535
|
-
let q;
|
|
536
|
-
try {
|
|
537
|
-
q = structuredClone(query);
|
|
538
|
-
}
|
|
539
|
-
catch {
|
|
540
|
-
return Promise.resolve(fail('REMOTE_DETAIL_INVALID'));
|
|
541
|
-
}
|
|
542
|
-
return serial(async () => {
|
|
543
|
-
const before = start();
|
|
544
|
-
if (uncertain)
|
|
545
|
-
return fail('REMOTE_DETAIL_STORAGE_FAILED');
|
|
546
|
-
if (!q || Object.keys(q).some(k => !['sessionId', 'provider', 'cursor'].includes(k)))
|
|
547
|
-
return fail('REMOTE_DETAIL_INVALID');
|
|
548
|
-
if (!Number.isSafeInteger(options.pageSize) || options.pageSize < 1)
|
|
549
|
-
return fail('SETTINGS_REQUIRED');
|
|
550
|
-
const identity = await readScope(q.sessionId, q.provider, before), domain = await prepare(identity, before), items = domain ? await rows(domain, before) : [], all = (await authorized(items, identity, q.sessionId, q.provider, before)).sort((a, b) => a.sequence - b.sequence);
|
|
551
|
-
const secret = all.length ? await key(before) : '';
|
|
552
|
-
if (q.cursor !== undefined && !all.length)
|
|
553
|
-
return fail('REMOTE_DETAIL_CURSOR_INVALID');
|
|
554
|
-
let upper = all.at(-1)?.sequence ?? -1, after = -1;
|
|
555
|
-
if (q.cursor !== undefined) {
|
|
556
|
-
if (typeof q.cursor !== 'string')
|
|
557
|
-
return fail('REMOTE_DETAIL_CURSOR_INVALID');
|
|
558
|
-
const c = readCursor(q.cursor, secret);
|
|
559
|
-
if (!c || typeof c !== 'object' || Array.isArray(c) || !['after,authorization,identity,provider,sessionId,upper,version', 'after,identity,provider,sessionId,upper,version'].includes(Object.keys(c).sort().join(',')) || c.version !== 1 || c.identity !== identity || c.sessionId !== q.sessionId || c.provider !== q.provider || !integer(c.upper) || !integer(c.after) || c.after > c.upper || !all.some(d => d.sequence === c.upper) || !all.some(d => d.sequence === c.after))
|
|
560
|
-
return fail('REMOTE_DETAIL_CURSOR_INVALID');
|
|
561
|
-
if (c.authorization === undefined ? all.some(d => d.sequence <= c.upper && (localRefs.has(d) || hostRefs.has(d))) : c.authorization !== digest(canonical(all.filter(d => d.sequence <= c.upper).map(d => [d.eventId, reference(d)]))))
|
|
562
|
-
return fail('REMOTE_DETAIL_CURSOR_INVALID');
|
|
563
|
-
upper = c.upper;
|
|
564
|
-
after = c.after;
|
|
565
|
-
}
|
|
566
|
-
const bounded = all.filter(d => d.sequence <= upper), remaining = bounded.filter(d => d.sequence > after), page = remaining.slice(0, options.pageSize);
|
|
567
|
-
if (await readScope(q.sessionId, q.provider, before) !== identity)
|
|
568
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
569
|
-
await stateRows(items, identity, before);
|
|
570
|
-
if (await readScope(q.sessionId, q.provider, before) !== identity)
|
|
571
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
572
|
-
const bodies = await Promise.all(page.map(d => loadDetail(domain, d, before)));
|
|
573
|
-
if (await readScope(q.sessionId, q.provider, before) !== identity)
|
|
574
|
-
return fail('REMOTE_DETAIL_SCOPE_INVALID');
|
|
575
|
-
const value = { items: structuredClone(bodies), ...counts(bounded, options.knownKinds), ...(page.length < remaining.length ? { nextCursor: cursor({ version: 1, identity, sessionId: q.sessionId, provider: q.provider, upper, after: page.at(-1).sequence, authorization: digest(canonical(bounded.map(d => [d.eventId, reference(d)]))) }, secret) } : {}) };
|
|
576
|
-
guardRecords(bounded);
|
|
577
|
-
finalReadGuard?.();
|
|
578
|
-
check(before);
|
|
579
|
-
return ok(value);
|
|
580
|
-
});
|
|
581
|
-
},
|
|
582
|
-
getRemoteConversationDetailState: currentSnapshot,
|
|
583
|
-
onRemoteConversationDetailState(listener) { listeners.add(listener); return () => { listeners.delete(listener); }; },
|
|
584
|
-
};
|
|
585
|
-
return { ...api, observeConnection(c) { if (disposed)
|
|
586
|
-
return; if (c.phase !== 'connected') {
|
|
587
|
-
indexed.clear();
|
|
588
|
-
publish(c.phase === 'disposed' ? 'disposed' : 'unavailable', [], c.phase === 'disposed' ? 'DISPOSED' : 'CONNECTION_LOST');
|
|
589
|
-
return;
|
|
590
|
-
} if (uncertain) {
|
|
591
|
-
publish('failed', [], 'REMOTE_DETAIL_STORAGE_FAILED');
|
|
592
|
-
return;
|
|
593
|
-
} publish('loading'); void serial(async () => { const before = start(), context = await checked(options.context(), before); if (!context.ok)
|
|
594
|
-
throw new NeedError(context.error); const identity = context.value.identity, domain = await prepare(identity, before); await stateRows(domain ? await rows(domain, before) : [], identity, before); return ok(undefined); }); }, async dispose() { disposed = true; indexed.clear(); await tail; publish('disposed', [], 'DISPOSED'); listeners.clear(); } };
|
|
595
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { HostDirectoryInfo } from './host-directories.ts';
|
|
2
|
-
import type { Provider } from './api.ts';
|
|
3
|
-
export interface HostProjectRecord {
|
|
4
|
-
id: string;
|
|
5
|
-
sessionId: string;
|
|
6
|
-
provider: Provider;
|
|
7
|
-
header: Record<string, any>;
|
|
8
|
-
identity: string;
|
|
9
|
-
workspaceId: string;
|
|
10
|
-
bindingId: string;
|
|
11
|
-
instanceId: string;
|
|
12
|
-
epoch: number;
|
|
13
|
-
runtimeId: string;
|
|
14
|
-
local: {
|
|
15
|
-
path: string;
|
|
16
|
-
device: number;
|
|
17
|
-
inode: number;
|
|
18
|
-
};
|
|
19
|
-
directory: HostDirectoryInfo;
|
|
20
|
-
revoked: boolean;
|
|
21
|
-
key: string;
|
|
22
|
-
}
|
|
23
|
-
export declare function hostProjectStore(profile: string, maxBytes: number): {
|
|
24
|
-
read: () => HostProjectRecord[];
|
|
25
|
-
save: (items: HostProjectRecord[], guard: () => void) => void;
|
|
26
|
-
verify: (expected: HostProjectRecord, guard: () => void) => void;
|
|
27
|
-
};
|