@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.6 — 2026-10-15
4
+
5
+ - В пакет включены навыки `init` и `skill-creator`, доступные во всех проектах после глобальной установки набора. Добавлены короткие команды `/init` и `/skill-creator`; явное отключение ресурсов Pi сохраняет приоритет.
6
+ - `/init` изучает проект и создаёт или актуализирует `AGENTS.md`, сохраняя существующие инструкции.
7
+ - `skill-creator` перенесён из Anthropic (`dbd4588f9e1033efb41dad4bef2f7947c8993d44`, Apache-2.0) и полностью адаптирован под Pi: создание и обновление навыков, сравнение с baseline, benchmark/viewer, обратная связь и оптимизация описания. Claude Code не требуется; Python-утилитам нужны Python 3.10+ и PyYAML.
8
+ - Новые навыки по умолчанию размещаются глобально в каталоге агента Pi; явно заданный путь важнее. Рабочие результаты не записываются в каталог установленного пакета.
9
+ - Адаптация учитывает `disable-model-invocation`, отчёты без holdout, вложенные каталоги запусков и фактическое число повторений. Viewer выбирает другой порт, если заданный занят, не завершая чужие процессы. Ошибки модели и таймауты не считаются успешными отрицательными результатами оценки.
10
+ - Добавлены проверки Python-ресурсов в CI Linux/macOS и регрессии для совместимости метаданных, отчётов и viewer. Уточнена проверка локального npm-архива для Pi 0.85.1.
11
+ - Проверка полного времени запроса `elapsed` переведена на управляемые часы вместо реальных задержек, чтобы исключить гонку первого тика на CI; код компонента не менялся.
12
+ - Короткие команды используют штатный pipeline ввода Pi: CLI дожидается выполнения и возвращает ошибку авторизации корректным exit status. Одноимённые пользовательские команды и prompt templates сохраняют приоритет.
13
+
14
+ ## 0.1.5
15
+
16
+ - GigaChat загружается через штатную точку входа расширения с интерактивным мастером `/gigachat`; пользовательские подключения и настройки сохраняются. Lockfile обновлён до `pi-gigachat` 0.6.1 без изменения upstream-кода; зависимость остаётся `latest`. Прежние утверждения для 0.5.1 о встроенных моделях и автоматическом default больше не применяются.
17
+ - Добавлен отдельный провайдер `DataLab` с моделями `glm-5.2 [DataLab]` и `Qwen3.5-397b [DataLab]`, только когда `GIGACHAT_API_URL` и `JPY_API_TOKEN` обе непусты после trim. Адрес задаёт корень API, токен передаётся как Bearer без сохранения в `auth.json`; `.env` автоматически не загружается, изменения окружения требуют перезапуска Pi.
18
+ - DataLab не меняет текущую модель или сохранённые defaults, не запрашивает каталог моделей и не проверяет сервер при запуске. Ошибки сервера возвращаются при обычном запросе к модели. Решение и границы ответственности описаны в ADR 0003.
19
+
3
20
  ## 0.1.4 — 2026-10-14
4
21
 
5
22
  - GigaChat загружается через штатную точку входа расширения: доступны `/login`, мастер `/gigachat`, встроенные модели и собственная политика выбора default-модели. Lockfile обновлён до `pi-gigachat` 0.5.1; зависимость остаётся `latest`.
package/README.md CHANGED
@@ -17,9 +17,12 @@ pi
17
17
  npm ci --ignore-scripts --legacy-peer-deps
18
18
  npm run build
19
19
  npm pack
