@xamukavila/pxpipe 0.8.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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +312 -0
  3. package/bin/cli.js +7 -0
  4. package/dist/core/applicability.d.ts +31 -0
  5. package/dist/core/applicability.js +96 -0
  6. package/dist/core/atlas-gray.d.ts +26 -0
  7. package/dist/core/atlas-gray.js +64 -0
  8. package/dist/core/atlas.d.ts +34 -0
  9. package/dist/core/atlas.js +71 -0
  10. package/dist/core/baseline.d.ts +80 -0
  11. package/dist/core/baseline.js +101 -0
  12. package/dist/core/caveman.d.ts +38 -0
  13. package/dist/core/caveman.js +183 -0
  14. package/dist/core/export.d.ts +128 -0
  15. package/dist/core/export.js +390 -0
  16. package/dist/core/factsheet.d.ts +78 -0
  17. package/dist/core/factsheet.js +216 -0
  18. package/dist/core/gpt-model-profiles.d.ts +60 -0
  19. package/dist/core/gpt-model-profiles.js +161 -0
  20. package/dist/core/history.d.ts +141 -0
  21. package/dist/core/history.js +553 -0
  22. package/dist/core/index.d.ts +8 -0
  23. package/dist/core/index.js +8 -0
  24. package/dist/core/library.d.ts +74 -0
  25. package/dist/core/library.js +133 -0
  26. package/dist/core/measurement.d.ts +22 -0
  27. package/dist/core/measurement.js +213 -0
  28. package/dist/core/openai-history.d.ts +124 -0
  29. package/dist/core/openai-history.js +494 -0
  30. package/dist/core/openai-savings.d.ts +44 -0
  31. package/dist/core/openai-savings.js +75 -0
  32. package/dist/core/openai.d.ts +24 -0
  33. package/dist/core/openai.js +839 -0
  34. package/dist/core/png.d.ts +11 -0
  35. package/dist/core/png.js +132 -0
  36. package/dist/core/proxy.d.ts +81 -0
  37. package/dist/core/proxy.js +730 -0
  38. package/dist/core/render.d.ts +188 -0
  39. package/dist/core/render.js +785 -0
  40. package/dist/core/schema-strip.d.ts +29 -0
  41. package/dist/core/schema-strip.js +160 -0
  42. package/dist/core/tracker.d.ts +154 -0
  43. package/dist/core/tracker.js +216 -0
  44. package/dist/core/transform.d.ts +362 -0
  45. package/dist/core/transform.js +1828 -0
  46. package/dist/core/types.d.ts +77 -0
  47. package/dist/core/types.js +8 -0
  48. package/dist/dashboard/fragments.d.ts +36 -0
  49. package/dist/dashboard/fragments.js +938 -0
  50. package/dist/dashboard/types.d.ts +154 -0
  51. package/dist/dashboard/types.js +3 -0
  52. package/dist/dashboard/vendor.d.ts +3 -0
  53. package/dist/dashboard/vendor.js +6 -0
  54. package/dist/dashboard.d.ts +245 -0
  55. package/dist/dashboard.js +1140 -0
  56. package/dist/export-collect.d.ts +36 -0
  57. package/dist/export-collect.js +59 -0
  58. package/dist/node.d.ts +9 -0
  59. package/dist/node.js +9038 -0
  60. package/dist/sessions.d.ts +172 -0
  61. package/dist/sessions.js +510 -0
  62. package/dist/stats.d.ts +74 -0
  63. package/dist/stats.js +248 -0
  64. package/dist/worker.d.ts +53 -0
  65. package/dist/worker.js +102 -0
  66. package/package.json +96 -0
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Shared file-reading gate for `pxpipe export`. Every collection mode
3
+ * (directory walk, explicit single-file target, and `--git` untracked files)
4
+ * must apply the SAME three checks — include/exclude globs, a max size, and a
5
+ * binary sniff — so the untracked path can no longer read gigabyte or filtered
6
+ * files that directory mode would have skipped.
7
+ *
8
+ * Kept in its own import-safe module (no top-level side effects, unlike
9
+ * src/node.ts which starts the server on import) so it can be unit-tested
10
+ * directly. src/core/export.ts is deliberately fs-free, so the fs-touching gate
11
+ * lives here rather than there.
12
+ */
13
+ /** Files larger than this are skipped by export (1 MiB). A single export bundle
14
+ * is meant to be paste-sized; a multi-MB file is never intentional context and
15
+ * reading it fully into memory is a resource-safety hazard. */
16
+ export declare const MAX_FILE_BYTES = 1000000;
17
+ /** Returns true if `buf` looks like binary (contains a null byte in the first 512 bytes). */
18
+ export declare function looksLikeBinary(buf: Buffer): boolean;
19
+ /** Outcome of trying to read one file for export. `excluded` is a normal filter
20
+ * hit (callers stay quiet); the other non-ok kinds are worth a warning. */
21
+ export type ExportReadResult = {
22
+ readonly kind: 'ok';
23
+ readonly content: string;
24
+ } | {
25
+ readonly kind: 'excluded' | 'oversized' | 'binary' | 'inaccessible';
26
+ };
27
+ /**
28
+ * Read a single text file for export if it passes every gate, in this order:
29
+ * 1. include/exclude globs (relative path)
30
+ * 2. size <= MAX_FILE_BYTES
31
+ * 3. not binary
32
+ * Returns the utf8 content on success, or the reason it was skipped. Pure of
33
+ * logging so each caller can decide whether a skip is noteworthy.
34
+ */
35
+ export declare function readExportTextFile(fullPath: string, relPath: string, include: string[], exclude: string[]): ExportReadResult;
36
+ //# sourceMappingURL=export-collect.d.ts.map
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Shared file-reading gate for `pxpipe export`. Every collection mode
3
+ * (directory walk, explicit single-file target, and `--git` untracked files)
4
+ * must apply the SAME three checks — include/exclude globs, a max size, and a
5
+ * binary sniff — so the untracked path can no longer read gigabyte or filtered
6
+ * files that directory mode would have skipped.
7
+ *
8
+ * Kept in its own import-safe module (no top-level side effects, unlike
9
+ * src/node.ts which starts the server on import) so it can be unit-tested
10
+ * directly. src/core/export.ts is deliberately fs-free, so the fs-touching gate
11
+ * lives here rather than there.
12
+ */
13
+ import * as fs from 'node:fs';
14
+ import { shouldIncludeFile } from './core/export.js';
15
+ /** Files larger than this are skipped by export (1 MiB). A single export bundle
16
+ * is meant to be paste-sized; a multi-MB file is never intentional context and
17
+ * reading it fully into memory is a resource-safety hazard. */
18
+ export const MAX_FILE_BYTES = 1_000_000;
19
+ /** Returns true if `buf` looks like binary (contains a null byte in the first 512 bytes). */
20
+ export function looksLikeBinary(buf) {
21
+ const check = Math.min(buf.byteLength, 512);
22
+ for (let i = 0; i < check; i++) {
23
+ if (buf[i] === 0)
24
+ return true;
25
+ }
26
+ return false;
27
+ }
28
+ /**
29
+ * Read a single text file for export if it passes every gate, in this order:
30
+ * 1. include/exclude globs (relative path)
31
+ * 2. size <= MAX_FILE_BYTES
32
+ * 3. not binary
33
+ * Returns the utf8 content on success, or the reason it was skipped. Pure of
34
+ * logging so each caller can decide whether a skip is noteworthy.
35
+ */
36
+ export function readExportTextFile(fullPath, relPath, include, exclude) {
37
+ if (!shouldIncludeFile(relPath, include, exclude))
38
+ return { kind: 'excluded' };
39
+ let stat;
40
+ try {
41
+ stat = fs.statSync(fullPath);
42
+ }
43
+ catch {
44
+ return { kind: 'inaccessible' };
45
+ }
46
+ if (stat.size > MAX_FILE_BYTES)
47
+ return { kind: 'oversized' };
48
+ let buf;
49
+ try {
50
+ buf = fs.readFileSync(fullPath);
51
+ }
52
+ catch {
53
+ return { kind: 'inaccessible' };
54
+ }
55
+ if (looksLikeBinary(buf))
56
+ return { kind: 'binary' };
57
+ return { kind: 'ok', content: buf.toString('utf8') };
58
+ }
59
+ //# sourceMappingURL=export-collect.js.map
package/dist/node.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Node entrypoint — `node:http` server + minimal CLI flag parsing.
3
+ *
4
+ * Wraps the runtime-agnostic `createProxy` from src/core/proxy.ts. The
5
+ * heavy lifting (transform, render, PNG) is identical to the Worker
6
+ * version; only the request/response plumbing differs.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=node.d.ts.map