@dailephd/my-dev-kit-lab 0.6.3 → 0.7.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 (103) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +6 -4
  3. package/benchmarks/contracts/context-window-scaling-cases.json +220 -0
  4. package/benchmarks/projects/context-window-scaling-fixed-ts/README.md +14 -0
  5. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/carrier-depot-catalog-01.ts +302 -0
  6. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/course-module-catalog-06.ts +302 -0
  7. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/library-shelf-catalog-07.ts +302 -0
  8. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/sensor-station-catalog-05.ts +302 -0
  9. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/staff-rota-catalog-03.ts +302 -0
  10. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/supplier-contract-catalog-02.ts +302 -0
  11. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-1/vehicle-route-catalog-04.ts +302 -0
  12. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/archive-box-catalog-12.ts +302 -0
  13. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/clinic-ward-catalog-08.ts +302 -0
  14. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/greenhouse-bay-catalog-13.ts +302 -0
  15. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/harbor-berth-catalog-10.ts +302 -0
  16. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/kitchen-section-catalog-15.ts +302 -0
  17. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/market-stall-catalog-09.ts +302 -0
  18. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/station-platform-catalog-14.ts +302 -0
  19. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-2/workshop-bench-catalog-11.ts +302 -0
  20. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/archive-box-catalog-28.ts +302 -0
  21. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/carrier-depot-catalog-17.ts +302 -0
  22. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/clinic-ward-catalog-24.ts +302 -0
  23. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/course-module-catalog-22.ts +302 -0
  24. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/greenhouse-bay-catalog-29.ts +302 -0
  25. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/harbor-berth-catalog-26.ts +302 -0
  26. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/kitchen-section-catalog-31.ts +302 -0
  27. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/library-shelf-catalog-23.ts +302 -0
  28. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/market-stall-catalog-25.ts +302 -0
  29. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/sensor-station-catalog-21.ts +302 -0
  30. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/staff-rota-catalog-19.ts +302 -0
  31. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/station-platform-catalog-30.ts +302 -0
  32. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/supplier-contract-catalog-18.ts +302 -0
  33. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/vehicle-route-catalog-20.ts +302 -0
  34. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/warehouse-zone-catalog-16.ts +302 -0
  35. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-3/workshop-bench-catalog-27.ts +302 -0
  36. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/archive-box-catalog-44.ts +302 -0
  37. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/carrier-depot-catalog-33.ts +302 -0
  38. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/carrier-depot-catalog-49.ts +302 -0
  39. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/clinic-ward-catalog-40.ts +302 -0
  40. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/clinic-ward-catalog-56.ts +302 -0
  41. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/course-module-catalog-38.ts +302 -0
  42. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/course-module-catalog-54.ts +302 -0
  43. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/greenhouse-bay-catalog-45.ts +302 -0
  44. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/harbor-berth-catalog-42.ts +302 -0
  45. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/harbor-berth-catalog-58.ts +302 -0
  46. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/kitchen-section-catalog-47.ts +302 -0
  47. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/library-shelf-catalog-39.ts +302 -0
  48. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/library-shelf-catalog-55.ts +302 -0
  49. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/market-stall-catalog-41.ts +302 -0
  50. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/market-stall-catalog-57.ts +302 -0
  51. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/sensor-station-catalog-37.ts +302 -0
  52. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/sensor-station-catalog-53.ts +302 -0
  53. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/staff-rota-catalog-35.ts +302 -0
  54. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/staff-rota-catalog-51.ts +302 -0
  55. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/station-platform-catalog-46.ts +302 -0
  56. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/supplier-contract-catalog-34.ts +302 -0
  57. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/supplier-contract-catalog-50.ts +302 -0
  58. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/vehicle-route-catalog-36.ts +302 -0
  59. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/vehicle-route-catalog-52.ts +302 -0
  60. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/warehouse-zone-catalog-32.ts +302 -0
  61. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/warehouse-zone-catalog-48.ts +302 -0
  62. package/benchmarks/projects/context-window-scaling-fixed-ts/src/filler/tier-4/workshop-bench-catalog-43.ts +302 -0
  63. package/benchmarks/projects/context-window-scaling-fixed-ts/src/tasks/auditRedaction.ts +25 -0
  64. package/benchmarks/projects/context-window-scaling-fixed-ts/src/tasks/inventoryReservation.ts +26 -0
  65. package/benchmarks/projects/context-window-scaling-fixed-ts/src/tasks/invoiceTotals.ts +25 -0
  66. package/benchmarks/projects/context-window-scaling-fixed-ts/src/tasks/shippingQuote.ts +32 -0
  67. package/benchmarks/projects/context-window-scaling-fixed-ts/tests/tasks/auditRedaction.test.ts +17 -0
  68. package/benchmarks/projects/context-window-scaling-fixed-ts/tests/tasks/inventoryReservation.test.ts +19 -0
  69. package/benchmarks/projects/context-window-scaling-fixed-ts/tests/tasks/invoiceTotals.test.ts +14 -0
  70. package/benchmarks/projects/context-window-scaling-fixed-ts/tests/tasks/shippingQuote.test.ts +19 -0
  71. package/dist/src/cli/help.js +13 -3
  72. package/dist/src/commands/runExperimentRunCommand.js +64 -4
  73. package/dist/src/experiments/defaultRegistry.js +2 -0
  74. package/dist/src/experiments/plugins/contextWindowScaling/cliBudgets.js +31 -0
  75. package/dist/src/experiments/plugins/contextWindowScaling/config.js +84 -0
  76. package/dist/src/experiments/plugins/contextWindowScaling/contextBudget.js +43 -0
  77. package/dist/src/experiments/plugins/contextWindowScaling/evaluation.js +36 -0
  78. package/dist/src/experiments/plugins/contextWindowScaling/execution.js +187 -0
  79. package/dist/src/experiments/plugins/contextWindowScaling/executionArtifact.js +15 -0
  80. package/dist/src/experiments/plugins/contextWindowScaling/executionArtifactReader.js +186 -0
  81. package/dist/src/experiments/plugins/contextWindowScaling/index.js +14 -0
  82. package/dist/src/experiments/plugins/contextWindowScaling/metadata.js +12 -0
  83. package/dist/src/experiments/plugins/contextWindowScaling/metrics.js +149 -0
  84. package/dist/src/experiments/plugins/contextWindowScaling/plugin.js +185 -0
  85. package/dist/src/experiments/plugins/contextWindowScaling/projectProfile.js +51 -0
  86. package/dist/src/experiments/plugins/contextWindowScaling/relevantFiles.js +76 -0
  87. package/dist/src/experiments/plugins/contextWindowScaling/successEvidence.js +60 -0
  88. package/dist/src/experiments/plugins/contextWindowScaling/types.js +1 -0
  89. package/dist/src/experiments/plugins/index.js +1 -0
  90. package/dist/src/experiments/plugins/warmIndexReuse/agentEvaluation.js +1 -1
  91. package/dist/src/plots/buildContextWindowScalingPlotData.js +96 -0
  92. package/dist/src/plots/index.js +1 -0
  93. package/dist/src/plots/writePlotArtifacts.js +12 -3
  94. package/dist/src/report/experiments/buildContextWindowScalingReport.js +84 -0
  95. package/dist/src/report/experiments/buildPluginExperimentReport.js +22 -2
  96. package/dist/src/report/experiments/contextWindowScalingReportModel.js +3 -0
  97. package/dist/src/report/experiments/index.js +4 -0
  98. package/dist/src/report/experiments/renderContextWindowScalingHtml.js +99 -0
  99. package/dist/src/report/experiments/renderContextWindowScalingText.js +108 -0
  100. package/dist/src/report/experiments/renderPluginExperimentReportHtml.js +3 -0
  101. package/dist/src/report/experiments/renderPluginExperimentReportText.js +8 -0
  102. package/docs/METRICS.md +27 -1
  103. package/package.json +1 -1
