Skip to content
Closed
Show file tree
Hide file tree
Changes from 10 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
36 changes: 35 additions & 1 deletion desktop/VALIDATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,48 @@ The historical Server c535d816 protocol qualification below records the specific

## Compatibility scope

[compatibility.json](src-tauri/src/connections/compatibility.json) preserves each recorded Server source, normalized OpenAPI contract digest, qualification-wheel digest and operation set. `sqlite-stats-63e9665c-v1` records the current bundled contract's twelve operations, including statistics, qualified below. `sqlite-atomic-3cefa45a-v1` retains its independently qualified eleven operations at the same contract digest. `sqlite-stats-9c8f061c-v1` retains its original historical qualification and digest. `sqlite-atomic-112db11e-v1` retains its independently qualified eleven operations. Historical records retain their exact identities and evidence, including `sqlite-source-artifact-87b6fae2-v1` and the preceding `sqlite-artifact-merge-87d01f68-v1` record. The `sqlite-atomic-dd62723d-v1` and `sqlite-atomic-4ffdf4e9-v1` records retain their migration-framework and release-preparation source qualifications with their original contract digest. Other historical records also retain their exact identities and evidence. Ordinary builds require explicitly selecting the record whose tested Server source and wheel match the deployment, then checking the connection before business operations become available. Records with a different contract digest are disabled in the selector, and saved unavailable selections remain visible until explicitly replaced. Selecting a profile does not extend its recorded operation set or qualify a different Server source. CI builds have their own artifact identities and do not change product qualification.
[compatibility.json](src-tauri/src/connections/compatibility.json) preserves each recorded Server source, normalized OpenAPI contract digest, qualification-wheel digest and operation set. `sqlite-stats-18d062ce-v1` records the current bundled contract's twelve operations, including statistics, qualified below. `sqlite-stats-63e9665c-v1` retains its statistics qualification at its earlier contract digest. `sqlite-atomic-3cefa45a-v1` retains its independently qualified eleven operations at the same contract digest. `sqlite-stats-9c8f061c-v1` retains its original historical qualification and digest. `sqlite-atomic-112db11e-v1` retains its independently qualified eleven operations. Historical records retain their exact identities and evidence, including `sqlite-source-artifact-87b6fae2-v1` and the preceding `sqlite-artifact-merge-87d01f68-v1` record. The `sqlite-atomic-dd62723d-v1` and `sqlite-atomic-4ffdf4e9-v1` records retain their migration-framework and release-preparation source qualifications with their original contract digest. Other historical records also retain their exact identities and evidence. Ordinary builds require explicitly selecting the record whose tested Server source and wheel match the deployment, then checking the connection before business operations become available. Records with a different contract digest are disabled in the selector, and saved unavailable selections remain visible until explicitly replaced. Selecting a profile does not extend its recorded operation set or qualify a different Server source. CI builds have their own artifact identities and do not change product qualification.

The real Server harness covers SQLite with anonymous loopback, static Bearer, HTTPS with explicit CA/base path, and injected-provider/enforced access. It exercises save/search/exact reads, identity changes, binding revocation, ambiguous writes without replay and Scope pagination. Installed UI checks cover repeated launches preserving the existing editor, late committed-save responses preserving a new Scope draft, explicit connection/Scope selection, clipboard copies, connection isolation, draft cancellation, byte limits and independent Server survival after Desktop exit. Historical record `sqlite-atomic-f3a90b2f-v1` remains preserved with its original identities and is disabled for this contract.

Selecting a compatibility profile does not attest the remote binary identity. Existing `sqlite-1.1.1-v1` / `sqlite-63f918b7-v1` / `sqlite-ab43e3a7-v1` / `sqlite-f1089f4e-v1` / `sqlite-6e237568-v1` / `sqlite-legacy-58f7f4f6-v1` selections require explicitly choosing an available matching profile and rechecking the connection. Desktop reads memories only through Atomic Memory references, so Servers that answer only with Memory entry citations are not qualified. CLI diagnostics separately verify the registered executable path and digest, then validate the diagnostic response schema. The observed version is optional report information; a registration does not require a version.

### Current-Scope statistics qualification

#### Server 18d062ce statistics product qualification

