tinymem-os 0.5.0__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.
- tinymem_os/__init__.py +157 -0
- tinymem_os/amos.py +738 -0
- tinymem_os/amos_store.py +816 -0
- tinymem_os/analyzer.py +349 -0
- tinymem_os/asset_manager.py +437 -0
- tinymem_os/cache_controller.py +130 -0
- tinymem_os/cli.py +54 -0
- tinymem_os/compiler.py +142 -0
- tinymem_os/compressor.py +188 -0
- tinymem_os/event_bus.py +93 -0
- tinymem_os/exceptions.py +67 -0
- tinymem_os/file_ops.py +256 -0
- tinymem_os/http_device.py +84 -0
- tinymem_os/llm_device.py +59 -0
- tinymem_os/memory_tools.py +212 -0
- tinymem_os/monitor.py +97 -0
- tinymem_os/portability_manager.py +202 -0
- tinymem_os/prompt_builder.py +84 -0
- tinymem_os/sandbox_executor.py +190 -0
- tinymem_os/search.py +367 -0
- tinymem_os/security_manager.py +139 -0
- tinymem_os/tar_util.py +91 -0
- tinymem_os/task_manager.py +221 -0
- tinymem_os/types.py +490 -0
- tinymem_os/utils.py +35 -0
- tinymem_os-0.5.0.dist-info/METADATA +693 -0
- tinymem_os-0.5.0.dist-info/RECORD +31 -0
- tinymem_os-0.5.0.dist-info/WHEEL +5 -0
- tinymem_os-0.5.0.dist-info/entry_points.txt +2 -0
- tinymem_os-0.5.0.dist-info/licenses/LICENSE +21 -0
- tinymem_os-0.5.0.dist-info/top_level.txt +1 -0
tinymem_os/__init__.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""tinymemOS —— AMOS-2.0 协议 Python 参考实现(v0.5)
|
|
2
|
+
|
|
3
|
+
零运行时依赖(仅 Python 标准库)。多用户 / 多 Agent 作用域模型。
|
|
4
|
+
|
|
5
|
+
快速开始:
|
|
6
|
+
from tinymem_os import AMOS
|
|
7
|
+
import asyncio
|
|
8
|
+
|
|
9
|
+
async def main():
|
|
10
|
+
amos = await AMOS.create(
|
|
11
|
+
root_dir="./amos_root",
|
|
12
|
+
actor="user_zhangsan",
|
|
13
|
+
agent="assistant",
|
|
14
|
+
summarize_fn=lambda text, instr: text[:200],
|
|
15
|
+
)
|
|
16
|
+
await amos.replace_soul("你是小深……")
|
|
17
|
+
await amos.add_turn("s1", "你好", "你好!")
|
|
18
|
+
messages = await amos.build_messages("s1", "帮我推荐酒店")
|
|
19
|
+
|
|
20
|
+
asyncio.run(main())
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from .amos import AMOS, AMOSOptions
|
|
24
|
+
from .prompt_builder import PromptBuilder
|
|
25
|
+
from .cache_controller import CacheController
|
|
26
|
+
from .compressor import SessionCompressor, CompressResult
|
|
27
|
+
from .search import MemorySearcher
|
|
28
|
+
from .asset_manager import AssetManager
|
|
29
|
+
from .memory_tools import MemoryTools
|
|
30
|
+
from .analyzer import (
|
|
31
|
+
SessionAnalyzer,
|
|
32
|
+
classify_message,
|
|
33
|
+
analyze_turn_default,
|
|
34
|
+
LLMCallFn,
|
|
35
|
+
)
|
|
36
|
+
from .compiler import WorkflowCompiler
|
|
37
|
+
from .amos_store import AmosStore
|
|
38
|
+
from .event_bus import EventBus, EventBusOptions
|
|
39
|
+
from .task_manager import TaskManager, TaskManagerOptions, TaskHandler
|
|
40
|
+
from .security_manager import SecurityManager, SecurityManagerOptions, PermissionAction
|
|
41
|
+
from .sandbox_executor import SandboxExecutor, SandboxExecutorOptions
|
|
42
|
+
from .portability_manager import PortabilityManager, ImportBundleOptions
|
|
43
|
+
from .llm_device import LLMDevice
|
|
44
|
+
from .http_device import HttpDevice, HttpRequestConfig
|
|
45
|
+
from .monitor import Monitor
|
|
46
|
+
from .tar_util import tar_pack, tar_unpack, gzip, gunzip, TarFileEntry, TarEntry
|
|
47
|
+
from .exceptions import (
|
|
48
|
+
TinymemError,
|
|
49
|
+
MemoryURIError,
|
|
50
|
+
AssetNotFoundError,
|
|
51
|
+
AssetExistsError,
|
|
52
|
+
InvalidAssetError,
|
|
53
|
+
CompressionError,
|
|
54
|
+
LLMUnavailableError,
|
|
55
|
+
ACLDeniedError,
|
|
56
|
+
TaskError,
|
|
57
|
+
SandboxError,
|
|
58
|
+
EnvVarDeniedError,
|
|
59
|
+
BundleError,
|
|
60
|
+
ProtocolVersionError,
|
|
61
|
+
)
|
|
62
|
+
from .types import (
|
|
63
|
+
Message,
|
|
64
|
+
MessageRole,
|
|
65
|
+
PromptMessage,
|
|
66
|
+
CacheMetadata,
|
|
67
|
+
SearchHit,
|
|
68
|
+
SearchAllHit,
|
|
69
|
+
AssetSearchHit,
|
|
70
|
+
IndexEntry,
|
|
71
|
+
AssetMetadata,
|
|
72
|
+
SummarizeFn,
|
|
73
|
+
AnalyzeFn,
|
|
74
|
+
TurnAnalysis,
|
|
75
|
+
MessageCategory,
|
|
76
|
+
AssetExecutor,
|
|
77
|
+
AssetExecutionResult,
|
|
78
|
+
MemoryEvent,
|
|
79
|
+
MemoryStoreLike,
|
|
80
|
+
TaskStatus,
|
|
81
|
+
AMOSTask,
|
|
82
|
+
Manifest,
|
|
83
|
+
AclEntry,
|
|
84
|
+
AclFile,
|
|
85
|
+
CapabilityCheck,
|
|
86
|
+
ImportResult,
|
|
87
|
+
LLMDeviceConfig,
|
|
88
|
+
ChatMessage,
|
|
89
|
+
ChatResponse,
|
|
90
|
+
MonitorSnapshot,
|
|
91
|
+
UpdateWorkflowMode,
|
|
92
|
+
WorkflowUpdateOptions,
|
|
93
|
+
SessionAnalysis,
|
|
94
|
+
AnalysisState,
|
|
95
|
+
SearchScope,
|
|
96
|
+
SearchOptions,
|
|
97
|
+
InjectMode,
|
|
98
|
+
RetrieveOptions,
|
|
99
|
+
CompileOptions,
|
|
100
|
+
ToolMetadata,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
VERSION = "0.5.0"
|
|
104
|
+
|
|
105
|
+
__all__ = [
|
|
106
|
+
"AMOS",
|
|
107
|
+
"AMOSOptions",
|
|
108
|
+
"PromptBuilder",
|
|
109
|
+
"CacheController",
|
|
110
|
+
"SessionCompressor",
|
|
111
|
+
"CompressResult",
|
|
112
|
+
"MemorySearcher",
|
|
113
|
+
"AssetManager",
|
|
114
|
+
"MemoryTools",
|
|
115
|
+
"SessionAnalyzer",
|
|
116
|
+
"classify_message",
|
|
117
|
+
"analyze_turn_default",
|
|
118
|
+
"LLMCallFn",
|
|
119
|
+
"WorkflowCompiler",
|
|
120
|
+
"AmosStore",
|
|
121
|
+
"EventBus",
|
|
122
|
+
"EventBusOptions",
|
|
123
|
+
"TaskManager",
|
|
124
|
+
"TaskManagerOptions",
|
|
125
|
+
"TaskHandler",
|
|
126
|
+
"SecurityManager",
|
|
127
|
+
"SecurityManagerOptions",
|
|
128
|
+
"PermissionAction",
|
|
129
|
+
"SandboxExecutor",
|
|
130
|
+
"SandboxExecutorOptions",
|
|
131
|
+
"PortabilityManager",
|
|
132
|
+
"ImportBundleOptions",
|
|
133
|
+
"LLMDevice",
|
|
134
|
+
"HttpDevice",
|
|
135
|
+
"HttpRequestConfig",
|
|
136
|
+
"Monitor",
|
|
137
|
+
"tar_pack",
|
|
138
|
+
"tar_unpack",
|
|
139
|
+
"gzip",
|
|
140
|
+
"gunzip",
|
|
141
|
+
"TarFileEntry",
|
|
142
|
+
"TarEntry",
|
|
143
|
+
"TinymemError",
|
|
144
|
+
"MemoryURIError",
|
|
145
|
+
"AssetNotFoundError",
|
|
146
|
+
"AssetExistsError",
|
|
147
|
+
"InvalidAssetError",
|
|
148
|
+
"CompressionError",
|
|
149
|
+
"LLMUnavailableError",
|
|
150
|
+
"ACLDeniedError",
|
|
151
|
+
"TaskError",
|
|
152
|
+
"SandboxError",
|
|
153
|
+
"EnvVarDeniedError",
|
|
154
|
+
"BundleError",
|
|
155
|
+
"ProtocolVersionError",
|
|
156
|
+
"VERSION",
|
|
157
|
+
]
|