From 991afeff288dfdaae4fb4f69a6471578149805aa Mon Sep 17 00:00:00 2001 From: Kris Braun Date: Sun, 19 Oct 2025 17:04:40 -0400 Subject: [PATCH] Export LLM docs --- .changeset/cute-moose-cheer.md | 5 + pnpm-lock.yaml | 303 +++++++++++++++++++++++++++++++++ sdk/.gitignore | 1 + sdk/cli/commands/create.ts | 2 +- sdk/package.json | 60 ++++++- sdk/prebuild.ts | 156 +++++++++++++++++ sdk/src/sdk-docs.ts | 89 +--------- sdk/src/tools/agent.ts | 21 +-- 8 files changed, 539 insertions(+), 98 deletions(-) create mode 100644 .changeset/cute-moose-cheer.md create mode 100644 sdk/.gitignore create mode 100644 sdk/prebuild.ts diff --git a/.changeset/cute-moose-cheer.md b/.changeset/cute-moose-cheer.md new file mode 100644 index 0000000..7250311 --- /dev/null +++ b/.changeset/cute-moose-cheer.md @@ -0,0 +1,5 @@ +--- +"@plotday/sdk": patch +--- + +Changed: Export LLM docs diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b143185..e3da947 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,6 +77,9 @@ importers: '@types/prompts': specifier: ^2.4.9 version: 2.4.9 + tsx: + specifier: ^4.19.2 + version: 4.20.6 typescript: specifier: ^5.9.3 version: 5.9.3 @@ -184,150 +187,306 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.25.11': + resolution: {integrity: sha512-Xt1dOL13m8u0WE8iplx9Ibbm+hFAO0GsU2P34UNoDGvZYkY8ifSiy6Zuc1lYxfG7svWE2fzqCUmFp5HCn51gJg==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + '@esbuild/android-arm64@0.24.2': resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} engines: {node: '>=18'} cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.25.11': + resolution: {integrity: sha512-9slpyFBc4FPPz48+f6jyiXOx/Y4v34TUeDDXJpZqAWQn/08lKGeD8aDp9TMn9jDz2CiEuHwfhRmGBvpnd/PWIQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm@0.24.2': resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} engines: {node: '>=18'} cpu: [arm] os: [android] + '@esbuild/android-arm@0.25.11': + resolution: {integrity: sha512-uoa7dU+Dt3HYsethkJ1k6Z9YdcHjTrSb5NUy66ZfZaSV8hEYGD5ZHbEMXnqLFlbBflLsl89Zke7CAdDJ4JI+Gg==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + '@esbuild/android-x64@0.24.2': resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} engines: {node: '>=18'} cpu: [x64] os: [android] + '@esbuild/android-x64@0.25.11': + resolution: {integrity: sha512-Sgiab4xBjPU1QoPEIqS3Xx+R2lezu0LKIEcYe6pftr56PqPygbB7+szVnzoShbx64MUupqoE0KyRlN7gezbl8g==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + '@esbuild/darwin-arm64@0.24.2': resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.25.11': + resolution: {integrity: sha512-VekY0PBCukppoQrycFxUqkCojnTQhdec0vevUL/EDOCnXd9LKWqD/bHwMPzigIJXPhC59Vd1WFIL57SKs2mg4w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-x64@0.24.2': resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.25.11': + resolution: {integrity: sha512-+hfp3yfBalNEpTGp9loYgbknjR695HkqtY3d3/JjSRUyPg/xd6q+mQqIb5qdywnDxRZykIHs3axEqU6l1+oWEQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + '@esbuild/freebsd-arm64@0.24.2': resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.25.11': + resolution: {integrity: sha512-CmKjrnayyTJF2eVuO//uSjl/K3KsMIeYeyN7FyDBjsR3lnSJHaXlVoAK8DZa7lXWChbuOk7NjAc7ygAwrnPBhA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-x64@0.24.2': resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.25.11': + resolution: {integrity: sha512-Dyq+5oscTJvMaYPvW3x3FLpi2+gSZTCE/1ffdwuM6G1ARang/mb3jvjxs0mw6n3Lsw84ocfo9CrNMqc5lTfGOw==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + '@esbuild/linux-arm64@0.24.2': resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} engines: {node: '>=18'} cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.25.11': + resolution: {integrity: sha512-Qr8AzcplUhGvdyUF08A1kHU3Vr2O88xxP0Tm8GcdVOUm25XYcMPp2YqSVHbLuXzYQMf9Bh/iKx7YPqECs6ffLA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm@0.24.2': resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} engines: {node: '>=18'} cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.25.11': + resolution: {integrity: sha512-TBMv6B4kCfrGJ8cUPo7vd6NECZH/8hPpBHHlYI3qzoYFvWu2AdTvZNuU/7hsbKWqu/COU7NIK12dHAAqBLLXgw==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + '@esbuild/linux-ia32@0.24.2': resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} engines: {node: '>=18'} cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.25.11': + resolution: {integrity: sha512-TmnJg8BMGPehs5JKrCLqyWTVAvielc615jbkOirATQvWWB1NMXY77oLMzsUjRLa0+ngecEmDGqt5jiDC6bfvOw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-loong64@0.24.2': resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} engines: {node: '>=18'} cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.25.11': + resolution: {integrity: sha512-DIGXL2+gvDaXlaq8xruNXUJdT5tF+SBbJQKbWy/0J7OhU8gOHOzKmGIlfTTl6nHaCOoipxQbuJi7O++ldrxgMw==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-mips64el@0.24.2': resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.25.11': + resolution: {integrity: sha512-Osx1nALUJu4pU43o9OyjSCXokFkFbyzjXb6VhGIJZQ5JZi8ylCQ9/LFagolPsHtgw6himDSyb5ETSfmp4rpiKQ==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-ppc64@0.24.2': resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.25.11': + resolution: {integrity: sha512-nbLFgsQQEsBa8XSgSTSlrnBSrpoWh7ioFDUmwo158gIm5NNP+17IYmNWzaIzWmgCxq56vfr34xGkOcZ7jX6CPw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-riscv64@0.24.2': resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.25.11': + resolution: {integrity: sha512-HfyAmqZi9uBAbgKYP1yGuI7tSREXwIb438q0nqvlpxAOs3XnZ8RsisRfmVsgV486NdjD7Mw2UrFSw51lzUk1ww==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-s390x@0.24.2': resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} engines: {node: '>=18'} cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.25.11': + resolution: {integrity: sha512-HjLqVgSSYnVXRisyfmzsH6mXqyvj0SA7pG5g+9W7ESgwA70AXYNpfKBqh1KbTxmQVaYxpzA/SvlB9oclGPbApw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-x64@0.24.2': resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} engines: {node: '>=18'} cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.25.11': + resolution: {integrity: sha512-HSFAT4+WYjIhrHxKBwGmOOSpphjYkcswF449j6EjsjbinTZbp8PJtjsVK1XFJStdzXdy/jaddAep2FGY+wyFAQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + '@esbuild/netbsd-arm64@0.24.2': resolution: {integrity: sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-arm64@0.25.11': + resolution: {integrity: sha512-hr9Oxj1Fa4r04dNpWr3P8QKVVsjQhqrMSUzZzf+LZcYjZNqhA3IAfPQdEh1FLVUJSiu6sgAwp3OmwBfbFgG2Xg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + '@esbuild/netbsd-x64@0.24.2': resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.25.11': + resolution: {integrity: sha512-u7tKA+qbzBydyj0vgpu+5h5AeudxOAGncb8N6C9Kh1N4n7wU1Xw1JDApsRjpShRpXRQlJLb9wY28ELpwdPcZ7A==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + '@esbuild/openbsd-arm64@0.24.2': resolution: {integrity: sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-arm64@0.25.11': + resolution: {integrity: sha512-Qq6YHhayieor3DxFOoYM1q0q1uMFYb7cSpLD2qzDSvK1NAvqFi8Xgivv0cFC6J+hWVw2teCYltyy9/m/14ryHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + '@esbuild/openbsd-x64@0.24.2': resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.25.11': + resolution: {integrity: sha512-CN+7c++kkbrckTOz5hrehxWN7uIhFFlmS/hqziSFVWpAzpWrQoAG4chH+nN3Be+Kzv/uuo7zhX716x3Sn2Jduw==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.25.11': + resolution: {integrity: sha512-rOREuNIQgaiR+9QuNkbkxubbp8MSO9rONmwP5nKncnWJ9v5jQ4JxFnLu4zDSRPf3x4u+2VN4pM4RdyIzDty/wQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + '@esbuild/sunos-x64@0.24.2': resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} engines: {node: '>=18'} cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.25.11': + resolution: {integrity: sha512-nq2xdYaWxyg9DcIyXkZhcYulC6pQ2FuCgem3LI92IwMgIZ69KHeY8T4Y88pcwoLIjbed8n36CyKoYRDygNSGhA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + '@esbuild/win32-arm64@0.24.2': resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} engines: {node: '>=18'} cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.25.11': + resolution: {integrity: sha512-3XxECOWJq1qMZ3MN8srCJ/QfoLpL+VaxD/WfNRm1O3B4+AZ/BnLVgFbUV3eiRYDMXetciH16dwPbbHqwe1uU0Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-ia32@0.24.2': resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.25.11': + resolution: {integrity: sha512-3ukss6gb9XZ8TlRyJlgLn17ecsK4NSQTmdIXRASVsiS2sQ6zPPZklNJT5GR5tE/MUarymmy8kCEf5xPCNCqVOA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-x64@0.24.2': resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} engines: {node: '>=18'} cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.25.11': + resolution: {integrity: sha512-D7Hpz6A2L4hzsRpPaCYkQnGOotdUpDzSGRIv9I+1ITdHROSFUWW95ZPZWQmGka1Fg7W3zFJowyn9WGwMJ0+KPA==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + '@inquirer/external-editor@1.0.2': resolution: {integrity: sha512-yy9cOoBnx58TlsPrIxauKIFQTiyH+0MK4e97y4sV9ERbI+zDxw7i2hxHLCIEGIE/8PPvDxGhgzIOTSOWcs6/MQ==} engines: {node: '>=18'} @@ -445,6 +604,11 @@ packages: engines: {node: '>=18'} hasBin: true + esbuild@0.25.11: + resolution: {integrity: sha512-KohQwyzrKTQmhXDW1PjCv3Tyspn9n5GcY2RTDqeORIdIJY8yKIF7sTSopFmn/wpMPW4rdPXI0UE5LJLuq3bx0Q==} + engines: {node: '>=18'} + hasBin: true + esprima@4.0.1: resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} engines: {node: '>=4'} @@ -476,6 +640,14 @@ packages: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-tsconfig@4.12.0: + resolution: {integrity: sha512-LScr2aNr2FbjAjZh2C6X6BxRx1/x+aTDExct/xyq2XKbYOiG5c0aK7pMsSuyc0brz3ibr/lbQiHD9jzt4lccJw==} + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -642,6 +814,9 @@ packages: resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} engines: {node: '>=8'} + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + reusify@1.1.0: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -705,6 +880,11 @@ packages: tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + tsx@4.20.6: + resolution: {integrity: sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==} + engines: {node: '>=18.0.0'} + hasBin: true + typebox@1.0.35: resolution: {integrity: sha512-K314QG+lnaymQwdJXxSPqv+X0l3zx4ltpVAXAWszwGjUT4nh1jTNdzM8bTwSh+TO7fXfv9VANnHxDzaLcCfIlw==} @@ -897,78 +1077,156 @@ snapshots: '@esbuild/aix-ppc64@0.24.2': optional: true + '@esbuild/aix-ppc64@0.25.11': + optional: true + '@esbuild/android-arm64@0.24.2': optional: true + '@esbuild/android-arm64@0.25.11': + optional: true + '@esbuild/android-arm@0.24.2': optional: true + '@esbuild/android-arm@0.25.11': + optional: true + '@esbuild/android-x64@0.24.2': optional: true + '@esbuild/android-x64@0.25.11': + optional: true + '@esbuild/darwin-arm64@0.24.2': optional: true + '@esbuild/darwin-arm64@0.25.11': + optional: true + '@esbuild/darwin-x64@0.24.2': optional: true + '@esbuild/darwin-x64@0.25.11': + optional: true + '@esbuild/freebsd-arm64@0.24.2': optional: true + '@esbuild/freebsd-arm64@0.25.11': + optional: true + '@esbuild/freebsd-x64@0.24.2': optional: true + '@esbuild/freebsd-x64@0.25.11': + optional: true + '@esbuild/linux-arm64@0.24.2': optional: true + '@esbuild/linux-arm64@0.25.11': + optional: true + '@esbuild/linux-arm@0.24.2': optional: true + '@esbuild/linux-arm@0.25.11': + optional: true + '@esbuild/linux-ia32@0.24.2': optional: true + '@esbuild/linux-ia32@0.25.11': + optional: true + '@esbuild/linux-loong64@0.24.2': optional: true + '@esbuild/linux-loong64@0.25.11': + optional: true + '@esbuild/linux-mips64el@0.24.2': optional: true + '@esbuild/linux-mips64el@0.25.11': + optional: true + '@esbuild/linux-ppc64@0.24.2': optional: true + '@esbuild/linux-ppc64@0.25.11': + optional: true + '@esbuild/linux-riscv64@0.24.2': optional: true + '@esbuild/linux-riscv64@0.25.11': + optional: true + '@esbuild/linux-s390x@0.24.2': optional: true + '@esbuild/linux-s390x@0.25.11': + optional: true + '@esbuild/linux-x64@0.24.2': optional: true + '@esbuild/linux-x64@0.25.11': + optional: true + '@esbuild/netbsd-arm64@0.24.2': optional: true + '@esbuild/netbsd-arm64@0.25.11': + optional: true + '@esbuild/netbsd-x64@0.24.2': optional: true + '@esbuild/netbsd-x64@0.25.11': + optional: true + '@esbuild/openbsd-arm64@0.24.2': optional: true + '@esbuild/openbsd-arm64@0.25.11': + optional: true + '@esbuild/openbsd-x64@0.24.2': optional: true + '@esbuild/openbsd-x64@0.25.11': + optional: true + + '@esbuild/openharmony-arm64@0.25.11': + optional: true + '@esbuild/sunos-x64@0.24.2': optional: true + '@esbuild/sunos-x64@0.25.11': + optional: true + '@esbuild/win32-arm64@0.24.2': optional: true + '@esbuild/win32-arm64@0.25.11': + optional: true + '@esbuild/win32-ia32@0.24.2': optional: true + '@esbuild/win32-ia32@0.25.11': + optional: true + '@esbuild/win32-x64@0.24.2': optional: true + '@esbuild/win32-x64@0.25.11': + optional: true + '@inquirer/external-editor@1.0.2(@types/node@24.7.2)': dependencies: chardet: 2.1.0 @@ -1105,6 +1363,35 @@ snapshots: '@esbuild/win32-ia32': 0.24.2 '@esbuild/win32-x64': 0.24.2 + esbuild@0.25.11: + optionalDependencies: + '@esbuild/aix-ppc64': 0.25.11 + '@esbuild/android-arm': 0.25.11 + '@esbuild/android-arm64': 0.25.11 + '@esbuild/android-x64': 0.25.11 + '@esbuild/darwin-arm64': 0.25.11 + '@esbuild/darwin-x64': 0.25.11 + '@esbuild/freebsd-arm64': 0.25.11 + '@esbuild/freebsd-x64': 0.25.11 + '@esbuild/linux-arm': 0.25.11 + '@esbuild/linux-arm64': 0.25.11 + '@esbuild/linux-ia32': 0.25.11 + '@esbuild/linux-loong64': 0.25.11 + '@esbuild/linux-mips64el': 0.25.11 + '@esbuild/linux-ppc64': 0.25.11 + '@esbuild/linux-riscv64': 0.25.11 + '@esbuild/linux-s390x': 0.25.11 + '@esbuild/linux-x64': 0.25.11 + '@esbuild/netbsd-arm64': 0.25.11 + '@esbuild/netbsd-x64': 0.25.11 + '@esbuild/openbsd-arm64': 0.25.11 + '@esbuild/openbsd-x64': 0.25.11 + '@esbuild/openharmony-arm64': 0.25.11 + '@esbuild/sunos-x64': 0.25.11 + '@esbuild/win32-arm64': 0.25.11 + '@esbuild/win32-ia32': 0.25.11 + '@esbuild/win32-x64': 0.25.11 + esprima@4.0.1: {} extendable-error@0.1.7: {} @@ -1142,6 +1429,13 @@ snapshots: jsonfile: 4.0.0 universalify: 0.1.2 + fsevents@2.3.3: + optional: true + + get-tsconfig@4.12.0: + dependencies: + resolve-pkg-maps: 1.0.0 + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -1269,6 +1563,8 @@ snapshots: resolve-from@5.0.0: {} + resolve-pkg-maps@1.0.0: {} + reusify@1.1.0: {} run-parallel@1.2.0: @@ -1316,6 +1612,13 @@ snapshots: tr46@0.0.3: {} + tsx@4.20.6: + dependencies: + esbuild: 0.25.11 + get-tsconfig: 4.12.0 + optionalDependencies: + fsevents: 2.3.3 + typebox@1.0.35: {} typescript@5.9.3: {} diff --git a/sdk/.gitignore b/sdk/.gitignore new file mode 100644 index 0000000..76ba15f --- /dev/null +++ b/sdk/.gitignore @@ -0,0 +1 @@ +src/llm-docs diff --git a/sdk/cli/commands/create.ts b/sdk/cli/commands/create.ts index c520061..a0d7fd1 100644 --- a/sdk/cli/commands/create.ts +++ b/sdk/cli/commands/create.ts @@ -100,9 +100,9 @@ export async function createCommand(options: CreateOptions) { fs.mkdirSync(path.join(agentPath, "src"), { recursive: true }); // Read SDK version from package.json - const sdkPackagePath = path.join(__dirname, "..", "..", "package.json"); let sdkVersion = "^0.1.0"; // Fallback version try { + const sdkPackagePath = path.join(__dirname, "..", "..", "package.json"); const sdkPackage = JSON.parse(fs.readFileSync(sdkPackagePath, "utf-8")); sdkVersion = `^${sdkPackage.version}`; } catch (error) { diff --git a/sdk/package.json b/sdk/package.json index f2a9bce..078cb33 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -70,6 +70,62 @@ "types": "./dist/sdk-docs.d.ts", "default": "./dist/sdk-docs.js" }, + "./llm-docs": { + "types": "./dist/llm-docs/index.d.ts", + "default": "./dist/llm-docs/index.js" + }, + "./llm-docs/index": { + "types": "./dist/llm-docs/index.d.ts", + "default": "./dist/llm-docs/index.js" + }, + "./llm-docs/agent": { + "types": "./dist/llm-docs/agent.d.ts", + "default": "./dist/llm-docs/agent.js" + }, + "./llm-docs/plot": { + "types": "./dist/llm-docs/plot.d.ts", + "default": "./dist/llm-docs/plot.js" + }, + "./llm-docs/tag": { + "types": "./dist/llm-docs/tag.d.ts", + "default": "./dist/llm-docs/tag.js" + }, + "./llm-docs/tools/agent": { + "types": "./dist/llm-docs/tools/agent.d.ts", + "default": "./dist/llm-docs/tools/agent.js" + }, + "./llm-docs/tools/ai": { + "types": "./dist/llm-docs/tools/ai.d.ts", + "default": "./dist/llm-docs/tools/ai.js" + }, + "./llm-docs/tools/auth": { + "types": "./dist/llm-docs/tools/auth.d.ts", + "default": "./dist/llm-docs/tools/auth.js" + }, + "./llm-docs/tools/callback": { + "types": "./dist/llm-docs/tools/callback.d.ts", + "default": "./dist/llm-docs/tools/callback.js" + }, + "./llm-docs/tools/plot": { + "types": "./dist/llm-docs/tools/plot.d.ts", + "default": "./dist/llm-docs/tools/plot.js" + }, + "./llm-docs/tools/run": { + "types": "./dist/llm-docs/tools/run.d.ts", + "default": "./dist/llm-docs/tools/run.js" + }, + "./llm-docs/tools/store": { + "types": "./dist/llm-docs/tools/store.d.ts", + "default": "./dist/llm-docs/tools/store.js" + }, + "./llm-docs/tools/webhook": { + "types": "./dist/llm-docs/tools/webhook.d.ts", + "default": "./dist/llm-docs/tools/webhook.js" + }, + "./llm-docs/common/calendar": { + "types": "./dist/llm-docs/common/calendar.d.ts", + "default": "./dist/llm-docs/common/calendar.js" + }, "./tsconfig.base.json": "./tsconfig.base.json" }, "files": [ @@ -83,7 +139,8 @@ "sideEffects": false, "scripts": { "lint": "tsc --noEmit", - "build": "tsc --project tsconfig.build.json && tsc --project tsconfig.cli.json && node postbuild.js", + "prebuild": "tsx prebuild.ts", + "build": "tsx prebuild.ts && tsc --project tsconfig.build.json && tsc --project tsconfig.cli.json && node postbuild.js", "clean": "rm -rf dist bin" }, "dependencies": { @@ -96,6 +153,7 @@ }, "devDependencies": { "@types/prompts": "^2.4.9", + "tsx": "^4.19.2", "typescript": "^5.9.3" }, "peerDependencies": { diff --git a/sdk/prebuild.ts b/sdk/prebuild.ts new file mode 100644 index 0000000..e35e9ed --- /dev/null +++ b/sdk/prebuild.ts @@ -0,0 +1,156 @@ +#!/usr/bin/env node +import { readFileSync, writeFileSync, existsSync, mkdirSync, rmSync } from "fs"; +import { dirname, join } from "path"; +import { fileURLToPath } from "url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +interface TypeFile { + file: string; + importPath: string; + docFilePath: string; // Path where doc file will be written (e.g., "tools/agent.ts") + varName: string; // Valid JS identifier for imports (e.g., "toolsAgent") +} + +// Generate SDK documentation files for LLM consumption +const packageJsonPath = join(__dirname, "package.json"); +const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8")); +const srcDir = join(__dirname, "src"); +const llmDocsDir = join(srcDir, "llm-docs"); + +// Clean and create llm-docs directory +if (existsSync(llmDocsDir)) { + rmSync(llmDocsDir, { recursive: true }); +} +mkdirSync(llmDocsDir, { recursive: true }); + +// Build typeFiles from package.json exports +const typeFiles: TypeFile[] = []; +const exports = packageJson.exports || {}; + +for (const [exportPath, exportValue] of Object.entries(exports)) { + // Skip non-type exports and root export (to avoid circular import in index.ts) + if ( + exportPath === "." || + exportPath === "./tsconfig.base.json" || + exportPath === "./agents-guide" || + exportPath === "./sdk-docs" || + exportPath.startsWith("./llm-docs") + ) { + continue; + } + + // Get the types field from the export + const typesPath = + typeof exportValue === "object" && exportValue !== null + ? (exportValue as any).types + : null; + + if (!typesPath || typeof typesPath !== "string") { + continue; + } + + // Convert dist/*.d.ts to src/*.ts + const sourceFile = typesPath + .replace(/^\.\/dist\//, "") + .replace(/\.d\.ts$/, ".ts"); + + // Build import path + const importPath = + exportPath === "." ? "@plotday/sdk" : `@plotday/sdk${exportPath.slice(1)}`; + + // docFilePath mirrors the source file structure (e.g., "tools/agent.ts") + // This is the path where the doc file will be written + const docFilePath = sourceFile; + + // varName is a valid JavaScript identifier for use in index.ts imports + // Convert path separators and hyphens to create valid identifiers + // e.g., "tools/agent.ts" -> "toolsAgent", "common/calendar.ts" -> "commonCalendar" + const varName = sourceFile + .replace(/\.ts$/, "") // Remove .ts extension + .replace(/\//g, "_") // Replace / with _ + .replace(/-/g, "_") // Replace - with _ + .replace(/^_/, ""); // Remove leading underscore if any + + typeFiles.push({ file: sourceFile, importPath, docFilePath, varName }); +} + +// Sort to ensure consistent ordering +typeFiles.sort((a, b) => { + const aDepth = a.file.split("/").length; + const bDepth = b.file.split("/").length; + + if (a.importPath === "@plotday/sdk" && b.importPath !== "@plotday/sdk") + return -1; + if (b.importPath === "@plotday/sdk" && a.importPath !== "@plotday/sdk") + return 1; + if (aDepth !== bDepth) return aDepth - bDepth; + return a.file.localeCompare(b.file); +}); + +// Generate individual doc files +const indexImports: string[] = []; +const indexMappings: string[] = []; + +for (const { file, importPath, docFilePath, varName } of typeFiles) { + const sourceFilePath = join(srcDir, file); + + // Skip if source file doesn't exist + if (!existsSync(sourceFilePath)) { + console.warn(`Warning: SDK file not found: ${sourceFilePath}`); + continue; + } + + const content = readFileSync(sourceFilePath, "utf-8"); + + // Create nested directory structure if needed + const fullDocFilePath = join(llmDocsDir, docFilePath); + const docFileDir = dirname(fullDocFilePath); + if (!existsSync(docFileDir)) { + mkdirSync(docFileDir, { recursive: true }); + } + + // Generate individual doc file with default export + const docFileContent = `/** + * Generated LLM documentation for ${importPath} + * + * This file is auto-generated during build. Do not edit manually. + * Generated from: prebuild.ts + */ + +export default ${JSON.stringify(content)}; +`; + + writeFileSync(fullDocFilePath, docFileContent, "utf-8"); + + // Add to index imports and mappings + // Import path needs to preserve directory structure and convert .ts to .js + const importRelativePath = docFilePath.replace(/\.ts$/, ".js"); + indexImports.push(`import ${varName} from "./${importRelativePath}";`); + indexMappings.push(` "${importPath}": ${varName}`); +} + +// Generate index.ts with default export of mapping object +const indexContent = `/** + * Generated LLM documentation index + * + * This file is auto-generated during build. Do not edit manually. + * Generated from: prebuild.ts + * + * Provides a mapping of SDK import paths to their source code documentation. + */ + +${indexImports.join("\n")} + +const llmDocs: Record = { +${indexMappings.join(",\n")} +}; + +export default llmDocs; +`; + +const indexPath = join(llmDocsDir, "index.ts"); +writeFileSync(indexPath, indexContent, "utf-8"); + +console.log(`✓ Generated ${typeFiles.length} LLM documentation files in src/llm-docs/`); diff --git a/sdk/src/sdk-docs.ts b/sdk/src/sdk-docs.ts index ba5814d..c51b8d7 100644 --- a/sdk/src/sdk-docs.ts +++ b/sdk/src/sdk-docs.ts @@ -1,100 +1,23 @@ -import * as fs from "fs"; -import * as path from "path"; -import { fileURLToPath } from "url"; +import llmDocs from "./llm-docs/index.js"; /** * Gets complete SDK type definitions with import paths for LLM context. * - * This function reads all SDK type definition files and formats them with - * their corresponding import paths. Used by agent generators to provide - * complete type information to LLMs. + * This function returns pre-generated SDK documentation that was bundled + * at build time. Used by agent generators to provide complete type + * information to LLMs. * * @returns Formatted string containing all SDK type definitions with import paths */ export function getSDKDocumentation(): string { - // Get the directory of this file - const __filename = fileURLToPath(import.meta.url); - const sdkRoot = path.dirname(__filename); - const packageRoot = path.dirname(sdkRoot); - - // Read package.json to get exports dynamically - const packageJsonPath = path.join(packageRoot, "package.json"); - const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")); - - // Build typeFiles from package.json exports - // Exclude non-type exports like tsconfig.base.json - const typeFiles: Array<{ file: string; importPath: string }> = []; - const exports = packageJson.exports || {}; - - for (const [exportPath, exportValue] of Object.entries(exports)) { - // Skip non-type exports - if ( - exportPath === "./tsconfig.base.json" || - exportPath === "./agents-guide" || - exportPath === "./sdk-docs" - ) { - continue; - } - - // Get the types field from the export - const typesPath = - typeof exportValue === "object" && exportValue !== null - ? (exportValue as any).types - : null; - - if (!typesPath || typeof typesPath !== "string") { - continue; - } - - // Convert dist/*.d.ts to src/*.ts - const sourceFile = typesPath - .replace(/^\.\/dist\//, "") - .replace(/\.d\.ts$/, ".ts"); - - // Build import path - const importPath = - exportPath === "." ? "@plotday/sdk" : `@plotday/sdk${exportPath.slice(1)}`; - - typeFiles.push({ file: sourceFile, importPath }); - } - - // Sort to ensure consistent ordering: - // 1. Root exports (@plotday/sdk) first - // 2. Then by directory depth and alphabetically - typeFiles.sort((a, b) => { - const aDepth = a.file.split("/").length; - const bDepth = b.file.split("/").length; - - // Root exports first - if (a.importPath === "@plotday/sdk" && b.importPath !== "@plotday/sdk") - return -1; - if (b.importPath === "@plotday/sdk" && a.importPath !== "@plotday/sdk") - return 1; - - // Then by depth - if (aDepth !== bDepth) return aDepth - bDepth; - - // Then alphabetically - return a.file.localeCompare(b.file); - }); - let documentation = "# Plot SDK Type Definitions\n\n"; documentation += "Complete type definitions with JSDoc documentation for all Plot SDK types.\n"; documentation += "These are the source files - use the import paths shown to import types in your agent code.\n\n"; - for (const { file, importPath } of typeFiles) { - const filePath = path.join(sdkRoot, file); - - // Skip if file doesn't exist (graceful degradation) - if (!fs.existsSync(filePath)) { - console.warn(`Warning: SDK file not found: ${filePath}`); - continue; - } - - const content = fs.readFileSync(filePath, "utf-8"); - + // Format each SDK file with headers and code fences + for (const [importPath, content] of Object.entries(llmDocs)) { documentation += `## ${importPath}\n\n`; documentation += "```typescript\n"; documentation += `// Import from: ${importPath}\n\n`; diff --git a/sdk/src/tools/agent.ts b/sdk/src/tools/agent.ts index 5ea2faf..d4312e4 100644 --- a/sdk/src/tools/agent.ts +++ b/sdk/src/tools/agent.ts @@ -148,25 +148,20 @@ export abstract class AgentManager extends ITool { * ``` */ abstract deploy( - _options: + _options: { + agentId: string; + environment?: "personal" | "private" | "review"; + name?: string; + description?: string; + dryRun?: boolean; + } & ( | { - agentId: string; module: string; - source?: never; - environment?: "personal" | "private" | "review"; - name?: string; - description?: string; - dryRun?: boolean; } | { - agentId: string; source: AgentSource; - module?: never; - environment?: "personal" | "private" | "review"; - name?: string; - description?: string; - dryRun?: boolean; } + ) ): Promise<{ version: string; errors?: string[];