@marsken/dsh-studio 0.0.0-stage → 0.1.0
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/AGENTS.md +148 -0
- package/LICENSE +202 -0
- package/README.md +1356 -3
- package/client.js +952 -0
- package/client.src.js +2466 -0
- package/cordis.patch.yml +9 -0
- package/dist/client.js +952 -0
- package/docs/compatibility.md +99 -0
- package/docs/publish.md +86 -0
- package/docs/quickstart.md +53 -0
- package/icon.svg +6 -0
- package/index.js +2674 -0
- package/locale/en.json +11 -0
- package/locale/zh.json +11 -0
- package/package.json +63 -4
- package/scripts/smoke-store.mjs +76 -0
- package/src/host/cases.js +135 -0
- package/src/host/design.js +87 -0
- package/src/host/dispatcher.js +936 -0
- package/src/host/domain.js +1966 -0
- package/src/host/executor.js +1396 -0
- package/src/host/gitlab-facts.js +22 -0
- package/src/host/impact.js +32 -0
- package/src/host/integrations.js +587 -0
- package/src/host/quality.js +106 -0
- package/src/host/routes/admin.js +100 -0
- package/src/host/routes/agents.js +71 -0
- package/src/host/routes/auth.js +155 -0
- package/src/host/routes/coding.js +203 -0
- package/src/host/routes/connect.js +166 -0
- package/src/host/routes/exports.js +122 -0
- package/src/host/routes/insights.js +97 -0
- package/src/host/routes/releases.js +335 -0
- package/src/host/routes/requirements.js +430 -0
- package/src/host/routes/skills.js +75 -0
- package/src/host/routes/tasks.js +573 -0
- package/src/host/store.js +522 -0
- package/src/host/team-memory.js +46 -0
- package/src/host/tools.js +1211 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# dsh-studio · 开发指南
|
|
2
|
+
|
|
3
|
+
给接手这个仓库的人(和 AI)看的操作手册。原则只有一条:**改动必须能在真实浏览器与真实 dsh 上验证,验证不出来的改动不算完成。**
|
|
4
|
+
|
|
5
|
+
## 1. 仓库结构
|
|
6
|
+
|
|
7
|
+
| 路径 | 是什么 | 谁能改 |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `index.js` | 宿主半边:`apply(ctx)`、39 个 `studio_*` 工具、`/studio-api/*` 路由、SQLite 存储、派单引擎、门禁 | ✅ 直接改 |
|
|
10
|
+
| `src/host/*.js` | 宿主层模块:`cases.js`(跨卡用例聚合与回归汇总:`collectCases` / `groupCaseKeys` / `summarizeRun`,纯函数)、`team-memory.js`(专家团的团级记忆,存 side 键)、`quality.js`(AI 质量:返工识别与按专家汇总,纯函数)、`gitlab-facts.js`(执行记录 vs MR 事实的对账,纯函数)、`impact.js`(需求改版的影响面:受影响的卡与要重跑的用例,纯函数)、`design.js`(设计评审记录与进开发前的闸门,纯函数)、`domain.js`(板列/数据形状/`sanitize*`/默认配置,纯函数)、`dispatcher.js`(派单引擎)、`executor.js`(用例执行、代码事实核对、健康检查)、`store.js`(`StudioStore`/`SecretStore`:SQLite 台账 + 快照 + 登录会话)、`integrations.js`(GitLab / 飞书 / 平台健康)、`routes/*.js`(按前缀拆出的 HTTP 处理:`exports.js` 导出 CSV、`auth.js` 统一登录、`tasks.js` 卡片/专家/列、`requirements.js` 需求/文档/公开提单、`releases.js` 版本/灰度/部署、`insights.js` 指标与工作台、`skills.js` 技能库读写上传、`admin.js` 配置/权限成员/审计/快照、`connect.js` 市场/集成健康/GitLab/仓库/飞书、`agents.js` 派单运行态与起停、`coding.js` 执行记录/失败重试/worktree/项目配置、`tools.js` 39 个 `studio_*` 工具) | ✅ 直接改,新逻辑优先放这里 |
|
|
11
|
+
| `client.src.js` | 浏览器半边的手写源码(通过 `window.__ModuleLoader__` 注册面板) | ✅ 直接改(前端逻辑) |
|
|
12
|
+
| `web/src/**` | shadcn/Radix 组件、样式、`legacy.js` 桥;`web/src/studio/*.js` 是从 `client.src.js` 抬出来的纯模块(`markdown.js` 渲染器、`format.js` 日期格式、`labels.js` 标签表、`roster.js` 负责人与候选人、`fields.js` 表单适配层、`shell.js` 共享抽屉、`card.js` 看板卡片、`board.js` 看板本体、`mentions.js` @ 选择器、`cases.js` 多步用例解析、`drawer.js` 卡片详情抽屉、`editor.js` 通用编辑器、`palette.js` 命令面板(⌘K 全局搜索卡片/需求/版本/专家/专家团/项目/技能 + 动作项 + Ctrl/⌘+Alt+Shift+N/T/D 全局快捷键;带 Shift 是为了避开宿主的 Ctrl+Alt+N 新会话)、`charts.js` 进度条与燃尽图、`context.js` 共享上下文(`provideClient`/`client`)、`panels/*.js` 设置页 17 个面板、`pages/*.js` 六个页面组件(看板之外的工作台/需求/用例/版本/效能/自助提单);**`StudioPage` 是组合根,故意留在 `client.src.js`**,它负责顶栏、页签与「+ 新建」菜单并调用 `provideClient()`,别为了行数把它搬走),由 `make-legacy` 生成的 `legacy.js` 顶部统一 import | ✅ 直接改(样式与组件) |
|
|
13
|
+
| `dist/client.js` | `pnpm build` 的产物(单文件 IIFE,注意在仓库根 `dist/`,不是 `web/dist/`) | ❌ 生成物 |
|
|
14
|
+
| `client.js`(包根) | 上面产物自动同步过来的副本,dsh 真正加载的那个 | ❌ 生成物 |
|
|
15
|
+
| `cordis.patch.yml` | bundle patch,把本包挂进 profile | ✅ |
|
|
16
|
+
| `locale/*.json` | 面板标题/描述等元数据 | ✅ |
|
|
17
|
+
| `README.md` | 用户向文档(安装、功能、排障) | ✅ |
|
|
18
|
+
| `docs/compatibility.md` | 我们对 dsh 宿主接口的依赖清单与升级 runbook | ✅ 改动宿主调用时必须同步 |
|
|
19
|
+
| `docs/quickstart.md` | 第一天上手:clone → 测试 → 构建 → 部署 → 冒烟,每条都在全新 clone 上验过 | ✅ 命令变了就同步 |
|
|
20
|
+
| `docs/publish.md` | 发布到 DSH 插件市场:发版、收录条目结构、自查清单 | ✅ 改发版流程时同步 |
|
|
21
|
+
|
|
22
|
+
## 2. 三个前端文件的关系(最容易搞错的地方)
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
client.src.js 手写源码
|
|
26
|
+
│ web/scripts/make-legacy.mjs → web/src/legacy.js
|
|
27
|
+
▼
|
|
28
|
+
web/src/** ── vite build ──▶ dist/client.js ── sync-client.mjs ──▶ 根 client.js
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- 改**前端逻辑** → `client.src.js`
|
|
32
|
+
- 改**样式/组件/主题** → `web/src/**`
|
|
33
|
+
- 改完一律在 `web/` 里构建:`pnpm build`(= `make-legacy` → `guard --pre` → `vite build` → `sync-client` → `guard --post`)
|
|
34
|
+
- 构建后自检:`cmp -s dist/client.js client.js && echo same`,大小应约 700 KB(gzip ≈ 207 KB)
|
|
35
|
+
|
|
36
|
+
> 曾经漏跑 `make-legacy`,`client.src.js` 的改动根本没进 bundle,白改好几轮。构建脚本已经把它串进 `build`,不要手工跳过。
|
|
37
|
+
|
|
38
|
+
## 3. 构建与部署
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 1) 构建(Windows 上用随包 pnpm)
|
|
42
|
+
cd dsh-studio/web
|
|
43
|
+
node C:/Users/hp/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/pnpm/bin/pnpm.cjs run build
|
|
44
|
+
|
|
45
|
+
# 2) 部署:一条命令,传 index.js + dist/client.js + 整个 src/host,先备份再覆盖,最后自检
|
|
46
|
+
cd ..
|
|
47
|
+
DSH_DEPLOY_HOST=192.168.120.218 DSH_DEPLOY_USER=lyf DSH_DEPLOY_PASSWORD=*** node tools/deploy.mjs
|
|
48
|
+
# 没有密码就先用 --key 或 ssh-copy-id 授权本机公钥,再:node tools/deploy.mjs --dry-run 看它要传什么
|
|
49
|
+
|
|
50
|
+
# 3) 冒烟:进面板 → 页签 → 看板有卡 → 用例库有行 → pageerror 必须为空
|
|
51
|
+
STUDIO_TOKEN=$(echo 1234 | sudo -S journalctl -u dsh-web -n 50 | grep -o 'token=[A-Za-z0-9_-]*' | tail -1 | cut -d= -f2) \
|
|
52
|
+
node tools/visual/smoke.mjs
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> `tools/deploy.mjs` 会打印 `active=` / `files=` / `state=`,`active` 不是 active 就以非零退出。
|
|
56
|
+
> 它依赖 `ssh2`(devDependency,只给部署用,不进插件运行时);`tools/visual/smoke.mjs` 依赖 `puppeteer-core`(同样只在 devDependencies 里),浏览器用系统 Chrome,可用 `CHROME_PATH` 指定。
|
|
57
|
+
|
|
58
|
+
> 目标机上那个老的 `deploy-all.sh` 只作兜底(它拷 `/tmp/` 下的两个文件和 `src/`)。日常用 `tools/deploy.mjs`,别再手工 scp 拼路径。改了 `package.json`(包头、`engines`、`dsh.*`、`files`)、`cordis.patch.yml`、`locale/*.json` 时必须单独上传到 `/home/lyf/dsh-studio/` 再重启,否则改了个寂寞。改动前先 `cp package.json /tmp/package.json.bak` 留退路。
|
|
59
|
+
>
|
|
60
|
+
> 宿主拆成 `src/host/*.js` 以后,**部署必须带整个 `src/` 目录**:`/tmp/index.js`、`/tmp/client.js`、`/tmp/src/host/{domain,dispatcher,executor,integrations,store}.js` 与 `/tmp/src/host/routes/*.js`。只传 `index.js` 会得到 `ReferenceError: sanitizeAccess is not defined`(服务 502)。
|
|
61
|
+
|
|
62
|
+
验收三件事:`systemctl is-active dsh-web` = `active`;浏览器打开 `http://<host>/` 侧栏出现「需求&任务工作空间」;`GET /studio-api/state` 返回 200 且 `revision` 递增。
|
|
63
|
+
|
|
64
|
+
## 4. 每次改动前后的硬性检查
|
|
65
|
+
|
|
66
|
+
1. `node --check index.js && node --check client.src.js`(语法;但**查不出**运行期 `ReferenceError`,见第 11 节)
|
|
67
|
+
2. 构建后 `cmp` 两个 client.js 一致
|
|
68
|
+
3. 服务端行为:写一个 `tmp/*.mjs`(或 `.py`)脚本直接打 `/studio-api/*`,**不要在 PowerShell 里内联复杂 `node -e`**
|
|
69
|
+
4. UI 行为:先跑 `node tools/visual/smoke.mjs`(部署后冒烟,见 §3);要验具体功能就照它的写法加探针,必须
|
|
70
|
+
- 先点侧栏文字进入面板,再等 `[data-dsh-studio]`
|
|
71
|
+
- 切页签用 `elementHandle.click()`(Radix Tabs 不认 DOM `.click()`)
|
|
72
|
+
- 断言 DOM + `pageerror` 为空,并截图留档
|
|
73
|
+
- **探针说「找不到元素」时,先截图再说**:面板崩掉时 React 的错误边界会把异常吞在自己的渲染树里,`pageerror` 是空的,页面上只有一行「工作空间渲染失败:xxx is not defined」。2026-11-13 连着两次把「页面崩了」误判成「选择器不对」,白跑两轮。截图 + `document.body.innerText.includes('渲染失败')` 才是判据。
|
|
74
|
+
5. 涉及权限/门禁/发布的重改动,跑一遍既有 e2e 脚本并贴出数字
|
|
75
|
+
6. `npm test`(条数以 `npm run check` 打印的为准,别再写死数字;覆盖范围是:`tests/repo.test.mjs` 管 manifest / 产物一致 / 宿主接口 / 领域层拆分与导入 / **导入只读绑定不许赋值** / **跨模块符号必须导入** / 迁移 / 文档 / locale / **用了 `React.` 的组件必须从 `client()` 或工厂参数拿到 `React`**;`tests/client-units.test.mjs` 用真实模块跑标签表/负责人/日期/命令面板检索这些纯函数;`tests/notify.test.mjs` 起一个本地 HTTP 桩验证飞书通知(正文归一、`botWants` 的事件矩阵、`feishuBroadcast` 只发给订阅该事件的机器人);`tests/store-boot.test.mjs` 真的起一个 `StudioStore`,把「搬完代码启动就炸」这类问题挡在部署前。想连真数据验证:把生产库三个文件(`.db`/`-wal`/`-shm`)拷到临时目录,用 `new StudioStore()` + `await store.ready` 跑一遍,`tmp/boot-real.mjs` 就是这么写的);`npm run check` = 语法 + 契约一把过
|
|
76
|
+
7. 构建期守卫:`web/scripts/guard.mjs`(`pnpm build` 自动跑两次)——禁 CSS 里出现 `hsl(var(--x))`、禁 Radix Portal 不挂 `container={portalRoot()}`、产物里必须留下 `data-dsh-studio-portal`。单独跑:`cd web && npm run guard`
|
|
77
|
+
8. 真库自检:`npm run smoke:store -- ~/.dsh/dsh-studio.db`(把 `.db/-wal/-shm` 拷到临时目录起一遍真实 `StudioStore`,专抓「空库能起、真库就炸」的导入问题)
|
|
78
|
+
9. CI 在 `.github/workflows/ci.yml`:语法 → 契约 → `web/` 里 `pnpm install --frozen-lockfile && pnpm build` → `cmp dist/client.js client.js` → `git diff --exit-code`(产物必须可复现,改了前端忘记构建会直接红)
|
|
79
|
+
|
|
80
|
+
## 5. 禁止事项
|
|
81
|
+
|
|
82
|
+
- ❌ 手改 `dist/client.js` 或根 `client.js`(会被下次构建覆盖)
|
|
83
|
+
- ❌ 直接在目标机上改文件而不回写仓库(下次部署即丢)
|
|
84
|
+
- ❌ 用 `powershell -Command "node -e \"...\""` 这类多层引号跑逻辑;一律落成 `tmp/*.js|mjs|py`
|
|
85
|
+
- ❌ 用 `split("\r\n")` 编辑 README(本仓库是混合行尾):用 `split(/\r?\n/)`,写回统一 `\r\n`
|
|
86
|
+
- ❌ 在 UI 线程里做「读样式 + 写属性」交替的批量循环(会触发强制同步布局,实测 685 ms 长任务)
|
|
87
|
+
- ❌ 删除用户数据前不备份:先 `cp ~/.dsh/dsh-studio.db /tmp/...`,再操作
|
|
88
|
+
- ❌ 从 `index.js` 往外搬代码后不回查导入:`node --check` 查不出,只有 `import()` 与运行时才会炸(新增的契约测试会拦一类,见 §4)
|
|
89
|
+
|
|
90
|
+
## 6. 后端约定(`index.js`)
|
|
91
|
+
|
|
92
|
+
- **白名单四处**(原来写的三件套少算了一处,2026-11-13 因此丢过 `config.design`):`defaultConfig()`、**`mergeConfig(saved)`——重启加载时按显式键列表重建配置,没列进去的键会被静默抹掉**、`mergeConfig(patch)`/`publicConfig()`(可写 / 对外可见)、`sanitizeX()`(每个对象)。契约测试 `config: every default key survives a merge round trip` 会拦住漏掉的那处。
|
|
93
|
+
- `StudioStore.mutate(fn)` **返回整份 state**,不是 `fn` 的返回值;要拿某张卡用 `store.snapshot().tasks.find(...)`。
|
|
94
|
+
- 所有对外状态走 `publicState()`:`{ revision, config, tasks, requirements, releases, experts, … }`。
|
|
95
|
+
- 路由统一挂在 `/studio-api`(`ctx.webServer.register({ kind:'prefix' })`);新增路由记得同时更新权限分级 `accessLevelFor` 与 `/auth/*` 例外。
|
|
96
|
+
- 迁移走 `config.schema` 版本号 + `#load()` 里的顺序迁移函数,禁止「就地猜测数据形状」。
|
|
97
|
+
- 长任务(派单、GitLab 同步、飞书推送)不得阻塞请求线程;失败要写进任务 `history` 或审计,不许静默。
|
|
98
|
+
- 拆出去的模块要宿主能力时,用 `configureDispatcher()/configureExecutor()/configureIntegrations()` 注入(`store.js` 不需要注入,只依赖 `domain.js`),**不要让子模块反向 import `index.js`**(会成环);需要活值(如 `activeDispatcher`)用 getter 注入。
|
|
99
|
+
|
|
100
|
+
## 7. 前端约定
|
|
101
|
+
|
|
102
|
+
- `client.src.js` 是**无 JSX** 的 `h()` 写法;需要 Radix 组件时用 `kit('Tabs')` 等取,取不到必须能降级(宿主可能没给)。
|
|
103
|
+
- 弹层一律用 Radix Portal,且容器**同时**带 `data-dsh-studio` 与 `data-dsh-studio-portal`,否则 `[data-dsh-studio]` 前缀的样式在弹层里全部失效(表现为「弹窗存在但看不见」)。
|
|
104
|
+
- 样式优先级:legacy 的 `.ds-*` 运行时注入,晚于 head 里的 Tailwind;同特异性时 legacy 胜。要覆盖就提高特异性(`[data-dsh-studio] .x`)。
|
|
105
|
+
- 颜色用**实色**,不要 `hsl(var(--primary))`(部分子树解析不到会让主按钮退化成纯文字)。
|
|
106
|
+
- 深色主题靠 `[data-theme="dark"]` 覆盖 `--ds-*` 变量;新增面板要同时给浅/深两套背景与边框。
|
|
107
|
+
- 表单统一用共享 `SideDrawer`;危险操作 `data-danger`,阻断/警示 `data-warn`,主行动 `ds-btn-primary`。
|
|
108
|
+
|
|
109
|
+
## 8. 宿主接口约定
|
|
110
|
+
|
|
111
|
+
- `export const inject = ['tools', 'systemPrompt']`;其它服务用 `ctx.inject([...], ctx => …)` 延迟获取,缺服务时整个插件不应崩。
|
|
112
|
+
- 起会话必须三件齐全:`ctx.agents.create({ sessionId, meta:{ cwd }, agentOptions:{ provider, model }, setup })`,其中 `setup` 要 `agentPresets.resolve(id)` + `presets.mount(scope, id)`;随后 `agent.inject()` + `agent.followup(..., { source:{ kind:'user' } })` 才真正驱动一轮。
|
|
113
|
+
- **模型在会话创建时固化**:改专家模型设置不影响已有会话,必须重启服务或删 `~/.dsh/sessions/<ws>/studio-*` 才会重建。
|
|
114
|
+
- 会话名固定 `studio-<taskId>-<expertId>`;排障时直接读 `~/.dsh/sessions/…/session.v4.jsonl.zstd`(`zstd -dc`)。
|
|
115
|
+
- 模型兜底不得跟随宿主默认(宿主默认在部分 provider 上没有可用通道,会 `503 No available channel`),统一走 `FALLBACK_AGENT_MODEL`。
|
|
116
|
+
|
|
117
|
+
## 9. 数据与迁移
|
|
118
|
+
|
|
119
|
+
- 真源:`~/.dsh/dsh-studio.db`(`node:sqlite`,WAL,`meta.state` 存整份状态,保留 10 份快照);`~/.dsh/dsh-studio.json` 只是历史遗留。
|
|
120
|
+
- 密钥:`~/.dsh/dsh-studio.secrets.json`(0600);不得写进 state、日志、README。
|
|
121
|
+
- 技能库:`~/.dsh/skills/<name>/SKILL.md`,插件启动时 `syncAll()` 自愈。
|
|
122
|
+
- 清库前必备份,清库后按场景重建(需求 → 功能点 → 卡 → 用例 → 交付物)。
|
|
123
|
+
|
|
124
|
+
## 10. 提交与发布
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
git remote -v # origin = ssh://git@ssh.github.com:443/marsken88/dsh-studio.git
|
|
128
|
+
GIT_SSH_COMMAND="ssh -p 443" git push
|
|
129
|
+
```
|
|
130
|
+
- 一个提交只做一件事,标题一句话说清(英文或中文均可,与既有历史保持同风格)。
|
|
131
|
+
- **改完即推,不在本地攒**:每完成一件事(一个提交)就 `git push`。攒着会让三处对不上——远端、目标机 `.218` 上跑的、以及仓库里的,别人 `git clone` 拿到的还是旧版。历史上曾经一口气攒了 18 个提交才推,属于反面案例。
|
|
132
|
+
- 提交前确保根 `client.js` 与 `dist/client.js` 一致(clone 下来即可安装靠的就是这一点)。
|
|
133
|
+
- 版本号在 `package.json`;发布标签 `vX.Y.Z`。
|
|
134
|
+
|
|
135
|
+
## 11. 常见故障速查
|
|
136
|
+
|
|
137
|
+
| 现象 | 先查这里 |
|
|
138
|
+
| --- | --- |
|
|
139
|
+
| 页面白屏 | 浏览器 console 的 `ReferenceError`(`node --check` 抓不到);派生变量必须 null 兜底 |
|
|
140
|
+
| 面板里一行「渲染失败:xxx is not defined」 | 组件里引用了当前作用域没有的变量(典型:把 `state.tasks` 写成 `tasks`)。`pageerror` 不会有记录,只能靠截图或 `innerText` 里找「渲染失败」 |
|
|
141
|
+
| 改了没生效 | 是否改了 `client.src.js` 却没跑 `make-legacy`;`cmp` 确认产物;浏览器强刷 |
|
|
142
|
+
| 主按钮只剩文字 | 是否又用了 `hsl(var(--primary))`;改实色 |
|
|
143
|
+
| 弹窗/抽屉看不见 | Portal 容器是否缺 `data-dsh-studio` 属性 |
|
|
144
|
+
| 拖拽没反应 | 卡片是否有 `draggable`、列上是否有 `onDragOver/onDrop`、路由是否是 `/task/update` |
|
|
145
|
+
| 服务每 5 分钟自杀一次 | 定时器里给**导入绑定**赋值(`larkProbeCache = …`):ESM 导入只读,抛 `Assignment to constant variable`;改成调 `invalidateLarkProbe()` 这类 setter |
|
|
146
|
+
| 点击页面卡顿 | DevTools Performance 找长任务;`keyboardPatch` 之类全量扫描是历史元凶 |
|
|
147
|
+
| 派单没留言 | 会话日志里找 `turn/end reason.kind=error`;常见是模型无可用通道(503) |
|
|
148
|
+
| 保存成功但字段为空 | `publicConfig`/`mergeConfig`/`sanitize*` 白名单漏字段 |
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|