dsh-univer-office 0.2.11 → 0.2.12

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/README.md CHANGED
@@ -204,7 +204,7 @@ The defaults are designed for local use: the service starts at port `9080`. If t
204
204
 
205
205
  ## Telemetry
206
206
 
207
- Sends anonymous usage stats (never file contents or paths). Disable with `DO_NOT_TRACK=1` or `telemetry: false`.
207
+ Sends anonymous usage stats after the plugin activates (never file contents or paths). The published package declares no `postinstall` script. Disable telemetry with `DO_NOT_TRACK=1` or `telemetry: false`.
208
208
 
209
209
  ## Uninstall
210
210
 
package/README.zh-CN.md CHANGED
@@ -204,7 +204,7 @@ DSH 会自动选择这些工具,日常使用不需要手动调用。
204
204
 
205
205
  ## 遥测
206
206
 
207
- 默认发送匿名使用统计(不含文件内容与路径)。设 `DO_NOT_TRACK=1` 或配置 `telemetry: false` 关闭。
207
+ 插件激活后默认发送匿名使用统计(不含文件内容与路径),发布包不声明 `postinstall` 脚本。设 `DO_NOT_TRACK=1` 或配置 `telemetry: false` 关闭遥测。
208
208
 
209
209
  ## 卸载
210
210
 
@@ -19,7 +19,7 @@
19
19
  - `workers/unit-content` 是一次性 Unit Content Worker 的子进程入口;
20
20
  - `client` 负责 DSH 浏览器端的预览、实时 worktree 窗口和用户审阅界面;
21
21
  - `shared/wire` 只存放 Host 与 Client 共享的纯 JSON 数据类型;
22
- - `telemetry` 提供 best-effort 的匿名产品遥测,只在 Host 与包 lifecycle 入口发送,任何失败都不影响安装、启动与卸载。
22
+ - `telemetry` 提供 best-effort 的匿名产品遥测,只在 Host 与包卸载入口发送,发布包不声明 `postinstall`,任何失败都不影响启动与卸载。
23
23
 
24
24
  用户只安装本插件即可使用全部功能。全局 `univer` CLI 不属于运行依赖;Unit 的导入、检查、执行和导出由插件内置的一次性 Unit Content Worker 完成。
25
25
 
@@ -135,7 +135,7 @@ src/
135
135
  plugin.ts # 可选 DSH Settings 命名空间
136
136
  telemetry/
137
137
  product-telemetry.ts # 匿名产品遥测:state、去重与白名单发送
138
- entry.ts # 打包为 lib/telemetry-entry.js 的 lifecycle 发送入口
138
+ entry.ts # 打包为 lib/telemetry-entry.js 的卸载 hook 发送入口
139
139
  adapters/
140
140
  gateway/
141
141
  client.ts
@@ -368,7 +368,7 @@ Client 必须满足:
368
368
 
369
369
  ## 12. 构建与发布
370
370
 
371
- `src` 包含插件发布的所有 application 源码;Viewer application、machine render page、render preset 和 IMPORTRANGE plugin 源码从 `univer-cli` 复制到本仓库后直接维护。`pnpm run build` 生成 Host/Client bundle、Unit Content Worker、Gateway、machine render page 和 Viewer;`lib` 与 `artifacts` 都被 gitignore,并在打包前重新生成。Host 构建为 Node ESM,Client 构建为 DSH ModuleLoader 可加载的浏览器 bundle,Gateway 构建为 Node CJS 子进程,Worker 构建为 Node ESM 子进程,machine render page 与 Viewer 构建为 Vite 静态资产。lib 构建同时生成 `lib/telemetry-entry.js`(lifecycle hook 发送入口)与 `lib/build-info.json`(包版本、构建 commit 与遥测 endpoint)。
371
+ `src` 包含插件发布的所有 application 源码;Viewer application、machine render page、render preset 和 IMPORTRANGE plugin 源码从 `univer-cli` 复制到本仓库后直接维护。`pnpm run build` 生成 Host/Client bundle、Unit Content Worker、Gateway、machine render page 和 Viewer;`lib` 与 `artifacts` 都被 gitignore,并在打包前重新生成。Host 构建为 Node ESM,Client 构建为 DSH ModuleLoader 可加载的浏览器 bundle,Gateway 构建为 Node CJS 子进程,Worker 构建为 Node ESM 子进程,machine render page 与 Viewer 构建为 Vite 静态资产。lib 构建同时生成 `lib/telemetry-entry.js`(卸载 hook 发送入口)与 `lib/build-info.json`(包版本、构建 commit 与遥测 endpoint)。
372
372
 
