helen-lang 1.20.0__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.
Files changed (173) hide show
  1. helen_lang-1.20.0/CLAUDE.md +258 -0
  2. helen_lang-1.20.0/LICENSE +21 -0
  3. helen_lang-1.20.0/MANIFEST.in +28 -0
  4. helen_lang-1.20.0/PKG-INFO +348 -0
  5. helen_lang-1.20.0/README.md +313 -0
  6. helen_lang-1.20.0/helen/__init__.py +3 -0
  7. helen_lang-1.20.0/helen/agent/helen_assistant.helen +77 -0
  8. helen_lang-1.20.0/helen/cli/__init__.py +1 -0
  9. helen_lang-1.20.0/helen/cli/__main__.py +828 -0
  10. helen_lang-1.20.0/helen/cli/docgen.py +352 -0
  11. helen_lang-1.20.0/helen/cli/formatter.py +94 -0
  12. helen_lang-1.20.0/helen/cli/repl.py +637 -0
  13. helen_lang-1.20.0/helen/core/__init__.py +27 -0
  14. helen_lang-1.20.0/helen/core/ast.py +1419 -0
  15. helen_lang-1.20.0/helen/core/errors.py +209 -0
  16. helen_lang-1.20.0/helen/core/lexer.py +940 -0
  17. helen_lang-1.20.0/helen/core/parser.py +1763 -0
  18. helen_lang-1.20.0/helen/core/source.py +129 -0
  19. helen_lang-1.20.0/helen/core/tokens.py +304 -0
  20. helen_lang-1.20.0/helen/ffi/__init__.py +27 -0
  21. helen_lang-1.20.0/helen/ffi/contracts.py +170 -0
  22. helen_lang-1.20.0/helen/ffi/python_module.py +58 -0
  23. helen_lang-1.20.0/helen/ffi/python_object.py +127 -0
  24. helen_lang-1.20.0/helen/ffi/python_runtime.py +89 -0
  25. helen_lang-1.20.0/helen/ffi/type_converter.py +71 -0
  26. helen_lang-1.20.0/helen/interpreter/__init__.py +21 -0
  27. helen_lang-1.20.0/helen/interpreter/agent_context.py +984 -0
  28. helen_lang-1.20.0/helen/interpreter/environment.py +316 -0
  29. helen_lang-1.20.0/helen/interpreter/exceptions.py +302 -0
  30. helen_lang-1.20.0/helen/interpreter/interpreter.py +3090 -0
  31. helen_lang-1.20.0/helen/interpreter/llm_mixin.py +1420 -0
  32. helen_lang-1.20.0/helen/lsp/server.py +591 -0
  33. helen_lang-1.20.0/helen/py.typed +0 -0
  34. helen_lang-1.20.0/helen/python_bridge/__init__.py +16 -0
  35. helen_lang-1.20.0/helen/python_bridge/agent_wrapper.py +259 -0
  36. helen_lang-1.20.0/helen/python_bridge/decorators.py +91 -0
  37. helen_lang-1.20.0/helen/python_bridge/import_hook.py +82 -0
  38. helen_lang-1.20.0/helen/python_bridge/type_converter.py +76 -0
  39. helen_lang-1.20.0/helen/runtime/__init__.py +529 -0
  40. helen_lang-1.20.0/helen/runtime/async_iterator_contracts.py +47 -0
  41. helen_lang-1.20.0/helen/runtime/cache_aware_compression.py +305 -0
  42. helen_lang-1.20.0/helen/runtime/channel.py +216 -0
  43. helen_lang-1.20.0/helen/runtime/config.py +538 -0
  44. helen_lang-1.20.0/helen/runtime/constants.py +66 -0
  45. helen_lang-1.20.0/helen/runtime/context_awareness.py +158 -0
  46. helen_lang-1.20.0/helen/runtime/context_recovery.py +377 -0
  47. helen_lang-1.20.0/helen/runtime/fuzzy_match.py +620 -0
  48. helen_lang-1.20.0/helen/runtime/graduated_compression.py +709 -0
  49. helen_lang-1.20.0/helen/runtime/history.py +1050 -0
  50. helen_lang-1.20.0/helen/runtime/http_llm.py +1304 -0
  51. helen_lang-1.20.0/helen/runtime/import_resolver.py +344 -0
  52. helen_lang-1.20.0/helen/runtime/llm_runtime.py +168 -0
  53. helen_lang-1.20.0/helen/runtime/llm_summarizer.py +187 -0
  54. helen_lang-1.20.0/helen/runtime/media.py +52 -0
  55. helen_lang-1.20.0/helen/runtime/media_storage.py +350 -0
  56. helen_lang-1.20.0/helen/runtime/memory.py +144 -0
  57. helen_lang-1.20.0/helen/runtime/observability.py +595 -0
  58. helen_lang-1.20.0/helen/runtime/prompt_builder.py +343 -0
  59. helen_lang-1.20.0/helen/runtime/reactive_compaction.py +374 -0
  60. helen_lang-1.20.0/helen/runtime/session_manager.py +225 -0
  61. helen_lang-1.20.0/helen/runtime/stream_contracts.py +61 -0
  62. helen_lang-1.20.0/helen/runtime/streaming_response.py +58 -0
  63. helen_lang-1.20.0/helen/runtime/token_utils.py +105 -0
  64. helen_lang-1.20.0/helen/runtime/tools.py +685 -0
  65. helen_lang-1.20.0/helen/runtime/transcript_store.py +837 -0
  66. helen_lang-1.20.0/helen/runtime/working_memory.py +425 -0
  67. helen_lang-1.20.0/helen/semantic/__init__.py +41 -0
  68. helen_lang-1.20.0/helen/semantic/analyzer.py +1675 -0
  69. helen_lang-1.20.0/helen/semantic/symbols.py +195 -0
  70. helen_lang-1.20.0/helen/semantic/type_utils.py +72 -0
  71. helen_lang-1.20.0/helen/semantic/types.py +338 -0
  72. helen_lang-1.20.0/helen/skills/LICENSE-THIRD-PARTY.md +63 -0
  73. helen_lang-1.20.0/helen/skills/README.md +113 -0
  74. helen_lang-1.20.0/helen/skills/devops/github/ATTRIBUTION.md +22 -0
  75. helen_lang-1.20.0/helen/skills/devops/github/SKILL.md +323 -0
  76. helen_lang-1.20.0/helen/skills/devops/github/references/ci-troubleshooting.md +49 -0
  77. helen_lang-1.20.0/helen/skills/devops/github/references/conventional-commits.md +49 -0
  78. helen_lang-1.20.0/helen/skills/devops/github/references/github-api-cheatsheet.md +78 -0
  79. helen_lang-1.20.0/helen/skills/devops/github/references/review-output-template.md +53 -0
  80. helen_lang-1.20.0/helen/skills/devops/github/templates/bug-report.md +33 -0
  81. helen_lang-1.20.0/helen/skills/devops/github/templates/feature-request.md +27 -0
  82. helen_lang-1.20.0/helen/skills/devops/github/templates/pr-body-bugfix.md +25 -0
  83. helen_lang-1.20.0/helen/skills/devops/github/templates/pr-body-feature.md +31 -0
  84. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/ATTRIBUTION.md +18 -0
  85. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/SKILL.md +1041 -0
  86. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/references/code-extraction-pitfalls.md +37 -0
  87. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/references/code-to-design-compliance.md +74 -0
  88. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/references/cross-doc-consistency-method.md +69 -0
  89. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/references/method-level-verification-pattern.md +125 -0
  90. helen_lang-1.20.0/helen/skills/devops/hellen-consistency-checker/references/phase2-codebase-structure.md +150 -0
  91. helen_lang-1.20.0/helen/skills/software-development/code-quality/ATTRIBUTION.md +19 -0
  92. helen_lang-1.20.0/helen/skills/software-development/code-quality/SKILL.md +402 -0
  93. helen_lang-1.20.0/helen/skills/software-development/code-quality/references/security-hardening-checklist.md +111 -0
  94. helen_lang-1.20.0/helen/skills/software-development/debugging/ATTRIBUTION.md +19 -0
  95. helen_lang-1.20.0/helen/skills/software-development/debugging/SKILL.md +301 -0
  96. helen_lang-1.20.0/helen/skills/software-development/helen-agent-collaboration/SKILL.md +807 -0
  97. helen_lang-1.20.0/helen/skills/software-development/helen-agent-patterns/SKILL.md +1489 -0
  98. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/ATTRIBUTION.md +19 -0
  99. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/SKILL.md +589 -0
  100. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/documentation-workflow.md +248 -0
  101. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/environment-and-pitfalls.md +1732 -0
  102. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/ffi-and-agents.md +155 -0
  103. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/fuzzy-match.md +92 -0
  104. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/hld-implementation.md +156 -0
  105. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/import-system-debugging.md +203 -0
  106. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/interpreter-execution-patterns.md +102 -0
  107. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/interpreter-sentinels.md +75 -0
  108. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/parser-disambiguation.md +158 -0
  109. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/parser-optional-expression.md +172 -0
  110. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/python-ffi-implementation.md +568 -0
  111. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/repl-extension.md +354 -0
  112. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/streaming-implementation.md +87 -0
  113. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/testing-helen-programs.md +86 -0
  114. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/tutorial-sync.md +40 -0
  115. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/tutorial-testing.md +75 -0
  116. helen_lang-1.20.0/helen/skills/software-development/helen-language-development/references/v1.6-v1.7-v1.8-implementation.md +379 -0
  117. helen_lang-1.20.0/helen/skills/software-development/helen-programming-methodology/SKILL.md +437 -0
  118. helen_lang-1.20.0/helen/skills/software-development/helen-python-bridge/SKILL.md +382 -0
  119. helen_lang-1.20.0/helen/skills/software-development/helen-quality/SKILL.md +135 -0
  120. helen_lang-1.20.0/helen/skills/software-development/helen-stdlib/SKILL.md +799 -0
  121. helen_lang-1.20.0/helen/skills/software-development/helen-syntax/SKILL.md +1101 -0
  122. helen_lang-1.20.0/helen/skills/software-development/helen-testing/SKILL.md +608 -0
  123. helen_lang-1.20.0/helen/skills/software-development/plan/ATTRIBUTION.md +20 -0
  124. helen_lang-1.20.0/helen/skills/software-development/plan/SKILL.md +338 -0
  125. helen_lang-1.20.0/helen/skills/software-development/subagent-driven-development/ATTRIBUTION.md +24 -0
  126. helen_lang-1.20.0/helen/skills/software-development/subagent-driven-development/SKILL.md +624 -0
  127. helen_lang-1.20.0/helen/skills/software-development/subagent-driven-development/references/compliance-checking-pattern.md +75 -0
  128. helen_lang-1.20.0/helen/skills/software-development/subagent-driven-development/references/context-budget-discipline.md +53 -0
  129. helen_lang-1.20.0/helen/skills/software-development/subagent-driven-development/references/gates-taxonomy.md +93 -0
  130. helen_lang-1.20.0/helen/skills/software-development/test-driven-development/ATTRIBUTION.md +19 -0
  131. helen_lang-1.20.0/helen/skills/software-development/test-driven-development/SKILL.md +354 -0
  132. helen_lang-1.20.0/helen/skills/software-development/writing-plans/ATTRIBUTION.md +19 -0
  133. helen_lang-1.20.0/helen/skills/software-development/writing-plans/SKILL.md +299 -0
  134. helen_lang-1.20.0/helen/stdlib/__init__.py +1182 -0
  135. helen_lang-1.20.0/helen/stdlib/collection.py +464 -0
  136. helen_lang-1.20.0/helen/stdlib/collection_contracts.py +311 -0
  137. helen_lang-1.20.0/helen/stdlib/context.py +1530 -0
  138. helen_lang-1.20.0/helen/stdlib/crypto.py +190 -0
  139. helen_lang-1.20.0/helen/stdlib/crypto_contracts.py +159 -0
  140. helen_lang-1.20.0/helen/stdlib/data.py +587 -0
  141. helen_lang-1.20.0/helen/stdlib/data_contracts.py +235 -0
  142. helen_lang-1.20.0/helen/stdlib/data_formats.py +373 -0
  143. helen_lang-1.20.0/helen/stdlib/data_formats_contracts.py +190 -0
  144. helen_lang-1.20.0/helen/stdlib/file_advanced.py +352 -0
  145. helen_lang-1.20.0/helen/stdlib/file_advanced_contracts.py +172 -0
  146. helen_lang-1.20.0/helen/stdlib/llm_control.py +54 -0
  147. helen_lang-1.20.0/helen/stdlib/locales/__init__.py +54 -0
  148. helen_lang-1.20.0/helen/stdlib/locales/zh.py +369 -0
  149. helen_lang-1.20.0/helen/stdlib/mailbox.py +52 -0
  150. helen_lang-1.20.0/helen/stdlib/math_stats.py +254 -0
  151. helen_lang-1.20.0/helen/stdlib/math_stats_contracts.py +173 -0
  152. helen_lang-1.20.0/helen/stdlib/media.py +482 -0
  153. helen_lang-1.20.0/helen/stdlib/network.py +264 -0
  154. helen_lang-1.20.0/helen/stdlib/network_contracts.py +99 -0
  155. helen_lang-1.20.0/helen/stdlib/quality.py +1247 -0
  156. helen_lang-1.20.0/helen/stdlib/stream_contracts.py +102 -0
  157. helen_lang-1.20.0/helen/stdlib/string.py +602 -0
  158. helen_lang-1.20.0/helen/stdlib/string_contracts.py +350 -0
  159. helen_lang-1.20.0/helen/stdlib/system.py +446 -0
  160. helen_lang-1.20.0/helen/stdlib/system_contracts.py +243 -0
  161. helen_lang-1.20.0/helen/stdlib/test.py +974 -0
  162. helen_lang-1.20.0/helen/stdlib/time.py +297 -0
  163. helen_lang-1.20.0/helen/stdlib/time_contracts.py +194 -0
  164. helen_lang-1.20.0/helen/stdlib/tools.py +134 -0
  165. helen_lang-1.20.0/helen/stdlib/transcript.py +474 -0
  166. helen_lang-1.20.0/helen_lang.egg-info/PKG-INFO +348 -0
  167. helen_lang-1.20.0/helen_lang.egg-info/SOURCES.txt +171 -0
  168. helen_lang-1.20.0/helen_lang.egg-info/dependency_links.txt +1 -0
  169. helen_lang-1.20.0/helen_lang.egg-info/entry_points.txt +2 -0
  170. helen_lang-1.20.0/helen_lang.egg-info/requires.txt +15 -0
  171. helen_lang-1.20.0/helen_lang.egg-info/top_level.txt +1 -0
  172. helen_lang-1.20.0/pyproject.toml +68 -0
  173. helen_lang-1.20.0/setup.cfg +4 -0
