Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
368f990
docs(rfc): propose plugin interfaces
jasper-yl Nov 8, 2026
647236a
docs(rfc): number plugin interfaces RFC as 2549
jasper-yl Nov 8, 2026
a542810
docs(rfc): link plugin interfaces RFC to PR 2549
jasper-yl Nov 8, 2026
8fc2bbc
feat(plugins): call Artifact plugins through the Supervisor with a co…
jasper-yl Nov 8, 2026
4a3abf3
feat(examples): rebuild Atomic Memory as an Artifact plugin
jasper-yl Nov 8, 2026
7f41b07
chore(plugins): pass the contract, upgrade review and type checks
jasper-yl Nov 8, 2026
01afdab
feat(plugins): declare plugins in code and reuse the Source and Artif…
jasper-yl Nov 9, 2026
90af4ce
feat(artifacts): serve merge, forget, restoration and tags for every …
jasper-yl Nov 9, 2026
2e34615
chore(desktop): regenerate the Desktop contract
jasper-yl Nov 9, 2026
9565419
fix(plugins): bind the generic merge routes in Codex and accept strin…
jasper-yl Nov 9, 2026
11de9a1
docs(rfc): route user changes through plugin host processes and add e…
jasper-yl Nov 10, 2026
0fcf893
docs(rfc): link the plugin hot reload RFC 2579
jasper-yl Nov 10, 2026
191596b
docs(rfc): address review on plugin storage keys and unchanged writes
jasper-yl Nov 11, 2026
fb73103
docs(rfc): keep the plugin interfaces RFC at the contract level
jasper-yl Nov 11, 2026
5378e39
docs(rfc): start plugin host processes once the plugin loads
jasper-yl Nov 11, 2026
7b726ae
feat(plugins): run user changes in core-managed plugin host processes
jasper-yl Nov 11, 2026
8f0ab62
feat(examples): add a knowledge base plugin that validates plugin routes
jasper-yl Nov 11, 2026
96c22ce
fix(examples): read knowledge base documents through a typed content …
jasper-yl Nov 11, 2026
e908927
feat(plugins): serve plugin pages, generic create and Source writes, …
jasper-yl Nov 12, 2026
7c2b2a9
feat(examples): add a Dashboard page and question answering to the kn…
jasper-yl Nov 12, 2026
162b16e
feat(examples): choose parsers per batch, parse PDFs, and edit chunks…
jasper-yl Nov 12, 2026
e025aae
feat(examples): withdraw knowledge base uploads that still wait for a…
jasper-yl Nov 12, 2026
9fe4e65
fix(examples): show whether knowledge base uploads wait for a parser
jasper-yl Nov 12, 2026
658e5a9
fix(examples): confirm deletions in place and withdraw uploads with o…
jasper-yl Nov 12, 2026
90251eb
feat(examples): record knowledge base chunk edits as Sources
jasper-yl Nov 12, 2026
e5d50b7
feat(plugins): deliver each consumed Source type in its own Projection
jasper-yl Nov 12, 2026
47892f9
refactor(examples): cover plugin pages with a minimal plugin and keep…
jasper-yl Nov 12, 2026
38bbabf
fix(plugins): start every loaded plugin's host process at load, as th…
jasper-yl Nov 12, 2026
d5e048c
docs(rfc): align the plugin interfaces RFC with the implemented model…
jasper-yl Nov 12, 2026
2d03a6e
docs(develop): add a plugin writing guide
jasper-yl Nov 12, 2026
6fc0e8f
fix(plugins): list only this Server's loaded plugin families in capab…
jasper-yl Nov 12, 2026
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
2 changes: 1 addition & 1 deletion desktop/src-tauri/src/transport/operations.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contractSha256": "0f6befcd87645b83e63ea6393ba57002387302b4e53cf85fc474a218292f4104",
"contractSha256": "8106da3063aaad228868fbe70e870f6c74959483949ace87610433fd9463f626",
"operations": {
"get_liveness": {
"method": "GET",
Expand Down
477 changes: 462 additions & 15 deletions desktop/ui/src/generated/api.d.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion desktop/ui/src/generated/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

// Generated from openapi/powercontext.yaml. Do not edit.
export const contractSha256 = "0f6befcd87645b83e63ea6393ba57002387302b4e53cf85fc474a218292f4104";
export const contractSha256 = "8106da3063aaad228868fbe70e870f6c74959483949ace87610433fd9463f626";
export const operations = {
"get_liveness": {
"method": "GET",
Expand Down
1 change: 1 addition & 0 deletions docs/en/docs/develop/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Choose an [interface](interfaces.md) for your application: the async Python Clie
Server, while the Core SDK supports in-process composition. MCP exposes a curated subset for Agents.

- [HTTP behavior](http-api.md): authentication, request IDs, errors, and concurrency.
- [Write a plugin](plugins.md): generate your own Artifacts, define Source types, and provide APIs and Dashboard pages with plugins.
- [HTTP API](/api): generated endpoints and schemas.
- [Python API](/en/modules): generated Python documentation.
- [Python Agent frameworks](../integrations/index.md#python-agent-frameworks): community adapters with their own lifecycles.
3 changes: 2 additions & 1 deletion docs/en/docs/develop/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"index",
"api-quickstart",
"interfaces",
"http-api"
"http-api",
"plugins"
]
}
372 changes: 372 additions & 0 deletions docs/en/docs/develop/plugins.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/en/docs/operate/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ still occupies an HTTP slot until it finishes; reserve other slots for concurren
| `POWERCONTEXT_SERVER_HTTP_HOST` | `127.0.0.1` | Listener address |
| `POWERCONTEXT_SERVER_HTTP_PORT` | `8000` | Listener port; the configuration wizard suggests `17429` for new setups |
| `POWERCONTEXT_SERVER_HTTP_MAX_REQUEST_BODY_BYTES` | `16777216` | Maximum external HTTP body bytes before parsing, including chunked uploads |
| `POWERCONTEXT_SERVER_PLUGIN_API_MAX_BODY_BYTES` | `33554432` | Request and response body limit of plugin routes (`/v1/plugins/{name}/api/...` and their Dashboard page forwarding), in place of the previous setting; a plugin route may declare a lower limit, never a higher one |
| `POWERCONTEXT_SERVER_HTTP_MAX_CONCURRENT_REQUESTS` | `64` | Per-process external HTTP requests in flight, including full streaming responses |
| `POWERCONTEXT_SERVER_WORKSPACE` | Server startup directory | Resolution root for local project Agent Skill folders |
| `POWERCONTEXT_SERVER_MCP_ENABLED` | `true` | Enable Streamable HTTP MCP |
Expand Down
1,306 changes: 1,306 additions & 0 deletions docs/en/rfcs/2549-plugin-interfaces.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/zh/docs/develop/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description: 通过 HTTP API、Python Client 或 Core SDK 接入应用。
Core SDK 支持进程内组合。MCP 向 Agent 暴露经过选择的工具子集。

- [HTTP 行为](http-api.md):认证、请求 ID、错误与并发。
- [编写插件](plugins.md):用插件生成自己的 Artifact、定义 Source 类型、提供接口和 Dashboard 页面。
- [HTTP API](/api):生成的端点与结构。
- [Python API](/zh/modules):生成的 Python 文档。
- [Python Agent 框架](../integrations/index.md#python-agent-框架):遵循各自生命周期的社区适配器。
3 changes: 2 additions & 1 deletion docs/zh/docs/develop/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"index",
"api-quickstart",
"interfaces",
"http-api"
"http-api",
"plugins"
]
}
348 changes: 348 additions & 0 deletions docs/zh/docs/develop/plugins.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/zh/docs/operate/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ MCP 使用 stateless Streamable HTTP,每次工具执行都采用当前请求
| `POWERCONTEXT_SERVER_HTTP_HOST` | `127.0.0.1` | 监听地址 |
| `POWERCONTEXT_SERVER_HTTP_PORT` | `8000` | 监听端口;配置向导在首次设置时建议使用 `17429` |
| `POWERCONTEXT_SERVER_HTTP_MAX_REQUEST_BODY_BYTES` | `16777216` | 解析前允许的外部 HTTP 请求体字节数,包括分块上传 |
| `POWERCONTEXT_SERVER_PLUGIN_API_MAX_BODY_BYTES` | `33554432` | 插件接口(`/v1/plugins/{name}/api/...` 及 Dashboard 插件页面的转发)的请求体和响应体上限,替代上一项;插件路由可以声明更小的上限,不能超过此值 |
| `POWERCONTEXT_SERVER_HTTP_MAX_CONCURRENT_REQUESTS` | `64` | 每进程进行中的外部 HTTP 请求上限,包括完整流式响应 |
| `POWERCONTEXT_SERVER_WORKSPACE` | Server 启动目录 | 本机项目级 Agent Skill 目录的解析根目录 |
| `POWERCONTEXT_SERVER_MCP_ENABLED` | `true` | 启用 Streamable HTTP MCP |
Expand Down
1,118 changes: 1,118 additions & 0 deletions docs/zh/rfcs/2549-plugin-interfaces.md

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions examples/plugins/atomic_memory/memory_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Copyright (c) 2026 OceanBase.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""A plugin-owned similarity index kept beside core's authoritative records.

Entries are keyed by Artifact ID and record the revision they describe. The index is
not part of core's transaction, so readers trust an entry only when core still has
that exact revision active.
"""

from __future__ import annotations

import asyncio
import hashlib
import json
import math
import re
import sqlite3
from pathlib import Path
from typing import Any

DIMENSIONS = 256
_WORD = re.compile(r"\w+", re.UNICODE)


def embed(text: str) -> list[float]:
"""Deterministic hashed bag of words; a real deployment would call an embedding model."""

vector = [0.0] * DIMENSIONS
for word in _WORD.findall(text.casefold()):
digest = hashlib.sha256(word.encode("utf-8")).digest()
vector[int.from_bytes(digest[:4], "big") % DIMENSIONS] += 1.0
norm = math.sqrt(sum(value * value for value in vector)) or 1.0
return [value / norm for value in vector]


class MemoryIndex:
def __init__(self, path: Path) -> None:
self.path = path

async def __aenter__(self) -> MemoryIndex:
await asyncio.to_thread(self._execute, _SCHEMA)
return self

async def __aexit__(self, *_: object) -> None:
return None

def _execute(self, statement: str, parameters: tuple[object, ...] = ()) -> list[Any]:
with sqlite3.connect(self.path, timeout=30) as connection:
return connection.execute(statement, parameters).fetchall()

async def upsert(self, scope_id: str, artifact_id: str, revision: int, text: str) -> None:
await asyncio.to_thread(
self._execute,
"INSERT INTO memory_vectors (scope_id, artifact_id, revision, vector) VALUES (?, ?, ?, ?) "
"ON CONFLICT (scope_id, artifact_id) DO UPDATE SET revision = excluded.revision, vector = excluded.vector",
(scope_id, artifact_id, revision, json.dumps(embed(text))),
)

async def remove(self, scope_id: str, artifact_id: str) -> None:
await asyncio.to_thread(
self._execute, "DELETE FROM memory_vectors WHERE scope_id = ? AND artifact_id = ?", (scope_id, artifact_id)
)

async def nearest(self, scope_id: str, text: str, *, threshold: float, limit: int) -> list[tuple[str, int, float]]:
rows = await asyncio.to_thread(
self._execute, "SELECT artifact_id, revision, vector FROM memory_vectors WHERE scope_id = ?", (scope_id,)
)
query = embed(text)
scored = []
for artifact_id, revision, payload in rows:
score = sum(left * right for left, right in zip(query, json.loads(payload), strict=True))
if score >= threshold:
scored.append((artifact_id, int(revision), score))
return sorted(scored, key=lambda item: (-item[2], item[0]))[:limit]


_SCHEMA = """
CREATE TABLE IF NOT EXISTS memory_vectors (
scope_id TEXT NOT NULL,
artifact_id TEXT NOT NULL,
revision INTEGER NOT NULL,
vector TEXT NOT NULL,
PRIMARY KEY (scope_id, artifact_id)
)
"""
Loading
Loading