@dev-sergeev/datalab-kit 0.1.4 → 0.1.6

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 (54) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +47 -4
  3. package/THIRD_PARTY_NOTICES.md +3 -0
  4. package/dist/datalab-provider.d.ts +2 -0
  5. package/dist/datalab-provider.js +45 -0
  6. package/dist/extension.js +4 -0
  7. package/dist/skills.d.ts +2 -0
  8. package/dist/skills.js +54 -0
  9. package/docs/adr/0003-datalab-environment-provider.md +11 -0
  10. package/package.json +36 -9
  11. package/skills/init/SKILL.md +31 -0
  12. package/skills/skill-creator/LICENSE.txt +202 -0
  13. package/skills/skill-creator/SKILL.md +610 -0
  14. package/skills/skill-creator/agents/analyzer.md +291 -0
  15. package/skills/skill-creator/agents/comparator.md +213 -0
  16. package/skills/skill-creator/agents/grader.md +234 -0
  17. package/skills/skill-creator/assets/eval_review.html +146 -0
  18. package/skills/skill-creator/eval-viewer/generate_review.py +453 -0
  19. package/skills/skill-creator/eval-viewer/viewer.html +1329 -0
  20. package/skills/skill-creator/references/schemas.md +521 -0
  21. package/skills/skill-creator/scripts/aggregate_benchmark.py +415 -0
  22. package/skills/skill-creator/scripts/generate_report.py +329 -0
  23. package/skills/skill-creator/scripts/improve_description.py +225 -0
  24. package/skills/skill-creator/scripts/package_skill.py +136 -0
  25. package/skills/skill-creator/scripts/pi_runtime.py +177 -0
  26. package/skills/skill-creator/scripts/quick_validate.py +107 -0
  27. package/skills/skill-creator/scripts/run_eval.py +215 -0
  28. package/skills/skill-creator/scripts/run_loop.py +334 -0
  29. package/skills/skill-creator/scripts/utils.py +41 -0
  30. package/node_modules/node-addon-api/common 2.gypi +0 -21
  31. package/node_modules/node-addon-api/except 2.gypi +0 -25
  32. package/node_modules/node-addon-api/napi 2.h +0 -3463
  33. package/node_modules/node-addon-api/napi-inl 2.h +0 -7250
  34. package/node_modules/node-addon-api/napi-inl.deprecated 2.h +0 -186
  35. package/node_modules/node-addon-api/node_addon_api 2.gyp +0 -42
  36. package/node_modules/node-addon-api/node_api 2.gyp +0 -9
  37. package/node_modules/node-addon-api/noexcept 2.gypi +0 -26
  38. package/node_modules/pi-toggle-skills/toggle-skills 2.ts +0 -316
  39. package/node_modules/pi-toggle-skills/vitest.config 2.ts +0 -15
  40. package/node_modules/sprintf-js/.npmignore 2 +0 -1
  41. package/node_modules/sprintf-js/LICENSE 2 +0 -24
  42. package/node_modules/sprintf-js/README 2.md +0 -88
  43. package/node_modules/sprintf-js/bower 2.json +0 -14
  44. package/node_modules/sprintf-js/gruntfile 2.js +0 -36
  45. package/node_modules/sprintf-js/package 2.json +0 -22
  46. package/node_modules/tree-sitter-bash/tree-sitter-bash 2.wasm +0 -0
  47. package/node_modules/typebox/license 2 +0 -23
  48. package/node_modules/typebox/package 2.json +0 -87
  49. package/node_modules/typebox/readme 2.md +0 -370
  50. package/node_modules/zod/compile 2.cjs +0 -96
  51. package/node_modules/zod/compile 2.js +0 -52
  52. package/node_modules/zod/index 2.cjs +0 -52
  53. package/node_modules/zod/index 2.js +0 -7
  54. /package/{node_modules/node-addon-api/nothing 2.c → skills/skill-creator/scripts/__init__.py} +0 -0
