diff --git a/.github/workflows/ollama.yml b/.github/workflows/ollama.yml index cd7fd3cf4a..bcc925a95d 100644 --- a/.github/workflows/ollama.yml +++ b/.github/workflows/ollama.yml @@ -32,5 +32,5 @@ jobs: run: docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama - name: run summarize-ollama-phi3 run: yarn test:summarize --model ollama:phi3 --out ./temp/summarize-ollama-phi3 - - name: run vector-search - run: yarn run:script vector-search --model ollama:phi3 --out ./temp/rag +# - name: run vector-search +# run: yarn run:script vector-search --model ollama:phi3 --out ./temp/rag diff --git a/THIRD_PARTY_LICENSES.md b/THIRD_PARTY_LICENSES.md index f7ba701557..833b9d86ac 100644 --- a/THIRD_PARTY_LICENSES.md +++ b/THIRD_PARTY_LICENSES.md @@ -1309,7 +1309,7 @@ MIT License The following npm package may be included in this product: - - genaiscript-vscode@1.57.0 + - genaiscript-vscode@1.58.0 This package contains the following license and notice below: @@ -4431,9 +4431,9 @@ The following npm packages may be included in this product: - @tokenizer/token@0.3.0 - agent-base@6.0.2 - canvas@2.11.2 - - genaiscript-core-internal@1.57.0 - - genaiscript-sample@1.57.0 - - genaiscript@1.57.0 + - genaiscript-core-internal@1.58.0 + - genaiscript-sample@1.58.0 + - genaiscript@1.58.0 - https-proxy-agent@5.0.1 - isarray@1.0.0 - javascript-natural-sort@0.7.1 @@ -4722,6 +4722,36 @@ SOFTWARE. ----------- +The following npm package may be included in this product: + + - @octokit/plugin-retry@7.1.2 + +This package contains the following license and notice below: + +MIT License + +Copyright (c) 2018 Octokit contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----------- + The following npm packages may be included in this product: - @jimp/core@1.6.0 diff --git a/docs/genaisrc/genaiscript.d.ts b/docs/genaisrc/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/docs/genaisrc/genaiscript.d.ts +++ b/docs/genaisrc/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/genaisrc/genaiscript.d.ts b/genaisrc/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/genaisrc/genaiscript.d.ts +++ b/genaisrc/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/auto/genaiscript.d.ts b/packages/auto/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/auto/genaiscript.d.ts +++ b/packages/auto/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/cli/package.json b/packages/cli/package.json index 8af4ce448a..2e3d80462a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,100 +1,102 @@ { - "name": "genaiscript", - "version": "1.58.0", - "main": "built/genaiscript.cjs", - "type": "commonjs", - "bin": { - "genaiscript": "built/genaiscript.cjs" - }, - "files": [ - "built/genaiscript.cjs" - ], - "publisher": "Microsoft", - "repository": { - "type": "git", - "url": "git+https://github.com/microsoft/genaiscript.git" - }, - "homepage": "https://microsoft.github.io/genaiscript", - "keywords": [ - "genai", - "ai", - "agentic", - "cli", - "prompt", - "llm", - "generative ai", - "gpt4", - "chatgpt", - "ollama", - "llamacpp", - "chatgpt" - ], - "description": "A CLI for GenAIScript, a generative AI scripting framework.", - "license": "MIT", - "dependencies": { - "@azure/identity": "^4.4.1", - "@inquirer/prompts": "^6.0.1", - "@lvce-editor/ripgrep": "^1.2.0", - "@octokit/plugin-throttling": "^9.3.1", - "@octokit/rest": "^21.0.2", - "dockerode": "^4.0.2", - "gpt-tokenizer": "^2.4.0", - "html-to-text": "^9.0.5", - "jimp": "^1.6.0", - "mammoth": "^1.8.0", - "mathjs": "^13.1.1", - "pdfjs-dist": "4.6.82", - "playwright": "^1.47.2", - "tabletojson": "^4.1.4", - "tree-sitter-wasms": "^0.1.11", - "tsx": "^4.19.1", - "turndown": "^7.2.0", - "typescript": "5.6.2", - "vectra": "^0.9.0", - "web-tree-sitter": "^0.22.2", - "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz" - }, - "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "promptfoo": "0.89.3" - }, - "devDependencies": { - "@types/diff": "^5.2.2", - "@types/dockerode": "^3.3.31", - "@types/fs-extra": "^11.0.4", - "@types/memorystream": "^0.3.4", - "@types/node": "^20.14.12", - "@types/papaparse": "^5.3.14", - "@types/prompts": "^2.4.9", - "@types/replace-ext": "^2.0.2", - "@types/ws": "^8.5.12", - "commander": "^12.1.0", - "diff": "^7.0.0", - "dotenv": "^16.4.5", - "esbuild": "^0.24.0", - "execa": "^9.4.0", - "fs-extra": "^11.2.0", - "glob": "^11.0.0", - "memorystream": "^0.3.1", - "node-sarif-builder": "^3.2.0", - "octokit": "^4.0.2", - "openai": "^4.65.0", - "pretty-bytes": "^6.1.1", - "replace-ext": "^2.0.0", - "ws": "^8.18.0", - "zx": "^8.1.8" - }, - "scripts": { - "compile": "esbuild src/main.ts --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text --external:@octokit/rest --external:@octokit/plugin-throttling && node ../../scripts/patch-cli.mjs", - "compile-debug": "esbuild src/main.ts --sourcemap --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text --external:@octokit/rest --external:@octokit/plugin-throttling", - "postcompile": "node built/genaiscript.cjs info help > ../../docs/src/content/docs/reference/cli/commands.md", - "vis:treemap": "npx --yes esbuild-visualizer --metadata esbuild.meta.json --filename esbuild.treemap.html", - "vis:network": "npx --yes esbuild-visualizer --metadata esbuild.meta.json --filename esbuild.network.html --template network", - "go": "yarn compile && node built/genaiscript.cjs", - "test": "node --import tsx --test src/**.test.ts", - "typecheck": "tsc -p src", - "lint": "npx --yes publint" - } + "name": "genaiscript", + "version": "1.58.0", + "main": "built/genaiscript.cjs", + "type": "commonjs", + "bin": { + "genaiscript": "built/genaiscript.cjs" + }, + "files": [ + "built/genaiscript.cjs" + ], + "publisher": "Microsoft", + "repository": { + "type": "git", + "url": "git+https://github.com/microsoft/genaiscript.git" + }, + "homepage": "https://microsoft.github.io/genaiscript", + "keywords": [ + "genai", + "ai", + "agentic", + "cli", + "prompt", + "llm", + "generative ai", + "gpt4", + "chatgpt", + "ollama", + "llamacpp", + "chatgpt" + ], + "description": "A CLI for GenAIScript, a generative AI scripting framework.", + "license": "MIT", + "dependencies": { + "@azure/identity": "^4.4.1", + "@inquirer/prompts": "^6.0.1", + "@lvce-editor/ripgrep": "^1.2.0", + "@octokit/plugin-paginate-rest": "^11.3.4", + "@octokit/plugin-retry": "^7.1.2", + "@octokit/plugin-throttling": "^9.3.1", + "@octokit/rest": "^21.0.2", + "dockerode": "^4.0.2", + "gpt-tokenizer": "^2.4.0", + "html-to-text": "^9.0.5", + "jimp": "^1.6.0", + "mammoth": "^1.8.0", + "mathjs": "^13.1.1", + "pdfjs-dist": "4.6.82", + "playwright": "^1.47.2", + "tabletojson": "^4.1.4", + "tree-sitter-wasms": "^0.1.11", + "tsx": "^4.19.1", + "turndown": "^7.2.0", + "typescript": "5.6.2", + "vectra": "^0.9.0", + "web-tree-sitter": "^0.22.2", + "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "promptfoo": "0.89.3" + }, + "devDependencies": { + "@types/diff": "^5.2.2", + "@types/dockerode": "^3.3.31", + "@types/fs-extra": "^11.0.4", + "@types/memorystream": "^0.3.4", + "@types/node": "^20.14.12", + "@types/papaparse": "^5.3.14", + "@types/prompts": "^2.4.9", + "@types/replace-ext": "^2.0.2", + "@types/ws": "^8.5.12", + "commander": "^12.1.0", + "diff": "^7.0.0", + "dotenv": "^16.4.5", + "esbuild": "^0.24.0", + "execa": "^9.4.0", + "fs-extra": "^11.2.0", + "glob": "^11.0.0", + "memorystream": "^0.3.1", + "node-sarif-builder": "^3.2.0", + "octokit": "^4.0.2", + "openai": "^4.65.0", + "pretty-bytes": "^6.1.1", + "replace-ext": "^2.0.0", + "ws": "^8.18.0", + "zx": "^8.1.8" + }, + "scripts": { + "compile": "esbuild src/main.ts --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text --external:@octokit/rest --external:@octokit/plugin-throttling --external:@octokit/plugin-retry --external:@octokit/plugin-paginate-rest && node ../../scripts/patch-cli.mjs", + "compile-debug": "esbuild src/main.ts --sourcemap --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text --external:@octokit/rest --external:@octokit/plugin-throttling --external:@octokit/plugin-retry --external:@octokit/plugin-paginate-rest", + "postcompile": "node built/genaiscript.cjs info help > ../../docs/src/content/docs/reference/cli/commands.md", + "vis:treemap": "npx --yes esbuild-visualizer --metadata esbuild.meta.json --filename esbuild.treemap.html", + "vis:network": "npx --yes esbuild-visualizer --metadata esbuild.meta.json --filename esbuild.network.html --template network", + "go": "yarn compile && node built/genaiscript.cjs", + "test": "node --import tsx --test src/**.test.ts", + "typecheck": "tsc -p src", + "lint": "npx --yes publint" + } } diff --git a/packages/core/package.json b/packages/core/package.json index b5effe99cc..14dc05afe8 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -19,6 +19,8 @@ "devDependencies": { "@azure/identity": "^4.4.1", "@huggingface/jinja": "^0.3.1", + "@octokit/plugin-paginate-rest": "^11.3.4", + "@octokit/plugin-retry": "^7.1.2", "@octokit/plugin-throttling": "^9.3.1", "@octokit/rest": "^21.0.2", "@tidyjs/tidy": "^2.5.2", diff --git a/packages/core/src/constants.ts b/packages/core/src/constants.ts index 51be13ebf2..aee86336ec 100644 --- a/packages/core/src/constants.ts +++ b/packages/core/src/constants.ts @@ -246,4 +246,6 @@ export const CHAT_REQUEST_PER_MODEL_CONCURRENT_LIMIT = 8 export const PROMISE_QUEUE_CONCURRENCY_DEFAULT = 16 export const GITHUB_REST_API_CONCURRENCY_LIMIT = 8 +export const GITHUB_REST_PAGE_DEFAULT = 50 + export const TOKEN_TRUNCATION_THRESHOLD = 128 diff --git a/packages/core/src/genaisrc/genaiscript.d.ts b/packages/core/src/genaisrc/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/core/src/genaisrc/genaiscript.d.ts +++ b/packages/core/src/genaisrc/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/core/src/github.ts b/packages/core/src/github.ts index 65049402d9..65e542beb1 100644 --- a/packages/core/src/github.ts +++ b/packages/core/src/github.ts @@ -1,8 +1,10 @@ import type { Octokit } from "@octokit/rest" +import type { PaginateInterface } from "@octokit/plugin-paginate-rest" import { GITHUB_API_VERSION, GITHUB_PULL_REQUEST_REVIEW_COMMENT_LINE_DISTANCE, GITHUB_REST_API_CONCURRENCY_LIMIT, + GITHUB_REST_PAGE_DEFAULT, GITHUB_TOKEN, TOOL_ID, } from "./constants" @@ -407,10 +409,31 @@ export async function githubCreatePullRequestReviews( return true } +async function paginatorToArray( + iterator: AsyncIterableIterator, + count: number, + iteratorItem: (item: T) => R[], + elementFilter?: (item: R) => boolean +): Promise { + const result: R[] = [] + for await (const item of await iterator) { + let r = iteratorItem(item) + if (elementFilter) r = r.filter(elementFilter) + result.push(...r) + if (result.length >= count) break + } + return result.slice(0, count) +} + export class GitHubClient implements GitHub { private _connection: Promise private _client: Promise< - ({ client: Octokit } & GithubConnectionInfo) | undefined + | ({ + client: Octokit & { + paginate: PaginateInterface + } + } & GithubConnectionInfo) + | undefined > constructor() {} @@ -422,7 +445,7 @@ export class GitHubClient implements GitHub { return this._connection } - private async client() { + async client() { if (!this._client) { this._client = new Promise(async (resolve) => { const conn = await this.connection() @@ -431,11 +454,18 @@ export class GitHubClient implements GitHub { const { throttling } = await import( "@octokit/plugin-throttling" ) - const OctokitWithPlugins = Octokit.plugin(throttling) - const res: Octokit = new OctokitWithPlugins({ + const { paginateRest } = await import( + "@octokit/plugin-paginate-rest" + ) + const { retry } = await import("@octokit/plugin-retry") + const OctokitWithPlugins = + Octokit.plugin(paginateRest).plugin(throttling) + // .plugin(retry) + const res = new OctokitWithPlugins({ userAgent: TOOL_ID, auth: token, baseUrl: apiUrl, + request: { retries: 3 }, throttle: { onRateLimit: ( retryAfter, @@ -466,7 +496,10 @@ export class GitHubClient implements GitHub { }, }, }) - resolve({ client: res, ...conn }) + resolve({ + client: res, + ...conn, + }) }) } return this._client @@ -500,13 +533,14 @@ export class GitHubClient implements GitHub { } & GitHubPaginationOptions ): Promise { const { client, owner, repo } = await this.client() - const { data: issues } = await client.rest.issues.listForRepo({ + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator(client.rest.issues.listForRepo, { owner, repo, - ...(options ?? {}), + ...rest, }) - const i = issues[0] - return issues + const res = await paginatorToArray(ite, count, (i) => i.data) + return res } async listPullRequests( @@ -517,12 +551,14 @@ export class GitHubClient implements GitHub { } & GitHubPaginationOptions ): Promise { const { client, owner, repo } = await this.client() - const { data: prs } = await client.rest.pulls.list({ + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator(client.rest.pulls.list, { owner, repo, - ...(options ?? {}), + ...rest, }) - return prs + const res = await paginatorToArray(ite, count, (i) => i.data) + return res } async listPullRequestReviewComments( @@ -530,27 +566,39 @@ export class GitHubClient implements GitHub { options?: GitHubPaginationOptions ): Promise { const { client, owner, repo } = await this.client() - const { data: comments } = await client.rest.pulls.listReviewComments({ - owner, - repo, - pull_number, - ...(options ?? {}), - }) - return comments + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator( + client.rest.pulls.listReviewComments, + { + owner, + repo, + pull_number, + ...rest, + } + ) + const res = await paginatorToArray(ite, count, (i) => i.data) + res[0].reactions + return res } async listIssueComments( issue_number: number, - options?: GitHubPaginationOptions + options?: { reactions?: boolean } & GitHubPaginationOptions ): Promise { const { client, owner, repo } = await this.client() - const { data: comments } = await client.rest.issues.listComments({ + const { + reactions, + count = GITHUB_REST_PAGE_DEFAULT, + ...rest + } = options ?? {} + const ite = client.paginate.iterator(client.rest.issues.listComments, { owner, repo, issue_number, - ...(options ?? {}), + ...rest, }) - return comments + const res = await paginatorToArray(ite, count, (i) => i.data) + return res } async listWorkflowRuns( @@ -561,31 +609,42 @@ export class GitHubClient implements GitHub { } & GitHubPaginationOptions ): Promise { const { client, owner, repo } = await this.client() - const { - data: { workflow_runs }, - } = await client.rest.actions.listWorkflowRuns({ - owner, - repo, - workflow_id, - per_page: 100, - ...(options ?? {}), - }) - const runs = workflow_runs.filter( + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator( + client.rest.actions.listWorkflowRuns, + { + owner, + repo, + workflow_id, + per_page: 100, + ...rest, + } + ) + const res = await paginatorToArray( + ite, + count, + (i) => i.data, ({ conclusion }) => conclusion !== "skipped" ) - return runs + return res } - async listWorkflowJobs(run_id: number): Promise { + async listWorkflowJobs( + run_id: number, + options?: GitHubPaginationOptions + ): Promise { // Get the jobs for the specified workflow run const { client, owner, repo } = await this.client() - const { - data: { jobs }, - } = await client.rest.actions.listJobsForWorkflowRun({ - owner, - repo, - run_id, - }) + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator( + client.rest.actions.listJobsForWorkflowRun, + { + owner, + repo, + run_id, + } + ) + const jobs = await paginatorToArray(ite, count, (i) => i.data) const res: GitHubWorkflowJob[] = [] for (const job of jobs) { @@ -683,12 +742,12 @@ export class GitHubClient implements GitHub { ): Promise { const { client, owner, repo } = await this.client() const q = query + `+repo:${owner}/${repo}` - const { - data: { items }, - } = await client.rest.search.code({ + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator(client.rest.search.code, { q, ...(options ?? {}), }) + const items = await paginatorToArray(ite, count, (i) => i.data) return items.map( ({ name, path, sha, html_url, score, repository }) => ({ name, @@ -705,14 +764,17 @@ export class GitHubClient implements GitHub { options?: GitHubPaginationOptions ): Promise { const { client, owner, repo } = await this.client() - const { data: workflows } = await client.rest.actions.listRepoWorkflows( + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator( + client.rest.actions.listRepoWorkflows, { owner, repo, ...(options ?? {}), } ) - return workflows.workflows.map(({ id, name, path }) => ({ + const workflows = await paginatorToArray(ite, count, (i) => i.data) + return workflows.map(({ id, name, path }) => ({ id, name, path, @@ -721,11 +783,13 @@ export class GitHubClient implements GitHub { async listBranches(options?: GitHubPaginationOptions): Promise { const { client, owner, repo } = await this.client() - const { data: branches } = await client.rest.repos.listBranches({ + const { count = GITHUB_REST_PAGE_DEFAULT, ...rest } = options ?? {} + const ite = client.paginate.iterator(client.rest.repos.listBranches, { owner, repo, ...(options ?? {}), }) + const branches = await paginatorToArray(ite, count, (i) => i.data) return branches.map(({ name }) => name) } diff --git a/packages/core/src/types/prompt_template.d.ts b/packages/core/src/types/prompt_template.d.ts index 0ab49046b5..250a11ac8a 100644 --- a/packages/core/src/types/prompt_template.d.ts +++ b/packages/core/src/types/prompt_template.d.ts @@ -1318,6 +1318,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1326,6 +1340,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1346,8 +1361,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1355,6 +1372,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1478,6 +1499,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/genaisrc/blog/genaiscript.d.ts b/packages/sample/genaisrc/blog/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/genaisrc/blog/genaiscript.d.ts +++ b/packages/sample/genaisrc/blog/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/genaisrc/genaiscript.d.ts b/packages/sample/genaisrc/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/genaisrc/genaiscript.d.ts +++ b/packages/sample/genaisrc/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/genaisrc/github.genai.mts b/packages/sample/genaisrc/github.genai.mts index fd7d69ac05..a78ab1d07d 100644 --- a/packages/sample/genaisrc/github.genai.mts +++ b/packages/sample/genaisrc/github.genai.mts @@ -3,41 +3,48 @@ script({ tests: {}, }) -const languages = await github.listRepositoryLanguages() -console.log(languages) - -const files = await github.getRepositoryContent("", { - type: "file", - downloadContent: true, - maxDownloadSize: 2_000, -}) -console.log( - files.map(({ filename, content }) => ({ - filename, - content: content?.slice(0, 50), - })) -) - -const issues = await github.listIssues({ per_page: 5 }) +const issues = await github.listIssues({ count: 5 }) +if (issues.length === 0) throw new Error("No issues found") console.log(issues.map((i) => i.title)) const issueComments = await github.listIssueComments(issues[0].number) console.log(issueComments) const prs = await github.listPullRequests() console.log(prs.slice(0, 5).map((i) => i.title)) +if (prs.length === 0) throw new Error("No PRs found") const prcs = await github.listPullRequestReviewComments(prs[0].number) console.log(prcs.map((i) => i.body)) const pkg = await github.getFile("package.json", "main") console.log(pkg.content.slice(0, 50) + "...") +if (!pkg.content?.length) throw new Error("No package.json found") const res = await github.searchCode("HTMLToText") console.log(res) +if (!res.length) throw new Error("No search results found") -const runs = await github.listWorkflowRuns("build.yml", { per_page: 5 }) +const runs = await github.listWorkflowRuns("build.yml", { count: 5 }) console.log(runs.map((i) => i.status)) +if (!runs.length) throw new Error("No workflow runs found") const jobs = await github.listWorkflowJobs(runs[0].id) -// redacted job log console.log(jobs[0].content) +if (!jobs.length) throw new Error("No workflow jobs found") + +const languages = await github.listRepositoryLanguages() +console.log(languages) +if (!Object.keys(languages).length) throw new Error("No languages found") + +const files = await github.getRepositoryContent("", { + type: "file", + downloadContent: true, + maxDownloadSize: 2_000, +}) +if (!files.length) throw new Error("No files found") +console.log( + files.map(({ filename, content }) => ({ + filename, + content: content?.slice(0, 50), + })) +) diff --git a/packages/sample/genaisrc/node/genaiscript.d.ts b/packages/sample/genaisrc/node/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/genaisrc/node/genaiscript.d.ts +++ b/packages/sample/genaisrc/node/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/genaisrc/python/genaiscript.d.ts b/packages/sample/genaisrc/python/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/genaisrc/python/genaiscript.d.ts +++ b/packages/sample/genaisrc/python/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/genaisrc/style/genaiscript.d.ts b/packages/sample/genaisrc/style/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/genaisrc/style/genaiscript.d.ts +++ b/packages/sample/genaisrc/style/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/src/aici/genaiscript.d.ts b/packages/sample/src/aici/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/src/aici/genaiscript.d.ts +++ b/packages/sample/src/aici/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/src/errors/genaiscript.d.ts b/packages/sample/src/errors/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/src/errors/genaiscript.d.ts +++ b/packages/sample/src/errors/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/src/genaiscript.d.ts b/packages/sample/src/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/src/genaiscript.d.ts +++ b/packages/sample/src/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/src/makecode/genaiscript.d.ts b/packages/sample/src/makecode/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/src/makecode/genaiscript.d.ts +++ b/packages/sample/src/makecode/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/src/tla/genaiscript.d.ts b/packages/sample/src/tla/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/src/tla/genaiscript.d.ts +++ b/packages/sample/src/tla/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/sample/src/vision/genaiscript.d.ts b/packages/sample/src/vision/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/sample/src/vision/genaiscript.d.ts +++ b/packages/sample/src/vision/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/packages/vscode/genaisrc/genaiscript.d.ts b/packages/vscode/genaisrc/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/packages/vscode/genaisrc/genaiscript.d.ts +++ b/packages/vscode/genaisrc/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/slides/genaisrc/genaiscript.d.ts b/slides/genaisrc/genaiscript.d.ts index c0a6426d2c..b9b339303e 100644 --- a/slides/genaisrc/genaiscript.d.ts +++ b/slides/genaisrc/genaiscript.d.ts @@ -1351,6 +1351,20 @@ interface GitHubIssue { state: string state_reason?: "completed" | "reopened" | "not_planned" | null html_url: string + reactions?: GitHubReactions +} + +interface GitHubReactions { + url: string + total_count: number + "+1": number + "-1": number + laugh: number + confused: number + heart: number + hooray: number + eyes: number + rocket: number } interface GitHubComment { @@ -1359,6 +1373,7 @@ interface GitHubComment { created_at: string updated_at: string html_url: string + reactions?: GitHubReactions } interface GitHubPullRequest extends GitHubIssue {} @@ -1379,8 +1394,10 @@ interface GitHubWorkflow { } interface GitHubPaginationOptions { - page?: number - per_page?: number + /** + * Default number of items to fetch, default is 50. + */ + count?: number } interface GitHubFile extends WorkspaceFile { @@ -1388,6 +1405,10 @@ interface GitHubFile extends WorkspaceFile { size: number } +interface GitHubUser { + login: string +} + interface GitHub { /** * Gets connection information for octokit @@ -1511,6 +1532,11 @@ interface GitHub { type?: (typeof GitHubFile)["type"] } ): Promise + + /** + * Gets the underlying Octokit client + */ + client(): Promise } interface MD { diff --git a/slides/yarn.lock b/slides/yarn.lock index e0b6f643e4..2e0c05897d 100644 --- a/slides/yarn.lock +++ b/slides/yarn.lock @@ -4646,27 +4646,27 @@ tsx@^4.19.0: optionalDependencies: fsevents "~2.3.3" -twoslash-protocol@0.2.11: - version "0.2.11" - resolved "https://registry.yarnpkg.com/twoslash-protocol/-/twoslash-protocol-0.2.11.tgz#a5ca5c40bd78e930c921ce2697025579831597d6" - integrity sha512-rp+nkOWbKfJnBTDZtnIaBGjnU+4CaMhqu6db2UU7byU96rH8X4hao4BOxYw6jdZc85Lhv5pOfcjgfHeQyLzndQ== +twoslash-protocol@0.2.12: + version "0.2.12" + resolved "https://registry.yarnpkg.com/twoslash-protocol/-/twoslash-protocol-0.2.12.tgz#4c22fc287bc0fc32eec8e7faa6092b0dc5cc4ecb" + integrity sha512-5qZLXVYfZ9ABdjqbvPc4RWMr7PrpPaaDSeaYY55vl/w1j6H6kzsWK/urAEIXlzYlyrFmyz1UbwIt+AA0ck+wbg== twoslash-vue@^0.2.11: - version "0.2.11" - resolved "https://registry.yarnpkg.com/twoslash-vue/-/twoslash-vue-0.2.11.tgz#0e945519e21ce91d6e6cec3021faf4eb919271af" - integrity sha512-wBwIwG0PRuv5V+1DD4Zno1j6MnaCbaY/ELops7oKSoMBTIQL720iRXppyldVVoYvti2caUA97T36XhZXHpjQyA== + version "0.2.12" + resolved "https://registry.yarnpkg.com/twoslash-vue/-/twoslash-vue-0.2.12.tgz#8a86a0fde76f0b625deb3569204f2b0f135f520a" + integrity sha512-kxH60DLn2QBcN2wjqxgMDkyRgmPXsytv7fJIlsyFMDPSkm1/lMrI/UMrNAshNaRHcI+hv8x3h/WBgcvlb2RNAQ== dependencies: "@vue/language-core" "~2.1.6" - twoslash "0.2.11" - twoslash-protocol "0.2.11" + twoslash "0.2.12" + twoslash-protocol "0.2.12" -twoslash@0.2.11, twoslash@^0.2.11: - version "0.2.11" - resolved "https://registry.yarnpkg.com/twoslash/-/twoslash-0.2.11.tgz#78d5166e4840802aeca959940fbb61b57c9dc238" - integrity sha512-392Qkcu5sD2hROLZ+XPywChreDGJ8Yu5nnK/Moxfti/R39q0Q39MaV7iHjz92B5qucyjsQFnKMdYIzafX5T8dg== +twoslash@0.2.12, twoslash@^0.2.11: + version "0.2.12" + resolved "https://registry.yarnpkg.com/twoslash/-/twoslash-0.2.12.tgz#46b11fb23ff3d950264ca32877576e2c2b4e997e" + integrity sha512-tEHPASMqi7kqwfJbkk7hc/4EhlrKCSLcur+TcvYki3vhIfaRMXnXjaYFgXpoZRbT6GdprD4tGuVBEmTpUgLBsw== dependencies: "@typescript/vfs" "^1.6.0" - twoslash-protocol "0.2.11" + twoslash-protocol "0.2.12" typescript@^5.5.4: version "5.6.2" @@ -4733,9 +4733,9 @@ unicorn-magic@^0.1.0: integrity sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ== unimport@^3.12.0: - version "3.13.0" - resolved "https://registry.yarnpkg.com/unimport/-/unimport-3.13.0.tgz#0ef719ede5661db04fa62ea77db952a22e1e34bf" - integrity sha512-0WkKsLy8jkcnB38VQdAGvF0N2trJyDbUuHsfXcyrspwgwWTIThiMpvnDNZMVsuNc11SwT2GYzcQ2RnI1TY/xcw== + version "3.13.1" + resolved "https://registry.yarnpkg.com/unimport/-/unimport-3.13.1.tgz#4362340e2df7edad212c693d33808189e058dded" + integrity sha512-nNrVzcs93yrZQOW77qnyOVHtb68LegvhYFwxFMfuuWScmwQmyVCG/NBuN8tYsaGzgQUVYv34E/af+Cc9u4og4A== dependencies: "@rollup/pluginutils" "^5.1.2" acorn "^8.12.1" diff --git a/yarn.lock b/yarn.lock index d145816e24..85907c4891 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1190,7 +1190,7 @@ resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-graphql/-/plugin-paginate-graphql-5.2.3.tgz#19882ff4694066b0937aea85b7e8eac512df4e9a" integrity sha512-EzFueuXVU3VHv5FwEXbdznn9EmyF0vA5LGDX6a8fJ9YJAlDgdYHRKJMO4Ghl2PPPJBxIPMDUJMnlUHqcvP7AnQ== -"@octokit/plugin-paginate-rest@^11.0.0": +"@octokit/plugin-paginate-rest@^11.0.0", "@octokit/plugin-paginate-rest@^11.3.4": version "11.3.4" resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.3.4.tgz#68c834beb721a4b5919cb98987b40e69099b5f30" integrity sha512-lqBHWiuI468XJ/o06Eg6hgACGXwikyHUzoYs/Y3gA1uVzPldxSeuEiCLAZRy4ovaAJozjds18ni2wgdT1oWtDQ== @@ -1209,7 +1209,7 @@ dependencies: "@octokit/types" "^13.6.0" -"@octokit/plugin-retry@^7.0.0": +"@octokit/plugin-retry@^7.0.0", "@octokit/plugin-retry@^7.1.2": version "7.1.2" resolved "https://registry.yarnpkg.com/@octokit/plugin-retry/-/plugin-retry-7.1.2.tgz#242e2d19a72a50b5113bb25d7d2c622ce0373fa0" integrity sha512-XOWnPpH2kJ5VTwozsxGurw+svB2e61aWlmk5EVIYZPwFK5F9h4cyPyj9CIKRyMXMHSwpIsI3mPOdpMmrRhe7UQ==