critiqs-react 0.3.0 → 0.5.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.
Files changed (58) hide show
  1. package/AGENT_SETUP.md +198 -66
  2. package/README.md +214 -31
  3. package/bin/critiqs.mjs +3 -1
  4. package/dist/index.js +16877 -4770
  5. package/dist/server/index.d.ts +1 -87
  6. package/dist/server/index.js +1 -4889
  7. package/package.json +6 -5
  8. package/bin/cli.d.mts +0 -21
  9. package/bin/cli.mjs +0 -293
  10. package/bin/env.d.mts +0 -41
  11. package/bin/env.mjs +0 -384
  12. package/bin/init.d.mts +0 -126
  13. package/bin/init.mjs +0 -965
  14. package/bin/mcp.d.mts +0 -20
  15. package/bin/mcp.mjs +0 -314
  16. package/bin/setup.d.mts +0 -183
  17. package/bin/setup.mjs +0 -1054
  18. package/dist/backend/convex/_generated/api.d.ts +0 -95
  19. package/dist/backend/convex/_generated/api.js +0 -23
  20. package/dist/backend/convex/_generated/dataModel.d.ts +0 -60
  21. package/dist/backend/convex/_generated/server.d.ts +0 -162
  22. package/dist/backend/convex/_generated/server.js +0 -101
  23. package/dist/backend/convex/ai.ts +0 -93
  24. package/dist/backend/convex/aiSettings.ts +0 -43
  25. package/dist/backend/convex/auth.config.ts +0 -18
  26. package/dist/backend/convex/captureHttp.ts +0 -96
  27. package/dist/backend/convex/captures.ts +0 -167
  28. package/dist/backend/convex/crons.ts +0 -14
  29. package/dist/backend/convex/deviceSignIn.ts +0 -151
  30. package/dist/backend/convex/grouping.ts +0 -41
  31. package/dist/backend/convex/http.ts +0 -724
  32. package/dist/backend/convex/lib/ai.ts +0 -6
  33. package/dist/backend/convex/lib/links.ts +0 -12
  34. package/dist/backend/convex/lib/pages.ts +0 -207
  35. package/dist/backend/convex/lib/r2.ts +0 -75
  36. package/dist/backend/convex/lib/store.ts +0 -509
  37. package/dist/backend/convex/lib/tokens.ts +0 -101
  38. package/dist/backend/convex/lib/validators.ts +0 -73
  39. package/dist/backend/convex/lib/vendor/aws4fetch.js +0 -289
  40. package/dist/backend/convex/lib/vendor/critiqs_ai.js +0 -49081
  41. package/dist/backend/convex/lib/vendor/critiqs_core.js +0 -385
  42. package/dist/backend/convex/lib/vendor/critiqs_server.js +0 -3108
  43. package/dist/backend/convex/notificationEmails.ts +0 -61
  44. package/dist/backend/convex/notifications.ts +0 -182
  45. package/dist/backend/convex/plans.ts +0 -67
  46. package/dist/backend/convex/projects.ts +0 -46
  47. package/dist/backend/convex/schema.ts +0 -343
  48. package/dist/backend/convex/search.ts +0 -26
  49. package/dist/backend/convex/signIn.ts +0 -368
  50. package/dist/backend/convex/tags.ts +0 -68
  51. package/dist/backend/convex/threads.ts +0 -146
  52. package/dist/backend/convex/users.ts +0 -13
  53. package/dist/server/chunks/driver-n9zpr0k3.js +0 -21
  54. package/dist/server/chunks/index-9bg7tmnq.js +0 -522
  55. package/dist/server/chunks/index-askcfn7t.js +0 -148
  56. package/dist/server/chunks/providers-rv184xvj.js +0 -48444
  57. package/dist/server/chunks/token-kzddms7r.js +0 -63
  58. package/dist/server/chunks/token-util-k8bee1wc.js +0 -4
