@acryldev/blends 1.7.21 → 1.7.23

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/desktop-shell",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Run the app as a desktop app: an Electron window on the app's own server. `npm run desktop`; the app's code never imports electron.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,6 +39,7 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "dependencies": {
42
+ "@acryldev/blends-core": "workspace:^",
42
43
  "@acryldev/instance": "workspace:*",
43
44
  "@acryldev/node-server": "workspace:*"
44
45
  },
@@ -6,7 +6,7 @@
6
6
  "provides": ["extensions"],
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
- "@acryldev/blends-core": "0.6.1"
9
+ "@acryldev/blends-core": "0.6.2"
10
10
  },
11
11
  "mount": "mount it after instance: root.plugin(extensions, { sources: [{ dir: join(root, 'plugins'), trust: 'install' }] })",
12
12
  "entries": {
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
9
  "yaml": "2.9.0",
10
- "@acryldev/blends-core": "0.6.1"
10
+ "@acryldev/blends-core": "0.6.2"
11
11
  },
12
12
  "mount": "in src/app.ts: const manifest = loadManifest(join(chosen.root, 'blend.yaml')); await compose(root, manifest, registry)",
13
13
  "entries": {
@@ -24,7 +24,6 @@ import {
24
24
  firstRegistryPort,
25
25
  gitCli,
26
26
  githubCli,
27
- githubReleasesOverHttps,
28
27
  httpsDownload,
29
28
  InvalidPluginSourceError,
30
29
  NPM_REGISTRY,
@@ -77,6 +76,7 @@ import {
77
76
  import { LIST_MAX_BYTES, parsePullList, pullListLocation } from './pull-list.ts'
78
77
  import { type PulledRecord, pulledRecords, withPulledRecord } from './pulled-records.ts'
79
78
  import { lookUpRegistry, REGISTRY_INDEX_URL } from './registry-source.ts'
79
+ import { LIMITED, releasesWithLoginFallback } from './releases-fallback.ts'
80
80
 
81
81
  export type {
82
82
  PublishOptions,
@@ -300,7 +300,7 @@ export class PluginShare extends Service {
300
300
  super(ctx, 'pluginShare')
301
301
  this.own = ctx
302
302
  this.dir = resolve(config.dir ?? join(ctx.appInstance.root, 'plugins'))
303
- this.releases = config.releases ?? githubReleasesOverHttps()
303
+ this.releases = config.releases ?? releasesWithLoginFallback()
304
304
  this.download = config.download ?? httpsDownload()
305
305
  this.registryIndex = config.registryIndex ?? REGISTRY_INDEX_URL
306
306
  this.npmRegistry = config.npm ?? firstRegistryPort(npmRegistryOverHttps(), npmRegistryViaCli())
@@ -870,10 +870,13 @@ export class PluginShare extends Service {
870
870
  expectIntegrity === undefined ? {} : { expectIntegrity },
871
871
  )
872
872
  } catch (cause) {
873
+ const reason = reasonOf(cause)
873
874
  return refuse(
874
875
  'fetch',
875
- reasonOf(cause),
876
- 'check the source with the person who released it; nothing was installed',
876
+ reason,
877
+ LIMITED.test(reason)
878
+ ? 'GitHub limits requests that are not signed in (60 an hour per address): sign in with `gh auth login`, or wait an hour, and run the same line again; nothing was installed'
879
+ : 'check the source with the person who released it; nothing was installed',
877
880
  )
878
881
  }
879
882
  // An npm package is `@scope/name` and lives in the folder `name`; a package from any other source must already be named for a folder.
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
9
  "@acryldev/app-persistence": "0.1.6",
10
- "@acryldev/blends-core": "0.6.1",
10
+ "@acryldev/blends-core": "0.6.2",
11
11
  "@acryldev/plugin-hub-core": "0.2.3",
12
12
  "yaml": "2.9.0"
13
13
  },
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Where a `github:` pull reads releases: GitHub's public API with no login (a public plugin needs none) and, when GitHub refuses that anonymous request
3
+ * for its limit (60 an hour for everyone behind one address: a workshop room, an office), the person's own `gh` login, which has a limit of its own.
4
+ * A person without `gh` gets the first answer, GitHub's own.
5
+ */
6
+ import {
7
+ githubReleasesOverHttps,
8
+ githubReleasesViaGh,
9
+ type ReleasePort,
10
+ } from '@acryldev/plugin-hub-core'
11
+
12
+ /** What the anonymous port says when GitHub limits or refuses it. */
13
+ export const LIMITED = /GitHub answered (?:403|429)/u
14
+
15
+ export function releasesWithLoginFallback(
16
+ anonymous: ReleasePort = githubReleasesOverHttps(),
17
+ signedIn: () => ReleasePort = githubReleasesViaGh,
18
+ ): ReleasePort {
19
+ const viaLogin = new Set<string>()
20
+ return {
21
+ async release(owner, repo, tag) {
22
+ try {
23
+ return await anonymous.release(owner, repo, tag)
24
+ } catch (cause) {
25
+ if (!LIMITED.test(cause instanceof Error ? cause.message : String(cause))) throw cause
26
+ try {
27
+ const found = await signedIn().release(owner, repo, tag)
28
+ for (const asset of found?.assets ?? []) viaLogin.add(asset.url)
29
+ return found
30
+ } catch {
31
+ throw cause
32
+ }
33
+ }
34
+ },
35
+ download: (url) => (viaLogin.has(url) ? signedIn().download(url) : anonymous.download(url)),
36
+ }
37
+ }