diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78728c74..e6d8c138 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,10 +21,10 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/isaacus-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: '22' @@ -43,10 +43,10 @@ jobs: contents: read id-token: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: '22' @@ -61,7 +61,7 @@ jobs: github.repository == 'stainless-sdks/isaacus-typescript' && !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc - uses: actions/github-script@v8 + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: core.setOutput('github_token', await core.getIDToken()); @@ -91,10 +91,10 @@ jobs: runs-on: ${{ github.repository == 'stainless-sdks/isaacus-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Node - uses: actions/setup-node@v4 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: '22' diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index f29b3817..a5ca4ebc 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -18,13 +18,12 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - id-token: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Node - uses: actions/setup-node@v3 + uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1 with: node-version: '20' @@ -42,6 +41,7 @@ jobs: yarn tsn scripts/publish-packages.ts "{ \"paths_released\": \"$PATHS_RELEASED\" }" env: INPUT_PATH: ${{ github.event.inputs.path }} + NPM_TOKEN: ${{ secrets.ISAACUS_NPM_TOKEN || secrets.NPM_TOKEN }} - name: Upload MCP Server DXT GitHub release asset run: | diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index d1991512..ac4ad967 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -12,9 +12,10 @@ jobs: if: github.repository == 'isaacus-dev/isaacus-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Check release environment run: | bash ./bin/check-release-environment - + env: + NPM_TOKEN: ${{ secrets.ISAACUS_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index ae4aa20e..b7d4f6b9 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,3 @@ dist-deno .eslintcache dist-bundle *.mcpb -oidc diff --git a/.prettierignore b/.prettierignore index 7cc13dd1..36afd3b3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,6 +2,7 @@ CHANGELOG.md /ecosystem-tests/*/** /node_modules /deno +/packages/mcp-server/manifest.json # don't format tsc output, will break source maps dist diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 28b80623..97bce112 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.22.4" + ".": "0.23.0" } diff --git a/.stats.yml b/.stats.yml index 181fa0dc..1e18ab15 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 5 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus%2Fisaacus-3fc0da1b03c07a47ee0a04ff61443710b99e6d24e8ba5986aab0b1c023c6f0d5.yml -openapi_spec_hash: 5992dd036e090cc43fa15ea5ff985f77 -config_hash: c2dabc5b28858404bc25dfc9fea08a25 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/isaacus/isaacus-6d99da2f60d8e64d82f99ff705a89038698a2410845bfa3a7e5738d821616727.yml +openapi_spec_hash: 155f43207a56a7b282f2bfdc8e098668 +config_hash: 9040e7359f066240ad536041fb2c5185 diff --git a/CHANGELOG.md b/CHANGELOG.md index e003aaec..b8943ac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,37 @@ # Changelog +## 0.23.0 (2026-06-01) + +Full Changelog: [v0.22.4...v0.23.0](https://github.com/isaacus-dev/isaacus-typescript/compare/v0.22.4...v0.23.0) + +### Features + +* support setting headers via env ([05c6abd](https://github.com/isaacus-dev/isaacus-typescript/commit/05c6abd544a0ecd87ddb3b635929018598aac5f4)) + + +### Bug Fixes + +* **mcp:** use `pure-lockfile` when building mcp server ([e738d97](https://github.com/isaacus-dev/isaacus-typescript/commit/e738d97b7431f1353aaaf460727266de2eb6a96b)) +* **typescript:** upgrade tsc-multi so that it works with Node 26 ([4430b91](https://github.com/isaacus-dev/isaacus-typescript/commit/4430b91fafc8fb07474b11aef0a36755ed24f1eb)) + + +### Chores + +* avoid formatting file that gets changed during releases ([ec88aef](https://github.com/isaacus-dev/isaacus-typescript/commit/ec88aef38af1f4b559e51184bb7d838edaff4f50)) +* **format:** run eslint and prettier separately ([8b0b6f7](https://github.com/isaacus-dev/isaacus-typescript/commit/8b0b6f764ce8c34b9e25ceabfb0557fad33e07db)) +* **internal:** codegen related update ([36d1802](https://github.com/isaacus-dev/isaacus-typescript/commit/36d18023d8bf4c886d1aec14504cb70d793f9a28)) +* **internal:** codegen related update ([9b13b88](https://github.com/isaacus-dev/isaacus-typescript/commit/9b13b888121581e04c3ce13aba2c6d10a23fa55a)) +* **internal:** more robust bootstrap script ([32259bd](https://github.com/isaacus-dev/isaacus-typescript/commit/32259bd667f736fb8f8da16a424f71c6f5242b09)) +* redact api-key headers in debug logs ([9767ee7](https://github.com/isaacus-dev/isaacus-typescript/commit/9767ee7e62f113d5483d22f36851ff9c3ece6aaf)) +* restructure docs search code ([e1919fe](https://github.com/isaacus-dev/isaacus-typescript/commit/e1919fee72c32029b6b87608e7ad6c3db30082e1)) +* **tests:** remove redundant File import ([b9de8d5](https://github.com/isaacus-dev/isaacus-typescript/commit/b9de8d58a97c963a739494c31951ac6015537cd7)) + + +### Documentation + +* **api:** rename ILGS to ILDGS in description without breaking API ([72621a2](https://github.com/isaacus-dev/isaacus-typescript/commit/72621a2bd148e982895b4d309db3dbd16e752ac2)) +* update http mcp docs ([3c73de3](https://github.com/isaacus-dev/isaacus-typescript/commit/3c73de3e01c16dd31ec03ac7ddff05a325f79bb4)) + ## 0.22.4 (2026-04-23) Full Changelog: [v0.22.3...v0.22.4](https://github.com/isaacus-dev/isaacus-typescript/compare/v0.22.3...v0.22.4) diff --git a/bin/check-release-environment b/bin/check-release-environment index 6b43775a..e4b6d58e 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${NPM_TOKEN}" ]; then + errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + lenErrors=${#errors[@]} if [[ lenErrors -gt 0 ]]; then diff --git a/bin/publish-npm b/bin/publish-npm index 3d05c0bd..45e8aa80 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -2,12 +2,7 @@ set -eux -if [[ ${NPM_TOKEN:-} ]]; then - npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" -elif [[ ! ${ACTIONS_ID_TOKEN_REQUEST_TOKEN:-} ]]; then - echo "ERROR: NPM_TOKEN must be set if not running in a Github Action with id-token permission" - exit 1 -fi +npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" yarn build cd dist @@ -62,9 +57,5 @@ else TAG="latest" fi -# Install OIDC compatible npm version -npm install --prefix ../oidc/ npm@11.6.2 - # Publish with the appropriate tag -export npm_config_registry='https://registry.npmjs.org' -../oidc/node_modules/.bin/npm publish --tag "$TAG" +yarn publish --tag "$TAG" diff --git a/eslint.config.mjs b/eslint.config.mjs index a5536608..fcce668b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,7 +1,6 @@ // @ts-check import tseslint from 'typescript-eslint'; import unusedImports from 'eslint-plugin-unused-imports'; -import prettier from 'eslint-plugin-prettier'; export default tseslint.config( { @@ -14,11 +13,9 @@ export default tseslint.config( plugins: { '@typescript-eslint': tseslint.plugin, 'unused-imports': unusedImports, - prettier, }, rules: { 'no-unused-vars': 'off', - 'prettier/prettier': 'error', 'unused-imports/no-unused-imports': 'error', 'no-restricted-imports': [ 'error', diff --git a/package.json b/package.json index 7b9fb74d..b33b8428 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isaacus", - "version": "0.22.4", + "version": "0.23.0", "description": "The official TypeScript library for the Isaacus API", "author": "Isaacus ", "types": "dist/index.d.ts", @@ -36,7 +36,6 @@ "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "eslint": "^9.39.1", - "eslint-plugin-prettier": "^5.4.1", "eslint-plugin-unused-imports": "^4.1.4", "iconv-lite": "^0.6.3", "jest": "^29.4.0", @@ -44,7 +43,7 @@ "publint": "^0.2.12", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", "tslib": "^2.8.1", "typescript": "5.8.3", diff --git a/packages/mcp-server/manifest.json b/packages/mcp-server/manifest.json index c50f6af2..8c67b9d3 100644 --- a/packages/mcp-server/manifest.json +++ b/packages/mcp-server/manifest.json @@ -1,7 +1,7 @@ { "dxt_version": "0.2", "name": "isaacus-mcp", - "version": "0.22.4", + "version": "0.23.0", "description": "The official MCP Server for the Isaacus API", "author": { "name": "Isaacus", diff --git a/packages/mcp-server/package.json b/packages/mcp-server/package.json index ca799369..537eb31a 100644 --- a/packages/mcp-server/package.json +++ b/packages/mcp-server/package.json @@ -1,6 +1,6 @@ { "name": "isaacus-mcp", - "version": "0.22.4", + "version": "0.23.0", "description": "The official MCP Server for the Isaacus API", "author": "Isaacus ", "types": "dist/index.d.ts", @@ -74,7 +74,7 @@ "ts-jest": "^29.1.0", "ts-morph": "^19.0.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz", "tsconfig-paths": "^4.0.0" }, "imports": { diff --git a/packages/mcp-server/src/local-docs-search.ts b/packages/mcp-server/src/local-docs-search.ts index 2f0981a0..4fe8b561 100644 --- a/packages/mcp-server/src/local-docs-search.ts +++ b/packages/mcp-server/src/local-docs-search.ts @@ -69,19 +69,19 @@ const EMBEDDED_METHODS: MethodEntry[] = [ markdown: "## create\n\n`client.embeddings.create(model: 'kanon-2-embedder', texts: string[] | string, task?: 'retrieval/query' | 'retrieval/document', overflow_strategy?: 'drop_end', dimensions?: number): { embeddings: object[]; usage: object; }`\n\n**post** `/embeddings`\n\nVectorize content with an Isaacus embedding model.\n\n### Parameters\n\n- `model: 'kanon-2-embedder'`\n The ID of the [model](https://docs.isaacus.com/models#embedding) to use for embedding.\n\n- `texts: string[] | string`\n The text or array of texts to embed.\n\nEach text must contain at least one non-whitespace character.\n\nNo more than 128 texts can be embedded in a single request.\n\n- `task?: 'retrieval/query' | 'retrieval/document'`\n The task the embeddings will be used for.\n\n`retrieval/query` is meant for queries and statements, and `retrieval/document` is meant for anything to be retrieved using query embeddings.\n\nIf `null`, which is the default setting, embeddings will not be optimized for any particular task.\n\n- `overflow_strategy?: 'drop_end'`\n The strategy to employ when content exceeds the model's maximum input length.\n\n`drop_end`, which is the default setting, drops tokens from the end of the content exceeding the limit.\n\nIf `null`, an error will be raised if any content exceeds the model's maximum input length.\n\n- `dimensions?: number`\n A whole number greater than or equal to 1.\n\n### Returns\n\n- `{ embeddings: { index: number; embedding: number[]; }[]; usage: { input_tokens: number; }; }`\n\n - `embeddings: { index: number; embedding: number[]; }[]`\n - `usage: { input_tokens: number; }`\n\n### Example\n\n```typescript\nimport Isaacus from 'isaacus';\n\nconst client = new Isaacus();\n\nconst embeddingResponse = await client.embeddings.create({ model: 'kanon-2-embedder', texts: ['Are restraints of trade enforceable under English law?', 'What is a non-compete clause?'] });\n\nconsole.log(embeddingResponse);\n```", perLanguage: { - http: { + typescript: { + method: 'client.embeddings.create', example: - 'curl https://api.isaacus.com/v1/embeddings \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-2-embedder",\n "texts": [\n "Are restraints of trade enforceable under English law?",\n "What is a non-compete clause?"\n ]\n }\'', + "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst embeddingResponse = await client.embeddings.create({\n model: 'kanon-2-embedder',\n texts: [\n 'Are restraints of trade enforceable under English law?',\n 'What is a non-compete clause?',\n ],\n});\n\nconsole.log(embeddingResponse.embeddings);", }, python: { method: 'embeddings.create', example: 'import os\nfrom isaacus import Isaacus\n\nclient = Isaacus(\n api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted\n)\nembedding_response = client.embeddings.create(\n model="kanon-2-embedder",\n texts=["Are restraints of trade enforceable under English law?", "What is a non-compete clause?"],\n)\nprint(embedding_response.embeddings)', }, - typescript: { - method: 'client.embeddings.create', + http: { example: - "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst embeddingResponse = await client.embeddings.create({\n model: 'kanon-2-embedder',\n texts: [\n 'Are restraints of trade enforceable under English law?',\n 'What is a non-compete clause?',\n ],\n});\n\nconsole.log(embeddingResponse.embeddings);", + 'curl https://api.isaacus.com/v1/embeddings \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-2-embedder",\n "texts": [\n "Are restraints of trade enforceable under English law?",\n "What is a non-compete clause?"\n ],\n "task": "retrieval/query",\n "overflow_strategy": "drop_end",\n "dimensions": 1792\n }\'', }, }, }, @@ -106,19 +106,19 @@ const EMBEDDED_METHODS: MethodEntry[] = [ markdown: "## create\n\n`client.classifications.universal.create(model: 'kanon-universal-classifier', query: string, texts: string[], is_iql?: boolean, scoring_method?: 'auto' | 'chunk_max' | 'chunk_avg' | 'chunk_min', chunking_options?: { size?: number; overlap_ratio?: number; overlap_tokens?: number; }): { classifications: object[]; usage: object; }`\n\n**post** `/classifications/universal`\n\nClassify documents with an Isaacus universal classification model.\n\n### Parameters\n\n- `model: 'kanon-universal-classifier'`\n The ID of the [model](https://docs.isaacus.com/models#universal-classification) to use for universal classification.\n\n- `query: string`\n The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query or, if IQL is disabled, the statement, to evaluate the texts against.\n\nThe query must contain at least one non-whitespace character.\n\nUnlike the texts being classified, the query cannot be so long that it exceeds the maximum input length of the universal classifier.\n\n- `texts: string[]`\n The texts to classify.\n\nEach text must contain at least one non-whitespace character.\n\n- `is_iql?: boolean`\n Whether the query should be interpreted as an [IQL](https://docs.isaacus.com/iql) query or else as a statement.\n\n- `scoring_method?: 'auto' | 'chunk_max' | 'chunk_avg' | 'chunk_min'`\n The method to use for producing an overall confidence score.\n\n`auto` is the default scoring method and is recommended for most use cases. Currently, it is equivalent to `chunk_max`. In the future, it will automatically select the best method based on the model and inputs.\n\n`chunk_max` uses the highest confidence score of all of the texts' chunks.\n\n`chunk_avg` averages the confidence scores of all of the texts' chunks.\n\n`chunk_min` uses the lowest confidence score of all of the texts' chunks.\n\n- `chunking_options?: { size?: number; overlap_ratio?: number; overlap_tokens?: number; }`\n Options for how to split text into smaller chunks.\n - `size?: number`\n A whole number greater than or equal to 1.\n - `overlap_ratio?: number`\n A number greater than or equal to 0 and less than 1.\n - `overlap_tokens?: number`\n A whole number greater than or equal to 0.\n\n### Returns\n\n- `{ classifications: { index: number; score: number; chunks: { index: number; start: number; end: number; score: number; text: string; }[]; }[]; usage: { input_tokens: number; }; }`\n\n - `classifications: { index: number; score: number; chunks: { index: number; start: number; end: number; score: number; text: string; }[]; }[]`\n - `usage: { input_tokens: number; }`\n\n### Example\n\n```typescript\nimport Isaacus from 'isaacus';\n\nconst client = new Isaacus();\n\nconst universalClassificationResponse = await client.classifications.universal.create({\n model: 'kanon-universal-classifier',\n query: 'This is a confidentiality clause.',\n texts: ['I agree not to tell anyone about the document.'],\n});\n\nconsole.log(universalClassificationResponse);\n```", perLanguage: { - http: { + typescript: { + method: 'client.classifications.universal.create', example: - 'curl https://api.isaacus.com/v1/classifications/universal \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-universal-classifier",\n "query": "This is a confidentiality clause.",\n "texts": [\n "I agree not to tell anyone about the document."\n ]\n }\'', + "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst universalClassificationResponse = await client.classifications.universal.create({\n model: 'kanon-universal-classifier',\n query: 'This is a confidentiality clause.',\n texts: ['I agree not to tell anyone about the document.'],\n});\n\nconsole.log(universalClassificationResponse.classifications);", }, python: { method: 'classifications.universal.create', example: 'import os\nfrom isaacus import Isaacus\n\nclient = Isaacus(\n api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted\n)\nuniversal_classification_response = client.classifications.universal.create(\n model="kanon-universal-classifier",\n query="This is a confidentiality clause.",\n texts=["I agree not to tell anyone about the document."],\n)\nprint(universal_classification_response.classifications)', }, - typescript: { - method: 'client.classifications.universal.create', + http: { example: - "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst universalClassificationResponse = await client.classifications.universal.create({\n model: 'kanon-universal-classifier',\n query: 'This is a confidentiality clause.',\n texts: ['I agree not to tell anyone about the document.'],\n});\n\nconsole.log(universalClassificationResponse.classifications);", + 'curl https://api.isaacus.com/v1/classifications/universal \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-universal-classifier",\n "query": "This is a confidentiality clause.",\n "texts": [\n "I agree not to tell anyone about the document."\n ],\n "is_iql": true,\n "scoring_method": "auto",\n "chunking_options": {\n "size": 512,\n "overlap_ratio": null,\n "overlap_tokens": null\n }\n }\'', }, }, }, @@ -143,19 +143,19 @@ const EMBEDDED_METHODS: MethodEntry[] = [ markdown: "## create\n\n`client.rerankings.create(model: 'kanon-2-reranker' | 'kanon-universal-classifier', query: string, texts: string[], top_n?: number, is_iql?: boolean, scoring_method?: 'auto' | 'chunk_max' | 'chunk_avg' | 'chunk_min', chunking_options?: { size?: number; overlap_ratio?: number; overlap_tokens?: number; }): { results: object[]; usage: object; }`\n\n**post** `/rerankings`\n\nScore and rank documents by their relevance to queries with an Isaacus reranker.\n\n### Parameters\n\n- `model: 'kanon-2-reranker' | 'kanon-universal-classifier'`\n The ID of the model to use for reranking, being either a [reranking model](https://docs.isaacus.com/models/introduction#reranking) or [universal classification model](https://docs.isaacus.com/models/introduction#universal-classification).\n\n- `query: string`\n The query to evaluate the relevance of the texts to.\n\nThe query must contain at least one non-whitespace character.\n\nUnlike the texts being reranked, the query cannot be so long that it exceeds the maximum input length of the reranker.\n\n- `texts: string[]`\n The texts to rerank.\n\nThere must be at least one text.\n\nEach text must contain at least one non-whitespace character.\n\n- `top_n?: number`\n A whole number greater than or equal to 1.\n\n- `is_iql?: boolean`\n Whether the query should be interpreted as an [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql) query, which is not the case by default.\n\nIf you allow untrusted users to construct their own queries, think carefully before enabling IQL since queries can be crafted to consume an excessively large amount of tokens.\n\n- `scoring_method?: 'auto' | 'chunk_max' | 'chunk_avg' | 'chunk_min'`\n The method to use for producing an overall relevance score for a text that exceeds the model's local context window and has, therefore, been split into multiple chunks.\n\n`auto` is the default scoring method and is recommended for most use cases. Currently, it is equivalent to `chunk_max`. In the future, it will automatically select the best method based on the model and inputs.\n\n`chunk_max` uses the highest relevance score of all of a text's chunks.\n\n`chunk_avg` averages the relevance scores of all of a text's chunks.\n\n`chunk_min` uses the lowest relevance score of all of a text's chunks.\n\n- `chunking_options?: { size?: number; overlap_ratio?: number; overlap_tokens?: number; }`\n Options for how to split text into smaller chunks.\n - `size?: number`\n A whole number greater than or equal to 1.\n - `overlap_ratio?: number`\n A number greater than or equal to 0 and less than 1.\n - `overlap_tokens?: number`\n A whole number greater than or equal to 0.\n\n### Returns\n\n- `{ results: { index: number; score: number; }[]; usage: { input_tokens: number; }; }`\n\n - `results: { index: number; score: number; }[]`\n - `usage: { input_tokens: number; }`\n\n### Example\n\n```typescript\nimport Isaacus from 'isaacus';\n\nconst client = new Isaacus();\n\nconst rerankingResponse = await client.rerankings.create({\n model: 'kanon-2-reranker',\n query: 'What are the essential elements required to establish a negligence claim?',\n texts: ['To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.', 'Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.', 'In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.', 'Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.', 'The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.'],\n});\n\nconsole.log(rerankingResponse);\n```", perLanguage: { - http: { + typescript: { + method: 'client.rerankings.create', example: - 'curl https://api.isaacus.com/v1/rerankings \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-2-reranker",\n "query": "What are the essential elements required to establish a negligence claim?",\n "texts": [\n "To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",\n "Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.",\n "In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.",\n "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.",\n "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm."\n ]\n }\'', + "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst rerankingResponse = await client.rerankings.create({\n model: 'kanon-2-reranker',\n query: 'What are the essential elements required to establish a negligence claim?',\n texts: [\n 'To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.',\n 'Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.',\n 'In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.',\n 'Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.',\n 'The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.',\n ],\n});\n\nconsole.log(rerankingResponse.results);", }, python: { method: 'rerankings.create', example: 'import os\nfrom isaacus import Isaacus\n\nclient = Isaacus(\n api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted\n)\nreranking_response = client.rerankings.create(\n model="kanon-2-reranker",\n query="What are the essential elements required to establish a negligence claim?",\n texts=["To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.", "Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.", "In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.", "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.", "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm."],\n)\nprint(reranking_response.results)', }, - typescript: { - method: 'client.rerankings.create', + http: { example: - "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst rerankingResponse = await client.rerankings.create({\n model: 'kanon-2-reranker',\n query: 'What are the essential elements required to establish a negligence claim?',\n texts: [\n 'To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.',\n 'Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.',\n 'In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.',\n 'Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.',\n 'The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm.',\n ],\n});\n\nconsole.log(rerankingResponse.results);", + 'curl https://api.isaacus.com/v1/rerankings \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-2-reranker",\n "query": "What are the essential elements required to establish a negligence claim?",\n "texts": [\n "To form a contract, there must be an offer, acceptance, consideration, and mutual intent to be bound.",\n "Criminal cases involve a completely different standard, requiring proof beyond a reasonable doubt.",\n "In a negligence claim, the plaintiff must prove duty, breach, causation, and damages.",\n "Negligence in tort law requires establishing a duty of care that the defendant owed to the plaintiff.",\n "The concept of negligence is central to tort law, with courts assessing whether a breach of duty caused harm."\n ],\n "top_n": null,\n "is_iql": false,\n "scoring_method": "auto",\n "chunking_options": {\n "size": null,\n "overlap_ratio": null,\n "overlap_tokens": null\n }\n }\'', }, }, }, @@ -180,19 +180,19 @@ const EMBEDDED_METHODS: MethodEntry[] = [ markdown: "## create\n\n`client.extractions.qa.create(model: 'kanon-answer-extractor', query: string, texts: string[], ignore_inextractability?: boolean, top_k?: number, chunking_options?: { size?: number; overlap_ratio?: number; overlap_tokens?: number; }): { extractions: object[]; usage: object; }`\n\n**post** `/extractions/qa`\n\nExtract information from documents with an Isaacus extractive question answering model.\n\n### Parameters\n\n- `model: 'kanon-answer-extractor'`\n The ID of the [model](https://docs.isaacus.com/models#extractive-question-answering) to use for extractive question answering.\n\n- `query: string`\n The query to extract the answer to.\n\nThe query must contain at least one non-whitespace character.\n\nUnlike the texts from which the answer will be extracted, the query cannot be so long that it exceeds the maximum input length of the model.\n\n- `texts: string[]`\n The texts to search for the answer in and extract the answer from.\n\nThere must be at least one text.\n\nEach text must contain at least one non-whitespace character.\n\n- `ignore_inextractability?: boolean`\n Whether to, if the model's score of the likelihood that an answer can not be extracted from a text is greater than the highest score of all possible answers, still return the highest scoring answers for that text.\n\nIf you have already determined that the texts answer the query, for example, by using one of our classification or reranker models, then you should set this to `true`.\n\n- `top_k?: number`\n The number of highest scoring answers to return.\n\nIf `null`, which is the default, all answers will be returned.\n\n- `chunking_options?: { size?: number; overlap_ratio?: number; overlap_tokens?: number; }`\n Options for how to split text into smaller chunks.\n - `size?: number`\n A whole number greater than or equal to 1.\n - `overlap_ratio?: number`\n A number greater than or equal to 0 and less than 1.\n - `overlap_tokens?: number`\n A whole number greater than or equal to 0.\n\n### Returns\n\n- `{ extractions: { index: number; answers: { text: string; start: number; end: number; score: number; }[]; inextractability_score: number; }[]; usage: { input_tokens: number; }; }`\n\n - `extractions: { index: number; answers: { text: string; start: number; end: number; score: number; }[]; inextractability_score: number; }[]`\n - `usage: { input_tokens: number; }`\n\n### Example\n\n```typescript\nimport Isaacus from 'isaacus';\n\nconst client = new Isaacus();\n\nconst answerExtractionResponse = await client.extractions.qa.create({\n model: 'kanon-answer-extractor',\n query: 'What is the punishment for murder in Victoria?',\n texts: ['The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case.'],\n});\n\nconsole.log(answerExtractionResponse);\n```", perLanguage: { - http: { + typescript: { + method: 'client.extractions.qa.create', example: - 'curl https://api.isaacus.com/v1/extractions/qa \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-answer-extractor",\n "query": "What is the punishment for murder in Victoria?",\n "texts": [\n "The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case."\n ]\n }\'', + "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst answerExtractionResponse = await client.extractions.qa.create({\n model: 'kanon-answer-extractor',\n query: 'What is the punishment for murder in Victoria?',\n texts: [\n 'The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case.',\n ],\n});\n\nconsole.log(answerExtractionResponse.extractions);", }, python: { method: 'extractions.qa.create', example: 'import os\nfrom isaacus import Isaacus\n\nclient = Isaacus(\n api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted\n)\nanswer_extraction_response = client.extractions.qa.create(\n model="kanon-answer-extractor",\n query="What is the punishment for murder in Victoria?",\n texts=["The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case."],\n)\nprint(answer_extraction_response.extractions)', }, - typescript: { - method: 'client.extractions.qa.create', + http: { example: - "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst answerExtractionResponse = await client.extractions.qa.create({\n model: 'kanon-answer-extractor',\n query: 'What is the punishment for murder in Victoria?',\n texts: [\n 'The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case.',\n ],\n});\n\nconsole.log(answerExtractionResponse.extractions);", + 'curl https://api.isaacus.com/v1/extractions/qa \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-answer-extractor",\n "query": "What is the punishment for murder in Victoria?",\n "texts": [\n "The standard sentence for murder in the State of Victoria is 30 years if the person murdered was a police officer and 25 years in any other case."\n ],\n "ignore_inextractability": false,\n "top_k": 1,\n "chunking_options": {\n "size": null,\n "overlap_ratio": null,\n "overlap_tokens": null\n }\n }\'', }, }, }, @@ -213,19 +213,19 @@ const EMBEDDED_METHODS: MethodEntry[] = [ markdown: "## create\n\n`client.enrichments.create(model: 'kanon-2-enricher', texts: string[] | string, overflow_strategy?: 'auto' | 'drop_end' | 'chunk'): { results: object[]; usage: object; }`\n\n**post** `/enrichments`\n\nEnrich documents with an Isaacus enrichment model.\n\n### Parameters\n\n- `model: 'kanon-2-enricher'`\n The ID of the [model](https://docs.isaacus.com/models#enrichment) to use for enrichment.\n\n- `texts: string[] | string`\n A text or array of texts to be enriched, each containing at least one non-whitespace character.\n\nNo more than 8 texts can be enriched in a single request.\n\n- `overflow_strategy?: 'auto' | 'drop_end' | 'chunk'`\n The strategy for handling content exceeding the model's maximum input length.\n\n`auto`, which is the recommended setting, currently behaves the same as `chunk`, which intelligently breaks the input up into smaller chunks and then stitches the results back together into a single prediction. In the future `auto` may implement even more sophisticated strategies for handling long contexts such as leveraging chunk overlap and/or a specialized stitching model.\n\n`chunk` breaks the input up into smaller chunks that fit within the model's context window and then intelligently merges the results into a single prediction at the cost of a minor accuracy drop.\n\n`drop_end` drops tokens from the end of input exceeding the model's maximum input length.\n\n`null`, which is the default setting, raises an error if the input exceeds the model's maximum input length.\n\n### Returns\n\n- `{ results: { index: number; document: object; }[]; usage: { input_tokens: number; }; }`\n\n - `results: { index: number; document: { text: string; title: object; subtitle: object; type: 'statute' | 'regulation' | 'decision' | 'contract' | 'other'; jurisdiction: string; segments: object[]; crossreferences: object[]; locations: object[]; persons: object[]; emails: object[]; websites: object[]; phone_numbers: object[]; id_numbers: object[]; terms: object[]; external_documents: object[]; quotes: object[]; dates: object[]; headings: object[]; junk: object[]; version: 'ilgs@1'; }; }[]`\n - `usage: { input_tokens: number; }`\n\n### Example\n\n```typescript\nimport Isaacus from 'isaacus';\n\nconst client = new Isaacus();\n\nconst enrichmentResponse = await client.enrichments.create({ model: 'kanon-2-enricher', texts: ['[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that \"§ 206 of Title 29 of the U.S. Code (the \"Labor Title\") does not apply to the plaintiff, Ms. Moody, given the definition of an \"employee\" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria.\"'] });\n\nconsole.log(enrichmentResponse);\n```", perLanguage: { - http: { + typescript: { + method: 'client.enrichments.create', example: - 'curl https://api.isaacus.com/v1/enrichments \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-2-enricher",\n "texts": [\n "[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that \\\\"§ 206 of Title 29 of the U.S. Code (the \\\\"Labor Title\\\\") does not apply to the plaintiff, Ms. Moody, given the definition of an \\\\"employee\\\\" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria.\\\\""\n ]\n }\'', + "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst enrichmentResponse = await client.enrichments.create({\n model: 'kanon-2-enricher',\n texts: [\n '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that \"§ 206 of Title 29 of the U.S. Code (the \"Labor Title\") does not apply to the plaintiff, Ms. Moody, given the definition of an \"employee\" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria.\"',\n ],\n});\n\nconsole.log(enrichmentResponse.results);", }, python: { method: 'enrichments.create', example: 'import os\nfrom isaacus import Isaacus\n\nclient = Isaacus(\n api_key=os.environ.get("ISAACUS_API_KEY"), # This is the default and can be omitted\n)\nenrichment_response = client.enrichments.create(\n model="kanon-2-enricher",\n texts=["[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that \\"§ 206 of Title 29 of the U.S. Code (the \\"Labor Title\\") does not apply to the plaintiff, Ms. Moody, given the definition of an \\"employee\\" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria.\\""],\n)\nprint(enrichment_response.results)', }, - typescript: { - method: 'client.enrichments.create', + http: { example: - "import Isaacus from 'isaacus';\n\nconst client = new Isaacus({\n apiKey: process.env['ISAACUS_API_KEY'], // This is the default and can be omitted\n});\n\nconst enrichmentResponse = await client.enrichments.create({\n model: 'kanon-2-enricher',\n texts: [\n '[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that \"§ 206 of Title 29 of the U.S. Code (the \"Labor Title\") does not apply to the plaintiff, Ms. Moody, given the definition of an \"employee\" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria.\"',\n ],\n});\n\nconsole.log(enrichmentResponse.results);", + 'curl https://api.isaacus.com/v1/enrichments \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $ISAACUS_API_KEY" \\\n -d \'{\n "model": "kanon-2-enricher",\n "texts": [\n "[42] The U.S. Attorney General, Mr. McGill, argued at ¶ 21 of the Filing that \\\\"§ 206 of Title 29 of the U.S. Code (the \\\\"Labor Title\\\\") does not apply to the plaintiff, Ms. Moody, given the definition of an \\\\"employee\\\\" at §203(e)(4) of the Labor Title does not include volunteers, and, regardless, she lives in Austria.\\\\""\n ],\n "overflow_strategy": "auto"\n }\'', }, }, }, diff --git a/packages/mcp-server/src/server.ts b/packages/mcp-server/src/server.ts index 43b3061c..eecb4ed5 100644 --- a/packages/mcp-server/src/server.ts +++ b/packages/mcp-server/src/server.ts @@ -28,7 +28,7 @@ export const newMcpServer = async ({ new McpServer( { name: 'isaacus_api', - version: '0.22.4', + version: '0.23.0', }, { instructions: await getInstructions({ stainlessApiKey, customInstructionsPath }), diff --git a/packages/mcp-server/yarn.lock b/packages/mcp-server/yarn.lock index c7e37692..c6b17b02 100644 --- a/packages/mcp-server/yarn.lock +++ b/packages/mcp-server/yarn.lock @@ -3921,9 +3921,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.1" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz": - version "1.1.9" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz#777f6f5d9e26bf0e94e5170990dd3a841d6707cd" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz": + version "1.1.11" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz#010247051be13b55abdc98f787c017285149f4f2" dependencies: debug "^4.3.7" fast-glob "^3.3.2" diff --git a/scripts/bootstrap b/scripts/bootstrap index a8b69ff3..2e315f53 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { echo -n "==> Install Homebrew dependencies? (y/N): " read -r response diff --git a/scripts/build b/scripts/build index 099cedf5..5724205e 100755 --- a/scripts/build +++ b/scripts/build @@ -52,6 +52,6 @@ fi # build all sub-packages for dir in packages/*; do if [ -d "$dir" ]; then - (cd "$dir" && yarn install && yarn build) + (cd "$dir" && yarn install --pure-lockfile && yarn build) fi done diff --git a/scripts/fast-format b/scripts/fast-format index 53721ac0..f1873aef 100755 --- a/scripts/fast-format +++ b/scripts/fast-format @@ -31,10 +31,7 @@ if ! [ -z "$ESLINT_FILES" ]; then fi echo "==> Running prettier --write" -# format things eslint didn't -PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)" -if ! [ -z "$PRETTIER_FILES" ]; then - echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \ - --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \ - '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' +if ! [ -z "$FILE_LIST" ]; then + cat "$FILE_LIST" | xargs ./node_modules/.bin/prettier \ + --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern --ignore-unknown fi diff --git a/scripts/format b/scripts/format index 7a756401..b1b2c17a 100755 --- a/scripts/format +++ b/scripts/format @@ -8,5 +8,4 @@ echo "==> Running eslint --fix" ./node_modules/.bin/eslint --fix . echo "==> Running prettier --write" -# format things eslint didn't -./node_modules/.bin/prettier --write --cache --cache-strategy metadata . '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' +./node_modules/.bin/prettier --write --cache --cache-strategy metadata . diff --git a/scripts/lint b/scripts/lint index 3ffb78a6..1f532548 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,6 +4,9 @@ set -e cd "$(dirname "$0")/.." +echo "==> Running prettier --check" +./node_modules/.bin/prettier --check . + echo "==> Running eslint" ./node_modules/.bin/eslint . diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index deae575e..a8cdeb7c 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -23,12 +23,19 @@ async function postprocess() { // strip out lib="dom", types="node", and types="react" references; these // are needed at build time, but would pollute the user's TS environment - const transformed = code.replace( + let transformed = code.replace( /^ *\/\/\/ * ' '.repeat(match.length - 1) + '\n', ); + // TypeScript's declaration emitter collapses /** @ts-ignore */ onto the same + // line as the type declaration, which doesn't work. So we convert to // @ts-ignore + // on its own line to properly suppresses errors. + if (file.endsWith('.d.ts') || file.endsWith('.d.mts') || file.endsWith('.d.cts')) { + transformed = transformed.replace(/\/\*\* @ts-ignore\b[^*]*\*\/ /gm, '// @ts-ignore\n'); + } + if (transformed !== code) { console.error(`wrote ${path.relative(process.cwd(), file)}`); await fs.promises.writeFile(file, transformed, 'utf8'); diff --git a/src/client.ts b/src/client.ts index 0f106abb..4412337a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -173,6 +173,18 @@ export class Isaacus { this.fetch = options.fetch ?? Shims.getDefaultFetch(); this.#encoder = Opts.FallbackEncoder; + const customHeadersEnv = readEnv('ISAACUS_CUSTOM_HEADERS'); + if (customHeadersEnv) { + const parsed: Record = {}; + for (const line of customHeadersEnv.split('\n')) { + const colon = line.indexOf(':'); + if (colon >= 0) { + parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim(); + } + } + options.defaultHeaders = { ...parsed, ...options.defaultHeaders }; + } + this._options = options; this.apiKey = apiKey; diff --git a/src/internal/types.ts b/src/internal/types.ts index b668dfc0..a050513a 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -40,7 +40,6 @@ type OverloadedParameters = : T extends (...args: infer A) => unknown ? A : never; -/* eslint-disable */ /** * These imports attempt to get types from a parent package's dependencies. * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which @@ -63,19 +62,18 @@ type OverloadedParameters = * * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition */ -/** @ts-ignore For users with \@types/node */ +/** @ts-ignore For users with \@types/node */ /* prettier-ignore */ type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users with undici */ +/** @ts-ignore For users with undici */ /* prettier-ignore */ type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users with \@types/bun */ +/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */ type BunRequestInit = globalThis.FetchRequestInit; -/** @ts-ignore For users with node-fetch@2 */ +/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */ type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ +/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */ type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users who use Deno */ +/** @ts-ignore For users who use Deno */ /* prettier-ignore */ type FetchRequestInit = NonNullable[1]>; -/* eslint-enable */ type RequestInits = | NotAny diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index 3ec1eada..c253fe11 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -107,6 +107,8 @@ export const formatRequestDetails = (details: { name, ( name.toLowerCase() === 'authorization' || + name.toLowerCase() === 'api-key' || + name.toLowerCase() === 'x-api-key' || name.toLowerCase() === 'cookie' || name.toLowerCase() === 'set-cookie' ) ? diff --git a/src/resources/enrichments.ts b/src/resources/enrichments.ts index 761597ed..4c6c9de2 100644 --- a/src/resources/enrichments.ts +++ b/src/resources/enrichments.ts @@ -53,7 +53,7 @@ export namespace EnrichmentResponse { /** * The document enriched into version 1.0.0 of the - * [Isaacus Legal Graph Schema (ILGS)](https://docs.isaacus.com/ilgs). + * [Isaacus Legal Document Graph Schema (ILDGS)](https://docs.isaacus.com/ildgs). * * All spans in an enriched document graph are indexed into the Unicode code point * space of a source document. diff --git a/src/resources/ilgs/v1/v1.ts b/src/resources/ilgs/v1/v1.ts index 5554a21b..e037be08 100644 --- a/src/resources/ilgs/v1/v1.ts +++ b/src/resources/ilgs/v1/v1.ts @@ -120,7 +120,7 @@ export interface Date { /** * The document enriched into version 1.0.0 of the - * [Isaacus Legal Graph Schema (ILGS)](https://docs.isaacus.com/ilgs). + * [Isaacus Legal Document Graph Schema (ILDGS)](https://docs.isaacus.com/ildgs). * * All spans in an enriched document graph are indexed into the Unicode code point * space of a source document. diff --git a/src/version.ts b/src/version.ts index 4c97d3ba..d77fad47 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '0.22.4'; // x-release-please-version +export const VERSION = '0.23.0'; // x-release-please-version diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 67e328c0..e089f984 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,7 +1,6 @@ import fs from 'fs'; import type { ResponseLike } from 'isaacus/internal/to-file'; import { toFile } from 'isaacus/core/uploads'; -import { File } from 'node:buffer'; class MyClass { name: string = 'foo'; diff --git a/yarn.lock b/yarn.lock index f6eae3cd..06fc1085 100644 --- a/yarn.lock +++ b/yarn.lock @@ -709,11 +709,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@pkgr/core@^0.2.4": - version "0.2.4" - resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.4.tgz#d897170a2b0ba51f78a099edccd968f7b103387c" - integrity sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw== - "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -1220,9 +1215,9 @@ baseline-browser-mapping@^2.9.0: integrity sha512-B0xUquLkiGLgHhpPBqvl7GWegWBUNuujQ6kXd/r1U38ElPT6Ok8KZ8e+FpUGEc2ZoRQUzq/aUnaKFc/svWUGSg== brace-expansion@^2.0.2: - version "2.1.0" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.0.tgz#4f41a41190216ee36067ec381526fe9539c4f0ae" - integrity sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w== + version "2.1.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.1.tgz#c68b1c4111c76aae3a6fba55d496cee10c39dad8" + integrity sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA== dependencies: balanced-match "^1.0.0" @@ -1515,14 +1510,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-plugin-prettier@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.1.tgz#99b55d7dd70047886b2222fdd853665f180b36af" - integrity sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg== - dependencies: - prettier-linter-helpers "^1.0.0" - synckit "^0.11.7" - eslint-plugin-unused-imports@^4.1.4: version "4.1.4" resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz#62ddc7446ccbf9aa7b6f1f0b00a980423cda2738" @@ -1674,11 +1661,6 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-diff@^1.1.2: - version "1.3.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" - integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== - fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -2841,13 +2823,6 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier-linter-helpers@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" - integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== - dependencies: - fast-diff "^1.1.2" - prettier@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.1.tgz#6ba9f23165d690b6cbdaa88cb0807278f7019848" @@ -3144,13 +3119,6 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@^0.11.7: - version "0.11.8" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.8.tgz#b2aaae998a4ef47ded60773ad06e7cb821f55457" - integrity sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A== - dependencies: - "@pkgr/core" "^0.2.4" - test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -3224,9 +3192,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz": - version "1.1.9" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.9/tsc-multi.tgz#777f6f5d9e26bf0e94e5170990dd3a841d6707cd" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz": + version "1.1.11" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.11/tsc-multi.tgz#010247051be13b55abdc98f787c017285149f4f2" dependencies: debug "^4.3.7" fast-glob "^3.3.2"