373
373
  发布包包含运行所需的 Gateway、Viewer、Unit Content Worker、Office 转换器、平台依赖、Univer license 与 bundled Skills。Gateway、Worker、Viewer 和 Host 直接使用 manifest 中精确版本的 Univer SDK/API Reference packages;JavaScript SDK 被 bundle,平台原生 package 由包管理器为目标机器安装。发布时只打包从当前源码生成的运行产物。
374
374
 
@@ -402,13 +402,13 @@ Client 必须满足:
402
402
 
403
403
  ## 15. 产品遥测
404
404
 
405
- 产品遥测是 best-effort 的匿名安装与活跃统计,只用于看趋势,不用于精确计量。遥测绝不影响安装、插件启动或卸载:所有失败静默吞掉,发送有 5 秒超时,无重试、无队列、无锁。
405
+ 产品遥测是 best-effort 的匿名活跃与卸载统计,只用于看趋势,不用于精确计量。发布包不声明 `postinstall`,以兼容 DSH profile 的依赖构建脚本审批策略。遥测绝不影响插件启动或卸载:所有失败静默吞掉,发送有 5 秒超时,无重试、无队列、无锁。
406
406
 
407
- - 事件共四个,统一经 `lib/build-info.json` 中固定的 Univer 代理 endpoint 上报(版本与 commit 也取自该文件),客户端不持有任何分析平台凭证。release workflow 通过 `RELEASE_TELEMETRY_ENDPOINT` 把线上代理地址注入发布构建;本地与开发构建保持为空,即遥测整体静默(`telemetry: false` 的 disabled 标记写入除外,见下)。运行时显式设置 `UNIVER_TELEMETRY_ENDPOINT`(含空值)优先于构建固定值,用作测试重定向与应急开关。服务端 allowlist 必须先于带 endpoint 的构建部署,否则事件会被整包拒绝且因 at-most-once 永久丢失;
408
- - `dsh_plugin_postinstall`(包 postinstall,每安装身份一次)、`dsh_plugin_activated`(Host 激活,每安装身份一次)、`dsh_plugin_daily_active`(Host 激活时检查,每安装身份每本地日一次)、`dsh_plugin_uninstall_hook`(包 uninstall,不去重,因为 state 跨重装存活,一次性标记会掩盖后续卸载);
407
+ - 事件共三个,统一经 `lib/build-info.json` 中固定的 Univer 代理 endpoint 上报(版本与 commit 也取自该文件),客户端不持有任何分析平台凭证。release workflow 通过 `RELEASE_TELEMETRY_ENDPOINT` 把线上代理地址注入发布构建;本地与开发构建保持为空,即遥测整体静默(`telemetry: false` 的 disabled 标记写入除外,见下)。运行时显式设置 `UNIVER_TELEMETRY_ENDPOINT`(含空值)优先于构建固定值,用作测试重定向与应急开关。服务端 allowlist 必须先于带 endpoint 的构建部署,否则事件会被整包拒绝且因 at-most-once 永久丢失;
408
+ - `dsh_plugin_activated`(Host 激活,每安装身份一次)、`dsh_plugin_daily_active`(Host 激活时检查,每安装身份每本地日一次)、`dsh_plugin_uninstall_hook`(包 uninstall,不去重,因为 state 跨重装存活,一次性标记会掩盖后续卸载);
409
409
  - payload 只允许 `distinctId`(随机 UUID)、事件名与白名单属性(package name/version、build commit、platform、arch、Node major version、event source、state schema version),禁止路径、workspace、session、文件内容与环境变量。服务端代理对未知键整包拒绝;
410
410
  - 去重只在本机 state(`$DSH_HOME/telemetry/dsh-univer-office/state.json`,沿用 `config.ts` 的 `DSH_HOME` 约定)中做,先落盘标记再发送(at-most-once:崩溃宁可丢事件不重发,标记写失败时同样放弃发送);并发启动的毫秒级竞态接受偶发双发;
