handoff-relay 0.1.0
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/LICENSE +21 -0
- package/README.md +434 -0
- package/dist/api/server.d.ts +16 -0
- package/dist/api/server.js +2578 -0
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +5502 -0
- package/dist/client-CjWEJ02H.d.ts +144 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +2623 -0
- package/dist/mcp/server.d.ts +84 -0
- package/dist/mcp/server.js +2950 -0
- package/dist/relay-service-BjF5HNvN.d.ts +712 -0
- package/docs/advanced-manual-setup.md +196 -0
- package/docs/claude-code-setup.md +143 -0
- package/docs/codex-setup.md +135 -0
- package/docs/demo-video-script.md +49 -0
- package/docs/generic-mcp-setup.md +163 -0
- package/docs/launch-copy.md +70 -0
- package/docs/local-self-hosting.md +170 -0
- package/docs/packet-schema.md +116 -0
- package/docs/security-privacy.md +90 -0
- package/docs/troubleshooting.md +180 -0
- package/examples/hydration-receipts/reply-hydration.json +14 -0
- package/examples/packets/ask.json +73 -0
- package/examples/packets/reply.json +62 -0
- package/examples/packets/share.json +52 -0
- package/fixtures/clarification.json +7 -0
- package/fixtures/declined-packet.json +6 -0
- package/fixtures/normal-ask.json +72 -0
- package/fixtures/normal-share.json +51 -0
- package/fixtures/revoked-member.json +7 -0
- package/fixtures/secret-redaction.json +10 -0
- package/fixtures/stale-handoff.json +16 -0
- package/fixtures/superseded-packet.json +6 -0
- package/package.json +103 -0
|
@@ -0,0 +1,712 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import Database from 'better-sqlite3';
|
|
3
|
+
|
|
4
|
+
type AuditAction = 'accept' | 'approve' | 'archive' | 'clarify' | 'close' | 'configure_project_alias' | 'decline' | 'deliver' | 'draft' | 'edit' | 'hydrate' | 'invite' | 'reply' | 'rotate_approval_secret' | 'revoke' | 'rotate_token' | 'search' | 'send' | 'supersede' | 'view';
|
|
5
|
+
interface AuditReceipt {
|
|
6
|
+
receipt_id: string;
|
|
7
|
+
action: AuditAction;
|
|
8
|
+
actor_member_id: string;
|
|
9
|
+
packet_id?: string;
|
|
10
|
+
workspace_id: string;
|
|
11
|
+
created_at: string;
|
|
12
|
+
metadata: Record<string, unknown>;
|
|
13
|
+
receipt_hash: string;
|
|
14
|
+
}
|
|
15
|
+
interface CreateReceiptInput {
|
|
16
|
+
action: AuditAction;
|
|
17
|
+
actorMemberId: string;
|
|
18
|
+
packetId?: string;
|
|
19
|
+
workspaceId: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
declare function createAuditReceipt(input: CreateReceiptInput): AuditReceipt;
|
|
23
|
+
|
|
24
|
+
declare const packetStatuses: readonly ["draft", "pending_sender_approval", "sent", "delivered", "viewed", "accepted", "clarification_requested", "response_drafting", "pending_recipient_approval", "replied", "hydrated", "archived", "declined", "expired", "superseded", "closed_resolved", "closed_unresolved"];
|
|
25
|
+
declare const packetTypes: readonly ["ask", "share", "reply", "clarification"];
|
|
26
|
+
declare const confidenceLevels: readonly ["low", "medium", "high"];
|
|
27
|
+
declare const auditReceiptSchema: z.ZodObject<{
|
|
28
|
+
receipt_id: z.ZodString;
|
|
29
|
+
action: z.ZodString;
|
|
30
|
+
actor_member_id: z.ZodString;
|
|
31
|
+
packet_id: z.ZodOptional<z.ZodString>;
|
|
32
|
+
workspace_id: z.ZodString;
|
|
33
|
+
created_at: z.ZodString;
|
|
34
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
35
|
+
receipt_hash: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
declare const projectIdentitySchema: z.ZodObject<{
|
|
38
|
+
repo_name: z.ZodString;
|
|
39
|
+
git_remote_fingerprint: z.ZodOptional<z.ZodString>;
|
|
40
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
41
|
+
commit_hash: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
declare const claimSchema: z.ZodObject<{
|
|
44
|
+
claim_id: z.ZodString;
|
|
45
|
+
text: z.ZodString;
|
|
46
|
+
confidence: z.ZodEnum<{
|
|
47
|
+
low: "low";
|
|
48
|
+
medium: "medium";
|
|
49
|
+
high: "high";
|
|
50
|
+
}>;
|
|
51
|
+
status: z.ZodEnum<{
|
|
52
|
+
superseded: "superseded";
|
|
53
|
+
observed: "observed";
|
|
54
|
+
inferred: "inferred";
|
|
55
|
+
suspected: "suspected";
|
|
56
|
+
disproven: "disproven";
|
|
57
|
+
}>;
|
|
58
|
+
evidence_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
59
|
+
needs_recheck: z.ZodDefault<z.ZodBoolean>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
declare const evidenceSchema: z.ZodObject<{
|
|
62
|
+
evidence_id: z.ZodString;
|
|
63
|
+
kind: z.ZodEnum<{
|
|
64
|
+
file_excerpt: "file_excerpt";
|
|
65
|
+
command_output: "command_output";
|
|
66
|
+
test_failure: "test_failure";
|
|
67
|
+
error_message: "error_message";
|
|
68
|
+
log_excerpt: "log_excerpt";
|
|
69
|
+
diff_summary: "diff_summary";
|
|
70
|
+
ticket_link: "ticket_link";
|
|
71
|
+
pr_link: "pr_link";
|
|
72
|
+
human_note: "human_note";
|
|
73
|
+
}>;
|
|
74
|
+
label: z.ZodString;
|
|
75
|
+
source: z.ZodString;
|
|
76
|
+
excerpt: z.ZodDefault<z.ZodString>;
|
|
77
|
+
hash: z.ZodString;
|
|
78
|
+
captured_at: z.ZodString;
|
|
79
|
+
sensitivity: z.ZodDefault<z.ZodEnum<{
|
|
80
|
+
normal: "normal";
|
|
81
|
+
private: "private";
|
|
82
|
+
secret_detected: "secret_detected";
|
|
83
|
+
restricted: "restricted";
|
|
84
|
+
}>>;
|
|
85
|
+
}, z.core.$strict>;
|
|
86
|
+
declare const redactionFindingSchema: z.ZodObject<{
|
|
87
|
+
kind: z.ZodEnum<{
|
|
88
|
+
api_key: "api_key";
|
|
89
|
+
private_key: "private_key";
|
|
90
|
+
credential_url: "credential_url";
|
|
91
|
+
env_secret: "env_secret";
|
|
92
|
+
local_path: "local_path";
|
|
93
|
+
oversized_excerpt: "oversized_excerpt";
|
|
94
|
+
user_pattern: "user_pattern";
|
|
95
|
+
}>;
|
|
96
|
+
field: z.ZodString;
|
|
97
|
+
evidence_id: z.ZodOptional<z.ZodString>;
|
|
98
|
+
severity: z.ZodEnum<{
|
|
99
|
+
warning: "warning";
|
|
100
|
+
block: "block";
|
|
101
|
+
}>;
|
|
102
|
+
message: z.ZodString;
|
|
103
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
declare const redactionReportSchema: z.ZodObject<{
|
|
106
|
+
blocked: z.ZodBoolean;
|
|
107
|
+
findings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
108
|
+
kind: z.ZodEnum<{
|
|
109
|
+
api_key: "api_key";
|
|
110
|
+
private_key: "private_key";
|
|
111
|
+
credential_url: "credential_url";
|
|
112
|
+
env_secret: "env_secret";
|
|
113
|
+
local_path: "local_path";
|
|
114
|
+
oversized_excerpt: "oversized_excerpt";
|
|
115
|
+
user_pattern: "user_pattern";
|
|
116
|
+
}>;
|
|
117
|
+
field: z.ZodString;
|
|
118
|
+
evidence_id: z.ZodOptional<z.ZodString>;
|
|
119
|
+
severity: z.ZodEnum<{
|
|
120
|
+
warning: "warning";
|
|
121
|
+
block: "block";
|
|
122
|
+
}>;
|
|
123
|
+
message: z.ZodString;
|
|
124
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strict>>>;
|
|
126
|
+
warnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
127
|
+
kind: z.ZodEnum<{
|
|
128
|
+
api_key: "api_key";
|
|
129
|
+
private_key: "private_key";
|
|
130
|
+
credential_url: "credential_url";
|
|
131
|
+
env_secret: "env_secret";
|
|
132
|
+
local_path: "local_path";
|
|
133
|
+
oversized_excerpt: "oversized_excerpt";
|
|
134
|
+
user_pattern: "user_pattern";
|
|
135
|
+
}>;
|
|
136
|
+
field: z.ZodString;
|
|
137
|
+
evidence_id: z.ZodOptional<z.ZodString>;
|
|
138
|
+
severity: z.ZodEnum<{
|
|
139
|
+
warning: "warning";
|
|
140
|
+
block: "block";
|
|
141
|
+
}>;
|
|
142
|
+
message: z.ZodString;
|
|
143
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strict>>>;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
declare const hydrationPolicySchema: z.ZodObject<{
|
|
147
|
+
requires_recipient_approval: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
requires_sender_approval_for_replies: z.ZodDefault<z.ZodBoolean>;
|
|
149
|
+
allow_raw_transcript: z.ZodDefault<z.ZodBoolean>;
|
|
150
|
+
max_characters: z.ZodDefault<z.ZodNumber>;
|
|
151
|
+
}, z.core.$strict>;
|
|
152
|
+
declare const packetSchema: z.ZodObject<{
|
|
153
|
+
packet_id: z.ZodString;
|
|
154
|
+
packet_type: z.ZodEnum<{
|
|
155
|
+
ask: "ask";
|
|
156
|
+
reply: "reply";
|
|
157
|
+
share: "share";
|
|
158
|
+
clarification: "clarification";
|
|
159
|
+
}>;
|
|
160
|
+
workspace_id: z.ZodString;
|
|
161
|
+
sender_member_id: z.ZodString;
|
|
162
|
+
recipient_member_ids: z.ZodArray<z.ZodString>;
|
|
163
|
+
parent_packet_id: z.ZodOptional<z.ZodString>;
|
|
164
|
+
created_at: z.ZodString;
|
|
165
|
+
updated_at: z.ZodString;
|
|
166
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
167
|
+
recheck_by: z.ZodOptional<z.ZodString>;
|
|
168
|
+
status: z.ZodEnum<{
|
|
169
|
+
draft: "draft";
|
|
170
|
+
pending_sender_approval: "pending_sender_approval";
|
|
171
|
+
sent: "sent";
|
|
172
|
+
delivered: "delivered";
|
|
173
|
+
viewed: "viewed";
|
|
174
|
+
accepted: "accepted";
|
|
175
|
+
clarification_requested: "clarification_requested";
|
|
176
|
+
response_drafting: "response_drafting";
|
|
177
|
+
pending_recipient_approval: "pending_recipient_approval";
|
|
178
|
+
replied: "replied";
|
|
179
|
+
hydrated: "hydrated";
|
|
180
|
+
archived: "archived";
|
|
181
|
+
declined: "declined";
|
|
182
|
+
expired: "expired";
|
|
183
|
+
superseded: "superseded";
|
|
184
|
+
closed_resolved: "closed_resolved";
|
|
185
|
+
closed_unresolved: "closed_unresolved";
|
|
186
|
+
}>;
|
|
187
|
+
project: z.ZodObject<{
|
|
188
|
+
repo_name: z.ZodString;
|
|
189
|
+
git_remote_fingerprint: z.ZodOptional<z.ZodString>;
|
|
190
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
191
|
+
commit_hash: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, z.core.$strict>;
|
|
193
|
+
source_client: z.ZodEnum<{
|
|
194
|
+
generic: "generic";
|
|
195
|
+
"claude-code": "claude-code";
|
|
196
|
+
codex: "codex";
|
|
197
|
+
cursor: "cursor";
|
|
198
|
+
other: "other";
|
|
199
|
+
}>;
|
|
200
|
+
title: z.ZodString;
|
|
201
|
+
summary: z.ZodString;
|
|
202
|
+
question: z.ZodOptional<z.ZodString>;
|
|
203
|
+
finding: z.ZodOptional<z.ZodString>;
|
|
204
|
+
answer: z.ZodOptional<z.ZodString>;
|
|
205
|
+
claims: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
206
|
+
claim_id: z.ZodString;
|
|
207
|
+
text: z.ZodString;
|
|
208
|
+
confidence: z.ZodEnum<{
|
|
209
|
+
low: "low";
|
|
210
|
+
medium: "medium";
|
|
211
|
+
high: "high";
|
|
212
|
+
}>;
|
|
213
|
+
status: z.ZodEnum<{
|
|
214
|
+
superseded: "superseded";
|
|
215
|
+
observed: "observed";
|
|
216
|
+
inferred: "inferred";
|
|
217
|
+
suspected: "suspected";
|
|
218
|
+
disproven: "disproven";
|
|
219
|
+
}>;
|
|
220
|
+
evidence_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
221
|
+
needs_recheck: z.ZodDefault<z.ZodBoolean>;
|
|
222
|
+
}, z.core.$strict>>>;
|
|
223
|
+
evidence: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
224
|
+
evidence_id: z.ZodString;
|
|
225
|
+
kind: z.ZodEnum<{
|
|
226
|
+
file_excerpt: "file_excerpt";
|
|
227
|
+
command_output: "command_output";
|
|
228
|
+
test_failure: "test_failure";
|
|
229
|
+
error_message: "error_message";
|
|
230
|
+
log_excerpt: "log_excerpt";
|
|
231
|
+
diff_summary: "diff_summary";
|
|
232
|
+
ticket_link: "ticket_link";
|
|
233
|
+
pr_link: "pr_link";
|
|
234
|
+
human_note: "human_note";
|
|
235
|
+
}>;
|
|
236
|
+
label: z.ZodString;
|
|
237
|
+
source: z.ZodString;
|
|
238
|
+
excerpt: z.ZodDefault<z.ZodString>;
|
|
239
|
+
hash: z.ZodString;
|
|
240
|
+
captured_at: z.ZodString;
|
|
241
|
+
sensitivity: z.ZodDefault<z.ZodEnum<{
|
|
242
|
+
normal: "normal";
|
|
243
|
+
private: "private";
|
|
244
|
+
secret_detected: "secret_detected";
|
|
245
|
+
restricted: "restricted";
|
|
246
|
+
}>>;
|
|
247
|
+
}, z.core.$strict>>>;
|
|
248
|
+
files_or_symbols: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
249
|
+
commands_or_tests_run: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
250
|
+
what_was_tried: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
251
|
+
known_failures: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
252
|
+
current_hypothesis: z.ZodDefault<z.ZodString>;
|
|
253
|
+
confidence: z.ZodDefault<z.ZodEnum<{
|
|
254
|
+
low: "low";
|
|
255
|
+
medium: "medium";
|
|
256
|
+
high: "high";
|
|
257
|
+
}>>;
|
|
258
|
+
suggested_next_steps: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
259
|
+
redaction_report: z.ZodObject<{
|
|
260
|
+
blocked: z.ZodBoolean;
|
|
261
|
+
findings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
262
|
+
kind: z.ZodEnum<{
|
|
263
|
+
api_key: "api_key";
|
|
264
|
+
private_key: "private_key";
|
|
265
|
+
credential_url: "credential_url";
|
|
266
|
+
env_secret: "env_secret";
|
|
267
|
+
local_path: "local_path";
|
|
268
|
+
oversized_excerpt: "oversized_excerpt";
|
|
269
|
+
user_pattern: "user_pattern";
|
|
270
|
+
}>;
|
|
271
|
+
field: z.ZodString;
|
|
272
|
+
evidence_id: z.ZodOptional<z.ZodString>;
|
|
273
|
+
severity: z.ZodEnum<{
|
|
274
|
+
warning: "warning";
|
|
275
|
+
block: "block";
|
|
276
|
+
}>;
|
|
277
|
+
message: z.ZodString;
|
|
278
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
279
|
+
}, z.core.$strict>>>;
|
|
280
|
+
warnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
281
|
+
kind: z.ZodEnum<{
|
|
282
|
+
api_key: "api_key";
|
|
283
|
+
private_key: "private_key";
|
|
284
|
+
credential_url: "credential_url";
|
|
285
|
+
env_secret: "env_secret";
|
|
286
|
+
local_path: "local_path";
|
|
287
|
+
oversized_excerpt: "oversized_excerpt";
|
|
288
|
+
user_pattern: "user_pattern";
|
|
289
|
+
}>;
|
|
290
|
+
field: z.ZodString;
|
|
291
|
+
evidence_id: z.ZodOptional<z.ZodString>;
|
|
292
|
+
severity: z.ZodEnum<{
|
|
293
|
+
warning: "warning";
|
|
294
|
+
block: "block";
|
|
295
|
+
}>;
|
|
296
|
+
message: z.ZodString;
|
|
297
|
+
preview: z.ZodOptional<z.ZodString>;
|
|
298
|
+
}, z.core.$strict>>>;
|
|
299
|
+
}, z.core.$strict>;
|
|
300
|
+
hydration_policy: z.ZodObject<{
|
|
301
|
+
requires_recipient_approval: z.ZodDefault<z.ZodBoolean>;
|
|
302
|
+
requires_sender_approval_for_replies: z.ZodDefault<z.ZodBoolean>;
|
|
303
|
+
allow_raw_transcript: z.ZodDefault<z.ZodBoolean>;
|
|
304
|
+
max_characters: z.ZodDefault<z.ZodNumber>;
|
|
305
|
+
}, z.core.$strict>;
|
|
306
|
+
audit_receipt: z.ZodObject<{
|
|
307
|
+
receipt_id: z.ZodString;
|
|
308
|
+
action: z.ZodString;
|
|
309
|
+
actor_member_id: z.ZodString;
|
|
310
|
+
packet_id: z.ZodOptional<z.ZodString>;
|
|
311
|
+
workspace_id: z.ZodString;
|
|
312
|
+
created_at: z.ZodString;
|
|
313
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
314
|
+
receipt_hash: z.ZodOptional<z.ZodString>;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
}, z.core.$strict>;
|
|
317
|
+
type PacketStatus = (typeof packetStatuses)[number];
|
|
318
|
+
type PacketType = (typeof packetTypes)[number];
|
|
319
|
+
type RelayPacket = z.infer<typeof packetSchema>;
|
|
320
|
+
type RelayEvidence = z.infer<typeof evidenceSchema>;
|
|
321
|
+
type RelayClaim = z.infer<typeof claimSchema>;
|
|
322
|
+
type RedactionReport = z.infer<typeof redactionReportSchema>;
|
|
323
|
+
type RedactionFinding = z.infer<typeof redactionFindingSchema>;
|
|
324
|
+
type HydrationPolicy = z.infer<typeof hydrationPolicySchema>;
|
|
325
|
+
type ProjectIdentity = z.infer<typeof projectIdentitySchema>;
|
|
326
|
+
interface ContextBudgetLimits {
|
|
327
|
+
summaryCharacters: number;
|
|
328
|
+
mainTextCharacters: number;
|
|
329
|
+
maxClaims: number;
|
|
330
|
+
maxEvidence: number;
|
|
331
|
+
maxExcerptCharacters: number;
|
|
332
|
+
maxHydrationCharacters: number;
|
|
333
|
+
}
|
|
334
|
+
declare const defaultContextBudget: ContextBudgetLimits;
|
|
335
|
+
interface BuildPacketDraftInput {
|
|
336
|
+
packet_type: PacketType;
|
|
337
|
+
workspace_id: string;
|
|
338
|
+
sender_member_id: string;
|
|
339
|
+
recipient_member_ids: string[];
|
|
340
|
+
source_client: RelayPacket['source_client'];
|
|
341
|
+
title: string;
|
|
342
|
+
summary: string;
|
|
343
|
+
question?: string;
|
|
344
|
+
finding?: string;
|
|
345
|
+
answer?: string;
|
|
346
|
+
parent_packet_id?: string;
|
|
347
|
+
project?: Partial<ProjectIdentity>;
|
|
348
|
+
claims?: Partial<RelayClaim>[];
|
|
349
|
+
evidence?: Partial<RelayEvidence>[];
|
|
350
|
+
files_or_symbols?: string[];
|
|
351
|
+
commands_or_tests_run?: string[];
|
|
352
|
+
what_was_tried?: string[];
|
|
353
|
+
known_failures?: string[];
|
|
354
|
+
current_hypothesis?: string;
|
|
355
|
+
confidence?: RelayPacket['confidence'];
|
|
356
|
+
suggested_next_steps?: string[];
|
|
357
|
+
expires_at?: string;
|
|
358
|
+
recheck_by?: string;
|
|
359
|
+
status?: PacketStatus;
|
|
360
|
+
redaction_report?: RedactionReport;
|
|
361
|
+
hydration_policy?: Partial<HydrationPolicy>;
|
|
362
|
+
}
|
|
363
|
+
interface ContextBudgetResult {
|
|
364
|
+
ok: boolean;
|
|
365
|
+
violations: string[];
|
|
366
|
+
}
|
|
367
|
+
declare function normalizeEvidence(evidence: Partial<RelayEvidence>, index: number): RelayEvidence;
|
|
368
|
+
declare function normalizeClaim(claim: Partial<RelayClaim>, index: number): RelayClaim;
|
|
369
|
+
declare function buildPacketDraft(input: BuildPacketDraftInput): RelayPacket;
|
|
370
|
+
declare function validateContextBudget(packet: RelayPacket, limits?: Partial<ContextBudgetLimits>): ContextBudgetResult;
|
|
371
|
+
declare function compressPacketToBudget(packet: RelayPacket, limits?: Partial<ContextBudgetLimits>): RelayPacket;
|
|
372
|
+
|
|
373
|
+
interface HydrationInput {
|
|
374
|
+
hydratedBy: string;
|
|
375
|
+
client: string;
|
|
376
|
+
sessionId?: string;
|
|
377
|
+
maxCharacters?: number;
|
|
378
|
+
}
|
|
379
|
+
interface HydrationResult {
|
|
380
|
+
context: string;
|
|
381
|
+
receipt: AuditReceipt;
|
|
382
|
+
}
|
|
383
|
+
declare function formatHydrationContext(packet: RelayPacket, input: HydrationInput): HydrationResult;
|
|
384
|
+
|
|
385
|
+
type MemberRole = 'admin' | 'member';
|
|
386
|
+
type MemberStatus = 'active' | 'revoked';
|
|
387
|
+
interface WorkspaceRecord {
|
|
388
|
+
id: string;
|
|
389
|
+
name: string;
|
|
390
|
+
admin_body_access: boolean;
|
|
391
|
+
created_at: string;
|
|
392
|
+
}
|
|
393
|
+
interface MemberRecord {
|
|
394
|
+
id: string;
|
|
395
|
+
workspace_id: string;
|
|
396
|
+
handle: string;
|
|
397
|
+
display_name: string;
|
|
398
|
+
role: MemberRole;
|
|
399
|
+
status: MemberStatus;
|
|
400
|
+
token?: string;
|
|
401
|
+
approval_secret?: string;
|
|
402
|
+
created_at: string;
|
|
403
|
+
revoked_at?: string;
|
|
404
|
+
}
|
|
405
|
+
interface InviteRecord {
|
|
406
|
+
id: string;
|
|
407
|
+
workspace_id: string;
|
|
408
|
+
handle: string;
|
|
409
|
+
token: string;
|
|
410
|
+
created_by_member_id: string;
|
|
411
|
+
expires_at: string;
|
|
412
|
+
accepted_at?: string;
|
|
413
|
+
created_at: string;
|
|
414
|
+
}
|
|
415
|
+
declare function createId(prefix: string): string;
|
|
416
|
+
declare function createToken(prefix?: string): string;
|
|
417
|
+
declare function hashToken(token: string): string;
|
|
418
|
+
declare function normalizeHandle(handle: string): string;
|
|
419
|
+
|
|
420
|
+
type RelayDatabase = Database.Database;
|
|
421
|
+
declare function createRelayDatabase(path?: string): RelayDatabase;
|
|
422
|
+
|
|
423
|
+
interface CreateWorkspaceInput {
|
|
424
|
+
name: string;
|
|
425
|
+
adminHandle: string;
|
|
426
|
+
adminName: string;
|
|
427
|
+
adminBodyAccess?: boolean;
|
|
428
|
+
}
|
|
429
|
+
type ApprovalAction = 'hydrate' | 'reply' | 'send';
|
|
430
|
+
type HistoryFilter = 'all' | 'closed' | 'drafts' | 'open' | 'sent';
|
|
431
|
+
interface PacketQueryFilters {
|
|
432
|
+
project?: string;
|
|
433
|
+
sender?: string;
|
|
434
|
+
recipient?: string;
|
|
435
|
+
status?: PacketStatus;
|
|
436
|
+
fileOrSymbol?: string;
|
|
437
|
+
ticketOrPr?: string;
|
|
438
|
+
}
|
|
439
|
+
interface ProjectAliasRecord {
|
|
440
|
+
id: string;
|
|
441
|
+
workspace_id: string;
|
|
442
|
+
canonical_project: string;
|
|
443
|
+
alias: string;
|
|
444
|
+
created_by_member_id: string;
|
|
445
|
+
created_at: string;
|
|
446
|
+
}
|
|
447
|
+
interface ApprovalTokenResult {
|
|
448
|
+
approval_token: string;
|
|
449
|
+
action: ApprovalAction;
|
|
450
|
+
packet_id: string;
|
|
451
|
+
expires_at: string;
|
|
452
|
+
}
|
|
453
|
+
interface PacketDraftOptions {
|
|
454
|
+
authToken: string;
|
|
455
|
+
workspaceId: string;
|
|
456
|
+
to: string;
|
|
457
|
+
title: string;
|
|
458
|
+
summary: string;
|
|
459
|
+
sourceClient: RelayPacket['source_client'];
|
|
460
|
+
project?: Partial<ProjectIdentity>;
|
|
461
|
+
evidence?: Partial<RelayEvidence>[];
|
|
462
|
+
claims?: BuildPacketDraftInput['claims'];
|
|
463
|
+
filesOrSymbols?: string[];
|
|
464
|
+
commandsOrTestsRun?: string[];
|
|
465
|
+
whatWasTried?: string[];
|
|
466
|
+
knownFailures?: string[];
|
|
467
|
+
currentHypothesis?: string;
|
|
468
|
+
confidence?: RelayPacket['confidence'];
|
|
469
|
+
suggestedNextSteps?: string[];
|
|
470
|
+
}
|
|
471
|
+
interface AskDraftInput extends PacketDraftOptions {
|
|
472
|
+
question: string;
|
|
473
|
+
}
|
|
474
|
+
interface ShareDraftInput extends PacketDraftOptions {
|
|
475
|
+
finding: string;
|
|
476
|
+
}
|
|
477
|
+
interface ReplyDraftInput {
|
|
478
|
+
authToken: string;
|
|
479
|
+
packetId: string;
|
|
480
|
+
answer: string;
|
|
481
|
+
summary: string;
|
|
482
|
+
sourceClient: RelayPacket['source_client'];
|
|
483
|
+
title?: string;
|
|
484
|
+
evidence?: Partial<RelayEvidence>[];
|
|
485
|
+
confidence?: RelayPacket['confidence'];
|
|
486
|
+
}
|
|
487
|
+
interface UpdateDraftInput {
|
|
488
|
+
authToken: string;
|
|
489
|
+
packetId: string;
|
|
490
|
+
title?: string;
|
|
491
|
+
summary?: string;
|
|
492
|
+
question?: string;
|
|
493
|
+
finding?: string;
|
|
494
|
+
claims?: BuildPacketDraftInput['claims'];
|
|
495
|
+
evidence?: Partial<RelayEvidence>[];
|
|
496
|
+
filesOrSymbols?: string[];
|
|
497
|
+
commandsOrTestsRun?: string[];
|
|
498
|
+
whatWasTried?: string[];
|
|
499
|
+
knownFailures?: string[];
|
|
500
|
+
currentHypothesis?: string;
|
|
501
|
+
confidence?: RelayPacket['confidence'];
|
|
502
|
+
suggestedNextSteps?: string[];
|
|
503
|
+
}
|
|
504
|
+
interface PacketResult {
|
|
505
|
+
id: string;
|
|
506
|
+
packet: RelayPacket;
|
|
507
|
+
}
|
|
508
|
+
interface PacketSearchResult {
|
|
509
|
+
packet_id: string;
|
|
510
|
+
packet_type: RelayPacket['packet_type'];
|
|
511
|
+
workspace_id: string;
|
|
512
|
+
sender_member_id: string;
|
|
513
|
+
recipient_member_ids: string[];
|
|
514
|
+
status: RelayPacket['status'];
|
|
515
|
+
title: string;
|
|
516
|
+
summary: string;
|
|
517
|
+
project: RelayPacket['project'];
|
|
518
|
+
source_client: RelayPacket['source_client'];
|
|
519
|
+
created_at: string;
|
|
520
|
+
updated_at: string;
|
|
521
|
+
expires_at?: string;
|
|
522
|
+
recheck_by?: string;
|
|
523
|
+
body_access: boolean;
|
|
524
|
+
}
|
|
525
|
+
declare class RelayService {
|
|
526
|
+
private readonly db;
|
|
527
|
+
constructor(db: RelayDatabase);
|
|
528
|
+
close(): void;
|
|
529
|
+
createWorkspace(input: CreateWorkspaceInput): {
|
|
530
|
+
workspace: WorkspaceRecord;
|
|
531
|
+
admin: MemberRecord & {
|
|
532
|
+
token: string;
|
|
533
|
+
approval_secret: string;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
inviteMember(input: {
|
|
537
|
+
adminToken: string;
|
|
538
|
+
workspaceId: string;
|
|
539
|
+
handle: string;
|
|
540
|
+
}): {
|
|
541
|
+
invite: InviteRecord;
|
|
542
|
+
};
|
|
543
|
+
acceptInvite(input: {
|
|
544
|
+
inviteToken: string;
|
|
545
|
+
displayName: string;
|
|
546
|
+
}): {
|
|
547
|
+
member: MemberRecord & {
|
|
548
|
+
token: string;
|
|
549
|
+
approval_secret: string;
|
|
550
|
+
};
|
|
551
|
+
workspace: WorkspaceRecord;
|
|
552
|
+
};
|
|
553
|
+
getInvite(input: {
|
|
554
|
+
inviteToken: string;
|
|
555
|
+
}): {
|
|
556
|
+
invite: InviteRecord;
|
|
557
|
+
workspace: WorkspaceRecord;
|
|
558
|
+
};
|
|
559
|
+
listMembers(input: {
|
|
560
|
+
authToken: string;
|
|
561
|
+
workspaceId: string;
|
|
562
|
+
}): MemberRecord[];
|
|
563
|
+
configureProjectAlias(input: {
|
|
564
|
+
authToken: string;
|
|
565
|
+
workspaceId: string;
|
|
566
|
+
canonicalProject: string;
|
|
567
|
+
alias: string;
|
|
568
|
+
}): {
|
|
569
|
+
alias: ProjectAliasRecord;
|
|
570
|
+
};
|
|
571
|
+
listProjectAliases(input: {
|
|
572
|
+
authToken: string;
|
|
573
|
+
workspaceId: string;
|
|
574
|
+
}): ProjectAliasRecord[];
|
|
575
|
+
revokeMember(input: {
|
|
576
|
+
adminToken: string;
|
|
577
|
+
workspaceId: string;
|
|
578
|
+
memberId: string;
|
|
579
|
+
}): {
|
|
580
|
+
member: MemberRecord;
|
|
581
|
+
};
|
|
582
|
+
rotateMemberToken(input: {
|
|
583
|
+
authToken: string;
|
|
584
|
+
}): {
|
|
585
|
+
member: MemberRecord;
|
|
586
|
+
token: string;
|
|
587
|
+
};
|
|
588
|
+
rotateApprovalSecret(input: {
|
|
589
|
+
authToken: string;
|
|
590
|
+
approvalSecret?: string;
|
|
591
|
+
}): {
|
|
592
|
+
member: MemberRecord;
|
|
593
|
+
approval_secret: string;
|
|
594
|
+
};
|
|
595
|
+
createApprovalToken(input: {
|
|
596
|
+
authToken: string;
|
|
597
|
+
approvalSecret?: string;
|
|
598
|
+
packetId: string;
|
|
599
|
+
action: ApprovalAction;
|
|
600
|
+
}): ApprovalTokenResult;
|
|
601
|
+
createAskDraft(input: AskDraftInput): PacketResult;
|
|
602
|
+
createShareDraft(input: ShareDraftInput): PacketResult;
|
|
603
|
+
updateDraft(input: UpdateDraftInput): PacketResult;
|
|
604
|
+
approveAndSend(input: {
|
|
605
|
+
authToken: string;
|
|
606
|
+
packetId: string;
|
|
607
|
+
approvalToken?: string;
|
|
608
|
+
allowSecretOverride?: boolean;
|
|
609
|
+
}): PacketResult;
|
|
610
|
+
listInbox(input: {
|
|
611
|
+
authToken: string;
|
|
612
|
+
workspaceId: string;
|
|
613
|
+
}): RelayPacket[];
|
|
614
|
+
viewPacket(input: {
|
|
615
|
+
authToken: string;
|
|
616
|
+
packetId: string;
|
|
617
|
+
}): PacketResult;
|
|
618
|
+
getPacketForMember(input: {
|
|
619
|
+
authToken: string;
|
|
620
|
+
packetId: string;
|
|
621
|
+
}): PacketResult;
|
|
622
|
+
acceptPacket(input: {
|
|
623
|
+
authToken: string;
|
|
624
|
+
packetId: string;
|
|
625
|
+
}): PacketResult;
|
|
626
|
+
hydratePacket(input: {
|
|
627
|
+
authToken: string;
|
|
628
|
+
packetId: string;
|
|
629
|
+
client: string;
|
|
630
|
+
sessionId?: string;
|
|
631
|
+
approvalToken?: string;
|
|
632
|
+
}): ReturnType<typeof formatHydrationContext> & {
|
|
633
|
+
packet: RelayPacket;
|
|
634
|
+
};
|
|
635
|
+
createReplyDraft(input: ReplyDraftInput): PacketResult;
|
|
636
|
+
approveReply(input: {
|
|
637
|
+
authToken: string;
|
|
638
|
+
replyPacketId: string;
|
|
639
|
+
approvalToken?: string;
|
|
640
|
+
}): PacketResult;
|
|
641
|
+
declinePacket(input: {
|
|
642
|
+
authToken: string;
|
|
643
|
+
packetId: string;
|
|
644
|
+
reason?: string;
|
|
645
|
+
}): PacketResult;
|
|
646
|
+
archivePacket(input: {
|
|
647
|
+
authToken: string;
|
|
648
|
+
packetId: string;
|
|
649
|
+
}): PacketResult;
|
|
650
|
+
requestClarification(input: {
|
|
651
|
+
authToken: string;
|
|
652
|
+
packetId: string;
|
|
653
|
+
question: string;
|
|
654
|
+
requestedEvidence?: string[];
|
|
655
|
+
}): PacketResult;
|
|
656
|
+
closePacket(input: {
|
|
657
|
+
authToken: string;
|
|
658
|
+
packetId: string;
|
|
659
|
+
resolution: 'resolved' | 'unresolved';
|
|
660
|
+
}): PacketResult;
|
|
661
|
+
searchPackets(input: {
|
|
662
|
+
authToken: string;
|
|
663
|
+
workspaceId: string;
|
|
664
|
+
query?: string;
|
|
665
|
+
} & PacketQueryFilters): PacketSearchResult[];
|
|
666
|
+
listHistory(input: {
|
|
667
|
+
authToken: string;
|
|
668
|
+
workspaceId: string;
|
|
669
|
+
filter?: HistoryFilter;
|
|
670
|
+
query?: string;
|
|
671
|
+
} & PacketQueryFilters): PacketSearchResult[];
|
|
672
|
+
listAuditReceipts(input: {
|
|
673
|
+
authToken: string;
|
|
674
|
+
workspaceId: string;
|
|
675
|
+
packetId?: string;
|
|
676
|
+
}): AuditReceipt[];
|
|
677
|
+
getPacket(packetId: string): RelayPacket;
|
|
678
|
+
private createPacketDraft;
|
|
679
|
+
private preparePacket;
|
|
680
|
+
private authenticate;
|
|
681
|
+
private requireMember;
|
|
682
|
+
private requireAdmin;
|
|
683
|
+
private requireApprovalSecret;
|
|
684
|
+
private getWorkspace;
|
|
685
|
+
private getMember;
|
|
686
|
+
private findMemberByHandle;
|
|
687
|
+
private resolveRecipient;
|
|
688
|
+
private actorRole;
|
|
689
|
+
private canReadMetadata;
|
|
690
|
+
private canReadBody;
|
|
691
|
+
private requireReadable;
|
|
692
|
+
private searchHaystackFor;
|
|
693
|
+
private toSearchResult;
|
|
694
|
+
private auditFilterMetadata;
|
|
695
|
+
private matchesPacketQueryFilters;
|
|
696
|
+
private resolveCanonicalProjectName;
|
|
697
|
+
private memberSelectorMatches;
|
|
698
|
+
private matchesHistoryFilter;
|
|
699
|
+
private requireSender;
|
|
700
|
+
private requireRecipient;
|
|
701
|
+
private assertApprovalTokenAllowed;
|
|
702
|
+
private consumeApprovalToken;
|
|
703
|
+
private transitionPacket;
|
|
704
|
+
private insertPacket;
|
|
705
|
+
private updatePacket;
|
|
706
|
+
private listWorkspacePackets;
|
|
707
|
+
private createNotification;
|
|
708
|
+
private recordAudit;
|
|
709
|
+
private insertAuditReceipt;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
export { normalizeHandle as $, type ApprovalAction as A, type BuildPacketDraftInput as B, type ContextBudgetLimits as C, auditReceiptSchema as D, buildPacketDraft as E, claimSchema as F, compressPacketToBudget as G, type HistoryFilter as H, type InviteRecord as I, confidenceLevels as J, createAuditReceipt as K, createId as L, type MemberRecord as M, createRelayDatabase as N, createToken as O, type PacketStatus as P, defaultContextBudget as Q, RelayService as R, type ShareDraftInput as S, evidenceSchema as T, type UpdateDraftInput as U, formatHydrationContext as V, type WorkspaceRecord as W, hashToken as X, hydrationPolicySchema as Y, normalizeClaim as Z, normalizeEvidence as _, type PacketType as a, packetSchema as a0, packetStatuses as a1, packetTypes as a2, projectIdentitySchema as a3, redactionFindingSchema as a4, redactionReportSchema as a5, validateContextBudget as a6, type RelayPacket as b, type RedactionReport as c, type ApprovalTokenResult as d, type AskDraftInput as e, type AuditAction as f, type AuditReceipt as g, type ContextBudgetResult as h, type CreateReceiptInput as i, type CreateWorkspaceInput as j, type HydrationInput as k, type HydrationPolicy as l, type HydrationResult as m, type MemberRole as n, type MemberStatus as o, type PacketDraftOptions as p, type PacketQueryFilters as q, type PacketResult as r, type PacketSearchResult as s, type ProjectAliasRecord as t, type ProjectIdentity as u, type RedactionFinding as v, type RelayClaim as w, type RelayDatabase as x, type RelayEvidence as y, type ReplyDraftInput as z };
|