hivenet 0.4.1 → 0.6.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # hivenet
2
2
 
3
- The support channel for AI agents. When an agent (or human) hits friction in a product's
3
+ The support channel for AI agents. The same package provides both the `npx hivenet`
4
+ CLI and an embeddable library. When an agent (or human) hits friction in a product's
4
5
  CLI, docs, SDK, or MCP server, this submits a structured, context-rich report straight to
5
6
  the maintainers — harness + session auto-detected, threaded, offline-safe.
6
7
 
@@ -9,13 +10,83 @@ npx hivenet --to acme --category cli --subject "acme deploy" \
9
10
  "acme deploy --json prints a spinner to stdout, corrupting the JSON output"
10
11
  ```
11
12
 
13
+ ```sh
14
+ npm install hivenet
15
+ ```
16
+
17
+ ```ts
18
+ import { sendFeedback } from 'hivenet';
19
+
20
+ await sendFeedback({
21
+ feedback: 'acme deploy --json corrupts stdout',
22
+ to: 'acme',
23
+ category: 'cli',
24
+ subject: 'acme deploy --json',
25
+ });
26
+ ```
27
+
28
+ Failed a task after real effort? File it structured — these reports become the
29
+ project's eval suite, so word the task so a stranger could re-run it:
30
+
31
+ ```sh
32
+ npx hivenet --to acme --category cli --task "export 2k-row dataset as CSV" \
33
+ --expected "CSV with all rows" --actual "times out at 30s, no partial file" \
34
+ --attempts 3 "acme export cannot complete large exports"
35
+ ```
36
+
37
+ Attach screenshots, logs or recordings (up to 10 files, 20 MiB each). Each `--describe`
38
+ explains the file before it:
39
+
40
+ ```sh
41
+ npx hivenet --to acme --category ux \
42
+ --attach ./screen.png --describe "The checkout button is hidden at 390px width." \
43
+ --attach ./trace.log \
44
+ "The checkout button disappears on mobile"
45
+ ```
46
+
47
+ The SDK takes the same files as an array:
48
+
49
+ ```ts
50
+ import { sendFeedback } from 'hivenet';
51
+
52
+ await sendFeedback({
53
+ to: 'my-project',
54
+ feedback: 'Export reports success but downloads an empty file.',
55
+ attachments: [
56
+ { path: './screen.png', description: 'The success message after exporting 12 rows.' },
57
+ './network.log',
58
+ ],
59
+ });
60
+ ```
61
+
62
+ If files can't be uploaded (network, server busy, a server without file storage), the report
63
+ is still sent — or queued — without them, and the output names them so you can add them
64
+ later with `--resume <thread> --attach <path>`. A file the server rejects stops the send.
65
+ After a text-only report the CLI suggests that same command (`attach_hint` with `--json`),
66
+ since a screenshot or log often says more than the text.
67
+
68
+ Structured reports can come from one JSON object, with the same fields as the SDK:
69
+
70
+ ```sh
71
+ npx hivenet --input report.json --json # attachment paths are relative to report.json
72
+ cat report.json | npx hivenet --input - --json
73
+ ```
74
+
75
+ Invalid input exits 1 with the fields to fix (`--json`: `code`, `error`, `issues`, `hint`);
76
+ nothing is sent. Owners attach files to a record with `HIVENET_SECRET_KEY`:
77
+ `npx hivenet attach issue <id> --attach ./reproduction.webm`.
78
+
79
+ Responses may carry `guidance` (the team's reply to your thread) and `ask` — a
80
+ question from the team with a ready-to-run `--answer <id>` command. Answering is
81
+ optional and must be grounded in what you actually did; never guess.
82
+
12
83
  - Never prompts, never blocks; queues locally when offline (`--flush` retries).
13
84
  - `DO_NOT_TRACK=1` strips all auto-detected context; feedback still delivers anonymously.
14
85
  - `--json` machine output · `--dry-run` shows the exact event before anything is sent.
15
86
  - Destinations: `--to <slug|domain>`, `--dsn`, `HIVENET_DSN`, or feedback.config.json.
16
87
 
17
- Vendors: claim a slug and get paste-ready snippets at
18
- https://hivenet.app — or self-host with
19
- [@hivenet/server](https://www.npmjs.com/package/@hivenet/server).
88
+ Vendors: claim a slug and get paste-ready snippets at https://hivenet.app.
89
+ The reference self-hosted ingest implementation remains available in the
90
+ [Hivenet repository](https://github.com/zvadaadam/hivenet/tree/master/packages/server).
20
91
 
21
92
  Docs: https://github.com/zvadaadam/hivenet
@@ -0,0 +1,32 @@
1
+ import {
2
+ FeedbackError,
3
+ attachmentDescriptionSchema
4
+ } from "./chunk-DNR6HNJD.js";
5
+
6
+ // src/attachment-flags.ts
7
+ function attachmentFlags() {
8
+ const files = [];
9
+ return {
10
+ "--attach": (path) => {
11
+ files.push({ path });
12
+ return files;
13
+ },
14
+ "--describe": (value) => {
15
+ const file = files.at(-1);
16
+ if (!file) throw new FeedbackError("--describe must follow the --attach it describes.");
17
+ if (file.description !== void 0)
18
+ throw new FeedbackError("Use one --describe per attached file.");
19
+ const parsed = attachmentDescriptionSchema.safeParse(value);
20
+ if (!parsed.success)
21
+ throw new FeedbackError(
22
+ `Invalid --describe: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`
23
+ );
24
+ file.description = parsed.data;
25
+ return parsed.data;
26
+ }
27
+ };
28
+ }
29
+
30
+ export {
31
+ attachmentFlags
32
+ };