Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/web-app-naming.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Registry 安装交接统一使用 `app_origin`,继续接收旧 `client_origin` 链接;拒绝冲突目标,目录导航和安装返回保持同一 Web App。
2 changes: 1 addition & 1 deletion .changeset/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changesets

Changesets owns version bumps and changelog entries for the independently
released client-web Extension Host Runtime. Add a changeset to any pull request
released Web app Extension Host Runtime. Add a changeset to any pull request
that changes its published behavior.

Python package versions and changelogs are managed by Towncrier instead.
7 changes: 7 additions & 0 deletions .changeset/web-app-runtime-name.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@inkcre/extension-runtime-web': patch
---

将浏览器 Extension Runtime 更名为 `@inkcre/extension-runtime-web`,目录、构建及独立发布产物使用 Web App 命名;公开运行时 API 和已发布旧名称产物保持兼容。

同时将 Runtime 的直接 Zod 依赖升级到 4.6.6,修复超大集合验证导致内存耗尽的问题(GHSA-mrhx-c7xc-m3w5)。
22 changes: 13 additions & 9 deletions .github/workflows/packages-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ jobs:

- name: Verify managed package versions
run: |
web_runtime_version=$(node -p 'require("./runtimes/client-web/package.json").version')
web_runtime_version=$(node -p 'require("./runtimes/web/package.json").version')
pdm run check:releases
grep -F -m1 "## $web_runtime_version" runtimes/client-web/CHANGELOG.md
grep -F -m1 "## $web_runtime_version" runtimes/web/CHANGELOG.md

- name: Build independent package assets
env:
SOURCE_DATE_EPOCH: '315532800'
run: |
mkdir -p release-assets/toolkit release-assets/runtime-core-py release-assets/runtime-client-web
mkdir -p release-assets/toolkit release-assets/runtime-core-py release-assets/runtime-web
pdm build --project toolkit --dest "$GITHUB_WORKSPACE/release-assets/toolkit"
pdm build --project runtimes/core-py --dest "$GITHUB_WORKSPACE/release-assets/runtime-core-py"
pnpm --filter @inkcre/extension-runtime-client-web build
pnpm --filter @inkcre/extension-runtime-client-web pack \
--pack-destination "$GITHUB_WORKSPACE/release-assets/runtime-client-web"
pnpm --filter @inkcre/extension-runtime-web build
pnpm --filter @inkcre/extension-runtime-web pack \
--pack-destination "$GITHUB_WORKSPACE/release-assets/runtime-web"

- name: Create missing independent package releases
env:
Expand Down Expand Up @@ -192,6 +192,10 @@ jobs:
else
echo "Core Python Runtime has pending release fragments; publication waits for its Version PR." >> "$GITHUB_STEP_SUMMARY"
fi
release_package runtime-client-web \
"$(node -p 'require("./runtimes/client-web/package.json").version')" \
release-assets/runtime-client-web
if ! find .changeset -maxdepth 1 -name '*.md' ! -name README.md | grep -q .; then
release_package runtime-web \
"$(node -p 'require("./runtimes/web/package.json").version')" \
release-assets/runtime-web
else
echo "Web Runtime has pending Changesets; publication waits for its Version PR." >> "$GITHUB_STEP_SUMMARY"
fi
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Package release intent uses the ecosystem-native release tool:
`pdm run towncrier create --config towncrier.toml --dir toolkit 123.added.md`.
The root `.changes/` belongs to the Registry service; `toolkit/.changes/` and
`runtimes/core-py/.changes/` belong to those independently versioned packages.
- Client Web Runtime changes use `pnpm changeset`. Changesets creates the
- Web Runtime changes use `pnpm changeset`. Changesets creates the
protected-main Version PR and updates its version and changelog.

The four versions are independent. A Python Version PR consumes pending
Expand Down
2 changes: 1 addition & 1 deletion docs/30-unit-tdd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ generated contracts and build checks remain executable authority.
- [Registry Web](registry-web.md): discovery, publisher workspace, and design consumption.
- [Extension Developer Toolkit](developer-toolkit.md)
- [Core Python Extension Host Runtime](core-python-runtime.md)
- [Client Web Extension Runtime](client-web-runtime.md):浏览器生命周期、精确 Peer 管理与发行文档消费。
- [Web Extension Runtime](web-runtime.md):浏览器生命周期、精确 Peer 管理与发行文档消费。