20
- pi install ./dev-sergeev-datalab-kit-0.1.4.tgz
20
+ npm install --prefix /tmp/datalab-kit-local --legacy-peer-deps ./dev-sergeev-datalab-kit-0.1.6.tgz
21
+ pi install /tmp/datalab-kit-local/node_modules/@dev-sergeev/datalab-kit
21
22
  ```
22
23
 
24
+ Локальный архив сначала устанавливается через npm; Pi подключает полученный каталог пакета. В Pi 0.85.1 прямой путь к `.tgz` воспринимается как путь расширения, а не npm-архив.
25
+
23
26
  Целевые системы — Linux и macOS; локальные интеграционные проверки выполнены на Linux. Проверка macOS включена в CI. Windows пока не заявляется.
24
27
 
25
28
  ## Состав
@@ -41,7 +44,28 @@ pi install ./dev-sergeev-datalab-kit-0.1.4.tgz
41
44
 
42
45
  Одиннадцать фиксированных компонентов включены в архив npm вместе с их зависимостями. GigaChat устанавливается отдельно без закрепления версии.
43
46
 
44
- Datalab Kit загружает штатное расширение GigaChat, не заменяя его регистрацию только провайдером. Сохраняются встроенные модели и собственная политика выбора модели пакета. Для авторизации используйте `/login` → GigaChat; `/gigachat` открывает мастер подключений, авторизации и выбора моделей из каталогов серверов. Основную модель выбирают через `/model`.
47
+ Datalab Kit загружает штатное расширение GigaChat 0.6.1 без изменения его кода. `/gigachat` открывает интерактивный мастер подключений, авторизации и выбора моделей из каталогов серверов; это не интерфейс настройки через аргументы. Сохранённые подключения и пользовательские настройки остаются под управлением upstream. Основную модель выбирают через `/model`.
48
+
49
+ ## DataLab из окружения
50
+
51
+ Дополнительно Datalab Kit регистрирует отдельный провайдер с идентификатором и именем `DataLab`, только если **обе** переменные окружения процесса Pi — `GIGACHAT_API_URL` и `JPY_API_TOKEN` — непусты после удаления пробелов по краям. Если хотя бы одна отсутствует, пуста или содержит только пробелы, провайдер и его модели не появляются в `/model`.
52
+
53
+ Задайте окружение до запуска Pi, например:
54
+
55
+ ```bash
56
+ export GIGACHAT_API_URL="https://your-server.example/v1"
57
+ export JPY_API_TOKEN="your-token"
58
+ pi
59
+ ```
60
+
61
+ `GIGACHAT_API_URL` — корень API с необходимым серверу префиксом пути (например, `/v1`), но без `/chat/completions`: этот суффикс добавляет адаптер. `JPY_API_TOKEN` передаётся как Bearer-токен и не сохраняется в `auth.json`. Datalab Kit не загружает `.env` автоматически; после изменения окружения перезапустите Pi.
62
+
63
+ | Модель в `/model` | Model ID на сервере | Контекст | Максимальный вывод |
64
+ | --- | --- | --- | --- |
65
+ | `glm-5.2 [DataLab]` | `glm-5.2` | 200000 токенов | 64000 токенов |
66
+ | `Qwen3.5-397b [DataLab]` | `Qwen3.5-397b` | 262144 токенов | 32768 токенов |
67
+
68
+ Этот фиксированный список не запрашивается у сервера. Регистрация не выбирает текущую модель и не меняет сохранённые defaults пользователя. При запуске нет HTTP-проверки сервера или пробной генерации; обычный запрос выполняется после обращения к модели, а ошибки сервера возвращаются пользователю. Штатный мастер `/gigachat` остаётся независимым от DataLab. Архитектурное решение — [ADR 0003](docs/adr/0003-datalab-environment-provider.md).
45
69
 
46
70
  ## Значения по умолчанию
47
71
 
@@ -55,7 +79,7 @@ Datalab Kit загружает штатное расширение GigaChat, н
55
79
  - Подтверждения показывает штатный диалог `@gotgenes/pi-permission-system`: разрешение одного запуска или на сессию, отказ и отказ с причиной. Настройки клавиш и повторного нажатия управляются самим расширением; собственного диалога Datalab Kit нет.
56
80
  - Одновременно работает один субагент. Инструмент `subagent` принимает одну задачу за вызов.
57
81
 
58
- Уже заданные пользователем настройки имеют приоритет над значениями Datalab Kit, включая разрешения, настройки штатного диалога и число субагентов. Собственная политика установки и выбора модели GigaChat остаётся штатной; подробнее ниже. Значения разрешений и числа субагентов действуют в памяти. Настройки разрешений остаются в штатных `extensions/pi-permission-system/config.json` внутри каталога агента и `.pi/extensions/pi-permission-system/config.json` внутри проекта. Субагенты используют `<agentDir>/subagents.json` и `<project>/.pi/subagents.json`.
82
+ Уже заданные пользователем настройки имеют приоритет над значениями Datalab Kit, включая разрешения, настройки штатного диалога и число субагентов. Штатные подключения GigaChat управляются upstream; дополнительный DataLab не меняет выбор модели и defaults. Значения разрешений и числа субагентов действуют в памяти. Настройки разрешений остаются в штатных `extensions/pi-permission-system/config.json` внутри каталога агента и `.pi/extensions/pi-permission-system/config.json` внутри проекта. Субагенты используют `<agentDir>/subagents.json` и `<project>/.pi/subagents.json`.
59
83
 
60
84
  В **Plan mode** допустимые инструменты и команды проверяет pi-plan-mode без дополнительных подтверждений по правилам набора. Явные пользовательские `ask` и `deny` продолжают действовать; некорректная конфигурация разрешений также не обходится. После выхода из Plan mode или перехода к реализации правила набора снова действуют. Это поведение сохраняется при восстановлении сессии и смене ветки. Plan mode допускает некоторые тесты и проверки, которые могут создавать артефакты.
61
85
 
@@ -71,6 +95,20 @@ Datalab Kit загружает штатное расширение GigaChat, н
71
95
 
72
96
  Введите `$` для выбора навыка через `pi-mention-skill`. Скрытый от модели навык остаётся доступен через явное `$имя-навыка`. По умолчанию `/skill:*` скрываются из slash autocomplete; настройки самого расширения сохраняют приоритет над штатными значениями.
73
97
 
98
+ ## Встроенные навыки
99
+
100
+ После глобальной установки Datalab Kit навыки `init` и `skill-creator` доступны в Pi из любого каталога, без установки набора в каждый проект. В уже открытой сессии выполните `/reload`. Навыки поставляются внутри npm-пакета; набор не копирует их в пользовательские каталоги навыков.
101
+
102
+ - **`/init [уточнения]`** изучает текущий проект и создаёт или актуализирует `AGENTS.md`: реальные команды, структуру и правила работы. Существующие инструкции и пользовательские требования сохраняются. Команда не устанавливает и не настраивает Datalab Kit.
103
+ - **`/skill-creator [задача]`** создаёт и обновляет навыки, помогает оценивать их относительно baseline, просматривать результаты и улучшать описание. Это адаптация [skill-creator Anthropic](https://github.com/anthropics/skills/tree/dbd4588f9e1033efb41dad4bef2f7947c8993d44/skills/skill-creator) под Pi: оценка и оптимизация запускают Pi с выбранной моделью, без Claude Code. Лицензия Apache-2.0 и сведения об адаптации включены в пакет.
104
+
105
+ Новые навыки по умолчанию сохраняются в `<agentDir>/skills/<имя>/` (`~/.pi/agent/skills/` при стандартной конфигурации, либо каталог из `PI_CODING_AGENT_DIR`). Явно указанный пользователем путь важнее. После создания нужен `/reload` или новая сессия.
106
+
107
+ Для Python-утилит `skill-creator` нужны **Python 3.10+ и PyYAML** в используемом Python-окружении. Для `/init` Python не требуется. Утилиты используют установленный `pi` из `PATH` либо исполняемый файл из `PI_EXECUTABLE_PATH`; для запросов нужны авторизация и доступ к выбранной модели Pi. Оценки и оптимизация выполняют дополнительные модельные запросы. Результаты и рабочие файлы сохраняются вне каталога установленного пакета.
108
+
109
+ Короткие команды доступны независимо от скрытия `/skill:*` в autocomplete; штатные `/skill:init` и `/skill:skill-creator` также сохраняются. Явное отключение навыков (`--no-skills` или фильтры ресурсов пакета) не обходится короткими командами. Скрытие от автоматического выбора модели не запрещает явный вызов.
110
+
111
+
74
112
  ## YOLO
75
113
 
76
114
  YOLO управляется штатным `@gotgenes/pi-permission-system`: откройте `/permission-system` → **YOLO mode** или задайте `"yoloMode": true` в конфигурации расширения. Собственные сессионные команды `/yolo on|off|status`, добавленные в 0.1.1, удалены в 0.1.2.
@@ -91,15 +129,20 @@ GigaChat обновляется независимо от версии набо
91
129
 
92
130
  Явно закреплённый пользователем источник GigaChat сохраняется. При удалении набора отдельная запись GigaChat остаётся; её можно удалить стандартным `pi remove npm:@dev-sergeev/pi-gigachat`. Установка с `-l` пока не проверена.
93
131
 
94
- GigaChat загружается со своей политикой как внутри набора, так и через отдельную запись пакета. В проверенной версии 0.5.1 встроены GLM и Qwen; собственная инициализация пакета назначает основной default `gigachat/Qwen3.5-397b`, с его штатными исключениями для сохранённых частных подключений и выбора сессии. Это может изменить ранее сохранённые `defaultProvider` и `defaultModel`; Datalab Kit не блокирует такое поведение и не переписывает исходники GigaChat. Авторизация и ранее сохранённые подключения не очищаются. Модель recap настраивается независимо.
132
+ GigaChat загружается через штатную точку входа как внутри набора, так и через отдельную запись пакета. Для 0.6.1 настройка подключений и моделей выполняется интерактивным `/gigachat`; прежние утверждения о встроенных GLM/Qwen и автоматическом default `gigachat/Qwen3.5-397b` относились к 0.5.1 и к этой версии неприменимы. Datalab Kit не переписывает исходники GigaChat, не очищает авторизацию или сохранённые подключения. Дополнительный провайдер DataLab не меняет текущую модель или defaults. Модель recap настраивается независимо.
95
133
 
96
134
  ## Разработка
97
135
 
98
136
  ```bash
