dsh-seework 0.1.3 → 0.1.4

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/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SettingsConflictError } from "@deepseek-ai/dsh-settings";
2
2
  import { defineTool } from "@deepseek-ai/dsh-tools";
3
- import { readFile } from "node:fs/promises";
3
+ import { readFile, writeFile } from "node:fs/promises";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { randomUUID } from "node:crypto";
6
6
  import { promises, readFileSync } from "node:fs";
@@ -3083,6 +3083,38 @@ function registryOf(registries) {
3083
3083
  return registries.resolved ?? registries.registry ?? DEFAULT_REGISTRY;
3084
3084
  }
3085
3085
  /**
3086
+ * Add one exact version to the profile's release-age exemptions.
3087
+ *
3088
+ * pnpm 11 refuses to install a version published less than `minimumReleaseAge`
3089
+ * ago — 1440 minutes by default — and records the versions it *has* accepted in
3090
+ * `minimumReleaseAgeExclude`. That is why an installed version can be
3091
+ * reinstalled while the next one cannot be installed at all.
3092
+ *
3093
+ * Writing the version the user just asked for into that same list is the
3094
+ * narrowest exemption available: one package, one version, chosen by the person
3095
+ * who pressed the button. Nothing else in the profile is relaxed, and the next
3096
+ * release has to earn its own exemption.
3097
+ *
3098
+ * @param profileDir - the profile directory holding `pnpm-workspace.yaml`.
3099
+ * @param packageName - the package to exempt.
3100
+ * @param version - the exact version to exempt.
3101
+ * @returns whether the file was changed.
3102
+ */
3103
+ async function exemptVersion(profileDir, packageName, version) {
3104
+ const file = `${profileDir}/pnpm-workspace.yaml`;
3105
+ let text;
3106
+ try {
3107
+ text = await readFile(file, "utf8");
3108
+ } catch {
3109
+ return false;
3110
+ }
3111
+ const bullet = ` - ${`${packageName}@${version}`}`;
3112
+ if (text.split("\n").some((line) => line.trimEnd() === bullet)) return false;
3113
+ const header = "minimumReleaseAgeExclude:";
3114
+ await writeFile(file, text.includes(header) ? text.replace(header, `${header}\n${bullet}`) : `${text.replace(/\s*$/, "")}\n\n${header}\n${bullet}\n`, "utf8");
3115
+ return true;
3116
+ }
3117
+ /**
3086
3118
  * Read the newest published version out of a registry's `latest` document.
3087
3119
  *
3088
3120
  * `/<name>/latest` is the one endpoint that answers "what is the newest
@@ -3502,9 +3534,22 @@ function makeRoutes(deps) {
3502
3534
  const host = deps.updateHost?.();
3503
3535
  if (host === void 0) return fail(res, 503, "unavailable", "宿主没有提供插件管理服务。");
3504
3536
  if (readInstallKind(profileDirectory()) === "local") return fail(res, 409, "local_install", "这是本地目录安装,更新请用 pnpm build && pnpm sync。");
3505
- ok(res, { started: true });
3537
+ let target;
3538
+ try {
3539
+ target = await latestVersionFrom({
3540
+ registry: registryOf(await host.registries()),
3541
+ packageName: PACKAGE_NAME
3542
+ });
3543
+ await exemptVersion(profileDirectory(), PACKAGE_NAME, target);
3544
+ } catch (error) {
3545
+ console.warn("[dsh-seework] could not resolve or exempt the target version:", error);
3546
+ }
3547
+ ok(res, {
3548
+ started: true,
3549
+ ...target === void 0 ? {} : { to: target }
3550
+ });
3506
3551
  setTimeout(() => {
3507
- host.installBundle(UPDATE_SPEC).catch((error) => {
3552
+ host.installBundle(target === void 0 ? UPDATE_SPEC : `${PACKAGE_NAME}@${target}`).catch((error) => {
3508
3553
  console.warn("[dsh-seework] self-update failed:", error);
3509
3554
  });
3510
3555
  }, 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-seework",
3
3
  "description": "SeeWork — DeepSeek Harness plugin for SeeAI Hub: generate images inside the agent conversation with your own SeeAI Hub API key (OpenAI-compatible /v1/images/generations), browse everything you generated in the sidebar material library, and arrange it on a canvas.",
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",