Shared product behavior and cross-unit Host contracts remain in the InKCre
documentation Hub rather than being copied here.
21 changes: 14 additions & 7 deletions docs/30-unit-tdd/registry-web.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ version. Missing or withdrawn versions return a human-readable 404. Existing
`/v1`, `/simple`, `/packages`, and Module Federation asset paths retain their
machine-facing semantics.

The detail page links to client-web's `/extensions?install=<name>&distribution=<kind>&version=<exact>`.
The detail page links to Web app's `/extensions?install=<name>&distribution=<kind>&version=<exact>`.
The Registry neither reads deployment state nor installs the Release. When a
client-web page opens the Registry, it passes only its Web origin as
`client_origin`; the catalog preserves it through search, filters, and version
Web app page opens the Registry, it passes only its Web origin as
`app_origin`; the catalog preserves it through search, filters, and version
links. The Registry accepts HTTPS origins (and local HTTP for development),
then constructs a fixed client-web path and displays the destination host. A
then constructs a fixed Web app path and displays the destination host. A
direct Registry visit defaults to `https://app.inkcre.dev`. The return query
contains the Extension name, distribution and exact version; client-web reads the
contains the Extension name, distribution and exact version; Web app reads the
Release anew from its own configured Registry and requires confirmation.

The deprecated `client_origin` query remains an input alias for older Apps and
bookmarks. Both names pass the same origin validation; when both are supplied,
the normalized origins must match or the request fails with `400`. The Registry
emits only `app_origin` in new navigation links and forms. During mixed deployment,
Web Apps may send both names with the same value so an older Registry still
returns to the chosen App. This alias carries no credentials or Peer identity.

The UI does not invent descriptions, popularity, trust badges, compatibility
verdicts, installation state, or download counts that Registry does not own.
Package inspection, copying an ID, and opening the install link do not install
Expand Down Expand Up @@ -87,9 +94,9 @@ Remote previews run the same CPython image with an isolated PostgreSQL branch an
resource lifecycle and source identity belong to the delivery controller; see
[Pull-Request Previews](../40-deployment/pull-request-previews.md).

Registry follows the client-web product surface: the 32px geometric InKCre logo,
Registry follows the Web app product surface: the 32px geometric InKCre logo,
InkHeader spacing and typography, square InkButton-style controls, bordered
extension rows, and compact metadata. `templates/brand.html` contains the SVG
from client-web's `apps/client-web/public/logo/32.svg`. Page content consists of
from Web app's `apps/web/public/logo/32.svg`. Page content consists of
catalog, release metadata, and publishing controls; it has no marketing hero,
illustration, promotional footer, or persistent tutorial panels.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Client Web Extension Runtime
# Web Extension Runtime

`@inkcre/extension-runtime-client-web` 是独立发行的浏览器 Runtime。Host SDK `@inkcre/core` 拥有部署持久化模型、Peer 发现、传输和错误分类;Runtime 拥有 Extension 生命周期编排、管理命令消费和 Registry 发行读取。应用继续决定操作当前浏览器 Runtime、在线远端 Host,还是只改变部署中的 desired state。
`@inkcre/extension-runtime-web` 是独立发行的浏览器 Runtime。Host SDK `@inkcre/core` 拥有部署持久化模型、Peer 发现、传输和错误分类;Runtime 拥有 Extension 生命周期编排、管理命令消费和 Registry 发行读取。应用继续决定操作当前浏览器 Runtime、在线远端 Host,还是只改变部署中的 desired state。

`listAdvertisedExtensionManagementPeers()` 读取 `PeerManager.listLive()`,只保留宣告精确管理 capability 的 Peer。宣告不是协议支持、路由就绪或运行证明。`manageExtensionOnPeer(peerId, command)` 使用调用者指定的精确 Peer 和固定 capability,发送一次 select、enable、disable 或 patch_config 命令。它不替换目标、不重试、不改写 PeerManager 的传输失败分类;管理 HTTP 错误及无效业务响应不附带可能回显配置凭据的原始正文或校验详情。返回的运行投影区分持久化选择与实际加载结果。

Expand All @@ -10,12 +10,25 @@

Runtime 的 Core peer dependency 以实际类型与构建验证为准,不使用 ambient SDK stub。新公共 API 通过 Changesets 声明 minor 发行意图,源包版本由正式版本流程修改。