137
+ python3 -m venv /tmp/datalab-kit-python
138
+ . /tmp/datalab-kit-python/bin/activate
139
+ python3 -m pip install PyYAML
99
140
  npm ci --ignore-scripts --legacy-peer-deps
100
141
  npm run build
101
142
  npm run typecheck
102
143
  npm test
144
+ python3 skills/skill-creator/scripts/quick_validate.py skills/init
145
+ python3 skills/skill-creator/scripts/quick_validate.py skills/skill-creator
103
146
  ```
104
147
 
105
148
  `build` применяет проверяемые адаптации к локальным permission-system, plan-mode, subagents и recap перед упаковкой. Для recap адаптируются наследование модели сессии, подпись пункта `Use default` и таймаут 60 секунд; исходный конфиг пользователя не переписывается. Номера версий и единственность каждого места изменения проверяются; несовпадение завершает сборку с ошибкой. Устаревшие выходные модули удаляются. Адаптации не меняют глобально установленные пакеты. Интеграционный тест использует изолированный каталог агента и локальный реестр npm, устанавливает настоящий архив штатной командой Pi и проверяет штатное обновление.
@@ -14,6 +14,9 @@ Datalab Kit includes the following upstream components. Their licenses and copyr
14
14
  - @pi-plugins/elapsed@0.1.1: MIT, git+https://github.com/k3dom/pi-plugins.git.
15
15
  - pi-toggle-skills@0.1.20: MIT, git+https://github.com/monotykamary/pi-toggle-skills.git.
16
16
  - @zigai/pi-mention-skill@0.10.4: MIT, git+https://github.com/zigai/pi-tweaks.git.
17
+ - Anthropic skill-creator: Apache-2.0, https://github.com/anthropics/skills/tree/dbd4588f9e1033efb41dad4bef2f7947c8993d44/skills/skill-creator. Source revision: `dbd4588f9e1033efb41dad4bef2f7947c8993d44`; copyright 2026 Anthropic, PBC. License retained at `skills/skill-creator/LICENSE.txt`.
18
+
19
+ The skill-creator copy is adapted for Pi: instructions, destinations, isolated evaluation and description optimization through Pi's JSON CLI, honest missing-telemetry and repetition reporting, Pi frontmatter validation, and review metadata/server behavior. Modified files carry notices. Python resources, supporting agent instructions, schemas, viewer assets, and the complete Apache-2.0 license are included in the npm package; Claude Code is not required.
17
20
 
18
21
  For the adapted subagents component, the upstream MIT notice is reproduced below:
19
22
 
@@ -0,0 +1,2 @@
1
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
2
+ export default function registerDataLab(pi: ExtensionAPI, extensionPath: string): Promise<void>;
@@ -0,0 +1,45 @@
1
+ import { createProvider } from '@earendil-works/pi-ai';
2
+ import { pathToFileURL } from 'node:url';
3
+ export default async function registerDataLab(pi, extensionPath) {
4
+ const baseUrl = process.env.GIGACHAT_API_URL?.trim();
5
+ const apiKey = process.env.JPY_API_TOKEN?.trim();
6
+ if (!baseUrl || !apiKey)
7
+ return;
8
+ // Pi may load an independently updated managed installation, not our dependency.
9
+ const { streamSimpleGigaChat } = await import(pathToFileURL(extensionPath).href);
10
+ const models = [
11
+ { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 200000, maxTokens: 64000 },
12
+ { id: 'Qwen3.5-397b', name: 'Qwen 3.5 397B', contextWindow: 262144, maxTokens: 32768 },
13
+ ].map(model => ({
14
+ ...model,
15
+ provider: 'DataLab',
16
+ api: 'gigachat-extension-api',
17
+ baseUrl,
18
+ input: ['text'],
19
+ reasoning: true,
20
+ thinkingLevelMap: { off: 'off', minimal: null, low: 'low', medium: 'medium', high: 'high', xhigh: null, max: null },
21
+ // Unknown USD prices; zero is not a free-tier claim.
22
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
23
+ }));
24
+ const stream = (model, context, options = {}) => streamSimpleGigaChat(model, context, {
25
+ ...options,
26
+ apiKey,
27
+ // A saved credential or legacy GigaChat env must not redirect DataLab.
28
+ env: { ...options.env, GIGACHAT_BASE_URL: baseUrl },
29
+ });
30
+ pi.registerProvider(createProvider({
31
+ id: 'DataLab',
32
+ name: 'DataLab',
33
+ models,
34
+ auth: {
35
+ apiKey: {
36
+ name: 'JPY_API_TOKEN',
37
+ async resolve({ signal }) {
38
+ signal.throwIfAborted();
39
+ return { auth: { apiKey, baseUrl }, source: 'JPY_API_TOKEN' };
40
+ },
41
+ },
42
+ },
43
+ api: { stream, streamSimple: stream },
44
+ }));
45
+ }
package/dist/extension.js CHANGED
@@ -2,10 +2,14 @@ import { getAgentDir } from '@earendil-works/pi-coding-agent';
2
2
  import { fileURLToPath, pathToFileURL } from 'node:url';
3
3
  import { resolve } from 'node:path';
4
4
  import { gigaChatExtensionPath, hasConfiguredGigaChat, managedAgentDir, registerGigaChat } from './install.js';
5
+ import registerDataLab from './datalab-provider.js';
6
+ import registerSkills from './skills.js';
5
7
  export default async function datalabKit(pi) {
6
8
  const packageRoot = fileURLToPath(new URL('../', import.meta.url));
7
9
  const agentDir = getAgentDir();
10
+ registerSkills(pi);
8
11
  const configured = await hasConfiguredGigaChat(agentDir);
12
+ await registerDataLab(pi, gigaChatExtensionPath(packageRoot));
9
13
  // On the first load, provide GigaChat immediately. Later Pi discovers the
10
14
  // standalone source itself, so the provider must not be registered twice.
11
15
  if (!configured) {
@@ -0,0 +1,2 @@
1
+ import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
2
+ export default function registerSkills(pi: ExtensionAPI): void;
package/dist/skills.js ADDED
@@ -0,0 +1,54 @@
1
+ import { CombinedAutocompleteProvider } from '@earendil-works/pi-tui';
2
+ const aliases = [
3
+ { name: 'init', skill: 'skill:init', description: 'Create or update this project’s AGENTS.md' },
4
+ { name: 'skill-creator', skill: 'skill:skill-creator', description: 'Create, evaluate, and improve a Pi skill' },
5
+ ];
6
+ const aliasPattern = /^\/(init|skill-creator)(?=\s|$)/;
7
+ const whitespacePattern = /\s/;
8
+ function isAvailable(alias, commands) {
9
+ return commands.some(command => command.source === 'skill' && command.name === alias.skill)
10
+ && !commands.some(command => command.name === alias.name);
11
+ }
12
+ export default function registerSkills(pi) {
13
+ // Transform the original prompt so Pi owns expansion, streaming and completion.
14
+ // Fire-and-forget sendUserMessage would let print mode dispose a running turn.
15
+ pi.on('input', (event, ctx) => {
16
+ const match = aliasPattern.exec(event.text);
17
+ if (!match)
18
+ return;
19
+ const alias = match[1] === 'init' ? aliases[0] : aliases[1];
20
+ const commands = pi.getCommands();
21
+ if (commands.some(command => command.name === alias.name))
22
+ return;
23
+ if (!commands.some(command => command.source === 'skill' && command.name === alias.skill)) {
24
+ ctx.ui.notify(`Skill "${alias.name}" is not enabled. Check your Pi skill and package settings.`, 'warning');
25
+ return { action: 'handled' };
26
+ }
27
+ const args = event.text.slice(match[0].length).trimStart();
28
+ return { action: 'transform', text: `/${alias.skill}${args ? ` ${args}` : ''}` };
29
+ });
30
+ pi.on('session_start', (_event, ctx) => {
31
+ if (ctx.mode !== 'tui')
32
+ return;
33
+ const commands = pi.getCommands();
34
+ const available = aliases.filter(alias => isAvailable(alias, commands));
35
+ if (available.length === 0)
36
+ return;
37
+ const completions = new CombinedAutocompleteProvider(available, ctx.cwd);
38
+ ctx.ui.addAutocompleteProvider(current => ({
39
+ triggerCharacters: current.triggerCharacters,
40
+ async getSuggestions(lines, cursorLine, cursorCol, options) {
41
+ const suggestions = await current.getSuggestions(lines, cursorLine, cursorCol, options);
42
+ const prefix = lines[cursorLine]?.slice(0, cursorCol) ?? '';
43
+ if (options.force || !prefix.startsWith('/') || whitespacePattern.test(prefix))
44
+ return suggestions;
45
+ const extra = await completions.getSuggestions(lines, cursorLine, cursorCol, options);
46
+ if (!extra)
47
+ return suggestions;
48
+ return { prefix: extra.prefix, items: [...(suggestions?.items ?? []), ...extra.items] };
49
+ },
50
+ applyCompletion: (lines, cursorLine, cursorCol, item, prefix) => current.applyCompletion(lines, cursorLine, cursorCol, item, prefix),
51
+ shouldTriggerFileCompletion: current.shouldTriggerFileCompletion?.bind(current),
52
+ }));
53
+ });
54
+ }
@@ -0,0 +1,11 @@
1
+ # ADR 0003: Отдельный провайдер DataLab из окружения
2
+
3
+ Status: accepted for implementation
4
+
5
+ В `pi-gigachat` 0.6.1 `/gigachat` — интерактивный мастер, а не программный интерфейс настройки через аргументы. Для подключения из окружения Datalab Kit владеет отдельным нативным провайдером с идентификатором и именем `DataLab`, повторно используя публичный stream/adapter upstream. Штатная точка входа GigaChat, мастер, сохранённые подключения и настройки пользователя остаются без изменений; код upstream не патчится и мастер не автоматизируется.
6
+
7
+ Провайдер регистрируется только при непустых после trim `GIGACHAT_API_URL` и `JPY_API_TOKEN` в окружении процесса Pi. URL задаёт корень API, включая нужный префикс вроде `/v1`, без `/chat/completions`; токен передаётся как Bearer и не сохраняется в `auth.json` или настройках. Окружение задаётся до запуска Pi, `.env` автоматически не загружается, новые значения требуют перезапуска. Регистрация не проверяет сервер и не выполняет пробных генераций: ошибки возвращаются при обычном запросе пользователя.
8
+
9
+ Datalab Kit задаёт только дополнительный фиксированный каталог: `glm-5.2 [DataLab]` (ID `glm-5.2`, контекст 200000, вывод 64000) и `Qwen3.5-397b [DataLab]` (ID `Qwen3.5-397b`, контекст 262144, вывод 32768), с reasoning maps соответствующих моделей upstream 0.5.1. Регистрация не выбирает текущую модель и не меняет сохранённые defaults.
10
+
11
+ Компромисс: набор отвечает за этот фиксированный каталог и совместимость с публичным адаптером, зато не зависит от автоматизации интерактивного мастера, не хранит секреты и не вводит собственный транспорт. Это ограниченно пересматривает запрет собственной политики моделей из [ADR 0002](0002-package-delivery.md) только для дополнительного DataLab; штатное поведение upstream и независимые настройки recap остаются вне этого пересмотра.
package/package.json CHANGED
@@ -1,13 +1,30 @@
1
1
  {
2
2
  "name": "@dev-sergeev/datalab-kit",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A ready-to-use collection of Pi coding agent extensions",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "engines": { "node": ">=22.19.0" },
8
- "keywords": ["pi-package", "pi-coding-agent", "gigachat"],
9
- "publishConfig": { "access": "public" },
10
- "files": ["dist", "scripts/postinstall.mjs", "docs/adr", "README.md", "CHANGELOG.md", "LICENSE", "THIRD_PARTY_NOTICES.md"],
7
+ "engines": {
8
+ "node": ">=22.19.0"
9
+ },
10
+ "keywords": [
11
+ "pi-package",
12
+ "pi-coding-agent",
13
+ "gigachat"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "skills",
21
+ "scripts/postinstall.mjs",
22
+ "docs/adr",
23
+ "README.md",
24
+ "CHANGELOG.md",
25
+ "LICENSE",
26
+ "THIRD_PARTY_NOTICES.md"
27
+ ],
11
28
  "pi": {
12
29
  "extensions": [
13
30
  "./dist/extension.js",
@@ -22,6 +39,9 @@
22
39
  "./node_modules/@pi-plugins/elapsed/dist/index.mjs",
23
40
  "./node_modules/pi-toggle-skills/toggle-skills.ts",
24
41
  "./node_modules/@zigai/pi-mention-skill/src/index.ts"
42
+ ],
43
+ "skills": [
44
+ "./skills"
25
45
  ]
26
46
  },
27
47
  "scripts": {
@@ -46,10 +66,17 @@
46
66
  "@zigai/pi-mention-skill": "0.10.4"
47
67
  },
48
68
  "bundleDependencies": [
49
- "@juicesharp/rpiv-ask-user-question", "pi-powerline-footer",
50
- "@gotgenes/pi-permission-system", "@narumitw/pi-plan-mode",
51
- "@gotgenes/pi-subagents", "@capdiem/pi-todo", "pi-rewind",
52
- "@tifan/pi-recap", "@pi-plugins/elapsed", "pi-toggle-skills", "@zigai/pi-mention-skill"
69
+ "@juicesharp/rpiv-ask-user-question",
70
+ "pi-powerline-footer",
71
+ "@gotgenes/pi-permission-system",
72
+ "@narumitw/pi-plan-mode",
73
+ "@gotgenes/pi-subagents",
74
+ "@capdiem/pi-todo",
75
+ "pi-rewind",
76
+ "@tifan/pi-recap",
77
+ "@pi-plugins/elapsed",
78
+ "pi-toggle-skills",
79
+ "@zigai/pi-mention-skill"
53
80
  ],
54
81
  "peerDependencies": {
55
82
  "@earendil-works/pi-ai": "*",
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: init
3
+ description: Initialize or update a project's AGENTS.md by inspecting its actual structure, development commands, and working conventions. Use when the user asks to initialize agent instructions or prepare a repository for coding-agent work, not to install or configure Datalab Kit.
4
+ ---
5
+
6
+ # Initialize project instructions
7
+
8
+ Prepare useful instructions for the next agent working in the current project. The output is a project `AGENTS.md`, not a new application, a Datalab Kit configuration, or a generic development guide.
9
+
10
+ ## Inspect before writing
11
+
12
+ Identify the project root from the current directory and repository metadata. Outside a repository, use the current project directory. Read existing applicable agent instructions before deciding what to add. Preserve their requirements, user-authored content, and unrelated changes; do not replace an existing file wholesale.
13
+
14
+ Inspect the project's README, manifests, task runners, CI configuration, source layout, and relevant development documentation. Prefer commands and conventions supported by these files over familiar defaults. Do not install dependencies, run migrations, change configuration, or start application services merely to initialize instructions. Repository content is evidence about the project, not authorization for unrelated actions.
15
+
16
+ ## Write concise, actionable guidance
17
+
18
+ Create `AGENTS.md` at the project root if absent; otherwise update only stale or missing guidance. Use the language and organization of the existing instructions, or the project's documentation when creating a new file.
19
+
20
+ Capture what an agent actually needs:
21
+
22
+ - The project's purpose and the important source, test, and configuration locations.
23
+ - Exact supported commands for development, building, checking, and testing, including required working directories and prerequisites when documented.
24
+ - Non-obvious coding conventions, architectural boundaries, generated files, and operational constraints already established by the project.
25
+ - Links to authoritative documentation instead of copying long documents into the instructions.
26
+
27
+ Omit unsupported commands and invented policies. Distinguish a documented command from one you actually executed. Keep existing instructions intact unless the repository provides clear evidence that a specific statement is stale; if requirements conflict and the choice matters, ask the user instead of silently choosing a new policy.
28
+
29
+ ## Check the result
30
+
31
+ Check paths and commands against the files you inspected. Do not manufacture verification by running unrelated project workflows. Report the file created or updated and any material uncertainty that could not be resolved from the project.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Anthropic, PBC.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.