@@ -0,0 +1,302 @@
1
+ // Scale-only filler (tier-4). Ordinary catalog data for a workshop bench listing.
2
+ // It is unrelated to every task under src/tasks and exists only to add repository context.
3
+
4
+ export interface WorkshopBenchRecord43 {
5
+ id: string;
6
+ label: string;
7
+ capacity: number;
8
+ priority: number;
9
+ active: boolean;
10
+ notes: string;
11
+ }
12
+
13
+ export const workshopBenchRecords43: readonly WorkshopBenchRecord43[] = [
14
+ {
15
+ id: "wor-43-001",
16
+ label: "central annex 1",
17
+ capacity: 74,
18
+ priority: 5,
19
+ active: false,
20
+ notes: "granite workshop bench entry reviewed in cycle 1"
21
+ },
22
+ {
23
+ id: "wor-43-002",
24
+ label: "northern row 2",
25
+ capacity: 44,
26
+ priority: 4,
27
+ active: false,
28
+ notes: "northern workshop bench entry reviewed in cycle 1"
29
+ },
30
+ {
31
+ id: "wor-43-003",
32
+ label: "central row 3",
33
+ capacity: 78,
34
+ priority: 1,
35
+ active: false,
36
+ notes: "northern workshop bench entry reviewed in cycle 1"
37
+ },
38
+ {
39
+ id: "wor-43-004",
40
+ label: "central annex 4",
41
+ capacity: 20,
42
+ priority: 3,
43
+ active: false,
44
+ notes: "granite workshop bench entry reviewed in cycle 5"
45
+ },
46
+ {
47
+ id: "wor-43-005",
48
+ label: "granite annex 5",
49
+ capacity: 72,
50
+ priority: 4,
51
+ active: false,
52
+ notes: "granite workshop bench entry reviewed in cycle 1"
53
+ },
54
+ {
55
+ id: "wor-43-006",
56
+ label: "eastern annex 6",
57
+ capacity: 58,
58
+ priority: 3,
59
+ active: false,
60
+ notes: "central workshop bench entry reviewed in cycle 9"
61
+ },
62
+ {
63
+ id: "wor-43-007",
64
+ label: "granite hall 7",
65
+ capacity: 66,
66
+ priority: 1,
67
+ active: false,
68
+ notes: "northern workshop bench entry reviewed in cycle 1"
69
+ },
70
+ {
71
+ id: "wor-43-008",
72
+ label: "central row 8",
73
+ capacity: 44,
74
+ priority: 2,
75
+ active: false,
76
+ notes: "northern workshop bench entry reviewed in cycle 9"
77
+ },
78
+ {
79
+ id: "wor-43-009",
80
+ label: "northern row 9",
81
+ capacity: 20,
82
+ priority: 5,
83
+ active: false,
84
+ notes: "granite workshop bench entry reviewed in cycle 5"
85
+ },
86
+ {
87
+ id: "wor-43-010",
88
+ label: "northern hall 10",
89
+ capacity: 10,
90
+ priority: 4,
91
+ active: true,
92
+ notes: "northern workshop bench entry reviewed in cycle 5"
93
+ },
94
+ {
95
+ id: "wor-43-011",
96
+ label: "northern hall 11",
97
+ capacity: 44,
98
+ priority: 4,
99
+ active: false,
100
+ notes: "central workshop bench entry reviewed in cycle 5"
101
+ },
102
+ {
103
+ id: "wor-43-012",
104
+ label: "central row 12",
105
+ capacity: 28,
106
+ priority: 2,
107
+ active: false,
108
+ notes: "granite workshop bench entry reviewed in cycle 1"
109
+ },
110
+ {
111
+ id: "wor-43-013",
112
+ label: "granite annex 13",
113
+ capacity: 56,
114
+ priority: 1,
115
+ active: false,
116
+ notes: "granite workshop bench entry reviewed in cycle 5"
117
+ },
118
+ {
119
+ id: "wor-43-014",
120
+ label: "northern row 14",
121
+ capacity: 90,
122
+ priority: 2,
123
+ active: false,
124
+ notes: "granite workshop bench entry reviewed in cycle 9"
125
+ },
126
+ {
127
+ id: "wor-43-015",
128
+ label: "granite hall 15",
129
+ capacity: 28,
130
+ priority: 2,
131
+ active: false,
132
+ notes: "northern workshop bench entry reviewed in cycle 9"
133
+ },
134
+ {
135
+ id: "wor-43-016",
136
+ label: "northern hall 16",
137
+ capacity: 38,
138
+ priority: 3,
139
+ active: false,
140
+ notes: "granite workshop bench entry reviewed in cycle 9"
141
+ },
142
+ {
143
+ id: "wor-43-017",
144
+ label: "granite annex 17",
145
+ capacity: 16,
146
+ priority: 1,
147
+ active: false,
148
+ notes: "northern workshop bench entry reviewed in cycle 5"
149
+ },
150
+ {
151
+ id: "wor-43-018",
152
+ label: "northern annex 18",
153
+ capacity: 52,
154
+ priority: 2,
155
+ active: false,
156
+ notes: "granite workshop bench entry reviewed in cycle 9"
157
+ },
158
+ {
159
+ id: "wor-43-019",
160
+ label: "central row 19",
161
+ capacity: 32,
162
+ priority: 5,
163
+ active: false,
164
+ notes: "central workshop bench entry reviewed in cycle 9"
165
+ },
166
+ {
167
+ id: "wor-43-020",
168
+ label: "granite annex 20",
169
+ capacity: 76,
170
+ priority: 3,
171
+ active: false,
172
+ notes: "northern workshop bench entry reviewed in cycle 9"
173
+ },
174
+ {
175
+ id: "wor-43-021",
176
+ label: "central row 21",
177
+ capacity: 40,
178
+ priority: 5,
179
+ active: false,
180
+ notes: "northern workshop bench entry reviewed in cycle 5"
181
+ },
182
+ {
183
+ id: "wor-43-022",
184
+ label: "granite annex 22",
185
+ capacity: 68,
186
+ priority: 3,
187
+ active: false,
188
+ notes: "granite workshop bench entry reviewed in cycle 1"
189
+ },
190
+ {
191
+ id: "wor-43-023",
192
+ label: "maple row 23",
193
+ capacity: 78,
194
+ priority: 5,
195
+ active: false,
196
+ notes: "central workshop bench entry reviewed in cycle 1"
197
+ },
198
+ {
199
+ id: "wor-43-024",
200
+ label: "granite hall 24",
201
+ capacity: 18,
202
+ priority: 4,
203
+ active: false,
204
+ notes: "granite workshop bench entry reviewed in cycle 9"
205
+ },
206
+ {
207
+ id: "wor-43-025",
208
+ label: "central hall 25",
209
+ capacity: 78,
210
+ priority: 1,
211
+ active: false,
212
+ notes: "central workshop bench entry reviewed in cycle 1"
213
+ },
214
+ {
215
+ id: "wor-43-026",
216
+ label: "northern row 26",
217
+ capacity: 56,
218
+ priority: 1,
219
+ active: false,
220
+ notes: "northern workshop bench entry reviewed in cycle 5"
221
+ },
222
+ {
223
+ id: "wor-43-027",
224
+ label: "northern annex 27",
225
+ capacity: 96,
226
+ priority: 2,
227
+ active: false,
228
+ notes: "granite workshop bench entry reviewed in cycle 1"
229
+ },
230
+ {
231
+ id: "wor-43-028",
232
+ label: "central hall 28",
233
+ capacity: 36,
234
+ priority: 5,
235
+ active: false,
236
+ notes: "granite workshop bench entry reviewed in cycle 5"
237
+ },
238
+ {
239
+ id: "wor-43-029",
240
+ label: "granite annex 29",
241
+ capacity: 34,
242
+ priority: 2,
243
+ active: false,
244
+ notes: "central workshop bench entry reviewed in cycle 1"
245
+ },
246
+ {
247
+ id: "wor-43-030",
248
+ label: "northern row 30",
249
+ capacity: 12,
250
+ priority: 4,
251
+ active: false,
252
+ notes: "northern workshop bench entry reviewed in cycle 9"
253
+ },
254
+ {
255
+ id: "wor-43-031",
256
+ label: "central row 31",
257
+ capacity: 42,
258
+ priority: 3,
259
+ active: false,
260
+ notes: "northern workshop bench entry reviewed in cycle 5"
261
+ },
262
+ {
263
+ id: "wor-43-032",
264
+ label: "central hall 32",
265
+ capacity: 90,
266
+ priority: 5,
267
+ active: false,
268
+ notes: "northern workshop bench entry reviewed in cycle 1"
269
+ },
270
+ {
271
+ id: "wor-43-033",
272
+ label: "central annex 33",
273
+ capacity: 70,
274
+ priority: 1,
275
+ active: false,
276
+ notes: "northern workshop bench entry reviewed in cycle 1"
277
+ },
278
+ {
279
+ id: "wor-43-034",
280
+ label: "central hall 34",
281
+ capacity: 50,
282
+ priority: 1,
283
+ active: false,
284
+ notes: "granite workshop bench entry reviewed in cycle 5"
285
+ }
286
+ ];
287
+
288
+ export function findWorkshopBenchRecord43(id: string): WorkshopBenchRecord43 | undefined {
289
+ return workshopBenchRecords43.find((record) => record.id === id);
290
+ }
291
+
292
+ export function listWorkshopBenchActiveRecords43(): WorkshopBenchRecord43[] {
293
+ return workshopBenchRecords43.filter((record) => record.active);
294
+ }
295
+
296
+ export function totalWorkshopBenchCapacity43(): number {
297
+ return workshopBenchRecords43.reduce((sum, record) => sum + record.capacity, 0);
298
+ }
299
+
300
+ export function countWorkshopBenchByPriority43(priority: number): number {
301
+ return workshopBenchRecords43.filter((record) => record.priority === priority).length;
302
+ }
@@ -0,0 +1,25 @@
1
+ export interface AuditEntry {
2
+ actor: string;
3
+ action: string;
4
+ email?: string;
5
+ token?: string;
6
+ }
7
+
8
+ export function maskEmail(email: string): string {
9
+ const [local, domain] = email.split("@");
10
+ if (!local || !domain) {
11
+ return "[invalid-email]";
12
+ }
13
+ return `${local[0]}***@${domain}`;
14
+ }
15
+
16
+ export function redactAuditEntry(entry: AuditEntry): AuditEntry {
17
+ const redacted: AuditEntry = { actor: entry.actor, action: entry.action };
18
+ if (entry.email !== undefined) {
19
+ redacted.email = maskEmail(entry.email);
20
+ }
21
+ if (entry.token !== undefined) {
22
+ redacted.token = "[redacted]";
23
+ }
24
+ return redacted;
25
+ }
@@ -0,0 +1,26 @@
1
+ export interface StockLevel {
2
+ sku: string;
3
+ onHand: number;
4
+ reserved: number;
5
+ }
6
+
7
+ export function availableStock(level: StockLevel): number {
8
+ return level.onHand - level.reserved;
9
+ }
10
+
11
+ export function reserveStock(level: StockLevel, quantity: number): StockLevel {
12
+ if (!Number.isInteger(quantity) || quantity <= 0) {
13
+ throw new Error("Reservation quantity must be a positive integer.");
14
+ }
15
+ if (quantity > availableStock(level)) {
16
+ throw new Error(`Insufficient stock for ${level.sku}.`);
17
+ }
18
+ return { ...level, reserved: level.reserved + quantity };
19
+ }
20
+
21
+ export function releaseReservation(level: StockLevel, quantity: number): StockLevel {
22
+ if (!Number.isInteger(quantity) || quantity <= 0 || quantity > level.reserved) {
23
+ throw new Error("Release quantity must be a positive integer no larger than the reserved amount.");
24
+ }
25
+ return { ...level, reserved: level.reserved - quantity };
26
+ }
@@ -0,0 +1,25 @@
1
+ export interface InvoiceLine {
2
+ unitCents: number;
3
+ quantity: number;
4
+ }
5
+
6
+ export function roundToCents(value: number): number {
7
+ return Math.round(value + Number.EPSILON);
8
+ }
9
+
10
+ export function applyBulkDiscount(subtotalCents: number, totalQuantity: number): number {
11
+ if (totalQuantity >= 100) {
12
+ return roundToCents(subtotalCents * 0.9);
13
+ }
14
+ if (totalQuantity >= 20) {
15
+ return roundToCents(subtotalCents * 0.95);
16
+ }
17
+ return subtotalCents;
18
+ }
19
+
20
+ export function calculateInvoiceTotal(lines: readonly InvoiceLine[], taxRate: number): number {
21
+ const subtotal = lines.reduce((sum, line) => sum + line.unitCents * line.quantity, 0);
22
+ const quantity = lines.reduce((sum, line) => sum + line.quantity, 0);
23
+ const discounted = applyBulkDiscount(subtotal, quantity);
24
+ return discounted + roundToCents(discounted * taxRate);
25
+ }
@@ -0,0 +1,32 @@
1
+ export interface Parcel {
2
+ weightGrams: number;
3
+ destinationZone: "domestic" | "regional" | "international";
4
+ }
5
+
6
+ export interface WeightBand {
7
+ maxGrams: number;
8
+ baseCents: number;
9
+ }
10
+
11
+ export const weightBands: readonly WeightBand[] = [
12
+ { maxGrams: 500, baseCents: 450 },
13
+ { maxGrams: 2000, baseCents: 900 },
14
+ { maxGrams: 10000, baseCents: 1800 }
15
+ ];
16
+
17
+ const zoneSurchargeCents = { domestic: 0, regional: 250, international: 1200 } as const;
18
+
19
+ export function selectWeightBand(weightGrams: number): WeightBand {
20
+ if (!Number.isFinite(weightGrams) || weightGrams <= 0) {
21
+ throw new Error("Parcel weight must be a positive number of grams.");
22
+ }
23
+ const band = weightBands.find((candidate) => weightGrams <= candidate.maxGrams);
24
+ if (!band) {
25
+ throw new Error("Parcel exceeds the maximum supported weight.");
26
+ }
27
+ return band;
28
+ }
29
+
30
+ export function calculateShippingQuote(parcel: Parcel): number {
31
+ return selectWeightBand(parcel.weightGrams).baseCents + zoneSurchargeCents[parcel.destinationZone];
32
+ }
@@ -0,0 +1,17 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { maskEmail, redactAuditEntry } from "../../src/tasks/auditRedaction.js";
3
+
4
+ describe("auditRedaction", () => {
5
+ it("masks the email local part and redacts tokens", () => {
6
+ expect(redactAuditEntry({ actor: "ana", action: "login", email: "ana@example.com", token: "abc" })).toEqual({
7
+ actor: "ana",
8
+ action: "login",
9
+ email: "a***@example.com",
10
+ token: "[redacted]"
11
+ });
12
+ });
13
+
14
+ it("flags malformed emails", () => {
15
+ expect(maskEmail("not-an-email")).toBe("[invalid-email]");
16
+ });
17
+ });
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { availableStock, releaseReservation, reserveStock } from "../../src/tasks/inventoryReservation.js";
3
+
4
+ describe("inventoryReservation", () => {
5
+ it("reserves and releases stock without mutating the input", () => {
6
+ const level = { sku: "sku-1", onHand: 10, reserved: 2 };
7
+ const reserved = reserveStock(level, 3);
8
+ expect(reserved.reserved).toBe(5);
9
+ expect(level.reserved).toBe(2);
10
+ expect(availableStock(releaseReservation(reserved, 5))).toBe(10);
11
+ });
12
+
13
+ it("rejects over-reservation and invalid quantities", () => {
14
+ const level = { sku: "sku-1", onHand: 4, reserved: 1 };
15
+ expect(() => reserveStock(level, 4)).toThrow("Insufficient stock");
16
+ expect(() => reserveStock(level, 0)).toThrow("positive integer");
17
+ expect(() => releaseReservation(level, 2)).toThrow("no larger");
18
+ });
19
+ });
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { applyBulkDiscount, calculateInvoiceTotal } from "../../src/tasks/invoiceTotals.js";
3
+
4
+ describe("invoiceTotals", () => {
5
+ it("applies tiered bulk discounts by quantity", () => {
6
+ expect(applyBulkDiscount(1000, 19)).toBe(1000);
7
+ expect(applyBulkDiscount(1000, 20)).toBe(950);
8
+ expect(applyBulkDiscount(1000, 100)).toBe(900);
9
+ });
10
+
11
+ it("adds rounded tax after the discount", () => {
12
+ expect(calculateInvoiceTotal([{ unitCents: 500, quantity: 2 }], 0.1)).toBe(1100);
13
+ });
14
+ });
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { calculateShippingQuote, selectWeightBand } from "../../src/tasks/shippingQuote.js";
3
+
4
+ describe("shippingQuote", () => {
5
+ it("selects the smallest band that holds the parcel", () => {
6
+ expect(selectWeightBand(500).baseCents).toBe(450);
7
+ expect(selectWeightBand(501).baseCents).toBe(900);
8
+ });
9
+
10
+ it("adds the zone surcharge to the band price", () => {
11
+ expect(calculateShippingQuote({ weightGrams: 300, destinationZone: "domestic" })).toBe(450);
12
+ expect(calculateShippingQuote({ weightGrams: 300, destinationZone: "international" })).toBe(1650);
13
+ });
14
+
15
+ it("rejects non-positive and oversize weights", () => {
16
+ expect(() => selectWeightBand(0)).toThrow("positive");
17
+ expect(() => selectWeightBand(10001)).toThrow("maximum");
18
+ });
19
+ });
@@ -156,11 +156,21 @@ export function renderExperimentRunHelp() {
156
156
  " --case <ids> Comma-separated case ids to run",
157
157
  " --benchmark-project <ids> Comma-separated benchmark project ids to run",
158
158
  "",
159
- "my-dev-kit command override (warm-index-reuse and incremental-change-staleness):",
159
+ "my-dev-kit command override (warm-index-reuse, incremental-change-staleness, and context-window-scaling):",
160
160
  " --kit-command <command> my-dev-kit command used by the selected experiment plugin",
161
- " (defaults: warm-index-reuse uses npx @dailephd/my-dev-kit@latest;",
161
+ " (defaults: warm-index-reuse and context-window-scaling use",
162
+ " npx @dailephd/my-dev-kit@latest;",
162
163
  " incremental-change-staleness uses npx @dailephd/my-dev-kit@1.12.5)",
163
164
  "",
165
+ "context-window-scaling only:",
166
+ " --context-budgets <values> Comma-separated estimated-context-token budgets: 8k, 16k, 32k,",
167
+ " 64k (8192/16384/32768/65536), or positive integers such as",
168
+ " 12000 (default: 8k,16k,32k,64k). Duplicates after",
169
+ " normalization are rejected. Only --out, --case,",
170
+ " --context-budgets, and --kit-command are accepted; --case",
171
+ " selects from the bundled four-case catalog. Self target only.",
172
+ " Generate plots with \"plots generate --experiment <run dir>\".",
173
+ "",
164
174
  "warm-index-reuse only:",
165
175
  " Legacy/default mode uses the deterministic fake agent only;",
166
176
  " agent options below are not accepted by this plugin.",
@@ -290,7 +300,7 @@ export function renderPlotsGenerateHelp() {
290
300
  "Supported inputs:",
291
301
  " - legacy controlled-experiment output directories",
292
302
  " - warm-index-reuse plugin output directories (containing its report.json)",
293
- " Other plugin outputs are not plotted by this command.",
303
+ " - context-window-scaling plugin output directories (containing context-window-scaling-execution.json)",
294
304
  "",
295
305
  "Required:",
296
306
  " --experiment <dir> Path to a supported experiment output directory",
@@ -2,7 +2,7 @@ import path from "node:path";
2
2
  import { parseAgentCommandTemplate } from "../agents/index.js";
3
3
  import { parseAgentId } from "../agents/agentRegistry.js";
4
4
  import { readBenchmarkProjectProfiles, readEvaluationCases } from "../evaluation/index.js";
5
- import { contextStrategyComparisonPlugin, createDefaultExperimentPluginRegistry, getWarmIndexCampaignPreset, incrementalChangeStalenessPlugin, parseWarmIndexCampaignPresetId, resolveExperimentTarget, runExperiment, warmIndexReusePlugin } from "../experiments/index.js";
5
+ import { contextStrategyComparisonPlugin, contextWindowScalingPlugin, createDefaultExperimentPluginRegistry, getWarmIndexCampaignPreset, incrementalChangeStalenessPlugin, parseContextBudgetsCliValue, parseWarmIndexCampaignPresetId, resolveExperimentTarget, runExperiment, warmIndexReusePlugin } from "../experiments/index.js";
6
6
  import { buildDefaultExperimentOutputRoot } from "../experiments/outputPaths.js";
7
7
  import { parsePromptComplexityLevel, parsePromptStrategy } from "../prompts/index.js";
8
8
  import { writePluginExperimentReports } from "../report/index.js";
@@ -32,6 +32,11 @@ import { runWarmIndexCampaignPresentation } from "./runWarmIndexCampaignPresenta
32
32
  // ---------------------------------------------------------------------------
33
33
  const DEFAULT_CASES_RESOURCE = "examples/token-savings-cases.json";
34
34
  const DEFAULT_PROJECT_PROFILES_RESOURCE = "benchmarks/contracts/benchmark-project-profiles.json";
35
+ // context-window-scaling owns one frozen bundled case catalog; its fixed project is referenced by the
36
+ // catalog's package-relative targetRoot, so both resolve from the package root, never the cwd.
37
+ const CONTEXT_WINDOW_SCALING_CASES_RESOURCE = "benchmarks/contracts/context-window-scaling-cases.json";
38
+ // Options the context-window-scaling plugin accepts; every other flag is rejected, not ignored.
39
+ const CONTEXT_WINDOW_SCALING_ALLOWED_FLAGS = ["--experiment", "--out", "--case", "--context-budgets", "--kit-command"];
35
40
  export async function runExperimentRunCommandFromArgs(argv, options = {}) {
36
41
  try {
37
42
  const args = parseRunExperimentArgs(argv);
@@ -52,7 +57,7 @@ export async function runExperimentRunCommandFromArgs(argv, options = {}) {
52
57
  registry,
53
58
  targetPath: args.targetPath,
54
59
  outputRoot,
55
- config: args.config,
60
+ config: pluginConfigFor(args),
56
61
  inputs,
57
62
  toolRoot,
58
63
  runId
@@ -142,9 +147,13 @@ export function parseRunExperimentArgs(argv) {
142
147
  let includeRealAgents;
143
148
  let kitCommand;
144
149
  let campaignPreset;
150
+ let contextBudgets;
151
+ const seenFlags = [];
145
152
  const commandTemplates = {};
146
153
  for (let index = 0; index < argv.length; index += 1) {
147
154
  const arg = argv[index];
155
+ if (arg !== undefined && arg.startsWith("--"))
156
+ seenFlags.push(arg);
148
157
  if (arg === "--experiment") {
149
158
  experimentId = readRequiredValue(argv, ++index, "--experiment");
150
159
  }
@@ -202,6 +211,9 @@ export function parseRunExperimentArgs(argv) {
202
211
  else if (arg === "--kit-command") {
203
212
  kitCommand = readRequiredValue(argv, ++index, "--kit-command");
204
213
  }
214
+ else if (arg === "--context-budgets") {
215
+ contextBudgets = parseContextBudgetsCliValue(readRequiredValue(argv, ++index, "--context-budgets"));
216
+ }
205
217
  else if (arg === "--campaign") {
206
218
  campaignPreset = parseWarmIndexCampaignPresetId(readRequiredValue(argv, ++index, "--campaign"));
207
219
  }
@@ -216,7 +228,23 @@ export function parseRunExperimentArgs(argv) {
216
228
  if (!experimentId) {
217
229
  throw new Error("Usage: --experiment <id> [--target <path>] [--out <directory>]");
218
230
  }
219
- const KIT_COMMAND_PLUGIN_IDS = [warmIndexReusePlugin.metadata.id, incrementalChangeStalenessPlugin.metadata.id];
231
+ const KIT_COMMAND_PLUGIN_IDS = [
232
+ warmIndexReusePlugin.metadata.id,
233
+ incrementalChangeStalenessPlugin.metadata.id,
234
+ contextWindowScalingPlugin.metadata.id
235
+ ];
236
+ if (contextBudgets !== undefined && experimentId !== contextWindowScalingPlugin.metadata.id) {
237
+ throw new Error(`--context-budgets is only supported for --experiment ${contextWindowScalingPlugin.metadata.id}.`);
238
+ }
239
+ if (experimentId === contextWindowScalingPlugin.metadata.id) {
240
+ const unsupported = [...new Set(seenFlags.filter((flag) => !CONTEXT_WINDOW_SCALING_ALLOWED_FLAGS.includes(flag)))];
241
+ if (unsupported.length > 0) {
242
+ throw new Error(`${unsupported.join(", ")} ${unsupported.length === 1 ? "is" : "are"} not supported for --experiment ${experimentId}; supported options: ${CONTEXT_WINDOW_SCALING_ALLOWED_FLAGS.join(", ")}.`);
243
+ }
244
+ if (seenFlags.includes("--case") && caseIds.length === 0) {
245
+ throw new Error("--case must list at least one case id.");
246
+ }
247
+ }
220
248
  if (kitCommand !== undefined && !KIT_COMMAND_PLUGIN_IDS.includes(experimentId)) {
221
249
  throw new Error(`--kit-command is only supported for --experiment ${KIT_COMMAND_PLUGIN_IDS.join(" or ")}.`);
222
250
  }
@@ -253,7 +281,8 @@ export function parseRunExperimentArgs(argv) {
253
281
  includeRealAgents,
254
282
  commandTemplates: Object.keys(commandTemplates).length > 0 ? commandTemplates : undefined,
255
283
  kitCommand,
256
- campaignPreset
284
+ campaignPreset,
285
+ contextBudgets
257
286
  })
258
287
  };
259
288
  }
@@ -297,8 +326,39 @@ async function loadPluginInputs(args, toolRoot, context) {
297
326
  }
298
327
  return loadCasesAndProjectProfiles(args, toolRoot, context);
299
328
  }
329
+ if (args.experimentId === contextWindowScalingPlugin.metadata.id) {
330
+ return loadContextWindowScalingInputs(args, toolRoot, context);
331
+ }
300
332
  return undefined;
301
333
  }
334
+ // --case is a selection over the frozen bundled catalog (catalog order, not argument order);
335
+ // the rest of the CLI config is the plugin's own ContextWindowScalingConfig.
336
+ function pluginConfigFor(args) {
337
+ if (args.experimentId !== contextWindowScalingPlugin.metadata.id)
338
+ return args.config;
339
+ const { caseIds: _caseIds, ...config } = args.config;
340
+ return config;
341
+ }
342
+ async function loadContextWindowScalingInputs(args, toolRoot, context) {
343
+ const validation = contextWindowScalingPlugin.validateConfig(pluginConfigFor(args));
344
+ if (!validation.valid || !validation.config) {
345
+ throw new Error(`Invalid context window scaling config: ${validation.errors.join("; ")}`);
346
+ }
347
+ const catalog = await readEvaluationCases(resolvePackageResource(context, CONTEXT_WINDOW_SCALING_CASES_RESOURCE), toolRoot);
348
+ const requested = args.config.caseIds;
349
+ if (requested === undefined)
350
+ return { cases: catalog, env: process.env };
351
+ const duplicates = [...new Set(requested.filter((id, position) => requested.indexOf(id) !== position))];
352
+ if (duplicates.length > 0) {
353
+ throw new Error(`--case contains duplicate case id(s): ${duplicates.join(", ")}.`);
354
+ }
355
+ const known = new Set(catalog.map((evaluationCase) => evaluationCase.id));
356
+ const unknown = requested.filter((id) => !known.has(id));
357
+ if (unknown.length > 0) {
358
+ throw new Error(`--case contains unknown case id(s): ${unknown.join(", ")}. Expected one of ${catalog.map((evaluationCase) => evaluationCase.id).join(", ")}.`);
359
+ }
360
+ return { cases: catalog.filter((evaluationCase) => requested.includes(evaluationCase.id)), env: process.env };
361
+ }
302
362
  // Shared by both registered plugins: explicit paths resolve against toolRoot, defaults come from
303
363
  // bundled package resources so they do not depend on the invocation cwd.
304
364
  async function loadCasesAndProjectProfiles(args, toolRoot, context) {
@@ -1,5 +1,6 @@
1
1
  import { ExperimentPluginRegistry } from "./registry.js";
2
2
  import { contextStrategyComparisonPlugin } from "./plugins/contextStrategyComparison/index.js";
3
+ import { contextWindowScalingPlugin } from "./plugins/contextWindowScaling/index.js";
3
4
  import { incrementalChangeStalenessPlugin } from "./plugins/incrementalChangeStaleness/index.js";
4
5
  import { warmIndexReusePlugin } from "./plugins/warmIndexReuse/index.js";
5
6
  export function createDefaultExperimentPluginRegistry() {
@@ -7,5 +8,6 @@ export function createDefaultExperimentPluginRegistry() {
7
8
  registry.register(contextStrategyComparisonPlugin);
8
9
  registry.register(warmIndexReusePlugin);
9
10
  registry.register(incrementalChangeStalenessPlugin);
11
+ registry.register(contextWindowScalingPlugin);
10
12
  return registry;
11
13
  }