gpt-driver-node 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -442,7 +442,7 @@ async function executeSmartLoop(ctx, params) {
442
442
  try {
443
443
  globalLogger.debug(`[SmartLoop] Checking cache (Attempt ${attempt + 1}/${maxCacheAttempts})`);
444
444
  const cacheResult = await executeFromCache({
445
- apiKey: ctx.apiKey,
445
+ apiKey: ctx.organisationId,
446
446
  stepNumber: params.stepNumber,
447
447
  stepDescription: params.description,
448
448
  screenshot,
@@ -472,7 +472,7 @@ async function executeSmartLoop(ctx, params) {
472
472
  anyCacheMiss = true;
473
473
  globalLogger.info(`[SmartLoop] Cache Miss. Requesting AI agent...`);
474
474
  const agentResponse = await executeAgentStep({
475
- apiKey: ctx.apiKey,
475
+ apiKey: ctx.organisationId,
476
476
  base64_screenshot: screenshot,
477
477
  instruction: params.instruction,
478
478
  action_history: actionHistory
@@ -555,7 +555,7 @@ async function executeSmartLoop(ctx, params) {
555
555
  globalLogger.info(`[SmartLoop] Populating cache with ${currentExecutionData.length} frame(s)...`);
556
556
  try {
557
557
  await populateCache({
558
- apiKey: ctx.apiKey,
558
+ apiKey: ctx.organisationId,
559
559
  stepNumber: params.stepNumber,
560
560
  stepDescription: params.description,
561
561
  executionData: currentExecutionData,
@@ -604,6 +604,7 @@ class GptDriver {
604
604
  });
605
605
  }
606
606
  apiKey;
607
+ organisationId;
607
608
  gptDriverSessionId;
608
609
  gptDriverBaseUrl;
609
610
  appiumSessionConfig;
@@ -628,6 +629,7 @@ class GptDriver {
628
629
  *
629
630
  * @param {GptDriverConfig} config - The configuration object for initializing the GptDriver instance. This includes:
630
631
  * - `apiKey`: The API key for authenticating requests to the GPT Driver server.
632
+ * - `organisationId` (optional): The Organisation Identifier for authenticating requests to the GPT Driver Cache Server.
631
633
  * - `driver` (optional): An existing WebDriver instance.
632
634
  * - `severConfig` (optional): Configuration for the Appium server, including URL and device settings.
633
635
  * @throws {Error} If a WebDriver instance is provided without a server URL, or if neither a WebDriver instance nor
@@ -638,6 +640,7 @@ class GptDriver {
638
640
  constructor(config) {
639
641
  this.testId = config.testId;
640
642
  this.apiKey = config.apiKey;
643
+ this.organisationId = config.organisationId;
641
644
  this.buildId = config.buildId;
642
645
  this.useGptDriverCloud = config.useGptDriverCloud;
643
646
  this.gptDriverBaseUrl = GPT_DRIVER_BASE_URL;
@@ -821,6 +824,9 @@ class GptDriver {
821
824
  * This context provides all the callbacks needed by the smart loop executor.
822
825
  */
823
826
  createSmartLoopContext() {
827
+ if (!this.organisationId) {
828
+ throw new Error("Organisation ID is missing, please set it in the GPTDriver constructor");
829
+ }
824
830
  return {
825
831
  apiKey: this.apiKey,
826
832
  platform: this.appiumSessionConfig?.platform,
@@ -830,7 +836,8 @@ class GptDriver {
830
836
  performTap: (x, y) => this.performTap(x, y),
831
837
  performScroll: (direction) => this.performScroll(direction),
832
838
  performType: (text) => this.performType(text),
833
- logCodeExecution: async (screenshot, command) => this.logCodeExecution(screenshot, command)
839
+ logCodeExecution: async (screenshot, command) => this.logCodeExecution(screenshot, command),
840
+ organisationId: this.organisationId
834
841
  };
835
842
  }
836
843
  /**
package/dist/index.d.cts CHANGED
@@ -14,6 +14,7 @@ interface ServerSessionInitConfig {
14
14
  interface GptDriverConfig {
15
15
  testId?: string;
16
16
  apiKey: string;
17
+ organisationId?: string;
17
18
  driver?: WebDriver | Browser;
18
19
  serverConfig: {
19
20
  device?: ServerSessionInitConfig;
@@ -385,6 +386,7 @@ type SavableTestStore = z.infer<typeof SavableTestStoreSchema>;
385
386
  declare class GptDriver {
386
387
  private interpolateTemplate;
387
388
  private apiKey;
389
+ private organisationId?;
388
390
  private gptDriverSessionId?;
389
391
  private gptDriverBaseUrl;
390
392
  private appiumSessionConfig?;
@@ -408,6 +410,7 @@ declare class GptDriver {
408
410
  *
409
411
  * @param {GptDriverConfig} config - The configuration object for initializing the GptDriver instance. This includes:
410
412
  * - `apiKey`: The API key for authenticating requests to the GPT Driver server.
413
+ * - `organisationId` (optional): The Organisation Identifier for authenticating requests to the GPT Driver Cache Server.
411
414
  * - `driver` (optional): An existing WebDriver instance.
412
415
  * - `severConfig` (optional): Configuration for the Appium server, including URL and device settings.
413
416
  * @throws {Error} If a WebDriver instance is provided without a server URL, or if neither a WebDriver instance nor
package/dist/index.mjs CHANGED
@@ -440,7 +440,7 @@ async function executeSmartLoop(ctx, params) {
440
440
  try {
441
441
  globalLogger.debug(`[SmartLoop] Checking cache (Attempt ${attempt + 1}/${maxCacheAttempts})`);
442
442
  const cacheResult = await executeFromCache({
443
- apiKey: ctx.apiKey,
443
+ apiKey: ctx.organisationId,
444
444
  stepNumber: params.stepNumber,
445
445
  stepDescription: params.description,
446
446
  screenshot,
@@ -470,7 +470,7 @@ async function executeSmartLoop(ctx, params) {
470
470
  anyCacheMiss = true;
471
471
  globalLogger.info(`[SmartLoop] Cache Miss. Requesting AI agent...`);
472
472
  const agentResponse = await executeAgentStep({
473
- apiKey: ctx.apiKey,
473
+ apiKey: ctx.organisationId,
474
474
  base64_screenshot: screenshot,
475
475
  instruction: params.instruction,
476
476
  action_history: actionHistory
@@ -553,7 +553,7 @@ async function executeSmartLoop(ctx, params) {
553
553
  globalLogger.info(`[SmartLoop] Populating cache with ${currentExecutionData.length} frame(s)...`);
554
554
  try {
555
555
  await populateCache({
556
- apiKey: ctx.apiKey,
556
+ apiKey: ctx.organisationId,
557
557
  stepNumber: params.stepNumber,
558
558
  stepDescription: params.description,
559
559
  executionData: currentExecutionData,
@@ -602,6 +602,7 @@ class GptDriver {
602
602
  });
603
603
  }
604
604
  apiKey;
605
+ organisationId;
605
606
  gptDriverSessionId;
606
607
  gptDriverBaseUrl;
607
608
  appiumSessionConfig;
@@ -626,6 +627,7 @@ class GptDriver {
626
627
  *
627
628
  * @param {GptDriverConfig} config - The configuration object for initializing the GptDriver instance. This includes:
628
629
  * - `apiKey`: The API key for authenticating requests to the GPT Driver server.
630
+ * - `organisationId` (optional): The Organisation Identifier for authenticating requests to the GPT Driver Cache Server.
629
631
  * - `driver` (optional): An existing WebDriver instance.
630
632
  * - `severConfig` (optional): Configuration for the Appium server, including URL and device settings.
631
633
  * @throws {Error} If a WebDriver instance is provided without a server URL, or if neither a WebDriver instance nor
@@ -636,6 +638,7 @@ class GptDriver {
636
638
  constructor(config) {
637
639
  this.testId = config.testId;
638
640
  this.apiKey = config.apiKey;
641
+ this.organisationId = config.organisationId;
639
642
  this.buildId = config.buildId;
640
643
  this.useGptDriverCloud = config.useGptDriverCloud;
641
644
  this.gptDriverBaseUrl = GPT_DRIVER_BASE_URL;
@@ -819,6 +822,9 @@ class GptDriver {
819
822
  * This context provides all the callbacks needed by the smart loop executor.
820
823
  */
821
824
  createSmartLoopContext() {
825
+ if (!this.organisationId) {
826
+ throw new Error("Organisation ID is missing, please set it in the GPTDriver constructor");
827
+ }
822
828
  return {
823
829
  apiKey: this.apiKey,
824
830
  platform: this.appiumSessionConfig?.platform,
@@ -828,7 +834,8 @@ class GptDriver {
828
834
  performTap: (x, y) => this.performTap(x, y),
829
835
  performScroll: (direction) => this.performScroll(direction),
830
836
  performType: (text) => this.performType(text),
831
- logCodeExecution: async (screenshot, command) => this.logCodeExecution(screenshot, command)
837
+ logCodeExecution: async (screenshot, command) => this.logCodeExecution(screenshot, command),
838
+ organisationId: this.organisationId
832
839
  };
833
840
  }
834
841
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gpt-driver-node",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.cts",