Core SDK 开发依赖固定官方 `core-v0.4.2` GitHub Release 的预构建 tgz,冻结锁文件验证下载完整性。该产物同时包含 ESM 和类型声明,type-check 与 build 直接消费它,不检出 client-web 源码、不安装生产者 workspace,也不需要私有 UI 包凭据。仓库门禁通过真实 SDK 和本地 HTTP 运行 `check-boundaries.mjs`;正式 Runtime 包由本仓独立版本流程发布,Core 的 peer dependency 要求至少 0.4.2,以支持宿主声明的开放分发标识。
Core SDK 开发依赖固定官方 `core-v0.4.2` GitHub Release 的预构建 tgz,冻结锁文件验证下载完整性。该产物同时包含 ESM 和类型声明,type-check 与 build 直接消费它,不检出 Web app 源码、不安装生产者 workspace,也不需要私有 UI 包凭据。仓库门禁通过真实 SDK 和本地 HTTP 运行 `check-boundaries.mjs`;正式 Runtime 包由本仓独立版本流程发布,Core 的 peer dependency 要求至少 0.4.2,以支持宿主声明的开放分发标识。

Runtime 使用 Registry v2 原生坐标查询 MF,公开 catalog 可明确选择 distribution;返回坐标和唯一原生关联均须匹配。安装将共享 Extension 身份与当前 Peer 的精确参与选择分别保存,enable/startup 读取当前 Peer 选择,不追随 latest,不修改其他 Peer 或清理业务 state。旧未知分发仅用当前浏览器支持的 MF 查询同一精确版本,缺失时失败而不替换版本。

管理能力为 `core.extension.management.v2`。`select` 明确指定分发与版本,`status` 返回目标 Peer 的能力和实际运行事实;所有响应采用 `{peer_id,supported_distributions,extensions}`,逐行包含精确选择和实际 loaded_version/running。Runtime SDK 校验目标身份与每行身份,保留原 PeerManager 的传输失败分类,不能由持久化 enabled 推断正在运行。删除参与记录保留部署配置和业务 state。

显式 enable/disable 先按同一 Host、同一 Extension 的命令顺序保存 enabled 意图,再串行执行模块生命周期。disable 在等待在途启动之前保存 false,并在资源清理完成后返回。startup 只恢复已有意图,成功或失败都不反写 enabled;初始化失败保留意图及错误,允许后续恢复重试。

恢复在加载前及异步 initialize/activate 后重新读取精确参与选择。若 enabled 被撤回、分发或版本改变,迟到的模块会执行 dispose,不能登记为 running。shutdown 等待在途恢复与命令完成并清理模块。同 Host 的串行队列不锁住其他已准入客户端对共享数据库的写入,因此离线意图更新不等于瞬时、原子的进程切换;这些客户端的修改通过重新读取被识别。
恢复在加载前及异步 initialize/activate 后重新读取精确参与选择。若 enabled 被撤回、分发或版本改变,迟到的模块会执行 dispose,不能登记为 running。shutdown 等待在途恢复与命令完成并清理模块。同 Host 的串行队列不锁住其他已准入 Peer对共享数据库的写入,因此离线意图更新不等于瞬时、原子的进程切换;这些 Peer 的修改通过重新读取被识别。

## 名称迁移与交付

源码目录为 `runtimes/web`,包名为 `@inkcre/extension-runtime-web`。正式发布使用
`runtime-web-v<version>` 标签与 `inkcre-extension-runtime-web-<version>.tgz`,Changeset
由 Version PR 消费后才发布;本次重命名不改变 Runtime 导出 API、Host SDK 要求或
`module_federation` Distribution 标识。

已发布的 `@inkcre/extension-runtime-client-web` 包、`runtime-client-web-v0.4.2`
标签与对应 TGZ 保持不可变。新名称包发布前,消费者可把新的 dependency/import key
指向该精确旧 TGZ,锁定其完整性;这只是安装别名,不能描述为新包已经发布。新名称正式产物
可用后,消费者再替换依赖来源。旧 Host 和 Extension 继续消费已有产物,不要求同时升级。
Registry 的 `app_origin` 交接及旧参数兼容由 [Registry Web](registry-web.md) 拥有。
2 changes: 1 addition & 1 deletion docs/40-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ documents own the operational intent, safety boundaries, failure behavior, and
recovery facts that those files cannot express clearly enough.

