fj-ai 0.1.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.
fj_ai-0.1.0/.gitignore ADDED
@@ -0,0 +1,215 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # fj-ai commits uv.lock for reproducible CLI installs.
99
+
100
+ # poetry
101
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105
+ # poetry.lock
106
+ # poetry.toml
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
111
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
112
+ # pdm.lock
113
+ # pdm.toml
114
+ .pdm-python
115
+ .pdm-build/
116
+
117
+ # pixi
118
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
119
+ # pixi.lock
120
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
121
+ # in the .venv directory. It is recommended not to include this directory in version control.
122
+ .pixi
123
+
124
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
125
+ __pypackages__/
126
+
127
+ # Celery stuff
128
+ celerybeat-schedule
129
+ celerybeat.pid
130
+
131
+ # Redis
132
+ *.rdb
133
+ *.aof
134
+ *.pid
135
+
136
+ # RabbitMQ
137
+ mnesia/
138
+ rabbitmq/
139
+ rabbitmq-data/
140
+
141
+ # ActiveMQ
142
+ activemq-data/
143
+
144
+ # SageMath parsed files
145
+ *.sage.py
146
+
147
+ # Environments
148
+ .env
149
+ .envrc
150
+ .venv
151
+ env/
152
+ venv/
153
+ ENV/
154
+ env.bak/
155
+ venv.bak/
156
+
157
+ # Spyder project settings
158
+ .spyderproject
159
+ .spyproject
160
+
161
+ # Rope project settings
162
+ .ropeproject
163
+
164
+ # mkdocs documentation
165
+ /site
166
+
167
+ # mypy
168
+ .mypy_cache/
169
+ .dmypy.json
170
+ dmypy.json
171
+
172
+ # Pyre type checker
173
+ .pyre/
174
+
175
+ # pytype static type analyzer
176
+ .pytype/
177
+
178
+ # Cython debug symbols
179
+ cython_debug/
180
+
181
+ # PyCharm
182
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
183
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
184
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
185
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
186
+ # .idea/
187
+
188
+ # Abstra
189
+ # Abstra is an AI-powered process automation framework.
190
+ # Ignore directories containing user credentials, local state, and settings.
191
+ # Learn more at https://abstra.io/docs
192
+ .abstra/
193
+
194
+ # Visual Studio Code
195
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
196
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
197
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
198
+ # you could uncomment the following to ignore the entire vscode folder
199
+ # .vscode/
200
+ # Temporary file for partial code execution
201
+ tempCodeRunnerFile.py
202
+
203
+ # Ruff stuff:
204
+ .ruff_cache/
205
+
206
+ # PyPI configuration file
207
+ .pypirc
208
+
209
+ # Marimo
210
+ marimo/_static/
211
+ marimo/_lsp/
212
+ __marimo__/
213
+
214
+ # Streamlit
215
+ .streamlit/secrets.toml
fj_ai-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Xiaming Chen
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.
fj_ai-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.4
2
+ Name: fj-ai
3
+ Version: 0.1.0
4
+ Summary: fj — one-shot CLI coding agent powered by soothe-nano
5
+ Project-URL: Homepage, https://github.com/caesar0301/fj-ai
6
+ Project-URL: Repository, https://github.com/caesar0301/fj-ai
7
+ Project-URL: Issues, https://github.com/caesar0301/fj-ai/issues
8
+ Author: Xiaming Chen
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: agent,ai,cli,coding-agent,fj,nano,soothe
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
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
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: <3.15,>=3.11
24
+ Requires-Dist: soothe-nano<1.0.0,>=0.9.2
25
+ Provides-Extra: dev
26
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
28
+ Requires-Dist: pytest-cov; extra == 'dev'
29
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
30
+ Requires-Dist: ruff>=0.12.0; extra == 'dev'
31
+ Requires-Dist: twine>=5.0.0; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # fj
35
+
36
+ **fj** is a one-shot coding-agent CLI. Everything after the command is the query:
37
+
38
+ ```bash
39
+ fj who is your name
40
+ fj 修改这个文件。
41
+ fj explain the auth flow in this repo
42
+ ```
43
+
44
+ It embeds [soothe-nano](https://github.com/mirasoth/soothe-nano) — a full coding CoreAgent (tools, skills, MCP, subagents, progressive loading) — with **default SQLite** persistence and config at **`~/.soothe/config/nano.yml`**.
45
+
46
+ > **fj-ai** is the Python package name; the agent runtime is **soothe-nano**. This README documents both the CLI and the agent capabilities you get underneath.
47
+
48
+ ## Quick start
49
+
50
+ ### 1. Install
51
+
52
+ ```bash
53
+ pip install fj-ai
54
+ # or
55
+ uv tool install fj-ai
56
+ ```
57
+
58
+ Requires Python 3.11+.
59
+
60
+ ### 2. Minimal config (no external SaaS)
61
+
62
+ Copy the example and point it at a **local** OpenAI-compatible server (Ollama, LM Studio, vLLM, …). No Tavily, Langfuse, Postgres, or browser stack required.
63
+
64
+ ```bash
65
+ mkdir -p ~/.soothe/config
66
+ cp nano.yml ~/.soothe/config/nano.yml
67
+ # or run without installing into ~/.soothe:
68
+ # fj -c ./nano.yml who are you
69
+ ```
70
+
71
+ The repo-root [`nano.yml`](nano.yml) is a validated minimal profile: local OpenAI-compatible provider (Ollama), SQLite, search/research/browser subagents off.
72
+
73
+ Start Ollama (or your local server), pull a model, then:
74
+
75
+ ```bash
76
+ fj who are you
77
+ fj list Python files in this directory
78
+ ```
79
+
80
+ **Zero-config alternative** (cloud API, still no extra services):
81
+
82
+ ```bash
83
+ export OPENAI_API_KEY=sk-...
84
+ # optional: export OPENAI_BASE_URL=https://api.openai.com/v1
85
+ fj summarize README.md
86
+ ```
87
+
88
+ If `~/.soothe/config/nano.yml` is missing, soothe-nano bootstraps from `OPENAI_API_KEY` or `ANTHROPIC_API_KEY`.
89
+
90
+ ### 3. What fj sets up for you
91
+
92
+ | Concern | Default |
93
+ |--------|---------|
94
+ | Config | `~/.soothe/config/nano.yml` (`SOOTHE_HOME` overrides home) |
95
+ | Checkpoints | SQLite at `~/.soothe/data/soothe_checkpoints.db` |
96
+ | Workspace | Current working directory (`SOOTHE_WORKSPACE`) |
97
+ | Output | Ephemeral progress on stdout line 1; final answer only when done |
98
+
99
+ ## Usage
100
+
101
+ ```text
102
+ fj [options] [--] <query...>
103
+ ```
104
+
105
+ | Flag | Meaning |
106
+ |------|---------|
107
+ | `-c PATH` / `--config` | Alternate `nano.yml` |
108
+ | `-t ID` / `--thread` | Reuse a LangGraph thread id (multi-turn via sqlite) |
109
+ | `-w DIR` / `--workspace` | Workspace root for file/shell tools |
110
+ | `--no-stream` | Same final-only answer (progress still shown on a TTY) |
111
+ | `-v` / `--verbose` | Also mirror tool/custom events on stderr |
112
+ | `-V` / `--version` | Version |
113
+ | `--` | Force remaining argv into the query (including leading `-`) |
114
+
115
+ Examples:
116
+
117
+ ```bash
118
+ fj who is your name
119
+ fj 修改这个文件。
120
+ fj -v refactor the CLI parser to support Unicode
121
+ fj --thread demo-1 continue from last turn: what files did you touch?
122
+ fj -w ~/code/myapp find TODO comments
123
+ ```
124
+
125
+ ## Add skills
126
+
127
+ Skills are folders with a `SKILL.md` (frontmatter + instructions). Point nano at them in `nano.yml`:
128
+
129
+ ```yaml
130
+ skills:
131
+ - ~/.soothe/skills/my-reviewer
132
+ - ./skills/deploy
133
+ ```
134
+
135
+ Example skill layout:
136
+
137
+ ```text
138
+ ~/.soothe/skills/my-reviewer/
139
+ SKILL.md
140
+ ```
141
+
142
+ ```markdown
143
+ ---
144
+ name: my-reviewer
145
+ description: Review Python PRs for style and security
146
+ ---
147
+
148
+ # Reviewer
149
+
150
+ When asked to review code, check for ...
151
+ ```
152
+
153
+ **Progressive skills** (on by default): the agent keeps a compact catalog in context and loads full skill bodies on demand via `search_skills` / `invoke_skill`, with optional intent prefetch on cold threads. Tune under `progressive_skills:` in `nano.yml` (budget %, core skills, semantic search).
154
+
155
+ ## Add MCP servers
156
+
157
+ MCP is opt-in. Either enable builtins or declare servers:
158
+
159
+ ```yaml
160
+ # Builtin names (playwright, github, slack, postgres, gdrive, …)
161
+ mcp_builtins:
162
+ - playwright
163
+
164
+ # Or explicit servers (stdio / SSE / HTTP / websocket)
165
+ mcp_servers:
166
+ - name: filesystem
167
+ transport: stdio
168
+ command: npx
169
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
170
+ defer: true # progressive: tools listed, activated when needed
171
+ enabled: true
172
+ ```
173
+
174
+ **Progressive MCP**: with `defer: true` (default), MCP tools are not dumped into the full tool array; the agent discovers and activates them as needed within a listing budget (`progressive_mcp:`).
175
+
176
+ ## Agent features (soothe-nano / fj-ai)
177
+
178
+ fj is a thin CLI; the agent is **soothe-nano**, built on **soothe-deepagents** + **soothe-sdk**.
179
+
180
+ ### Progressive loading
181
+
182
+ | Layer | Behavior |
183
+ |-------|----------|
184
+ | **Tools** | Core tools bound at startup; deferred tools discovered via `search_tools` (`progressive_tools`) |
185
+ | **Skills** | Compact listings + `search_skills` / `invoke_skill`; intent prefetch on turn 0 |
186
+ | **MCP** | Servers deferred by default; tools activated on demand |
187
+
188
+ This keeps the context window small on every turn while still exposing a large capability surface.
189
+
190
+ ### Coding product defaults (beyond raw deepagents)
191
+
192
+ - Builtin tool groups: shell/execution, file ops, HTTP, data, datetime, optional search
193
+ - Ready subagents: planner, explorer, deep/academic research, browser-use (disable what you do not need)
194
+ - Workspace scoping + path security policies
195
+ - YAML / env config factory (`SootheConfig`)
196
+ - SQLite-first persistence (Postgres optional in nano for larger deployments)
197
+ - Middleware: context limits, tool timeouts, rate-limit retries, edit coalescing, role routing
198
+
199
+ ### Optimizations inspired by / layered on deepagents
200
+
201
+ deepagents provides the harness (filesystem, shell, todos, subagents, context management). soothe-nano adds production-shaped defaults and progressive discovery so a coding agent can run in a repo without hand-wiring every tool and prompt. fj then packages that as a single argv → agent CLI with sqlite threads and cwd as workspace.
202
+
203
+ ## Compared to other agents
204
+
205
+ | | **fj / soothe-nano** | **deepagents** | **OpenCode** | **Pi / pi-agent style** |
206
+ |--|----------------------|----------------|--------------|-------------------------|
207
+ | Shape | Library + thin CLI | Python harness library | Full TUI product (JS/TS) | Minimal / research-oriented agent loops |
208
+ | Install surface | `pip install fj-ai` | `pip install deepagents` | Native/npm installer | Varies by project |
209
+ | Config | `~/.soothe/config/nano.yml` | Code-first | App/project config | Usually code or light config |
210
+ | Tools in context | Progressive (core + search) | Bring-your-own / harness set | Product tool surface | Often smaller fixed sets |
211
+ | Skills | Progressive SKILL.md catalog | Base / custom | Product skills/plugins | Optional / custom |
212
+ | MCP | First-class, deferred by default | Via adapters if you wire them | Product MCP support | Depends on fork |
213
+ | Persistence | SQLite default under `~/.soothe/data` | Pluggable checkpointer | Product session store | Often ephemeral |
214
+ | Subagents | Planner / research / browser ready | You define `task` agents | Product multi-agent UX | Usually single loop |
215
+ | Best when | Scriptable coding agent in a repo | Custom harness control | Interactive daily coding IDE-in-terminal | Experiments, minimal loops |
216
+
217
+ **vs deepagents:** use deepagents when you want the harness and full control; use fj/nano when you want coding defaults, progressive skills/tools/MCP, and a one-line CLI.
218
+
219
+ **vs OpenCode:** OpenCode is a rich interactive TUI product. fj is intentionally small — argv in, streamed answer out — while sharing the same class of capabilities (tools, MCP, skills) through soothe-nano.
220
+
221
+ **vs Pi-agent-style agents:** Pi-oriented agents emphasize lean loops and simplicity. fj trades a bit of that minimalism for progressive loading, workspace security, and sqlite threads so longer coding sessions stay practical.
222
+
223
+ ## Development
224
+
225
+ ```bash
226
+ git clone https://github.com/caesar0301/fj-ai.git
227
+ cd fj-ai
228
+ make sync-dev
229
+ make test
230
+ make lint
231
+
232
+ # Run against a local soothe-nano checkout (optional):
233
+ # uv add --editable ../soothe/packages/soothe-nano
234
+ uv run fj who is your name
235
+ ```
236
+
237
+ ### Project layout
238
+
239
+ ```text
240
+ src/fj_ai/
241
+ cli.py # argv → query, asyncio entry
242
+ config.py # ~/.soothe/config/nano.yml loader
243
+ agent.py # create_nano_agent + sqlite checkpointer
244
+ stream.py # stdout streaming
245
+ nano.yml # minimal local config
246
+ .github/workflows/
247
+ ci.yml
248
+ release.yml
249
+ ```
250
+
251
+ ### CI / release
252
+
253
+ - **CI** — format, lint, unit tests on Python 3.11–3.13; build + `twine check`
254
+ - **Release** — on GitHub Release publish (or workflow_dispatch), build and publish to PyPI (`UV_PUBLISH_TOKEN` or OIDC trusted publishing)
255
+
256
+ ## License
257
+
258
+ MIT