From b28e1bfd01b804c8662e9e418d8487d0e08cc0ce Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 11:10:46 +0800 Subject: [PATCH 1/8] chore(release): prepare core 1.0 alpha.1 Signed-off-by: tercel --- CHANGELOG.md | 4 + docs/guides/index.md | 1 + docs/index.md | 12 +-- examples/python/golden-path/README.md | 25 +++++ examples/python/golden-path/app.py | 98 ++++++++++++++++++ examples/python/golden-path/verify.py | 126 +++++++++++++++++++++++ planning/microkernel-delivery/alpha-1.md | 29 ++++++ python/CHANGELOG.md | 5 + python/apcore-conformance.yaml | 2 +- python/pyproject.toml | 2 +- python/uv.lock | 55 +++++++++- rust/CHANGELOG.md | 5 + rust/Cargo.lock | 2 +- rust/Cargo.toml | 2 +- rust/apcore-conformance.yaml | 2 +- typescript/CHANGELOG.md | 4 + typescript/apcore-conformance.yaml | 2 +- typescript/package.json | 2 +- 18 files changed, 364 insertions(+), 14 deletions(-) create mode 100644 examples/python/golden-path/README.md create mode 100644 examples/python/golden-path/app.py create mode 100644 examples/python/golden-path/verify.py create mode 100644 planning/microkernel-delivery/alpha-1.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ca7f6a7b..bdac3711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.0-alpha.1] + +This prerelease delivers the cross-repository governance and streaming fixes ahead of the microkernel package split. SDK installations use `1.0.0a1` for Python and `1.0.0-alpha.1` for TypeScript and Rust. The full package and configuration entry points remain available for adapter migration. + ### Added - **Protocol 2.1.0 draft, §6.7, §9.16.2, and §12.7.9.** Add managed drain and recovery hooks, async lifecycle adapters, host-directed cancellation before forced removal, opt-in reload reports, and lifecycle events across the three SDKs. diff --git a/docs/guides/index.md b/docs/guides/index.md index fcd58f0f..4c1f0155 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -21,6 +21,7 @@ The guides are arranged as a learning path. Read the Foundations in order, then ## Integration +- [Python Golden Path](https://github.com/aiperceivable/apcore/tree/main/examples/python/golden-path) — Register an existing function and verify the same governance from Python and MCP - [Multi-Language](./multi-language.md) — Sharing schemas and module IDs across the Python, TypeScript, and Rust SDKs - [Adapter Development](./adapter-development.md) — Exposing modules through a web framework - [Integrating Existing Projects](./integrating-existing-projects.md) — Adopting apcore in an application that already has request and correlation IDs diff --git a/docs/index.md b/docs/index.md index b1a13a04..db0e312e 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,12 +22,12 @@ A schema makes a capability contract machine-readable and validatable. It does n ## Current Versions -| Component | Package | Version | -|---|---|---| -| Protocol specification | [protocol-spec.md](spec/protocol-spec.md) | `2.1.0` (draft) | -| Python SDK | `apcore` | `0.33.0` | -| TypeScript SDK | `apcore-js` | `0.33.0` | -| Rust SDK | `apcore` | `0.33.0` | +| Component | Package | Stable | In development | +|---|---|---|---| +| Protocol specification | [protocol-spec.md](spec/protocol-spec.md) | `1.66.0` | `2.1.0` (draft) | +| Python SDK | `apcore` | `0.33.0` | `1.0.0a1` | +| TypeScript SDK | `apcore-js` | `0.33.0` | `1.0.0-alpha.1` | +| Rust SDK | `apcore` | `0.33.0` | `1.0.0-alpha.1` | The three core SDKs share a release line. Surface adapters (`apcore-mcp`, `apcore-a2a`, `apcore-cli`, `apcore-toolkit`) are versioned independently and declare the core range they support in their package metadata. diff --git a/examples/python/golden-path/README.md b/examples/python/golden-path/README.md new file mode 100644 index 00000000..ce5159b4 --- /dev/null +++ b/examples/python/golden-path/README.md @@ -0,0 +1,25 @@ +# Python Golden Path + +Register an existing application function as an APCore module, call it from Python, and expose the same executor over MCP. The example uses an in-memory notebook and an application-owned approval queue. The MCP server binds only to a temporary loopback port and uses the local process as its trust boundary. + +## Run the example + +Use Python 3.11 or newer. From this directory, create a clean environment and install a compatible Core and MCP pair. To test a release candidate, install its two wheels explicitly so the resolver uses the intended builds. + +```bash +python -m venv .venv +. .venv/bin/activate +python -m pip install "$APCORE_WHEEL" "$APCORE_MCP_WHEEL" +python -m pip check +python verify.py +``` + +Set `APCORE_WHEEL` and `APCORE_MCP_WHEEL` to the absolute paths of the Core and MCP wheels. The verification runs in seconds once the dependencies are installed. + +## Follow a call + +1. `app.py` registers the notebook's archive operation with an input type inferred from the function signature and an output schema inferred from `ArchiveResult`. It marks the operation as destructive and configures an explicit `ExecutionPolicy(strict=True, gate_destructive=True)`. +2. `verify.py` calls the same registered module from Python and through MCP. An ACL denial and invalid input stop execution. Archiving returns pending without modifying the notebook. The application reviewer approves the request and the initiator resumes it with the same arguments and its private credential. The review queue matches the request and consumes the credential on successful authorization. +3. The verifier checks that each authorized archive executes once. It prints ACL decisions with trace ID, caller ID, and target ID so the two entry points can be compared. The approval credential stays out of the audit output. + +This MCP adapter returns pending status as an error message. The local application hands the initiator its private resume credential through the review queue. A deployed application can replace the demonstration queue with its own authenticated review service and persistent store. diff --git a/examples/python/golden-path/app.py b/examples/python/golden-path/app.py new file mode 100644 index 00000000..b4c3589b --- /dev/null +++ b/examples/python/golden-path/app.py @@ -0,0 +1,98 @@ +"""Register an existing application capability for code and MCP callers.""" + +from dataclasses import dataclass, field +from uuid import uuid4 + +from apcore import ACL, APCore, ACLRule, ApprovalRequest, ApprovalResult, ExecutionPolicy +from apcore.acl import AuditEntry +from apcore_mcp import APCoreMCP +from pydantic import BaseModel + +ARCHIVE = "notes.archive" +LOOKUP = "notes.lookup" +RESTRICTED = "notes.restricted" + + +class ArchiveResult(BaseModel): + archived: str + + +@dataclass +class Notebook: + archived: list[str] = field(default_factory=list) + + def archive(self, note_id: str) -> ArchiveResult: + self.archived.append(note_id) + return ArchiveResult(archived=note_id) + + +@dataclass +class PendingReview: + request: ApprovalRequest + approved: bool = False + + +class DemoReviewQueue: + """Review requests in one local process during this example.""" + + def __init__(self) -> None: + self.pending: dict[str, PendingReview] = {} + + async def request_approval(self, request: ApprovalRequest) -> ApprovalResult: + approval_id = uuid4().hex + self.pending[approval_id] = PendingReview(request) + return ApprovalResult(status="pending", approval_id=approval_id) + + async def check_approval(self, approval_id: str) -> ApprovalResult: + review = self.pending.get(approval_id) + if review is None: + return ApprovalResult(status="rejected") + if review.approved: + return ApprovalResult(status="approved", approved_by="demo-reviewer") + return ApprovalResult(status="pending", approval_id=approval_id) + + async def check_approval_for_call(self, approval_id: str, request: ApprovalRequest) -> ApprovalResult: + review = self.pending.get(approval_id) + if review is None or self.scope(review.request) != self.scope(request): + return ApprovalResult(status="rejected") + decision = await self.check_approval(approval_id) + if decision.status == "approved": + del self.pending[approval_id] + return decision + + @staticmethod + def scope(request: ApprovalRequest) -> tuple[object, ...]: + return (request.caller_id, request.context.identity, request.module_id, request.arguments) + + def approve(self, approval_id: str) -> None: + self.pending[approval_id].approved = True + + +def build_app(notebook: Notebook, reviews: DemoReviewQueue, audit: list[AuditEntry]) -> APCore: + client = APCore(policy=ExecutionPolicy(strict=True, gate_destructive=True)) + client.executor.set_acl( + ACL( + [ACLRule(callers=["@external"], targets=[ARCHIVE, LOOKUP], effect="allow")], + default_effect="deny", + audit_logger=audit.append, + ) + ) + client.executor.set_approval_handler(reviews) + + @client.module(ARCHIVE, description="Archive a note", annotations={"destructive": True}) + def archive(note_id: str) -> ArchiveResult: + return notebook.archive(note_id) + + @client.module(LOOKUP, description="Look up a note", annotations={"readonly": True}) + def lookup(note_id: str) -> dict[str, bool]: + return {"archived": note_id in notebook.archived} + + @client.module(RESTRICTED, description="Access a restricted note") + def restricted() -> dict[str, bool]: + raise AssertionError("The ACL must prevent this function from running") + + return client + + +def build_mcp(client: APCore, reviews: DemoReviewQueue) -> APCoreMCP: + return APCoreMCP(client.executor, approval_handler=reviews, require_auth=False, async_tasks=False) diff --git a/examples/python/golden-path/verify.py b/examples/python/golden-path/verify.py new file mode 100644 index 00000000..e3aacd20 --- /dev/null +++ b/examples/python/golden-path/verify.py @@ -0,0 +1,126 @@ +"""Exercise one application through direct calls and a real MCP session.""" + +import asyncio +import json +from contextlib import asynccontextmanager +from socket import socket +from typing import AsyncIterator + +import uvicorn +from apcore import APCore +from apcore.acl import AuditEntry +from apcore.errors import ACLDeniedError, ApprovalPendingError, SchemaValidationError +from apcore_mcp import APCoreMCP +from mcp import ClientSession +from mcp.client.streamable_http import streamable_http_client +from mcp.types import CallToolResult, TextContent + +from app import ARCHIVE, LOOKUP, RESTRICTED, DemoReviewQueue, Notebook, build_app, build_mcp + + +async def verify_direct(client: APCore, notebook: Notebook, reviews: DemoReviewQueue) -> None: + try: + await client.call_async(RESTRICTED, {}) + except ACLDeniedError: + pass + else: + raise AssertionError("Expected an ACL denial") + + try: + await client.call_async(LOOKUP, {"note_id": ["invalid"]}) + except SchemaValidationError: + pass + else: + raise AssertionError("Expected input validation to fail") + + arguments = {"note_id": "from-code"} + try: + await client.call_async(ARCHIVE, arguments) + except ApprovalPendingError as pending: + approval_id = pending.approval_id + assert approval_id is not None + else: + raise AssertionError("Expected approval to be pending") + assert notebook.archived == [] + reviews.approve(approval_id) + assert await client.call_async(ARCHIVE, {**arguments, "_approval_token": approval_id}) == {"archived": "from-code"} + assert notebook.archived == ["from-code"] + + +@asynccontextmanager +async def local_session(mcp: APCoreMCP) -> AsyncIterator[ClientSession]: + async with mcp.async_serve() as application: + with socket() as listener: + listener.bind(("127.0.0.1", 0)) + port = listener.getsockname()[1] + config = uvicorn.Config(application, lifespan="off", log_level="warning") + server = uvicorn.Server(config) + task = asyncio.create_task(server.serve(sockets=[listener])) + try: + async with asyncio.timeout(10): + while not server.started: + if task.done(): + task.result() + raise RuntimeError("The MCP server stopped before startup") + await asyncio.sleep(0.01) + url = f"http://127.0.0.1:{port}/mcp" + async with ( + streamable_http_client(url, terminate_on_close=False) as (read, write, _), + ClientSession(read, write) as session, + ): + await session.initialize() + yield session + finally: + server.should_exit = True + await task + + +def tool_text(result: CallToolResult) -> str: + (content,) = result.content + assert isinstance(content, TextContent) + return content.text + + +async def verify_mcp(mcp: APCoreMCP, notebook: Notebook, reviews: DemoReviewQueue) -> None: + async with local_session(mcp) as session: + tools = {tool.name: tool for tool in (await session.list_tools()).tools} + assert tools[ARCHIVE].inputSchema["properties"]["note_id"]["type"] == "string" + denied = await session.call_tool(RESTRICTED, {}) + assert denied.isError and "Access denied" in tool_text(denied) + invalid = await session.call_tool(LOOKUP, {"note_id": ["invalid"]}) + assert invalid.isError and "validation" in tool_text(invalid).lower() + + arguments = {"note_id": "from-mcp"} + pending = await session.call_tool(ARCHIVE, arguments) + assert pending.isError and "Approval pending" in tool_text(pending) + assert notebook.archived == ["from-code"] + # The local review host gives the initiator the resume credential out of band. + (approval_id,) = reviews.pending + reviews.approve(approval_id) + approved = await session.call_tool(ARCHIVE, {**arguments, "_approval_token": approval_id}) + assert not approved.isError, tool_text(approved) + assert json.loads(tool_text(approved)) == {"archived": "from-mcp"} + assert notebook.archived == ["from-code", "from-mcp"] + + +async def main() -> None: + notebook = Notebook() + reviews = DemoReviewQueue() + audit: list[AuditEntry] = [] + client = build_app(notebook, reviews, audit) + try: + await verify_direct(client, notebook, reviews) + await verify_mcp(build_mcp(client, reviews), notebook, reviews) + finally: + await client.shutdown() + + assert sum(entry.decision == "deny" and entry.target_id == RESTRICTED for entry in audit) == 2 + assert sum(entry.decision == "allow" and entry.target_id == ARCHIVE for entry in audit) == 4 + assert all(entry.trace_id for entry in audit) + for entry in audit: + print(entry.trace_id, entry.caller_id, entry.target_id, entry.decision) + print("Direct calls and MCP both passed the governance checks.") + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/planning/microkernel-delivery/alpha-1.md b/planning/microkernel-delivery/alpha-1.md new file mode 100644 index 00000000..0b9379de --- /dev/null +++ b/planning/microkernel-delivery/alpha-1.md @@ -0,0 +1,29 @@ +# APCore alpha.1 delivery record + +The last stable release on the old line is `0.33.0`. The next public Core candidate is `1.0.0-alpha.1`. The Python distribution uses the PEP 440 spelling `1.0.0a1`. Each affected Surfaces package uses its own prerelease version. + +## Scope + +Core includes the C1 execution and governance fixes, C2 streaming completion, and the managed lifecycle already merged at `316cb05ce1d30931586a12e9296751690782bc7a`. The release changes package metadata and adds the Python Golden Path. The import surface, default governance, and configuration behavior follow the current SDKs until the microkernel work in the next alpha. + +Surfaces starts from `a2b4a3af7d58cf1095569fbea9434f48270668e7` and the candidate work for MCP cancellation and completion, A2A deadlines and cleanup, CLI strict streaming and structured arguments, registration integrity, and the M1 and M2 migration paths. + +## Core rehearsal + +| Local artifact | SHA-256 | +|---|---| +| `apcore-1.0.0a1-py3-none-any.whl` | `a674d4bfd25790a928e67a8960604205dc676f4f1f70522012b2a5ebdfe96e9c` | +| `apcore-1.0.0a1.tar.gz` | `e875f3c03e6aad8c2d6fdd99dcd818731b38968ac2ccc6e2e4c4a4e0817447fc` | +| `apcore-js-1.0.0-alpha.1.tgz` | `fe86feb59e4f8ce9686217c1d9bbd80b1c12360b99ca58107000473a0c0890a5` | +| `apcore-1.0.0-alpha.1.crate` | `a98f01a31ebdd737c9cadb46b8a4e2a44d0635a0a3a305063ef6fa7eba2c87e9` | + +Full local suites passed 6,703 Python, 5,910 TypeScript, and 3,286 Rust tests. The fixture integrity checks covered 98 shared fixtures and 643 expected fields. The installed wheel and npm tarball and unpacked crate passed the Quick Start and governed-stream examples and lifecycle checks. The wheel was exercised on Python 3.11.18 and the npm archive on Node 20.0.0. The local Rust rehearsal used Rust 1.100.0. The distribution workflow covers the declared Rust floor. + +The [Golden Path](../../examples/python/golden-path/README.md) passed after installing `apcore==1.0.0a1` and `apcore-mcp==0.23.5a1` from their local wheels in an isolated environment. It uses a real MCP session and verifies schema rejection, ACL denial, approval suspension and resumption, one execution per authorized call, and ACL audit evidence. + +## Public release gates + +- Record the final source commits, workflow runs, and SHA-256 digests of the exact build artifacts. Verify package contents and the declared runtime versions from clean checkouts. +- Against the selected Core artifacts, run the Surfaces matrix for each component's declared minimum and the alpha candidate. Verify Rust MCP and CLI installations using registry resolution and confirm the resolved Core identity. +- After release approval, publish Core first and then the affected Surfaces packages in dependency order. Verify the same behavior from public package installs and record the resolved versions and checksums. Keep the prior stable line available for consumers that have not adopted an alpha. +- Use the Golden Path with the first Python pilot and record setup, governance outcomes, and adoption friction separately from build acceptance. diff --git a/python/CHANGELOG.md b/python/CHANGELOG.md index 52dccc51..94b56295 100644 --- a/python/CHANGELOG.md +++ b/python/CHANGELOG.md @@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.0a1] + ### Added +- Add the `stream_with_completion()` handle for a single invocation's chunks, validated output, and terminal outcome. +- Add owned shutdown and removal operations, managed drain and recovery hooks, and opt-in governed reload reports. +- Expose Prometheus text rendering without starting an HTTP listener. - Expose `APCore(fail_on_error=True)` and `sys_modules_errors` for system-module startup, and `Executor.ungated_approval_modules()` for approval readiness. ([#230](https://github.com/aiperceivable/apcore/issues/230), [#231](https://github.com/aiperceivable/apcore/issues/231)) ### Changed diff --git a/python/apcore-conformance.yaml b/python/apcore-conformance.yaml index 64a41a8f..9b7edfa4 100644 --- a/python/apcore-conformance.yaml +++ b/python/apcore-conformance.yaml @@ -1,6 +1,6 @@ implementation: name: apcore-python - version: 0.33.0 + version: 1.0.0a1 language: python spec_version: 1.65.0 maintainer: AI Perceivable diff --git a/python/pyproject.toml b/python/pyproject.toml index 8e04faec..9d3d35eb 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "apcore" -version = "0.33.0" +version = "1.0.0a1" description = "Build once, invoke by code or AI — with schema, ACL, approval, and audit enforced at every call" readme = "README.md" requires-python = ">=3.11" diff --git a/python/uv.lock b/python/uv.lock index e7f19621..7c593ebb 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -199,7 +199,7 @@ wheels = [ [[package]] name = "apcore" -version = "0.33.0" +version = "1.0.0a1" source = { editable = "." } dependencies = [ { name = "jsonschema" }, @@ -216,6 +216,7 @@ dev = [ { name = "pytest-asyncio" }, { name = "pytest-cov" }, { name = "ruff" }, + { name = "watchdog" }, ] events = [ { name = "aiohttp" }, @@ -234,6 +235,7 @@ requires-dist = [ { name = "pyyaml", specifier = ">=6.0,<7" }, { name = "referencing", specifier = ">=0.30,<1" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.15.0,<0.17" }, + { name = "watchdog", marker = "extra == 'dev'", specifier = ">=3.0" }, ] provides-extras = ["events", "dev"] @@ -1588,6 +1590,57 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/de/0c/ea2544850a7c135e15033a5c7a8e7211136184b7ae63e2239d557c2b3019/typing_inspection-0.4.5-py3-none-any.whl", hash = "sha256:bc210535442b39e1bf2805e0c7a17dfd6a4ace760c84c7f7d16245d23a6b1c39", size = 14874, upload-time = "2026-11-04T14:13:22.616Z" }, ] +[[package]] +name = "watchdog" +version = "7.1.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e2/55/087e45c2a3ed8223bc9f30d6b65f051de35513cfc30c989c2b1a14bf862e/watchdog-7.1.0.tar.gz", hash = "sha256:d3861e255416f49a1384474cb2efa097de165fb330d4c5432ce6708b509ed922", size = 218748, upload-time = "2026-11-05T09:33:21.28Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/dd/d7/e6d9c38630aa844ea4ad7f2d66924926fc1f73ed770ec7f3caa773f6b874/watchdog-7.1.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:be3f5f953b11bde13ee3c54ae740948f61b01b6b79442f92ff5b9d0c15e5b7e7", size = 120911, upload-time = "2026-11-05T09:32:28.095Z" }, + { url = "https://files.pythonhosted.org/packages/a1/78/87400e56145c88bf6b53474110009f3bc20edfea3b8e6bfcd20faada84d9/watchdog-7.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a79b77db565ae3bc9ff490df2ce51a4bdd6b344a99732055e828e8dadaaf1c97", size = 112978, upload-time = "2026-11-05T09:32:29.511Z" }, + { url = "https://files.pythonhosted.org/packages/bf/3e/dd912eaf296c3c5e279b8e6824fb0cb103523a1dae209667c1221f205480/watchdog-7.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bb9182d0b0b75a78137ea9ae8d74943e53ebc3fc5ea11178fdb3da32ced6ef18", size = 113552, upload-time = "2026-11-05T09:32:30.829Z" }, + { url = "https://files.pythonhosted.org/packages/59/14/40662f61f6e09f6a0371d95d916f6fc134825a7937b3ebff08cb6be433a8/watchdog-7.1.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:5047bc32663aa6c8a720940072a64cd648f4c6c6f34cd43592719bcc880b7465", size = 120967, upload-time = "2026-11-05T09:32:32.212Z" }, + { url = "https://files.pythonhosted.org/packages/83/dd/a36aed1934abf1b9a827f5d5b4fab23de395526eb1bc40da34aad9f2d589/watchdog-7.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:24bf3345278ed7861438cd1ff162888e955250124d1e3c122f9be1d5c2a142c3", size = 112992, upload-time = "2026-11-05T09:32:33.631Z" }, + { url = "https://files.pythonhosted.org/packages/a5/4d/a490bcebc20c0c2781b0e1b2674245354502c9a62b274cc41859f4b269cd/watchdog-7.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:84a196f6259d18ce53cc58f211f7d0184939dbbfaaebae6efc509cec333ba9ea", size = 113581, upload-time = "2026-11-05T09:32:34.752Z" }, + { url = "https://files.pythonhosted.org/packages/c3/1f/804e62a8895212f436944ea2f13cdb3e6a7e2570b14f3723d3fef2bc9db7/watchdog-7.1.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:33501d3ab5627e41b6230d5f92e651ea843b1d236cf2b135959dfda2d42d2f69", size = 120813, upload-time = "2026-11-05T09:32:35.831Z" }, + { url = "https://files.pythonhosted.org/packages/30/35/59365fa94ebc1cddf89a21752eb17afef037bd534d63ab1800721540e5f4/watchdog-7.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:531f1a21bf0d37ea82be9a717ab92c05ab6f2f32ec6c1f2e7a748f9cfd21c8b2", size = 112905, upload-time = "2026-11-05T09:32:37.371Z" }, + { url = "https://files.pythonhosted.org/packages/41/ac/d4d6fb1bd6f25b614fa7150629b8eb3e30f7ded82f63a19b4427b140475e/watchdog-7.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:fb84cdb12a3c4c273d71e4e5a4f76861fbf8f49bc9ca5be86f085ab6f57c683f", size = 113516, upload-time = "2026-11-05T09:32:38.48Z" }, + { url = "https://files.pythonhosted.org/packages/d4/8c/a25dac9642a4962d70cace9ffbb9ea4e575e6a61412ba5c80569460e0c81/watchdog-7.1.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:a0fdb62a48b5073ea3bcca29b9910f1cbde1026ab8bffb87a69b112bf6d97d1c", size = 122360, upload-time = "2026-11-05T09:32:39.85Z" }, + { url = "https://files.pythonhosted.org/packages/c7/56/b262a7c5acb47cb7eebc0cb25ded697ac4fbfc2d65c3a505a210ecb2b2e3/watchdog-7.1.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:8b637a1525d7e23548419368485bf1de931aca4c9e132e89a41bad52ff435fca", size = 113003, upload-time = "2026-11-05T09:32:40.873Z" }, + { url = "https://files.pythonhosted.org/packages/e0/5f/5133b328bae8ec5fab02c329c4364445459d678194c42457c9721b6f64ea/watchdog-7.1.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:b1a669c90ae6dc734f2a5a417f15ba30d5ef41d890bc28aef161d51bb62b7882", size = 113518, upload-time = "2026-11-05T09:32:41.924Z" }, + { url = "https://files.pythonhosted.org/packages/13/e1/0de47b185b82317696f59c0f0b9bb105f6492d6d3423cb1535ce60f70c2f/watchdog-7.1.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:4332ae52b5e530d2c25a8525d765f1d34e595cfb07096c6b6368f9da10b5a8bf", size = 123108, upload-time = "2026-11-05T09:32:43.453Z" }, + { url = "https://files.pythonhosted.org/packages/56/f7/84b94e50c73479a291733027bd572336ba5b85dca27c18982186293bd8bd/watchdog-7.1.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:701586db59c9c421389e2e007713a821d934c3d83d034f0cafa95516a422758d", size = 113369, upload-time = "2026-11-05T09:32:44.689Z" }, + { url = "https://files.pythonhosted.org/packages/12/71/a6e482e81cb7ebe9f2aea7955254dee2865ea99a580bfeceaf53c274875d/watchdog-7.1.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:d4c9804d3db8e18659cd7cd968e2dbb31a655d12fcc07ec54df5ae47ff929f50", size = 113900, upload-time = "2026-11-05T09:32:45.742Z" }, + { url = "https://files.pythonhosted.org/packages/46/8b/aeeacda90fcbcf2c8c3eeb761f9dcce798b0209c4413e9f89733d4bc8c8f/watchdog-7.1.0-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:a78673ab08b15f42760ae036f9251d02ac4107390c074963ccad4fc91cf880ac", size = 122415, upload-time = "2026-11-05T09:32:46.9Z" }, + { url = "https://files.pythonhosted.org/packages/66/07/69e1962eeccd885cc6196fea3f45f610741ca259ce9f69f372aa42e35146/watchdog-7.1.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:b0747551092578b70a4e8c48260ab956a9aa7efd2e9f7614471a7f73ada91c44", size = 113001, upload-time = "2026-11-05T09:32:48.023Z" }, + { url = "https://files.pythonhosted.org/packages/d0/9a/3beeb0a20d9907468b48bdc63e2e0e5ff858b308c46051a823280164bbcf/watchdog-7.1.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:3dcf1a72c8c83a945e99965746c818bca3f50c0835b66ef1deb388d89bae792a", size = 113576, upload-time = "2026-11-05T09:32:49.407Z" }, + { url = "https://files.pythonhosted.org/packages/f1/f6/d552bd549125010e7c7d78fbb8057ee4ec6f5d258ffdc8cd6c675f9a70ef/watchdog-7.1.0-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:22fb8c80a2e510ec7773e4f6b2c6db869c2aed80bfb09962feb0962eb54f3ac9", size = 123152, upload-time = "2026-11-05T09:32:50.724Z" }, + { url = "https://files.pythonhosted.org/packages/c6/7e/b951aeea6d6db7a917e3c1c5a341cbb3e5c8cc02ccb9201b2715547603c3/watchdog-7.1.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:e226f1797764c3995ff9e91ce46f1b2ae65f59ab231785ef2f62243f06ba7956", size = 113366, upload-time = "2026-11-05T09:32:52.04Z" }, + { url = "https://files.pythonhosted.org/packages/b6/ce/9e944c1d21b9b767023fb63cc764affcff1c8f4853de8e0ad14005cadbba/watchdog-7.1.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:2dc548262230493c8740c50cb0016d5983143ef3e587284d55f8a9fac393340f", size = 113951, upload-time = "2026-11-05T09:32:53.341Z" }, + { url = "https://files.pythonhosted.org/packages/2a/ab/0c57f765c0b29534e12ca4aa69fc0b1cb8437ed307c4250887ecb400d8e8/watchdog-7.1.0-pp311-pypy311_pp80-macosx_10_15_x86_64.whl", hash = "sha256:cf55c6108cce5c590661ebf3345d5203b6c6455237d73122a64acb74acc6a920", size = 112010, upload-time = "2026-11-05T09:32:54.588Z" }, + { url = "https://files.pythonhosted.org/packages/67/f8/755e32b082b3b27c3f4730874dc09d11eed5c39ffbe512d30e2662e917b8/watchdog-7.1.0-pp311-pypy311_pp80-macosx_11_0_arm64.whl", hash = "sha256:b390a8a0b85a93882d2ad27cbcc222e1e93293a5410d2ceffb48c0fdb38e0b17", size = 112577, upload-time = "2026-11-05T09:32:55.7Z" }, + { url = "https://files.pythonhosted.org/packages/33/7d/1d661f910c1f3717603b3eea0e3bd5540c7a76221371ae24bb42e0e3b049/watchdog-7.1.0-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:550ff9204139b6d759cd37210935bb88f6aac42542ad17516edaf17c9b35fd41", size = 112168, upload-time = "2026-11-05T09:32:57.02Z" }, + { url = "https://files.pythonhosted.org/packages/b6/29/f3b91fe0ef86c11f508de1c189054e2b4f00be8da6043e96130f841697d0/watchdog-7.1.0-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:22d8869d9cb822c735923eea39d9279f03d5fd23e6d325800ac9e402e34c0a28", size = 112671, upload-time = "2026-11-05T09:32:58.143Z" }, + { url = "https://files.pythonhosted.org/packages/b3/5b/1e62e5ab365634f84afe91f8fd78563c71226056d57e36d5fcba9d99b536/watchdog-7.1.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:dbd4e701a31b9bfa686bd831177b433695f5e4dabee6aa0bdf4efcf6f0fd5b9f", size = 103268, upload-time = "2026-11-05T09:32:59.401Z" }, + { url = "https://files.pythonhosted.org/packages/6e/0a/1da133041dfa1ca8d512e06485ce82dd2a9af7b6cc4fe9c277008380d10a/watchdog-7.1.0-py3-none-manylinux2014_armv7l.whl", hash = "sha256:d47f3067eb77a83d04de1cac214284da604f960eaee9816d7ebfd01a165b4175", size = 103269, upload-time = "2026-11-05T09:33:00.478Z" }, + { url = "https://files.pythonhosted.org/packages/e5/b4/3c9142add82c134fcbb748cc23e52603519679dddc4b5900d83e473d0648/watchdog-7.1.0-py3-none-manylinux2014_i686.whl", hash = "sha256:400788184d62c0e384da67de4d7fcb892bfeb064b2e59a7d1a1dccb9ff4b49bc", size = 103267, upload-time = "2026-11-05T09:33:01.522Z" }, + { url = "https://files.pythonhosted.org/packages/3f/d3/dbbc79e5ce139516cad0b88ec08df27fd00ef478547c0e584951f2c687b3/watchdog-7.1.0-py3-none-manylinux2014_ppc64.whl", hash = "sha256:b76e3ac088550b33046c4eabacdd7dd4cb9db9147c8749b202643a4b5c2433c8", size = 103266, upload-time = "2026-11-05T09:33:02.614Z" }, + { url = "https://files.pythonhosted.org/packages/7a/ad/721ff870f9ecf25532a07d58fb677764e17390a46b675486bf23ce278873/watchdog-7.1.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:d94d0bcf30a9ea5ac5387df290b9e175c04747558c33443d2b0f763471699531", size = 103269, upload-time = "2026-11-05T09:33:03.694Z" }, + { url = "https://files.pythonhosted.org/packages/ab/4c/dfe0265c572027b2af9e824c6370a6ca39da33c819a99af48ddbc0cf1706/watchdog-7.1.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:cbae4a087f712bac4086e653273a949f86e2f908d16f157fd3568217e0c07cbe", size = 103268, upload-time = "2026-11-05T09:33:04.738Z" }, + { url = "https://files.pythonhosted.org/packages/98/4d/60e1c38c27973d63f8748cfe8da70bdf698d1c1ab0e94fd18de15b3044fe/watchdog-7.1.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:77f06d709fe5d766ec51ec07b79773f5e29a0b3c4c3d195cfc7aa1e909fa566c", size = 103269, upload-time = "2026-11-05T09:33:05.95Z" }, + { url = "https://files.pythonhosted.org/packages/72/88/9190129165760c76191f4711b64a728d1bff02de74649c675797ae253f26/watchdog-7.1.0-py3-none-manylinux_2_17_aarch64.whl", hash = "sha256:48db8dd8f9f92359ca5d4bccbd82be814facc3f57feaa3c67be964cc86b1dc33", size = 103270, upload-time = "2026-11-05T09:33:07.48Z" }, + { url = "https://files.pythonhosted.org/packages/5e/6c/1c3a9066266b5c3f0db9146422f67e5d13781b2fb1b9e777ead5553fc1a7/watchdog-7.1.0-py3-none-manylinux_2_17_armv7l.whl", hash = "sha256:a47d6e1418d7ed80f69454fb7f000ded554363209f8b04b812bf46b6c9e3093f", size = 103268, upload-time = "2026-11-05T09:33:08.639Z" }, + { url = "https://files.pythonhosted.org/packages/40/6b/aa8fb28263d3965f91228ce9b251a786e36060a3571f4d724b2fab44a1c1/watchdog-7.1.0-py3-none-manylinux_2_17_i686.whl", hash = "sha256:71b0ebfd5b3ffe7cf53143f2ab63fa5038ca190fc10782ec23202765a859b057", size = 103268, upload-time = "2026-11-05T09:33:10.041Z" }, + { url = "https://files.pythonhosted.org/packages/63/bb/8757c54c6dcb0edcc514a47b0dc026f8751a266b6c320a0df8830d9f89a4/watchdog-7.1.0-py3-none-manylinux_2_17_ppc64.whl", hash = "sha256:c71bd120d57b16c2c49abd55d74d3c83f984e19024249ebe7ba4dc4903eb27ee", size = 103268, upload-time = "2026-11-05T09:33:11.147Z" }, + { url = "https://files.pythonhosted.org/packages/79/47/bdd6c0176695fb5b44fa9164ab5aa3edbefd322eea7dc584073fe7bfe67c/watchdog-7.1.0-py3-none-manylinux_2_17_ppc64le.whl", hash = "sha256:a17f37720ea088430754a7cc5869fad93915c69eaff8d5284adbac41f1befaaa", size = 103268, upload-time = "2026-11-05T09:33:12.264Z" }, + { url = "https://files.pythonhosted.org/packages/e6/99/13406d1424ed4a8796a800016d21ac6fba3ba9ac508cc860e97ce352f14e/watchdog-7.1.0-py3-none-manylinux_2_17_s390x.whl", hash = "sha256:89f78b2b1c153715463e27fc86f0f95fd4dd6cb07a2cdad932fe01840101fb5a", size = 103269, upload-time = "2026-11-05T09:33:13.414Z" }, + { url = "https://files.pythonhosted.org/packages/bb/28/96130c970c236e4278a188cb6b8dec2500ff395ddcebb74c6171f5fc6069/watchdog-7.1.0-py3-none-manylinux_2_17_x86_64.whl", hash = "sha256:ad6d0b473cb8cde0721692b22b30fcbea8b52102430528874b3593549888bd81", size = 103269, upload-time = "2026-11-05T09:33:14.916Z" }, + { url = "https://files.pythonhosted.org/packages/17/54/312036da06d83b4a21d25a0d83643d2a9b2188eb2e5031e52fe82eddbe0a/watchdog-7.1.0-py3-none-win32.whl", hash = "sha256:9c937139c8afdb26405639309956352ef72c453006e772e0cf5c0bbc0d1cba82", size = 103255, upload-time = "2026-11-05T09:33:16.394Z" }, + { url = "https://files.pythonhosted.org/packages/5a/bc/c04fbb2d6366afb0850e39c6d848f2d38066ff6dadccc886b3cb12c39e32/watchdog-7.1.0-py3-none-win_amd64.whl", hash = "sha256:16a5ba8694587cdbeae4ab8e6434cece994f9cce4e5bab03e61e6d1a0a93a643", size = 103260, upload-time = "2026-11-05T09:33:17.687Z" }, + { url = "https://files.pythonhosted.org/packages/92/9c/5a39ec8880c08e50f75d90f4e0e27b95dc91a04deb5e6e04871dd4b7e006/watchdog-7.1.0-py3-none-win_arm64.whl", hash = "sha256:5ed4b94365c53ffd51d88e47ca48d6afae02fb1bd849175a9a10927a2fbfb932", size = 103260, upload-time = "2026-11-05T09:33:18.987Z" }, + { url = "https://files.pythonhosted.org/packages/c0/aa/7a7210433e000f2491ddec7756d312009b0a47847e5c3457ccb03852cfdf/watchdog-7.1.0-py3-none-win_ia64.whl", hash = "sha256:0cfc5a6b3d4e76fc3e18fd371ee79d57945004da4105b589f71bb16966fd3e67", size = 103256, upload-time = "2026-11-05T09:33:20.159Z" }, +] + [[package]] name = "yarl" version = "1.25.1" diff --git a/rust/CHANGELOG.md b/rust/CHANGELOG.md index 049af483..1f557442 100644 --- a/rust/CHANGELOG.md +++ b/rust/CHANGELOG.md @@ -14,8 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.0-alpha.1] + ### Added +- Add the `stream_with_completion()` handle for a single invocation's chunks, validated output, and terminal outcome. +- Add owned shutdown and removal operations, managed drain and recovery hooks, and opt-in governed reload reports. +- Expose Prometheus text rendering without starting an HTTP listener. - Expose `APCore::try_with_options` and `sys_modules_errors()` for system-module startup, and `Executor::ungated_approval_modules()` for approval readiness. ([#230](https://github.com/aiperceivable/apcore/issues/230), [#231](https://github.com/aiperceivable/apcore/issues/231)) ### Changed diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 29e3d171..0b4cab0c 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -42,7 +42,7 @@ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "apcore" -version = "0.33.0" +version = "1.0.0-alpha.1" dependencies = [ "async-stream", "async-trait", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index b1510e7e..1f8c7cd2 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apcore" -version = "0.33.0" +version = "1.0.0-alpha.1" edition = "2021" # Minimum supported Rust version. Verified with `cargo +1.86 check --all-features`. # The binding language constraint is `std::task::Waker::noop()` (used by the diff --git a/rust/apcore-conformance.yaml b/rust/apcore-conformance.yaml index 4507b22f..35910987 100644 --- a/rust/apcore-conformance.yaml +++ b/rust/apcore-conformance.yaml @@ -1,6 +1,6 @@ implementation: name: apcore-rust - version: 0.33.0 + version: 1.0.0-alpha.1 language: rust spec_version: 1.65.0 maintainer: AI Perceivable diff --git a/typescript/CHANGELOG.md b/typescript/CHANGELOG.md index 386934a6..0133879c 100644 --- a/typescript/CHANGELOG.md +++ b/typescript/CHANGELOG.md @@ -7,8 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.0-alpha.1] + ### Added +- Add the `streamWithCompletion()` handle for a single invocation's chunks, validated output, and terminal outcome. +- Add owned shutdown and removal operations, managed drain and recovery hooks, and opt-in governed reload reports. - Expose `APCore({ failOnError: true })` and `sysModulesErrors` for system-module startup, and `Executor.ungatedApprovalModules()` for approval readiness. ([#230](https://github.com/aiperceivable/apcore/issues/230), [#231](https://github.com/aiperceivable/apcore/issues/231)) ### Changed diff --git a/typescript/apcore-conformance.yaml b/typescript/apcore-conformance.yaml index 20593932..13b8a6f4 100644 --- a/typescript/apcore-conformance.yaml +++ b/typescript/apcore-conformance.yaml @@ -2,7 +2,7 @@ # It does not certify every fixture required by Level 1 or Level 2. implementation: name: apcore-typescript - version: "0.33.0" + version: "1.0.0-alpha.1" language: typescript spec_version: "1.65.0" maintainer: AI Perceivable diff --git a/typescript/package.json b/typescript/package.json index be3921d4..a64415d0 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -1,6 +1,6 @@ { "name": "apcore-js", - "version": "0.33.0", + "version": "1.0.0-alpha.1", "description": "Build once, invoke by code or AI — with schema, ACL, approval, and audit enforced at every call", "type": "module", "main": "./dist/index.js", From e93265ff315f7f37dd823a3b39c78dc1fa8bf50c Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 11:25:14 +0800 Subject: [PATCH 2/8] ci: run Surfaces verification from the Core alpha candidate Signed-off-by: tercel --- .github/workflows/surfaces-alpha1-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/surfaces-alpha1-ci.yml diff --git a/.github/workflows/surfaces-alpha1-ci.yml b/.github/workflows/surfaces-alpha1-ci.yml new file mode 100644 index 00000000..0e416e3d --- /dev/null +++ b/.github/workflows/surfaces-alpha1-ci.yml @@ -0,0 +1,21 @@ +name: Surfaces alpha.1 verification + +on: + push: + branches: [codex/core-alpha1] + paths: [.github/workflows/surfaces-alpha1-ci.yml] + +permissions: + contents: read + actions: read + +jobs: + verify: + uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@6bf595616fed0c7dd8a198584429bd3bf06d967c + with: + core_run_id: '45933698251' + core_sha: b28e1bfd01b804c8662e9e418d8487d0e08cc0ce + surfaces_sha: 6bf595616fed0c7dd8a198584429bd3bf06d967c + python_sha256: 9a7de3440413cf891ec2efb4a634350efbbf28659734ddad1c28db70182e7bff + npm_sha256: 833e1f2e4c9328c0c4192c02d9e2c8bfbb62ae651fddd62980b448c41d5842db + rust_sha256: bbc1db3680f3d81b7096fa5eb70476a2c043b333681c2a7bba3597a49bbf11f6 From abf1c60a815d1480290cb46cea33e6fb3fd0b401 Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 11:31:53 +0800 Subject: [PATCH 3/8] ci: reverify Surfaces with the Linux shutdown test fix Signed-off-by: tercel --- .github/workflows/surfaces-alpha1-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/surfaces-alpha1-ci.yml b/.github/workflows/surfaces-alpha1-ci.yml index 0e416e3d..c4b5d98c 100644 --- a/.github/workflows/surfaces-alpha1-ci.yml +++ b/.github/workflows/surfaces-alpha1-ci.yml @@ -11,11 +11,11 @@ permissions: jobs: verify: - uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@6bf595616fed0c7dd8a198584429bd3bf06d967c + uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@1ae19987ed939401ba4ebcb83256dc31d97bb921 with: core_run_id: '45933698251' core_sha: b28e1bfd01b804c8662e9e418d8487d0e08cc0ce - surfaces_sha: 6bf595616fed0c7dd8a198584429bd3bf06d967c + surfaces_sha: 1ae19987ed939401ba4ebcb83256dc31d97bb921 python_sha256: 9a7de3440413cf891ec2efb4a634350efbbf28659734ddad1c28db70182e7bff npm_sha256: 833e1f2e4c9328c0c4192c02d9e2c8bfbb62ae651fddd62980b448c41d5842db rust_sha256: bbc1db3680f3d81b7096fa5eb70476a2c043b333681c2a7bba3597a49bbf11f6 From 109e036b54893f7a4b100a40a38d8881e9c72cb2 Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 11:41:30 +0800 Subject: [PATCH 4/8] ci: verify the Toolkit and A2A race fixes Signed-off-by: tercel --- .github/workflows/surfaces-alpha1-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/surfaces-alpha1-ci.yml b/.github/workflows/surfaces-alpha1-ci.yml index c4b5d98c..3b586b05 100644 --- a/.github/workflows/surfaces-alpha1-ci.yml +++ b/.github/workflows/surfaces-alpha1-ci.yml @@ -11,11 +11,11 @@ permissions: jobs: verify: - uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@1ae19987ed939401ba4ebcb83256dc31d97bb921 + uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@2eca45d07c13600e44089c8c50b8433cf2e1c596 with: core_run_id: '45933698251' core_sha: b28e1bfd01b804c8662e9e418d8487d0e08cc0ce - surfaces_sha: 1ae19987ed939401ba4ebcb83256dc31d97bb921 + surfaces_sha: 2eca45d07c13600e44089c8c50b8433cf2e1c596 python_sha256: 9a7de3440413cf891ec2efb4a634350efbbf28659734ddad1c28db70182e7bff npm_sha256: 833e1f2e4c9328c0c4192c02d9e2c8bfbb62ae651fddd62980b448c41d5842db rust_sha256: bbc1db3680f3d81b7096fa5eb70476a2c043b333681c2a7bba3597a49bbf11f6 From a8cf0e8206bd11182c15a3ae159ba4dc0e0c61fe Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 11:51:29 +0800 Subject: [PATCH 5/8] chore(ci): follow the renamed Core candidate branch Signed-off-by: tercel --- .github/workflows/surfaces-alpha1-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/surfaces-alpha1-ci.yml b/.github/workflows/surfaces-alpha1-ci.yml index 3b586b05..40c3fcd4 100644 --- a/.github/workflows/surfaces-alpha1-ci.yml +++ b/.github/workflows/surfaces-alpha1-ci.yml @@ -2,7 +2,7 @@ name: Surfaces alpha.1 verification on: push: - branches: [codex/core-alpha1] + branches: [core-alpha1] paths: [.github/workflows/surfaces-alpha1-ci.yml] permissions: From f14ee595f937878b4de77a5cf978fd273a10fa05 Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 14:10:27 +0800 Subject: [PATCH 6/8] ci: verify the reviewed Surfaces alpha candidate Signed-off-by: tercel --- .github/workflows/surfaces-alpha1-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/surfaces-alpha1-ci.yml b/.github/workflows/surfaces-alpha1-ci.yml index 40c3fcd4..f1e36214 100644 --- a/.github/workflows/surfaces-alpha1-ci.yml +++ b/.github/workflows/surfaces-alpha1-ci.yml @@ -11,11 +11,11 @@ permissions: jobs: verify: - uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@2eca45d07c13600e44089c8c50b8433cf2e1c596 + uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@329ce88e93231810ad9e8ba764e3cbe9008abd3a with: core_run_id: '45933698251' core_sha: b28e1bfd01b804c8662e9e418d8487d0e08cc0ce - surfaces_sha: 2eca45d07c13600e44089c8c50b8433cf2e1c596 + surfaces_sha: 329ce88e93231810ad9e8ba764e3cbe9008abd3a python_sha256: 9a7de3440413cf891ec2efb4a634350efbbf28659734ddad1c28db70182e7bff npm_sha256: 833e1f2e4c9328c0c4192c02d9e2c8bfbb62ae651fddd62980b448c41d5842db rust_sha256: bbc1db3680f3d81b7096fa5eb70476a2c043b333681c2a7bba3597a49bbf11f6 From eb2e795e47070369e2347e8a1f4b625831c877c7 Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 14:20:20 +0800 Subject: [PATCH 7/8] docs(examples): exercise scoped approval in the Golden Path Signed-off-by: tercel --- examples/python/golden-path/README.md | 12 ++--- examples/python/golden-path/app.py | 54 +++------------------- examples/python/golden-path/verify.py | 64 ++++++++++++++++++--------- 3 files changed, 55 insertions(+), 75 deletions(-) diff --git a/examples/python/golden-path/README.md b/examples/python/golden-path/README.md index ce5159b4..5553f775 100644 --- a/examples/python/golden-path/README.md +++ b/examples/python/golden-path/README.md @@ -1,6 +1,6 @@ # Python Golden Path -Register an existing application function as an APCore module, call it from Python, and expose the same executor over MCP. The example uses an in-memory notebook and an application-owned approval queue. The MCP server binds only to a temporary loopback port and uses the local process as its trust boundary. +Register an existing application function as an APCore module and call it from Python and through MCP. The two executors use the same notebook, module definitions, and governance policy. Each uses an in-memory approval store. The MCP server binds to a temporary loopback port and uses the local process as its trust boundary. ## Run the example @@ -18,8 +18,10 @@ Set `APCORE_WHEEL` and `APCORE_MCP_WHEEL` to the absolute paths of the Core and ## Follow a call -1. `app.py` registers the notebook's archive operation with an input type inferred from the function signature and an output schema inferred from `ArchiveResult`. It marks the operation as destructive and configures an explicit `ExecutionPolicy(strict=True, gate_destructive=True)`. -2. `verify.py` calls the same registered module from Python and through MCP. An ACL denial and invalid input stop execution. Archiving returns pending without modifying the notebook. The application reviewer approves the request and the initiator resumes it with the same arguments and its private credential. The review queue matches the request and consumes the credential on successful authorization. -3. The verifier checks that each authorized archive executes once. It prints ACL decisions with trace ID, caller ID, and target ID so the two entry points can be compared. The approval credential stays out of the audit output. +1. `app.py` registers the notebook's archive operation with an input type inferred from the function signature and an output schema inferred from `ArchiveResult`. It marks the operation as destructive and configures `ExecutionPolicy(strict=True, gate_destructive=True)`. +2. `verify.py` checks a normal lookup, an ACL denial, and invalid input through both entry points. An archive request stays pending until the reviewer records a decision. +3. In Python, the verifier resolves the pending result's public `audit_id` in the store. It retries the same arguments through Core with the private `approval_id` in the reserved `_approval_token` field. +4. Through MCP, the verifier reads `approvalId` and `resumeToken` from the pending tool result's `_meta.apcore.approval`. It polls `__apcore_approval_check` with the public ID, resolves the request, and checks that the status changes to approved. It then retries the original tool arguments with the private token in request `_meta.approvalId`. +5. The verifier checks that each archive executes once and prints the ACL decisions with trace ID, caller ID, and target ID. The approval credential stays out of the audit output. -This MCP adapter returns pending status as an error message. The local application hands the initiator its private resume credential through the review queue. A deployed application can replace the demonstration queue with its own authenticated review service and persistent store. +The in-memory stores are for this local example. A deployed application can use an authenticated review service and a persistent scoped approval store. diff --git a/examples/python/golden-path/app.py b/examples/python/golden-path/app.py index b4c3589b..2a281d1f 100644 --- a/examples/python/golden-path/app.py +++ b/examples/python/golden-path/app.py @@ -1,11 +1,10 @@ """Register an existing application capability for code and MCP callers.""" from dataclasses import dataclass, field -from uuid import uuid4 -from apcore import ACL, APCore, ACLRule, ApprovalRequest, ApprovalResult, ExecutionPolicy +from apcore import ACL, ACLRule, APCore, ExecutionPolicy from apcore.acl import AuditEntry -from apcore_mcp import APCoreMCP +from apcore_mcp import APCoreMCP, InMemoryApprovalStore from pydantic import BaseModel ARCHIVE = "notes.archive" @@ -26,49 +25,7 @@ def archive(self, note_id: str) -> ArchiveResult: return ArchiveResult(archived=note_id) -@dataclass -class PendingReview: - request: ApprovalRequest - approved: bool = False - - -class DemoReviewQueue: - """Review requests in one local process during this example.""" - - def __init__(self) -> None: - self.pending: dict[str, PendingReview] = {} - - async def request_approval(self, request: ApprovalRequest) -> ApprovalResult: - approval_id = uuid4().hex - self.pending[approval_id] = PendingReview(request) - return ApprovalResult(status="pending", approval_id=approval_id) - - async def check_approval(self, approval_id: str) -> ApprovalResult: - review = self.pending.get(approval_id) - if review is None: - return ApprovalResult(status="rejected") - if review.approved: - return ApprovalResult(status="approved", approved_by="demo-reviewer") - return ApprovalResult(status="pending", approval_id=approval_id) - - async def check_approval_for_call(self, approval_id: str, request: ApprovalRequest) -> ApprovalResult: - review = self.pending.get(approval_id) - if review is None or self.scope(review.request) != self.scope(request): - return ApprovalResult(status="rejected") - decision = await self.check_approval(approval_id) - if decision.status == "approved": - del self.pending[approval_id] - return decision - - @staticmethod - def scope(request: ApprovalRequest) -> tuple[object, ...]: - return (request.caller_id, request.context.identity, request.module_id, request.arguments) - - def approve(self, approval_id: str) -> None: - self.pending[approval_id].approved = True - - -def build_app(notebook: Notebook, reviews: DemoReviewQueue, audit: list[AuditEntry]) -> APCore: +def build_app(notebook: Notebook, audit: list[AuditEntry]) -> APCore: client = APCore(policy=ExecutionPolicy(strict=True, gate_destructive=True)) client.executor.set_acl( ACL( @@ -77,7 +34,6 @@ def build_app(notebook: Notebook, reviews: DemoReviewQueue, audit: list[AuditEnt audit_logger=audit.append, ) ) - client.executor.set_approval_handler(reviews) @client.module(ARCHIVE, description="Archive a note", annotations={"destructive": True}) def archive(note_id: str) -> ArchiveResult: @@ -94,5 +50,5 @@ def restricted() -> dict[str, bool]: return client -def build_mcp(client: APCore, reviews: DemoReviewQueue) -> APCoreMCP: - return APCoreMCP(client.executor, approval_handler=reviews, require_auth=False, async_tasks=False) +def build_mcp(client: APCore, reviews: InMemoryApprovalStore) -> APCoreMCP: + return APCoreMCP(client.executor, approval_store=reviews, require_auth=False, async_tasks=False) diff --git a/examples/python/golden-path/verify.py b/examples/python/golden-path/verify.py index e3aacd20..a904b9d6 100644 --- a/examples/python/golden-path/verify.py +++ b/examples/python/golden-path/verify.py @@ -2,23 +2,24 @@ import asyncio import json -from contextlib import asynccontextmanager +from collections.abc import AsyncIterator +from contextlib import AsyncExitStack, asynccontextmanager from socket import socket -from typing import AsyncIterator import uvicorn from apcore import APCore from apcore.acl import AuditEntry from apcore.errors import ACLDeniedError, ApprovalPendingError, SchemaValidationError -from apcore_mcp import APCoreMCP +from apcore_mcp import APCoreMCP, InMemoryApprovalStore, StorageBackedApprovalHandler +from app import ARCHIVE, LOOKUP, RESTRICTED, Notebook, build_app, build_mcp from mcp import ClientSession from mcp.client.streamable_http import streamable_http_client from mcp.types import CallToolResult, TextContent -from app import ARCHIVE, LOOKUP, RESTRICTED, DemoReviewQueue, Notebook, build_app, build_mcp +async def verify_direct(client: APCore, notebook: Notebook, reviews: InMemoryApprovalStore) -> None: + assert await client.call_async(LOOKUP, {"note_id": "from-code"}) == {"archived": False} -async def verify_direct(client: APCore, notebook: Notebook, reviews: DemoReviewQueue) -> None: try: await client.call_async(RESTRICTED, {}) except ACLDeniedError: @@ -37,13 +38,15 @@ async def verify_direct(client: APCore, notebook: Notebook, reviews: DemoReviewQ try: await client.call_async(ARCHIVE, arguments) except ApprovalPendingError as pending: - approval_id = pending.approval_id - assert approval_id is not None + approval_id = pending.result.audit_id + resume_token = pending.approval_id + assert approval_id and resume_token and approval_id != resume_token else: raise AssertionError("Expected approval to be pending") assert notebook.archived == [] - reviews.approve(approval_id) - assert await client.call_async(ARCHIVE, {**arguments, "_approval_token": approval_id}) == {"archived": "from-code"} + assert await reviews.resolve(approval_id, approved=True) + resumed = await client.call_async(ARCHIVE, {**arguments, "_approval_token": resume_token}) + assert resumed == {"archived": "from-code"} assert notebook.archived == ["from-code"] @@ -81,10 +84,13 @@ def tool_text(result: CallToolResult) -> str: return content.text -async def verify_mcp(mcp: APCoreMCP, notebook: Notebook, reviews: DemoReviewQueue) -> None: +async def verify_mcp(mcp: APCoreMCP, notebook: Notebook, reviews: InMemoryApprovalStore) -> None: async with local_session(mcp) as session: tools = {tool.name: tool for tool in (await session.list_tools()).tools} assert tools[ARCHIVE].inputSchema["properties"]["note_id"]["type"] == "string" + assert "__apcore_approval_check" in tools + lookup = await session.call_tool(LOOKUP, {"note_id": "from-code"}) + assert not lookup.isError and json.loads(tool_text(lookup)) == {"archived": True} denied = await session.call_tool(RESTRICTED, {}) assert denied.isError and "Access denied" in tool_text(denied) invalid = await session.call_tool(LOOKUP, {"note_id": ["invalid"]}) @@ -94,10 +100,22 @@ async def verify_mcp(mcp: APCoreMCP, notebook: Notebook, reviews: DemoReviewQueu pending = await session.call_tool(ARCHIVE, arguments) assert pending.isError and "Approval pending" in tool_text(pending) assert notebook.archived == ["from-code"] - # The local review host gives the initiator the resume credential out of band. - (approval_id,) = reviews.pending - reviews.approve(approval_id) - approved = await session.call_tool(ARCHIVE, {**arguments, "_approval_token": approval_id}) + assert pending.meta is not None + approval = pending.meta["apcore"]["approval"] + approval_id, resume_token = approval["approvalId"], approval["resumeToken"] + assert approval_id != resume_token + assert resume_token not in tool_text(pending) + + poll_arguments = {"approval_id": approval_id} + status = await session.call_tool("__apcore_approval_check", poll_arguments) + assert not status.isError + assert json.loads(tool_text(status)) == {**poll_arguments, "status": "pending"} + assert await reviews.resolve(approval_id, approved=True) + status = await session.call_tool("__apcore_approval_check", poll_arguments) + assert not status.isError + assert json.loads(tool_text(status)) == {**poll_arguments, "status": "approved"} + + approved = await session.call_tool(ARCHIVE, arguments, meta={"approvalId": resume_token}) assert not approved.isError, tool_text(approved) assert json.loads(tool_text(approved)) == {"archived": "from-mcp"} assert notebook.archived == ["from-code", "from-mcp"] @@ -105,14 +123,18 @@ async def verify_mcp(mcp: APCoreMCP, notebook: Notebook, reviews: DemoReviewQueu async def main() -> None: notebook = Notebook() - reviews = DemoReviewQueue() audit: list[AuditEntry] = [] - client = build_app(notebook, reviews, audit) - try: - await verify_direct(client, notebook, reviews) - await verify_mcp(build_mcp(client, reviews), notebook, reviews) - finally: - await client.shutdown() + async with AsyncExitStack() as cleanup: + direct = build_app(notebook, audit) + cleanup.push_async_callback(direct.shutdown) + direct_reviews = InMemoryApprovalStore() + direct.executor.set_approval_handler(StorageBackedApprovalHandler(direct_reviews)) + await verify_direct(direct, notebook, direct_reviews) + + mcp_client = build_app(notebook, audit) + cleanup.push_async_callback(mcp_client.shutdown) + mcp_reviews = InMemoryApprovalStore() + await verify_mcp(build_mcp(mcp_client, mcp_reviews), notebook, mcp_reviews) assert sum(entry.decision == "deny" and entry.target_id == RESTRICTED for entry in audit) == 2 assert sum(entry.decision == "allow" and entry.target_id == ARCHIVE for entry in audit) == 4 From 852bf90ee6c0243cb2322b4938482b0c1d8d7a6d Mon Sep 17 00:00:00 2001 From: tercel Date: Fri, 27 Nov 2026 14:30:15 +0800 Subject: [PATCH 8/8] ci: verify the final alpha.1 approval candidate Signed-off-by: tercel --- .github/workflows/surfaces-alpha1-ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/surfaces-alpha1-ci.yml b/.github/workflows/surfaces-alpha1-ci.yml index f1e36214..cca63ca0 100644 --- a/.github/workflows/surfaces-alpha1-ci.yml +++ b/.github/workflows/surfaces-alpha1-ci.yml @@ -11,11 +11,12 @@ permissions: jobs: verify: - uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@329ce88e93231810ad9e8ba764e3cbe9008abd3a + uses: aiperceivable/apcore-surfaces/.github/workflows/core-candidate.yml@fa3ab784dc5f69afa75c0a8e969fb8d985b187ed with: core_run_id: '45933698251' core_sha: b28e1bfd01b804c8662e9e418d8487d0e08cc0ce - surfaces_sha: 329ce88e93231810ad9e8ba764e3cbe9008abd3a + core_example_sha: eb2e795e47070369e2347e8a1f4b625831c877c7 + surfaces_sha: fa3ab784dc5f69afa75c0a8e969fb8d985b187ed python_sha256: 9a7de3440413cf891ec2efb4a634350efbbf28659734ddad1c28db70182e7bff npm_sha256: 833e1f2e4c9328c0c4192c02d9e2c8bfbb62ae651fddd62980b448c41d5842db rust_sha256: bbc1db3680f3d81b7096fa5eb70476a2c043b333681c2a7bba3597a49bbf11f6