dapr-ext-strands-dev 1.16.0.dev60__py3-none-any.whl

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.
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """
4
+ Copyright 2025 The Dapr Authors
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ """
15
+
16
+ # Import your main classes here
17
+ from dapr.ext.strands.dapr_session_manager import DaprSessionManager
18
+
19
+ __all__ = [
20
+ 'DaprSessionManager',
21
+ ]
@@ -0,0 +1,551 @@
1
+ """
2
+ Copyright 2026 The Dapr Authors
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+ http://www.apache.org/licenses/LICENSE-2.0
7
+ Unless required by applicable law or agreed to in writing, software
8
+ distributed under the License is distributed on an "AS IS" BASIS,
9
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ See the License for the specific language governing permissions and
11
+ limitations under the License.
12
+ """
13
+
14
+ import json
15
+ import logging
16
+ from typing import Any, Dict, List, Literal, Optional, cast
17
+
18
+ from dapr.clients import DaprClient
19
+ from dapr.clients.grpc._state import Consistency, StateOptions
20
+ from strands import _identifier
21
+ from strands.session.repository_session_manager import RepositorySessionManager
22
+ from strands.session.session_repository import SessionRepository
23
+ from strands.types.exceptions import SessionException
24
+ from strands.types.session import Session, SessionAgent, SessionMessage
25
+
26
+ logger = logging.getLogger(__name__)
27
+
28
+ # Type-safe consistency constants
29
+ ConsistencyLevel = Literal['eventual', 'strong']
30
+ DAPR_CONSISTENCY_EVENTUAL: ConsistencyLevel = 'eventual'
31
+ DAPR_CONSISTENCY_STRONG: ConsistencyLevel = 'strong'
32
+
33
+
34
+ class DaprSessionManager(RepositorySessionManager, SessionRepository):
35
+ """Dapr state store session manager for distributed storage.
36
+
37
+ Stores session data in Dapr state stores (Redis, PostgreSQL, MongoDB, Cosmos DB, etc.)
38
+ with support for TTL and consistency levels.
39
+
40
+ Key structure:
41
+ - `{session_id}:session` - Session metadata
42
+ - `{session_id}:agents:{agent_id}` - Agent metadata
43
+ - `{session_id}:messages:{agent_id}` - Message list (JSON array)
44
+ """
45
+
46
+ def __init__(
47
+ self,
48
+ session_id: str,
49
+ state_store_name: str,
50
+ dapr_client: DaprClient,
51
+ ttl: Optional[int] = None,
52
+ consistency: ConsistencyLevel = DAPR_CONSISTENCY_EVENTUAL,
53
+ ):
54
+ """Initialize DaprSessionManager.
55
+
56
+ Args:
57
+ session_id: ID for the session.
58
+ ID is not allowed to contain path separators (e.g., a/b).
59
+ state_store_name: Name of the Dapr state store component.
60
+ dapr_client: DaprClient instance for state operations.
61
+ ttl: Optional time-to-live in seconds for state items.
62
+ consistency: Consistency level for state operations ("eventual" or "strong").
63
+ """
64
+ self._state_store_name = state_store_name
65
+ self._dapr_client = dapr_client
66
+ self._ttl = ttl
67
+ self._consistency = consistency
68
+ self._owns_client = False
69
+
70
+ super().__init__(session_id=session_id, session_repository=self)
71
+
72
+ @classmethod
73
+ def from_address(
74
+ cls,
75
+ session_id: str,
76
+ state_store_name: str,
77
+ dapr_address: str = 'localhost:50001',
78
+ ) -> 'DaprSessionManager':
79
+ """Create DaprSessionManager from Dapr address.
80
+
81
+ Args:
82
+ session_id: ID for the session.
83
+ state_store_name: Name of the Dapr state store component.
84
+ dapr_address: Dapr gRPC endpoint (default: localhost:50001).
85
+
86
+ Returns:
87
+ DaprSessionManager instance with owned client.
88
+ """
89
+ dapr_client = DaprClient(address=dapr_address)
90
+ manager = cls(session_id, state_store_name=state_store_name, dapr_client=dapr_client)
91
+ manager._owns_client = True
92
+ return manager
93
+
94
+ def _get_session_key(self, session_id: str) -> str:
95
+ """Get session state key.
96
+
97
+ Args:
98
+ session_id: ID for the session.
99
+
100
+ Returns:
101
+ State store key for the session.
102
+
103
+ Raises:
104
+ ValueError: If session id contains a path separator.
105
+ """
106
+ session_id = _identifier.validate(session_id, _identifier.Identifier.SESSION)
107
+ return f'{session_id}:session'
108
+
109
+ def _get_agent_key(self, session_id: str, agent_id: str) -> str:
110
+ """Get agent state key.
111
+
112
+ Args:
113
+ session_id: ID for the session.
114
+ agent_id: ID for the agent.
115
+
116
+ Returns:
117
+ State store key for the agent.
118
+
119
+ Raises:
120
+ ValueError: If session id or agent id contains a path separator.
121
+ """
122
+ session_id = _identifier.validate(session_id, _identifier.Identifier.SESSION)
123
+ agent_id = _identifier.validate(agent_id, _identifier.Identifier.AGENT)
124
+ return f'{session_id}:agents:{agent_id}'
125
+
126
+ def _get_messages_key(self, session_id: str, agent_id: str) -> str:
127
+ """Get messages list state key.
128
+
129
+ Args:
130
+ session_id: ID for the session.
131
+ agent_id: ID for the agent.
132
+
133
+ Returns:
134
+ State store key for the messages list.
135
+
136
+ Raises:
137
+ ValueError: If session id or agent id contains a path separator.
138
+ """
139
+ session_id = _identifier.validate(session_id, _identifier.Identifier.SESSION)
140
+ agent_id = _identifier.validate(agent_id, _identifier.Identifier.AGENT)
141
+ return f'{session_id}:messages:{agent_id}'
142
+
143
+ def _get_manifest_key(self, session_id: str) -> str:
144
+ """Get session manifest key (tracks agent_ids for deletion)."""
145
+ session_id = _identifier.validate(session_id, _identifier.Identifier.SESSION)
146
+ return f'{session_id}:manifest'
147
+
148
+ def _get_read_metadata(self) -> Dict[str, str]:
149
+ """Get metadata for read operations (consistency).
150
+
151
+ Returns:
152
+ Metadata dictionary for state reads.
153
+ """
154
+ metadata: Dict[str, str] = {}
155
+ if self._consistency:
156
+ metadata['consistency'] = self._consistency
157
+ return metadata
158
+
159
+ def _get_write_metadata(self) -> Dict[str, str]:
160
+ """Get metadata for write operations (TTL).
161
+
162
+ Returns:
163
+ Metadata dictionary for state writes.
164
+ """
165
+ metadata: Dict[str, str] = {}
166
+ if self._ttl is not None:
167
+ metadata['ttlInSeconds'] = str(self._ttl)
168
+ return metadata
169
+
170
+ def _get_state_options(self) -> Optional[StateOptions]:
171
+ """Get state options for write/delete operations (consistency).
172
+
173
+ Returns:
174
+ StateOptions for consistency or None.
175
+ """
176
+ if self._consistency == DAPR_CONSISTENCY_STRONG:
177
+ return StateOptions(consistency=Consistency.strong)
178
+ elif self._consistency == DAPR_CONSISTENCY_EVENTUAL:
179
+ return StateOptions(consistency=Consistency.eventual)
180
+ return None
181
+
182
+ def _read_state(self, key: str) -> Optional[Dict[str, Any]]:
183
+ """Read and parse JSON state from Dapr.
184
+
185
+ Args:
186
+ key: State store key.
187
+
188
+ Returns:
189
+ Parsed JSON dictionary or None if not found.
190
+
191
+ Raises:
192
+ SessionException: If state is corrupted or read fails.
193
+ """
194
+ try:
195
+ response = self._dapr_client.get_state(
196
+ store_name=self._state_store_name,
197
+ key=key,
198
+ state_metadata=self._get_read_metadata(),
199
+ )
200
+
201
+ if not response.data:
202
+ return None
203
+
204
+ content = response.data.decode('utf-8')
205
+ return cast(Dict[str, Any], json.loads(content))
206
+
207
+ except json.JSONDecodeError as e:
208
+ raise SessionException(f'Invalid JSON in state key {key}: {e}') from e
209
+ except Exception as e:
210
+ raise SessionException(f'Failed to read state key {key}: {e}') from e
211
+
212
+ def _write_state(self, key: str, data: Dict[str, Any]) -> None:
213
+ """Write JSON state to Dapr.
214
+
215
+ Args:
216
+ key: State store key.
217
+ data: Dictionary to serialize and store.
218
+
219
+ Raises:
220
+ SessionException: If write fails.
221
+ """
222
+ try:
223
+ content = json.dumps(data, ensure_ascii=False)
224
+ self._dapr_client.save_state(
225
+ store_name=self._state_store_name,
226
+ key=key,
227
+ value=content,
228
+ state_metadata=self._get_write_metadata(),
229
+ options=self._get_state_options(),
230
+ )
231
+ except Exception as e:
232
+ raise SessionException(f'Failed to write state key {key}: {e}') from e
233
+
234
+ def _delete_state(self, key: str) -> None:
235
+ """Delete state from Dapr.
236
+
237
+ Args:
238
+ key: State store key.
239
+
240
+ Raises:
241
+ SessionException: If delete fails.
242
+ """
243
+ try:
244
+ self._dapr_client.delete_state(
245
+ store_name=self._state_store_name,
246
+ key=key,
247
+ options=self._get_state_options(),
248
+ )
249
+ except Exception as e:
250
+ raise SessionException(f'Failed to delete state key {key}: {e}') from e
251
+
252
+ def create_session(self, session: Session) -> Session:
253
+ """Create a new session.
254
+
255
+ Args:
256
+ session: Session to create.
257
+
258
+ Returns:
259
+ Created session.
260
+
261
+ Raises:
262
+ SessionException: If session already exists or creation fails.
263
+ """
264
+ session_key = self._get_session_key(session.session_id)
265
+
266
+ # Check if session already exists
267
+ existing = self.read_session(session.session_id)
268
+ if existing is not None:
269
+ raise SessionException(f'Session {session.session_id} already exists')
270
+
271
+ # Write session data
272
+ session_dict = session.to_dict()
273
+ self._write_state(session_key, session_dict)
274
+ return session
275
+
276
+ def read_session(self, session_id: str) -> Optional[Session]:
277
+ """Read session data.
278
+
279
+ Args:
280
+ session_id: ID of the session to read.
281
+
282
+ Returns:
283
+ Session if found, None otherwise.
284
+
285
+ Raises:
286
+ SessionException: If read fails.
287
+ """
288
+ session_key = self._get_session_key(session_id)
289
+
290
+ session_data = self._read_state(session_key)
291
+ if session_data is None:
292
+ return None
293
+
294
+ return Session.from_dict(session_data)
295
+
296
+ def delete_session(self, session_id: str) -> None:
297
+ """Delete session and all associated data.
298
+
299
+ Uses a session manifest to discover agent IDs for cleanup.
300
+ """
301
+ session_key = self._get_session_key(session_id)
302
+ manifest_key = self._get_manifest_key(session_id)
303
+
304
+ # Read manifest (may be missing if no agents created)
305
+ manifest = self._read_state(manifest_key)
306
+ agent_ids: list[str] = manifest.get('agents', []) if manifest else []
307
+
308
+ # Delete agent and message keys
309
+ for agent_id in agent_ids:
310
+ agent_key = self._get_agent_key(session_id, agent_id)
311
+ messages_key = self._get_messages_key(session_id, agent_id)
312
+ self._delete_state(agent_key)
313
+ self._delete_state(messages_key)
314
+
315
+ # Delete manifest and session
316
+ self._delete_state(manifest_key)
317
+ self._delete_state(session_key)
318
+
319
+ def create_agent(self, session_id: str, session_agent: SessionAgent) -> None:
320
+ """Create a new agent in the session.
321
+
322
+ Args:
323
+ session_id: ID of the session.
324
+ session_agent: Agent to create.
325
+
326
+ Raises:
327
+ SessionException: If creation fails.
328
+ """
329
+ agent_key = self._get_agent_key(session_id, session_agent.agent_id)
330
+ agent_dict = session_agent.to_dict()
331
+
332
+ self._write_state(agent_key, agent_dict)
333
+
334
+ # Initialize empty messages list
335
+ messages_key = self._get_messages_key(session_id, session_agent.agent_id)
336
+ self._write_state(messages_key, {'messages': []})
337
+
338
+ # Update manifest with this agent
339
+ manifest_key = self._get_manifest_key(session_id)
340
+ manifest = self._read_state(manifest_key) or {'agents': []}
341
+ if session_agent.agent_id not in manifest['agents']:
342
+ manifest['agents'].append(session_agent.agent_id)
343
+ self._write_state(manifest_key, manifest)
344
+
345
+ def read_agent(self, session_id: str, agent_id: str) -> Optional[SessionAgent]:
346
+ """Read agent data.
347
+
348
+ Args:
349
+ session_id: ID of the session.
350
+ agent_id: ID of the agent.
351
+
352
+ Returns:
353
+ SessionAgent if found, None otherwise.
354
+
355
+ Raises:
356
+ SessionException: If read fails.
357
+ """
358
+ agent_key = self._get_agent_key(session_id, agent_id)
359
+
360
+ agent_data = self._read_state(agent_key)
361
+ if agent_data is None:
362
+ return None
363
+
364
+ return SessionAgent.from_dict(agent_data)
365
+
366
+ def update_agent(self, session_id: str, session_agent: SessionAgent) -> None:
367
+ """Update agent data.
368
+
369
+ Args:
370
+ session_id: ID of the session.
371
+ session_agent: Agent to update.
372
+
373
+ Raises:
374
+ SessionException: If agent doesn't exist or update fails.
375
+ """
376
+ previous_agent = self.read_agent(session_id=session_id, agent_id=session_agent.agent_id)
377
+ if previous_agent is None:
378
+ raise SessionException(
379
+ f'Agent {session_agent.agent_id} in session {session_id} does not exist'
380
+ )
381
+
382
+ # Preserve creation timestamp
383
+ session_agent.created_at = previous_agent.created_at
384
+
385
+ agent_key = self._get_agent_key(session_id, session_agent.agent_id)
386
+
387
+ self._write_state(agent_key, session_agent.to_dict())
388
+
389
+ def create_message(
390
+ self,
391
+ session_id: str,
392
+ agent_id: str,
393
+ session_message: SessionMessage,
394
+ ) -> None:
395
+ """Create a new message for the agent.
396
+
397
+ Args:
398
+ session_id: ID of the session.
399
+ agent_id: ID of the agent.
400
+ session_message: Message to create.
401
+
402
+ Raises:
403
+ SessionException: If creation fails.
404
+ """
405
+ messages_key = self._get_messages_key(session_id, agent_id)
406
+
407
+ # Read existing messages
408
+ messages_data = self._read_state(messages_key)
409
+ if messages_data is None:
410
+ messages_list = []
411
+ else:
412
+ messages_list = messages_data.get('messages', [])
413
+ if not isinstance(messages_list, list):
414
+ messages_list = []
415
+
416
+ # Append new message
417
+ messages_list.append(session_message.to_dict())
418
+
419
+ # Write back
420
+ self._write_state(messages_key, {'messages': messages_list})
421
+
422
+ def read_message(
423
+ self, session_id: str, agent_id: str, message_id: int
424
+ ) -> Optional[SessionMessage]:
425
+ """Read message data.
426
+
427
+ Args:
428
+ session_id: ID of the session.
429
+ agent_id: ID of the agent.
430
+ message_id: Index of the message.
431
+
432
+ Returns:
433
+ SessionMessage if found, None otherwise.
434
+
435
+ Raises:
436
+ ValueError: If message_id is not an integer.
437
+ SessionException: If read fails.
438
+ """
439
+ if not isinstance(message_id, int):
440
+ raise ValueError(f'message_id=<{message_id}> | message id must be an integer')
441
+
442
+ messages_key = self._get_messages_key(session_id, agent_id)
443
+
444
+ messages_data = self._read_state(messages_key)
445
+ if messages_data is None:
446
+ return None
447
+
448
+ messages_list = messages_data.get('messages', [])
449
+ if not isinstance(messages_list, list):
450
+ messages_list = []
451
+
452
+ # Find message by ID
453
+ for msg_dict in messages_list:
454
+ if msg_dict.get('message_id') == message_id:
455
+ return SessionMessage.from_dict(msg_dict)
456
+
457
+ return None
458
+
459
+ def update_message(
460
+ self, session_id: str, agent_id: str, session_message: SessionMessage
461
+ ) -> None:
462
+ """Update message data.
463
+
464
+ Args:
465
+ session_id: ID of the session.
466
+ agent_id: ID of the agent.
467
+ session_message: Message to update.
468
+
469
+ Raises:
470
+ SessionException: If message doesn't exist or update fails.
471
+ """
472
+ previous_message = self.read_message(
473
+ session_id=session_id, agent_id=agent_id, message_id=session_message.message_id
474
+ )
475
+ if previous_message is None:
476
+ raise SessionException(f'Message {session_message.message_id} does not exist')
477
+
478
+ # Preserve creation timestamp
479
+ session_message.created_at = previous_message.created_at
480
+
481
+ messages_key = self._get_messages_key(session_id, agent_id)
482
+
483
+ # Read existing messages
484
+ messages_data = self._read_state(messages_key)
485
+ if messages_data is None:
486
+ raise SessionException(
487
+ f'Messages not found for agent {agent_id} in session {session_id}'
488
+ )
489
+
490
+ messages_list = messages_data.get('messages', [])
491
+ if not isinstance(messages_list, list):
492
+ messages_list = []
493
+
494
+ # Find and update message
495
+ updated = False
496
+ for i, msg_dict in enumerate(messages_list):
497
+ if msg_dict.get('message_id') == session_message.message_id:
498
+ messages_list[i] = session_message.to_dict()
499
+ updated = True
500
+ break
501
+
502
+ if not updated:
503
+ raise SessionException(f'Message {session_message.message_id} not found in list')
504
+
505
+ # Write back
506
+ self._write_state(messages_key, {'messages': messages_list})
507
+
508
+ def list_messages(
509
+ self,
510
+ session_id: str,
511
+ agent_id: str,
512
+ limit: Optional[int] = None,
513
+ offset: int = 0,
514
+ ) -> List[SessionMessage]:
515
+ """List messages for an agent with pagination.
516
+
517
+ Args:
518
+ session_id: ID of the session.
519
+ agent_id: ID of the agent.
520
+ limit: Maximum number of messages to return.
521
+ offset: Number of messages to skip.
522
+
523
+ Returns:
524
+ List of SessionMessage objects.
525
+
526
+ Raises:
527
+ SessionException: If read fails.
528
+ """
529
+ messages_key = self._get_messages_key(session_id, agent_id)
530
+
531
+ messages_data = self._read_state(messages_key)
532
+ if messages_data is None:
533
+ return []
534
+
535
+ messages_list = messages_data.get('messages', [])
536
+ if not isinstance(messages_list, list):
537
+ messages_list = []
538
+
539
+ # Apply pagination
540
+ if limit is not None:
541
+ messages_list = messages_list[offset : offset + limit]
542
+ else:
543
+ messages_list = messages_list[offset:]
544
+
545
+ # Convert to SessionMessage objects
546
+ return [SessionMessage.from_dict(msg_dict) for msg_dict in messages_list]
547
+
548
+ def close(self) -> None:
549
+ """Close the Dapr client if owned by this manager."""
550
+ if self._owns_client:
551
+ self._dapr_client.close()
@@ -0,0 +1,16 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ """
4
+ Copyright 2025 The Dapr Authors
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+ """
15
+
16
+ __version__ = '1.16.0.dev'
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: dapr-ext-strands-dev
3
+ Version: 1.16.0.dev60
4
+ Summary: The developmental release for the Dapr Session Manager extension for Strands Agents
5
+ Home-page: https://dapr.io/
6
+ Author: Dapr Authors
7
+ Author-email: daprweb@microsoft.com
8
+ License: Apache
9
+ Project-URL: Documentation, https://github.com/dapr/docs
10
+ Project-URL: Source, https://github.com/dapr/python-sdk
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.10
22
+ License-File: LICENSE
23
+ Requires-Dist: dapr>=1.16.1rc1
24
+ Requires-Dist: strands-agents
25
+ Requires-Dist: strands-agents-tools
26
+ Requires-Dist: python-ulid>=3.0.0
27
+ Requires-Dist: msgpack-python>=0.4.5
28
+ Dynamic: description
29
+ Dynamic: license-file
30
+ Dynamic: summary
31
+
32
+ This is the developmental release for the Dapr Session Manager extension for Strands Agents
@@ -0,0 +1,8 @@
1
+ dapr/ext/strands/__init__.py,sha256=n6PXbFuszbhJVAlr44TvzshKFI24bdVGo_FmObtkyW8,730
2
+ dapr/ext/strands/dapr_session_manager.py,sha256=WvtSc9FKNBU8AC4xVJ5T6jNvQ0B1U3xlodD6AB8NzfI,18539
3
+ dapr/ext/strands/version.py,sha256=lQx583JxGdiXBodt-fs4PlfiZmIuSE3yZj9RbHFZCow,615
4
+ dapr_ext_strands_dev-1.16.0.dev60.dist-info/licenses/LICENSE,sha256=D-QjNdE9_ypCaJn2kkQy-AYHZZ_x5aozSpR7Q1CpbRs,11377
5
+ dapr_ext_strands_dev-1.16.0.dev60.dist-info/METADATA,sha256=c9i_n-T6pVDYePPHpittXQCpIJB5iIsHpUeALJbBAbQ,1253
6
+ dapr_ext_strands_dev-1.16.0.dev60.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
7
+ dapr_ext_strands_dev-1.16.0.dev60.dist-info/top_level.txt,sha256=iLDu9C_1nUTIsa3H4jMbuHuF-zs0opkitR7p7PCPYz0,5
8
+ dapr_ext_strands_dev-1.16.0.dev60.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (79.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,203 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2021 The Dapr Authors.
190
+
191
+ and others that have contributed code to the public domain.
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.