411
- - `telemetry: false` 配置由 Host 同步写入 state 的 `disabled` 标记,使拿不到 Cordis 配置的 lifecycle hook 发送同样停用,这也是空 endpoint 下唯一会创建 state 的路径;`DO_NOT_TRACK` 非空在所有入口直接短路;
411
+ - `telemetry: false` 配置由 Host 同步写入 state 的 `disabled` 标记,使拿不到 Cordis 配置的卸载 hook 发送同样停用,这也是空 endpoint 下唯一会创建 state 的路径;`DO_NOT_TRACK` 非空在所有入口直接短路;
412
412
  - 发送只发生在 Host 进程(fire-and-forget,不注册资源、不阻塞激活与卸载)与 `scripts/telemetry-entry.mjs` 启动的 detached 子进程中;Client、Viewer、Gateway 与 Worker 不发送遥测。
413
413
 
414
414
  ## 16. 变更规则
@@ -1,5 +1,5 @@
1
1
  {
2
- "commit": "6086d9a7b7291007fc17a9b9cbc49a2e0b536884",
2
+ "commit": "45de615e671218dae7ba1214db4089699ca25358",
3
3
  "telemetryEndpoint": "",
4
- "version": "0.2.11"
4
+ "version": "0.2.12"
5
5
  }
package/lib/index.js CHANGED
@@ -7117,12 +7117,10 @@ function markTelemetryEvent(input) {
7117
7117
  if (state.dailyActiveSentDate === date) return void 0;
7118
7118
  return { ...state, dailyActiveSentDate: date, version: TELEMETRY_STATE_VERSION };
7119
7119
  }
7120
- if (event === "dsh_plugin_postinstall" && state.postinstallAttemptedAt !== void 0)
7121
- return void 0;
7122
7120
  if (event === "dsh_plugin_activated" && state.activatedAttemptedAt !== void 0) return void 0;
7123
7121
  return {
7124
7122
  ...state,
7125
- [event === "dsh_plugin_postinstall" ? "postinstallAttemptedAt" : "activatedAttemptedAt"]: now.toISOString(),
7123
+ activatedAttemptedAt: now.toISOString(),
7126
7124
  version: TELEMETRY_STATE_VERSION
7127
7125
  };
7128
7126
  }
@@ -7138,13 +7136,11 @@ function parseTelemetryState(json) {
7138
7136
  throw new Error("Invalid telemetry anonymous install id.");
7139
7137
  }
7140
7138
  const activatedAttemptedAt = readTimestamp(value.activatedAttemptedAt);
7141
- const postinstallAttemptedAt = readTimestamp(value.postinstallAttemptedAt);
7142
7139
  const dailyActiveSentDate = typeof value.dailyActiveSentDate === "string" && value.dailyActiveSentDate.length > 0 ? value.dailyActiveSentDate : void 0;
7143
7140
  return {
7144
7141
  anonymousInstallId: value.anonymousInstallId,
7145
7142
  ...activatedAttemptedAt === void 0 ? {} : { activatedAttemptedAt },
7146
7143
  ...value.disabled === true ? { disabled: true } : {},
7147
- ...postinstallAttemptedAt === void 0 ? {} : { postinstallAttemptedAt },
7148
7144
  ...dailyActiveSentDate === void 0 ? {} : { dailyActiveSentDate },
7149
7145
  version: TELEMETRY_STATE_VERSION
7150
7146
  };
@@ -109,12 +109,10 @@ function markTelemetryEvent(input) {
109
109
  if (state.dailyActiveSentDate === date) return void 0;
110
110
  return { ...state, dailyActiveSentDate: date, version: TELEMETRY_STATE_VERSION };
111
111
  }
112
- if (event2 === "dsh_plugin_postinstall" && state.postinstallAttemptedAt !== void 0)
113
- return void 0;
114
112
  if (event2 === "dsh_plugin_activated" && state.activatedAttemptedAt !== void 0) return void 0;
115
113
  return {
116
114
  ...state,
117
- [event2 === "dsh_plugin_postinstall" ? "postinstallAttemptedAt" : "activatedAttemptedAt"]: now.toISOString(),
115
+ activatedAttemptedAt: now.toISOString(),
118
116
  version: TELEMETRY_STATE_VERSION
119
117
  };
120
118
  }
