writedock-mcp 0.4.2 → 0.4.6

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 (35) hide show
  1. package/README.md +87 -63
  2. package/extension/LICENSE-MULTIPOST.txt +201 -0
  3. package/extension/LICENSE.txt +674 -0
  4. package/extension/NOTICE.txt +13 -0
  5. package/extension/assets/editor-DWoK50xk.js +76 -0
  6. package/extension/assets/editor-VBFqqvXW.css +1 -0
  7. package/extension/assets/icon-128.png +0 -0
  8. package/extension/assets/icon-16.png +0 -0
  9. package/extension/assets/icon-48.png +0 -0
  10. package/extension/assets/index.browser-Hs3ZYqOv.js +157 -0
  11. package/extension/assets/index.ts-DbQynGAJ.js +42 -0
  12. package/extension/assets/logo.svg +5 -0
  13. package/extension/assets/offscreen-3BECPbQX.js +63 -0
  14. package/extension/assets/purify.es-1yEQDPgc.js +3 -0
  15. package/extension/assets/react-vendor-BrXlnJmF.js +40 -0
  16. package/extension/assets/task-utils-DwzGcJkm.js +1 -0
  17. package/extension/manifest.json +40 -0
  18. package/extension/service-worker-loader.js +1 -0
  19. package/extension/src/editor/index.html +16 -0
  20. package/extension/src/offscreen/index.html +6 -0
  21. package/extension/zhihu-publication-observer.js +1 -0
  22. package/extension//345/256/211/350/243/205/344/270/216/346/233/264/346/226/260.txt +19 -0
  23. package/index.cjs +330 -69
  24. package/package.json +3 -2
  25. package/source/package.json +1 -1
  26. package/source/src/__tests__/bridge.test.ts +22 -0
  27. package/source/src/__tests__/extension-update.test.ts +54 -0
  28. package/source/src/__tests__/setup.test.ts +50 -0
  29. package/source/src/bridge.ts +40 -11
  30. package/source/src/extension-id.ts +2 -0
  31. package/source/src/extension-update.ts +82 -0
  32. package/source/src/index.ts +3 -0
  33. package/source/src/release-info.ts +3 -0
  34. package/source/src/server.ts +45 -3
  35. package/source/src/setup.ts +88 -0
package/README.md CHANGED
@@ -1,102 +1,126 @@
1
1
  # WriteDock MCP
2
2
 
3
- 连接用户自己的 agent 与 WriteDock 浏览器扩展。agent 写稿并准备图片或视频,本服务负责素材读取、任务转发与结果查询。平台 Cookie 留在浏览器中。
3
+ 连接你自己的 agent 与 WriteDock 浏览器扩展:agent 写稿并准备图片或视频,一次调用发布到多个平台,并按平台查询结果。
4
4
 
5
- ## 通过 npx 连接
5
+ MCP 运行在你自己的电脑上,只监听 `127.0.0.1`。平台 Cookie 留在浏览器里,稿件和媒体不经过 npm。
6
6
 
7
- 电脑需要 Node.js 22+(包含 npm/npx),首次获取及更新需要能访问 npm。无需手动下载解压安装包,无需全局安装。本包运行的是本机 stdio MCP,不是远程托管服务。
7
+ ## 安装
8
+
9
+ 需要 Node.js 22+ 和 Chrome 或 Edge。运行:
10
+
11
+ ```bash
12
+ npx -y writedock-mcp@latest setup
13
+ ```
14
+
15
+ 它会做两件事,并在最后告诉用户下一步:
16
+
17
+ - 给本机已有的 Codex、Claude Code、Cursor、Claude Desktop 添加 MCP 配置,原文件留一份 `.writedock-backup`。已有的 WriteDock 配置不会改动。
18
+ - 把内置的扩展放到本机固定目录。
19
+
20
+ 然后重启 agent,在扩展管理页打开开发者模式,加载提示中的文件夹,打开扩展点「连接」。
21
+
22
+ 其他客户端手动添加:
8
23
 
