pinokiod 7.5.20 → 7.5.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "7.5.20",
3
+ "version": "7.5.21",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1192,12 +1192,24 @@ const getPluginInstallRedirect = async (rawHref) => {
1192
1192
  pluginInstallPreflightCache.set(pluginPath, redirectHref)
1193
1193
  return redirectHref
1194
1194
  }
1195
+ const navigateOutsideLauncher = (href) => {
1196
+ if (!href) {
1197
+ return
1198
+ }
1199
+ try {
1200
+ if (window.parent && window.parent !== window && window.parent !== window.top) {
1201
+ window.parent.location.href = href
1202
+ return
1203
+ }
1204
+ } catch (_) {}
1205
+ window.location.href = href
1206
+ }
1195
1207
  const redirectToPluginInstallIfNeeded = async (rawHref) => {
1196
1208
  const redirectHref = await getPluginInstallRedirect(rawHref)
1197
1209
  if (!redirectHref) {
1198
1210
  return false
1199
1211
  }
1200
- window.top.location.href = redirectHref
1212
+ navigateOutsideLauncher(redirectHref)
1201
1213
  return true
1202
1214
  }
1203
1215
  const pluginSettingsHrefFromLaunchHref = (rawHref) => {
@@ -1367,7 +1379,7 @@ document.addEventListener("click", async (e) => {
1367
1379
  e.stopPropagation()
1368
1380
  const settingsHref = pluginSettingsHrefFromLaunchHref(settingsTarget.getAttribute('data-href') || '')
1369
1381
  if (settingsHref) {
1370
- window.top.location.href = settingsHref
1382
+ navigateOutsideLauncher(settingsHref)
1371
1383
  }
1372
1384
  return
1373
1385
  }
@@ -1,5 +1,6 @@
1
1
  const fs = require("fs")
2
2
  const path = require("path")
3
+ const installer = require("./install")
3
4
 
4
5
  const MANAGED_DIR_PARTS = ["bin", "antigravity-cli"]
5
6
 
@@ -46,23 +47,17 @@ function workspaceFor(context, kernel) {
46
47
  return args.cwd || kernel.path("home")
47
48
  }
48
49
 
49
- function installSteps(kernel) {
50
+ async function installSteps(kernel) {
51
+ await installer.install({
52
+ installDir: installDir(kernel),
53
+ managedDir: managedDir(kernel),
54
+ })
50
55
  return [{
51
- id: "install",
52
- method: "shell.run",
56
+ id: "installed",
57
+ method: "notify",
53
58
  params: {
54
- message: {
55
- _: [
56
- "node",
57
- installerPath(),
58
- "--install-dir",
59
- installDir(kernel),
60
- "--managed-dir",
61
- managedDir(kernel),
62
- ]
63
- },
64
- path: kernel.path(),
65
- buffer: 1024,
59
+ html: "Antigravity CLI installed in Pinokio.",
60
+ type: "success",
66
61
  }
67
62
  }]
68
63
  }
@@ -7,6 +7,7 @@ const test = require("node:test")
7
7
  const antigravityCli = require("../system/plugin/antigravity-cli/pinokio")
8
8
  const antigravityCliAuto = require("../system/plugin/antigravity-cli-auto/pinokio")
9
9
  const antigravityCommon = require("../system/plugin/antigravity-cli/common")
10
+ const antigravityInstaller = require("../system/plugin/antigravity-cli/install")
10
11
 
11
12
  function createKernel(root, platform = "darwin") {
12
13
  return {
@@ -25,29 +26,34 @@ test("Antigravity CLI plugins expose managed lifecycle actions", () => {
25
26
  }
26
27
  })
27
28
 
28
- test("Antigravity CLI install and update install agy into Pinokio bin", () => {
29
+ test("Antigravity CLI install and update call the bundled installer internally", async () => {
29
30
  const root = path.join(os.tmpdir(), "pinokio-antigravity-test")
30
31
  const kernel = createKernel(root)
32
+ const calls = []
33
+ const originalInstall = antigravityInstaller.install
34
+ antigravityInstaller.install = async (options) => {
35
+ calls.push(options)
36
+ }
31
37
 
32
- const install = antigravityCli.install(kernel, {})[0]
33
- const update = antigravityCli.update(kernel, {})[0]
34
-
35
- for (const step of [install, update]) {
36
- assert.equal(step.method, "shell.run")
37
- assert.equal(step.params.path, root)
38
- assert.equal(Object.prototype.hasOwnProperty.call(step.params, "conda"), false)
39
- assert.equal(Object.prototype.hasOwnProperty.call(step.params, "env"), false)
40
- assert.equal(step.params.message._[0], "node")
41
- assert.equal(step.params.message._[1], antigravityCommon.installerPath())
42
- assert.deepEqual(step.params.message._.slice(2), [
43
- "--install-dir",
44
- path.join(root, "bin"),
45
- "--managed-dir",
46
- path.join(root, "bin", "antigravity-cli"),
47
- ])
48
- assert.doesNotMatch(step.params.message._.join(" "), / -e /)
49
- assert.doesNotMatch(step.params.message._.join(" "), /api\.github\.com\/repos\/google-antigravity\/antigravity-cli\/releases\/latest/)
50
- assert.equal(Object.prototype.hasOwnProperty.call(step.params, "input"), false)
38
+ try {
39
+ const install = await antigravityCli.install(kernel, {})
40
+ const update = await antigravityCli.update(kernel, {})
41
+
42
+ assert.deepEqual(calls, [{
43
+ installDir: path.join(root, "bin"),
44
+ managedDir: path.join(root, "bin", "antigravity-cli"),
45
+ }, {
46
+ installDir: path.join(root, "bin"),
47
+ managedDir: path.join(root, "bin", "antigravity-cli"),
48
+ }])
49
+
50
+ for (const steps of [install, update]) {
51
+ assert.equal(steps.length, 1)
52
+ assert.equal(steps[0].method, "notify")
53
+ assert.equal(steps[0].params.type, "success")
54
+ }
55
+ } finally {
56
+ antigravityInstaller.install = originalInstall
51
57
  }
52
58
  })
53
59