foliko 1.0.86 → 1.1.0

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 (104) hide show
  1. package/.agent/data/default.json +3 -4310
  2. package/.agent/data/plugins-state.json +34 -1
  3. package/.agent/mcp_config.json +0 -1
  4. package/.agent/memory/core.md +1 -0
  5. package/.agent/memory/project/mnn93ogy-ypjn27.md +9 -0
  6. package/.agent/memory/project/mnn98fqy-5nhc1u.md +25 -0
  7. package/.agent/memory/user/mnm67t9m-x8rekk.md +9 -0
  8. package/.agent/memory/user/mnn5mmqh-w6aktx.md +11 -0
  9. package/.agent/memory/user/mnnbfhhn-dk1bd1.md +22 -0
  10. package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
  11. package/.agent/plugins/marknative/index.js +2 -7
  12. package/.agent/plugins/poster-plugin/README.md +304 -0
  13. package/.agent/plugins/poster-plugin/fonts/PatuaOne-Regular.ttf +0 -0
  14. package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
  15. package/.agent/plugins/poster-plugin/fonts//345/276/256/350/275/257/351/233/205/351/273/221/347/262/227/344/275/223.ttf +0 -0
  16. package/.agent/plugins/poster-plugin/index.js +13 -0
  17. package/.agent/plugins/poster-plugin/package.json +28 -0
  18. package/.agent/plugins/poster-plugin/src/canvas.js +161 -0
  19. package/.agent/plugins/poster-plugin/src/components/arrow.js +84 -0
  20. package/.agent/plugins/poster-plugin/src/components/avatar.js +71 -0
  21. package/.agent/plugins/poster-plugin/src/components/badge.js +85 -0
  22. package/.agent/plugins/poster-plugin/src/components/card.js +88 -0
  23. package/.agent/plugins/poster-plugin/src/components/chart.js +127 -0
  24. package/.agent/plugins/poster-plugin/src/components/chip.js +88 -0
  25. package/.agent/plugins/poster-plugin/src/components/columns.js +107 -0
  26. package/.agent/plugins/poster-plugin/src/components/cta.js +85 -0
  27. package/.agent/plugins/poster-plugin/src/components/divider.js +55 -0
  28. package/.agent/plugins/poster-plugin/src/components/feature.js +85 -0
  29. package/.agent/plugins/poster-plugin/src/components/featureGrid.js +112 -0
  30. package/.agent/plugins/poster-plugin/src/components/grid.js +118 -0
  31. package/.agent/plugins/poster-plugin/src/components/imageFrame.js +155 -0
  32. package/.agent/plugins/poster-plugin/src/components/index.js +62 -0
  33. package/.agent/plugins/poster-plugin/src/components/listItem.js +146 -0
  34. package/.agent/plugins/poster-plugin/src/components/notification.js +123 -0
  35. package/.agent/plugins/poster-plugin/src/components/progress.js +79 -0
  36. package/.agent/plugins/poster-plugin/src/components/progressCircle.js +117 -0
  37. package/.agent/plugins/poster-plugin/src/components/quote.js +97 -0
  38. package/.agent/plugins/poster-plugin/src/components/rating.js +85 -0
  39. package/.agent/plugins/poster-plugin/src/components/star.js +70 -0
  40. package/.agent/plugins/poster-plugin/src/components/statCard.js +105 -0
  41. package/.agent/plugins/poster-plugin/src/components/stepper.js +118 -0
  42. package/.agent/plugins/poster-plugin/src/components/table.js +159 -0
  43. package/.agent/plugins/poster-plugin/src/components/tagCloud.js +78 -0
  44. package/.agent/plugins/poster-plugin/src/components/timeline.js +105 -0
  45. package/.agent/plugins/poster-plugin/src/components/watermark.js +52 -0
  46. package/.agent/plugins/poster-plugin/src/composer.js +1904 -0
  47. package/.agent/plugins/poster-plugin/src/elements/artText.js +60 -0
  48. package/.agent/plugins/poster-plugin/src/elements/background.js +52 -0
  49. package/.agent/plugins/poster-plugin/src/elements/circle.js +31 -0
  50. package/.agent/plugins/poster-plugin/src/elements/image.js +71 -0
  51. package/.agent/plugins/poster-plugin/src/elements/index.js +26 -0
  52. package/.agent/plugins/poster-plugin/src/elements/line.js +23 -0
  53. package/.agent/plugins/poster-plugin/src/elements/polygon.js +32 -0
  54. package/.agent/plugins/poster-plugin/src/elements/rectangle.js +32 -0
  55. package/.agent/plugins/poster-plugin/src/elements/svg.js +92 -0
  56. package/.agent/plugins/poster-plugin/src/elements/text.js +38 -0
  57. package/.agent/plugins/poster-plugin/src/fonts.js +118 -0
  58. package/.agent/plugins/poster-plugin/src/index.js +1659 -0
  59. package/.agent/plugins/poster-plugin/src/presets.js +36 -0
  60. package/.agent/plugins/poster-plugin/src/templates/business.js +60 -0
  61. package/.agent/plugins/poster-plugin/src/templates/gradient.js +64 -0
  62. package/.agent/plugins/poster-plugin/src/templates/index.js +43 -0
  63. package/.agent/plugins/poster-plugin/src/templates/modern.js +69 -0
  64. package/.agent/plugins/poster-plugin/src/templates/simple.js +58 -0
  65. package/.agent/plugins/poster-plugin/src/templates/social.js +62 -0
  66. package/.agent/plugins/poster-plugin/src/templates/tech.js +84 -0
  67. package/.agent/sessions/cli_default.json +24265 -0
  68. package/.agent/weixin.json +6 -0
  69. package/.claude/settings.local.json +176 -171
  70. package/CLAUDE.md +144 -108
  71. package/docs/CONTEXT_DESIGN.md +1596 -0
  72. package/examples/test-concurrent-chat.js +60 -0
  73. package/examples/test-long-chat.js +77 -0
  74. package/examples/test-session-chat.js +93 -0
  75. package/output/beef-love-poster.png +0 -0
  76. package/package.json +2 -2
  77. package/plugins/default-plugins.js +2 -1
  78. package/plugins/extension-executor-plugin.js +11 -0
  79. package/plugins/memory-plugin.js +984 -0
  80. package/plugins/session-plugin.js +78 -1
  81. package/plugins/weixin-plugin.js +24 -22
  82. package/skills/poster-guide/SKILL.md +743 -0
  83. package/skills/python-plugin-dev/SKILL.md +238 -238
  84. package/skills/skill-guide/SKILL.md +130 -108
  85. package/src/capabilities/skill-manager.js +99 -0
  86. package/src/core/agent-chat.js +627 -180
  87. package/src/core/agent-context.js +188 -0
  88. package/src/core/agent.js +9 -63
  89. package/src/core/context-manager.js +283 -0
  90. package/src/core/framework.js +264 -3
  91. package/src/core/plugin-manager.js +79 -2
  92. package/src/core/request-context.js +98 -0
  93. package/src/core/session-context.js +341 -0
  94. package/src/core/session-storage.js +274 -0
  95. package/src/executors/mcp-executor.js +2 -2
  96. package/src/utils/index.js +239 -67
  97. package/src/utils/plugin-helpers.js +17 -0
  98. package//346/265/267/346/212/245/346/217/222/344/273/266.md +621 -0
  99. package/.agent/plugins/__pycache__/test_plugin.cpython-312.pyc +0 -0
  100. package/.agent/plugins/temp-repo/LICENSE +0 -201
  101. package/.agent/plugins/temp-repo/puppeteer-plugin/README.md +0 -147
  102. package/.agent/plugins/temp-repo/puppeteer-plugin/index.js +0 -1418
  103. package/.agent/plugins/temp-repo/puppeteer-plugin/package.json +0 -9
  104. package/.agent/plugins/test_plugin.py +0 -304