Python release intent belongs to the Registry, Toolkit or Core Runtime
`.changes/` directory and is prepared with Towncrier. Client Web Runtime release
`.changes/` directory and is prepared with Towncrier. Web Runtime release
intent belongs to `.changeset/` and is prepared with Changesets. Generated
Version PRs run the same required repository check through an explicit workflow
dispatch; package publication waits for the prepared version on protected
Expand Down
2 changes: 1 addition & 1 deletion docs/_shared
Submodule _shared updated 59 files
+6 −6 .github/workflows/pages-deploy.yml
+2 −2 .github/workflows/pages-preview-cleanup.yml
+3 −3 .github/workflows/pages-preview.yml
+2 −2 .github/workflows/website-check.yml
+6 −0 10-prd/behavior/capabilities.md
+27 −0 10-prd/behavior/observability.md
+4 −0 10-prd/behavior/rules-and-invariants.md
+4 −0 10-prd/behavior/workflows.md
+3 −3 10-prd/domain-structure/cross-domain-interactions.md
+1 −1 10-prd/domain-structure/derived-boundaries.md
+9 −4 10-prd/glossary.md
+1 −0 10-prd/index.md
+145 −0 20-product-tdd/core-app-boundary.md
+4 −0 20-product-tdd/cross-unit-contracts.md
+3 −3 20-product-tdd/extension-documentation-hosting.md
+2 −2 20-product-tdd/extension-release-and-installation.md
+4 −4 20-product-tdd/feature-retrieval-and-media-interpretation.md
+1 −1 20-product-tdd/graph-navigation-retrieval.md
+6 −4 20-product-tdd/knowledge-capability-contract.md
+6 −4 20-product-tdd/local-files-contract.md
+58 −8 20-product-tdd/observability-contract.md
+1 −1 20-product-tdd/peer-database-runtime-contract.md
+3 −3 20-product-tdd/system-state-and-authority.md
+8 −2 20-product-tdd/unit-topology.md
+1 −0 docs/index.md
+5 −5 website/README.md
+3 −3 website/content/en/developer/architecture.md
+1 −1 website/content/en/developer/contributing.md
+2 −2 website/content/en/developer/index.md
+2 −2 website/content/en/getting-started.md
+1 −1 website/content/en/guide/collect.md
+3 −8 website/content/en/guide/connect-cli.md
+2 −2 website/content/en/guide/connect.md
+1 −1 website/content/en/guide/daily-use.md
+1 −1 website/content/en/guide/first-source.md
+1 −1 website/content/en/guide/schedules.md
+2 −2 website/content/en/guide/search.md
+1 −1 website/content/en/guide/sources/mail.md
+1 −1 website/content/en/guide/sources/memos.md
+1 −1 website/content/en/guide/sources/rss.md
+4 −4 website/content/en/guide/sources/twitter.md
+1 −1 website/content/en/guide/troubleshooting.md
+1 −1 website/content/en/index.md
+8 −8 website/content/en/self-hosted/custom.md
+1 −1 website/content/en/self-hosted/index.md
+1 −0 website/content/public/_redirects
+ − website/content/public/images/web/collection-job.png
+ − website/content/public/images/web/create-source-type.png
+ − website/content/public/images/web/info-base-graph.png
+ − website/content/public/images/web/lexical-search.png
+ − website/content/public/images/web/mail-content.png
+ − website/content/public/images/web/memos-setup.png
+ − website/content/public/images/web/peers-overview.png
+ − website/content/public/images/web/settings-overview.png
+ − website/content/public/images/web/source-schedule.png
+ − website/content/public/images/web/sources-overview.png
+ − website/content/public/images/web/twitter-setup.png
+2 −2 website/package.json
+350 −404 website/pnpm-lock.yaml
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
"node": "22.x"
},
"scripts": {
"build": "SOURCE_DATE_EPOCH=315532800 pdm build --no-sdist --dest \"$INIT_CWD/dist\" && SOURCE_DATE_EPOCH=315532800 pdm build --project toolkit --no-sdist --no-clean --dest \"$INIT_CWD/dist\" && SOURCE_DATE_EPOCH=315532800 pdm build --project runtimes/core-py --no-sdist --no-clean --dest \"$INIT_CWD/dist\" && pnpm --filter @inkcre/extension-runtime-client-web build",
"build": "SOURCE_DATE_EPOCH=315532800 pdm build --no-sdist --dest \"$INIT_CWD/dist\" && SOURCE_DATE_EPOCH=315532800 pdm build --project toolkit --no-sdist --no-clean --dest \"$INIT_CWD/dist\" && SOURCE_DATE_EPOCH=315532800 pdm build --project runtimes/core-py --no-sdist --no-clean --dest \"$INIT_CWD/dist\" && pnpm --filter @inkcre/extension-runtime-web build",
"changeset": "changeset",
"check": "pnpm release:check && pnpm web:check && pnpm contracts:check && pnpm format:check && pnpm lint && pnpm type-check && pnpm build && pnpm --filter @inkcre/extension-runtime-client-web exec node check-boundaries.mjs && pnpm packages:check && pnpm registry:check",
"check": "pnpm release:check && pnpm web:check && pnpm contracts:check && pnpm format:check && pnpm lint && pnpm type-check && pnpm build && pnpm --filter @inkcre/extension-runtime-web exec node check-boundaries.mjs && pnpm packages:check && pnpm registry:check",
"packages:check": "pdm run python scripts/check_packages.py",
"contracts:check": "pdm run python scripts/generate_contracts.py --check && pdm run python runtimes/core-py/scripts/generate_contracts.py --check && pnpm --filter @inkcre/extension-runtime-client-web check:bindings",
"contracts:generate": "pdm run python scripts/generate_contracts.py && pdm run python runtimes/core-py/scripts/generate_contracts.py && pnpm --filter @inkcre/extension-runtime-client-web generate:bindings",
"contracts:check": "pdm run python scripts/generate_contracts.py --check && pdm run python runtimes/core-py/scripts/generate_contracts.py --check && pnpm --filter @inkcre/extension-runtime-web check:bindings",
"contracts:generate": "pdm run python scripts/generate_contracts.py && pdm run python runtimes/core-py/scripts/generate_contracts.py && pnpm --filter @inkcre/extension-runtime-web generate:bindings",
"format": "pdm run ruff format . && prettier --write .",
"format:check": "pdm run ruff format --check . && prettier --check .",
"lint": "pdm run ruff check .",
"registry:check": "pdm run python scripts/check_registry.py",
"release:check": "pdm run check:releases ${RELEASE_CHECK_ARGS:-} && node scripts/check_changesets.mjs",
"release:version": "changeset version",
"type-check": "pdm run pyright && pnpm --filter @inkcre/extension-runtime-client-web type-check",
"type-check": "pdm run pyright && pnpm --filter @inkcre/extension-runtime-web type-check",
"web:build": "sass --pkg-importer=node --no-source-map --style=compressed web/registry.scss src/inkcre_extension_registry/service/static/registry.css",
"web:check": "node --check src/inkcre_extension_registry/service/static/registry.js && node scripts/check-web-styles.mjs",
"db:migrate": "pdm run tortoise -c inkcre_extension_registry.migration_config.TORTOISE_ORM upgrade",
Expand Down
26 changes: 13 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
- runtimes/client-web
- runtimes/web

autoInstallPeers: false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @inkcre/extension-runtime-client-web
# @inkcre/extension-runtime-web

## 0.4.2

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@inkcre/extension-runtime-client-web",
"name": "@inkcre/extension-runtime-web",
"version": "0.4.2",
"description": "InKCre Client Web Extension Host Runtime",
"description": "InKCre Web Extension Host Runtime",
"type": "module",
"files": [
"dist",
Expand All @@ -27,7 +27,7 @@
},
"dependencies": {
"semver": "7.8.5",
"zod": "4.1.12"
"zod": "4.6.6"
},
"peerDependencies": {
"@inkcre/core": ">=0.4.2 <0.5.0",
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class ExtensionManager<T extends WebExtensionModule = WebExtensionModule>
return current
}
await handle.activate()
// Other admitted clients may change a sleeping Peer directly in the shared store.
// Other admitted Peers may change a sleeping Peer directly in the shared store.
// A local queue does not claim ownership of their durable intent.
current = await ExtensionParticipationModel.get(peerId, name)
if (!this.#matches(current, selected)) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading