dsh-pdf-mineru 0.0.3 → 0.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.4
4
+
5
+ ### Added
6
+
7
+ - MinerU API keys can now be stored and managed through the DSH credentials service while configuration retains only credential references.
8
+
9
+ ### Fixed
10
+
11
+ - Official v4 health checks now recognize MinerU's current `-60012` missing-task probe sentinel while continuing to reject unrelated business errors.
12
+ - Persisted user settings are resolved before the storage root is fixed, preserving Provider and parsing configuration across rebuilds, reinstalls, upgrades, and process reloads.
13
+ - Configuration saves can no longer report success after changing only in-memory state; every successful save now completes through the settings persistence scope.
14
+
3
15
  ## 0.0.3
4
16
 
5
17
  ### Changed
package/lib/index.js CHANGED
@@ -11330,7 +11330,7 @@ function mapOfficialFileState(rawState) {
11330
11330
  function isMissingBatchProbeSentinel(code, message) {
11331
11331
  const normalizedCode = String(code).toUpperCase();
11332
11332
  if (normalizedCode === "BATCH_NOT_FOUND") return true;
11333
- return normalizedCode === "-500" && /^task not found or expire(?:d)?[.!]?$/i.test(message.trim());
11333
+ return (normalizedCode === "-500" || normalizedCode === "-60012") && /^task not found or expire(?:d)?[.!]?$/i.test(message.trim());
11334
11334
  }
11335
11335
  function officialBusinessFailure(code, message, traceId) {
11336
11336
  const providerCode = String(code);
@@ -15450,7 +15450,11 @@ function registerRpc(ctx, deps) {
15450
15450
  //#endregion
15451
15451
  //#region src/index.ts
15452
15452
  const name = "dsh-pdf-mineru";
15453
- const inject = ["tools", "jobs"];
15453
+ const inject = [
15454
+ "tools",
15455
+ "jobs",
15456
+ "settings"
15457
+ ];
15454
15458
  const ProviderSchema = z.union([z.object({
15455
15459
  id: z.string(),
15456
15460
  type: z.string(),
@@ -15541,18 +15545,31 @@ function parseDraftProvider(value, current) {
15541
15545
  }
15542
15546
  async function apply(ctx, entryConfig = {}) {
15543
15547
  let persistedConfig = migrateConfig(entryConfig);
15544
- let settingsScope;
15548
+ let fixedStorageRoot;
15545
15549
  let toolDisposer;
15546
15550
  let operations;
15547
15551
  const startup = new AbortController();
15548
15552
  ctx.effect(() => () => startup.abort(), "dsh-pdf-mineru startup cancellation");
15549
- const fixedStorageRoot = persistedConfig.storage.storageRoot;
15550
15553
  const validateRuntimeConfig = (value) => {
15551
15554
  const next = migrateConfig(value);
15552
- if (next.storage.storageRoot !== fixedStorageRoot) throw new TypeError("storage.storageRoot cannot change while the MinerU plugin is running");
15555
+ if (fixedStorageRoot !== void 0 && next.storage.storageRoot !== fixedStorageRoot) throw new TypeError("storage.storageRoot cannot change while the MinerU plugin is running");
15553
15556
  return next;
15554
15557
  };
15555
15558
  const runtimeConfig = () => persistedConfig;
15559
+ const settings = ctx.get("settings");
15560
+ if (settings === void 0) throw new Error("settings service is unavailable");
15561
+ const settingsScope = settings.register("dsh-pdf-mineru", Config, {
15562
+ base: asObject(persistedConfig),
15563
+ applies: "live",
15564
+ validate: (value) => {
15565
+ validateRuntimeConfig(value);
15566
+ }
15567
+ });
15568
+ persistedConfig = validateRuntimeConfig(settingsScope.get());
15569
+ fixedStorageRoot = persistedConfig.storage.storageRoot;
15570
+ ctx.effect(() => settingsScope.watch((next) => {
15571
+ persistedConfig = validateRuntimeConfig(next);
15572
+ }), "dsh-pdf-mineru settings watch");
15556
15573
  const paths = new StoragePaths(fixedStorageRoot);
15557
15574
  const lock = new ProcessLock(paths);
15558
15575
  try {
@@ -15584,28 +15601,12 @@ async function apply(ctx, entryConfig = {}) {
15584
15601
  }
15585
15602
  });
15586
15603
  toolDisposer = registerTools(ctx, () => service, accessGate);
15587
- ctx.inject(["settings"], (settingsCtx) => {
15588
- const settings = settingsCtx.get("settings") ?? ctx.get("settings");
15589
- if (settings !== void 0) {
15590
- settingsScope = settings.register("dsh-pdf-mineru", Config, {
15591
- base: asObject(persistedConfig),
15592
- applies: "live",
15593
- validate: (value) => {
15594
- validateRuntimeConfig(value);
15595
- }
15596
- });
15597
- persistedConfig = validateRuntimeConfig(settingsScope.get());
15598
- return settingsScope.watch((next) => {
15599
- persistedConfig = validateRuntimeConfig(next);
15600
- });
15601
- }
15602
- });
15603
15604
  ctx.inject(["connection"], (connectionCtx) => {
15604
15605
  return registerRpc(connectionCtx, {
15605
15606
  getConfig: () => persistedConfig,
15606
15607
  setConfig: async (value) => {
15607
15608
  const next = validateRuntimeConfig(value);
15608
- if (settingsScope !== void 0) await settingsScope.replace(asObject(next));
15609
+ await settingsScope.replace(asObject(next));
15609
15610
  persistedConfig = next;
15610
15611
  return next;
15611
15612
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-pdf-mineru",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },