@mengruo/dsh-vision-toolkit 0.1.2 → 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.
Files changed (85) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +4 -0
  3. package/README.zh.md +4 -0
  4. package/docs/requirements-traceability/README.i18n.yaml +2 -2
  5. package/docs/requirements-traceability/README.md +1 -1
  6. package/docs/requirements-traceability/README.zh.md +1 -1
  7. package/lib/artifact-access.js +20 -2
  8. package/lib/artifact-access.js.map +1 -1
  9. package/lib/client.js +59 -19
  10. package/lib/client.js.map +1 -1
  11. package/lib/config.js +64 -12
  12. package/lib/config.js.map +1 -1
  13. package/lib/errors.js +25 -1
  14. package/lib/errors.js.map +1 -1
  15. package/lib/evidence-cache.js +5 -2
  16. package/lib/evidence-cache.js.map +1 -1
  17. package/lib/exposure.js +14 -1
  18. package/lib/exposure.js.map +1 -1
  19. package/lib/image-input-variants.js +22 -12
  20. package/lib/image-input-variants.js.map +1 -1
  21. package/lib/index.js +53 -6
  22. package/lib/index.js.map +1 -1
  23. package/lib/paste-images.js +67 -19
  24. package/lib/paste-images.js.map +1 -1
  25. package/lib/paths.js +214 -28
  26. package/lib/paths.js.map +1 -1
  27. package/lib/runtime-manager.js +76 -10
  28. package/lib/runtime-manager.js.map +1 -1
  29. package/lib/runtime.js +389 -104
  30. package/lib/runtime.js.map +1 -1
  31. package/lib/storage-history.js +154 -0
  32. package/lib/storage-history.js.map +1 -0
  33. package/lib/tools.js +68 -35
  34. package/lib/tools.js.map +1 -1
  35. package/lib/types/artifact-access.d.ts.map +1 -1
  36. package/lib/types/client/index.d.ts +23 -5
  37. package/lib/types/client/index.d.ts.map +1 -1
  38. package/lib/types/client/paste-images.d.ts +2 -0
  39. package/lib/types/client/paste-images.d.ts.map +1 -1
  40. package/lib/types/config.d.ts +38 -7
  41. package/lib/types/config.d.ts.map +1 -1
  42. package/lib/types/errors.d.ts +18 -2
  43. package/lib/types/errors.d.ts.map +1 -1
  44. package/lib/types/evidence-cache.d.ts +1 -1
  45. package/lib/types/evidence-cache.d.ts.map +1 -1
  46. package/lib/types/exposure.d.ts.map +1 -1
  47. package/lib/types/image-input-variants.d.ts +5 -3
  48. package/lib/types/image-input-variants.d.ts.map +1 -1
  49. package/lib/types/index.d.ts.map +1 -1
  50. package/lib/types/paste-images.d.ts +12 -4
  51. package/lib/types/paste-images.d.ts.map +1 -1
  52. package/lib/types/paths.d.ts +31 -5
  53. package/lib/types/paths.d.ts.map +1 -1
  54. package/lib/types/runtime-manager.d.ts +28 -4
  55. package/lib/types/runtime-manager.d.ts.map +1 -1
  56. package/lib/types/runtime.d.ts +75 -12
  57. package/lib/types/runtime.d.ts.map +1 -1
  58. package/lib/types/storage-history.d.ts +63 -0
  59. package/lib/types/storage-history.d.ts.map +1 -0
  60. package/lib/types/tools.d.ts +1 -0
  61. package/lib/types/tools.d.ts.map +1 -1
  62. package/lib/types/upstream.d.ts.map +1 -1
  63. package/lib/types/web.d.ts.map +1 -1
  64. package/lib/upstream.js +31 -8
  65. package/lib/upstream.js.map +1 -1
  66. package/lib/web.js +9 -3
  67. package/lib/web.js.map +1 -1
  68. package/package.json +1 -1
  69. package/src/artifact-access.ts +22 -2
  70. package/src/client/index.tsx +72 -20
  71. package/src/client/paste-images.tsx +14 -4
  72. package/src/config.ts +107 -20
  73. package/src/errors.ts +25 -1
  74. package/src/evidence-cache.ts +5 -2
  75. package/src/exposure.ts +16 -2
  76. package/src/image-input-variants.ts +21 -6
  77. package/src/index.ts +65 -6
  78. package/src/paste-images.ts +81 -19
  79. package/src/paths.ts +249 -28
  80. package/src/runtime-manager.ts +93 -10
  81. package/src/runtime.ts +431 -115
  82. package/src/storage-history.ts +172 -0
  83. package/src/tools.ts +78 -46
  84. package/src/upstream.ts +33 -8
  85. package/src/web.ts +9 -2
package/src/web.ts CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  } from './paste-images.ts'
23
23
  import {
24
24
  resolveConfig,
25
+ retainedStorageHistory,
25
26
  isBuiltInFreeVisionProvider,
26
27
  VISION_TOOLKIT_SETTINGS_NAMESPACE,
27
28
  type ResolvedProvider,
@@ -346,16 +347,22 @@ export class VisionToolkitWebBackend {
346
347
 
347
348
  private async save(request: SaveRequest): Promise<VisionToolkitSettingsSnapshot> {
348
349
  if (!this.ctx.settings.writable) throw new Error('settings provider is read-only')
350
+ const current = resolveConfig(descriptorOf(this.ctx).value as VisionToolkitConfig)
351
+ const storageHistory = retainedStorageHistory(request.value, current)
352
+ const value: VisionToolkitConfig = {
353
+ ...request.value,
354
+ ...(storageHistory.length === 0 ? {} : { storageHistory }),
355
+ }
349
356
  let candidate: PreparedRuntimeGeneration
350
357
  try {
351
- candidate = await this.manager.prepareCandidate(request.value)
358
+ candidate = await this.manager.prepareCandidate(value)
352
359
  } catch (error) {
353
360
  this.manager.recordFailure(error)
354
361
  throw error
355
362
  }
356
363
  await this.ctx.settings.replace(
357
364
  VISION_TOOLKIT_SETTINGS_NAMESPACE,
358
- request.value as object,
365
+ value as object,
359
366
  request.expectedRevision,
360
367
  )
361
368
  this.manager.activateCandidate(candidate)