@boxxy/pepys 0.0.1 → 0.1.4

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 (63) hide show
  1. package/README.md +42 -5
  2. package/dist/boxxy-source.d.ts +636 -0
  3. package/dist/boxxy-work-plugin.d.ts +1 -0
  4. package/dist/build-boxxy-plugin.d.ts +181 -0
  5. package/dist/consumers/apply-scope.d.ts +5 -0
  6. package/dist/create-pepys-fact-sink.d.ts +9 -0
  7. package/dist/create-pepys-reader.d.ts +9 -0
  8. package/dist/generated/boxxy-work-boundary.d.ts +566 -0
  9. package/dist/index.d.ts +5 -0
  10. package/dist/queries/build-cost-to-land-query.d.ts +156 -0
  11. package/dist/queries/build-cost-to-land.d.ts +12 -0
  12. package/dist/queries/build-stage-time-query.d.ts +29 -0
  13. package/dist/queries/build-stage-time.d.ts +10 -0
  14. package/dist/queries/constants.d.ts +6 -0
  15. package/dist/queries/find-item-entity-id.d.ts +2 -0
  16. package/dist/queries/types.d.ts +109 -0
  17. package/dist/sink/is-outgoing-fact.d.ts +3 -0
  18. package/dist/sink/pick-sink-answer.d.ts +7 -0
  19. package/dist/sink/to-wire-fact.d.ts +5 -0
  20. package/dist/types.d.ts +6 -0
  21. package/dist/wire-fact-schemas.d.ts +319 -0
  22. package/dist/work/boxxy-work-consumer.d.ts +125 -0
  23. package/dist/work/constants.d.ts +3 -0
  24. package/dist/work/fold-work-facts.d.ts +2 -0
  25. package/dist/work/types.d.ts +147 -0
  26. package/package.json +51 -4
  27. package/src/boxxy-source.ts +25 -0
  28. package/src/boxxy-work-plugin.ts +11 -0
  29. package/src/build-boxxy-plugin.ts +18 -0
  30. package/src/consumers/apply-scope.ts +125 -0
  31. package/src/create-pepys-fact-sink.ts +64 -0
  32. package/src/create-pepys-reader.ts +79 -0
  33. package/src/generated/boxxy-work-boundary.ts +2923 -0
  34. package/src/generated/boxxy-work.sql +71 -0
  35. package/src/index.ts +17 -0
  36. package/src/queries/build-cost-to-land-query.ts +127 -0
  37. package/src/queries/build-cost-to-land.ts +226 -0
  38. package/src/queries/build-stage-time-query.ts +59 -0
  39. package/src/queries/build-stage-time.ts +195 -0
  40. package/src/queries/constants.ts +10 -0
  41. package/src/queries/find-item-entity-id.ts +16 -0
  42. package/src/queries/types.ts +168 -0
  43. package/src/sink/is-outgoing-fact.ts +19 -0
  44. package/src/sink/pick-sink-answer.ts +29 -0
  45. package/src/sink/to-wire-fact.ts +31 -0
  46. package/src/test-utils/build-foreign-stand-in.ts +139 -0
  47. package/src/test-utils/build-mock-applied-fact.ts +39 -0
  48. package/src/test-utils/build-mock-attempt-read-row.ts +17 -0
  49. package/src/test-utils/build-mock-binding-read-row.ts +12 -0
  50. package/src/test-utils/build-mock-item-facts.ts +149 -0
  51. package/src/test-utils/build-mock-request-read-row.ts +20 -0
  52. package/src/test-utils/build-mock-scope-fact.ts +13 -0
  53. package/src/test-utils/create-ingest-stand-in.ts +56 -0
  54. package/src/test-utils/create-query-stand-in.ts +51 -0
  55. package/src/test-utils/create-test-pepys.ts +228 -0
  56. package/src/test-utils/to-entity-id.ts +14 -0
  57. package/src/test-utils/to-scope-fact.ts +92 -0
  58. package/src/types.ts +14 -0
  59. package/src/wire-fact-schemas.ts +41 -0
  60. package/src/work/boxxy-work-consumer.ts +95 -0
  61. package/src/work/constants.ts +25 -0
  62. package/src/work/fold-work-facts.ts +490 -0
  63. package/src/work/types.ts +177 -0
