@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,77 @@
1
+ /**
2
+ * Minimal Anthropic Messages API request types — only the fields pxpipe
3
+ * actually reads or rewrites. Anything else passes through untouched.
4
+ *
5
+ * Shape reference: https://docs.anthropic.com/en/api/messages
6
+ */
7
+ export interface TextBlock {
8
+ type: 'text';
9
+ text: string;
10
+ cache_control?: CacheControl;
11
+ }
12
+ export interface ImageBlock {
13
+ type: 'image';
14
+ source: {
15
+ type: 'base64';
16
+ media_type: 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp';
17
+ data: string;
18
+ };
19
+ cache_control?: CacheControl;
20
+ }
21
+ export interface ToolUseBlock {
22
+ type: 'tool_use';
23
+ id: string;
24
+ name: string;
25
+ input: unknown;
26
+ }
27
+ export interface ToolResultBlock {
28
+ type: 'tool_result';
29
+ tool_use_id: string;
30
+ content: string | Array<TextBlock | ImageBlock>;
31
+ is_error?: boolean;
32
+ cache_control?: CacheControl;
33
+ }
34
+ export type ContentBlock = TextBlock | ImageBlock | ToolUseBlock | ToolResultBlock;
35
+ export interface CacheControl {
36
+ type: 'ephemeral';
37
+ ttl?: '5m' | '1h';
38
+ }
39
+ export interface Message {
40
+ role: 'user' | 'assistant';
41
+ content: string | ContentBlock[];
42
+ }
43
+ export interface ToolDef {
44
+ name: string;
45
+ description?: string;
46
+ input_schema?: unknown;
47
+ cache_control?: CacheControl;
48
+ }
49
+ export type SystemField = string | Array<TextBlock | ImageBlock>;
50
+ /** Anthropic token usage block — same shape on streaming (message_start) and non-streaming. */
51
+ export interface Usage {
52
+ input_tokens?: number;
53
+ output_tokens?: number;
54
+ cache_creation_input_tokens?: number;
55
+ cache_read_input_tokens?: number;
56
+ /** Split by tier (5m=1.25×, 1h=2× base) for honest cost; absent on older API / non-cache requests. */
57
+ cache_creation?: {
58
+ ephemeral_5m_input_tokens?: number;
59
+ ephemeral_1h_input_tokens?: number;
60
+ };
61
+ /** Server tool billing (web search = per-request, not per-token); absent when unused. */
62
+ server_tool_use?: {
63
+ web_search_requests?: number;
64
+ };
65
+ /** OpenAI prompt-cache hits — the subset of `input_tokens` served from cache
66
+ * (billed at ~0.1× for the gpt-5 family). Mapped from `input_tokens_details`
67
+ * / `prompt_tokens_details.cached_tokens`. Anthropic uses cache_read instead. */
68
+ cached_tokens?: number;
69
+ }
70
+ export interface MessagesRequest {
71
+ model: string;
72
+ messages: Message[];
73
+ system?: SystemField;
74
+ tools?: ToolDef[];
75
+ [k: string]: unknown;
76
+ }
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Minimal Anthropic Messages API request types — only the fields pxpipe
3
+ * actually reads or rewrites. Anything else passes through untouched.
4
+ *
5
+ * Shape reference: https://docs.anthropic.com/en/api/messages
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,36 @@
1
+ import type { StatsPayload, RecentPayload, SessionsPayload, FullStatsPayload } from './types.js';
2
+ export declare function escapeHtml(s: string | null | undefined): string;
3
+ export declare function renderToggleFragment(enabled: boolean): string;
4
+ export declare function renderModelsFragment(active: string[], configured: string[], enabled: boolean): string;
5
+ export declare function renderSessionSummaryFragment(s: StatsPayload): string;
6
+ export declare function renderHeaderFragment(s: StatsPayload, port: number): string;
7
+ export interface ContextMapData {
8
+ id: number;
9
+ baselineTokens: number;
10
+ realInput: number;
11
+ baselineInputEff: number;
12
+ actualInputEff: number;
13
+ haveBaseline: boolean;
14
+ cacheRead: number;
15
+ warm: boolean;
16
+ output: number;
17
+ imageCount: number;
18
+ buckets: Partial<Record<string, number>>;
19
+ imageIds: number[];
20
+ compressed: boolean;
21
+ restored?: boolean;
22
+ }
23
+ /** Image-vs-text breakdown for one request. */
24
+ export declare function renderContextMapFragment(c: ContextMapData | undefined, history?: ContextMapData[], notFound?: boolean): string;
25
+ export declare function renderRecentFragment(p: RecentPayload): string;
26
+ export interface LatestFragmentInput {
27
+ payload: RecentPayload;
28
+ pin: number | null;
29
+ showSource: boolean;
30
+ sourceText: string | null;
31
+ }
32
+ export declare function renderLatestFragment(inp: LatestFragmentInput): string;
33
+ export declare function renderSessionsFragment(p: SessionsPayload): string;
34
+ export declare function renderStatsTableFragment(p: FullStatsPayload): string;
35
+ export declare function renderPage(port: number): string;
36
+ //# sourceMappingURL=fragments.d.ts.map