Skip to content

Commit 0aef715

Browse files
committed
chore: add credential check param field
Signed-off-by: Donnie Adams <[email protected]>
1 parent 1f83238 commit 0aef715

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/gptscript.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ export type Credential = {
12381238
ephemeral: boolean
12391239
expiresAt?: Date | undefined
12401240
refreshToken?: string | undefined
1241+
checkParam?: string | undefined
12411242
}
12421243

12431244
// Types for OpenAI API-compatible models
@@ -1277,6 +1278,7 @@ type cred = {
12771278
ephemeral: boolean
12781279
expiresAt: string | undefined
12791280
refreshToken: string | undefined
1281+
checkParam: string | undefined
12801282
}
12811283

12821284
export function credentialToJSON(c: Credential): string {
@@ -1289,7 +1291,8 @@ export function credentialToJSON(c: Credential): string {
12891291
env: c.env,
12901292
ephemeral: c.ephemeral,
12911293
expiresAt: expiresAt,
1292-
refreshToken: c.refreshToken
1294+
refreshToken: c.refreshToken,
1295+
checkParam: c.checkParam
12931296
} as cred)
12941297
}
12951298

@@ -1302,7 +1305,8 @@ function jsonToCredential(cred: string): Credential {
13021305
env: c.env,
13031306
ephemeral: c.ephemeral,
13041307
expiresAt: c.expiresAt ? new Date(c.expiresAt) : undefined,
1305-
refreshToken: c.refreshToken
1308+
refreshToken: c.refreshToken,
1309+
checkParam: c.checkParam
13061310
}
13071311
}
13081312

tests/gptscript.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ describe("gptscript module", () => {
843843
ephemeral: false,
844844
expiresAt: new Date(Date.now() + 5000), // 5 seconds from now
845845
type: CredentialType.Tool,
846+
checkParam: "my-check-param",
846847
})
847848
} catch (e) {
848849
throw new Error("failed to create credential: " + e)
@@ -856,6 +857,8 @@ describe("gptscript module", () => {
856857
const result = await g.revealCredential(["default"], name)
857858
expect(result.env["TEST"]).toEqual(value)
858859
expect(result.expiresAt!.valueOf()).toBeLessThan(new Date().valueOf())
860+
expect(result.type).toEqual(CredentialType.Tool)
861+
expect(result.checkParam).toEqual("my-check-param")
859862
} catch (e) {
860863
throw new Error("failed to reveal credential: " + e)
861864
}

0 commit comments

Comments
 (0)