diff --git a/.ai/AGENTS.md b/.ai/AGENTS.md deleted file mode 100644 index 8eac1091..00000000 --- a/.ai/AGENTS.md +++ /dev/null @@ -1,22 +0,0 @@ -# Transloadit Repository Guide - -This document serves as a quick reference for agentic coding assistants working in this repository. - -## Check your work - -After making changes, always run `corepack yarn check`, which runs Knip (with fixes/removals), -lints TypeScript, formats code, and runs quick unit tests. Remember that Knip and formatting may -make changes that you must review and commit when you touched the affected files. - -## When running in GitHub Actions - -When in running in a GitHub Actions context, always commit changes to a non-`main` branch, and never -forget to push. Even if there was an error, when in GHA context, commit your work to a branch and -push it so we can inspect it and continue in a next run. - -## More important rules - -Detailed guidelines are organized in the following files, read them carefully when applicable: - -@.ai/rules/coding-style.mdc @.ai/rules/typescript.mdc @.ai/rules/cli-scripts.mdc -@.ai/rules/general.mdc @.ai/rules/repo.mdc diff --git a/.ai/rules/general.mdc b/.ai/rules/general.mdc index 72d7c086..bb5f8659 100644 --- a/.ai/rules/general.mdc +++ b/.ai/rules/general.mdc @@ -11,4 +11,5 @@ General: - Avoid blocking the conversation with terminal commands. For example: A) most of my git commands run through pagers, so pipe their output to `cat` to avoid blocking the terminal. B) You can use `tail` for logs, but be smart and use `-n` instead of `-f`, or the conversation will block - Use the `gh` tool to interact with GitHub (search/view an Issue, create a PR). +- Treat `AGENTS.md` and `CLAUDE.md` as generated artifacts (single source of truth is `.ai/rules/`), managed by `~/code/content/_scripts/alphalib-sync.ts`; never edit those files directly. If you'd like to make a modification, do it here in `.ai/rules/` and the script will ensure proper preservation and syncing. If you need a rule specific to this repo, add it to `.ai/rules/repo.mdc`. - All new files are to be in TypeScript. Even if someone suggests: make this new foo3 feature, model it after `foo1.js`, create: `foo3.ts`. Chances are, a `foo2.ts` already exist that you can take a look at also for inspiration. diff --git a/.ai/rules/pr-comments.mdc b/.ai/rules/pr-comments.mdc deleted file mode 100644 index f5e658fb..00000000 --- a/.ai/rules/pr-comments.mdc +++ /dev/null @@ -1,25 +0,0 @@ ---- -description: -globs: -alwaysApply: false ---- -goal: address PR comments - -- get PR comments -```bash -# Find PR for current branch -gh pr list --head $(git branch --show-current) | cat - -# Get inline comments (most important) -gh api repos/:owner/:repo/pulls/PR_NUMBER/comments --jq '.[] | {author: .user.login, body: .body, path: .path, line: .line}' | cat - -# Get review comments if needed -gh api repos/:owner/:repo/pulls/PR_NUMBER/reviews --jq '.[] | select(.body != "") | {author: .user.login, body: .body}' | cat -``` - -- if no PR exists, abort -- suggest fixes for each comment -- always use `| cat` - - - diff --git a/.ai/rules/typescript.mdc b/.ai/rules/typescript.mdc index d7388a2a..dc51359c 100644 --- a/.ai/rules/typescript.mdc +++ b/.ai/rules/typescript.mdc @@ -9,7 +9,7 @@ For Typescript: - Favor `from './PosterboyCommand.ts'` over `from './PosterboyCommand'` - Favor `return ideas.filter(isPresent)` over `ideas.filter((idea): idea is Idea => idea !== null)` - Favor using `.tsx` over `.jsx` file extensions. -- Use Node v24's native typestripping vs `tsx` or `ts-node`. These days we do not even need to pass `--experimental-strip-types`, `node app.ts` will just work. +- Use Node v24's native typestripping vs `tsx` or `ts-node`. These days you do not even need to pass `--experimental-strip-types`, `node app.ts` will just work. - Favor `satisfies` over `as`, consider `as` a sin - Favor `unknown` over `any`, consider `any` a sin - Favor validating data with Zod over using `any` or custom type guards diff --git a/AGENTS.md b/AGENTS.md deleted file mode 120000 index b28461c9..00000000 --- a/AGENTS.md +++ /dev/null @@ -1 +0,0 @@ -.ai/AGENTS.md \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..f68a8797 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,73 @@ +# Transloadit Repository Guide + +## coding style + +Coding style: + +- Favor `async run() {` over `run = async () => {` inside ES6 classes +- Favor `if (!(err instanceof Error)) { throw new Error(`Was thrown a non-error: ${err}`) }` inside + `catch` blocks to ensure the `error` is always an instance of `Error` +- Favor using real paths (`../lib/schemas.ts`) over aliases (`@/app/lib/schemas`). +- Favor `for (const comment of comments) {` over `comments.forEach((comment) => {` +- Favor named exports over default exports, with the exception of Next.js pages +- Do not wrap each function body and function call in `try`/`catch` blocks. It pollutes the code. + Assume we will always have an e.g. + `main().catch((err) => { console.error(err); process.exit(1) })` to catch us. I repeat: Avoid + over-use of try-catch such as + `try { // foo } catch (err) { console.error('error while foo'); throw err }`, assume we catch + errors on a higher level and do not need the extra explananation. +- If you must use try/catch, for simple cases, favor `alphalib/tryCatch.ts` + (`const [err, data] = await tryCatch(promise)`) over + `let data; try { data = await promise } catch (err) { }` +- Before creating new files and new code, see if we can leverage existing work, maybe slighty adapt + that without breaking BC, to keep things DRY. +- Favor early exits, so quickly `continue`, `return false` (or `throw` if needed), over nesting + everything in positive conditions, creating christmas trees. +- Use Prettier with 100 char line width, single quotes for JS/TS, semi: false +- Use descriptive names: PascalCase for components/types, camelCase for variables/methods/schemas +- Alphabetize imports, group by source type (built-in/external/internal) +- Favor US English over UK English, so `summarizeError` over `summarise Error` +- Favor `.replaceAll('a', 'b)` over `.replace(/a/g, 'b')` or `.replace(new RegExp('a', 'g'), 'b')` when the only need for regeses was replacing all strings. That's usually both easier to read and more performant. +- Use typographic characters: ellipsis (`…`) instead of `...`, curly quotes (`'` `"`) instead of straight quotes in user-facing text +- Put API keys and secrets in `.env` files, not hardcoded in components +- Check for existing hooks before creating new ones (e.g., `useUppy()` for Uppy functionality) + +## general + +General: + +- Do not touch `.env` files! +- Favor Yarn (4) over npm +- Never run any dev server yourself. I have one running that auto-reloads on changes. +- Avoid blocking the conversation with terminal commands. For example: A) most of my git commands run through pagers, so pipe their output to `cat` to avoid blocking the + terminal. B) You can use `tail` for logs, but be smart and use `-n` instead of `-f`, or the conversation will block +- Use the `gh` tool to interact with GitHub (search/view an Issue, create a PR). +- Treat `AGENTS.md` and `CLAUDE.md` as generated artifacts (single source of truth is `.ai/rules/`), managed by `~/code/content/_scripts/alphalib-sync.ts`; never edit those files directly. If you'd like to make a modification, do it here in `.ai/rules/` and the script will ensure proper preservation and syncing. If you need a rule specific to this repo, add it to `.ai/rules/repo.mdc`. +- All new files are to be in TypeScript. Even if someone suggests: make this new foo3 feature, model it after `foo1.js`, create: `foo3.ts`. Chances are, a `foo2.ts` already exist that you can take a look at also for inspiration. + +## playwright + +- Prefer user-centric locators: `getByRole`/`getByText` with accessible names; avoid `page.locator('body')`, `innerText()`, or raw CSS unless there is no accessible alternative. +- Make positive assertions on expected UI/text instead of looping over regexes to assert absence. +- Keep tests simple: no control-flow loops or extra variables for straightforward assertions. +- Navigate with relative URLs (`page.goto('/path')`) by setting `baseURL` in `playwright.config.ts`; avoid stringing environment URLs in tests. +- Stub or mock external/third‑party requests (Intercom, Sentry, etc.) and any auth/login endpoints to keep tests deterministic; return minimal valid JSON when the app expects data. +- Each unexpected error should surface and fail the test. + +## typescript + +For Typescript: + +- Favor `contentGapItemSchema = z.object()` over `ContentGapItemSchema = z.object()` +- Favor `from './PosterboyCommand.ts'` over `from './PosterboyCommand'` +- Favor `return ideas.filter(isPresent)` over `ideas.filter((idea): idea is Idea => idea !== null)` +- Favor using `.tsx` over `.jsx` file extensions. +- Use Node v24's native typestripping vs `tsx` or `ts-node`. These days you do not even need to pass `--experimental-strip-types`, `node app.ts` will just work. +- Favor `satisfies` over `as`, consider `as` a sin +- Favor `unknown` over `any`, consider `any` a sin +- Favor validating data with Zod over using `any` or custom type guards +- We use the `rewriteRelativeImportExtensions` TS 5.7 compiler option, so for local TypeScript + files, import with the `.ts` / `.tsx` extension (not js, not extensionless) +- Favor defining props as an interface over inline +- Favor explicit return types over inferring them as it makes typescript a lot faster in the editor + on our scale diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 120000 index b28461c9..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1 +0,0 @@ -.ai/AGENTS.md \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..f68a8797 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,73 @@ +# Transloadit Repository Guide + +## coding style + +Coding style: + +- Favor `async run() {` over `run = async () => {` inside ES6 classes +- Favor `if (!(err instanceof Error)) { throw new Error(`Was thrown a non-error: ${err}`) }` inside + `catch` blocks to ensure the `error` is always an instance of `Error` +- Favor using real paths (`../lib/schemas.ts`) over aliases (`@/app/lib/schemas`). +- Favor `for (const comment of comments) {` over `comments.forEach((comment) => {` +- Favor named exports over default exports, with the exception of Next.js pages +- Do not wrap each function body and function call in `try`/`catch` blocks. It pollutes the code. + Assume we will always have an e.g. + `main().catch((err) => { console.error(err); process.exit(1) })` to catch us. I repeat: Avoid + over-use of try-catch such as + `try { // foo } catch (err) { console.error('error while foo'); throw err }`, assume we catch + errors on a higher level and do not need the extra explananation. +- If you must use try/catch, for simple cases, favor `alphalib/tryCatch.ts` + (`const [err, data] = await tryCatch(promise)`) over + `let data; try { data = await promise } catch (err) { }` +- Before creating new files and new code, see if we can leverage existing work, maybe slighty adapt + that without breaking BC, to keep things DRY. +- Favor early exits, so quickly `continue`, `return false` (or `throw` if needed), over nesting + everything in positive conditions, creating christmas trees. +- Use Prettier with 100 char line width, single quotes for JS/TS, semi: false +- Use descriptive names: PascalCase for components/types, camelCase for variables/methods/schemas +- Alphabetize imports, group by source type (built-in/external/internal) +- Favor US English over UK English, so `summarizeError` over `summarise Error` +- Favor `.replaceAll('a', 'b)` over `.replace(/a/g, 'b')` or `.replace(new RegExp('a', 'g'), 'b')` when the only need for regeses was replacing all strings. That's usually both easier to read and more performant. +- Use typographic characters: ellipsis (`…`) instead of `...`, curly quotes (`'` `"`) instead of straight quotes in user-facing text +- Put API keys and secrets in `.env` files, not hardcoded in components +- Check for existing hooks before creating new ones (e.g., `useUppy()` for Uppy functionality) + +## general + +General: + +- Do not touch `.env` files! +- Favor Yarn (4) over npm +- Never run any dev server yourself. I have one running that auto-reloads on changes. +- Avoid blocking the conversation with terminal commands. For example: A) most of my git commands run through pagers, so pipe their output to `cat` to avoid blocking the + terminal. B) You can use `tail` for logs, but be smart and use `-n` instead of `-f`, or the conversation will block +- Use the `gh` tool to interact with GitHub (search/view an Issue, create a PR). +- Treat `AGENTS.md` and `CLAUDE.md` as generated artifacts (single source of truth is `.ai/rules/`), managed by `~/code/content/_scripts/alphalib-sync.ts`; never edit those files directly. If you'd like to make a modification, do it here in `.ai/rules/` and the script will ensure proper preservation and syncing. If you need a rule specific to this repo, add it to `.ai/rules/repo.mdc`. +- All new files are to be in TypeScript. Even if someone suggests: make this new foo3 feature, model it after `foo1.js`, create: `foo3.ts`. Chances are, a `foo2.ts` already exist that you can take a look at also for inspiration. + +## playwright + +- Prefer user-centric locators: `getByRole`/`getByText` with accessible names; avoid `page.locator('body')`, `innerText()`, or raw CSS unless there is no accessible alternative. +- Make positive assertions on expected UI/text instead of looping over regexes to assert absence. +- Keep tests simple: no control-flow loops or extra variables for straightforward assertions. +- Navigate with relative URLs (`page.goto('/path')`) by setting `baseURL` in `playwright.config.ts`; avoid stringing environment URLs in tests. +- Stub or mock external/third‑party requests (Intercom, Sentry, etc.) and any auth/login endpoints to keep tests deterministic; return minimal valid JSON when the app expects data. +- Each unexpected error should surface and fail the test. + +## typescript + +For Typescript: + +- Favor `contentGapItemSchema = z.object()` over `ContentGapItemSchema = z.object()` +- Favor `from './PosterboyCommand.ts'` over `from './PosterboyCommand'` +- Favor `return ideas.filter(isPresent)` over `ideas.filter((idea): idea is Idea => idea !== null)` +- Favor using `.tsx` over `.jsx` file extensions. +- Use Node v24's native typestripping vs `tsx` or `ts-node`. These days you do not even need to pass `--experimental-strip-types`, `node app.ts` will just work. +- Favor `satisfies` over `as`, consider `as` a sin +- Favor `unknown` over `any`, consider `any` a sin +- Favor validating data with Zod over using `any` or custom type guards +- We use the `rewriteRelativeImportExtensions` TS 5.7 compiler option, so for local TypeScript + files, import with the `.ts` / `.tsx` extension (not js, not extensionless) +- Favor defining props as an interface over inline +- Favor explicit return types over inferring them as it makes typescript a lot faster in the editor + on our scale diff --git a/docs/fingerprint/transloadit-baseline.json b/docs/fingerprint/transloadit-baseline.json index 19f2fb2f..521052f5 100644 --- a/docs/fingerprint/transloadit-baseline.json +++ b/docs/fingerprint/transloadit-baseline.json @@ -2,8 +2,8 @@ "packageDir": "/home/kvz/code/node-sdk/packages/transloadit", "tarball": { "filename": "transloadit-4.7.5.tgz", - "sizeBytes": 1247607, - "sha256": "8ece4cbf0df04422d189035abb22a80c0565f95e5b10488d0e9226277702e363" + "sizeBytes": 1250742, + "sha256": "195c48c7b93e44360d29e3c74d3dbb720503242123a7a57c3387000c71b72c1a" }, "packageJson": { "name": "transloadit", @@ -88,8 +88,8 @@ }, { "path": "dist/alphalib/types/assemblyStatus.js", - "sizeBytes": 31003, - "sha256": "d8b1b0695044286e9699caf0fad4f8a2f8d4b7277f349ca3cfe8f4fe761f383a" + "sizeBytes": 31124, + "sha256": "1133e32f2dcf546c9713fe5832b6b83107dbf9a7dd3f661217ff83acc5fd8c67" }, { "path": "dist/alphalib/types/assemblyUrls.js", @@ -171,6 +171,11 @@ "sizeBytes": 2328, "sha256": "fee6e43bf67ac5c5b2187300fde17c075e0ffc83a13b04d6485649ce23bd61e3" }, + { + "path": "dist/alphalib/types/builtinTemplates.js", + "sizeBytes": 552, + "sha256": "c69974779485260068e93df6949ae05b36270f233618748b831c7acc7dfabba2" + }, { "path": "dist/cli.js", "sizeBytes": 1147, @@ -501,6 +506,11 @@ "sizeBytes": 3455, "sha256": "4c023f0931db25b7d99da7f56828d5d7d2132c6e467ceda0bb764a0ec21d2555" }, + { + "path": "dist/alphalib/types/skillFrontmatter.js", + "sizeBytes": 735, + "sha256": "2e8f00ddd7bf432577ec78c7d6ba1dc41de55b6f7e47056e4205272a24263302" + }, { "path": "dist/alphalib/types/robots/speech-transcribe.js", "sizeBytes": 5236, @@ -543,8 +553,8 @@ }, { "path": "dist/alphalib/types/template.js", - "sizeBytes": 10452, - "sha256": "b48fbb82af77032c3076c5016410f251759ad295344557215753d931679c0679" + "sizeBytes": 11108, + "sha256": "73cd432fb80df101ca0be422259d19165c01ef5ba766d80d79d40039890a5778" }, { "path": "dist/alphalib/types/templateCredential.js", @@ -753,8 +763,8 @@ }, { "path": "dist/alphalib/types/assembliesGet.d.ts.map", - "sizeBytes": 263, - "sha256": "df2b0c48f851d217f2c2d31c8eb287c5eef4864eacaa0850fd3ac340a632487b" + "sizeBytes": 268, + "sha256": "fc283742483b93e310e1143160f1c9aa695ba81fd7f920b981c9f3840e6d6c56" }, { "path": "dist/alphalib/types/assembliesGet.js.map", @@ -803,8 +813,8 @@ }, { "path": "dist/alphalib/types/assemblyReplay.d.ts.map", - "sizeBytes": 8189, - "sha256": "e76e1ab44b84878a3dc753d8e36e57a11547e3c281b4359b9fa693c66b685553" + "sizeBytes": 8194, + "sha256": "846c0c704890f286cc083d9a71fddf0c84d24f592ef573dff88f6d60ce84837a" }, { "path": "dist/alphalib/types/assemblyReplay.js.map", @@ -813,8 +823,8 @@ }, { "path": "dist/alphalib/types/assemblyReplayNotification.d.ts.map", - "sizeBytes": 8204, - "sha256": "4b5267d560245ecc7a60dbe045fb16feb88b433030b1f74b65a617207ba1505b" + "sizeBytes": 8209, + "sha256": "165d4b295a8d037be82cfc678675f26daa5a92ee023ca9e74f301bea9a93f81a" }, { "path": "dist/alphalib/types/assemblyReplayNotification.js.map", @@ -824,12 +834,12 @@ { "path": "dist/alphalib/types/assemblyStatus.d.ts.map", "sizeBytes": 74450, - "sha256": "35152821982e71642fa8ec06ee38969a55d05a198bb7baf4108661407ccc27bc" + "sha256": "a455e6ceace04dd94f276f2c0c3b0ba568874ccc2e7268175004aad62ea52779" }, { "path": "dist/alphalib/types/assemblyStatus.js.map", - "sizeBytes": 33281, - "sha256": "c9bdbffd86d923fddbb7d65035870e8eeb71278ed4676eb80c6273f67c73fc7a" + "sizeBytes": 33305, + "sha256": "b298a07cd042be194d1993f0c12f034e3a64284f4cf159004215f2606399eb45" }, { "path": "dist/alphalib/types/assemblyUrls.d.ts.map", @@ -973,8 +983,8 @@ }, { "path": "dist/alphalib/types/bill.d.ts.map", - "sizeBytes": 233, - "sha256": "100418a9cbbb497bd3deb4fba29c4bff7cd202c869085f2ac1cd1293d403548a" + "sizeBytes": 238, + "sha256": "de09c0cdc898a68b88a8009ba4d6656c8534881309b7f45b4dfa8a89abe76481" }, { "path": "dist/alphalib/types/bill.js.map", @@ -991,6 +1001,16 @@ "sizeBytes": 2277, "sha256": "15f2a633092558d16a9026ac829a4458e6ff4e3f4b51f5277c40f9785df82cc0" }, + { + "path": "dist/alphalib/types/builtinTemplates.d.ts.map", + "sizeBytes": 400, + "sha256": "7ae83c04c8d92b40e298959e720330472610945d7893e07d086d43b1ba862dc8" + }, + { + "path": "dist/alphalib/types/builtinTemplates.js.map", + "sizeBytes": 790, + "sha256": "b734fed0fe28149adef6544cf1757012ccd7d5604e613e03ca957ebef6d1c5d3" + }, { "path": "dist/cli.d.ts.map", "sizeBytes": 278, @@ -1651,6 +1671,16 @@ "sizeBytes": 1972, "sha256": "9e1dd16cb07a33783ce79a07599589d90c6991eb4d17f042e07bd41b04be52be" }, + { + "path": "dist/alphalib/types/skillFrontmatter.d.ts.map", + "sizeBytes": 321, + "sha256": "cda25ca57722150190a863bb66603725346a239b07bd923f3c99134b50c1256a" + }, + { + "path": "dist/alphalib/types/skillFrontmatter.js.map", + "sizeBytes": 849, + "sha256": "bb0c691cc73f29d66b7a2d5acedce100b80a39ddc44ab55f5931d693f6d01485" + }, { "path": "dist/alphalib/types/robots/speech-transcribe.d.ts.map", "sizeBytes": 1260, @@ -1733,18 +1763,18 @@ }, { "path": "dist/alphalib/types/template.d.ts.map", - "sizeBytes": 134426, - "sha256": "73aedc14d95de2fe06f515872b36f65bbfcb6fb72975037d80c55aab8e2537ff" + "sizeBytes": 134462, + "sha256": "b4889f17b1e437b7cd7f0a99e57039d33ece349937641071e49737b2a1f1e791" }, { "path": "dist/alphalib/types/template.js.map", - "sizeBytes": 5214, - "sha256": "df5e14bc81fcb702b288bb964fe05ac0f6976a0b4061e8dd6cc8586c19d18b9d" + "sizeBytes": 5478, + "sha256": "87dac3828a2fb9e514164589f9a03fced7b54715e69ee940f31102b0fb4f8749" }, { "path": "dist/alphalib/types/templateCredential.d.ts.map", - "sizeBytes": 347, - "sha256": "b47bd53ceca8cec91455635a28942287286b87d962de0b32bbf4afd785df1822" + "sizeBytes": 357, + "sha256": "fb41daf2fa6ce7cec41195bf5cae66d1eb1b49e2fdf8ee3dbed30fa218dcae3e" }, { "path": "dist/alphalib/types/templateCredential.js.map", @@ -2088,8 +2118,8 @@ }, { "path": "dist/alphalib/types/assembliesGet.d.ts", - "sizeBytes": 2112, - "sha256": "9708f78e367a541625e567768f5d2bc8339ec49057dd2fa454d5c7215216f7be" + "sizeBytes": 2369, + "sha256": "f793c28a1769069e8dc5e3199b6f1b16045da928e2db4f4088ff06c9befefa5b" }, { "path": "src/alphalib/types/assembliesGet.ts", @@ -2138,8 +2168,8 @@ }, { "path": "dist/alphalib/types/assemblyReplay.d.ts", - "sizeBytes": 417057, - "sha256": "c9075355284f9c11981b0de0d7e4890cf97da9487f8b5bec297a33ad20dc3ef9" + "sizeBytes": 417314, + "sha256": "cba4fb06897e0292503f0debac31963f0f72d04e1c3c576b09931775cbb4620c" }, { "path": "src/alphalib/types/assemblyReplay.ts", @@ -2148,8 +2178,8 @@ }, { "path": "dist/alphalib/types/assemblyReplayNotification.d.ts", - "sizeBytes": 416619, - "sha256": "7f30e55b769fc351b5766fbe1bf29e06e7791ce2b8747b81ab6cbc48e167bbb0" + "sizeBytes": 416876, + "sha256": "6c629acc4b45e95b137c66bc9fc2f16cf925c5b96c2b6a156f67bf8e8231557a" }, { "path": "src/alphalib/types/assemblyReplayNotification.ts", @@ -2158,13 +2188,13 @@ }, { "path": "dist/alphalib/types/assemblyStatus.d.ts", - "sizeBytes": 4255868, - "sha256": "bbfeb7f112fef5eb7f7207eff3c3941e17c7ce0a183f59c4461acd8cd27d0a2e" + "sizeBytes": 4256859, + "sha256": "4b639cd3a32022cbcdf12490bf2f0c7accd0e9f5b0712e1aa5e9b781e66086e8" }, { "path": "src/alphalib/types/assemblyStatus.ts", - "sizeBytes": 32643, - "sha256": "79af2c95a568024094bd7fe132b82d32638bfad0b0f062c3b0722f6e4dfc0492" + "sizeBytes": 32758, + "sha256": "be03fff16ebce38a346785e8453de2fe5b4a2e9a74129a39ad3a175864fc5e51" }, { "path": "dist/alphalib/types/assemblyUrls.d.ts", @@ -2308,8 +2338,8 @@ }, { "path": "dist/alphalib/types/bill.d.ts", - "sizeBytes": 1340, - "sha256": "addda1ad6e3507c37fa8eaa835c6ed57ede1206a732d0237e40f109d329549db" + "sizeBytes": 1597, + "sha256": "3c6abe444091b82dcaa62fb74d56ed5967d48b888c0ee3cb44b5ba451889d507" }, { "path": "src/alphalib/types/bill.ts", @@ -2326,6 +2356,16 @@ "sizeBytes": 2402, "sha256": "c3272b2808ff8ff1a2924aaea1431e01fb0bd46205861d5621d28ac08ef4f5f9" }, + { + "path": "dist/alphalib/types/builtinTemplates.d.ts", + "sizeBytes": 2371, + "sha256": "482bcbd513deb62fe3c512bc81c853ee828d982fcd5d527478778cd0cffc9d6a" + }, + { + "path": "src/alphalib/types/builtinTemplates.ts", + "sizeBytes": 601, + "sha256": "4216c2fedf539c16add2e93a4e0566fa2be63bcba2f65510766c4b0bcbef1dcb" + }, { "path": "dist/cli.d.ts", "sizeBytes": 256, @@ -2991,6 +3031,16 @@ "sizeBytes": 4129, "sha256": "8a2f0b5f00e281b04d9270286c679f2829e1c2b5186d41e96f495039a865ec08" }, + { + "path": "dist/alphalib/types/skillFrontmatter.d.ts", + "sizeBytes": 1052, + "sha256": "71e161a6adb25ae24dde3d097aa341225ad850e1d09cce367a1b52a7be4b051a" + }, + { + "path": "src/alphalib/types/skillFrontmatter.ts", + "sizeBytes": 748, + "sha256": "c7a523f8b386d00a55b392f94c578917161efc89e1494b98bf80305bb54503d6" + }, { "path": "dist/alphalib/types/robots/speech-transcribe.d.ts", "sizeBytes": 19949, @@ -3073,18 +3123,18 @@ }, { "path": "dist/alphalib/types/template.d.ts", - "sizeBytes": 7720893, - "sha256": "49fc04dc876673bef62e46aa6e8c61d74b75aa96bb1d6a5e6d151be18fbbd8db" + "sizeBytes": 7722903, + "sha256": "a33a90105aea2a848e33f64eac5811f3af602648bdecf2a78b7e83a8a6da1aa4" }, { "path": "src/alphalib/types/template.ts", - "sizeBytes": 11635, - "sha256": "4c72d99aefee3ffe6dc9fb285f51773d7446b24b4d6fff4aafb0a8d5b89efa18" + "sizeBytes": 12309, + "sha256": "96d1cf2f90fa99ae87ee69f9a39d7379ddcb4ef9ad1e0c74435faee2f9eaf7f2" }, { "path": "dist/alphalib/types/templateCredential.d.ts", - "sizeBytes": 3526, - "sha256": "7cdf3efb031ed1d5e202644aa7ce8a18301d0c765058b699855af4d7d70cb35e" + "sizeBytes": 4040, + "sha256": "48876e7e71edff9b3945f298730415b986b1a9fb255598cacdc4d1e20c8ec564" }, { "path": "src/alphalib/types/templateCredential.ts", diff --git a/packages/node/src/alphalib/types/assemblyStatus.ts b/packages/node/src/alphalib/types/assemblyStatus.ts index 6bfbd8d7..201f2cc1 100644 --- a/packages/node/src/alphalib/types/assemblyStatus.ts +++ b/packages/node/src/alphalib/types/assemblyStatus.ts @@ -48,6 +48,7 @@ export const assemblyStatusErrCodeSchema = z.enum([ 'ASSEMBLY_NOTIFICATION_NOT_REPLAYED', 'ASSEMBLY_NOTIFICATIONS_LIST_ERROR', 'ASSEMBLY_NO_NOTIFY_URL', + 'ASSEMBLY_PLAN_FILE_SIZE_LIMIT_EXCEEDED', 'ASSEMBLY_ROBOT_MISSING', 'ASSEMBLY_SATURATED', 'ASSEMBLY_STATS_ERROR', @@ -122,6 +123,7 @@ export const assemblyStatusErrCodeSchema = z.enum([ 'INVALID_ASSEMBLY_STATUS', 'INVALID_AUTH_EXPIRES_PARAMETER', 'INVALID_AUTH_KEY_PARAMETER', + 'INVALID_AUTH_MAX_NUMBER_OF_FILES_PARAMETER', 'INVALID_AUTH_MAX_SIZE_PARAMETER', 'INVALID_AUTH_REFERER_PARAMETER', 'INVALID_FILE_META_DATA', @@ -133,6 +135,7 @@ export const assemblyStatusErrCodeSchema = z.enum([ 'INVALID_STEP_NAME', 'INVALID_TEMPLATE_FIELD', 'INVALID_UPLOAD_HANDLE_STEP_NAME', + 'MAX_NUMBER_OF_FILES_EXCEEDED', 'MAX_SIZE_EXCEEDED', 'NO_AUTH_EXPIRES_PARAMETER', 'NO_AUTH_KEY_PARAMETER', @@ -533,7 +536,7 @@ export const assemblyStatusBaseSchema = z.object({ update_stream_url: z.string().optional(), tus_url: z.string().optional(), bytes_received: z.number().optional(), - bytes_expected: z.number().nullable().optional(), + bytes_expected: z.number().optional(), upload_duration: z.number().optional(), client_agent: z.string().nullable().optional(), client_ip: z.string().nullable().optional(), diff --git a/packages/node/src/alphalib/types/builtinTemplates.ts b/packages/node/src/alphalib/types/builtinTemplates.ts new file mode 100644 index 00000000..93ba5ddb --- /dev/null +++ b/packages/node/src/alphalib/types/builtinTemplates.ts @@ -0,0 +1,24 @@ +import { z } from 'zod' + +export const builtinTemplateDocSchema = z + .object({ + id: z.string(), + base: z.string(), + version: z.string(), + description: z.string(), + input: z.enum(['upload', 'remote_url', 'none']), + required_fields: z.array(z.string()), + optional_fields: z.array( + z + .object({ + name: z.string(), + default: z.string().optional(), + }) + .strict(), + ), + }) + .strict() + +export const builtinTemplateDocsSchema = z.array(builtinTemplateDocSchema) + +export type BuiltinTemplateDoc = z.infer diff --git a/packages/node/src/alphalib/types/skillFrontmatter.ts b/packages/node/src/alphalib/types/skillFrontmatter.ts new file mode 100644 index 00000000..0b925e8b --- /dev/null +++ b/packages/node/src/alphalib/types/skillFrontmatter.ts @@ -0,0 +1,24 @@ +import { z } from 'zod' + +/** + * Zod schema for Agent Skills SKILL.md frontmatter. + * @see https://agentskills.io/specification + */ +export const skillFrontmatterSchema = z.object({ + name: z + .string() + .min(1) + .max(64) + .regex( + /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, + 'Lowercase alphanumeric and hyphens only; must not start/end with hyphen', + ) + .refine((v) => !v.includes('--'), 'Must not contain consecutive hyphens'), + description: z.string().min(1).max(1024), + license: z.string().optional(), + compatibility: z.string().max(500).optional(), + metadata: z.record(z.string(), z.string()).optional(), + 'allowed-tools': z.string().optional(), +}) + +export type SkillFrontmatter = z.infer diff --git a/packages/node/src/alphalib/types/template.ts b/packages/node/src/alphalib/types/template.ts index d237b809..32a13a07 100644 --- a/packages/node/src/alphalib/types/template.ts +++ b/packages/node/src/alphalib/types/template.ts @@ -67,6 +67,14 @@ export const assemblyAuthInstructionsSchema = z .optional() .describe('ISO 8601 expiration timestamp for signature authentication'), max_size: z.number().optional().describe('Maximum allowed upload size in bytes'), + max_number_of_files: z + .number() + .int() + .min(1) + .optional() + .describe( + 'Maximum number of input files allowed per Assembly. If the number of uploaded or imported files exceeds this limit, the Assembly will be stopped with an error. This is useful for preventing abuse when Signature Authentication credentials are exposed.', + ), nonce: z.string().optional().describe('Unique, random nonce for this request'), referer: z .string() @@ -223,6 +231,12 @@ export const templateListParamsSchema = z .describe( 'Specifies keywords to be matched in the Assembly Status. The Assembly fields checked include the `id`, `redirect_url`, `fields`, and `notify_url`, as well as error messages and files used.', ), + include_builtin: z + .enum(['none', 'latest', 'all', 'exclusively-latest', 'exclusively-all']) + .optional() + .describe( + 'Include Builtin Templates in the results. Use `latest` (recommended) or `all`. Prefix with `exclusively-` to return only Builtin Templates.', + ), }) .strict() diff --git a/packages/zod/scripts/sync-v3.ts b/packages/zod/scripts/sync-v3.ts index 7181c923..e3c2eed1 100644 --- a/packages/zod/scripts/sync-v3.ts +++ b/packages/zod/scripts/sync-v3.ts @@ -15,6 +15,8 @@ const indexModules = [ 'assemblyStatus', 'assemblyUrls', 'bill', + 'builtinTemplates', + 'skillFrontmatter', 'stackVersions', 'template', 'templateCredential',