@@ -0,0 +1,258 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working in the **Helen** repo.
4
+ For the broader multi-project layout, see `../CLAUDE.md`.
5
+
6
+ ## Overview
7
+
8
+ **Helen** — a prompt-first Agent programming language (AI-native DSL).
9
+ Combines deterministic constructs (variables, functions, control flow) with
10
+ first-class LLM primitives (`llm act`, `llm if`).
11
+
12
+ ## Development Commands
13
+
14
+ ```bash
15
+ uv pip install -e . # Install in editable mode (Python 3.12+, using uv)
16
+ uv pip install -e ".[dev]" # Install dev dependencies (pytest, flake8)
17
+ # 或者使用传统 pip
18
+ pip install -e . # Install in editable mode (Python 3.12+)
19
+ pip install -e ".[dev]" # Install dev dependencies (pytest, flake8)
20
+
21
+ # Running programs
22
+ helen <file.helen> # Execute a Helen program
23
+ helen check <file.helen> # Validate syntax/semantics without executing
24
+ helen repl # Interactive REPL
25
+
26
+ # Testing
27
+ pytest # Run all 2791+ tests
28
+ pytest tests/core/ # Run tests for a specific module
29
+ pytest tests/execution/test_functions.py::test_function_call -v # Single test
30
+ helen test <file.helen> # Run Helen's built-in test framework
31
+ helen test <file.helen> --only "name" --suite "suite" # Filtered test run
32
+
33
+ # Quality & tooling
34
+ flake8 helen/ # Lint (max-line-length=120, E501 ignored)
35
+ helen quality <file.helen> # 7-dimension quality assessment
36
+ helen doc <file.helen> # Generate documentation
37
+ helen lsp # Start Language Server (JSON-RPC over stdio)
38
+ helen init # Initialize ~/.helen/ config directory
39
+ ```
40
+
41
+ ## Architecture (3-layer pipeline)
42
+
43
+ ```
44
+ Layer 1: Helen Core (pure language)
45
+ Lexer (maximal-munch, frozenset O(1) lookup, 89 bilingual keywords)
46
+ → Parser (Pratt precedence + recursive descent)
47
+ → AST (64 frozen dataclass nodes, Visitor pattern)
48
+ → SemanticAnalyzer (two-pass for forward refs, SymbolTable, 14-type system)
49
+ → Interpreter (environment chain, sentinels for control flow)
50
+
51
+ Layer 2: Runtime (LLM integration)
52
+ LLMRuntime (abstract) → HttpLLMRuntime (httpx connection pool, OpenAI-compatible API)
53
+ Tools (10 built-in: web_search, web_fetch, read/write/patch_file, shell_exec, calculate, load_skill, find_files, search_files)
54
+ ImportResolver (.helen/.json/.yaml/.md/.txt/Python), Config, History (with compression)
55
+ TranscriptStore (v1.16: SSOT for all messages, SQLite/JSONL backends, LRU cache, UUID addressing)
56
+
57
+ Layer 3: Toolchain
58
+ CLI (run/check/repl/test/quality/doc/init/lsp)
59
+ REPL (multi-line, :help/:reset/:ask/:agent/:trace/:stats/:llm_log/:last_error/:transcript/:sessions/:session_id)
60
+ LSP (diagnostics, completion, go-to-definition, alias-aware)
61
+ VS Code Extension (syntax highlighting + LSP)
62
+ ```
63
+
64
+ ## Key Source Layout
65
+
66
+ ```
67
+ helen/
68
+ ├── core/ # lexer.py, parser.py, ast.py, tokens.py, errors.py, source_span.py
69
+ ├── semantic/ # analyzer.py (two-pass semantic analysis)
70
+ ├── interpreter/ # interpreter.py, llm_mixin.py (LLM visitor methods), environment.py, exceptions.py
71
+ ├── runtime/ # llm_runtime.py, http_llm.py, tools.py, config.py, import_resolver.py
72
+ │ # prompt_builder.py (system prompt + skill index), history.py, observability.py
73
+ │ # fuzzy_match.py (9-strategy file patching)
74
+ │ # transcript_store.py (v1.16: SSOT, SQLiteBackend, JSONLBackend, LRU cache)
75
+ │ # session_manager.py (v1.16: session lifecycle, path management)
76
+ │ # channel.py (v1.18: Channel + ChannelEndpoint message queue)
77
+ ├── stdlib/ # 287 built-in functions (string, math, crypto, collections, test, quality, context, transcript, media, etc.)
78
+ │ # locales/zh.py (287 Chinese aliases)
79
+ │ # mailbox.py (v1.18: mailbox_select for multi-channel select)
80
+ ├── ffi/ # Python FFI for importing Python modules from Helen
81
+ ├── cli/ # __main__.py (entry point), repl.py, formatter.py, docgen.py
82
+ ├── lsp/ # Language Server Protocol (JSON-RPC 2.0 over stdio)
83
+ ├── agent/ # Helen assistant program (helen_assistant.helen)
84
+ └── skills/ # 16 built-in skills (SKILL.md + references/) — distributed with the package
85
+ ├── software-development/ # helen-syntax, helen-stdlib, helen-testing, helen-quality,
86
+ │ # helen-agent-patterns, helen-agent-collaboration,
87
+ │ # helen-language-development, helen-programming-methodology,
88
+ │ # code-quality, debugging, plan, tdd, subagent-driven, writing-plans
89
+ └── devops/ # github, hellen-consistency-checker
90
+ ```
91
+
92
+ ## Language Concepts
93
+
94
+ - **Agent declarations**: First-class `agent` blocks with description, model, temperature, tools, prompt template (`{{var}}`), `functions {}` block (becomes LLM-callable tools), and `main {}` logic
95
+ - **Agent isolation levels (v1.12)**: Three decorator levels control scope access:
96
+ - `@open agent`: Can access and modify module-level `let` (breaks isolation)
97
+ - `@strict agent`: Deep-copies shared let on access (prevents accidental mutation)
98
+ - `@sandbox agent`: Forces `tools=[]` (no external tools, only load_skill)
99
+ - Default (no decorator): Standard isolation — module `let` invisible, `const` auto-visible read-only
100
+ - **Shared store & channel (v1.12-v1.13)**: Thread-safe shared state containers
101
+ - `shared store Name { fields, methods }` — mutable shared state with RLock protection
102
+ - `通道` (channel) — Chinese alias for `shared store` (same declaration syntax, same runtime)
103
+ - Chinese keywords: `仓库` (store), `通道` (channel alias)
104
+ - `_` prefix fields are private (inaccessible from agent code)
105
+ - **Channel message queue (v1.18)**: `spawn` returns a Channel (mailbox) for message-passing concurrency
106
+ - `spawn Agent(...)` — spawns agent, returns Channel immediately
107
+ - Channel methods: `send(msg)`, `receive()`, `try_receive()`, `cancel()`, `close()`
108
+ - `mailbox_select([m1, m2])` — multi-channel select (first-ready wins)
109
+ - Chinese aliases: `发送()`, `接收()`, `尝试接收()`, `取消()`, `关闭()`
110
+ - **Streaming interrupt (v1.18)**: `on_chunk` callback return `false` to stop streaming; Ctrl+C during streaming interrupts and preserves REPL state; `spawn` + `Channel.cancel()` can interrupt background agent streaming
111
+ - **Stdlib**: `cancel_llm_call()`, `current_llm_call_id()`, `cancel_all_llm_calls()`
112
+ - **中文别名**: `取消大模型调用`, `当前大模型调用id`, `取消所有大模型调用`
113
+ - **ReadOnlyView (v1.12)**: Immutable wrapper for agent parameters
114
+ - Blocks all mutation attempts → raises `ScopeViolationError`
115
+ - Supports `__getitem__`, `__len__`, `__iter__`, `__contains__`, `__bool__`, `__str__`, comparison operators, `__add__`, `__radd__`, `__hash__`
116
+ - Nested iterables auto-wrapped on iteration
117
+ - dict methods: `keys()`, `values()`, `items()`, `get()`
118
+ - **Agent scope isolation (v1.10)**: `agent main {}` runs in isolated environment. Module-level `let` is **not** visible inside agent main (compile-time error). Module-level `const` is auto-visible (read-only sharing). Use `shared let` for cross-agent visible mutable variables. Closures in agent main can capture local variables.
119
+ - **Closure value capture**: Closures capture a **deep copy** of reference-type variables (snapshot semantics, immune to subsequent modifications)
120
+ - **LLM primitives**: `llm act` (tool-calling loop + optional callbacks, usable as expression since v1.10), `llm if` (LLM-routed branching)
121
+ - v1.14: `llm stream` **deleted** — streaming merged into `llm act` with optional callbacks
122
+ - v1.17: 新增 `on_media` / `on_generate` / `provider` 子句,支持多模态输入与文生图/视频
123
+ - Syntax: `llm act "prompt" [media(...)] [provider("...")] [on_media fn(...)] [on_generate fn(...)] [on_chunk fn(...)] [on_complete fn(...)]`
124
+ - **Multimodal support (v1.17)**: 回调即适配器——协议差异由用户回调处理,Helen 核心不内置 provider 格式
125
+ - **`media()` stdlib 函数**:普通函数(非关键字),返回 `MediaPart` 对象,自动识别文件路径/URL/base64
126
+ - **`MediaPart` 数据类型**:一等公民,可赋值、传参、存入列表;字段:`source`/`content`/`mime`/`media_type`/`metadata`
127
+ - **`on_media fn(parts, provider)`**:多模态输入适配器,将 `MediaPart` 列表转换为 provider 特定格式(Content Parts);不指定时使用默认 OpenAI 兼容适配器
128
+ - **`on_generate fn(params)`**:将生成能力注册为工具,LLM 在工具循环中决定是否调用;支持文生图、文生视频等,协议差异完全由回调处理
129
+ - **设计原则**:协议未统一时不固化进语法;未来新模态/新协议无需修改语言核心,用户更新回调或 skill 即可
130
+ - **配套 skill**:`multimodal-providers` 提供各主流 provider(OpenAI/Claude/Gemini/Seedance/Kling 等)的标准回调写法模板
131
+ - **中文别名**:`媒体()`, `媒体base64()`, `是媒体()`, `媒体类型()`, `处理媒体 fn(...)`, `生成 fn(...)`
132
+ - **spawn + Channel (v1.18)**: `spawn Agent(...)` spawns an agent and returns a Channel (mailbox) immediately. The spawned agent runs in an isolated environment with a deep-copied snapshot of ALL variables (including SharedStore). Inter-agent data sharing is done explicitly by passing SharedStore references through Channel messages. `mailbox_select([m1, m2, ...])` provides multi-channel select (first-ready wins). Old async/await/detach keywords and `channel X { fields }` declaration syntax removed (v1.18).
133
+ - **Short-circuit evaluation (v1.10)**: `&&` and `||` short-circuit
134
+ - **Type system**: 14 types including Optional (`str?`), Union (`int | str`), Protocol, Agent, Literal. Return type annotation uses `:` syntax only (`fn foo(): int {}`); `->` syntax removed (v1.10)
135
+ - **Pattern matching**: `match` with range, wildcard, variable binding, type patterns
136
+ - **Exception hierarchy**: `AnyError → LLMError → TimeoutError/ModelError/AgentError`, `ToolError`, `RuntimeError` (including wrapped stdlib Python exceptions since v1.10), `AssertionError`, `AggregateError`, `ScopeViolationError`
137
+ - **Imports**: Multi-format (`.helen`, `.json`, `.yaml`, `.md`, `.txt`, Python), circular detection; imported `shared let` tracked correctly since v1.10
138
+ - **Chinese support**: 89 bilingual keywords (44.5 English + 44.5 Chinese) with full bilingual support (CJK identifiers, fullwidth punctuation since v1.10, Chinese quotes since v1.10)
139
+ - **Subscript/field assignment (v1.10)**: `arr[i] = x` and `obj.field = x` are supported as assignment targets
140
+ - **Alias statement (v1.10)**: `alias <canonical> as <alias_name>` / `别名 <canonical> 为 <alias_name>` — create aliases for stdlib, user functions, agents, and variables
141
+ - **Context management (v1.12, v1.19)**: `clear_context()` clears conversation history; `compress_context(strategy)` with strategies: `auto`, `summarize`, `truncate`, `none`. v1.19 adds 24 new stdlib functions covering 6 dimensions: Inspection (`context_stats`, `context_usage`), Working Memory (`working_memory_get/set/remove/clear`), Fine-grained Mutation (`insert/replace/delete/pin/unpin_message`), Runtime Config (`set_compression_strategy/set_context_window/set_working_memory_enabled/set_cache_aware/get_context_config`), Query (`search_context/context_slice`), Multi-Agent Transfer (`export/import/fork_context`), Lifecycle Hooks (`on_compression/on_context_overflow`). Pinned messages are immune to all 5 graduated compression layers. `classify_message` internalized (no longer public).
142
+ - **Context enhancement (v1.15, Phase 1-7)**:
143
+ - **Working Memory**: Automatically tracks active files, recent decisions, pending TODOs, error history
144
+ - **Graduated Compression**: Five-layer progressive compression (Layer 1-5, from 60% to 95% usage)
145
+ - **Cache-Aware Compression**: Preserves stable prefix (30%), improves cache hit rate from 10-20% to 70-80%
146
+ - **Three-Channel Context**: System instructions (15%) + Working memory (50%) + Conversation history (35%)
147
+ - **Agent context configuration**: `context { compression "graduated" cache-aware true working-memory true working-memory-tokens 5000 }`
148
+ - **TranscriptStore SSOT (v1.16)**: Single Source of Truth for all conversation messages
149
+ - **Persistent Sessions**: All conversations auto-saved to `~/.helen/sessions/<session_id>/`
150
+ - **Dual Backends**: JSONL (simple, human-readable) or SQLite (WAL mode, indexed, fast)
151
+ - **LRU Cache**: Memory-efficient (configurable `max_memory_items`, default 1000)
152
+ - **UUID Addressing**: O(1) lookups via `get(uuid)`, no list index dependencies
153
+ - **Non-Destructive Compression**: BoundaryMarkers record compression events, full audit trail
154
+ - **View Caching**: Dirty flag + cached view for O(1) reads
155
+ - **REPL Commands**: `:transcript [--full|--audit]`, `:sessions`, `:session_id`
156
+ - **Stdlib Functions**: `get_session_id()`, `list_sessions()`, `replay_transcript()`, `export_transcript()`, `get_compression_audit()`, `get_session_dir()`, `set_session_dir()`
157
+ - **Session Scope (v1.20)**: transcripts 默认按作用域存储——项目目录 `.helen/sessions/`(检测到 `.helen/`、`helen.yaml`、`helen.toml` 时)或全局 `~/.helen/sessions/`(REPL、脚本)。通过 `session_scope: "auto"|"global"|"project"` 配置,或 `HELEN_SESSION_DIR` 环境变量强制指定路径
158
+ - **Configuration**:
159
+ ```yaml
160
+ transcript:
161
+ enabled: true # Default: true (SSOT enabled)
162
+ backend: "sqlite" # or "jsonl"
163
+ session_scope: "auto" # "auto" (default) | "global" | "project"
164
+ session_dir: "~/.helen/sessions" # used when scope=global
165
+ project_session_dir: ".helen/sessions" # used when scope=project
166
+ max_memory_items: 1000 # LRU cache size
167
+ ```
168
+
169
+ ## Configuration
170
+
171
+ Helen uses `~/.helen/config.yaml`:
172
+ ```yaml
173
+ llm:
174
+ base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
175
+ api_key: "your-key"
176
+ model: "qwen3.7-plus"
177
+
178
+ transcript:
179
+ enabled: true
180
+ backend: "sqlite"
181
+ session_scope: "auto" # v1.20: "auto" (default) | "global" | "project"
182
+ session_dir: "~/.helen/sessions" # scope=global 时使用
183
+ project_session_dir: ".helen/sessions" # scope=project 时使用
184
+ max_memory_items: 1000
185
+
186
+ multimodal: # v1.17
187
+ max_media_size_mb: 20 # 单个媒体最大 20MB
188
+ max_media_per_request: 10 # 每次最多 10 个媒体
189
+ video_frame_interval: 1.0 # 默认视频抽帧间隔(秒)
190
+ media_cache_dir: "~/.helen/media_cache"
191
+ ```
192
+ Also supports `.env` format and falls back to `~/.hermes/.env`.
193
+
194
+ ## Testing Architecture
195
+
196
+ Tests in `tests/` mirror the source structure:
197
+ - `core/` — Lexer, parser, AST, tokens, errors
198
+ - `semantic/` — Semantic analyzer, agent scope isolation
199
+ - `interpreter/` — Interpreter, isolation (v1.12)
200
+ - `execution/` — End-to-end (agents, control flow, functions, imports, match, exceptions, v1.12 isolation, v1.18 spawn)
201
+ - `runtime/` — LLM runtime, tools, memory, history, config, imports, working memory, graduated compression, cache-aware compression, transcript store, session manager
202
+ - `stdlib/` — Standard library functions, context management, transcript functions
203
+ - `language/` — Feature tests (v16-v18: pattern matching, closures, protocols)
204
+ - `performance/` — Benchmarks
205
+ - `integration/` — Full agent integration
206
+ - `lsp/` — Language Server
207
+ - `cli/` — CLI and REPL
208
+
209
+ **2791+ tests passing** (Python pytest)
210
+
211
+ Helen also has a built-in test framework (`helen/stdlib/test.py`) with `test()`, `assert_equal()`, `assert_true()`, `assert_throws()`, expect chains, suites, filtering, JSON output, watch mode, and coverage tracking.
212
+
213
+ ## Skill System (Two-Tier Disclosure)
214
+
215
+ Helen has its own skill system (similar to Claude Code skills):
216
+ - **Tier 1**: Lightweight skill index injected into system prompt (name + description + tags)
217
+ - **Tier 2**: Full SKILL.md content loaded on-demand via `load_skill` tool
218
+ - Skill locations (priority order):
219
+ 1. `<project>/.helen/skills/` (project-level)
220
+ 2. `~/.helen/skills/` (user-level)
221
+ 3. `<helen-install>/skills/` (built-in — 16 skills)
222
+ 4. `~/.hermes/skills/` (Hermes fallback)
223
+ - Each skill is a directory with `SKILL.md` (YAML frontmatter + markdown content)
224
+ - Skills can have `references/` subdirectory for supplementary documents
225
+
226
+ ## Claude Code Skill Conversion Assessment
227
+
228
+ Helen's 16 built-in skills can be categorized for Claude Code conversion:
229
+
230
+ ### Helen-Specific Skills (convert for Helen development assistance)
231
+ | Skill | Lines | Purpose |
232
+ |-------|-------|---------|
233
+ | helen-syntax | 967 | Complete language syntax reference (92 keywords, types, expressions) |
234
+ | helen-stdlib | 533 | 198 built-in functions reference with examples |
235
+ | helen-testing | 589 | Test framework usage, TDD workflow, agent testing |
236
+ | helen-quality | 107 | 7-dimension quality assessment guide |
237
+ | helen-agent-patterns | 1115 | Agent design patterns (7 patterns + history management) |
238
+ | helen-agent-collaboration | 773 | Multi-agent collaboration patterns (6 patterns) |
239
+ | helen-language-development | 472 | Language implementation patterns (AST, parser, interpreter extension) |
240
+ | helen-programming-methodology | 437 | Contract-first + TDD + quality workflow |
241
+ | hellen-consistency-checker | 1040 | Design document consistency checking |
242
+
243
+ ### Generic Skills (already applicable to any project)
244
+ | Skill | Lines | Purpose |
245
+ |-------|-------|---------|
246
+ | code-quality | 403 | 7-dimension scoring, pre-commit verification, parallel cleanup |
247
+ | debugging | 302 | Systematic debugging methodology + language-specific tools |
248
+ | plan | 339 | Plan mode: write actionable plans without execution |
249
+ | test-driven-development | 355 | Strict TDD enforcement (RED-GREEN-REFACTOR) |
250
+ | subagent-driven-development | 625 | Execute plans via subagents with 2-stage review |
251
+ | writing-plans | 300 | Implementation plan writing craft |
252
+ | github | 324 | Complete GitHub workflow (PRs, issues, CI/CD) |
253
+
254
+ ### Conversion Strategy
255
+ 1. **Direct mapping**: Helen's SKILL.md format is already compatible with Claude Code skill format (both use YAML frontmatter + markdown)
256
+ 2. **Helen-specific skills** → Create as project skills in `.claude/skills/helen-*` for Helen development
257
+ 3. **Generic skills** → Already exist in Claude Code ecosystem; no conversion needed
258
+ 4. **Priority**: helen-syntax, helen-stdlib, helen-testing (most frequently needed for Helen dev)
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Helen Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,28 @@
1
+ # MANIFEST.in — include non-Python resources in source distribution
2
+
3
+ include LICENSE
4
+ include README.md
5
+ include CLAUDE.md
6
+
7
+ # Skills (built-in skill definitions distributed with the language)
8
+ recursive-include helen/skills *.md
9
+
10
+ # Agent program (Helen self-assistant)
11
+ recursive-include helen/agent *.helen
12
+
13
+ # PEP 561 marker
14
+ include helen/py.typed
15
+
16
+ # Exclude build/test artifacts
17
+ global-exclude *.py[cod]
18
+ global-exclude __pycache__
19
+ global-exclude *.so
20
+ prune .git
21
+ prune .github
22
+ prune tests
23
+ prune docs
24
+ prune examples
25
+ prune reports
26
+ prune wiki
27
+ prune vscode-extension
28
+ prune extensions
@@ -0,0 +1,348 @@
1
+ Metadata-Version: 2.4
2
+ Name: helen-lang
3
+ Version: 1.20.0
4
+ Summary: Helen — A Prompt-first Agent Programming Language for AI-native applications
5
+ Author-email: Helen Team <2229855189@qq.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/hahalee000000/helen
8
+ Project-URL: Repository, https://github.com/hahalee000000/helen
9
+ Project-URL: Issues, https://github.com/hahalee000000/helen/issues
10
+ Keywords: helen,dsl,agent,llm,ai,prompt,language
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Compilers
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: toml>=0.10
24
+ Requires-Dist: httpx>=0.24.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
28
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
29
+ Requires-Dist: flake8>=6.0; extra == "dev"
30
+ Provides-Extra: accurate-tokens
31
+ Requires-Dist: tiktoken>=0.5.0; extra == "accurate-tokens"
32
+ Provides-Extra: all
33
+ Requires-Dist: tiktoken>=0.5.0; extra == "all"
34
+ Dynamic: license-file
35
+
36
+ # Helen — 为 AI Agent 设计的提示词优先编程语言
37
+
38
+ [![PyPI version](https://img.shields.io/pypi/v/helen-lang.svg)](https://pypi.org/project/helen-lang/)
39
+ [![Python](https://img.shields.io/pypi/pyversions/helen-lang.svg)](https://pypi.org/project/helen-lang/)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
41
+ [![Tests](https://img.shields.io/badge/tests-2917%20passed-green.svg)](https://github.com/hahalee000000/helen)
42
+
43
+ **Helen** 是一门专为 AI Agent 开发设计的 AI 原生 DSL(领域特定语言)。它将确定性构造(变量、函数、控制流)与一等 LLM 原语(`llm act`、`llm if`)融合为一门语言。
44
+
45
+ ## ✨ 为什么选择 Helen?
46
+
47
+ - **Prompt-first**:`agent` 是一等公民,Agent 即语言构造而非库模式
48
+ - **287 个内置 stdlib 函数**:287 个中英文双语函数覆盖 AI 应用开发全链路
49
+ - **5 层渐进压缩 + 工作记忆**:长对话 Agent 自动管理上下文,无需手工调优
50
+ - **Transcript SSOT**:会话记录以 SQLite/JSONL 持久化,支持审计与回放
51
+ - **多 Agent 并发**:`spawn` + Channel 消息队列,内置 mailbox_select 多选
52
+ - **Python 双向集成**:Helen → Python FFI + Python → Helen Bridge
53
+ - **89 个双语关键字**:44.5 英文 + 44.5 中文,原生中文编程支持
54
+
55
+ ## 🚀 快速开始
56
+
57
+ ### 安装
58
+
59
+ ```bash
60
+ pip install helen-lang
61
+ ```
62
+
63
+ ### Hello Helen
64
+
65
+ 创建 `hello.helen`:
66
+
67
+ ```helen
68
+ agent Greeter(name: str) {
69
+ description "A friendly greeter"
70
+ prompt "Greet {{name}} warmly in one sentence"
71
+
72
+ main {
73
+ return llm act "Greet {{name}} warmly"
74
+ }
75
+ }
76
+
77
+ main {
78
+ let g = Greeter("World")
79
+ print(g)
80
+ }
81
+ ```
82
+
83
+ 运行:
84
+
85
+ ```bash
86
+ helen hello.helen
87
+ # Hello, World! It's wonderful to meet you!
88
+ ```
89
+
90
+ ### REPL 交互
91
+
92
+ ```bash
93
+ helen repl
94
+ > let x = 1 + 2
95
+ > print(x)
96
+ 3
97
+ > :help
98
+ ```
99
+
100
+ ### Python Bridge 用法
101
+
102
+ Helen Agent 可以通过 Python Bridge 直接在 Python 中使用,就像使用普通的 Python 类:
103
+
104
+ 1. 创建 Helen Agent 文件 `translator.helen`:
105
+
106
+ ```helen
107
+ agent TranslatorAgent(text: str, target: str) {
108
+ description "翻译文本到目标语言"
109
+ prompt "Translate '{{text}}' to {{target}}"
110
+
111
+ main {
112
+ return llm act "Translate '{{text}}' to {{target}}"
113
+ }
114
+ }
115
+ ```
116
+
117
+ 2. 在 Python 中导入并调用:
118
+
119
+ ```python
120
+ from translator import TranslatorAgent
121
+
122
+ agent = TranslatorAgent()
123
+ result = agent("Hello", "French")
124
+ print(result) # "Bonjour"
125
+ ```
126
+
127
+ ### Python 集成特性
128
+
129
+ - **直接导入 .helen 文件**:`from my_agents import TranslatorAgent`
130
+ - **类型提示支持**:IDE 自动补全 Helen Agent
131
+ - **异步调用**:`await agent.async_call(...)`
132
+ - **装饰器模式**:`@helen_agent` 装饰 Python 函数
133
+ - **参数验证**:Helen 自动校验 Agent 参数类型
134
+
135
+ ```python
136
+ from helen.python_bridge import helen_agent
137
+
138
+ @helen_agent("translator.helen", "TranslatorAgent")
139
+ def translate(text: str, target: str) -> str:
140
+ pass
141
+
142
+ result = translate("Hello", "French")
143
+ ```
144
+
145
+ ## 🎯 使用场景
146
+
147
+ ### AI Agent 开发
148
+
149
+ ```python
150
+ from agents import ResearchAgent, AnalysisAgent
151
+
152
+ # 研究阶段
153
+ researcher = ResearchAgent()
154
+ findings = researcher("quantum computing", depth="deep")
155
+
156
+ # 分析阶段
157
+ analyzer = AnalysisAgent()
158
+ insights = analyzer(findings)
159
+ ```
160
+
161
+ ### 多 Agent 协作
162
+
163
+ ```python
164
+ from workflow import PlannerAgent, ExecutorAgent, ReviewerAgent
165
+
166
+ planner = PlannerAgent()
167
+ plan = planner("Build a web app")
168
+
169
+ executor = ExecutorAgent()
170
+ result = executor(plan)
171
+
172
+ reviewer = ReviewerAgent()
173
+ feedback = reviewer(result)
174
+ ```
175
+
176
+ ### LLM 应用
177
+
178
+ ```python
179
+ from llm_agents import ChatBot, Summarizer, Translator
180
+
181
+ chatbot = ChatBot()
182
+ response = chatbot("What is AI?")
183
+
184
+ summarizer = Summarizer()
185
+ summary = summarizer(long_text)
186
+
187
+ translator = Translator()
188
+ translated = translator(summary, target="Chinese")
189
+ ```
190
+
191
+ ## 🛠️ API 参考
192
+
193
+ ### HelenAgentWrapper
194
+
195
+ ```python
196
+ class HelenAgentWrapper:
197
+ def __init__(self, agent_name: str, helen_file: str, interpreter=None)
198
+
199
+ def __call__(self, *args, **kwargs) -> Any
200
+ """调用 agent"""
201
+
202
+ async def async_call(self, *args, **kwargs) -> Any
203
+ """异步调用 agent"""
204
+ ```
205
+
206
+ ### 装饰器
207
+
208
+ ```python
209
+ @helen_agent(helen_file: str, agent_name: str = None)
210
+ def my_function(...):
211
+ """将函数包装为 Helen agent 调用"""
212
+
213
+ @helen_module(helen_file: str)
214
+ class MyModule:
215
+ """将类包装为 Helen agents 集合"""
216
+ ```
217
+
218
+ ### Import Hook
219
+
220
+ ```python
221
+ from helen.python_bridge import install_import_hook
222
+
223
+ # 自动安装(默认)
224
+ install_import_hook()
225
+
226
+ # 手动卸载
227
+ from helen.python_bridge import uninstall_import_hook
228
+ uninstall_import_hook()
229
+ ```
230
+
231
+ ## 📖 更多示例
232
+
233
+ ### 批量处理
234
+
235
+ ```python
236
+ from agents import TranslatorAgent
237
+
238
+ agent = TranslatorAgent()
239
+ texts = ["Hello", "World", "AI"]
240
+
241
+ results = [agent(text, target="French") for text in texts]
242
+ print(results) # ["Bonjour", "Monde", "IA"]
243
+ ```
244
+
245
+ ### 错误处理
246
+
247
+ ```python
248
+ from agents import TranslatorAgent
249
+
250
+ agent = TranslatorAgent()
251
+
252
+ try:
253
+ result = agent("Hello", target="French")
254
+ except TypeError as e:
255
+ print(f"参数错误: {e}")
256
+ except Exception as e:
257
+ print(f"执行错误: {e}")
258
+ ```
259
+
260
+ ### 共享解释器
261
+
262
+ ```python
263
+ from helen.interpreter import Interpreter
264
+ from helen.python_bridge import HelenAgentWrapper
265
+
266
+ # 创建共享解释器
267
+ interpreter = Interpreter()
268
+
269
+ # 多个 agent 共享同一个解释器
270
+ agent1 = HelenAgentWrapper("Agent1", "agents.helen", interpreter)
271
+ agent2 = HelenAgentWrapper("Agent2", "agents.helen", interpreter)
272
+ ```
273
+
274
+ ## 🤝 贡献
275
+
276
+ 欢迎贡献!请查看 [CONTRIBUTING.md](CONTRIBUTING.md) 了解详情。
277
+
278
+ ## 📄 许可证
279
+
280
+ MIT License
281
+
282
+ ## 🔗 链接
283
+
284
+ - 文档:https://helen.readthedocs.io
285
+ - GitHub:https://github.com/hahalee000000/helen
286
+ - PyPI:https://pypi.org/project/helen-lang
287
+
288
+ ## 📚 文档
289
+
290
+ - [Wiki 文档](wiki/index.md) - 完整的技术文档
291
+ - [教程](docs/tutorial.md) - 从零开始学习 Helen
292
+ - [Python Bridge 教程](wiki/tutorial/15-python-bridge.md) - Python 集成指南
293
+ - [上下文管理](wiki/runtime/context-management.md) - 智能上下文处理(v1.20)
294
+ - [技能系统](wiki/runtime/skills.md) - 技能加载和使用
295
+
296
+ ## 🆕 版本历史
297
+
298
+ ### v1.20 - Transcript 会话作用域
299
+ - Transcripts 默认按应用隔离在 `.helen/sessions/`(REPL 场景 opt-in 全局)
300
+ - `session_scope` 配置:`auto` | `global` | `project`
301
+ - `HELEN_SESSION_DIR` 环境变量强制指定路径
302
+ - 新增 `get_session_dir()` / `set_session_dir()` stdlib 函数
303
+
304
+ ### v1.19 - 上下文管理 API 完善
305
+ - 补齐 6 维度 API(Inspection/Working Memory/Fine-grained Mutation/Runtime Config/Query/Multi-agent Transfer)
306
+ - 新增 24 个 stdlib 函数:`context_stats`/`context_usage`/`pin_message`/`working_memory_*`/`export_context` 等
307
+ - `Message.pinned: bool` 字段,pinned 消息免疫全部 5 层压缩
308
+ - 内部化 `classify_message`
309
+
310
+ ### v1.18 - spawn 并发原语
311
+ - `spawn Agent(...)` 返回 Channel,替代 `async/await/detach`
312
+ - Channel 消息队列:`send/receive/try_receive/cancel/close`
313
+ - `mailbox_select()` 多选原语
314
+ - 流式中断:`on_chunk` 回调返回 `false` 停止流式;Ctrl+C 中断
315
+
316
+ ### v1.16 - TranscriptStore SSOT
317
+ - 对话历史 SSOT,SQLite/JSONL 双后端
318
+ - LRU 缓存(10K messages ~10MB)
319
+ - UUID 寻址,O(1) 查找
320
+ - 非破坏性压缩(BoundaryMarker 审计)
321
+
322
+ ### v1.15 - 上下文管理增强
323
+ - Working Memory(工作记忆)
324
+ - Graduated Compression(渐进式压缩)
325
+ - Cache-Aware Compression(缓存感知压缩)
326
+ - Three-Channel Context(三通道上下文)
327
+ - Agent context configuration
328
+
329
+
330
+ ### v1.14 - LLM 流式支持
331
+ - `llm act` 支持流式输出(on_chunk/on_complete 回调)
332
+ - `llm stream` 已删除(功能合并到 `llm act`)
333
+
334
+ ### v1.13 - Python Bridge
335
+ - Python 直接导入和使用 Helen Agent
336
+ - 双向 FFI(Helen ↔ Python)
337
+
338
+ ### v1.12 - Agent 隔离增强
339
+ - Agent 隔离级别(@open, @strict, @sandbox)
340
+ - Shared store 和 channel
341
+ - ReadOnlyView
342
+ - 闭包值捕获
343
+
344
+ ### v1.10 - 核心特性
345
+ - Agent 作用域隔离
346
+ - 短路求值
347
+ - 下标/字段赋值
348
+ - 别名语句