dsh-as-aistudio 0.5.0 → 0.5.1

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
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## 中文
6
6
 
7
+ **0.5.1** —— 组件行标出「动作 / 维护」;跟进内嵌组件。
8
+
9
+ - 面板里每个组件行在名字后多一个徽章:`动作`(edit/rerun/delete/markdown)或 `维护`(log-trim)。
10
+ - 内嵌 dsh-log-trim 升到 0.5.1(双份安装告警)。
11
+
7
12
  **0.5.0** —— 第五个组件:会话日志裁剪(dsh-log-trim 0.5.0)。
8
13
 
9
14
  - **维护型组件**:manifest 新增 `{ id: 'dsh-log-trim', suffix: 'trim', kind: 'maintenance' }`,它没有消息行动作、没有输入区浮层,因此不占 slot / overlay;补丁行、`exports["./trim"]`、vendor 副本与状态行照旧,和其它四个组件一样由本包内置。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-as-aistudio",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Google-AI-Studio-style turn controls for DeepSeek Harness, in one install: edit a prompt and re-run it, re-run a reply in place, delete a turn from the model context, and render sent prompts as Markdown. Self-contained: the plugin list shows this one row, and the four components are vendored inside it - installing the studio installs nothing else.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/client.js CHANGED
@@ -9575,7 +9575,7 @@ window.__ModuleLoader__.load({
9575
9575
  const react = require('react')
9576
9576
  const { jsx, jsxs } = require('react/jsx-runtime')
9577
9577
 
9578
- const PLUGIN_VERSION = '0.5.0'
9578
+ const PLUGIN_VERSION = '0.5.1'
9579
9579
  const ROUTE_PREFIX = '/api/dsh-log-trim'
9580
9580
 
9581
9581
  /** The knobs this card edits, in the order they are drawn. */
@@ -9988,6 +9988,12 @@ window.__ModuleLoader__.load({
9988
9988
  `版本 ${PLUGIN_VERSION};设置在 ~/.dsh/dsh-log-trim/config.json,配置文件里的那一行只是初始值。`,
9989
9989
  ],
9990
9990
  }),
9991
+ status !== null && status !== undefined && status.duplicateStudio === true
9992
+ ? jsx('p', {
9993
+ style: { ...style.status, color: 'var(--dsw-alias-state-warning-primary, #d98b00)' },
9994
+ children: '检测到同时安装了 dsh-as-aistudio(它内置了本插件):两份会各跑一次启动扫描,建议在插件列表里只保留一份。',
9995
+ })
9996
+ : null,
9991
9997
  jsx('div', {
9992
9998
  style: style.grid,
9993
9999
  children: FIELDS.filter((field) => field.kind === 'select').map((field) =>
@@ -10076,7 +10082,7 @@ window.__ModuleLoader__.load({
10076
10082
  const NS = 'dsh-as-aistudio'
10077
10083
 
10078
10084
  /** Keep in sync with package.json and src/components.js. */
10079
- const PLUGIN_VERSION = '0.5.0'
10085
+ const PLUGIN_VERSION = '0.5.1'
10080
10086
 
10081
10087
  /** Presence marker the live verifier reads. */
10082
10088
  const DEBUG_KEY = '__DSH_AS_AISTUDIO__'
@@ -10117,6 +10123,8 @@ window.__ModuleLoader__.load({
10117
10123
  statusInstalled: '已安装,宿主未挂载',
10118
10124
  statusMissing: '未安装',
10119
10125
  statusUnknown: '宿主未报告',
10126
+ kindAction: '动作',
10127
+ kindMaintenance: '维护',
10120
10128
  hostOnly: '(独立安装时走自己的插件行)',
10121
10129
  row: '行 {row}',
10122
10130
  version: '版本 {version}',
@@ -10143,6 +10151,8 @@ window.__ModuleLoader__.load({
10143
10151
  statusMounted: 'Enabled',
10144
10152
  statusInstalled: 'Installed, host not mounted',
10145
10153
  statusMissing: 'Not installed',
10154
+ kindAction: 'action',
10155
+ kindMaintenance: 'maintenance',
10146
10156
  statusUnknown: 'Host did not report',
10147
10157
  hostOnly: '(a standalone install also shows its own row)',
10148
10158
  row: 'row {row}',
@@ -10554,6 +10564,7 @@ window.__ModuleLoader__.load({
10554
10564
  h('div', { className: 'dsas-rowHead', key: 'head' }, [
10555
10565
  h('span', { className: 'dsas-dot', 'data-state': state, key: 'dot' }),
10556
10566
  h('span', { className: 'dsas-name', key: 'name' }, text.title),
10567
+ h('span', { className: 'dsas-badge', key: 'kind' }, component.kind === 'maintenance' ? t('kindMaintenance') : t('kindAction')),
10557
10568
  h('span', { className: 'dsas-badge', key: 'badge' }, stateLabelText),
10558
10569
  h('span', { className: 'dsas-badge dsas-code', key: 'version' }, version),
10559
10570
  ]),
package/src/components.js CHANGED
@@ -26,7 +26,7 @@
26
26
  export const STUDIO_ID = 'dsh-as-aistudio'
27
27
 
28
28
  /** Keep in sync with package.json and src/client.js. */
29
- export const STUDIO_VERSION = '0.5.0'
29
+ export const STUDIO_VERSION = '0.5.1'
30
30
 
31
31
  /**
32
32
  * The AI Studio action strip this studio composes, in the order the user meets
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.flatten.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/flatten.js (v0.5.0, sha256 3aa1fdcbb120ab06)
3
+ // Source: ../dsh-log-trim/lib/flatten.js (v0.5.1, sha256 3aa1fdcbb120ab06)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.host-libs.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/host-libs.mjs (v0.5.0, sha256 5ebed01988b5bfcf)
3
+ // Source: ../dsh-log-trim/lib/host-libs.mjs (v0.5.1, sha256 5ebed01988b5bfcf)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/index.js (v0.5.0, sha256 f8f01a5f2ae2ca7b)
3
+ // Source: ../dsh-log-trim/lib/index.js (v0.5.1, sha256 bd4d3c438d7c00ba)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -42,7 +42,7 @@ import { applyFlatten, applyLossless, applyStreamOnly, planLossless, applyRebuil
42
42
 
43
43
  export const name = 'dsh-log-trim'
44
44
  export const PLUGIN_ID = name
45
- export const PLUGIN_VERSION = '0.5.0'
45
+ export const PLUGIN_VERSION = '0.5.1'
46
46
  export const ROUTE_PREFIX = '/api/dsh-log-trim'
47
47
 
48
48
  /**
@@ -1032,11 +1032,47 @@ function isLoopback(req) {
1032
1032
  * @param {object} ctx - 插件上下文。
1033
1033
  * @param {object} [config] - 用户配置。
1034
1034
  */
1035
+
1036
+ /**
1037
+ * 本机是否同时装了独立的本插件与内嵌了它的聚合包(`dsh-as-aistudio`)。
1038
+ *
1039
+ * 两份会各跑一次启动扫描:都能看见对方的 `.precompact-` 备份,也能同时改写同一份日志。
1040
+ * 这不是错误,是需要提醒的配置。
1041
+ *
1042
+ * @param {string} [home] - 家目录(测试用)。
1043
+ * @returns {boolean} 同时装了就是 true。
1044
+ */
1045
+ export function duplicateStudioInstall(home = os.homedir()) {
1046
+ const profiles = path.join(home, '.dsh', 'profiles')
1047
+ let names = []
1048
+ try {
1049
+ names = fs.readdirSync(profiles)
1050
+ } catch {
1051
+ return false
1052
+ }
1053
+ for (const name of names) {
1054
+ let manifest
1055
+ try {
1056
+ manifest = JSON.parse(fs.readFileSync(path.join(profiles, name, 'package.json'), 'utf8'))
1057
+ } catch {
1058
+ continue
1059
+ }
1060
+ const bundles = Array.isArray(manifest?.dsh?.profile?.bundles) ? manifest.dsh.profile.bundles : []
1061
+ if (bundles.includes('dsh-log-trim') && bundles.includes('dsh-as-aistudio')) return true
1062
+ }
1063
+ return false
1064
+ }
1065
+
1035
1066
  export function apply(ctx, config = {}) {
1036
1067
  // The card can change these while the host runs, so the resolved values live in
1037
1068
  // a box the routes can replace instead of a frozen const.
1038
1069
  let resolved = resolveConfig({ ...config, ...readSavedConfig() })
1039
1070
  const state = { last: null, running: false }
1071
+ // 双份安装:聚合包里已经内嵌了一份裁剪器,再单装一份会各跑一遍启动扫描。
1072
+ const duplicate = duplicateStudioInstall()
1073
+ if (duplicate && typeof ctx.logger?.warn === 'function') {
1074
+ ctx.logger.warn('[dsh-log-trim] 检测到同时安装了 dsh-as-aistudio(内置本插件):两份会各跑一次启动扫描,建议只留一份')
1075
+ }
1040
1076
 
1041
1077
  // A session the GUI has open cannot be rewritten (the host holds its lock).
1042
1078
  // The moment one closes it becomes writable, so the deferred work happens
@@ -1150,7 +1186,7 @@ export function apply(ctx, config = {}) {
1150
1186
  return
1151
1187
  }
1152
1188
  res.setHeader('content-type', 'application/json; charset=utf-8')
1153
- res.end(JSON.stringify({ ok: true, version: PLUGIN_VERSION, config: resolved, running: state.running, last: state.last }, null, 2))
1189
+ res.end(JSON.stringify({ ok: true, version: PLUGIN_VERSION, config: resolved, running: state.running, last: state.last, duplicateStudio: duplicate }, null, 2))
1154
1190
  },
1155
1191
  }),
1156
1192
  )
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.lossless.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/lossless.js (v0.5.0, sha256 adf9bf5d79aa41b0)
3
+ // Source: ../dsh-log-trim/lib/lossless.js (v0.5.1, sha256 adf9bf5d79aa41b0)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.roots.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/roots.js (v0.5.0, sha256 028d9c12a395aaab)
3
+ // Source: ../dsh-log-trim/lib/roots.js (v0.5.1, sha256 028d9c12a395aaab)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.vendor.compact-session.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/vendor.compact-session.mjs (v0.5.0, sha256 2c1c819e732c9649)
3
+ // Source: ../dsh-log-trim/lib/vendor.compact-session.mjs (v0.5.1, sha256 2c1c819e732c9649)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.verify-session-log.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/verify-session-log.mjs (v0.5.0, sha256 6a0527e8483fb252)
3
+ // Source: ../dsh-log-trim/lib/verify-session-log.mjs (v0.5.1, sha256 6a0527e8483fb252)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -3,5 +3,5 @@
3
3
  "dsh-rerun-turn": "0.2.7",
4
4
  "dsh-delete-turn": "0.2.0",
5
5
  "dsh-markdown-bubble": "0.1.5",
6
- "dsh-log-trim": "0.5.0"
6
+ "dsh-log-trim": "0.5.1"
7
7
  }