@@ -130,13 +128,11 @@ function parseTelemetryState(json) {
130
128
  throw new Error("Invalid telemetry anonymous install id.");
131
129
  }
132
130
  const activatedAttemptedAt = readTimestamp(value.activatedAttemptedAt);
133
- const postinstallAttemptedAt = readTimestamp(value.postinstallAttemptedAt);
134
131
  const dailyActiveSentDate = typeof value.dailyActiveSentDate === "string" && value.dailyActiveSentDate.length > 0 ? value.dailyActiveSentDate : void 0;
135
132
  return {
136
133
  anonymousInstallId: value.anonymousInstallId,
137
134
  ...activatedAttemptedAt === void 0 ? {} : { activatedAttemptedAt },
138
135
  ...value.disabled === true ? { disabled: true } : {},
139
- ...postinstallAttemptedAt === void 0 ? {} : { postinstallAttemptedAt },
140
136
  ...dailyActiveSentDate === void 0 ? {} : { dailyActiveSentDate },
141
137
  version: TELEMETRY_STATE_VERSION
142
138
  };
@@ -191,23 +187,15 @@ function isRecord(value) {
191
187
  }
192
188
 
193
189
  // src/host/telemetry/entry.ts
194
- function isTelemetryEventName(value) {
195
- return value === "dsh_plugin_postinstall" || value === "dsh_plugin_activated" || value === "dsh_plugin_daily_active" || value === "dsh_plugin_uninstall_hook";
196
- }
197
- function sourceFor(event2) {
198
- if (event2 === "dsh_plugin_postinstall") return "postinstall";
199
- if (event2 === "dsh_plugin_uninstall_hook") return "uninstall-hook";
200
- return "host-activate";
201
- }
202
190
  var event = process.argv[3];
203
- if (process.argv[2] === "capture" && isTelemetryEventName(event)) {
191
+ if (process.argv[2] === "capture" && event === "dsh_plugin_uninstall_hook") {
204
192
  try {
205
193
  const buildInfo = readBundledBuildInfo();
206
194
  await captureTelemetry({
207
195
  buildInfo,
208
196
  endpoint: telemetryEndpointFor({ buildInfo }),
209
197
  event,
210
- source: sourceFor(event)
198
+ source: "uninstall-hook"
211
199
  });
212
200
  } catch {
213
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-univer-office",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "DSH × Univer integration with a bundled collaboration Gateway and Viewer: inline previews, live floating Worktree windows, and session-end review actions in DeepSeek Harness.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -61,7 +61,6 @@
61
61
  },
62
62
  "scripts": {
63
63
  "prepare": "simple-git-hooks",
64
- "postinstall": "node scripts/telemetry-entry.mjs postinstall",
65
64
  "uninstall": "node scripts/telemetry-entry.mjs uninstall",
66
65
  "build": "pnpm run build:lib && pnpm run build:worker && pnpm run build:gateway && pnpm run build:render && pnpm run build:viewer",
67
66
  "build:lib": "node scripts/build.mjs lib",
@@ -1,7 +1,8 @@
1
- // Package lifecycle entry (package.json "postinstall" / "uninstall"). It must
2
- // never fail or slow install and removal: if the bundled telemetry entry is
3
- // missing (fresh checkout before a build, scripts disabled) it exits silently,
4
- // and otherwise the send runs in a detached child process.
1
+ // Package uninstall lifecycle entry. It must never fail or slow removal: if the
2
+ // bundled telemetry entry is missing (fresh checkout before a build, scripts
3
+ // disabled) it exits silently, and otherwise the send runs in a detached child
4
+ // process. The published package intentionally declares no postinstall script
5
+ // because DSH profiles reject unapproved dependency build scripts.
5
6
  import { spawn } from 'node:child_process'
6
7
  import { existsSync } from 'node:fs'
7
8
  import { dirname, join, resolve } from 'node:path'
@@ -9,7 +10,6 @@ import { fileURLToPath } from 'node:url'
9
10
 
10
11
  const command = process.argv[2]
11
12
  const eventByCommand = {
12
- postinstall: 'dsh_plugin_postinstall',
13
13
  uninstall: 'dsh_plugin_uninstall_hook'
14
14
  }
15
15
  const event = command === undefined ? undefined : eventByCommand[command]