`sqlite-stats-18d062ce-v1` qualifies all twelve Desktop operations, including
`get_stats` and discovery, against Server source
`18d062ce09cf6700efb489531cb6be6ad3dd7ea5` and normalized OpenAPI digest
`f74fa13f2d75fc9aa6d53187f57ab92dcb2acf26b536f2ea4b004c903f2f3061`.
Wheel: `powercontext-1.4.2.dev256+g18d062ce0-py3-none-any.whl`, built with `uv build --wheel` from that commit.
Wheel SHA-256: `01bcb6f0a518d544b4ee5ddc0513613ebd02d27a6f563e2e9b50cd4e11be8509`.
All 704 packaged runtime files match the commit byte for byte, without missing or extra files.
The sorted newline-terminated `wheel/path sha256` manifest hashes to
`a106efcaa09f84c64863789988d38d2b635ca73acd134267fdad13499fb27270`.
The contract change adds optional context-check fields (`conversation_id`, `parent_conversation_id`,
`encrypted_receipts`, and `receipt`, which a check returns at `before_send` and `before_release`) and
`context_protection.output_limits` in capabilities; the twelve qualified operations are unchanged.

On 2026-11-05, Linux x86_64 (Ubuntu 24.04) with Python 3.13.18 and Rust 1.95.0 passed all four
built-wheel SQLite modes with `--product-qualification sqlite-stats-18d062ce-v1`: anonymous loopback,
static Bearer loopback, explicit-CA HTTPS with a base path, and enforced authentication Provider. The
provider case also verified identity invalidation, same-identity revocation, and 51 same-title Scopes;
every mode verified an unknown write without replay and Server survival after the client exited. The
harness verified the selected product record's wheel, contract and operation identity. The native probe
(debug profile, SHA-256 `2a6b74385dca40ce5148dff12162a642e166c3a9234759c29d31472579aa0ff8`) was built
outside the Tauri build container from the Desktop tree at that commit plus this record; the report marks
that working tree as uncommitted. No CPU affinity was needed, and no assertions or timeouts were changed.

```sh
cargo build --locked --manifest-path desktop/src-tauri/Cargo.toml --example server_probe
uv run --no-sync python desktop/tests/real_server.py --product-qualification sqlite-stats-18d062ce-v1
cargo test --locked --manifest-path desktop/src-tauri/Cargo.toml --test session bundled_product_qualification_covers_every_desktop_operation
```

These checks establish the local built-wheel/native SQLite path. Context checks and receipts, model quality,
installed Windows/macOS packages, signing, and database upgrades require separate checks.

#### Server 63e9665c statistics product qualification

