@testsmith/api-spector 0.6.1 → 0.6.3

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.
Files changed (30) hide show
  1. package/out/main/agents.js +2 -1
  2. package/out/main/chunks/{snapshots-Y33M1SEy.js → broker-client-WEymdqAK.js} +119 -10
  3. package/out/main/chunks/{cli-common-BKYgsbGB.js → cli-common-vASoDfQH.js} +3 -2
  4. package/out/main/chunks/data-files-Br2h3Dt2.js +85 -0
  5. package/out/main/chunks/escape-BwPM4Tf6.js +9 -0
  6. package/out/main/chunks/{handle-BFaeFA0A.js → handle-CL-nWtYA.js} +11 -2
  7. package/out/main/chunks/{import-D9LH0isB.js → import-DdXhO56X.js} +2 -2
  8. package/out/main/chunks/{request-collection-BQIo1765.js → request-collection-GzK4QgvT.js} +78 -17
  9. package/out/main/chunks/{request-exec-5_3279w1.js → request-exec-DAFA6Fap.js} +19 -1
  10. package/out/main/chunks/{soap-handler-CWn3o6Py.js → soap-handler-BAPCALkN.js} +2 -2
  11. package/out/main/compare.js +2 -1
  12. package/out/main/contract.js +50 -147
  13. package/out/main/coverage.js +2 -1
  14. package/out/main/generate-tests.js +2 -1
  15. package/out/main/index.js +134 -36
  16. package/out/main/lib.js +2 -2
  17. package/out/main/mock.js +2 -1
  18. package/out/main/record.js +2 -1
  19. package/out/main/runner.js +117 -20
  20. package/out/main/wsdl.js +5 -4
  21. package/out/preload/index.js +21 -3
  22. package/out/renderer/assets/{GraphQLEditor-8wU1UeBL.js → GraphQLEditor-MImdgXb4.js} +3 -1
  23. package/out/renderer/assets/{SoapEditor-DQwLLqCX.js → SoapEditor-rxb3heue.js} +4 -2
  24. package/out/renderer/assets/ajv-2MAg6kGF.js +6153 -0
  25. package/out/renderer/assets/codemirror-F6m3Hm1M.js +26552 -0
  26. package/out/renderer/assets/index-B3mtLdU3.css +2 -0
  27. package/out/renderer/assets/{index-CdxTj7i6.js → index-ByGIqJ2H.js} +17526 -49312
  28. package/out/renderer/index.html +4 -2
  29. package/package.json +1 -1
  30. package/out/renderer/assets/index-CkHujZU3.css +0 -2
package/out/main/index.js CHANGED
@@ -22,18 +22,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  mod
23
23
  ));
24
24
  const electron = require("electron");
25
- const handle = require("./chunks/handle-BFaeFA0A.js");
25
+ const handle = require("./chunks/handle-CL-nWtYA.js");
26
26
  const path = require("path");
27
27
  const fs$1 = require("fs");
28
28
  const promises = require("fs/promises");
29
29
  const crypto = require("crypto");
30
30
  const JSZip = require("jszip");
31
- const requestExec = require("./chunks/request-exec-5_3279w1.js");
31
+ const dataFiles = require("./chunks/data-files-Br2h3Dt2.js");
32
+ const requestExec = require("./chunks/request-exec-DAFA6Fap.js");
32
33
  const ipcValidate = require("./chunks/ipc-validate-sqUFqRmE.js");
33
34
  const uuid = require("uuid");
34
35
  const jsYaml = require("js-yaml");
35
36
  const undici = require("undici");
36
- const requestCollection = require("./chunks/request-collection-BQIo1765.js");
37
+ const requestCollection = require("./chunks/request-collection-GzK4QgvT.js");
37
38
  const mockServer = require("./chunks/mock-server-BxiXhP1m.js");
38
39
  const http = require("http");
39
40
  const WebSocket = require("ws");
@@ -42,10 +43,11 @@ const os = require("node:os");
42
43
  const path$1 = require("node:path");
43
44
  const grpc = require("@grpc/grpc-js");
44
45
  const protoLoader = require("@grpc/proto-loader");
