From 30a8f8021369fe6838753f7566904b13b524a876 Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Mon, 16 Nov 2026 10:40:18 +0100 Subject: [PATCH] 0.36.1: a Session persisted without its version restores at 0.4 in TypeScript, as in Python PapSession.fromJson() passed no protocol version for a Session persisted before 0.36, so the new 1.0 default applied under the same sid and changed Poppy-Version mid-Session. It now restores such a Session at 0.4 (PROTOCOL_PROFILE), as PapSession.from_json() does; a Session persisted with its version keeps it, and a new one defaults to 1.0. Tests in both SDKs. --- CHANGELOG.md | 8 +++++++ docs/docs/protocol/conformance-report.mdx | 2 +- docs/docs/releases/compatibility.mdx | 3 ++- package.json | 2 +- .../__tests__/test_sessions.py | 22 +++++++++++++++++++ personal_agent_protocol/__version__.py | 2 +- personal_agent_protocol/company/__init__.py | 2 +- personal_agent_protocol/reactor.py | 2 +- src/__tests__/sessions.test.mjs | 19 ++++++++++++++++ src/company/index.ts | 2 +- src/reactor.ts | 2 +- src/sessions.ts | 6 +++-- 12 files changed, 62 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c98ab013..7e762cdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ # Changelog +## 0.36.1 (2026-11-16) + +- **A persisted Session keeps its version** (TypeScript). `PapSession.fromJson()` restores a + Session persisted without `protocol_version` (by an SDK before 0.36) at `0.4`, as Python's + `PapSession.from_json()` already did, instead of the new default `1.0` under the same `sid`, + which changed `Poppy-Version` mid-Session. A Session persisted with its version keeps it; + a new Session still defaults to `1.0`. Tests in both SDKs. + ## 0.36.0 (2026-11-16) The 1.0 draft (upstream `/docs/spec`, as of `c71f515`, 2026-11-11) becomes the **default** in diff --git a/docs/docs/protocol/conformance-report.mdx b/docs/docs/protocol/conformance-report.mdx index 2086dd64..a5510c84 100644 --- a/docs/docs/protocol/conformance-report.mdx +++ b/docs/docs/protocol/conformance-report.mdx @@ -6,7 +6,7 @@ title: Compatibility and conformance report # Compatibility and conformance report -SDK version **0.36.0**, PAP profile **0.4** (as published 2026-11-10), Operations extension **v3**; the pairings run at protocol version **1.0**, the default (the 1.0 draft as of 2026-11-11). Each pairing runs every positive, negative and recovery fixture case over real TCP and TLS, the personal agent in one language and the reference company (Manzanita) in the other. A case is skipped, never passed, when a side lacks what it needs; the reason is listed below. +SDK version **0.36.1**, PAP profile **0.4** (as published 2026-11-10), Operations extension **v3**; the pairings run at protocol version **1.0**, the default (the 1.0 draft as of 2026-11-11). Each pairing runs every positive, negative and recovery fixture case over real TCP and TLS, the personal agent in one language and the reference company (Manzanita) in the other. A case is skipped, never passed, when a side lacks what it needs; the reason is listed below. ## Pairings diff --git a/docs/docs/releases/compatibility.mdx b/docs/docs/releases/compatibility.mdx index d028841e..74d4ce7a 100644 --- a/docs/docs/releases/compatibility.mdx +++ b/docs/docs/releases/compatibility.mdx @@ -4,7 +4,7 @@ title: Compatibility # Compatibility -This page is versioned with the SDK: it describes **SDK 0.36.0**. +This page is versioned with the SDK: it describes **SDK 0.36.1**. ## The PAP version implemented @@ -34,6 +34,7 @@ profile, never picked up from an unattended fetch. | SDK (PyPI and npm) | PAP profile | Specification revision | Operations | Breaking changes | | --- | --- | --- | --- | --- | +| `0.36.1` | `0.4` | 2026-11-10 | v3 | none: a Session persisted without its version (before 0.36) restores at 0.4 in TypeScript too, as in Python | | `0.36.0` | `0.4` | 2026-11-10 | v3 | [0.35 → 0.36](/releases/migration/#035--036): the 1.0 draft is the default in both SDKs and both reference companies; 0.4 is used only when named (`protocol_versions`) | | `0.35.0` | `0.4` | 2026-11-10 | v3 | none: [0.34 → 0.35](/releases/migration/#034--035) adds the 1.0 draft as an opt-in second version (`protocol_versions`) and shows a company's domain beside its name | | `0.34.0` | `0.4` | 2026-11-10 | v3 | none: [0.33 → 0.34](/releases/migration/#033--034) adds operations on websites (`Poppy-Operation`, the operations `endpoint`) and the Browser Control extension, version 1 | diff --git a/package.json b/package.json index ec710c03..0ac5a068 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@datalayer/personal-agent-protocol", - "version": "0.36.0", + "version": "0.36.1", "description": "TypeScript SDK for Personal Agent Protocol 0.4 (2026-11-10) and its Operations extension v3", "repository": { "type": "git", diff --git a/personal_agent_protocol/__tests__/test_sessions.py b/personal_agent_protocol/__tests__/test_sessions.py index 0d2cfee9..a2265086 100644 --- a/personal_agent_protocol/__tests__/test_sessions.py +++ b/personal_agent_protocol/__tests__/test_sessions.py @@ -232,6 +232,28 @@ def handler(request: httpx.Request) -> httpx.Response: assert PapSession.from_json(first.to_json()) == first +def test_a_persisted_session_without_its_version_restores_as_0_4() -> None: + persisted: dict[str, object] = { + "sid": "AAECAwQFBgcICQoLDA0ODw", + "sub": PAIRWISE, + "issuer": ISSUER, + "client_id": CLIENT_ID, + "tenant_id": "tenant-one", + "agent_id": None, + } + assert PapSession.from_json(persisted).protocol_version == "0.4" + assert PapSession.from_json({**persisted, "protocol_version": "1.0"}).protocol_version == "1.0" + assert PapSession.from_json({**persisted, "protocol_version": "0.4"}).protocol_version == "0.4" + fresh = PapSession( + sid="AAECAwQFBgcICQoLDA0ODw", + sub=PAIRWISE, + issuer=ISSUER, + client_id=CLIENT_ID, + tenant_id="tenant-one", + ) + assert fresh.protocol_version == "1.0" + + def test_a_session_id_is_at_least_128_random_bits() -> None: assert new_session_id(fixed_random) == "AAECAwQFBgcICQoLDA0ODw" with pytest.raises(ValueError, match="128 random bits"): diff --git a/personal_agent_protocol/__version__.py b/personal_agent_protocol/__version__.py index db98ebce..05972e33 100644 --- a/personal_agent_protocol/__version__.py +++ b/personal_agent_protocol/__version__.py @@ -7,4 +7,4 @@ """Personal Agent Protocol.""" -__version__ = "0.36.0" +__version__ = "0.36.1" diff --git a/personal_agent_protocol/company/__init__.py b/personal_agent_protocol/company/__init__.py index 60ed5b33..407ba21a 100644 --- a/personal_agent_protocol/company/__init__.py +++ b/personal_agent_protocol/company/__init__.py @@ -182,7 +182,7 @@ def build_company( reactor.register_plugin( PluginManifest( name="personal-agent-protocol.company", - version="0.36.0", + version="0.36.1", contribution_points=[ COMPANY_STORES.id, COMPANY_ACCOUNTS.id, diff --git a/personal_agent_protocol/reactor.py b/personal_agent_protocol/reactor.py index 7b36db4c..3d08d3a6 100644 --- a/personal_agent_protocol/reactor.py +++ b/personal_agent_protocol/reactor.py @@ -1081,7 +1081,7 @@ def build_pap_reactor( platform.register_plugin( PluginManifest( name="personal-agent-protocol.core", - version="0.36.0", + version="0.36.1", contribution_points=[ DISCOVERY_TRANSPORTS.id, URL_SAFETY_POLICIES.id, diff --git a/src/__tests__/sessions.test.mjs b/src/__tests__/sessions.test.mjs index 8ce5c9ea..117456fc 100644 --- a/src/__tests__/sessions.test.mjs +++ b/src/__tests__/sessions.test.mjs @@ -187,6 +187,25 @@ test("a Session starts with no request and a new random sid", async () => { assert.deepEqual(PapSession.fromJson(first.toJson()).toJson(), first.toJson()); }); +test("a persisted Session without its version restores as 0.4, one with it keeps it", () => { + const persisted = { + sid: "AAECAwQFBgcICQoLDA0ODw", + sub: PAIRWISE, + issuer: ISSUER, + client_id: CLIENT_ID, + tenant_id: "tenant-one", + agent_id: null, + }; + assert.equal(PapSession.fromJson(persisted).protocolVersion, "0.4"); + assert.equal(PapSession.fromJson({ ...persisted, protocol_version: "1.0" }).protocolVersion, "1.0"); + assert.equal(PapSession.fromJson({ ...persisted, protocol_version: "0.4" }).protocolVersion, "0.4"); + assert.equal( + new PapSession({ sid: persisted.sid, sub: PAIRWISE, issuer: ISSUER, clientId: CLIENT_ID, tenantId: "tenant-one" }) + .protocolVersion, + "1.0", + ); +}); + test("a Session ID is at least 128 random bits", () => { assert.equal(newSessionId(fixedRandom), "AAECAwQFBgcICQoLDA0ODw"); assert.throws(() => newSessionId(() => new Uint8Array(5)), /128 random bits/); diff --git a/src/company/index.ts b/src/company/index.ts index 43e5255f..6f011d13 100644 --- a/src/company/index.ts +++ b/src/company/index.ts @@ -127,7 +127,7 @@ export function createCompanyDefaultsPlugin( ) { return definePlugin({ name: "personal-agent-protocol.company", - version: "0.36.0", + version: "0.36.1", contributionPoints: [ CompanyStores, CompanyAccounts, diff --git a/src/reactor.ts b/src/reactor.ts index e8259b7e..b143fea3 100644 --- a/src/reactor.ts +++ b/src/reactor.ts @@ -364,7 +364,7 @@ export function createPapCorePlugin(options: PapCoreOptions = {}) { } return definePlugin({ name: "@datalayer/personal-agent-protocol-core", - version: "0.36.0", + version: "0.36.1", contributionPoints: [ DiscoveryTransports, UrlSafetyPolicies, diff --git a/src/sessions.ts b/src/sessions.ts index 04e41f8a..c967b335 100644 --- a/src/sessions.ts +++ b/src/sessions.ts @@ -27,7 +27,7 @@ import { companySessionVersion, type DiscoveredCompany, } from "./models.js"; -import { DEFAULT_PROTOCOL_VERSION } from "./profile.js"; +import { DEFAULT_PROTOCOL_VERSION, PROTOCOL_PROFILE } from "./profile.js"; import { Clocks, DpopProvers, @@ -300,7 +300,9 @@ export class PapSession { clientId: value.client_id, tenantId: value.tenant_id, ...(value.agent_id === null ? {} : { agentId: value.agent_id }), - ...(value.protocol_version === undefined ? {} : { protocolVersion: value.protocol_version }), + // A Session persisted before it named its version was a 0.4 Session: it keeps 0.4 + // (as Python's PapSession.from_json), never the newer default under the same sid. + protocolVersion: value.protocol_version || PROTOCOL_PROFILE, ...(value.extensions === undefined ? {} : { extensions: value.extensions }), }); }