@@ -1,9 +0,0 @@
1
- {
2
- "name": "puppeteer-plugin",
3
- "version": "1.0.0",
4
- "description": "Puppeteer 网页自动化操作插件,支持 Session 保存、页面截图、元素交互等",
5
- "main": "index.js",
6
- "dependencies": {
7
- "puppeteer-core": "^24.40.0"
8
- }
9
- }
@@ -1,304 +0,0 @@
1
- # .agent/plugins/test_plugin.py
2
- """
3
- Python 测试插件 - 提供单元测试和覆盖率测试功能
4
- """
5
-
6
- PLUGIN = {
7
- "name": "test_plugin",
8
- "version": "1.0.0",
9
- "description": "Python 单元测试和覆盖率测试插件"
10
- }
11
-
12
- TOOLS = [
13
- {
14
- "name": "run_tests",
15
- "description": "运行 Python 测试文件或目录中的测试用例",
16
- "params": {
17
- "path": "string",
18
- "verbose": "boolean",
19
- "pattern": "string"
20
- }
21
- },
22
- {
23
- "name": "create_test",
24
- "description": "创建单元测试文件模板",
25
- "params": {
26
- "path": "string",
27
- "class_name": "string",
28
- "test_methods": "array",
29
- "module_name": "string"
30
- }
31
- },
32
- {
33
- "name": "run_coverage",
34
- "description": "运行测试并生成覆盖率报告",
35
- "params": {
36
- "path": "string",
37
- "source": "string",
38
- "report_type": "string"
39
- }
40
- },
41
- {
42
- "name": "assert_equal",
43
- "description": "断言两个值相等(测试辅助)",
44
- "params": {
45
- "actual": "any",
46
- "expected": "any",
47
- "message": "string"
48
- }
49
- },
50
- {
51
- "name": "mock_function",
52
- "description": "创建模拟函数用于测试",
53
- "params": {
54
- "return_value": "any",
55
- "side_effect": "array",
56
- "called_count": "number"
57
- }
58
- }
59
- ]
60
-
61
- # === 工具实现 ===
62
-
63
- import os
64
- import json
65
- import subprocess
66
- import traceback
67
- from datetime import datetime
68
-
69
-
70
- def run_tests(params):
71
- """运行 Python 测试文件或目录中的测试用例"""
72
- path = params.get("path", ".")
73
- verbose = params.get("verbose", True)
74
- pattern = params.get("pattern", "test_*.py")
75
-
76
- if not os.path.exists(path):
77
- return {"success": False, "error": f"Path not found: {path}"}
78
-
79
- # 构建 pytest 命令
80
- cmd = ["pytest", path]
81
- if verbose:
82
- cmd.append("-v")
83
-
84
- try:
85
- result = subprocess.run(
86
- cmd,
87
- capture_output=True,
88
- text=True,
89
- timeout=60
90
- )
91
-
92
- output = result.stdout + result.stderr
93
-
94
- return {
95
- "success": result.returncode == 0,
96
- "result": {
97
- "passed": result.returncode == 0,
98
- "output": output,
99
- "return_code": result.returncode
100
- }
101
- }
102
- except subprocess.TimeoutExpired:
103
- return {"success": False, "error": "Test execution timed out"}
104
- except Exception as e:
105
- return {"success": False, "error": str(e)}
106
-
107
-
108
- def create_test(params):
109
- """创建单元测试文件模板"""
110
- path = params.get("path")
111
- class_name = params.get("class_name", "TestModule")
112
- test_methods = params.get("test_methods", ["test_case"])
113
- module_name = params.get("module_name", "")
114
-
115
- if not path:
116
- return {"success": False, "error": "path is required"}
117
-
118
- # 确保目录存在
119
- os.makedirs(os.path.dirname(path) if os.path.dirname(path) else ".", exist_ok=True)
120
-
121
- # 生成测试模板
122
- template = f'''"""
123
- 测试模块 - {datetime.now().strftime("%Y-%m-%d %H:%M:%S")}
124
- """
125
-
126
- import unittest
127
- {"import " + module_name if module_name else ""}
128
-
129
-
130
- class {class_name}(unittest.TestCase):
131
- """{class_name} 测试类"""
132
- '''
133
-
134
- for method in test_methods:
135
- template += f'''
136
- def {method}(self):
137
- """测试用例: {method}"""
138
- # TODO: 实现测试逻辑
139
- self.assertTrue(True)
140
- '''
141
-
142
- template += '''
143
-
144
- if __name__ == "__main__":
145
- unittest.main()
146
- '''
147
-
148
- try:
149
- with open(path, "w", encoding="utf-8") as f:
150
- f.write(template)
151
-
152
- return {
153
- "success": True,
154
- "result": {
155
- "path": path,
156
- "class_name": class_name,
157
- "methods": test_methods
158
- }
159
- }
160
- except Exception as e:
161
- return {"success": False, "error": str(e)}
162
-
163
-
164
- def run_coverage(params):
165
- """运行测试并生成覆盖率报告"""
166
- path = params.get("path", ".")
167
- source = params.get("source", "")
168
- report_type = params.get("report_type", "term")
169
-
170
- if not os.path.exists(path):
171
- return {"success": False, "error": f"Path not found: {path}"}
172
-
173
- # 构建 coverage 命令
174
- cmd = ["coverage", "run", "-m", "pytest", path]
175
- if source:
176
- cmd = ["coverage", "run", "--source", source, "-m", "pytest", path]
177
-
178
- try:
179
- # 运行测试
180
- subprocess.run(cmd, capture_output=True, timeout=60)
181
-
182
- # 生成报告
183
- if report_type == "term":
184
- report_result = subprocess.run(
185
- ["coverage", "report"],
186
- capture_output=True,
187
- text=True
188
- )
189
- output = report_result.stdout
190
- elif report_type == "html":
191
- subprocess.run(
192
- ["coverage", "html", "-d", "htmlcov"],
193
- capture_output=True,
194
- timeout=30
195
- )
196
- output = "Coverage HTML report generated at htmlcov/"
197
- elif report_type == "json":
198
- report_result = subprocess.run(
199
- ["coverage", "json"],
200
- capture_output=True,
201
- text=True
202
- )
203
- output = report_result.stdout
204
- else:
205
- output = "Unknown report type"
206
-
207
- return {
208
- "success": True,
209
- "result": {
210
- "report": output,
211
- "type": report_type
212
- }
213
- }
214
- except subprocess.TimeoutExpired:
215
- return {"success": False, "error": "Coverage execution timed out"}
216
- except FileNotFoundError:
217
- return {"success": False, "error": "coverage module not installed. Run: pip install coverage"}
218
- except Exception as e:
219
- return {"success": False, "error": str(e)}
220
-
221
-
222
- def assert_equal(params):
223
- """断言两个值相等(测试辅助)"""
224
- actual = params.get("actual")
225
- expected = params.get("expected")
226
- message = params.get("message", "")
227
-
228
- try:
229
- # 处理 JSON 字符串比较
230
- if isinstance(actual, str):
231
- try:
232
- actual = json.loads(actual)
233
- except (json.JSONDecodeError, TypeError):
234
- pass
235
-
236
- if isinstance(expected, str):
237
- try:
238
- expected = json.loads(expected)
239
- except (json.JSONDecodeError, TypeError):
240
- pass
241
-
242
- if actual == expected:
243
- return {
244
- "success": True,
245
- "result": {
246
- "passed": True,
247
- "message": f"Assertion passed: {actual} == {expected}",
248
- "actual": actual,
249
- "expected": expected
250
- }
251
- }
252
- else:
253
- return {
254
- "success": True,
255
- "result": {
256
- "passed": False,
257
- "message": f"Assertion failed: {actual} != {expected}",
258
- "actual": actual,
259
- "expected": expected
260
- }
261
- }
262
- except Exception as e:
263
- return {"success": False, "error": str(e)}
264
-
265
-
266
- def mock_function(params):
267
- """创建模拟函数用于测试"""
268
- return_value = params.get("return_value")
269
- side_effect = params.get("side_effect", [])
270
- called_count = params.get("called_count", 0)
271
-
272
- class MockResult:
273
- def __init__(self):
274
- self.call_count = 0
275
- self.call_args = []
276
- self.side_effects = side_effect
277
-
278
- def __call__(self, *args, **kwargs):
279
- self.call_count += 1
280
- self.call_args.append({"args": args, "kwargs": kwargs})
281
-
282
- # 如果有 side_effect,按顺序返回
283
- if self.side_effects:
284
- index = min(self.call_count - 1, len(self.side_effects) - 1)
285
- return self.side_effects[index]
286
-
287
- return return_value
288
-
289
- def reset(self):
290
- self.call_count = 0
291
- self.call_args = []
292
-
293
- mock = MockResult()
294
- mock.call_count = called_count
295
-
296
- return {
297
- "success": True,
298
- "result": {
299
- "mock_type": "MockFunction",
300
- "return_value": return_value,
301
- "side_effects": side_effect,
302
- "description": "Use this mock function in your tests"
303
- }
304
- }