@vellumai/assistant 0.8.10-dev.202606102253.fbea648 → 0.8.10-dev.202606110059.319a8d3
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.
- package/bun.lock +62 -1
- package/knip.json +1 -0
- package/package.json +2 -1
- package/scripts/build-plugin-api.ts +299 -0
- package/src/__tests__/history-repair-hook.test.ts +120 -35
- package/src/__tests__/image-recovery-hook.test.ts +129 -43
- package/src/plugin-api/index.ts +17 -0
- package/src/plugins/defaults/history-repair/hooks/post-model-call.ts +80 -0
- package/src/plugins/defaults/history-repair/hooks/stop.ts +17 -54
- package/src/plugins/defaults/history-repair/repair-state-store.ts +15 -11
- package/src/plugins/defaults/image-recovery/hooks/post-model-call.ts +103 -0
- package/src/plugins/defaults/image-recovery/hooks/stop.ts +17 -77
- package/src/plugins/defaults/index.ts +16 -8
- package/tsconfig.plugin-api.json +13 -0
package/bun.lock
CHANGED
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"zod": "4.3.6",
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"@microsoft/api-extractor": "7.58.8",
|
|
48
49
|
"@types/archiver": "7.0.0",
|
|
49
50
|
"@types/bun": "1.3.10",
|
|
50
51
|
"@types/node": "25.5.0",
|
|
@@ -179,6 +180,14 @@
|
|
|
179
180
|
|
|
180
181
|
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
|
|
181
182
|
|
|
183
|
+
"@microsoft/api-extractor": ["@microsoft/api-extractor@7.58.8", "", { "dependencies": { "@microsoft/api-extractor-model": "7.33.8", "@microsoft/tsdoc": "~0.16.0", "@microsoft/tsdoc-config": "~0.18.1", "@rushstack/node-core-library": "5.23.1", "@rushstack/rig-package": "0.7.3", "@rushstack/terminal": "0.24.0", "@rushstack/ts-command-line": "5.3.9", "diff": "~8.0.2", "minimatch": "10.2.3", "resolve": "~1.22.1", "semver": "~7.7.4", "source-map": "~0.6.1", "typescript": "5.9.3" }, "bin": { "api-extractor": "bin/api-extractor" } }, "sha512-Y45rdEvZodD1WBAK9w8Wvqj7k/6z21YOEP8aVNWv1vemEzanjThvCowc3Eyt/bmJJyqI4gj0BQr9nLC51fsDiQ=="],
|
|
184
|
+
|
|
185
|
+
"@microsoft/api-extractor-model": ["@microsoft/api-extractor-model@7.33.8", "", { "dependencies": { "@microsoft/tsdoc": "~0.16.0", "@microsoft/tsdoc-config": "~0.18.1", "@rushstack/node-core-library": "5.23.1" } }, "sha512-aIcoQggPyer3B6Ze3usz0YWC/oBwUHfRH5ETUsr+oT2BRA6SfTJl7IKPcPZkX4UR+PohowzW4uMxsvjrn8vm+w=="],
|
|
186
|
+
|
|
187
|
+
"@microsoft/tsdoc": ["@microsoft/tsdoc@0.16.0", "", {}, "sha512-xgAyonlVVS+q7Vc7qLW0UrJU7rSFcETRWsqdXZtjzRU8dF+6CkozTK4V4y1LwOX7j8r/vHphjDeMeGI4tNGeGA=="],
|
|
188
|
+
|
|
189
|
+
"@microsoft/tsdoc-config": ["@microsoft/tsdoc-config@0.18.1", "", { "dependencies": { "@microsoft/tsdoc": "0.16.0", "ajv": "~8.18.0", "jju": "~1.4.0", "resolve": "~1.22.2" } }, "sha512-9brPoVdfN9k9g0dcWkFeA7IH9bbcttzDJlXvkf8b2OBzd5MueR1V2wkKBL0abn0otvmkHJC6aapBOTJDDeMCZg=="],
|
|
190
|
+
|
|
182
191
|
"@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.27.1", "", { "dependencies": { "@hono/node-server": "^1.19.9", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-sr6GbP+4edBwFndLbM60gf07z0FQ79gaExpnsjMGePXqFcSSb7t6iscpjk9DhFhwd+mTEQrzNafGP8/iGGFYaA=="],
|
|
183
192
|
|
|
184
193
|
"@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.1.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.1" }, "peerDependencies": { "@emnapi/core": "^1.7.1", "@emnapi/runtime": "^1.7.1" } }, "sha512-3NQNNgA1YSlJb/kMH1ildASP9HW7/7kYnRI2szWJaofaS1hWmbGI4H+d3+22aGzXXN9IJ+n+GiFVcGipJP18ow=="],
|
|
@@ -351,6 +360,16 @@
|
|
|
351
360
|
|
|
352
361
|
"@resvg/resvg-js-win32-x64-msvc": ["@resvg/resvg-js-win32-x64-msvc@2.6.2", "", { "os": "win32", "cpu": "x64" }, "sha512-ZXtYhtUr5SSaBrUDq7DiyjOFJqBVL/dOBN7N/qmi/pO0IgiWW/f/ue3nbvu9joWE5aAKDoIzy/CxsY0suwGosQ=="],
|
|
353
362
|
|
|
363
|
+
"@rushstack/node-core-library": ["@rushstack/node-core-library@5.23.1", "", { "dependencies": { "ajv": "~8.18.0", "ajv-draft-04": "~1.0.0", "ajv-formats": "~3.0.1", "fs-extra": "~11.3.0", "import-lazy": "~4.0.0", "jju": "~1.4.0", "resolve": "~1.22.1", "semver": "~7.7.4" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-wlKmIKIYCKuCASbITvOxLZXepPbwXvrv7S6ig6XNWFchSyhL/E2txmVXspHY49Wu2dzf7nI27a2k/yV5BA3EiA=="],
|
|
364
|
+
|
|
365
|
+
"@rushstack/problem-matcher": ["@rushstack/problem-matcher@0.2.1", "", { "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-gulfhBs6n+I5b7DvjKRfhMGyUejtSgOHTclF/eONr8hcgF1APEDjhxIsfdUYYMzC3rvLwGluqLjbwCFZ8nxrog=="],
|
|
366
|
+
|
|
367
|
+
"@rushstack/rig-package": ["@rushstack/rig-package@0.7.3", "", { "dependencies": { "jju": "~1.4.0", "resolve": "~1.22.1" } }, "sha512-aAA518n6wxxjCfnTAOjQnm7ngNE0FVHxHAw2pxKlIhxrMn0XQjGcXKF0oKWpjBgJOmsaJpVob/v+zr3zxgPWuA=="],
|
|
368
|
+
|
|
369
|
+
"@rushstack/terminal": ["@rushstack/terminal@0.24.0", "", { "dependencies": { "@rushstack/node-core-library": "5.23.1", "@rushstack/problem-matcher": "0.2.1", "supports-color": "~8.1.1" }, "peerDependencies": { "@types/node": "*" }, "optionalPeers": ["@types/node"] }, "sha512-8ZQS4MMaGsv27EXCBiH7WMPkRZrffeDoIevs6z9TM5dzqiY6+Hn4evfK/G+gvgBTjfvfkHIZPQQmalmI2sM4TQ=="],
|
|
370
|
+
|
|
371
|
+
"@rushstack/ts-command-line": ["@rushstack/ts-command-line@5.3.9", "", { "dependencies": { "@rushstack/terminal": "0.24.0", "@types/argparse": "1.0.38", "argparse": "~1.0.9", "string-argv": "~0.3.1" } }, "sha512-GIHqU+sRGQ3LGWAZu1O+9Yh++qwtyNIIGuNbcWHJjBTm2qRez0cwINUHZ+pQLR8UuzZDcMajrDaNbUYoaL/XtQ=="],
|
|
372
|
+
|
|
354
373
|
"@sentry/core": ["@sentry/core@10.43.0", "", {}, "sha512-l0SszQAPiQGWl/ferw8GP3ALyHXiGiRKJaOvNmhGO+PrTQyZTZ6OYyPnGijAFRg58dE1V3RCH/zw5d2xSUIiNg=="],
|
|
355
374
|
|
|
356
375
|
"@sentry/node": ["@sentry/node@10.43.0", "", { "dependencies": { "@fastify/otel": "0.16.0", "@opentelemetry/api": "^1.9.0", "@opentelemetry/context-async-hooks": "^2.5.1", "@opentelemetry/core": "^2.5.1", "@opentelemetry/instrumentation": "^0.211.0", "@opentelemetry/instrumentation-amqplib": "0.58.0", "@opentelemetry/instrumentation-connect": "0.54.0", "@opentelemetry/instrumentation-dataloader": "0.28.0", "@opentelemetry/instrumentation-express": "0.59.0", "@opentelemetry/instrumentation-fs": "0.30.0", "@opentelemetry/instrumentation-generic-pool": "0.54.0", "@opentelemetry/instrumentation-graphql": "0.58.0", "@opentelemetry/instrumentation-hapi": "0.57.0", "@opentelemetry/instrumentation-http": "0.211.0", "@opentelemetry/instrumentation-ioredis": "0.59.0", "@opentelemetry/instrumentation-kafkajs": "0.20.0", "@opentelemetry/instrumentation-knex": "0.55.0", "@opentelemetry/instrumentation-koa": "0.59.0", "@opentelemetry/instrumentation-lru-memoizer": "0.55.0", "@opentelemetry/instrumentation-mongodb": "0.64.0", "@opentelemetry/instrumentation-mongoose": "0.57.0", "@opentelemetry/instrumentation-mysql": "0.57.0", "@opentelemetry/instrumentation-mysql2": "0.57.0", "@opentelemetry/instrumentation-pg": "0.63.0", "@opentelemetry/instrumentation-redis": "0.59.0", "@opentelemetry/instrumentation-tedious": "0.30.0", "@opentelemetry/instrumentation-undici": "0.21.0", "@opentelemetry/resources": "^2.5.1", "@opentelemetry/sdk-trace-base": "^2.5.1", "@opentelemetry/semantic-conventions": "^1.39.0", "@prisma/instrumentation": "7.2.0", "@sentry/core": "10.43.0", "@sentry/node-core": "10.43.0", "@sentry/opentelemetry": "10.43.0", "import-in-the-middle": "^2.0.6" } }, "sha512-oNwXcuZUc4uTTr0WbHZBBIKsKwAKvNMTgbXwxfB37CfzV18wbTirbQABZ/Ir3WNxSgi6ZcnC6UE013jF5XWPqw=="],
|
|
@@ -371,6 +390,8 @@
|
|
|
371
390
|
|
|
372
391
|
"@types/archiver": ["@types/archiver@7.0.0", "", { "dependencies": { "@types/readdir-glob": "*" } }, "sha512-/3vwGwx9n+mCQdYZ2IKGGHEFL30I96UgBlk8EtRDDFQ9uxM1l4O5Ci6r00EMAkiDaTqD9DQ6nVrWRICnBPtzzg=="],
|
|
373
392
|
|
|
393
|
+
"@types/argparse": ["@types/argparse@1.0.38", "", {}, "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA=="],
|
|
394
|
+
|
|
374
395
|
"@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
|
|
375
396
|
|
|
376
397
|
"@types/connect": ["@types/connect@3.4.38", "", { "dependencies": { "@types/node": "*" } }, "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug=="],
|
|
@@ -465,6 +486,8 @@
|
|
|
465
486
|
|
|
466
487
|
"ajv": ["ajv@6.15.0", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
|
|
467
488
|
|
|
489
|
+
"ajv-draft-04": ["ajv-draft-04@1.0.0", "", { "peerDependencies": { "ajv": "^8.5.0" }, "optionalPeers": ["ajv"] }, "sha512-mv00Te6nmYbRp5DCwclxtt7yV/joXJPGS7nM+97GdxvuttCOfgI3K4U25zboyeX0O+myI8ERluxQe5wljMmVIw=="],
|
|
490
|
+
|
|
468
491
|
"ajv-formats": ["ajv-formats@3.0.1", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="],
|
|
469
492
|
|
|
470
493
|
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
|
|
@@ -479,6 +502,8 @@
|
|
|
479
502
|
|
|
480
503
|
"archiver-utils": ["archiver-utils@5.0.2", "", { "dependencies": { "glob": "^10.0.0", "graceful-fs": "^4.2.0", "is-stream": "^2.0.1", "lazystream": "^1.0.0", "lodash": "^4.17.15", "normalize-path": "^3.0.0", "readable-stream": "^4.0.0" } }, "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA=="],
|
|
481
504
|
|
|
505
|
+
"argparse": ["argparse@1.0.10", "", { "dependencies": { "sprintf-js": "~1.0.2" } }, "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg=="],
|
|
506
|
+
|
|
482
507
|
"ast-module-types": ["ast-module-types@6.0.1", "", {}, "sha512-WHw67kLXYbZuHTmcdbIrVArCq5wxo6NEuj3hiYAWr8mwJeC+C2mMCIBIWCiDoCye/OF/xelc+teJ1ERoWmnEIA=="],
|
|
483
508
|
|
|
484
509
|
"async": ["async@3.2.6", "", {}, "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA=="],
|
|
@@ -595,6 +620,8 @@
|
|
|
595
620
|
|
|
596
621
|
"detective-vue2": ["detective-vue2@2.3.0", "", { "dependencies": { "@dependents/detective-less": "^5.0.1", "@vue/compiler-sfc": "^3.5.32", "detective-es6": "^5.0.1", "detective-sass": "^6.0.1", "detective-scss": "^5.0.1", "detective-stylus": "^5.0.1", "detective-typescript": "^14.1.0" }, "peerDependencies": { "typescript": "^5.4.4 || ^6.0.2" } }, "sha512-3gwbZPqVTm9sL9XdZsgEJ7x4x99O853VVZHapQAiEkGuMJMpFPjHDrecSgfqnS5JW3FJfYXesLZGvUOibjn49g=="],
|
|
597
622
|
|
|
623
|
+
"diff": ["diff@8.0.4", "", {}, "sha512-DPi0FmjiSU5EvQV0++GFDOJ9ASQUVFh5kD+OzOnYdi7n3Wpm9hWWGfB/O2blfHcMVTL5WkQXSnRiK9makhrcnw=="],
|
|
624
|
+
|
|
598
625
|
"dotenv": ["dotenv@17.3.1", "", {}, "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA=="],
|
|
599
626
|
|
|
600
627
|
"drizzle-kit": ["drizzle-kit@0.30.6", "", { "dependencies": { "@drizzle-team/brocli": "^0.10.2", "@esbuild-kit/esm-loader": "^2.5.5", "esbuild": "^0.19.7", "esbuild-register": "^3.5.0", "gel": "^2.0.0" }, "bin": { "drizzle-kit": "bin.cjs" } }, "sha512-U4wWit0fyZuGuP7iNmRleQyK2V8wCuv57vf5l3MnG4z4fzNTjY/U13M8owyQ5RavqvqxBifWORaR3wIUzlN64g=="],
|
|
@@ -729,6 +756,8 @@
|
|
|
729
756
|
|
|
730
757
|
"fresh": ["fresh@2.0.0", "", {}, "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A=="],
|
|
731
758
|
|
|
759
|
+
"fs-extra": ["fs-extra@11.3.5", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-eKpRKAovdpZtR1WopLHxlBWvAgPny3c4gX1G5Jhwmmw4XJj0ifSD5qB5TOo8hmA0wlRKDAOAhEE1yVPgs6Fgcg=="],
|
|
760
|
+
|
|
732
761
|
"fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
|
|
733
762
|
|
|
734
763
|
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
|
|
@@ -787,6 +816,8 @@
|
|
|
787
816
|
|
|
788
817
|
"import-in-the-middle": ["import-in-the-middle@2.0.6", "", { "dependencies": { "acorn": "^8.15.0", "acorn-import-attributes": "^1.9.5", "cjs-module-lexer": "^2.2.0", "module-details-from-path": "^1.0.4" } }, "sha512-3vZV3jX0XRFW3EJDTwzWoZa+RH1b8eTTx6YOCjglrLyPuepwoBti1k3L2dKwdCUrnVEfc5CuRuGstaC/uQJJaw=="],
|
|
789
818
|
|
|
819
|
+
"import-lazy": ["import-lazy@4.0.0", "", {}, "sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw=="],
|
|
820
|
+
|
|
790
821
|
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
|
|
791
822
|
|
|
792
823
|
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
|
@@ -831,6 +862,8 @@
|
|
|
831
862
|
|
|
832
863
|
"jiti": ["jiti@2.6.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="],
|
|
833
864
|
|
|
865
|
+
"jju": ["jju@1.4.0", "", {}, "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA=="],
|
|
866
|
+
|
|
834
867
|
"jose": ["jose@6.2.3", "", {}, "sha512-YYVDInQKFJfR/xa3ojUTl8c2KoTwiL1R5Wg9YCydwH0x0B9grbzlg5HC7mMjCtUJjbQ/YnGEZIhI5tCgfTb4Hw=="],
|
|
835
868
|
|
|
836
869
|
"joycon": ["joycon@3.1.1", "", {}, "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw=="],
|
|
@@ -849,6 +882,8 @@
|
|
|
849
882
|
|
|
850
883
|
"json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
|
|
851
884
|
|
|
885
|
+
"jsonfile": ["jsonfile@6.2.1", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q=="],
|
|
886
|
+
|
|
852
887
|
"jszip": ["jszip@3.10.1", "", { "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", "readable-stream": "~2.3.6", "setimmediate": "^1.0.5" } }, "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g=="],
|
|
853
888
|
|
|
854
889
|
"jwa": ["jwa@2.0.1", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="],
|
|
@@ -1127,6 +1162,8 @@
|
|
|
1127
1162
|
|
|
1128
1163
|
"split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],
|
|
1129
1164
|
|
|
1165
|
+
"sprintf-js": ["sprintf-js@1.0.3", "", {}, "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g=="],
|
|
1166
|
+
|
|
1130
1167
|
"statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="],
|
|
1131
1168
|
|
|
1132
1169
|
"stemmer": ["stemmer@2.0.1", "", { "bin": { "stemmer": "cli.js" } }, "sha512-bkWvSX2JR4nSZFfs113kd4C6X13bBBrg4fBKv2pVdzpdQI2LA5pZcWzTFNdkYsiUNl13E4EzymSRjZ0D55jBYg=="],
|
|
@@ -1135,6 +1172,8 @@
|
|
|
1135
1172
|
|
|
1136
1173
|
"streamx": ["streamx@2.25.0", "", { "dependencies": { "events-universal": "^1.0.0", "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" } }, "sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg=="],
|
|
1137
1174
|
|
|
1175
|
+
"string-argv": ["string-argv@0.3.2", "", {}, "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q=="],
|
|
1176
|
+
|
|
1138
1177
|
"string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", "strip-ansi": "^7.0.1" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
|
|
1139
1178
|
|
|
1140
1179
|
"string-width-cjs": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
|
|
@@ -1153,7 +1192,7 @@
|
|
|
1153
1192
|
|
|
1154
1193
|
"stylus-lookup": ["stylus-lookup@6.1.2", "", { "dependencies": { "commander": "^12.1.0" }, "bin": { "stylus-lookup": "bin/cli.js" } }, "sha512-O+Q/SJ8s1X2aMLh4213fQ9X/bND9M3dhSsyTRe+O1OXPcewGLiYmAtKCrnP7FDvDBaXB2ZHPkCt3zi4cJXBlCQ=="],
|
|
1155
1194
|
|
|
1156
|
-
"supports-color": ["supports-color@
|
|
1195
|
+
"supports-color": ["supports-color@8.1.1", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
|
|
1157
1196
|
|
|
1158
1197
|
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
|
|
1159
1198
|
|
|
@@ -1199,6 +1238,8 @@
|
|
|
1199
1238
|
|
|
1200
1239
|
"undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
|
|
1201
1240
|
|
|
1241
|
+
"universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="],
|
|
1242
|
+
|
|
1202
1243
|
"unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
|
|
1203
1244
|
|
|
1204
1245
|
"uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
|
|
@@ -1249,12 +1290,22 @@
|
|
|
1249
1290
|
|
|
1250
1291
|
"@isaacs/cliui/strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="],
|
|
1251
1292
|
|
|
1293
|
+
"@microsoft/api-extractor/minimatch": ["minimatch@10.2.3", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-Rwi3pnapEqirPSbWbrZaa6N3nmqq4Xer/2XooiOKyV3q12ML06f7MOuc5DVH8ONZIFhwIYQ3yzPH4nt7iWHaTg=="],
|
|
1294
|
+
|
|
1295
|
+
"@microsoft/api-extractor/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
|
1296
|
+
|
|
1297
|
+
"@microsoft/tsdoc-config/ajv": ["ajv@8.18.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="],
|
|
1298
|
+
|
|
1252
1299
|
"@modelcontextprotocol/sdk/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
|
1253
1300
|
|
|
1254
1301
|
"@opentelemetry/instrumentation-http/@opentelemetry/core": ["@opentelemetry/core@2.5.0", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, "peerDependencies": { "@opentelemetry/api": ">=1.0.0 <1.10.0" } }, "sha512-ka4H8OM6+DlUhSAZpONu0cPBtPPTQKxbxVzC4CzVx5+K4JnroJVBtDzLAMx4/3CDTJXRvVFhpFjtl4SaiTNoyQ=="],
|
|
1255
1302
|
|
|
1256
1303
|
"@prisma/instrumentation/@opentelemetry/instrumentation": ["@opentelemetry/instrumentation@0.207.0", "", { "dependencies": { "@opentelemetry/api-logs": "0.207.0", "import-in-the-middle": "^2.0.0", "require-in-the-middle": "^8.0.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-y6eeli9+TLKnznrR8AZlQMSJT7wILpXH+6EYq5Vf/4Ao+huI7EedxQHwRgVUOMLFbe7VFDvHJrX9/f4lcwnJsA=="],
|
|
1257
1304
|
|
|
1305
|
+
"@rushstack/node-core-library/ajv": ["ajv@8.18.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="],
|
|
1306
|
+
|
|
1307
|
+
"@rushstack/node-core-library/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
|
1308
|
+
|
|
1258
1309
|
"@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.5", "", {}, "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg=="],
|
|
1259
1310
|
|
|
1260
1311
|
"@typescript-eslint/typescript-estree/semver": ["semver@7.7.4", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
|
|
@@ -1269,12 +1320,16 @@
|
|
|
1269
1320
|
|
|
1270
1321
|
"@vellumai/gateway-client/@vellumai/service-contracts": ["@vellumai/service-contracts@file:../packages/service-contracts", { "dependencies": { "zod": "4.3.6" }, "devDependencies": { "@types/bun": "1.2.4", "typescript": "5.7.3" } }],
|
|
1271
1322
|
|
|
1323
|
+
"ajv-draft-04/ajv": ["ajv@8.17.1", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g=="],
|
|
1324
|
+
|
|
1272
1325
|
"ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
|
|
1273
1326
|
|
|
1274
1327
|
"bl/buffer": ["buffer@5.7.1", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ=="],
|
|
1275
1328
|
|
|
1276
1329
|
"bl/readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
|
|
1277
1330
|
|
|
1331
|
+
"chalk/supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
|
|
1332
|
+
|
|
1278
1333
|
"cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
|
|
1279
1334
|
|
|
1280
1335
|
"dependency-tree/commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
|
|
@@ -1373,10 +1428,14 @@
|
|
|
1373
1428
|
|
|
1374
1429
|
"@isaacs/cliui/strip-ansi/ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
|
|
1375
1430
|
|
|
1431
|
+
"@microsoft/tsdoc-config/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
|
1432
|
+
|
|
1376
1433
|
"@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
|
1377
1434
|
|
|
1378
1435
|
"@prisma/instrumentation/@opentelemetry/instrumentation/@opentelemetry/api-logs": ["@opentelemetry/api-logs@0.207.0", "", { "dependencies": { "@opentelemetry/api": "^1.3.0" } }, "sha512-lAb0jQRVyleQQGiuuvCOTDVspc14nx6XJjP4FspJ1sNARo3Regq4ZZbrc3rN4b1TYSuUCvgH+UXUPug4SLOqEQ=="],
|
|
1379
1436
|
|
|
1437
|
+
"@rushstack/node-core-library/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
|
1438
|
+
|
|
1380
1439
|
"@vellumai/ces-client/@types/bun/bun-types": ["bun-types@1.2.4", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-nDPymR207ZZEoWD4AavvEaa/KZe/qlrbMSchqpQwovPZCKc7pwMoENjEtHgMKaAjJhy+x6vfqSBA1QU3bJgs0Q=="],
|
|
1381
1440
|
|
|
1382
1441
|
"@vellumai/ces-client/@vellumai/service-contracts/@types/bun": ["@types/bun@1.3.10", "", { "dependencies": { "bun-types": "1.3.10" } }, "sha512-0+rlrUrOrTSskibryHbvQkDOWRJwJZqZlxrUs1u4oOoTln8+WIXBPmAuCF35SWB2z4Zl3E84Nl/D0P7803nigQ=="],
|
|
@@ -1385,6 +1444,8 @@
|
|
|
1385
1444
|
|
|
1386
1445
|
"@vellumai/environments/@types/bun/bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="],
|
|
1387
1446
|
|
|
1447
|
+
"ajv-draft-04/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
|
1448
|
+
|
|
1388
1449
|
"ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
|
1389
1450
|
|
|
1390
1451
|
"cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
|
package/knip.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vellumai/assistant",
|
|
3
|
-
"version": "0.8.10-dev.
|
|
3
|
+
"version": "0.8.10-dev.202606110059.319a8d3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@resvg/resvg-js-darwin-x64": "2.6.2"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
+
"@microsoft/api-extractor": "7.58.8",
|
|
99
100
|
"@types/archiver": "7.0.0",
|
|
100
101
|
"@types/bun": "1.3.10",
|
|
101
102
|
"@types/node": "25.5.0",
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Builds the publishable `@vellumai/plugin-api` npm package: a types-first
|
|
4
|
+
* package whose public `index.d.ts` is a single self-contained rollup of the
|
|
5
|
+
* plugin authoring surface (`src/plugin-api/index.ts`), with the workspace
|
|
6
|
+
* `@vellumai/*` contract types inlined and `zod` as the only external dep.
|
|
7
|
+
*
|
|
8
|
+
* Why a rollup: the authoring surface re-exports types from internal workspace
|
|
9
|
+
* packages that ship `.ts` source (not published to npm), so a naive emit
|
|
10
|
+
* leaves dangling `@vellumai/*` imports that no external consumer can resolve.
|
|
11
|
+
* Microsoft API Extractor inlines exactly the reachable declarations into one
|
|
12
|
+
* file, so a standalone plugin repo type-checks against the real contract
|
|
13
|
+
* without vendoring a hand-maintained shim.
|
|
14
|
+
*
|
|
15
|
+
* Why a trivial runtime: inside a live assistant workspace the host
|
|
16
|
+
* materializes a `node_modules/@vellumai/plugin-api` shim that re-binds the
|
|
17
|
+
* already-loaded namespace off `globalThis` (see `ensure-plugin-api-shim.ts`).
|
|
18
|
+
* The published `index.js` is the same re-bind so the npm package behaves
|
|
19
|
+
* identically when present, and degrades to `undefined` exports when imported
|
|
20
|
+
* outside a host (it is a dev-time authoring contract, not a runtime library).
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* cd assistant && bun run scripts/build-plugin-api.ts --version 1.2.3
|
|
24
|
+
*
|
|
25
|
+
* Output: a ready-to-pack package directory (default
|
|
26
|
+
* `.plugin-api-build/package`) containing `package.json`, `index.d.ts`, and
|
|
27
|
+
* `index.js`. The release workflow runs `npm pack` / `npm publish` against it.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { execFileSync } from "node:child_process";
|
|
31
|
+
import {
|
|
32
|
+
cpSync,
|
|
33
|
+
existsSync,
|
|
34
|
+
mkdirSync,
|
|
35
|
+
readdirSync,
|
|
36
|
+
readFileSync,
|
|
37
|
+
rmSync,
|
|
38
|
+
symlinkSync,
|
|
39
|
+
writeFileSync,
|
|
40
|
+
} from "node:fs";
|
|
41
|
+
import { join, resolve } from "node:path";
|
|
42
|
+
|
|
43
|
+
import {
|
|
44
|
+
PLUGIN_API_EXPORTS,
|
|
45
|
+
PLUGIN_API_REGISTRY_KEY,
|
|
46
|
+
} from "../src/embedded/plugin-api.js";
|
|
47
|
+
|
|
48
|
+
const ASSISTANT_DIR = resolve(import.meta.dir, "..");
|
|
49
|
+
const NODE_MODULES = join(ASSISTANT_DIR, "node_modules");
|
|
50
|
+
const TSC = join(NODE_MODULES, ".bin", "tsc");
|
|
51
|
+
const API_EXTRACTOR = join(NODE_MODULES, ".bin", "api-extractor");
|
|
52
|
+
|
|
53
|
+
/** The published types reference `z.*`, so the package declares the same `zod`
|
|
54
|
+
* version the assistant resolved — read from the installed package so it can
|
|
55
|
+
* never drift from the contract the rollup was generated against. */
|
|
56
|
+
const ZOD_VERSION = (
|
|
57
|
+
JSON.parse(
|
|
58
|
+
readFileSync(join(NODE_MODULES, "zod", "package.json"), "utf8"),
|
|
59
|
+
) as { version: string }
|
|
60
|
+
).version;
|
|
61
|
+
|
|
62
|
+
interface Args {
|
|
63
|
+
version: string;
|
|
64
|
+
buildDir: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parseArgs(argv: string[]): Args {
|
|
68
|
+
let version = "";
|
|
69
|
+
let buildDir = join(ASSISTANT_DIR, ".plugin-api-build");
|
|
70
|
+
for (let i = 0; i < argv.length; i++) {
|
|
71
|
+
const arg = argv[i];
|
|
72
|
+
if (arg === "--version") version = argv[++i] ?? "";
|
|
73
|
+
else if (arg === "--out") buildDir = resolve(argv[++i] ?? "");
|
|
74
|
+
}
|
|
75
|
+
if (!version) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
"Missing required --version <semver> (the release version to stamp).",
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return { version, buildDir };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function run(bin: string, args: string[], cwd: string): void {
|
|
84
|
+
execFileSync(bin, args, { cwd, stdio: "inherit" });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Emit `.d.ts` for one workspace contract package into `dest`, resolving its
|
|
88
|
+
* dependencies through `assistant/node_modules` (the layout CI produces after
|
|
89
|
+
* `bun install`). Returns true if a usable `index.d.ts` was produced. */
|
|
90
|
+
function emitContract(pkgDir: string, dest: string): boolean {
|
|
91
|
+
try {
|
|
92
|
+
execFileSync(
|
|
93
|
+
TSC,
|
|
94
|
+
[
|
|
95
|
+
"--emitDeclarationOnly",
|
|
96
|
+
"--declaration",
|
|
97
|
+
"--declarationMap",
|
|
98
|
+
"false",
|
|
99
|
+
"--sourceMap",
|
|
100
|
+
"false",
|
|
101
|
+
"--rootDir",
|
|
102
|
+
"src",
|
|
103
|
+
"--outDir",
|
|
104
|
+
dest,
|
|
105
|
+
],
|
|
106
|
+
{ cwd: pkgDir, stdio: "pipe" },
|
|
107
|
+
);
|
|
108
|
+
} catch {
|
|
109
|
+
// Best-effort: a package that fails to emit standalone is only a problem
|
|
110
|
+
// if the public surface actually reaches it, in which case API Extractor
|
|
111
|
+
// fails loudly below with the offending unresolved import.
|
|
112
|
+
}
|
|
113
|
+
return existsSync(join(dest, "index.d.ts"));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface ContractPackageJson {
|
|
117
|
+
name: string;
|
|
118
|
+
version?: string;
|
|
119
|
+
type?: string;
|
|
120
|
+
exports?: Record<string, unknown>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Write a `package.json` for an emitted contract whose `types`/`exports`
|
|
124
|
+
* resolve to the `.d.ts` files (not the unpublished `src/*.ts`). API
|
|
125
|
+
* Extractor resolves a `bundledPackage`'s entry through its real
|
|
126
|
+
* `package.json`, so without this it would follow `exports` back to source
|
|
127
|
+
* and reject the `.ts`. Subpath keys map to same-named `.d.ts` siblings. */
|
|
128
|
+
function writeContractManifest(srcManifestPath: string, destDir: string): void {
|
|
129
|
+
const orig = JSON.parse(
|
|
130
|
+
readFileSync(srcManifestPath, "utf8"),
|
|
131
|
+
) as ContractPackageJson;
|
|
132
|
+
const origExports = orig.exports ?? { ".": "./src/index.ts" };
|
|
133
|
+
const exports: Record<string, string> = {};
|
|
134
|
+
for (const key of Object.keys(origExports)) {
|
|
135
|
+
exports[key] = key === "." ? "./index.d.ts" : `${key}.d.ts`;
|
|
136
|
+
}
|
|
137
|
+
writeFileSync(
|
|
138
|
+
join(destDir, "package.json"),
|
|
139
|
+
`${JSON.stringify(
|
|
140
|
+
{
|
|
141
|
+
name: orig.name,
|
|
142
|
+
version: orig.version ?? "0.0.0",
|
|
143
|
+
type: orig.type ?? "module",
|
|
144
|
+
types: "./index.d.ts",
|
|
145
|
+
exports,
|
|
146
|
+
},
|
|
147
|
+
null,
|
|
148
|
+
2,
|
|
149
|
+
)}\n`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function buildRuntimeShim(): string {
|
|
154
|
+
const key = JSON.stringify(PLUGIN_API_REGISTRY_KEY.description ?? "");
|
|
155
|
+
const lines = [
|
|
156
|
+
"// Generated by scripts/build-plugin-api.ts — do not edit by hand.",
|
|
157
|
+
`const api = globalThis[Symbol.for(${key})] ?? {};`,
|
|
158
|
+
...PLUGIN_API_EXPORTS.map((name) => `export const ${name} = api.${name};`),
|
|
159
|
+
];
|
|
160
|
+
return `${lines.join("\n")}\n`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function main(): void {
|
|
164
|
+
const { version, buildDir } = parseArgs(Bun.argv.slice(2));
|
|
165
|
+
|
|
166
|
+
const outDir = join(buildDir, "out");
|
|
167
|
+
const pkgDir = join(buildDir, "package");
|
|
168
|
+
const nodeModulesDir = join(buildDir, "node_modules");
|
|
169
|
+
const vellumOverlay = join(nodeModulesDir, "@vellumai");
|
|
170
|
+
|
|
171
|
+
rmSync(buildDir, { recursive: true, force: true });
|
|
172
|
+
mkdirSync(vellumOverlay, { recursive: true });
|
|
173
|
+
|
|
174
|
+
// 1. Emit declarations for the authoring surface and everything it reaches.
|
|
175
|
+
console.log("[plugin-api] emitting authoring-surface declarations…");
|
|
176
|
+
run(TSC, ["-p", "tsconfig.plugin-api.json"], ASSISTANT_DIR);
|
|
177
|
+
|
|
178
|
+
// 2. Emit each `@vellumai/*` contract the surface reaches into an overlay
|
|
179
|
+
// `node_modules`, each with a `package.json` pointing at its `.d.ts`, so
|
|
180
|
+
// API Extractor inlines them (as `bundledPackages`) instead of leaving
|
|
181
|
+
// dangling `@vellumai/*` imports an external consumer can't resolve.
|
|
182
|
+
console.log("[plugin-api] emitting workspace contract declarations…");
|
|
183
|
+
const vellumDir = join(NODE_MODULES, "@vellumai");
|
|
184
|
+
const bundled: string[] = [];
|
|
185
|
+
for (const name of readdirSync(vellumDir)) {
|
|
186
|
+
const dir = join(vellumDir, name);
|
|
187
|
+
if (!existsSync(join(dir, "tsconfig.json"))) continue;
|
|
188
|
+
if (!existsSync(join(dir, "src"))) continue;
|
|
189
|
+
const dest = join(vellumOverlay, name);
|
|
190
|
+
if (emitContract(dir, dest)) {
|
|
191
|
+
writeContractManifest(join(dir, "package.json"), dest);
|
|
192
|
+
bundled.push(`@vellumai/${name}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
bundled.sort();
|
|
196
|
+
|
|
197
|
+
// `zod` is the sole external dependency of the rolled-up surface; symlink it
|
|
198
|
+
// so the compiler resolves it while API Extractor leaves it as an import.
|
|
199
|
+
symlinkSync(join(NODE_MODULES, "zod"), join(nodeModulesDir, "zod"), "dir");
|
|
200
|
+
|
|
201
|
+
// 3. Generate the API Extractor compiler tsconfig + config.
|
|
202
|
+
writeFileSync(
|
|
203
|
+
join(buildDir, "tsconfig.dts.json"),
|
|
204
|
+
`${JSON.stringify(
|
|
205
|
+
{
|
|
206
|
+
compilerOptions: {
|
|
207
|
+
target: "ES2022",
|
|
208
|
+
module: "NodeNext",
|
|
209
|
+
moduleResolution: "NodeNext",
|
|
210
|
+
skipLibCheck: true,
|
|
211
|
+
types: [],
|
|
212
|
+
},
|
|
213
|
+
include: ["dts/**/*.d.ts"],
|
|
214
|
+
},
|
|
215
|
+
null,
|
|
216
|
+
2,
|
|
217
|
+
)}\n`,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
writeFileSync(
|
|
221
|
+
join(buildDir, "api-extractor.json"),
|
|
222
|
+
`${JSON.stringify(
|
|
223
|
+
{
|
|
224
|
+
$schema:
|
|
225
|
+
"https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
226
|
+
projectFolder: ".",
|
|
227
|
+
mainEntryPointFilePath: "<projectFolder>/dts/plugin-api/index.d.ts",
|
|
228
|
+
bundledPackages: bundled,
|
|
229
|
+
compiler: { tsconfigFilePath: "<projectFolder>/tsconfig.dts.json" },
|
|
230
|
+
dtsRollup: {
|
|
231
|
+
enabled: true,
|
|
232
|
+
untrimmedFilePath: "<projectFolder>/out/index.d.ts",
|
|
233
|
+
},
|
|
234
|
+
apiReport: { enabled: false },
|
|
235
|
+
docModel: { enabled: false },
|
|
236
|
+
tsdocMetadata: { enabled: false },
|
|
237
|
+
messages: {
|
|
238
|
+
compilerMessageReporting: { default: { logLevel: "none" } },
|
|
239
|
+
extractorMessageReporting: { default: { logLevel: "none" } },
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
null,
|
|
243
|
+
2,
|
|
244
|
+
)}\n`,
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
// 4. Roll up the reachable declarations into a single self-contained file.
|
|
248
|
+
console.log("[plugin-api] rolling up declarations with API Extractor…");
|
|
249
|
+
run(API_EXTRACTOR, ["run", "--local", "-c", "api-extractor.json"], buildDir);
|
|
250
|
+
|
|
251
|
+
const rollup = join(outDir, "index.d.ts");
|
|
252
|
+
if (!existsSync(rollup)) {
|
|
253
|
+
throw new Error(`API Extractor did not produce ${rollup}`);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// 5. Assemble the publishable package directory.
|
|
257
|
+
mkdirSync(pkgDir, { recursive: true });
|
|
258
|
+
cpSync(rollup, join(pkgDir, "index.d.ts"));
|
|
259
|
+
writeFileSync(join(pkgDir, "index.js"), buildRuntimeShim());
|
|
260
|
+
writeFileSync(
|
|
261
|
+
join(pkgDir, "package.json"),
|
|
262
|
+
`${JSON.stringify(
|
|
263
|
+
{
|
|
264
|
+
name: "@vellumai/plugin-api",
|
|
265
|
+
version,
|
|
266
|
+
description:
|
|
267
|
+
"Public TypeScript authoring contract for Vellum assistant plugins.",
|
|
268
|
+
license: "MIT",
|
|
269
|
+
type: "module",
|
|
270
|
+
main: "./index.js",
|
|
271
|
+
types: "./index.d.ts",
|
|
272
|
+
exports: {
|
|
273
|
+
".": {
|
|
274
|
+
types: "./index.d.ts",
|
|
275
|
+
import: "./index.js",
|
|
276
|
+
default: "./index.js",
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
files: ["index.js", "index.d.ts"],
|
|
280
|
+
dependencies: { zod: ZOD_VERSION },
|
|
281
|
+
publishConfig: { access: "public" },
|
|
282
|
+
repository: {
|
|
283
|
+
type: "git",
|
|
284
|
+
url: "git+https://github.com/vellum-ai/vellum-assistant.git",
|
|
285
|
+
directory: "assistant/src/plugin-api",
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
null,
|
|
289
|
+
2,
|
|
290
|
+
)}\n`,
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
console.log(
|
|
294
|
+
`[plugin-api] built @vellumai/plugin-api@${version} → ${pkgDir}\n` +
|
|
295
|
+
`[plugin-api] inlined contracts: ${bundled.join(", ")}`,
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
main();
|