45
- const soapHandler = require("./chunks/soap-handler-CWn3o6Py.js");
46
+ const soapHandler = require("./chunks/soap-handler-BAPCALkN.js");
47
+ const escape = require("./chunks/escape-BwPM4Tf6.js");
46
48
  const promises$1 = require("node:fs/promises");
47
49
  const os$1 = require("os");
48
- const snapshots = require("./chunks/snapshots-Y33M1SEy.js");
50
+ const brokerClient = require("./chunks/broker-client-WEymdqAK.js");
49
51
  const simpleGit = require("simple-git");
50
52
  const recorder = require("./chunks/recorder-0Ij921El.js");
51
53
  require("tls");
@@ -332,14 +334,16 @@ Create a workspace in this folder and add "${path.basename(wsPath)}" to it? The
332
334
  });
333
335
  handle.handleIpc(ipc, handle.IPC.file.loadCollection, async (_e, relPath) => {
334
336
  if (!workspaceDir) throw new Error("No workspace open");
335
- const raw = await promises.readFile(path.resolve(workspaceDir, relPath), "utf8");
336
- return JSON.parse(raw);
337
+ const fullPath = path.resolve(workspaceDir, relPath);
338
+ const raw = await promises.readFile(fullPath, "utf8");
339
+ return dataFiles.inlineDataSets(JSON.parse(raw), path.dirname(fullPath));
337
340
  });
338
341
  handle.handleIpc(ipc, handle.IPC.file.saveCollection, async (_e, relPath, col) => {
339
342
  if (!workspaceDir) throw new Error("No workspace open");
340
343
  const fullPath = path.resolve(workspaceDir, relPath);
341
344
  await promises.mkdir(path.dirname(fullPath), { recursive: true });
342
- await atomicWrite(fullPath, JSON.stringify(col, null, 2));
345
+ const toWrite = await dataFiles.externalizeDataSets(col, path.dirname(fullPath));
346
+ await atomicWrite(fullPath, JSON.stringify(toWrite, null, 2));
343
347
  });
344
348
  handle.handleIpc(ipc, handle.IPC.file.loadEnvironment, async (_e, relPath) => {
345
349
  if (!workspaceDir) throw new Error("No workspace open");
@@ -942,6 +946,77 @@ function registerRequestHandler(ipc) {
942
946
  };
943
947
  });
944
948
  }
