diff --git a/.github/workflows/dispatch.yaml b/.github/workflows/dispatch.yaml index 7f12d49..7045abc 100644 --- a/.github/workflows/dispatch.yaml +++ b/.github/workflows/dispatch.yaml @@ -22,7 +22,7 @@ jobs: - uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Automated GPTScript Version Update - file_pattern: 'package*.json src/install-binary.js' + file_pattern: 'package*.json scripts/install-binary.js' tag-release: needs: update-gptscript-dep runs-on: ubuntu-latest diff --git a/package-lock.json b/package-lock.json index 5ff7ca6..5ea2a64 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gptscript-ai/gptscript", - "version": "v0.8.2", + "version": "v0.8.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gptscript-ai/gptscript", - "version": "v0.8.2", + "version": "v0.8.3", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 210836f..593b53b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gptscript-ai/gptscript", - "version": "v0.8.2", + "version": "v0.8.3", "description": "Run gptscript in node.js", "source": "src/gptscript.ts", "main": "dist/gptscript.js", diff --git a/scripts/install-binary.js b/scripts/install-binary.js index 7c4bbbd..7e09eaa 100644 --- a/scripts/install-binary.js +++ b/scripts/install-binary.js @@ -68,7 +68,7 @@ if (process.platform === 'win32') { const gptscript_info = { name: "gptscript", url: "https://github.com/gptscript-ai/gptscript/releases/download/", - version: "v0.8.2" + version: "v0.8.3" } const pltfm = { diff --git a/src/gptscript.ts b/src/gptscript.ts index 3735f9b..64214da 100644 --- a/src/gptscript.ts +++ b/src/gptscript.ts @@ -569,7 +569,7 @@ export class Run { } } else if ((f.type as string).startsWith("call")) { f = f as CallFrame - if (f.parentID === "" && this.parentCallId === "") { + if (!f.parentID && this.parentCallId === "") { this.parentCallId = f.id } this.calls[f.id] = f diff --git a/tests/gptscript.test.ts b/tests/gptscript.test.ts index e061a82..4a298bf 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -1,5 +1,5 @@ import * as gptscript from "../src/gptscript" -import {ArgumentSchemaType, PropertyType, ToolType} from "../src/gptscript" +import {ArgumentSchemaType, PropertyType, RunEventType, ToolType} from "../src/gptscript" import path from "path" import {fileURLToPath} from "url" @@ -66,11 +66,20 @@ describe("gptscript module", () => { for (let output of data.output) out += `system: ${output.content}` }) + let callFinished = false + run.on(gptscript.RunEventType.CallFinish, (data: gptscript.CallFrame) => { + if (data.type == RunEventType.CallFinish) { + expect(callFinished).toBe(false) + callFinished = true + } + }) + await run.text() err = run.err expect(out).toContain("Calvin Coolidge") expect(err).toEqual("") + expect(run.parentCallFrame()).toBeTruthy() }) test("evaluate executes a prompt correctly with context", async () => {