ms-tau-sdk 2.0.30.dev89__tar.gz → 2.0.30.dev92__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/CHANGELOG.md +15 -1
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/PKG-INFO +1 -1
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/pyproject.toml +1 -1
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/tau_security_and_access/SKILL.md +6 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/request_identity.py +70 -11
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/models.py +14 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/chat_history.py +10 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/manager.py +10 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/requester.py +21 -2
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/session.py +11 -4
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/settings.py +26 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/mcp_applications.py +5 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/.gitignore +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/README.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/app.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/cli.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/config.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/env_file.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/logs.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/proxy.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/state.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/static/BULMA-LICENSE.txt +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/static/app.js +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/static/board.css +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/static/bulma.min.css +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/static/index.html +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/design-agent-icons-and-motion/SKILL.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/design-agent-icons-and-motion/agents/openai.yaml +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/design-agent-icons-and-motion/references/metatables-example.html +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/tau_a2a_runtime_adapter/SKILL.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/tau_local_development/SKILL.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/tau_project_customization/SKILL.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/agent_skills/tau_repository_integration/SKILL.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/a2a.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/chat.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/conversations.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/dependencies.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/health.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/inspection.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/local_chat.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/models.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/api/sessions.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/app.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/application.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/assertions.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/auth.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/client.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/local.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/mcp.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/routes.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/team_memberships.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/cli.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/errors.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/logging.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/a2a_failure.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/a2a_message.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/a2a_roles.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/assistant_ui.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/caller_context.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/strict_json.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/providers/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/providers/definitions.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/providers/factory.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/providers/tau_compat.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/SYSTEM.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/context_compat.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/loader.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/prompts/review-code-repository.md +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/selection.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/deployment_health.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/events.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/extensions.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/failures.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/live_turns.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/observability.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/provenance.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/snapshots.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/task_context.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/sessions/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/sessions/storage.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/skills.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/__init__.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/mainsequence_mcp.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/mcp_connection.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/skill_read.py +0 -0
- {ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/task_control.py +0 -0
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 2.0.30 — 2026-11-08
|
|
4
|
+
|
|
5
|
+
- **Sessions may name the person they serve, and applications learn which session a tool call
|
|
6
|
+
serves.** A session the platform returns may carry `subowner: {issuer_uid, subject}`, the person
|
|
7
|
+
its owning application named when it created the session (platform ADR-042). The runtime keeps
|
|
8
|
+
it, stamps `subownerIssuerUid` and `subownerSubject` into each turn's provenance entry, binds
|
|
9
|
+
them to the turn's log context, and names the turn's session to every declared application in
|
|
10
|
+
`X-MainSequence-Agent-Session-UID`, over MCP and through `call_release()`, so the application can
|
|
11
|
+
resolve the person from its own record of that session; project code cannot set the header.
|
|
12
|
+
The new `TAU_SUBOWNER_BAGGAGE_KEYS` setting names the two caller-context keys an application
|
|
13
|
+
uses for its people; set, a request to a session with a subowner whose baggage names another
|
|
14
|
+
person is refused with `403 subowner_mismatch`. Unset, nothing changes and baggage keeps no
|
|
15
|
+
meaning. The subowner is never a requester and grants nothing on the platform. See
|
|
16
|
+
[session subowners](docs/reference/runtime-contract.md#session-subowners) and
|
|
17
|
+
[ADR 0028](docs/adrs/0028-session-subowners-in-the-runtime.md).
|
|
4
18
|
|
|
5
19
|
- **Several Agents from one repository each load their own prompt, skills and tools.** An Agent's
|
|
6
20
|
workflow declaration can select, in `harness_agent.spec.runtime_resources`, the system prompt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ms-tau-sdk
|
|
3
|
-
Version: 2.0.30.
|
|
3
|
+
Version: 2.0.30.dev92
|
|
4
4
|
Summary: Workspace-bound Tau application primitives for Main Sequence projects
|
|
5
5
|
Project-URL: Changelog, https://github.com/mainsequence-sdk/ms-tau-sdk/blob/development/CHANGELOG.md
|
|
6
6
|
Project-URL: Documentation, https://github.com/mainsequence-sdk/ms-tau-sdk/tree/development/docs
|
|
@@ -321,6 +321,12 @@ person = baggage.get_baggage("mainsequence.advisor.person") # None when the wor
|
|
|
321
321
|
|
|
322
322
|
The SDK Security and access guide's **Caller context** section has the full rules.
|
|
323
323
|
|
|
324
|
+
An application that owns sessions for its own people can name each session's person on the
|
|
325
|
+
platform, and the runtime then tells the application which session a tool call serves. If you are
|
|
326
|
+
building that, follow **Session subowners** in the SDK runtime contract
|
|
327
|
+
(`docs/reference/runtime-contract.md`) and the matching bullet in the Security and access guide;
|
|
328
|
+
nothing in this skill restates them.
|
|
329
|
+
|
|
324
330
|
## What never reaches the model
|
|
325
331
|
|
|
326
332
|
Tool results, their `details`, and errors can reach the model provider and the session history.
|
|
@@ -12,8 +12,10 @@ context, which is the caller's claim and never identity.
|
|
|
12
12
|
|
|
13
13
|
A request that addresses an existing session must also come from the session's owner, from an
|
|
14
14
|
Organization admin, or, for a delegated child session, from the workload User of the Agent that
|
|
15
|
-
delegated to it; see ``require_session_access()``.
|
|
16
|
-
|
|
15
|
+
delegated to it; see ``require_session_access()``. When the Agent's operator declares which baggage
|
|
16
|
+
keys name the person a call is for (``TAU_SUBOWNER_BAGGAGE_KEYS``, ADR 0028), a request to a
|
|
17
|
+
session with a subowner must also name that same person in its baggage. Outside hosted mode
|
|
18
|
+
nothing here changes how requests are handled.
|
|
17
19
|
|
|
18
20
|
The raw caller assertion stays private to the request: ``request_caller_assertion()`` hands it
|
|
19
21
|
only to the turn that request starts, which presents it when it marks the turn active.
|
|
@@ -27,6 +29,7 @@ from contextvars import ContextVar
|
|
|
27
29
|
|
|
28
30
|
import structlog
|
|
29
31
|
from fastapi import FastAPI, HTTPException, Request
|
|
32
|
+
from opentelemetry import baggage as otel_baggage
|
|
30
33
|
from pydantic import ValidationError
|
|
31
34
|
from starlette.responses import JSONResponse
|
|
32
35
|
from starlette.types import ASGIApp, Receive, Scope, Send
|
|
@@ -42,7 +45,7 @@ from ms_tau_sdk.backend.assertions import (
|
|
|
42
45
|
VerifiedCaller,
|
|
43
46
|
)
|
|
44
47
|
from ms_tau_sdk.backend.client import MainSequenceClient
|
|
45
|
-
from ms_tau_sdk.backend.models import AgentSession, DirectoryUser
|
|
48
|
+
from ms_tau_sdk.backend.models import AgentSession, DirectoryUser, SessionSubowner
|
|
46
49
|
from ms_tau_sdk.backend.team_memberships import (
|
|
47
50
|
TeamMembershipCache,
|
|
48
51
|
TeamMembershipScope,
|
|
@@ -90,6 +93,54 @@ _workload_lookups: ContextVar[dict[str, DirectoryUser | None] | None] = ContextV
|
|
|
90
93
|
)
|
|
91
94
|
|
|
92
95
|
|
|
96
|
+
SUBOWNER_MISMATCH_DETAIL = (
|
|
97
|
+
"The request's caller context names another person than the session's subowner."
|
|
98
|
+
)
|
|
99
|
+
SUBOWNER_MISMATCH_CODE = "subowner_mismatch"
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class SubownerMismatchError(HTTPException):
|
|
103
|
+
"""The request addresses a session with a subowner and its baggage names someone else."""
|
|
104
|
+
|
|
105
|
+
def __init__(self) -> None:
|
|
106
|
+
super().__init__(
|
|
107
|
+
status_code=403,
|
|
108
|
+
detail={"detail": SUBOWNER_MISMATCH_DETAIL, "code": SUBOWNER_MISMATCH_CODE},
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _named_subowner(keys: tuple[str, str]) -> SessionSubowner | None:
|
|
113
|
+
"""The person the current caller context names under the declared keys, or None."""
|
|
114
|
+
|
|
115
|
+
members = otel_baggage.get_all()
|
|
116
|
+
issuer = str(members.get(keys[0]) or "").strip().lower()
|
|
117
|
+
subject = str(members.get(keys[1]) or "").strip()
|
|
118
|
+
if not issuer or not subject:
|
|
119
|
+
return None
|
|
120
|
+
return SessionSubowner(issuer_uid=issuer, subject=subject)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _baggage_names_the_subowner(
|
|
124
|
+
settings: TauSDKSettings,
|
|
125
|
+
session: AgentSession,
|
|
126
|
+
) -> bool:
|
|
127
|
+
"""Whether the request may address ``session`` as far as its subowner is concerned.
|
|
128
|
+
|
|
129
|
+
True when no keys are declared, when the session has no subowner, or when the baggage names
|
|
130
|
+
the session's subowner exactly. Comparison of the issuer is case-insensitive, as UIDs are.
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
keys = settings.subowner_baggage_keys
|
|
134
|
+
if keys is None or session.subowner is None:
|
|
135
|
+
return True
|
|
136
|
+
named = _named_subowner(keys)
|
|
137
|
+
return (
|
|
138
|
+
named is not None
|
|
139
|
+
and named.issuer_uid == session.subowner.issuer_uid.strip().lower()
|
|
140
|
+
and named.subject == session.subowner.subject
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
93
144
|
class SessionAccessDeniedError(HTTPException):
|
|
94
145
|
"""A verified caller addressed a session that it neither owns nor administers."""
|
|
95
146
|
|
|
@@ -206,12 +257,17 @@ async def require_session_access(
|
|
|
206
257
|
caller = current_caller()
|
|
207
258
|
if caller is None or not session_uid:
|
|
208
259
|
raise SessionAccessDeniedError()
|
|
209
|
-
|
|
260
|
+
checks_subowner = client.settings.subowner_baggage_keys is not None
|
|
261
|
+
if caller.is_organization_admin and not checks_subowner:
|
|
210
262
|
return None
|
|
211
263
|
session = await client.get_session(session_uid)
|
|
212
|
-
if
|
|
213
|
-
|
|
214
|
-
|
|
264
|
+
if (
|
|
265
|
+
caller.is_organization_admin
|
|
266
|
+
or session.created_by_user_uid == caller.uid
|
|
267
|
+
or await _delegated_to_caller(client, session, caller)
|
|
268
|
+
):
|
|
269
|
+
if not _baggage_names_the_subowner(client.settings, session):
|
|
270
|
+
raise SubownerMismatchError()
|
|
215
271
|
return session
|
|
216
272
|
raise SessionAccessDeniedError()
|
|
217
273
|
|
|
@@ -232,7 +288,8 @@ async def sessions_the_caller_may_address(
|
|
|
232
288
|
caller = current_caller()
|
|
233
289
|
if caller is None:
|
|
234
290
|
return set()
|
|
235
|
-
|
|
291
|
+
checks_subowner = client.settings.subowner_baggage_keys is not None
|
|
292
|
+
if caller.is_organization_admin and not checks_subowner:
|
|
236
293
|
return None
|
|
237
294
|
allowed: set[str] = set()
|
|
238
295
|
for session_uid in set(session_uids):
|
|
@@ -242,9 +299,11 @@ async def sessions_the_caller_may_address(
|
|
|
242
299
|
session = await client.get_session(session_uid)
|
|
243
300
|
except SessionNotFoundError:
|
|
244
301
|
continue
|
|
245
|
-
if
|
|
246
|
-
|
|
247
|
-
|
|
302
|
+
if (
|
|
303
|
+
caller.is_organization_admin
|
|
304
|
+
or session.created_by_user_uid == caller.uid
|
|
305
|
+
or await _delegated_to_caller(client, session, caller)
|
|
306
|
+
) and _baggage_names_the_subowner(client.settings, session):
|
|
248
307
|
allowed.add(session_uid)
|
|
249
308
|
return allowed
|
|
250
309
|
|
|
@@ -51,6 +51,18 @@ class BackendRequestModel(BackendModel):
|
|
|
51
51
|
model_config = ConfigDict(extra="forbid", populate_by_name=True)
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
class SessionSubowner(BackendModel):
|
|
55
|
+
"""The person a session serves, as the platform's owner named it (ADR 0028).
|
|
56
|
+
|
|
57
|
+
An opaque pair the owning application supplied when it created the session: the principal that
|
|
58
|
+
vouches for the person and the person's id in that principal's namespace. The platform indexes
|
|
59
|
+
it and never interprets it; it is never a User, a requester or a credential owner.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
issuer_uid: str
|
|
63
|
+
subject: str
|
|
64
|
+
|
|
65
|
+
|
|
54
66
|
class AgentSession(BackendModel):
|
|
55
67
|
organization_environment_uid: str | None = None
|
|
56
68
|
uid: str
|
|
@@ -74,6 +86,8 @@ class AgentSession(BackendModel):
|
|
|
74
86
|
)
|
|
75
87
|
status: str | None = None
|
|
76
88
|
created_by_user_uid: str | None = None
|
|
89
|
+
# The person the owner named when it created the session, or None (ADR 0028).
|
|
90
|
+
subowner: SessionSubowner | None = None
|
|
77
91
|
# The Agent of the parent session, or None for a session without a parent. The Agent that
|
|
78
92
|
# delegated to a child session addresses it with its own workload User.
|
|
79
93
|
parent_session_agent_uid: str | None = None
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/chat_history.py
RENAMED
|
@@ -324,6 +324,16 @@ def normalized_provenance(data: object) -> dict[str, str] | None:
|
|
|
324
324
|
actor_name = data.get("actorName")
|
|
325
325
|
if actor_kind == "user" and isinstance(actor_name, str) and actor_name.strip():
|
|
326
326
|
normalized["actorName"] = actor_name.strip()[:255]
|
|
327
|
+
# The session's subowner, stamped by the runtime (ADR 0028): kept only as a complete pair.
|
|
328
|
+
subowner_issuer = _canonical_uuid(data.get("subownerIssuerUid"))
|
|
329
|
+
subowner_subject = data.get("subownerSubject")
|
|
330
|
+
if (
|
|
331
|
+
subowner_issuer is not None
|
|
332
|
+
and isinstance(subowner_subject, str)
|
|
333
|
+
and subowner_subject.strip()
|
|
334
|
+
):
|
|
335
|
+
normalized["subownerIssuerUid"] = subowner_issuer
|
|
336
|
+
normalized["subownerSubject"] = subowner_subject.strip()[:255]
|
|
327
337
|
return normalized or None
|
|
328
338
|
|
|
329
339
|
|
|
@@ -25,6 +25,7 @@ from structlog.contextvars import (
|
|
|
25
25
|
bound_contextvars,
|
|
26
26
|
clear_contextvars,
|
|
27
27
|
get_contextvars,
|
|
28
|
+
unbind_contextvars,
|
|
28
29
|
)
|
|
29
30
|
from tau_agent.tools import AgentTool, AgentToolResult
|
|
30
31
|
from tau_agent.types import JSONValue
|
|
@@ -1283,6 +1284,7 @@ class SessionRuntimeManager:
|
|
|
1283
1284
|
provider_name=provider_runtime.name,
|
|
1284
1285
|
model=provider_runtime.model,
|
|
1285
1286
|
agent_uid=session.agent_uid,
|
|
1287
|
+
subowner=session.subowner,
|
|
1286
1288
|
mcp_client=mcp_client,
|
|
1287
1289
|
runtime_config_sha256=str(session_extra.get("runtime_config_sha256", "")),
|
|
1288
1290
|
provider_control_schema=bootstrap.provider_control.schema_version,
|
|
@@ -1636,6 +1638,12 @@ class SessionRuntimeManager:
|
|
|
1636
1638
|
caller_assertion=presented,
|
|
1637
1639
|
caller_delivery_uid=delivery.uid if delivery is not None else None,
|
|
1638
1640
|
)
|
|
1641
|
+
if runtime.subowner is not None:
|
|
1642
|
+
# Opaque ids, like the baggage keys the runtime already records (ADR 0028).
|
|
1643
|
+
bind_contextvars(
|
|
1644
|
+
subowner_issuer_uid=runtime.subowner.issuer_uid,
|
|
1645
|
+
subowner_subject=runtime.subowner.subject,
|
|
1646
|
+
)
|
|
1639
1647
|
requester_binding = TurnRequesterBinding(
|
|
1640
1648
|
session_uid=session_uid,
|
|
1641
1649
|
requester=self._turn_requester(runtime, task_context),
|
|
@@ -1725,6 +1733,8 @@ class SessionRuntimeManager:
|
|
|
1725
1733
|
# The requester's binding ends with the turn.
|
|
1726
1734
|
unbind_turn_requester(requester_binding, requester_token)
|
|
1727
1735
|
runtime.requester_user_uid = None
|
|
1736
|
+
if runtime.subowner is not None:
|
|
1737
|
+
unbind_contextvars("subowner_issuer_uid", "subowner_subject")
|
|
1728
1738
|
if terminal_status == "completed" and observer.terminal_failure is not None:
|
|
1729
1739
|
failure = observer.terminal_failure
|
|
1730
1740
|
terminal_status = "cancelled" if failure.reason == "aborted" else "failed"
|
|
@@ -128,17 +128,24 @@ class _RequesterPlatform(Protocol):
|
|
|
128
128
|
) -> ReleaseRuntimeAccess: ...
|
|
129
129
|
|
|
130
130
|
|
|
131
|
+
# The turn's session, named to a declared application on every call made inside a turn
|
|
132
|
+
# (ADR 0028). The runtime sets it; project code cannot, as with every X-MainSequence-* header.
|
|
133
|
+
AGENT_SESSION_HEADER = "X-MainSequence-Agent-Session-UID"
|
|
134
|
+
|
|
135
|
+
|
|
131
136
|
@dataclass(frozen=True, slots=True)
|
|
132
137
|
class _TurnApplicationAccess:
|
|
133
138
|
"""SDK-private: one application's RPC URL and a token for the turn's call.
|
|
134
139
|
|
|
135
140
|
Never give the token to the model or to project code. ``renew`` obtains a new token for the
|
|
136
|
-
same turn, from any task.
|
|
141
|
+
same turn, from any task. ``session_uid`` is the turn's session, named to the application on
|
|
142
|
+
each call, or None outside a turn.
|
|
137
143
|
"""
|
|
138
144
|
|
|
139
145
|
rpc_url: httpx.URL
|
|
140
146
|
token: str = field(repr=False)
|
|
141
147
|
renew: Callable[[], Awaitable[str]] = field(repr=False)
|
|
148
|
+
session_uid: str | None = None
|
|
142
149
|
|
|
143
150
|
|
|
144
151
|
@dataclass(slots=True)
|
|
@@ -333,6 +340,11 @@ class TurnRequesterBinding:
|
|
|
333
340
|
# client kept from another answer is sent with it. The caller context of the work goes
|
|
334
341
|
# on with it, unless the call sets those headers itself.
|
|
335
342
|
own_headers = dict(options.get("headers") or {})
|
|
343
|
+
# Inside a turn the call also names the turn's session, so that the application can
|
|
344
|
+
# resolve the person it serves from its own record of that session (ADR 0028).
|
|
345
|
+
session_headers = (
|
|
346
|
+
{AGENT_SESSION_HEADER: self.session_uid} if self.session_uid is not None else {}
|
|
347
|
+
)
|
|
336
348
|
request = httpx.Request(
|
|
337
349
|
method,
|
|
338
350
|
url,
|
|
@@ -344,6 +356,7 @@ class TurnRequesterBinding:
|
|
|
344
356
|
headers={
|
|
345
357
|
**outbound_headers(own_headers),
|
|
346
358
|
**own_headers,
|
|
359
|
+
**session_headers,
|
|
347
360
|
"Authorization": f"Bearer {token}",
|
|
348
361
|
},
|
|
349
362
|
extensions={"timeout": client.timeout.as_dict()},
|
|
@@ -683,7 +696,12 @@ async def _turn_application_access(
|
|
|
683
696
|
async def renew() -> str:
|
|
684
697
|
return (await obtain(refresh=True)).token.value
|
|
685
698
|
|
|
686
|
-
return _TurnApplicationAccess(
|
|
699
|
+
return _TurnApplicationAccess(
|
|
700
|
+
rpc_url=access.rpc_url,
|
|
701
|
+
token=access.token.value,
|
|
702
|
+
renew=renew,
|
|
703
|
+
session_uid=binding.session_uid,
|
|
704
|
+
)
|
|
687
705
|
|
|
688
706
|
|
|
689
707
|
def _canonical_uid(value: str) -> str:
|
|
@@ -803,6 +821,7 @@ def _token_access(answer: ReleaseRuntimeAccess) -> _ReleaseAccess:
|
|
|
803
821
|
|
|
804
822
|
|
|
805
823
|
__all__ = [
|
|
824
|
+
"AGENT_SESSION_HEADER",
|
|
806
825
|
"CallerDelivery",
|
|
807
826
|
"Delegation",
|
|
808
827
|
"PlatformClient",
|
|
@@ -12,7 +12,7 @@ from tau_coding import CodingSession
|
|
|
12
12
|
from tau_coding.reload import CodingReloadSummary
|
|
13
13
|
|
|
14
14
|
from ms_tau_sdk.backend.mcp import MainSequenceMCPClient
|
|
15
|
-
from ms_tau_sdk.backend.models import TauTurnCommit
|
|
15
|
+
from ms_tau_sdk.backend.models import SessionSubowner, TauTurnCommit
|
|
16
16
|
from ms_tau_sdk.resources.selection import ResolvedRuntimeResources
|
|
17
17
|
from ms_tau_sdk.runtime.events import TauRuntimeEvent, translate_tau_event
|
|
18
18
|
from ms_tau_sdk.runtime.extensions import ProjectExtensionState, log_project_resources
|
|
@@ -33,6 +33,9 @@ class ActiveSessionRuntime:
|
|
|
33
33
|
model: str = ""
|
|
34
34
|
# The Agent the session belongs to, as the platform named it when the session loaded.
|
|
35
35
|
agent_uid: str | None = None
|
|
36
|
+
# The person the owner named when it created the session, as the platform returned it at
|
|
37
|
+
# load (ADR 0028). Stamped into each turn's provenance; never read for admission here.
|
|
38
|
+
subowner: SessionSubowner | None = None
|
|
36
39
|
mcp_client: MainSequenceMCPClient | None = None
|
|
37
40
|
lease_renew_task: asyncio.Task[None] | None = None
|
|
38
41
|
persistence_task: asyncio.Task[object] | None = None
|
|
@@ -103,9 +106,13 @@ class ActiveSessionRuntime:
|
|
|
103
106
|
# the canonical entry contract, stays out of the model context,
|
|
104
107
|
# reloads as a first-class entry, and rides the turn's commit
|
|
105
108
|
# batch, so the send path gains no request.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
stamp: dict[str, JSONValue] = dict(provenance)
|
|
110
|
+
if self.subowner is not None:
|
|
111
|
+
# The platform's projection copies only the keys it knows; these stay in
|
|
112
|
+
# the entry for the application's own projections and local history.
|
|
113
|
+
stamp["subownerIssuerUid"] = self.subowner.issuer_uid
|
|
114
|
+
stamp["subownerSubject"] = self.subowner.subject
|
|
115
|
+
await self.coding_session.append_custom_entry(PROVENANCE_NAMESPACE, stamp)
|
|
109
116
|
if platform_event is not None:
|
|
110
117
|
namespace, payload = platform_event
|
|
111
118
|
await self.coding_session.append_custom_entry(namespace, dict(payload))
|
|
@@ -155,6 +155,13 @@ class TauSDKSettings(BaseSettings):
|
|
|
155
155
|
allow_inf_nan=False,
|
|
156
156
|
validation_alias="TAU_TEAM_MEMBERSHIP_CACHE_SECONDS",
|
|
157
157
|
)
|
|
158
|
+
# The two baggage keys an application uses to name the person a call is for: the issuer's and
|
|
159
|
+
# the subject's (ADR 0028). Set, a request to a session with a subowner must name the same pair
|
|
160
|
+
# in its baggage. Unset, the runtime gives baggage no meaning, as ADR-0057 asks.
|
|
161
|
+
subowner_baggage_keys: tuple[str, str] | None = Field(
|
|
162
|
+
default=None,
|
|
163
|
+
validation_alias="TAU_SUBOWNER_BAGGAGE_KEYS",
|
|
164
|
+
)
|
|
158
165
|
local_mode: bool = Field(default=False, validation_alias="TAU_LOCAL_MODE")
|
|
159
166
|
exclude_base_tools: bool = Field(default=False, validation_alias="TAU_EXCLUDE_BASE_TOOLS")
|
|
160
167
|
exclude_mainsequence_mcp: bool = Field(
|
|
@@ -393,6 +400,25 @@ class TauSDKSettings(BaseSettings):
|
|
|
393
400
|
return tuple(item.strip() for item in value.split(",") if item.strip())
|
|
394
401
|
return value
|
|
395
402
|
|
|
403
|
+
@field_validator("subowner_baggage_keys", mode="before")
|
|
404
|
+
@classmethod
|
|
405
|
+
def parse_subowner_baggage_keys(cls, value: object) -> object:
|
|
406
|
+
if value is None:
|
|
407
|
+
return None
|
|
408
|
+
if isinstance(value, str):
|
|
409
|
+
if not value.strip():
|
|
410
|
+
return None
|
|
411
|
+
value = tuple(item.strip() for item in value.split(","))
|
|
412
|
+
if isinstance(value, list | tuple):
|
|
413
|
+
keys = tuple(str(item).strip() for item in value)
|
|
414
|
+
if len(keys) != 2 or not all(keys) or keys[0] == keys[1]:
|
|
415
|
+
raise ValueError(
|
|
416
|
+
"TAU_SUBOWNER_BAGGAGE_KEYS names exactly two different baggage keys, "
|
|
417
|
+
"the issuer's then the subject's, separated by a comma"
|
|
418
|
+
)
|
|
419
|
+
return keys
|
|
420
|
+
return value
|
|
421
|
+
|
|
396
422
|
@field_validator("workspace")
|
|
397
423
|
@classmethod
|
|
398
424
|
def validate_workspace(cls, value: Path) -> Path:
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/mcp_applications.py
RENAMED
|
@@ -58,6 +58,7 @@ from ms_tau_sdk.errors import (
|
|
|
58
58
|
ConfigurationError,
|
|
59
59
|
)
|
|
60
60
|
from ms_tau_sdk.runtime.requester import (
|
|
61
|
+
AGENT_SESSION_HEADER,
|
|
61
62
|
RequesterBindingError,
|
|
62
63
|
_turn_application_access,
|
|
63
64
|
_TurnApplicationAccess,
|
|
@@ -84,11 +85,15 @@ class _ApplicationTokenAuth(httpx2.Auth):
|
|
|
84
85
|
def __init__(self, access: _TurnApplicationAccess) -> None:
|
|
85
86
|
self._token = access.token
|
|
86
87
|
self._renew = access.renew
|
|
88
|
+
self._session_uid = access.session_uid
|
|
87
89
|
|
|
88
90
|
async def async_auth_flow(
|
|
89
91
|
self,
|
|
90
92
|
request: httpx2.Request,
|
|
91
93
|
) -> AsyncGenerator[httpx2.Request, httpx2.Response]:
|
|
94
|
+
if self._session_uid is not None:
|
|
95
|
+
# The turn's session, for the application to resolve the person it serves (ADR 0028).
|
|
96
|
+
request.headers[AGENT_SESSION_HEADER] = self._session_uid
|
|
92
97
|
request.headers["Authorization"] = f"Bearer {self._token}"
|
|
93
98
|
response = yield request
|
|
94
99
|
if response.status_code == 401:
|
|
File without changes
|
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/__init__.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/app.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/cli.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/config.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/env_file.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/logs.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/proxy.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/packages/tau-board/src/ms_tau_board/state.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/backend/team_memberships.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/assistant_ui.py
RENAMED
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/protocols/caller_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/resources/context_compat.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/runtime/deployment_health.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ms_tau_sdk-2.0.30.dev89 → ms_tau_sdk-2.0.30.dev92}/src/ms_tau_sdk/tools/mainsequence_mcp.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|