949
+ const AI_OPENAI_TOKEN_REF = "ai:openai:token";
950
+ const DEFAULT_AI_MODEL = "gpt-4o-mini";
951
+ const OPENAI_URL = "https://api.openai.com/v1/chat/completions";
952
+ function systemPrompt(level) {
953
+ return [
954
+ "You write clear, concise API documentation in GitHub-flavored Markdown.",
955
+ `You are documenting an API ${level}.`,
956
+ "Return ONLY markdown — no preamble, no code fences around the whole answer.",
957
+ "Use short paragraphs and headings. Describe purpose, key parameters, request/response shape,",
958
+ "auth if relevant, and any gotchas. Do not invent endpoints or fields that are not in the context.",
959
+ "Keep it practical for a developer who will call this API."
960
+ ].join(" ");
961
+ }
962
+ function registerAiHandlers(ipc) {
963
+ handle.handleIpc(ipc, handle.IPC.ai.generateDocs, async (_e, input) => {
964
+ const token = await requestExec.getSecret(AI_OPENAI_TOKEN_REF);
965
+ if (!token) {
966
+ throw new Error("No OpenAI API key configured. Add one in Settings → AI.");
967
+ }
968
+ const model = input.model?.trim() || DEFAULT_AI_MODEL;
969
+ const userParts = [
970
+ `Name: ${input.name}`,
971
+ "",
972
+ input.context
973
+ ];
974
+ if (input.existing?.trim()) {
975
+ userParts.push("", "Existing documentation to refine and expand (keep what is still accurate):", input.existing.trim());
976
+ }
977
+ const controller = new AbortController();
978
+ const timeout = setTimeout(() => controller.abort(), 6e4);
979
+ try {
980
+ const res = await fetch(OPENAI_URL, {
981
+ method: "POST",
982
+ headers: {
983
+ "content-type": "application/json",
984
+ authorization: `Bearer ${token}`
985
+ },
986
+ body: JSON.stringify({
987
+ model,
988
+ temperature: 0.3,
989
+ messages: [
990
+ { role: "system", content: systemPrompt(input.level) },
991
+ { role: "user", content: userParts.join("\n") }
992
+ ]
993
+ }),
994
+ signal: controller.signal,
995
+ // @ts-expect-error undici accepts a dispatcher for proxy/TLS support
996
+ dispatcher: await requestExec.buildDispatcher(void 0, void 0)
997
+ });
998
+ if (!res.ok) {
999
+ let detail = `HTTP ${res.status}`;
1000
+ try {
1001
+ const body = await res.json();
1002
+ if (body?.error?.message) detail = body.error.message;
1003
+ } catch {
1004
+ }
1005
+ if (res.status === 401) detail = "OpenAI rejected the API key (401). Check the key in Settings → AI.";
1006
+ throw new Error(`Doc generation failed: ${detail}`);
1007
+ }
1008
+ const data = await res.json();
1009
+ const content = data.choices?.[0]?.message?.content?.trim();
1010
+ if (!content) throw new Error("The model returned an empty response.");
1011
+ return content;
1012
+ } catch (e) {
1013
+ if (e instanceof Error && e.name === "AbortError") throw new Error("Doc generation timed out after 60s.");
1014
+ throw e;
1015
+ } finally {
1016
+ clearTimeout(timeout);
1017
+ }
1018
+ });
1019
+ }
945
1020
  const POSTMAN_RULES = [
946
1021
  // Variables — environment
947
1022
  [/\bpm\.environment\.get\(/g, "sp.environment.get("],
@@ -1433,6 +1508,10 @@ function buildCollection(spec) {
1433
1508
  const globalSecurity = spec.security ?? [];
1434
1509
  const requests = {};
1435
1510
  const foldersByTag = {};
1511
+ const tagDescriptions = {};
1512
+ for (const tg of spec.tags ?? []) {
1513
+ if (tg?.name && tg.description) tagDescriptions[tg.name] = tg.description;
1514
+ }
1436
1515
  for (const [pathStr, pathItem] of Object.entries(spec.paths ?? {})) {
1437
1516
  const resolved = resolve(spec, pathItem);
1438
1517
  const pathLevelParams = resolved.parameters ?? [];
@@ -1462,14 +1541,14 @@ function buildCollection(spec) {
1462
1541
  params,
1463
1542
  auth: buildAuth(security, securitySchemes),
1464
1543
  body,
1465
- description: operation.description ?? "",
1544
+ description: operation.description || operation.summary || "",
1466
1545
  meta: { tags },
1467
1546
  ...responseSchema ? { schema: responseSchema } : {},
1468
1547
  ...examples ? { examples } : {}
1469
1548
  };
1470
1549
  requests[req.id] = req;
1471
1550
  if (!foldersByTag[tag]) {
1472
- foldersByTag[tag] = { id: uuid.v4(), name: tag, description: "", folders: [], requestIds: [] };
1551
+ foldersByTag[tag] = { id: uuid.v4(), name: tag, description: tagDescriptions[tag] ?? "", folders: [], requestIds: [] };
1473
1552
  }
1474
1553
  foldersByTag[tag].requestIds.push(req.id);
1475
1554
  }
@@ -1744,7 +1823,8 @@ function parseBruFile(content, fileName) {
1744
1823
  params,
1745
1824
  auth,
1746
1825
  body,
1747
- description: "",
1826
+ // Bruno keeps request documentation in a `docs { ... }` block (markdown).
1827
+ description: extractBlock(content, "docs")?.trim() ?? "",
1748
1828
  preRequestScript: extractBlock(content, "script:pre-request") ? translateScript(extractBlock(content, "script:pre-request").trim(), "bruno") || void 0 : void 0,
1749
1829
  postRequestScript: extractBlock(content, "script:post-response") ? translateScript(extractBlock(content, "script:post-response").trim(), "bruno") || void 0 : void 0,
1750
1830
  meta: { seq: meta["seq"] !== void 0 ? Number(meta["seq"]) : 0 }
@@ -4606,6 +4686,7 @@ function registerRunnerHandler(ipc) {
4606
4686
  isHook: item.isHook,
4607
4687
  hookType: item.hookType,
4608
4688
  scopeId: item.scopeId,
4689
+ collection: item.collection,
4609
4690
  scopePath: item.scopePath,
4610
4691
  iterationLabel: item.iterationLabel
4611
4692
  };
@@ -4619,6 +4700,7 @@ function registerRunnerHandler(ipc) {
4619
4700
  isHook: item.isHook,
4620
4701
  hookType: item.hookType,
4621
4702
  scopeId: item.scopeId,
4703
+ collection: item.collection,
4622
4704
  scopePath: item.scopePath
4623
4705
  };
4624
4706
  event.sender.send(handle.IPC.runner.progress, { requestId: item.request.id, ...runningUpdate });
@@ -4631,7 +4713,9 @@ function registerRunnerHandler(ipc) {
4631
4713
  dispatcher,
4632
4714
  piiMaskPatterns,
4633
4715
  proxy,
4634
- tls
4716
+ tls,
4717
+ expectStatus: item.expectStatus,
4718
+ owaspTag: item.owaspTag
4635
4719
  });
4636
4720
  runEnvVars = updatedEnvVars;
4637
4721
  runCollectionVars = updatedCollectionVars;
@@ -4648,6 +4732,7 @@ function registerRunnerHandler(ipc) {
4648
4732
  isHook: item.isHook,
4649
4733
  hookType: item.hookType,
4650
4734
  scopeId: item.scopeId,
4735
+ collection: item.collection,
4651
4736
  scopePath: item.scopePath
4652
4737
  });
4653
4738
  if (requestDelay > 0 && item !== items[items.length - 1]) {
@@ -5251,9 +5336,7 @@ function generateMarkdown(payload) {
5251
5336
  }
5252
5337
  return lines.join("\n");
5253
5338
  }
5254
- function escHtml(s) {
5255
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
5256
- }
5339
+ const escHtml = escape.escapeHtml;
5257
5340
  const METHOD_COLORS = {
5258
5341
  GET: "#34d399",
5259
5342
  POST: "#60a5fa",
@@ -5443,7 +5526,7 @@ function inferSchemaFromJson(json) {
5443
5526
  async function resolveSnapshotSpec(relPath) {
5444
5527
  const dir = getWorkspaceDir();
5445
5528
  if (!dir) throw new Error("No workspace open - cannot resolve snapshot.");
5446
- const snap = await snapshots.loadSnapshot(dir, relPath);
5529
+ const snap = await brokerClient.loadSnapshot(dir, relPath);
5447
5530
  const tmp = path.join(os$1.tmpdir(), `api-spector-${crypto.randomUUID()}.${snap.format === "yaml" ? "yaml" : "json"}`);
5448
5531
  await promises.writeFile(tmp, snap.spec, "utf8");
5449
5532
  return { specPath: tmp };
@@ -5455,7 +5538,7 @@ function registerContractHandlers(ipc) {
5455
5538
  let requests = payload.requests;
5456
5539
  let { specUrl, specPath } = payload;
5457
5540
  if (mode !== "provider") {
5458
- const designReqs = await snapshots.loadDesignContractRequests(
5541
+ const designReqs = await brokerClient.loadDesignContractRequests(
5459
5542
  { designContracts: payload.designContracts },
5460
5543
  getWorkspaceDir() ?? void 0
5461
5544
  );
@@ -5476,13 +5559,13 @@ function registerContractHandlers(ipc) {
5476
5559
  }
5477
5560
  switch (mode) {
5478
5561
  case "consumer":
5479
- return snapshots.runConsumerContracts(requests, envVars, collectionVars, providerBaseUrl);
5562
+ return brokerClient.runConsumerContracts(requests, envVars, collectionVars, providerBaseUrl);
5480
5563
  case "provider":
5481
- return snapshots.runProviderVerification(requests, envVars, collectionVars, specUrl, specPath, requestBaseUrl);
5564
+ return brokerClient.runProviderVerification(requests, envVars, collectionVars, specUrl, specPath, requestBaseUrl);
5482
5565
  case "provider-live":
5483
- return snapshots.runLiveProviderVerification(requests, envVars, collectionVars, providerBaseUrl, stateHandlerUrl);
5566
+ return brokerClient.runLiveProviderVerification(requests, envVars, collectionVars, providerBaseUrl, stateHandlerUrl);
5484
5567
  case "bidirectional":
5485
- return snapshots.runBidirectional(requests, envVars, collectionVars, specUrl, specPath, requestBaseUrl);
5568
+ return brokerClient.runBidirectional(requests, envVars, collectionVars, specUrl, specPath, requestBaseUrl);
5486
5569
  }
5487
5570
  });
5488
5571
  handle.handleIpc(ipc, handle.IPC.contract.inferSchema, (_e, jsonBody) => {
@@ -5496,7 +5579,7 @@ function registerContractHandlers(ipc) {
5496
5579
  filters: [{ name: "HTML", extensions: ["html"] }]
5497
5580
  });
5498
5581
  if (canceled || !filePath) return false;
5499
- await promises.writeFile(filePath, snapshots.reportToHtml(report, { generatedAt: (/* @__PURE__ */ new Date()).toISOString(), ...meta }), "utf8");
5582
+ await promises.writeFile(filePath, brokerClient.reportToHtml(report, { generatedAt: (/* @__PURE__ */ new Date()).toISOString(), ...meta }), "utf8");
5500
5583
  return true;
5501
5584
  });
5502
5585
  handle.handleIpc(ipc, handle.IPC.contract.exportDesignPact, async (_e, contract) => {
@@ -5506,31 +5589,31 @@ function registerContractHandlers(ipc) {
5506
5589
  const relPath = path.join("pacts", `${safe(contract.consumer)}-${safe(contract.provider)}.pact.json`);
5507
5590
  const fullPath = path.join(dir, relPath);
5508
5591
  await promises.mkdir(path.join(dir, "pacts"), { recursive: true });
5509
- await promises.writeFile(fullPath, JSON.stringify(snapshots.designContractToPact(contract), null, 2), "utf8");
5592
+ await promises.writeFile(fullPath, JSON.stringify(brokerClient.designContractToPact(contract), null, 2), "utf8");
5510
5593
  return relPath;
5511
5594
  });
5512
5595
  handle.handleIpc(ipc, handle.IPC.contract.captureSnapshot, async (_e, opts) => {
5513
5596
  const dir = getWorkspaceDir();
5514
5597
  if (!dir) throw new Error("No workspace open - cannot capture snapshot.");
5515
- const snapshot = await snapshots.captureSnapshot(dir, opts);
5516
- const relPath = snapshots.relPathOf(snapshot);
5598
+ const snapshot = await brokerClient.captureSnapshot(dir, opts);
5599
+ const relPath = brokerClient.relPathOf(snapshot);
5517
5600
  if (!relPath) throw new Error("Snapshot created but relPath was not attached.");
5518
5601
  return { relPath, snapshot };
5519
5602
  });
5520
5603
  handle.handleIpc(ipc, handle.IPC.contract.listSnapshots, async (_e, registered = []) => {
5521
5604
  const dir = getWorkspaceDir();
5522
5605
  if (!dir) return [];
5523
- return snapshots.listSnapshots(dir, registered);
5606
+ return brokerClient.listSnapshots(dir, registered);
5524
5607
  });
5525
5608
  handle.handleIpc(ipc, handle.IPC.contract.loadSnapshot, async (_e, relPath) => {
5526
5609
  const dir = getWorkspaceDir();
5527
5610
  if (!dir) throw new Error("No workspace open.");
5528
- return snapshots.loadSnapshot(dir, relPath);
5611
+ return brokerClient.loadSnapshot(dir, relPath);
5529
5612
  });
5530
5613
  handle.handleIpc(ipc, handle.IPC.contract.deleteSnapshot, async (_e, relPath) => {
5531
5614
  const dir = getWorkspaceDir();
5532
5615
  if (!dir) return;
5533
- await snapshots.deleteSnapshot(dir, relPath);
5616
+ await brokerClient.deleteSnapshot(dir, relPath);
5534
5617
  });
5535
5618
  handle.handleIpc(ipc, handle.IPC.contract.fuzz, async (_e, payload) => {
5536
5619
  let { specUrl, specPath } = payload;
@@ -5539,7 +5622,7 @@ function registerContractHandlers(ipc) {
5539
5622
  specPath = resolved.specPath;
5540
5623
  specUrl = void 0;
5541
5624
  }
5542
- return snapshots.runFuzz({ ...payload, specUrl, specPath });
5625
+ return brokerClient.runFuzz({ ...payload, specUrl, specPath });
5543
5626
  });
5544
5627
  handle.handleIpc(ipc, handle.IPC.contract.recordResult, async (_e, opts) => {
5545
5628
  const dir = getWorkspaceDir();
@@ -5547,7 +5630,7 @@ function registerContractHandlers(ipc) {
5547
5630
  const pacticipant = opts.pacticipant?.trim();
5548
5631
  const version = opts.version?.trim();
5549
5632
  if (!pacticipant || !version) throw new Error("Pacticipant and version are required.");
5550
- const file = await snapshots.recordResult(dir, pacticipant, version, opts.report, (/* @__PURE__ */ new Date()).toISOString());
5633
+ const file = await brokerClient.recordResult(dir, pacticipant, version, opts.report, (/* @__PURE__ */ new Date()).toISOString());
5551
5634
  return { file };
5552
5635
  });
5553
5636
  }
@@ -5598,6 +5681,17 @@ function registerGitHandlers(ipc) {
5598
5681
  handle.handleIpc(ipc, handle.IPC.git.markResolved, async (_e, filePath) => {
5599
5682
  await git().add([filePath]);
5600
5683
  });
5684
+ handle.handleIpc(ipc, handle.IPC.git.readConflict, async (_e, filePath) => {
5685
+ const dir = getWorkspaceDir();
5686
+ if (!dir) throw new Error("No workspace open");
5687
+ return promises.readFile(path.join(dir, filePath), "utf8");
5688
+ });
5689
+ handle.handleIpc(ipc, handle.IPC.git.writeResolved, async (_e, filePath, content) => {
5690
+ const dir = getWorkspaceDir();
5691
+ if (!dir) throw new Error("No workspace open");
5692
+ await promises.writeFile(path.join(dir, filePath), content, "utf8");
5693
+ await git().add([filePath]);
5694
+ });
5601
5695
  handle.handleIpc(ipc, handle.IPC.git.diff, async (_e, filePath) => {
5602
5696
  if (filePath) return git().diff(["--", filePath]);
5603
5697
  return git().diff();
@@ -5683,8 +5777,11 @@ function registerGitHandlers(ipc) {
5683
5777
  handle.handleIpc(ipc, handle.IPC.git.deleteBranch, async (_e, name, force = false) => {
5684
5778
  await git().deleteLocalBranch(name, force);
5685
5779
  });
5686
- handle.handleIpc(ipc, handle.IPC.git.pull, async () => {
5687
- await git().pull();
5780
+ handle.handleIpc(ipc, handle.IPC.git.fetch, async () => {
5781
+ await git().fetch(["--prune"]);
5782
+ });
5783
+ handle.handleIpc(ipc, handle.IPC.git.pull, async (_e, rebase = false) => {
5784
+ await git().raw(["pull", ...rebase ? ["--rebase"] : []]);
5688
5785
  });
5689
5786
  handle.handleIpc(ipc, handle.IPC.git.push, async (_e, setUpstream) => {
5690
5787
  if (setUpstream) {
@@ -5744,7 +5841,7 @@ function registerRecordHandlers(ipc, getWebContents) {
5744
5841
  });
5745
5842
  }
5746
5843
  const CLOUD_TOKEN_REF = "cloud:token";
5747
- const CLOUD_ENDPOINT = (process.env["API_SPECTOR_CLOUD_ENDPOINT"] || "https://api-spector.dev").replace(/\/+$/, "");
5844
+ const CLOUD_ENDPOINT = brokerClient.resolveCloudEndpoint();
5748
5845
  async function cloudFetch(path2, method, body) {
5749
5846
  const token = await requestExec.getSecret(CLOUD_TOKEN_REF);
5750
5847
  if (!token) throw new Error("No cloud API token set. Add one in Settings → Cloud.");
@@ -5871,7 +5968,7 @@ function registerCloudHandlers(ipc) {
5871
5968
  return cloudFetch("/api/mocks/" + encodeURIComponent(slugify(name)), "GET");
5872
5969
  });
5873
5970
  handle.handleIpc(ipc, handle.IPC.cloud.pushPact, async (_e, input) => {
5874
- const pact = snapshots.exportPact(input.consumer, input.provider, input.requests ?? []);
5971
+ const pact = brokerClient.exportPact(input.consumer, input.provider, input.requests ?? []);
5875
5972
  return cloudFetch("/api/contracts", "PUT", {
5876
5973
  consumer: input.consumer,
5877
5974
  consumerVersion: input.consumerVersion,
@@ -5880,7 +5977,7 @@ function registerCloudHandlers(ipc) {
5880
5977
  });
5881
5978
  });
5882
5979
  handle.handleIpc(ipc, handle.IPC.cloud.pushDesignContract, async (_e, input) => {
5883
- const pact = snapshots.designContractToPact(input.contract);
5980
+ const pact = brokerClient.designContractToPact(input.contract);
5884
5981
  return cloudFetch("/api/contracts", "PUT", {
5885
5982
  consumer: input.contract.consumer,
5886
5983
  consumerVersion: input.consumerVersion,
@@ -5945,7 +6042,7 @@ function isNewer(a, b) {
5945
6042
  return a2 > b2;
5946
6043
  }
5947
6044
  async function checkForUpdate() {
5948
- const current = "0.6.1";
6045
+ const current = "0.6.3";
5949
6046
  try {
5950
6047
  const res = await fetch(REGISTRY_URL, { signal: AbortSignal.timeout(4e3) });
5951
6048
  if (!res.ok) return null;
@@ -6124,6 +6221,7 @@ electron.app.whenReady().then(async () => {
6124
6221
  registerFileHandlers(electron.ipcMain);
6125
6222
  registerRequestHandler(electron.ipcMain);
6126
6223
  requestExec.registerSecretHandlers(electron.ipcMain);
6224
+ registerAiHandlers(electron.ipcMain);
6127
6225
  registerImportHandlers(electron.ipcMain);
6128
6226
  registerGenerateHandlers(electron.ipcMain);
6129
6227
  registerRunnerHandler(electron.ipcMain);
package/out/main/lib.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const mockServer = require("./chunks/mock-server-BxiXhP1m.js");
4
- const requestExec = require("./chunks/request-exec-5_3279w1.js");
4
+ const requestExec = require("./chunks/request-exec-DAFA6Fap.js");
5
5
  require("http");
6
6
  require("crypto");
7
7
  require("vm");
@@ -10,7 +10,7 @@ require("@xmldom/xmldom");
10
10
  require("undici");
11
11
  require("fs/promises");
12
12
  require("tls");
13
- require("./chunks/handle-BFaeFA0A.js");
13
+ require("./chunks/handle-CL-nWtYA.js");
14
14
  require("node:fs");
15
15
  require("node:os");
16
16
  require("node:path");
package/out/main/mock.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  const mockServer = require("./chunks/mock-server-BxiXhP1m.js");
4
- const cliCommon = require("./chunks/cli-common-BKYgsbGB.js");
4
+ const cliCommon = require("./chunks/cli-common-vASoDfQH.js");
5
5
  require("http");
6
6
  require("crypto");
7
7
  require("vm");
@@ -9,6 +9,7 @@ require("dayjs");
9
9
  require("@xmldom/xmldom");
10
10
  require("fs/promises");
11
11
  require("path");
12
+ require("./chunks/data-files-Br2h3Dt2.js");
12
13
  async function main() {
13
14
  const args = cliCommon.parseArgs(process.argv.slice(2), ["name"]);
14
15
  if (args.help) {
@@ -3,10 +3,11 @@
3
3
  const promises = require("fs/promises");
4
4
  const path = require("path");
5
5
  const recorder = require("./chunks/recorder-0Ij921El.js");
6
- const cliCommon = require("./chunks/cli-common-BKYgsbGB.js");
6
+ const cliCommon = require("./chunks/cli-common-vASoDfQH.js");
7
7
  require("http");
8
8
  require("crypto");
9
9
  require("undici");
10
+ require("./chunks/data-files-Br2h3Dt2.js");
10
11
  function methodBadge(method) {
11
12
  const m = method.toUpperCase();
12
13
  const c = m === "GET" ? cliCommon.C.green : m === "POST" ? cliCommon.C.cyan : m === "PUT" || m === "PATCH" ? cliCommon.C.yellow : m === "DELETE" ? cliCommon.C.red : cliCommon.C.white;