@@ -0,0 +1,521 @@
1
+ # JSON Schemas
2
+
3
+ > Modified for Datalab Kit/Pi from Anthropic's skill-creator,
4
+ > revision `dbd4588f9e1033efb41dad4bef2f7947c8993d44`.
5
+ > Changes: Pi telemetry, writable workspace layout, and evaluation field guidance.
6
+ > See [Apache-2.0 license](../LICENSE.txt) and [source attribution](../SKILL.md).
7
+
8
+ ## Contents
9
+
10
+ - [Workspace layout](#workspace-layout)
11
+ - [evals.json](#evalsjson)
12
+ - [eval_metadata.json](#eval_metadatajson)
13
+ - [history.json](#historyjson)
14
+ - [grading.json](#gradingjson)
15
+ - [metrics.json](#metricsjson)
16
+ - [timing.json](#timingjson)
17
+ - [benchmark.json](#benchmarkjson)
18
+ - [comparison.json](#comparisonjson)
19
+ - [analysis.json](#analysisjson)
20
+
21
+ ## Workspace layout
22
+
23
+ Use a writable workspace outside the installed skill-creator package:
24
+
25
+ ```text
26
+ <workspace>/
27
+ candidate/<skill-name>/SKILL.md
28
+ skill-snapshot/<skill-name>/SKILL.md
29
+ iteration-1/
30
+ eval-1-descriptive-name/
31
+ eval_metadata.json
32
+ with_skill/run-1/
33
+ transcript.jsonl
34
+ stderr.log
35
+ timing.json
36
+ grading.json
37
+ outputs/
38
+ without_skill/run-1/
39
+ transcript.jsonl
40
+ stderr.log
41
+ timing.json
42
+ grading.json
43
+ outputs/
44
+ benchmark.json
45
+ benchmark.md
46
+ feedback.json
47
+ ```
48
+
49
+ Repeat under `run-2/`, `run-3/`, etc. for variance measurements; `run-1/` is
50
+ required even for a single run because aggregation searches `run-*` directories.
51
+ For an update, `without_skill` contains the old-skill snapshot execution; record
52
+ that baseline identity explicitly in metadata and benchmark notes. It does not
53
+ mean that the old-skill arm lacked a skill.
54
+
55
+ Examples below illustrate values, not telemetry that every Pi provider supplies.
56
+ Omit unavailable measurements; never substitute character counts for tokens or
57
+ zero for missing usage. Keep executor usage/time separate from grading and
58
+ orchestration. Use absolute paths in executor prompts; keep raw Pi JSONL for
59
+ auditing and derive metrics only from complete events.
60
+
61
+ This document defines the JSON schemas used by skill-creator.
62
+
63
+ ---
64
+
65
+ ## evals.json
66
+
67
+ Defines the evals for a skill. Located at `evals/evals.json` within the writable candidate skill, not the installed creator package.
68
+
69
+ ```json
70
+ {
71
+ "skill_name": "example-skill",
72
+ "evals": [
73
+ {
74
+ "id": 1,
75
+ "prompt": "User's example prompt",
76
+ "expected_output": "Description of expected result",
77
+ "files": ["evals/files/sample1.pdf"],
78
+ "expectations": [
79
+ "The output includes X",
80
+ "The skill used script Y"
81
+ ]
82
+ }
83
+ ]
84
+ }
85
+ ```
86
+
87
+ **Fields:**
88
+ - `skill_name`: Name matching the skill's frontmatter
89
+ - `evals[].id`: Unique integer identifier
90
+ - `evals[].prompt`: The task to execute
91
+ - `evals[].expected_output`: Human-readable description of success
92
+ - `evals[].files`: Optional list of input file paths (relative to skill root)
93
+ - `evals[].expectations`: List of verifiable statements
94
+
95
+ The main workflow calls these statements "assertions". Store them as
96
+ `expectations` here and copy the strings into `assertions` in eval_metadata.json.
97
+
98
+ ---
99
+
100
+ ## eval_metadata.json
101
+
102
+ Located at `<workspace>/iteration-N/eval-ID-name/eval_metadata.json`.
103
+
104
+ ```json
105
+ {
106
+ "eval_id": 1,
107
+ "eval_name": "table-extraction",
108
+ "prompt": "Extract the line items from the supplied invoice into a CSV.",
109
+ "assertions": ["Every invoice line item is present in the CSV"],
110
+ "baseline": "original skill snapshot"
111
+ }
112
+ ```
113
+
114
+ `eval_id`, `eval_name`, `prompt`, and `assertions` support the viewer and grading
115
+ workflow. `baseline` is optional human-readable context: use `"no skill"` for a
116
+ new skill or identify the snapshot used for an update. Keep this metadata outside
117
+ executor outputs so the executor cannot accidentally consume expected answers.
118
+
119
+ ---
120
+
121
+ ## history.json
122
+
123
+ Tracks version progression in Improve mode. Located at workspace root.
124
+
125
+ ```json
126
+ {
127
+ "started_at": "2026-01-15T10:30:00Z",
128
+ "skill_name": "pdf",
129
+ "current_best": "v2",
130
+ "iterations": [
131
+ {
132
+ "version": "v0",
133
+ "parent": null,
134
+ "expectation_pass_rate": 0.65,
135
+ "grading_result": "baseline",
136
+ "is_current_best": false
137
+ },
138
+ {
139
+ "version": "v1",
140
+ "parent": "v0",
141
+ "expectation_pass_rate": 0.75,
142
+ "grading_result": "won",
143
+ "is_current_best": false
144
+ },
145
+ {
146
+ "version": "v2",
147
+ "parent": "v1",
148
+ "expectation_pass_rate": 0.85,
149
+ "grading_result": "won",
150
+ "is_current_best": true
151
+ }
152
+ ]
153
+ }
154
+ ```
155
+
156
+ **Fields:**
157
+ - `started_at`: ISO timestamp of when improvement started
158
+ - `skill_name`: Name of the skill being improved
159
+ - `current_best`: Version identifier of the best performer
160
+ - `iterations[].version`: Version identifier (v0, v1, ...)
161
+ - `iterations[].parent`: Parent version this was derived from
162
+ - `iterations[].expectation_pass_rate`: Pass rate from grading
163
+ - `iterations[].grading_result`: "baseline", "won", "lost", or "tie"
164
+ - `iterations[].is_current_best`: Whether this is the current best version
165
+
166
+ ---
167
+
168
+ ## grading.json
169
+
170
+ Output from the grader agent. Located at `<run-dir>/grading.json`.
171
+
172
+ ```json
173
+ {
174
+ "expectations": [
175
+ {
176
+ "text": "The output includes the name 'John Smith'",
177
+ "passed": true,
178
+ "evidence": "Found in transcript Step 3: 'Extracted names: John Smith, Sarah Johnson'"
179
+ },
180
+ {
181
+ "text": "The spreadsheet has a SUM formula in cell B10",
182
+ "passed": false,
183
+ "evidence": "No spreadsheet was created. The output was a text file."
184
+ }
185
+ ],
186
+ "summary": {
187
+ "passed": 2,
188
+ "failed": 1,
189
+ "total": 3,
190
+ "pass_rate": 0.67
191
+ },
192
+ "execution_metrics": {
193
+ "tool_calls": {
194
+ "read": 5,
195
+ "write": 2,
196
+ "bash": 8
197
+ },
198
+ "total_tool_calls": 15,
199
+ "total_steps": 6,
200
+ "errors_encountered": 0,
201
+ "output_chars": 12450,
202
+ "transcript_chars": 3200
203
+ },
204
+ "timing": {
205
+ "executor_duration_seconds": 165.0,
206
+ "grader_duration_seconds": 26.0,
207
+ "total_duration_seconds": 165.0
208
+ },
209
+ "claims": [
210
+ {
211
+ "claim": "The form has 12 fillable fields",
212
+ "type": "factual",
213
+ "verified": true,
214
+ "evidence": "Counted 12 fields in field_info.json"
215
+ }
216
+ ],
217
+ "user_notes_summary": {
218
+ "uncertainties": ["Used 2023 data, may be stale"],
219
+ "needs_review": [],
220
+ "workarounds": ["Fell back to text overlay for non-fillable fields"]
221
+ },
222
+ "eval_feedback": {
223
+ "suggestions": [
224
+ {
225
+ "assertion": "The output includes the name 'John Smith'",
226
+ "reason": "A hallucinated document that mentions the name would also pass"
227
+ }
228
+ ],
229
+ "overall": "Assertions check presence but not correctness."
230
+ }
231
+ }
232
+ ```
233
+
234
+ **Fields:**
235
+ - `expectations[]`: Graded expectations with evidence
236
+ - `summary`: Aggregate pass/fail counts
237
+ - `execution_metrics`: Optional recorded tool usage and output size (from executor's metrics.json or measured JSONL events); omit when unavailable
238
+ - `timing`: Optional measured executor wall time (from timing.json); do not include grader/orchestrator usage in benchmark time
239
+ - `claims`: Extracted and verified claims from the output
240
+ - `user_notes_summary`: Issues flagged by the executor
241
+ - `eval_feedback`: (optional) Improvement suggestions for the evals, only present when the grader identifies issues worth raising
242
+
243
+ ---
244
+
245
+ ## metrics.json
246
+
247
+ Output from the executor agent. Located at `<run-dir>/outputs/metrics.json`.
248
+
249
+ ```json
250
+ {
251
+ "tool_calls": {
252
+ "read": 5,
253
+ "write": 2,
254
+ "bash": 8,
255
+ "edit": 1,
256
+ "find": 2,
257
+ "grep": 0
258
+ },
259
+ "total_tool_calls": 18,
260
+ "total_steps": 6,
261
+ "files_created": ["filled_form.pdf", "field_values.json"],
262
+ "errors_encountered": 0,
263
+ "output_chars": 12450,
264
+ "transcript_chars": 3200
265
+ }
266
+ ```
267
+
268
+ **Fields:**
269
+ - `tool_calls`: Count per tool type
270
+ - `total_tool_calls`: Sum of all tool calls
271
+ - `total_steps`: Number of major execution steps
272
+ - `files_created`: List of output files created
273
+ - `errors_encountered`: Number of errors during execution
274
+ - `output_chars`: Total character count of output files
275
+ - `transcript_chars`: Character count of transcript
276
+
277
+ Pi emits `tool_execution_start`/`tool_execution_end` events with `toolName`,
278
+ `toolCallId`, and (on completion) `isError`. Count each executed call once.
279
+ `total_steps` is an optional workflow-level count, not a native Pi metric.
280
+ File sizes and created-file lists can be measured from the outputs; they are not
281
+ automatically emitted by Pi. Include only measurements actually collected.
282
+
283
+ ---
284
+
285
+ ## timing.json
286
+
287
+ Wall clock timing for a run. Located at `<run-dir>/timing.json`.
288
+
289
+ **How to capture:** Measure the fresh executor Pi process using a monotonic clock. For tokens, sum `message.usage.totalTokens` from completed assistant `message_end` events in that executor's JSONL, once per message. Preserve the JSONL so this can be audited or recovered. Do not use rounded subagent summaries or assume completion notifications contain numeric `total_tokens`/`duration_ms`. Pi subagent lifetime usage is a different accounting surface and can include orchestration; do not mix it into executor measurements.
290
+
291
+ ```json
292
+ {
293
+ "total_tokens": 84852,
294
+ "duration_ms": 23332,
295
+ "total_duration_seconds": 23.332,
296
+ "executor_start": "2026-01-15T10:30:00Z",
297
+ "executor_end": "2026-01-15T10:30:23.332Z",
298
+ "executor_duration_seconds": 23.332
299
+ }
300
+ ```
301
+
302
+ `total_tokens` is optional when the provider supplies no usable token telemetry.
303
+ The start/end timestamps are optional context; elapsed durations should come
304
+ from a monotonic clock. If separately measuring grading, use explicitly named
305
+ grader fields, but keep `total_duration_seconds` as executor time for benchmark
306
+ compatibility. A provider-reported zero is not the same as missing telemetry.
307
+
308
+ ---
309
+
310
+ ## benchmark.json
311
+
312
+ Output from benchmark aggregation. Located at `<workspace>/iteration-N/benchmark.json` (or the explicitly selected benchmark directory).
313
+
314
+ ```json
315
+ {
316
+ "metadata": {
317
+ "skill_name": "pdf",
318
+ "skill_path": "/path/to/pdf",
319
+ "executor_model": "provider/model-id",
320
+ "analyzer_model": "most-capable-model",
321
+ "timestamp": "2026-01-15T10:30:00Z",
322
+ "evals_run": [1, 2, 3],
323
+ "runs_per_configuration": 3
324
+ },
325
+
326
+ "runs": [
327
+ {
328
+ "eval_id": 1,
329
+ "eval_name": "Ocean",
330
+ "configuration": "with_skill",
331
+ "run_number": 1,
332
+ "result": {
333
+ "pass_rate": 0.85,
334
+ "passed": 6,
335
+ "failed": 1,
336
+ "total": 7,
337
+ "time_seconds": 42.5,
338
+ "tokens": 3800,
339
+ "tool_calls": 18,
340
+ "errors": 0
341
+ },
342
+ "expectations": [
343
+ {"text": "...", "passed": true, "evidence": "..."}
344
+ ],
345
+ "notes": [
346
+ "Used 2023 data, may be stale",
347
+ "Fell back to text overlay for non-fillable fields"
348
+ ]
349
+ }
350
+ ],
351
+
352
+ "run_summary": {
353
+ "with_skill": {
354
+ "pass_rate": {"mean": 0.85, "stddev": 0.05, "min": 0.80, "max": 0.90},
355
+ "time_seconds": {"mean": 45.0, "stddev": 12.0, "min": 32.0, "max": 58.0},
356
+ "tokens": {"mean": 3800, "stddev": 400, "min": 3200, "max": 4100}
357
+ },
358
+ "without_skill": {
359
+ "pass_rate": {"mean": 0.35, "stddev": 0.08, "min": 0.28, "max": 0.45},
360
+ "time_seconds": {"mean": 32.0, "stddev": 8.0, "min": 24.0, "max": 42.0},
361
+ "tokens": {"mean": 2100, "stddev": 300, "min": 1800, "max": 2500}
362
+ },
363
+ "delta": {
364
+ "pass_rate": "+0.50",
365
+ "time_seconds": "+13.0",
366
+ "tokens": "+1700"
367
+ }
368
+ },
369
+
370
+ "notes": [
371
+ "Assertion 'Output is a PDF file' passes 100% in both configurations - may not differentiate skill value",
372
+ "Eval 3 shows high variance (50% ± 40%) - may be flaky or model-dependent",
373
+ "Without-skill runs consistently fail on table extraction expectations",
374
+ "Skill adds 13s average execution time but improves pass rate by 50%"
375
+ ]
376
+ }
377
+ ```
378
+
379
+ **Fields:**
380
+ - `metadata`: Information about the benchmark run
381
+ - `skill_name`: Name of the skill
382
+ - `timestamp`: When the benchmark was run
383
+ - `evals_run`: List of eval names or IDs
384
+ - `runs_per_configuration`: Observed repetitions per evaluation/configuration pair; null when counts differ or are unavailable. Per-run records remain authoritative.
385
+ - `runs[]`: Individual run results
386
+ - `eval_id`: Numeric eval identifier
387
+ - `eval_name`: Human-readable eval name (used as section header in the viewer)
388
+ - `configuration`: Use `"with_skill"` or `"without_skill"` for the documented comparison workflow (the viewer uses these names for grouping and color coding). An old-skill baseline still uses `"without_skill"` with its real identity explained in notes.
389
+ - `run_number`: Integer run number (1, 2, 3...)
390
+ - `result`: Nested object with graded `pass_rate`, `passed`, `total`; `time_seconds`, `tokens`, tool counts, and errors are measured numbers or `null` when unavailable
391
+ - `run_summary`: Statistical aggregates per configuration
392
+ - `with_skill` / `without_skill`: Each contains metric objects with `mean`, `stddev`, `min`, and `max`; absent measurements produce null statistic values, not zero usage
393
+ - `delta`: Difference strings like `"+0.50"`, `"+13.0"`, `"+1700"`, or `null` when unavailable
394
+ - `notes`: Freeform observations from the analyzer
395
+
396
+ **Important:** The viewer reads these field names exactly. Using `config` instead of `configuration`, or putting `pass_rate` at the top level of a run instead of nested under `result`, will cause the viewer to show empty/zero values. Always reference this schema when generating benchmark.json manually.
397
+
398
+ ---
399
+
400
+ ## comparison.json
401
+
402
+ Output from blind comparator. Located at `<grading-dir>/comparison-N.json`.
403
+
404
+ ```json
405
+ {
406
+ "winner": "A",
407
+ "reasoning": "Output A provides a complete solution with proper formatting and all required fields. Output B is missing the date field and has formatting inconsistencies.",
408
+ "rubric": {
409
+ "A": {
410
+ "content": {
411
+ "correctness": 5,
412
+ "completeness": 5,
413
+ "accuracy": 4
414
+ },
415
+ "structure": {
416
+ "organization": 4,
417
+ "formatting": 5,
418
+ "usability": 4
419
+ },
420
+ "content_score": 4.7,
421
+ "structure_score": 4.3,
422
+ "overall_score": 9.0
423
+ },
424
+ "B": {
425
+ "content": {
426
+ "correctness": 3,
427
+ "completeness": 2,
428
+ "accuracy": 3
429
+ },
430
+ "structure": {
431
+ "organization": 3,
432
+ "formatting": 2,
433
+ "usability": 3
434
+ },
435
+ "content_score": 2.7,
436
+ "structure_score": 2.7,
437
+ "overall_score": 5.4
438
+ }
439
+ },
440
+ "output_quality": {
441
+ "A": {
442
+ "score": 9,
443
+ "strengths": ["Complete solution", "Well-formatted", "All fields present"],
444
+ "weaknesses": ["Minor style inconsistency in header"]
445
+ },
446
+ "B": {
447
+ "score": 5,
448
+ "strengths": ["Readable output", "Correct basic structure"],
449
+ "weaknesses": ["Missing date field", "Formatting inconsistencies", "Partial data extraction"]
450
+ }
451
+ },
452
+ "expectation_results": {
453
+ "A": {
454
+ "passed": 4,
455
+ "total": 5,
456
+ "pass_rate": 0.80,
457
+ "details": [
458
+ {"text": "Output includes name", "passed": true}
459
+ ]
460
+ },
461
+ "B": {
462
+ "passed": 3,
463
+ "total": 5,
464
+ "pass_rate": 0.60,
465
+ "details": [
466
+ {"text": "Output includes name", "passed": true}
467
+ ]
468
+ }
469
+ }
470
+ }
471
+ ```
472
+
473
+ ---
474
+
475
+ ## analysis.json
476
+
477
+ Output from post-hoc analyzer. Located at `<grading-dir>/analysis.json`.
478
+
479
+ ```json
480
+ {
481
+ "comparison_summary": {
482
+ "winner": "A",
483
+ "winner_skill": "path/to/winner/skill",
484
+ "loser_skill": "path/to/loser/skill",
485
+ "comparator_reasoning": "Brief summary of why comparator chose winner"
486
+ },
487
+ "winner_strengths": [
488
+ "Clear step-by-step instructions for handling multi-page documents",
489
+ "Included validation script that caught formatting errors"
490
+ ],
491
+ "loser_weaknesses": [
492
+ "Vague instruction 'process the document appropriately' led to inconsistent behavior",
493
+ "No script for validation, agent had to improvise"
494
+ ],
495
+ "instruction_following": {
496
+ "winner": {
497
+ "score": 9,
498
+ "issues": ["Minor: skipped optional logging step"]
499
+ },
500
+ "loser": {
501
+ "score": 6,
502
+ "issues": [
503
+ "Did not use the skill's formatting template",
504
+ "Invented own approach instead of following step 3"
505
+ ]
506
+ }
507
+ },
508
+ "improvement_suggestions": [
509
+ {
510
+ "priority": "high",
511
+ "category": "instructions",
512
+ "suggestion": "Replace 'process the document appropriately' with explicit steps",
513
+ "expected_impact": "Would eliminate ambiguity that caused inconsistent behavior"
514
+ }
515
+ ],
516
+ "transcript_insights": {
517
+ "winner_execution_pattern": "Read skill -> Followed 5-step process -> Used validation script",
518
+ "loser_execution_pattern": "Read skill -> Unclear on approach -> Tried 3 different methods"
519
+ }
520
+ }
521
+ ```