@@ -1,87 +1 @@
1
- // Public types for `critiqs-react/server`: Critiqs's server inside the host
2
- // app's own Node or Bun server, storing feedback in a SQLite file.
3
- // Built-in SQLite requires Node.js 22.13 or later, or Bun; the setup CLI also supports Node.js 20.
4
-
5
- /** Someone the host app has already signed in. */
6
- export interface HostUser {
7
- /** The host app's permanent ID for them. */
8
- id: string;
9
- name: string;
10
- /** Where mention emails go; the host app vouches that it is theirs. */
11
- email: string;
12
- pictureUrl?: string | null;
13
- }
14
-
15
- /** The few calls Critiqs needs from a SQLite library. */
16
- export interface SqlDriver {
17
- exec(sql: string): void;
18
- run(sql: string, params?: unknown[]): void;
19
- get<T>(sql: string, params?: unknown[]): T | undefined;
20
- all<T>(sql: string, params?: unknown[]): T[];
21
- }
22
-
23
- export interface CritiqsHandlerOptions {
24
- /** A SQLite file path (Bun's SQLite under Bun, node:sqlite under Node), or a driver. */
25
- database: string | SqlDriver;
26
- /** Where the handler is mounted; the component's `backend` is this path. Default `/critiqs`. */
27
- basePath?: string;
28
- /** Resend key and sender, for sign-in codes and mention emails. */
29
- email?: { resendApiKey: string; from: string };
30
- /**
31
- * Uses the host app's own sign-in instead of Critiqs's email codes: returns
32
- * who made the request, or null when nobody is signed in to the app.
33
- */
34
- identify?: (request: Request) => HostUser | null | Promise<HostUser | null>;
35
- /**
36
- * Shows sign-in codes on screen instead of emailing them, only for requests
37
- * whose connection comes from this computer (see `fetch`'s `remoteAddress`).
38
- */
39
- developmentSignIn?: boolean;
40
- /**
41
- * AI for automatic tag grouping, natural-language search, and insights. The
42
- * provider here is the default for every project; with `encryptionKey`,
43
- * project owners can also connect their own provider in Critiqs, whose keys
44
- * are stored encrypted. Read these from your server's environment; never
45
- * put keys in browser code. Search and grouping still work without AI.
46
- */
47
- ai?: CritiqsAiOptions;
48
- }
49
-
50
- export interface CritiqsAiOptions {
51
- provider?: "openai" | "anthropic" | "google" | "gateway" | "compatible";
52
- model?: string;
53
- apiKey?: string;
54
- /** The provider's address; required for an OpenAI-compatible endpoint, such as `http://localhost:11434/v1` for Ollama. */
55
- baseURL?: string;
56
- /** At least 32 random characters, such as from `openssl rand -base64 32`; lets owners store their own keys, encrypted. */
57
- encryptionKey?: string;
58
- /** Endpoint addresses owners may enter, such as `https://llm.example.com/v1`. */
59
- allowedEndpoints?: string[];
60
- /** Allows `http://` and private-network addresses among `allowedEndpoints`, for providers on your own network. */
61
- allowLocalEndpoints?: boolean;
62
- /** Longest a model request may take. Default 30 seconds. */
63
- timeoutMs?: number;
64
- }
65
-
66
- export interface CritiqsHandler {
67
- /**
68
- * Answers requests under `basePath`; others get 404. `remoteAddress` is the
69
- * connection's address (Bun: `server.requestIP(request)?.address`), which
70
- * development sign-in needs to know a request comes from this computer.
71
- */
72
- fetch(request: Request, connection?: { remoteAddress?: string }): Promise<Response>;
73
- /** Sends due mention emails now; this also runs every minute. */
74
- deliverMentionEmails(): Promise<void>;
75
- /** Groups tags waiting for automatic grouping now; this also runs every minute. */
76
- groupTags(): Promise<void>;
77
- /** Stops the mention email and grouping timer. */
78
- close(): void;
79
- }
80
-
81
- /** Creates Critiqs's request handler for a host app's server. */
82
- export declare function createCritiqsHandler(options: CritiqsHandlerOptions): Promise<CritiqsHandler>;
83
-
84
- /** The handler as a Node `(req, res)` listener, for `http.createServer` or Express. */
85
- export declare function toNodeListener(
86
- handler: CritiqsHandler,
87
- ): (request: import("node:http").IncomingMessage, response: import("node:http").ServerResponse) => Promise<void>;
1
+ export * from "critiqs/server";