`sqlite-stats-63e9665c-v1` qualifies all twelve Desktop operations, including
Expand Down
21 changes: 21 additions & 0 deletions desktop/src-tauri/src/connections/compatibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -901,5 +901,26 @@
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-63e9665c-statistics-product-qualification"
},
{
"id": "sqlite-stats-18d062ce-v1",
"serverCommit": "18d062ce09cf6700efb489531cb6be6ad3dd7ea5",
"contractSha256": "f74fa13f2d75fc9aa6d53187f57ab92dcb2acf26b536f2ea4b004c903f2f3061",
"artifactSha256": "01bcb6f0a518d544b4ee5ddc0513613ebd02d27a6f563e2e9b50cd4e11be8509",
"operations": [
"get_access_principal",
"get_artifact_revision",
"get_capabilities",
"get_default_scope",
"get_liveness",
"get_readiness",
"get_scope",
"get_server_info",
"get_stats",
"list_scopes",
"remember_memory",
"search_memory"
],
"evidence": "desktop/VALIDATION.md#server-18d062ce-statistics-product-qualification"
}
]
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": "d59da9040814d0f2b25d930ecb36b93d932ff8906440606d259d3b9456364d3d",
"contractSha256": "f74fa13f2d75fc9aa6d53187f57ab92dcb2acf26b536f2ea4b004c903f2f3061",
"operations": {
"get_liveness": {
"method": "GET",
Expand Down
5 changes: 5 additions & 0 deletions desktop/src-tauri/src/transport/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,10 @@ pub struct ContextProtectionCapabilities {
pub enforcing: bool,
#[serde(rename = "limits")]
pub limits: ContextProtectionCapabilitiesLimits,
/// Configured `max_output_tokens` by target profile, for targets that declare one. A colocated gateway uses the value of its own target when a client request omits an output limit; the final request is still checked against the same limit.
#[ts(optional)]
#[serde(rename = "output_limits", skip_serializing_if = "Option::is_none")]
pub output_limits: Option<std::collections::HashMap<String, i32>>,
}

impl ContextProtectionCapabilities {
Expand All @@ -889,6 +893,7 @@ impl ContextProtectionCapabilities {
reuse_families,
enforcing,
limits,
output_limits: None,
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions desktop/ui/src/generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,12 @@ export interface components {
target_profile: string;
payload: components["schemas"]["ModelJsonPayload"];
prepared_contexts: components["schemas"]["PreparedContextLocation"][];
/** @description Trusted conversation of the request, as resolved by the executor. */
conversation_id?: string;
/** @description For a subagent, the conversation that handed it its task. Receipts issued to that conversation also prove the origin of encrypted items in this request. */
parent_conversation_id?: string;
/** @description Receipts from earlier check results. For a target that admits encrypted items, each admitted encrypted value must be proven, unexpired, by a receipt for the same principal, Scope and target issued to this conversation. A receipt issued to the parent conversation proves only the values it holds for handover, and only as an agent_message task. Otherwise the request is withheld with encrypted-origin-unverified. Admission does not mean Core inspected the plaintext. */
encrypted_receipts?: string[];
};
CheckContextBeforeRelease: {
scope_id: string;
Expand All @@ -4268,6 +4274,8 @@ export interface components {
payload: components["schemas"]["ModelJsonPayload"];
/** @enum {string} */
completion: "complete";
/** @description Trusted conversation of the request; receipts are issued only when it is present. */
conversation_id?: string;
};
CheckContextRequest: components["schemas"]["CheckContextBeforeSend"] | components["schemas"]["CheckContextBeforeRelease"];
ContextCheckCoverage: {
Expand All @@ -4294,6 +4302,8 @@ export interface components {
correlate_until?: string;
/** @description Present only for allow, bound to this phase, identity, target, policy, and exact payload. */
binding?: string;
/** @description For a target that admits encrypted items and a request that names a conversation. On a before_release allow it proves the response's encrypted values and, for handover, the values of its function-call arguments that the checked request declared encrypted, for one hour. On a before_send allow it replaces the receipts of that conversation that the request presented: it carries every unexpired proof they held with its expiry, and renews for one hour the values the request carried and the proven handover values its replayed function calls carry. A check whose values do not fit one receipt is withheld with encrypted-receipt-capacity-exceeded. */
receipt?: string;
};
ContextProtectionCapabilities: {
check_versions: string[];
Expand All @@ -4302,6 +4312,10 @@ export interface components {
reuse_families: string[];
enforcing: boolean;
limits: components["schemas"]["ContextProtectionCapabilitiesLimits"];
/** @description Configured `max_output_tokens` by target profile, for targets that declare one. A colocated gateway uses the value of its own target when a client request omits an output limit; the final request is still checked against the same limit. */
output_limits?: {
[key: string]: number;
};
};
ContextProtectionCapabilitiesLimits: {
payload_bytes: number;
Expand Down
6 changes: 5 additions & 1 deletion desktop/ui/src/generated/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ external_skill_registry?: boolean,
*/
handoff_generation: boolean, search_modes: Array<MemorySearchMode>, context_versions: Array<PreparedContextSchema>, context_protection?: ContextProtectionCapabilities, };
export type Configuration = "configured" | "unconfigured" | "unknown";
export type ContextProtectionCapabilities = { check_versions: Array<string>, payload_versions: Array<string>, reuse_versions: Array<string>, reuse_families: Array<string>, enforcing: boolean, limits: ContextProtectionCapabilitiesLimits, };
export type ContextProtectionCapabilities = { check_versions: Array<string>, payload_versions: Array<string>, reuse_versions: Array<string>, reuse_families: Array<string>, enforcing: boolean, limits: ContextProtectionCapabilitiesLimits,
/**
* Configured `max_output_tokens` by target profile, for targets that declare one. A colocated gateway uses the value of its own target when a client request omits an output limit; the final request is still checked against the same limit.
*/
output_limits?: { [key in string]: number }, };
export type ContextProtectionCapabilitiesLimits = { payload_bytes: number, binding_bytes: number, prepared_contexts: number, dependencies: number, send_seconds: number, correlate_seconds: number, };
export type ContractVersion = { major: number, minor: number, };
export type CustomArtifactFamilySchema = { family: string, schema_version: string, content_schema: Record<string, unknown>,
Expand Down
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 = "d59da9040814d0f2b25d930ecb36b93d932ff8906440606d259d3b9456364d3d";
export const contractSha256 = "f74fa13f2d75fc9aa6d53187f57ab92dcb2acf26b536f2ea4b004c903f2f3061";
export const operations = {
"get_liveness": {
"method": "GET",
Expand Down
17 changes: 17 additions & 0 deletions docs/en/docs/operate/deploy-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,23 @@ translates its requests to the Chat or Responses route and forwards them. Set `P
(`PC_GATEWAY_CORE_BASE`) injects only with `PC_GATEWAY_INJECTION=on`. An empty or failed preparation sends the request
without injection.

### Gateway output limit

An enforcing Server requires every generation request to set an output limit, and some clients never send one;
Codex 0.145, for example, sends no `max_output_tokens`. When a Chat or Responses request sets no limit, the gateway adds
the `max_output_tokens` configured for its target (`PC_GATEWAY_UPSTREAM_PROFILE`) in the Server's inference protection
settings. It reads that value from the Server's capabilities once at startup, so the limit is configured only on the
Server. On the Chat route the added limit uses `max_completion_tokens`. The limit is added before the request is
checked, and the Server checks the final request as usual; a limit the client sets, and its field, are kept. Without a
configured limit for the target nothing is added.

For a target whose Server configuration sets `admit_encrypted_items`, the gateway keeps the encrypted-content
receipts that Core returns, per conversation, for one hour. It presents them with later requests of the same
conversation, and of subagent conversations started from it (`x-codex-parent-thread-id`, Claude Code parent agent,
OpenCode parent session). When a send check returns a consolidated receipt, the gateway replaces only the receipts of
that conversation that the request presented; receipts added since and the parent's receipts are kept. Requests
without a conversation never inherit receipts.

### Gateway instruction

`PC_GATEWAY_STEERING_FILE` names a file with a short, fixed instruction that the gateway adds to every request on the
Expand Down
30 changes: 30 additions & 0 deletions docs/en/docs/operate/inference-protection.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@ Keep secret values in the deployment's protected configuration. Never put real c
Exact model aliases returned by a provider must be explicitly listed in `response_models` when they differ from
the requested model.

An `openai-responses` target can set `admit_encrypted_items` to `["reasoning"]`, `["agent_message"]`, or both.
It is empty by default. Clients such as Codex send `store: false` with `include: ["reasoning.encrypted_content"]`,
so responses carry encrypted reasoning that later requests replay, and a subagent receives its task as an encrypted
`agent_message` part. Core cannot inspect these values:

- At `before_release`, Core admits the encrypted reasoning in the response. When the request names a conversation, it
returns a `receipt` for that principal, Scope, target and conversation, valid for one hour. The receipt proves the
response's encrypted values. It also proves, as handover values, the function-call argument values that the checked
request's tool definitions declare `"encrypted": true` (Codex declares the task of `spawn_agent` this way). Other
argument values are not receipted.
- At `before_send`, an encrypted value at an admitted position is admitted only when it is proven, unexpired, by a
presented receipt issued to the request's conversation. The positions are the `encrypted_content` of a root
`reasoning` item, and an `agent_message` content part whose only fields are `type: "encrypted_content"` and
`encrypted_content`. A receipt issued to the request's `parent_conversation_id` proves only its handover values, and
only in an `agent_message` part: a subagent can receive its task, never the parent's reasoning. Otherwise the request
is withheld with `encrypted-origin-unverified`.
- An allowed `before_send` with a conversation also returns one `receipt` that replaces the receipts of that
conversation the request presented. It carries every unexpired proof those receipts held, with its expiry, so a
retried or divergent history keeps its proof. It renews for one hour the values the request carried and the proven
handover values its replayed function calls carry, so a parent that keeps talking does not strand a pending
subagent's task. A long conversation therefore presents a constant number of receipts, and a value stays admissible
for one hour after its last verified use.
- One receipt holds at most 1,024 values. A check whose values do not fit is withheld with
`encrypted-receipt-capacity-exceeded` rather than leaving a later request without proof.
- Encrypted values at any other position, and an `agent_message` part with any other field, stay
`content_unsupported`.

Admission proves where a value came from, not what it contains: Core has not inspected the plaintext. The PowerContext
gateway keeps and presents receipts per conversation.

The supported rules match configured exact values and optional bounded formats: `email`, `private_key`, and
`api_token`. Both raw JSON and decoded text, tool arguments, and numeric spellings are inspected. Duplicate JSON
keys, opaque image/audio/file carriers, unknown request fields, incomplete output, and unsupported targets cannot
Expand Down
Loading
Loading