hivenet 0.4.0 → 0.4.2
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 +20 -4
- package/dist/{chunk-K4DIOYVH.js → chunk-WWPF6V2Y.js} +129 -102
- package/dist/cli.js +51 -7
- package/dist/doctor-CVWF7J3P.js +210 -0
- package/dist/index.cjs +16363 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +700 -0
- package/dist/index.d.ts +700 -0
- package/dist/index.js +16303 -0
- package/dist/index.js.map +1 -0
- package/dist/{owner-LAL5WKKW.js → owner-N2MSYLV7.js} +32 -10
- package/package.json +14 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,700 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Triage lifecycle of a single feedback event (owner plane). */
|
|
4
|
+
declare const EVENT_STATUSES: readonly ["new", "seen", "in_progress", "resolved", "wont_fix", "spam"];
|
|
5
|
+
type EventStatus = (typeof EVENT_STATUSES)[number];
|
|
6
|
+
/** Triage lifecycle of a clustered issue (owner plane). */
|
|
7
|
+
declare const ISSUE_STATUSES: readonly ["open", "in_progress", "resolved", "wont_fix", "spam"];
|
|
8
|
+
type IssueStatus = (typeof ISSUE_STATUSES)[number];
|
|
9
|
+
declare const sentimentSchema$1: z.ZodEnum<{
|
|
10
|
+
positive: "positive";
|
|
11
|
+
negative: "negative";
|
|
12
|
+
neutral: "neutral";
|
|
13
|
+
}>;
|
|
14
|
+
type Sentiment$1 = z.infer<typeof sentimentSchema$1>;
|
|
15
|
+
/** Who authored the feedback text (cf. Arize Phoenix `annotator_kind`). */
|
|
16
|
+
declare const authorSchema$1: z.ZodEnum<{
|
|
17
|
+
agent: "agent";
|
|
18
|
+
human: "human";
|
|
19
|
+
hybrid: "hybrid";
|
|
20
|
+
}>;
|
|
21
|
+
type FeedbackAuthor$1 = z.infer<typeof authorSchema$1>;
|
|
22
|
+
/**
|
|
23
|
+
* Structured failed-task report. `category: "eval"` events carry one of these so the
|
|
24
|
+
* feedback stream doubles as a replayable eval-candidate corpus.
|
|
25
|
+
*/
|
|
26
|
+
declare const evalReportSchema$1: z.ZodObject<{
|
|
27
|
+
task: z.ZodString;
|
|
28
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
29
|
+
actual: z.ZodOptional<z.ZodString>;
|
|
30
|
+
mistake: z.ZodOptional<z.ZodString>;
|
|
31
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
type EvalReport$1 = z.infer<typeof evalReportSchema$1>;
|
|
34
|
+
/**
|
|
35
|
+
* Auto-detected context. Every block is optional and best-effort: a missing block means
|
|
36
|
+
* "not detected or telemetry declined", never an error.
|
|
37
|
+
*/
|
|
38
|
+
declare const feedbackContextSchema$1: z.ZodObject<{
|
|
39
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
name: z.ZodOptional<z.ZodString>;
|
|
42
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
model: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>>;
|
|
45
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
name: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
ci: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
name: z.ZodNullable<z.ZodString>;
|
|
51
|
+
isPr: z.ZodNullable<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
platform: z.ZodString;
|
|
55
|
+
arch: z.ZodString;
|
|
56
|
+
node: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
project: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
59
|
+
session: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
60
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
id: z.ZodOptional<z.ZodString>;
|
|
62
|
+
authType: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
type FeedbackContext$1 = z.infer<typeof feedbackContextSchema$1>;
|
|
66
|
+
/**
|
|
67
|
+
* Vendor-defined enrichment (sdk_version, plan tier, build number). Flat by
|
|
68
|
+
* design — values stay renderable as chips and queryable via json_extract.
|
|
69
|
+
* Distinct from `context`, which is what the client auto-detects.
|
|
70
|
+
*/
|
|
71
|
+
declare const metadataSchema$1: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
72
|
+
type FeedbackMetadata$1 = z.infer<typeof metadataSchema$1>;
|
|
73
|
+
declare const feedbackEventSchema$1: z.ZodObject<{
|
|
74
|
+
v: z.ZodLiteral<1>;
|
|
75
|
+
to: z.ZodOptional<z.ZodString>;
|
|
76
|
+
feedback: z.ZodString;
|
|
77
|
+
category: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
|
|
78
|
+
tool: "tool";
|
|
79
|
+
skill: "skill";
|
|
80
|
+
prompt: "prompt";
|
|
81
|
+
docs: "docs";
|
|
82
|
+
mcp: "mcp";
|
|
83
|
+
cli: "cli";
|
|
84
|
+
api: "api";
|
|
85
|
+
model: "model";
|
|
86
|
+
eval: "eval";
|
|
87
|
+
ux: "ux";
|
|
88
|
+
other: "other";
|
|
89
|
+
}>, z.ZodString]>>;
|
|
90
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
91
|
+
sentiment: z.ZodOptional<z.ZodEnum<{
|
|
92
|
+
positive: "positive";
|
|
93
|
+
negative: "negative";
|
|
94
|
+
neutral: "neutral";
|
|
95
|
+
}>>;
|
|
96
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
97
|
+
agent: "agent";
|
|
98
|
+
human: "human";
|
|
99
|
+
hybrid: "hybrid";
|
|
100
|
+
}>>;
|
|
101
|
+
thread: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
}, z.core.$strip>;
|
|
104
|
+
eval: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
task: z.ZodString;
|
|
106
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
107
|
+
actual: z.ZodOptional<z.ZodString>;
|
|
108
|
+
mistake: z.ZodOptional<z.ZodString>;
|
|
109
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
112
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
id: z.ZodString;
|
|
114
|
+
name: z.ZodOptional<z.ZodString>;
|
|
115
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
116
|
+
model: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>>;
|
|
118
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
name: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
ci: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
name: z.ZodNullable<z.ZodString>;
|
|
124
|
+
isPr: z.ZodNullable<z.ZodBoolean>;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
platform: z.ZodString;
|
|
128
|
+
arch: z.ZodString;
|
|
129
|
+
node: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
project: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
132
|
+
session: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
133
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
id: z.ZodOptional<z.ZodString>;
|
|
135
|
+
authType: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
}, z.core.$strip>>;
|
|
138
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
139
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
140
|
+
client: z.ZodObject<{
|
|
141
|
+
name: z.ZodString;
|
|
142
|
+
version: z.ZodString;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
consent: z.ZodObject<{
|
|
145
|
+
telemetry: z.ZodBoolean;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
type FeedbackEvent$1 = z.infer<typeof feedbackEventSchema$1>;
|
|
149
|
+
/** 202 body returned by every conforming ingest endpoint. */
|
|
150
|
+
declare const ingestResponseSchema$1: z.ZodObject<{
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
thread: z.ZodString;
|
|
153
|
+
resume: z.ZodOptional<z.ZodString>;
|
|
154
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
155
|
+
duplicate: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
type IngestResponse$1 = z.infer<typeof ingestResponseSchema$1>;
|
|
158
|
+
/**
|
|
159
|
+
* Tenant descriptor. Served identically by the hosted registry
|
|
160
|
+
* (`{registry}/v1/registry/{slug}`) and by self-published well-known files
|
|
161
|
+
* (`https://{domain}/.well-known/agent-feedback.json`).
|
|
162
|
+
*/
|
|
163
|
+
declare const descriptorSchema$1: z.ZodObject<{
|
|
164
|
+
v: z.ZodLiteral<1>;
|
|
165
|
+
name: z.ZodString;
|
|
166
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
167
|
+
endpoint: z.ZodURL;
|
|
168
|
+
writeKey: z.ZodOptional<z.ZodString>;
|
|
169
|
+
categories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
170
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
171
|
+
description: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strip>>>;
|
|
173
|
+
jwks: z.ZodOptional<z.ZodURL>;
|
|
174
|
+
docs: z.ZodOptional<z.ZodURL>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
type Descriptor$1 = z.infer<typeof descriptorSchema$1>;
|
|
177
|
+
/**
|
|
178
|
+
* A codebase a project's feedback is about. Owner-plane wire contract: rides on
|
|
179
|
+
* every list/get response so a triage agent knows where to go fix things.
|
|
180
|
+
*/
|
|
181
|
+
declare const repoEntrySchema$1: z.ZodObject<{
|
|
182
|
+
url: z.ZodString;
|
|
183
|
+
label: z.ZodOptional<z.ZodString>;
|
|
184
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
type RepoEntry$1 = z.infer<typeof repoEntrySchema$1>;
|
|
187
|
+
|
|
188
|
+
declare const DSN_ENV_VAR = "HIVENET_DSN";
|
|
189
|
+
declare const REGISTRY_ENV_VAR = "HIVENET_REGISTRY";
|
|
190
|
+
declare const HOME_ENV_VAR = "HIVENET_HOME";
|
|
191
|
+
declare const NO_TELEMETRY_ENV_VAR = "HIVENET_NO_TELEMETRY";
|
|
192
|
+
/** Minimal environment contract accepted by Node, Bun, Deno, and edge adapters. */
|
|
193
|
+
type EnvLike = Record<string, string | undefined>;
|
|
194
|
+
declare function feedbackHomeDir(env?: EnvLike): string;
|
|
195
|
+
declare function isTelemetryDisabled(extraOptOutEnvVars?: string[], env?: EnvLike): boolean;
|
|
196
|
+
|
|
197
|
+
/** A vendor-configured source for a product session ID. */
|
|
198
|
+
type SessionSource = {
|
|
199
|
+
key: string;
|
|
200
|
+
envVar: string;
|
|
201
|
+
} | {
|
|
202
|
+
key: string;
|
|
203
|
+
dotenvFile: string;
|
|
204
|
+
dotenvKey?: string;
|
|
205
|
+
};
|
|
206
|
+
type CollectContextOptions = {
|
|
207
|
+
projectRoot?: string;
|
|
208
|
+
sessions?: SessionSource[];
|
|
209
|
+
/** Vendor product fingerprint (versions, config). Never allowed to throw the pipeline. */
|
|
210
|
+
fingerprint?: () => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
|
|
211
|
+
extraOptOutEnvVars?: string[];
|
|
212
|
+
env?: EnvLike;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Assemble best-effort context. Returns undefined when telemetry is disabled.
|
|
216
|
+
* Never throws; every block is optional.
|
|
217
|
+
*/
|
|
218
|
+
declare function collectContext(options?: CollectContextOptions): Promise<FeedbackContext$1 | undefined>;
|
|
219
|
+
/** `agent` when an agent harness is detected, otherwise unknown (omitted). */
|
|
220
|
+
declare function inferAuthor(context: FeedbackContext$1 | undefined): 'agent' | undefined;
|
|
221
|
+
|
|
222
|
+
type Destination = {
|
|
223
|
+
endpoint: string;
|
|
224
|
+
writeKey?: string;
|
|
225
|
+
/** Tenant slug or domain, when known. */
|
|
226
|
+
to?: string;
|
|
227
|
+
descriptor?: Descriptor$1;
|
|
228
|
+
};
|
|
229
|
+
/** Shape of feedback.config.json — a local descriptor plus client-side settings. */
|
|
230
|
+
type FeedbackConfig = {
|
|
231
|
+
name?: string;
|
|
232
|
+
slug?: string;
|
|
233
|
+
endpoint?: string;
|
|
234
|
+
writeKey?: string;
|
|
235
|
+
categories?: Descriptor$1['categories'];
|
|
236
|
+
sessions?: SessionSource[];
|
|
237
|
+
telemetryOptOutEnv?: string[];
|
|
238
|
+
};
|
|
239
|
+
declare const CONFIG_FILE_NAME = "feedback.config.json";
|
|
240
|
+
type FetchLike = typeof fetch;
|
|
241
|
+
type ResolveDestinationOptions = {
|
|
242
|
+
to?: string;
|
|
243
|
+
dsn?: string;
|
|
244
|
+
cwd?: string;
|
|
245
|
+
env?: EnvLike;
|
|
246
|
+
fetchImpl?: FetchLike;
|
|
247
|
+
/** Directory for the descriptor cache; defaults to the hivenet home dir. */
|
|
248
|
+
cacheDir?: string;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Parse a DSN: `https://hv_pub_KEY@host[/slug]`.
|
|
252
|
+
* One string carries endpoint + tenant + write key (the Sentry move).
|
|
253
|
+
*/
|
|
254
|
+
declare function parseDsn(dsn: string): Destination;
|
|
255
|
+
/** Walk up from `startDir` looking for feedback.config.json. */
|
|
256
|
+
declare function findConfigFile(startDir: string): {
|
|
257
|
+
config: FeedbackConfig;
|
|
258
|
+
path: string;
|
|
259
|
+
} | undefined;
|
|
260
|
+
declare function registryUrl(env?: EnvLike): string;
|
|
261
|
+
/**
|
|
262
|
+
* Resolve where feedback goes. Priority:
|
|
263
|
+
* explicit DSN → HIVENET_DSN → nearest feedback.config.json →
|
|
264
|
+
* --to slug (hosted registry) / --to domain (.well-known).
|
|
265
|
+
*/
|
|
266
|
+
declare function resolveDestination(options?: ResolveDestinationOptions): Promise<Destination>;
|
|
267
|
+
|
|
268
|
+
/** Configuration or validation error — the caller can fix it. Network failures are not
|
|
269
|
+
* FeedbackErrors; they degrade to the outbox instead of throwing. */
|
|
270
|
+
declare class FeedbackError extends Error {
|
|
271
|
+
constructor(message: string);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
type OutboxEntry = {
|
|
275
|
+
endpoint: string;
|
|
276
|
+
writeKey?: string;
|
|
277
|
+
event: FeedbackEvent$1;
|
|
278
|
+
queuedAt: string;
|
|
279
|
+
};
|
|
280
|
+
declare function outboxPath(env?: EnvLike): string;
|
|
281
|
+
/** Queue an event that could not be delivered. Never throws — losing feedback is
|
|
282
|
+
* acceptable, breaking the host process is not. */
|
|
283
|
+
declare function appendToOutbox(entry: OutboxEntry, env?: EnvLike): boolean;
|
|
284
|
+
type FlushResult = {
|
|
285
|
+
delivered: number;
|
|
286
|
+
remaining: number;
|
|
287
|
+
};
|
|
288
|
+
/** Best-effort redelivery of queued events. Short timeout, never throws. */
|
|
289
|
+
declare function flushOutbox(options?: {
|
|
290
|
+
env?: EnvLike;
|
|
291
|
+
fetchImpl?: typeof fetch;
|
|
292
|
+
timeoutMs?: number;
|
|
293
|
+
}): Promise<FlushResult>;
|
|
294
|
+
|
|
295
|
+
type OwnerIssue = {
|
|
296
|
+
id: string;
|
|
297
|
+
title: string;
|
|
298
|
+
summary: string | null;
|
|
299
|
+
status: IssueStatus;
|
|
300
|
+
fingerprint: string | null;
|
|
301
|
+
event_count: number;
|
|
302
|
+
reopened_count: number;
|
|
303
|
+
first_seen: string;
|
|
304
|
+
last_seen: string;
|
|
305
|
+
links_json: string;
|
|
306
|
+
};
|
|
307
|
+
type OwnerEvent = {
|
|
308
|
+
id: string;
|
|
309
|
+
received_at: string;
|
|
310
|
+
status: EventStatus;
|
|
311
|
+
category: string;
|
|
312
|
+
subject: string | null;
|
|
313
|
+
sentiment: string | null;
|
|
314
|
+
author: string | null;
|
|
315
|
+
feedback: string;
|
|
316
|
+
agent_id: string | null;
|
|
317
|
+
agent_session: string | null;
|
|
318
|
+
thread_id: string;
|
|
319
|
+
consent_telemetry: number;
|
|
320
|
+
triage_note: string | null;
|
|
321
|
+
triaged_at: string | null;
|
|
322
|
+
issue_id: string | null;
|
|
323
|
+
links_json: string;
|
|
324
|
+
context_json: string;
|
|
325
|
+
metadata_json: string;
|
|
326
|
+
idempotency_key: string | null;
|
|
327
|
+
};
|
|
328
|
+
type OwnerFilters = {
|
|
329
|
+
status?: EventStatus;
|
|
330
|
+
category?: string;
|
|
331
|
+
thread?: string;
|
|
332
|
+
/** ISO timestamp — only events received at or after this moment ("what's new since my last run"). */
|
|
333
|
+
since?: string;
|
|
334
|
+
limit?: number;
|
|
335
|
+
};
|
|
336
|
+
type OwnerApiOptions = {
|
|
337
|
+
secretKey: string;
|
|
338
|
+
/** API origin, e.g. https://hivenet.app. */
|
|
339
|
+
apiOrigin?: string;
|
|
340
|
+
fetchImpl?: typeof fetch;
|
|
341
|
+
timeoutMs?: number;
|
|
342
|
+
};
|
|
343
|
+
/** Derive the owner API origin from a slug/domain/DSN (same host as the ingest endpoint). */
|
|
344
|
+
declare function resolveApiOrigin(options: {
|
|
345
|
+
to?: string;
|
|
346
|
+
dsn?: string;
|
|
347
|
+
env?: EnvLike;
|
|
348
|
+
fetchImpl?: typeof fetch;
|
|
349
|
+
}): Promise<string>;
|
|
350
|
+
declare function ownerApi(options: OwnerApiOptions): {
|
|
351
|
+
listFeedback(filters?: OwnerFilters): Promise<{
|
|
352
|
+
project: string;
|
|
353
|
+
repos: RepoEntry$1[];
|
|
354
|
+
events: OwnerEvent[];
|
|
355
|
+
}>;
|
|
356
|
+
getFeedback(id: string): Promise<{
|
|
357
|
+
event: OwnerEvent;
|
|
358
|
+
}>;
|
|
359
|
+
setFeedbackStatus(id: string, status: EventStatus, note?: string): Promise<{
|
|
360
|
+
event: OwnerEvent;
|
|
361
|
+
}>;
|
|
362
|
+
listIssues(filters?: {
|
|
363
|
+
status?: IssueStatus;
|
|
364
|
+
since?: string;
|
|
365
|
+
limit?: number;
|
|
366
|
+
}): Promise<{
|
|
367
|
+
project: string;
|
|
368
|
+
repos: RepoEntry$1[];
|
|
369
|
+
issues: OwnerIssue[];
|
|
370
|
+
}>;
|
|
371
|
+
getIssue(id: string): Promise<{
|
|
372
|
+
issue: OwnerIssue;
|
|
373
|
+
repos: RepoEntry$1[];
|
|
374
|
+
events: OwnerEvent[];
|
|
375
|
+
}>;
|
|
376
|
+
setIssueStatus(id: string, status: IssueStatus, note?: string): Promise<{
|
|
377
|
+
issue: OwnerIssue;
|
|
378
|
+
}>;
|
|
379
|
+
/** Attach an external link (Slack message, Linear/GitHub issue, PR) to evt_… or iss_…. */
|
|
380
|
+
addLink(id: string, url: string, label?: string): Promise<{
|
|
381
|
+
event?: OwnerEvent;
|
|
382
|
+
issue?: OwnerIssue;
|
|
383
|
+
}>;
|
|
384
|
+
};
|
|
385
|
+
type OwnerApi = ReturnType<typeof ownerApi>;
|
|
386
|
+
|
|
387
|
+
declare function generateThreadId(): string;
|
|
388
|
+
/** A valid resume ID continues its thread; anything else gets a fresh one. */
|
|
389
|
+
declare function resolveThreadId(resume?: string): {
|
|
390
|
+
id: string;
|
|
391
|
+
resumed: boolean;
|
|
392
|
+
};
|
|
393
|
+
type SendFeedbackOptions = {
|
|
394
|
+
feedback: string;
|
|
395
|
+
to?: string;
|
|
396
|
+
dsn?: string;
|
|
397
|
+
category?: string;
|
|
398
|
+
subject?: string;
|
|
399
|
+
sentiment?: Sentiment$1;
|
|
400
|
+
author?: FeedbackAuthor$1;
|
|
401
|
+
eval?: EvalReport$1;
|
|
402
|
+
/** Resume an existing feedback thread by ID. */
|
|
403
|
+
resume?: string;
|
|
404
|
+
/** Extra product session IDs, merged over detected ones. */
|
|
405
|
+
session?: Record<string, string>;
|
|
406
|
+
/** Vendor product fingerprint, merged into context.project. */
|
|
407
|
+
project?: Record<string, unknown>;
|
|
408
|
+
/** Vendor-defined enrichment (sdk_version, plan, build) — flat map, see spec metadataSchema. */
|
|
409
|
+
metadata?: FeedbackMetadata$1;
|
|
410
|
+
/** Override the auto-minted retry key (same key + project = same stored event). */
|
|
411
|
+
idempotencyKey?: string;
|
|
412
|
+
cwd?: string;
|
|
413
|
+
timeoutMs?: number;
|
|
414
|
+
/** Identify the embedding client (e.g. a vendor CLI) instead of the generic one. */
|
|
415
|
+
clientName?: string;
|
|
416
|
+
clientVersion?: string;
|
|
417
|
+
/** Set false to skip all context detection regardless of consent env vars. */
|
|
418
|
+
collectContext?: boolean;
|
|
419
|
+
/** Set false to fail without queueing when the endpoint is unreachable. */
|
|
420
|
+
outbox?: boolean;
|
|
421
|
+
contextOptions?: CollectContextOptions;
|
|
422
|
+
fetchImpl?: typeof fetch;
|
|
423
|
+
env?: EnvLike;
|
|
424
|
+
};
|
|
425
|
+
type SendFeedbackResult = {
|
|
426
|
+
delivered: true;
|
|
427
|
+
response: IngestResponse$1;
|
|
428
|
+
event: FeedbackEvent$1;
|
|
429
|
+
destination: Destination;
|
|
430
|
+
resumed: boolean;
|
|
431
|
+
} | {
|
|
432
|
+
delivered: false;
|
|
433
|
+
queued: boolean;
|
|
434
|
+
error: string;
|
|
435
|
+
event: FeedbackEvent$1;
|
|
436
|
+
destination: Destination;
|
|
437
|
+
resumed: boolean;
|
|
438
|
+
};
|
|
439
|
+
/**
|
|
440
|
+
* Build, enrich, validate, and deliver one feedback event.
|
|
441
|
+
*
|
|
442
|
+
* Throws FeedbackError only for caller-fixable problems (no destination, invalid
|
|
443
|
+
* input). Network failures never throw: the event is queued to the outbox and
|
|
444
|
+
* `{ delivered: false, queued: true }` is returned.
|
|
445
|
+
*/
|
|
446
|
+
declare function sendFeedback(options: SendFeedbackOptions): Promise<SendFeedbackResult>;
|
|
447
|
+
|
|
448
|
+
type PostEventOptions = {
|
|
449
|
+
endpoint: string;
|
|
450
|
+
writeKey?: string;
|
|
451
|
+
event: FeedbackEvent$1;
|
|
452
|
+
timeoutMs: number;
|
|
453
|
+
fetchImpl?: typeof fetch;
|
|
454
|
+
};
|
|
455
|
+
type PostEventResult = {
|
|
456
|
+
kind: 'accepted';
|
|
457
|
+
response: IngestResponse$1;
|
|
458
|
+
} | {
|
|
459
|
+
kind: 'rejected';
|
|
460
|
+
status: number;
|
|
461
|
+
errors: string[];
|
|
462
|
+
} | {
|
|
463
|
+
kind: 'unreachable';
|
|
464
|
+
error: string;
|
|
465
|
+
};
|
|
466
|
+
/** One POST, bounded by timeout. 4xx = rejected (do not retry); network/5xx = unreachable
|
|
467
|
+
* (outbox-eligible). */
|
|
468
|
+
declare function postEvent(options: PostEventOptions): Promise<PostEventResult>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* hivenet protocol v1.
|
|
472
|
+
*
|
|
473
|
+
* Everything here is the wire contract shared by the CLI, embeddable SDK, MCP tool,
|
|
474
|
+
* and any ingest endpoint (hosted or self-hosted). See SPEC.md for prose.
|
|
475
|
+
*/
|
|
476
|
+
declare const PROTOCOL_VERSION: 1;
|
|
477
|
+
declare const MAX_FEEDBACK_LENGTH = 5000;
|
|
478
|
+
declare const MAX_SUBJECT_LENGTH = 500;
|
|
479
|
+
declare const MAX_GUIDANCE_LENGTH = 1000;
|
|
480
|
+
declare const WELL_KNOWN_PATH = "/.well-known/agent-feedback.json";
|
|
481
|
+
declare const DEFAULT_REGISTRY_URL = "https://hivenet.app";
|
|
482
|
+
declare const DEFAULT_INGEST_PATH = "/v1/feedback";
|
|
483
|
+
declare const WRITE_KEY_HEADER = "x-af-write-key";
|
|
484
|
+
declare const WRITE_KEY_PATTERN: RegExp;
|
|
485
|
+
declare const THREAD_ID_PATTERN: RegExp;
|
|
486
|
+
/** Component kinds of any agentic system's agent-facing surface area. */
|
|
487
|
+
declare const FEEDBACK_CATEGORIES: readonly ["tool", "skill", "prompt", "docs", "mcp", "cli", "api", "model", "eval", "ux", "other"];
|
|
488
|
+
type FeedbackCategory = (typeof FEEDBACK_CATEGORIES)[number];
|
|
489
|
+
declare const categorySchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
490
|
+
tool: "tool";
|
|
491
|
+
skill: "skill";
|
|
492
|
+
prompt: "prompt";
|
|
493
|
+
docs: "docs";
|
|
494
|
+
mcp: "mcp";
|
|
495
|
+
cli: "cli";
|
|
496
|
+
api: "api";
|
|
497
|
+
model: "model";
|
|
498
|
+
eval: "eval";
|
|
499
|
+
ux: "ux";
|
|
500
|
+
other: "other";
|
|
501
|
+
}>, z.ZodString]>;
|
|
502
|
+
declare const sentimentSchema: z.ZodEnum<{
|
|
503
|
+
positive: "positive";
|
|
504
|
+
negative: "negative";
|
|
505
|
+
neutral: "neutral";
|
|
506
|
+
}>;
|
|
507
|
+
type Sentiment = z.infer<typeof sentimentSchema>;
|
|
508
|
+
/** Who authored the feedback text (cf. Arize Phoenix `annotator_kind`). */
|
|
509
|
+
declare const authorSchema: z.ZodEnum<{
|
|
510
|
+
agent: "agent";
|
|
511
|
+
human: "human";
|
|
512
|
+
hybrid: "hybrid";
|
|
513
|
+
}>;
|
|
514
|
+
type FeedbackAuthor = z.infer<typeof authorSchema>;
|
|
515
|
+
/**
|
|
516
|
+
* Structured failed-task report. `category: "eval"` events carry one of these so the
|
|
517
|
+
* feedback stream doubles as a replayable eval-candidate corpus.
|
|
518
|
+
*/
|
|
519
|
+
declare const evalReportSchema: z.ZodObject<{
|
|
520
|
+
task: z.ZodString;
|
|
521
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
522
|
+
actual: z.ZodOptional<z.ZodString>;
|
|
523
|
+
mistake: z.ZodOptional<z.ZodString>;
|
|
524
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
525
|
+
}, z.core.$strip>;
|
|
526
|
+
type EvalReport = z.infer<typeof evalReportSchema>;
|
|
527
|
+
/**
|
|
528
|
+
* Auto-detected context. Every block is optional and best-effort: a missing block means
|
|
529
|
+
* "not detected or telemetry declined", never an error.
|
|
530
|
+
*/
|
|
531
|
+
declare const feedbackContextSchema: z.ZodObject<{
|
|
532
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
533
|
+
id: z.ZodString;
|
|
534
|
+
name: z.ZodOptional<z.ZodString>;
|
|
535
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
536
|
+
model: z.ZodOptional<z.ZodString>;
|
|
537
|
+
}, z.core.$strip>>;
|
|
538
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
539
|
+
id: z.ZodString;
|
|
540
|
+
name: z.ZodOptional<z.ZodString>;
|
|
541
|
+
}, z.core.$strip>>;
|
|
542
|
+
ci: z.ZodOptional<z.ZodObject<{
|
|
543
|
+
name: z.ZodNullable<z.ZodString>;
|
|
544
|
+
isPr: z.ZodNullable<z.ZodBoolean>;
|
|
545
|
+
}, z.core.$strip>>;
|
|
546
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
547
|
+
platform: z.ZodString;
|
|
548
|
+
arch: z.ZodString;
|
|
549
|
+
node: z.ZodOptional<z.ZodString>;
|
|
550
|
+
}, z.core.$strip>>;
|
|
551
|
+
project: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
552
|
+
session: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
553
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
554
|
+
id: z.ZodOptional<z.ZodString>;
|
|
555
|
+
authType: z.ZodOptional<z.ZodString>;
|
|
556
|
+
}, z.core.$strip>>;
|
|
557
|
+
}, z.core.$strip>;
|
|
558
|
+
type FeedbackContext = z.infer<typeof feedbackContextSchema>;
|
|
559
|
+
/**
|
|
560
|
+
* Vendor-defined enrichment (sdk_version, plan tier, build number). Flat by
|
|
561
|
+
* design — values stay renderable as chips and queryable via json_extract.
|
|
562
|
+
* Distinct from `context`, which is what the client auto-detects.
|
|
563
|
+
*/
|
|
564
|
+
declare const metadataSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
565
|
+
type FeedbackMetadata = z.infer<typeof metadataSchema>;
|
|
566
|
+
declare const feedbackEventSchema: z.ZodObject<{
|
|
567
|
+
v: z.ZodLiteral<1>;
|
|
568
|
+
to: z.ZodOptional<z.ZodString>;
|
|
569
|
+
feedback: z.ZodString;
|
|
570
|
+
category: z.ZodDefault<z.ZodUnion<readonly [z.ZodEnum<{
|
|
571
|
+
tool: "tool";
|
|
572
|
+
skill: "skill";
|
|
573
|
+
prompt: "prompt";
|
|
574
|
+
docs: "docs";
|
|
575
|
+
mcp: "mcp";
|
|
576
|
+
cli: "cli";
|
|
577
|
+
api: "api";
|
|
578
|
+
model: "model";
|
|
579
|
+
eval: "eval";
|
|
580
|
+
ux: "ux";
|
|
581
|
+
other: "other";
|
|
582
|
+
}>, z.ZodString]>>;
|
|
583
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
584
|
+
sentiment: z.ZodOptional<z.ZodEnum<{
|
|
585
|
+
positive: "positive";
|
|
586
|
+
negative: "negative";
|
|
587
|
+
neutral: "neutral";
|
|
588
|
+
}>>;
|
|
589
|
+
author: z.ZodOptional<z.ZodEnum<{
|
|
590
|
+
agent: "agent";
|
|
591
|
+
human: "human";
|
|
592
|
+
hybrid: "hybrid";
|
|
593
|
+
}>>;
|
|
594
|
+
thread: z.ZodObject<{
|
|
595
|
+
id: z.ZodString;
|
|
596
|
+
}, z.core.$strip>;
|
|
597
|
+
eval: z.ZodOptional<z.ZodObject<{
|
|
598
|
+
task: z.ZodString;
|
|
599
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
600
|
+
actual: z.ZodOptional<z.ZodString>;
|
|
601
|
+
mistake: z.ZodOptional<z.ZodString>;
|
|
602
|
+
attempts: z.ZodOptional<z.ZodNumber>;
|
|
603
|
+
}, z.core.$strip>>;
|
|
604
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
605
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
606
|
+
id: z.ZodString;
|
|
607
|
+
name: z.ZodOptional<z.ZodString>;
|
|
608
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
609
|
+
model: z.ZodOptional<z.ZodString>;
|
|
610
|
+
}, z.core.$strip>>;
|
|
611
|
+
sandbox: z.ZodOptional<z.ZodObject<{
|
|
612
|
+
id: z.ZodString;
|
|
613
|
+
name: z.ZodOptional<z.ZodString>;
|
|
614
|
+
}, z.core.$strip>>;
|
|
615
|
+
ci: z.ZodOptional<z.ZodObject<{
|
|
616
|
+
name: z.ZodNullable<z.ZodString>;
|
|
617
|
+
isPr: z.ZodNullable<z.ZodBoolean>;
|
|
618
|
+
}, z.core.$strip>>;
|
|
619
|
+
runtime: z.ZodOptional<z.ZodObject<{
|
|
620
|
+
platform: z.ZodString;
|
|
621
|
+
arch: z.ZodString;
|
|
622
|
+
node: z.ZodOptional<z.ZodString>;
|
|
623
|
+
}, z.core.$strip>>;
|
|
624
|
+
project: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
625
|
+
session: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
626
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
627
|
+
id: z.ZodOptional<z.ZodString>;
|
|
628
|
+
authType: z.ZodOptional<z.ZodString>;
|
|
629
|
+
}, z.core.$strip>>;
|
|
630
|
+
}, z.core.$strip>>;
|
|
631
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
632
|
+
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
633
|
+
client: z.ZodObject<{
|
|
634
|
+
name: z.ZodString;
|
|
635
|
+
version: z.ZodString;
|
|
636
|
+
}, z.core.$strip>;
|
|
637
|
+
consent: z.ZodObject<{
|
|
638
|
+
telemetry: z.ZodBoolean;
|
|
639
|
+
}, z.core.$strip>;
|
|
640
|
+
}, z.core.$strip>;
|
|
641
|
+
type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
|
|
642
|
+
type FeedbackEventInput = z.input<typeof feedbackEventSchema>;
|
|
643
|
+
/** 202 body returned by every conforming ingest endpoint. */
|
|
644
|
+
declare const ingestResponseSchema: z.ZodObject<{
|
|
645
|
+
id: z.ZodString;
|
|
646
|
+
thread: z.ZodString;
|
|
647
|
+
resume: z.ZodOptional<z.ZodString>;
|
|
648
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
649
|
+
duplicate: z.ZodOptional<z.ZodBoolean>;
|
|
650
|
+
}, z.core.$strip>;
|
|
651
|
+
type IngestResponse = z.infer<typeof ingestResponseSchema>;
|
|
652
|
+
/**
|
|
653
|
+
* Tenant descriptor. Served identically by the hosted registry
|
|
654
|
+
* (`{registry}/v1/registry/{slug}`) and by self-published well-known files
|
|
655
|
+
* (`https://{domain}/.well-known/agent-feedback.json`).
|
|
656
|
+
*/
|
|
657
|
+
declare const descriptorSchema: z.ZodObject<{
|
|
658
|
+
v: z.ZodLiteral<1>;
|
|
659
|
+
name: z.ZodString;
|
|
660
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
661
|
+
endpoint: z.ZodURL;
|
|
662
|
+
writeKey: z.ZodOptional<z.ZodString>;
|
|
663
|
+
categories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
664
|
+
subject: z.ZodOptional<z.ZodString>;
|
|
665
|
+
description: z.ZodOptional<z.ZodString>;
|
|
666
|
+
}, z.core.$strip>>>;
|
|
667
|
+
jwks: z.ZodOptional<z.ZodURL>;
|
|
668
|
+
docs: z.ZodOptional<z.ZodURL>;
|
|
669
|
+
}, z.core.$strip>;
|
|
670
|
+
type Descriptor = z.infer<typeof descriptorSchema>;
|
|
671
|
+
/**
|
|
672
|
+
* A codebase a project's feedback is about. Owner-plane wire contract: rides on
|
|
673
|
+
* every list/get response so a triage agent knows where to go fix things.
|
|
674
|
+
*/
|
|
675
|
+
declare const repoEntrySchema: z.ZodObject<{
|
|
676
|
+
url: z.ZodString;
|
|
677
|
+
label: z.ZodOptional<z.ZodString>;
|
|
678
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
679
|
+
}, z.core.$strip>;
|
|
680
|
+
type RepoEntry = z.infer<typeof repoEntrySchema>;
|
|
681
|
+
declare const repoListSchema: z.ZodArray<z.ZodObject<{
|
|
682
|
+
url: z.ZodString;
|
|
683
|
+
label: z.ZodOptional<z.ZodString>;
|
|
684
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
685
|
+
}, z.core.$strip>>;
|
|
686
|
+
type ValidationResult<T> = {
|
|
687
|
+
ok: true;
|
|
688
|
+
data: T;
|
|
689
|
+
} | {
|
|
690
|
+
ok: false;
|
|
691
|
+
errors: string[];
|
|
692
|
+
};
|
|
693
|
+
declare function validateFeedbackEvent(input: unknown): ValidationResult<FeedbackEvent>;
|
|
694
|
+
declare function validateDescriptor(input: unknown): ValidationResult<Descriptor>;
|
|
695
|
+
declare function validateIngestResponse(input: unknown): ValidationResult<IngestResponse>;
|
|
696
|
+
/** JSON Schema exports for non-TypeScript implementers. */
|
|
697
|
+
declare function feedbackEventJsonSchema(): Record<string, unknown>;
|
|
698
|
+
declare function descriptorJsonSchema(): Record<string, unknown>;
|
|
699
|
+
|
|
700
|
+
export { CONFIG_FILE_NAME, type CollectContextOptions, DEFAULT_INGEST_PATH, DEFAULT_REGISTRY_URL, DSN_ENV_VAR, type Descriptor, type Destination, EVENT_STATUSES, type EnvLike, type EvalReport, type EventStatus, FEEDBACK_CATEGORIES, type FeedbackAuthor, type FeedbackCategory, type FeedbackConfig, type FeedbackContext, FeedbackError, type FeedbackEvent, type FeedbackEventInput, type FeedbackMetadata, type FlushResult, HOME_ENV_VAR, ISSUE_STATUSES, type IngestResponse, type IssueStatus, MAX_FEEDBACK_LENGTH, MAX_GUIDANCE_LENGTH, MAX_SUBJECT_LENGTH, NO_TELEMETRY_ENV_VAR, type OutboxEntry, type OwnerApi, type OwnerApiOptions, type OwnerEvent, type OwnerFilters, type OwnerIssue, PROTOCOL_VERSION, type PostEventOptions, type PostEventResult, REGISTRY_ENV_VAR, type RepoEntry, type ResolveDestinationOptions, type SendFeedbackOptions, type SendFeedbackResult, type Sentiment, type SessionSource, THREAD_ID_PATTERN, type ValidationResult, WELL_KNOWN_PATH, WRITE_KEY_HEADER, WRITE_KEY_PATTERN, appendToOutbox, authorSchema, categorySchema, collectContext, descriptorJsonSchema, descriptorSchema, evalReportSchema, feedbackContextSchema, feedbackEventJsonSchema, feedbackEventSchema, feedbackHomeDir, findConfigFile, flushOutbox, generateThreadId, inferAuthor, ingestResponseSchema, isTelemetryDisabled, metadataSchema, outboxPath, ownerApi, parseDsn, postEvent, registryUrl, repoEntrySchema, repoListSchema, resolveApiOrigin, resolveDestination, resolveThreadId, sendFeedback, sentimentSchema, validateDescriptor, validateFeedbackEvent, validateIngestResponse };
|