@@ -0,0 +1 @@
1
+ export declare const boxxyWorkPlugin: import("@pepys/kit").Plugin<never>;
@@ -0,0 +1,181 @@
1
+ import type { ForeignReads } from './queries/types.ts';
2
+ export declare function buildBoxxyPlugin(foreign: ForeignReads): import("@pepys/kit").Plugin<import("@pepys/kit").QueryDefinition<"boxxy_cost_to_land", import("zod").ZodObject<{
3
+ item: import("zod").ZodString;
4
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
5
+ item: import("zod").ZodString;
6
+ landedAt: import("zod").ZodNullable<import("zod").ZodString>;
7
+ attempts: import("zod").ZodNumber;
8
+ lines: import("zod").ZodArray<import("zod").ZodObject<{
9
+ phase: import("zod").ZodString;
10
+ rework: import("zod").ZodBoolean;
11
+ product: import("zod").ZodString;
12
+ model: import("zod").ZodNullable<import("zod").ZodString>;
13
+ requests: import("zod").ZodNumber;
14
+ inputTokens: import("zod").ZodNumber;
15
+ cacheReadTokens: import("zod").ZodNumber;
16
+ cacheCreationTokens: import("zod").ZodNumber;
17
+ outputTokens: import("zod").ZodNumber;
18
+ costUSD: import("zod").ZodNullable<import("zod").ZodNumber>;
19
+ costBasis: import("zod").ZodEnum<{
20
+ none: "none";
21
+ reported: "reported";
22
+ turn: "turn";
23
+ }>;
24
+ }, import("zod/v4/core").$strip>>;
25
+ totals: import("zod").ZodObject<{
26
+ requests: import("zod").ZodNumber;
27
+ costUSD: import("zod").ZodNumber;
28
+ reworkCostUSD: import("zod").ZodNumber;
29
+ requestsWithoutCost: import("zod").ZodNumber;
30
+ }, import("zod/v4/core").$strip>;
31
+ }, import("zod/v4/core").$strip>, readonly [import("@pepys/kit").ConsumerDeclaration<"boxxy_work", {
32
+ readonly boxxy_item: import("@pepys/kit").TableDeclaration<{
33
+ readonly id: {
34
+ readonly kind: "entityID";
35
+ };
36
+ readonly kind: {
37
+ readonly kind: "text";
38
+ };
39
+ readonly repo: {
40
+ readonly kind: "text";
41
+ };
42
+ readonly title: {
43
+ readonly kind: "text";
44
+ };
45
+ readonly design_mode: {
46
+ readonly kind: "text";
47
+ readonly nullable: true;
48
+ };
49
+ readonly filed_at: {
50
+ readonly kind: "timestamp";
51
+ };
52
+ readonly closed_at: {
53
+ readonly kind: "timestamp";
54
+ readonly nullable: true;
55
+ };
56
+ readonly close_reason: {
57
+ readonly kind: "text";
58
+ readonly nullable: true;
59
+ };
60
+ readonly updated_at: {
61
+ readonly kind: "timestamp";
62
+ };
63
+ }>;
64
+ readonly boxxy_attempt: import("@pepys/kit").TableDeclaration<{
65
+ readonly id: {
66
+ readonly kind: "entityID";
67
+ };
68
+ readonly item_id: {
69
+ readonly kind: "entityID";
70
+ };
71
+ readonly phase: {
72
+ readonly kind: "text";
73
+ };
74
+ readonly number: {
75
+ readonly kind: "integer";
76
+ };
77
+ readonly round: {
78
+ readonly kind: "integer";
79
+ };
80
+ readonly mode: {
81
+ readonly kind: "text";
82
+ };
83
+ readonly pool: {
84
+ readonly kind: "text";
85
+ };
86
+ readonly recipe_hash: {
87
+ readonly kind: "text";
88
+ };
89
+ readonly rules_version: {
90
+ readonly kind: "text";
91
+ };
92
+ readonly atc_session: {
93
+ readonly kind: "text";
94
+ readonly nullable: true;
95
+ };
96
+ readonly state: {
97
+ readonly kind: "text";
98
+ };
99
+ readonly outcome: {
100
+ readonly kind: "text";
101
+ readonly nullable: true;
102
+ };
103
+ readonly failure: {
104
+ readonly kind: "text";
105
+ readonly nullable: true;
106
+ };
107
+ readonly claimed_at: {
108
+ readonly kind: "timestamp";
109
+ };
110
+ readonly started_at: {
111
+ readonly kind: "timestamp";
112
+ readonly nullable: true;
113
+ };
114
+ readonly closed_out_at: {
115
+ readonly kind: "timestamp";
116
+ readonly nullable: true;
117
+ };
118
+ readonly ended_at: {
119
+ readonly kind: "timestamp";
120
+ readonly nullable: true;
121
+ };
122
+ readonly sleeps: {
123
+ readonly kind: "json";
124
+ };
125
+ readonly updated_at: {
126
+ readonly kind: "timestamp";
127
+ };
128
+ }>;
129
+ readonly boxxy_attempt_session: import("@pepys/kit").TableDeclaration<{
130
+ readonly attempt_id: {
131
+ readonly kind: "entityID";
132
+ };
133
+ readonly session_id: {
134
+ readonly kind: "entityID";
135
+ };
136
+ readonly key: {
137
+ readonly kind: "text";
138
+ };
139
+ readonly product: {
140
+ readonly kind: "text";
141
+ readonly nullable: true;
142
+ };
143
+ readonly caller_issuer: {
144
+ readonly kind: "text";
145
+ readonly nullable: true;
146
+ };
147
+ readonly caller_subject: {
148
+ readonly kind: "text";
149
+ readonly nullable: true;
150
+ };
151
+ readonly bound_at: {
152
+ readonly kind: "timestamp";
153
+ };
154
+ }>;
155
+ }, import("@pepys/kit").LinkTypeDeclaration<"attempt_of", "boxxy:attempt", "boxxy:item"> | import("@pepys/kit").LinkTypeDeclaration<"produced", "boxxy:attempt", "github:pull_request"> | import("@pepys/kit").LinkTypeDeclaration<"ran_in", "boxxy:attempt", "telemetry:session">>, import("./index.ts").TelemetryModelRequestConsumer, import("./index.ts").TelemetryTurnCostConsumer, import("./index.ts").GithubPullRequestConsumer]> | import("@pepys/kit").QueryDefinition<"boxxy_stage_time", import("zod").ZodObject<{
156
+ item: import("zod").ZodString;
157
+ environment: import("zod").ZodString;
158
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
159
+ item: import("zod").ZodString;
160
+ environment: import("zod").ZodString;
161
+ steps: import("zod").ZodArray<import("zod").ZodObject<{
162
+ step: import("zod").ZodEnum<{
163
+ build: "build";
164
+ deploy: "deploy";
165
+ design: "design";
166
+ merge: "merge";
167
+ release: "release";
168
+ review: "review";
169
+ triage: "triage";
170
+ }>;
171
+ minutes: import("zod").ZodNullable<import("zod").ZodNumber>;
172
+ endedAt: import("zod").ZodNullable<import("zod").ZodString>;
173
+ }, import("zod/v4/core").$strip>>;
174
+ rework: import("zod").ZodObject<{
175
+ count: import("zod").ZodNumber;
176
+ minutes: import("zod").ZodNumber;
177
+ }, import("zod/v4/core").$strip>;
178
+ reviewWaitMinutes: import("zod").ZodNullable<import("zod").ZodNumber>;
179
+ sleepMinutes: import("zod").ZodNumber;
180
+ pullRequests: import("zod").ZodArray<import("zod").ZodString>;
181
+ }, import("zod/v4/core").$strip>, import("./index.ts").StageTimeReads>>;
@@ -0,0 +1,5 @@
1
+ import type { BoxxyWorkMessage, BoxxyWorkModel } from '../generated/boxxy-work-boundary.ts';
2
+ export type { BoxxyWorkMessage, BoxxyWorkModel } from '../generated/boxxy-work-boundary.ts';
3
+ export declare function init(): BoxxyWorkModel;
4
+ export declare function update(model: BoxxyWorkModel, message: BoxxyWorkMessage): BoxxyWorkModel;
5
+ export declare function applyScope(scope: string): string;
@@ -0,0 +1,9 @@
1
+ import type { FactSink } from '@boxxy/model';
2
+ interface PepysFactSinkOptions {
3
+ readonly url: string;
4
+ readonly secret: string;
5
+ readonly timeoutMs: number;
6
+ readonly fetch?: (request: Request) => Promise<Response>;
7
+ }
8
+ export declare function createPepysFactSink(options: PepysFactSinkOptions): FactSink;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { PepysReader } from '@boxxy/model';
2
+ import type { UncheckedQueryClient } from './types.ts';
3
+ interface PepysReaderOptions {
4
+ readonly client: UncheckedQueryClient;
5
+ readonly environment: string;
6
+ readonly timeoutMs: number;
7
+ }
8
+ export declare function createPepysReader(options: PepysReaderOptions): PepysReader;
9
+ export {};