9
24
  ```json
10
25
  {
11
26
  "mcpServers": {
12
27
  "writedock": {
13
28
  "command": "npx",
14
- "args": ["-y", "--prefer-online", "writedock-mcp@latest"],
15
- "env": { "WRITEDOCK_PORT": "9647" }
29
+ "args": ["-y", "--prefer-online", "writedock-mcp@latest"]
16
30
  }
17
31
  }
18
32
  }
19
33
  ```
20
34
 
21
- Codex 的配置示例(格式依据 [OpenAI 官方 MCP 文档](https://developers.openai.com/codex/mcp/)):
22
-
23
- ```toml
24
- [mcp_servers.writedock]
25
- command = "npx"
26
- args = ["-y", "--prefer-online", "writedock-mcp@latest"]
27
- startup_timeout_sec = 120
28
- tool_timeout_sec = 60
29
-
30
- [mcp_servers.writedock.env]
31
- WRITEDOCK_PORT = "9647"
32
- ```
33
-
34
- 不同客户端按各自支持的配置格式添加。首次下载需预留启动时间;Windows 的 npx 启动命令按客户端要求处理。
35
-
36
- 启动 MCP 后调用 `get_connection_status`;尚未配对时调用 `begin_pairing`,将一次性配对码粘贴到扩展的「MCP 连接」。配对码 3 分钟有效、使用一次失效。连接配置和配对阶段不提交文章;连通后按用户指定的平台和内容调用发布工具。
37
-
38
- ## 更新与旧版迁移
39
-
40
- `--prefer-online` 在每次新启动时检查 npm 包的更新,相同版本可复用缓存;`latest` 指向维护者发布的版本。正在运行的进程不会自动替换,发布新版后重新加载 MCP 连接或重启相关 agent。新建聊天、刷新扩展不一定重启 MCP。
41
-
42
- 从旧的 `node /安装目录/index.cjs` 迁移时,修改已有 writedock 服务的 command/args,保留原端口、`WRITEDOCK_DATA_DIR`、已有 `WRITEDOCK_TOKEN` 和其他客户端配置,停掉仍运行旧程序的 WriteDock MCP,再重新加载连接。无需删除旧程序目录或配对资料。
35
+ 首次下载较慢,请把启动超时设为 120 秒。启动后调用 `get_connection_status`;未连接时,让用户打开扩展点「连接」。
43
36
 
44
- 身份与配对保存在用户数据目录的 `identity-端口.json`,不在程序目录或 npm 缓存里:
37
+ ## 发布
45
38
 
46
- - macOS:`~/Library/Application Support/WriteDock/mcp/`
47
- - Windows:`%LOCALAPPDATA%/WriteDock/mcp/`
48
- - Linux:`${XDG_DATA_HOME:-~/.local/share}/writedock/mcp/`
49
-
50
- 保留同一系统用户、端口和数据目录时,npx 更新继续复用身份。旧 `WRITEDOCK_TOKEN` 仅在首次建立持久身份时迁移,资料已存在时不会覆盖。扩展更新保留浏览器配对;卸载重装扩展后用 `begin_pairing` 恢复,不需要重装 MCP。配对资料不备份浏览器稿件或 Cookie。
39
+ 优先使用 `publish`,一次调用即可:
51
40
 
52
- 服务默认只监听 `127.0.0.1:9647`,可通过 `WRITEDOCK_PORT` 调整。Cookie、稿件与媒体不经过 npm 注册表。MCP 桥接主进程重启后,未完成的本机素材授权需要重新准备,已提交的任务先查询原 request_id,不自动重发。
53
-
54
- `npx -y --prefer-online writedock-mcp@latest --version` 只显示版本,不启动服务或读取配对资料。
41
+ ```json
42
+ {
43
+ "platforms": ["zhihu", "baijiahao", "weibo", "xiaohongshu", "douyin"],
44
+ "article": { "file_path": "/absolute/path/article.md" },
45
+ "post": { "kind": "image", "title": "标题", "content": "正文", "image_paths": ["/absolute/path/1.png"] },
46
+ "request_id": "my_post_20261105_01"
47
+ }
48
+ ```
55
49
 
56
- ## 版本提示
50
+ 扩展按平台选择内容:
57
51
 
58
- 自 v0.4.2 起,MCP 在启动后异步检查 npm latest,随后每 6 小时检查,失败后至少等待 10 分钟再试。查询只访问公开版本信息,不传送配对凭据或稿件,也不会阻塞配对、工具调用或发布任务。
52
+ | 平台 ID | 默认发送 | 说明 |
53
+ |---|---|---|
54
+ | `zhihu` | 文章 | 标题最多 100 字,可内嵌本地 MP4 |
55
+ | `baijiahao` | 文章 | 标题最多 64 字;没有 `cover` 时使用正文第一张图 |
56
+ | `bilibili` | 文章 | 不接独立封面;LV1–3 账号每天只能发 1 篇,删除不退额度 |
57
+ | `weibo` | 有 `post` 发图文或视频,否则发长文章 | 长文章标题最多 32 字;视频必须明确 `weibo_video_creation` |
58
+ | `xiaohongshu` | 有 `post` 发图文或视频,否则发长文 | 长文标题最多 64 字、正文最多 10000 字 |
59
+ | `douyin` | 图文或视频 | 不接文章 |
60
+ | `weixin`、`sohu` | 只保存文章草稿 | 不公开发布 |
59
61
 
60
- `get_connection_status` 返回 `mcp_version`、可用时的 `latest_version`、`update_available`、`update_checked_at`、`update_checking` 及可选 `update_check_error`。运行版本指与扩展实际连接的本机桥接进程;多个 agent 共用端口时,不把新启动客户端的版本误当成仍占用端口的旧服务版本。
62
+ - 用 `modes` 可为微博、小红书指定内容类型,如 `{"weibo": "article"}`。
63
+ - 某个平台未登录、不能接收这份内容或失败时,只跳过该平台,其他平台继续。
64
+ - 不支持的 `cover` 会被忽略,并写入该平台的 `warnings`。标题超长不会被截断,该平台直接失败。
65
+ - 平台依次执行,全部完成通常需要几分钟。同一时间只运行一个任务。
66
+ - 只有用户明确要求发布并指定平台时,才调用发布工具。
61
67
 
62
- 现有 ready/ping 消息附带相同信息,扩展显示版本和更新提示。只有确定 npm 版本更新时才提醒用户重新启动 WriteDock MCP。发布任务进行中只提示,不自动重启、改配置或重新提交。旧扩展忽略新增字段;旧 MCP 未提供版本字段时显示未知。npm 查询失败不影响当前连接。
68
+ `rehearse_publish` 参数相同,但会在点击发布之前停下,也不需要 `request_id`。可能上传图片并留下草稿,结果 `rehearsed` 不代表已发布。
63
69
 
64
- 工具包括:`get_connection_status`、`begin_pairing`、`list_platforms`、`check_auth`、`prepare_article`、`publish_article`、`sync_article`、`prepare_post`、`publish_post`、`get_sync_task`、`list_sync_history`。
70
+ ## 查询结果
65
71
 
66
- 小红书的三种发布方式共用 `platforms: ["xiaohongshu"]`:
72
+ `publish` 立即返回 `task_id`,随后用 `get_sync_task` 查询,直到 `finished: true`。任务结束后,按 `summary` 逐平台告诉用户结果:
67
73
 
68
- | 模式 | 调用 | 说明 |
74
+ | `summary` 分类 | 含义 | agent 应该怎么做 |
69
75
  |---|---|---|
70
- | 写长文 | `publish_article` | Markdown/HTML/稿件文件,支持正文图片,原生自动排版后发布;标题最多 64 字、正文最多 10000 字,不接独立 `cover`、内嵌视频或长文话题 |
71
- | 普通图文 | `publish_post`,`kind: "image"` | `image_paths`、标题和正文;首图作封面 |
72
- | 独立视频 | `publish_post`,`kind: "video"` | `video_path`、标题和简介;不传 `cover_path` 时使用平台自动生成的第一帧封面 |
73
-
74
- Agent 先看 `list_platforms` 返回的 `publishModes`、`tools`、`modeOptions` 再选入口;直接传内容即可,不要求先准备本机预览。沿用已有工具名称、参数及桥接协议,已有通用 `publish_article` / `publish_post` 的 MCP 无需因小红书增加长文而重装。工具说明源码同步更新,未改用户安装。普通图文/视频的标题、数量、格式和正文长度还受原生控件限制,不能截断或丢图后继续提交。
75
-
76
- 小红书仅在匹配本任务的 `POST /web_api/sns/v2/note` 返回 HTTP 成功、`success: true`、`result: 0` 和有效笔记 ID 时确认 `submitted`。长文需先核对排版前的完整正文与插图,再核对生成图片的上传及最终长文标记。验证码、协议、封面或设置需人工处理时,Agent 把 `user_actions` 的原因和原稿件链接交给用户,在已打开的同一页处理并手动发布;不重发、不换请求 ID。本次仅完成源码接入,未运行测试、构建、打包或实际投稿。
76
+ | `submitted` | 平台已接受提交,可能还在审核 | 汇报结果和链接 |
77
+ | `draft_saved` | 已保存草稿 | 汇报,说明未公开发布 |
78
+ | `rehearsed` | 演练结束,未发布 | 不得说已发布 |
79
+ | `not_logged_in` | 未登录,未执行 | 请用户登录后,用新 `request_id` 只重发这些平台 |
80
+ | `login_unconfirmed` | 无法确认登录状态,未执行 | 请用户检查后再提交 |
81
+ | `waiting_verification` | 正在等用户完成验证码 | 立即转告 `user_actions` 的提示和链接,继续查询 |
82
+ | `needs_user_action` | 需要用户在页面上处理 | 转告原因和链接,不重发 |
83
+ | `unknown` | 结果未确认,可能已经发布 | 让用户核对,**不要重发** |
84
+ | `failed` | 未能完成 | 汇报 `error`,必要时提供 `diagnostics` |
77
85
 
78
- 知乎用 `publish_article` 直接发布 Agent 写好的 Markdown/HTML,参数为 file_path/markdown/html 三选一(或已准备的 draft_id)、platforms: ["zhihu"] 和稳定 request_id。可直接提交,无需在扩展编写,也无需先调用 prepare_article。支持本地 PNG/JPEG/GIF/WebP 正文图片;稿件中的 `<video src="./demo.mp4"></video>` 可插入本地 MP4,路径按稿件目录或 base_directory 解析。每篇最多 5 个视频、总量 512 MB;标题最多 100 字,独立封面和话题暂未接入。视频是文章内嵌,不是独立视频投稿。
86
+ 验证码由用户手动完成,agent 和扩展都不代做。用户完成后任务会自动更新,不需要重新提交。
79
87
 
80
- 扩展自动完成知乎内部草稿准备,再触发页面原生发布,让平台生成动态签名;仅在发布接口返回 code=0 且文章 ID 匹配时确认 submitted。未知结果返回 unknown,不自动重发。返回 task_id 后调用 get_sync_task 查询。源码接入尚未运行测试或真实投稿。
88
+ 相同 `request_id` 和相同内容不会重复提交;内容变化必须换新 ID。部分平台失败时,只针对失败的平台用新 ID 重发,`unknown` 的平台不要重发。
81
89
 
82
- 百家号同样使用 `publish_article`,必须提供 cover 封面(本地图片、HTTP(S) 地址或 data URI),当前接收 64 字以内标题,暂不接文章内视频。平台要求旋转验证码、其他验证码或调整封面时,任务返回 needs_user_action,顶层 requires_user_action 和 user_actions 给出原因、原稿件链接。Agent 必须把它们告诉用户,优先让用户在扩展已打开的页面完成验证并手动发布,不解验证码、不重发、不换 ID。人工接管不会被标记为提交成功,原任务也不会自动确认用户之后的操作。
90
+ ## 工具
83
91
 
84
- 微博长文章同样用 `publish_article`,platforms: ["weibo"];当前接收 32 字以内标题,正文支持图片、封面可选。无独立封面时使用本篇第一张正文图片,没有正文图片则需显式提供 cover。视频 URL 尚未接入。验证码、原创协议或发布设置无法核对时转人工处理;不自动关注官方账号、声明原创或同步新浪新闻。
92
+ | 工具 | 用途 |
93
+ |---|---|
94
+ | `get_connection_status` | 连接状态、运行版本和更新提示 |
95
+ | `begin_pairing` | 仅在一键连接不可用时使用:生成一次性配对码 |
96
+ | `list_platforms`、`check_auth` | 平台能力和登录状态 |
97
+ | `publish`、`rehearse_publish` | 一次调用发多平台,以及演练 |
98
+ | `get_sync_task`、`list_sync_history` | 任务结果和最近 25 次记录 |
99
+ | `prepare_article`、`prepare_post` | 可选:把稿件存到扩展里预览 |
100
+ | `publish_article`、`publish_post`、`sync_article` | 旧版按类型发布,继续可用 |
101
+ | `rehearse_article`、`rehearse_post` | 旧版按类型演练 |
85
102
 
86
- 微信公众号、搜狐号暂用 `sync_article` 保存草稿。B站专栏改用 `publish_article`,平台 ID 为 `bilibili`,`platforms: ["bilibili"]` 接收 Agent 的 Markdown/HTML/文件,支持正文图片。扩展使用新版原生编辑器生成实时签名、上传图片并直接提交;不经过旧版专栏草稿接口。B站暂不接视频、视频卡片、音频或独立 cover,标题按页面实际限制校验。`code=-352` 或验证码请求返回 needs_user_action 和当前原稿件页链接,让用户在已打开的标签页验证并手动发布,Agent 不重新提交。只有匹配的 create/opus 返回 code=0 及有效字符串 dyn_id_str 才报告 submitted。B站接入沿用现有工具和平台字符串参数,不增加 MCP 工具、参数或协议,无需因此重装 MCP。微博长文章保留并接入直发。知乎、百家号、微博长文章、B站专栏旧草稿请求不会自动公开发布,需显式使用 publish_article。实际能力以 list_platforms 的 action、publishModes、capabilities、coverRequired 为准,publish_article 的平台入参不固定枚举。
103
+ 文章来源支持 `file_path`、`markdown`、`html` 三选一,图片支持 PNG/JPEG/GIF/WebP,单张 8 MB,整篇 24 MB。图文图片单张 20 MB、总量 100 MB;视频支持 MP4/MOV/WebM,最大 512 MB。实际限制还以平台页面为准。
87
104
 
88
- 小红书、抖音、微博普通图文/独立视频用 `prepare_post` / `publish_post`。字段包括 kind(image/video)、title、content、image_paths、video_path、cover_path、tags、base_directory。路径由 agent 自动准备。图片单张 20 MB、总量 100 MB;视频最大 512 MB,支持 MP4/MOV/WebM,具体格式和数量以平台上传控件为准。视频封面可选,图文封面使用第一张图片。普通微博标题放在正文首行,最多 18 张图片;微博视频封面最多 5 MB、标题最多 30 个汉字或 60 个半角字符。
105
+ ## 已知限制
89
106
 
90
- 抖音 `platforms: ["douyin"]` 直接复用 MultiPost-Extension 的公开页面流程,用户不需要先操作发布或抓 HAR。图文用 `kind: "image"`,独立视频用 `kind: "video"`,可选 `cover_path`。当前图文话题最多 4 个、视频最多 5 个;标题、全文和话题写入后会完整核对。仅接即时投稿,工具未提供定时发布或横竖两套封面参数。抖音以本次操作新增的原生成功提示确认 `submitted`,`list_platforms.confirmation` 为 `native_page_message`;未核对最终 HTTP 业务回执,跳转本身不算成功,没有明确提示则返回 `unknown`。验证码、声明、协议和封面问题返回 `needs_user_action`,Agent 交出原投稿页和原因,让用户在同一页处理并手动发布,不重发。本次沿用现有 `publish_post` 及桥接协议,已有此工具的 MCP 无需因此重装;仅改源码,未运行测试、构建、打包或修改用户安装。
107
+ - 发布依赖平台页面,平台改版可能导致失败。失败结果的 `diagnostics` 含阶段、页面结构和请求路径,不含 Cookie、输入内容和 URL 查询参数。
108
+ - 抖音只能通过页面提示确认结果,没有接口回执,遇到验证码时直接交给用户。
109
+ - 除 B站外,其他平台的验证码流程尚未在真实验证码上验证过。
110
+ - 视频发布已走到发布前,但尚未真实发布验证。
111
+ - `submitted` 不跟踪之后的审核结果。
91
112
 
92
- 微博视频必须明确 `weibo_video_creation: original | secondary | repost`(原创/二创/转载),不得默认声明原创。此参数会保存到本机稿件并参与请求去重。若需补充来源、原视频关联、内容声明、分类、封面或验证码,返回 needs_user_action 及原投稿页链接,Agent 告诉用户在已打开的页面手动处理并发布,不重新提交。只有匹配本任务的 statuses/update 成功回执才确认微博 submitted;视频回执可能不带帖子 ID,不因此编造 ID。微博长文章继续用 publish_article,三种格式共用 weibo 这个平台 ID。
113
+ ## 更新
93
114
 
94
- 先用 `prepare_post` 存本机预览,返回 draft_id;再向 `publish_post` 传 draft_id、request_id 和 platforms(xiaohongshu/douyin/weibo)。也可直接向 publish_post 提供全部内容与素材。该工具会打开平台原生页面并点击发布,必须以用户明确的发布要求和目标平台为依据。publish_post 的平台参数改为由扩展实际能力校验,不在 MCP 中固定枚举。
115
+ - **MCP:** `--prefer-online` 在每次启动时检查新版,运行中的进程不会自动替换,重启 agent 即可。发布任务进行中不要重启。
116
+ - **扩展:** 新版 MCP 内置更新的扩展时,扩展的「连接 agent」页会出现「更新扩展」。用户点一下,MCP 覆盖扩展目录,扩展自行重新加载;发布任务进行中不能更新。
95
117
 
96
- 所有提交都需要稳定的 `request_id`,返回 `task_id` 后用 `get_sync_task` 跟进。同 ID 的相同请求复用原任务,不能用同 ID 发布不同内容。Agent 只使用 WriteDock MCP,不依赖浏览器或 Playwright 工具。打开平台原生投稿页及操作由扩展完成。任务返回 finished、next_action、results、agent_instructions;poll_task 按原 ID 继续查询,report_result 汇报逐平台结果和链接。submitted/published 后不再打开网站验证;验证码、图形验证、unknown 或 interrupted 时,把 user_actions 中的原因和链接交给用户自行点击处理,不自动换 ID 重试。submitted 表示平台接受提交,是否公开展示以平台审核为准。
118
+ 连接资料保存在用户数据目录的 `identity-端口.json`:
97
119
 
98
- 本地视频不嵌入 MCP 消息,而是通过随机授权、绑定具体文件的本机 HTTP 范围请求分块传输。授权两小时有效,MCP 桥接主进程重启后重新准备素材;文件变更会拒绝读取。从旧版使用新增 publish_article 或 prepare_post/publish_post 工具时,原位升级本 MCP 一次并重启,保留 agent 配置和已有配对资料。
120
+ - macOS:`~/Library/Application Support/WriteDock/mcp/`
121
+ - Windows:`%LOCALAPPDATA%/WriteDock/mcp/`
122
+ - Linux:`${XDG_DATA_HOME:-~/.local/share}/writedock/mcp/`
99
123
 
100
- 本次微博接入新增创作类型参数,并放开 publish_post 的固定平台枚举,启用新版时需原位更新 MCP 程序一次。后续同类平台增删由扩展校验,避免每次改平台枚举;保留安装位置、启动配置和配对资料,无需卸载重装。本版本提供可通过 npx 启动的构建包,未进行真实平台投稿验证。
124
+ 卸载重装扩展后,在扩展里再点一次「连接」即可,不需要重装 MCP。`npx -y writedock-mcp@latest --version` 只显示版本。
101
125
 
102
- 对应源码位于 npm 包内 `source/`,可在该目录安装开发依赖并运行构建命令。第三方依赖许可见 `THIRD_PARTY_NOTICES.txt`,本服务遵循 GPL-3.0-only,见 `LICENSE` 与 `NOTICE.md`。
126
+ 对应源码位于包内 `source/`。本服务遵循 GPL-3.0-only,见 `LICENSE`、`NOTICE.md` 和 `THIRD_PARTY_NOTICES.txt`。
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.