tnega 0.1.1 → 0.3.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.
- package/README.md +115 -100
- package/dist/agent.js +2510 -134
- package/dist/agent.js.map +4 -4
- package/dist/bin.js +30723 -5163
- package/dist/bin.js.map +4 -4
- package/dist/cli-runtime.js +30690 -5094
- package/dist/cli-runtime.js.map +4 -4
- package/dist/coding-agent.js +19088 -0
- package/dist/coding-agent.js.map +7 -0
- package/dist/core.js +74 -1
- package/dist/core.js.map +4 -4
- package/dist/eval.js +23159 -1990
- package/dist/eval.js.map +4 -4
- package/dist/events.js +22 -1
- package/dist/events.js.map +2 -2
- package/dist/evolve.js +17631 -1815
- package/dist/evolve.js.map +4 -4
- package/dist/index.js +31848 -6076
- package/dist/index.js.map +4 -4
- package/dist/llm.js +8 -0
- package/dist/llm.js.map +2 -2
- package/dist/services.js +12 -1
- package/dist/services.js.map +2 -2
- package/dist/session.js +793 -122
- package/dist/session.js.map +4 -4
- package/dist/tools.js +242 -135
- package/dist/tools.js.map +4 -4
- package/dist/types/packages/agent/src/inbox-durable.d.ts +54 -0
- package/dist/types/packages/agent/src/index.d.ts +4 -0
- package/dist/types/packages/agent/src/live.d.ts +115 -0
- package/dist/types/packages/agent/src/llm-service.d.ts +32 -0
- package/dist/types/packages/agent/src/prompt.d.ts +55 -0
- package/dist/types/packages/agent/src/service.d.ts +24 -0
- package/dist/types/packages/agent/src/types.d.ts +75 -1
- package/dist/types/packages/benchmark/src/bigcodebench.d.ts +6 -0
- package/dist/types/packages/benchmark/src/humaneval.d.ts +11 -0
- package/dist/types/packages/benchmark/src/index.d.ts +9 -0
- package/dist/types/packages/benchmark/src/manifest.d.ts +10 -0
- package/dist/types/packages/benchmark/src/mbpp.d.ts +10 -0
- package/dist/types/packages/benchmark/src/parquet.d.ts +2 -0
- package/dist/types/packages/benchmark/src/stdlib.d.ts +3 -0
- package/dist/types/packages/benchmark/src/swebench.d.ts +2 -0
- package/dist/types/packages/benchmark/src/types.d.ts +58 -0
- package/dist/types/packages/cli/src/commands.d.ts +26 -2
- package/dist/types/packages/cli/src/config.d.ts +2 -0
- package/dist/types/packages/cli/src/index.d.ts +4 -2
- package/dist/types/packages/cli/src/profile-file.d.ts +26 -0
- package/dist/types/packages/cli/src/profile.d.ts +9 -0
- package/dist/types/packages/cli/src/server.d.ts +2 -0
- package/dist/types/packages/cli/src/store.d.ts +10 -9
- package/dist/types/packages/coding-agent/src/codingAgent.d.ts +25 -0
- package/dist/types/packages/coding-agent/src/index.d.ts +6 -0
- package/dist/types/packages/coding-agent/src/mcp.d.ts +24 -0
- package/dist/types/packages/coding-agent/src/plan.d.ts +13 -0
- package/dist/types/packages/coding-agent/src/skills.d.ts +12 -0
- package/dist/types/packages/coding-agent/src/slash.d.ts +28 -0
- package/dist/types/packages/coding-agent/src/types.d.ts +41 -0
- package/dist/types/packages/core/src/events.d.ts +4 -1
- package/dist/types/packages/core/src/index.d.ts +1 -0
- package/dist/types/packages/core/src/invariant.d.ts +45 -0
- package/dist/types/packages/eval/src/codingRuntime.d.ts +18 -0
- package/dist/types/packages/eval/src/policy.d.ts +8 -0
- package/dist/types/packages/eval/src/runner.d.ts +4 -0
- package/dist/types/packages/eval/src/strategies.d.ts +10 -0
- package/dist/types/packages/eval/src/trace.d.ts +7 -0
- package/dist/types/packages/eval/src/types.d.ts +97 -1
- package/dist/types/packages/eval/src/workspace.d.ts +17 -0
- package/dist/types/packages/llm/src/types.d.ts +2 -0
- package/dist/types/packages/session/src/index.d.ts +397 -12
- package/dist/types/packages/session/src/invariant.d.ts +33 -0
- package/dist/types/packages/tools/src/builtins.d.ts +2 -0
- package/dist/types/packages/tools/src/execution.d.ts +31 -0
- package/dist/types/packages/tools/src/index.d.ts +17 -0
- package/dist/types/src/index.d.ts +5 -5
- package/dist/web/assets/index-45pokiBH.js +270 -0
- package/dist/web/assets/index-DCLL69Kz.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +92 -88
- package/dist/web/assets/index-C3jFlR4V.css +0 -1
- package/dist/web/assets/index-DeFGh2h4.js +0 -268
package/README.md
CHANGED
|
@@ -1,100 +1,115 @@
|
|
|
1
|
-
# Tnega
|
|
2
|
-
|
|
3
|
-
[中文](docs/zh-CN.md)
|
|
4
|
-
|
|
5
|
-
**Tnega** is "agent" spelled backwards. It is an eval-first agent harness with spacetime-composable plugin lifecycles: components can be hot-swapped and rolled back safely, and Eval is a first-class citizen on par with the agent loop and tools.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
Requires Node.js >= 22.
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install -g tnega
|
|
13
|
-
# or
|
|
14
|
-
pnpm add -g tnega
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Quick Start
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
export OPENCODE_GO_API_KEY=sk-...
|
|
21
|
-
tnega run "Reply with: hello"
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
`tnega run` uses OpenCode Go's `deepseek-v4-flash` model through the OpenAI compatible endpoint by default. `minimax-m3` is also available through the Anthropic Messages endpoint. The API key can also come from `~/.tnega/config.json` (Windows: `%USERPROFILE%\.tnega\config.json`) with fields `apiKey`, `model`, `baseUrl`, and `temperature`. Precedence: CLI flags > environment variables > config file > defaults.
|
|
25
|
-
|
|
26
|
-
Run a deterministic eval without an API key:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
tnega eval run examples/tasks.yml
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Start the local web UI:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
tnega web
|
|
36
|
-
# http://127.0.0.1:3080
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
1
|
+
# Tnega
|
|
2
|
+
|
|
3
|
+
[中文](docs/zh-CN.md)
|
|
4
|
+
|
|
5
|
+
**Tnega** is "agent" spelled backwards. It is an eval-first agent harness with spacetime-composable plugin lifecycles: components can be hot-swapped and rolled back safely, and Eval is a first-class citizen on par with the agent loop and tools.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Requires Node.js >= 22.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g tnega
|
|
13
|
+
# or
|
|
14
|
+
pnpm add -g tnega
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
export OPENCODE_GO_API_KEY=sk-...
|
|
21
|
+
tnega run "Reply with: hello"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`tnega run` uses OpenCode Go's `deepseek-v4-flash` model through the OpenAI compatible endpoint by default. `minimax-m3` is also available through the Anthropic Messages endpoint. The API key can also come from `~/.tnega/config.json` (Windows: `%USERPROFILE%\.tnega\config.json`) with fields `apiKey`, `model`, `baseUrl`, and `temperature`. Precedence: CLI flags > environment variables > config file > defaults.
|
|
25
|
+
|
|
26
|
+
Run a deterministic eval without an API key:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
tnega eval run examples/tasks.yml
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Start the local web UI:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
tnega web
|
|
36
|
+
# http://127.0.0.1:3080
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The web UI creates sessions as either `general` or `coding` agents. Coding
|
|
40
|
+
sessions support `auto` / `plan` / `execute` modes; plan mode shows the LLM
|
|
41
|
+
generated todo list above the composer and updates each item as tools mark it
|
|
42
|
+
done or failed. `/` slash commands such as `/mode`, `/skills`, and `/mcp` are
|
|
43
|
+
available in coding sessions.
|
|
44
|
+
|
|
45
|
+
## CLI
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
tnega run "prompt" # one agent session
|
|
49
|
+
tnega run --allow-shell "list files" # enable high-permission tools
|
|
50
|
+
tnega web # local web UI
|
|
51
|
+
tnega eval run tasks.yml # run evals
|
|
52
|
+
tnega eval compare <base> <head> # compare two eval runs
|
|
53
|
+
tnega evolve run tasks.yml # run a self-evolution loop
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Options include `--model`, `--base-url`, `--max-tokens`, `--temperature`, `--cwd`, `--session`, `--timeout-ms`, `--max-retries`, and `--retry-delay-ms`. Sessions are recorded as JSONL under `.tnega/`.
|
|
57
|
+
|
|
58
|
+
## Built-in Tools
|
|
59
|
+
|
|
60
|
+
The default tool set is `echo`, `now`, `calculator`, `json`, `read_file`, `write_file`, `list_dir`, `glob`, and `grep`. High-permission tools are opt-in: `http_get` requires `--allow-network`, `shell` requires `--allow-shell`. File and shell tools are confined to the working directory.
|
|
61
|
+
|
|
62
|
+
## Coding Agent
|
|
63
|
+
|
|
64
|
+
`tnega/coding-agent` is a packaged agent plugin for workspace-oriented coding
|
|
65
|
+
sessions. It contributes plan generation, `plan_execute_mark` /
|
|
66
|
+
`plan_execute_result` tools, workspace skills (`skills_list` / `skill_read`),
|
|
67
|
+
stdio MCP servers from `.tnega/mcp.json`, and a slash command registry. The web
|
|
68
|
+
server enables it per session through `agentType: "coding"`, while general
|
|
69
|
+
sessions keep the default loop unchanged.
|
|
70
|
+
|
|
71
|
+
## Library
|
|
72
|
+
|
|
73
|
+
Tnega is published as a library as well as a CLI. Use the root package or domain subpaths (`tnega/core`, `tnega/agent`, `tnega/coding-agent`, `tnega/eval`, `tnega/evolve`, `tnega/session`, `tnega/tools`, `tnega/llm`, ...):
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { Context, defineAgent, openaiCompatAdapter } from 'tnega'
|
|
77
|
+
|
|
78
|
+
const root = new Context()
|
|
79
|
+
const fiber = await root.plugin(
|
|
80
|
+
defineAgent({
|
|
81
|
+
name: 'coding-agent',
|
|
82
|
+
version: '0.3.0',
|
|
83
|
+
system: 'You are a coding agent.',
|
|
84
|
+
}),
|
|
85
|
+
{ llm: openaiCompatAdapter({ apiKey: process.env.OPENCODE_GO_API_KEY! }) },
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
const loop = root.get('agentLoop')
|
|
89
|
+
const result = await loop({ text: 'implement the feature' })
|
|
90
|
+
console.log(result.output)
|
|
91
|
+
|
|
92
|
+
await fiber.dispose()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Concepts
|
|
96
|
+
|
|
97
|
+
- **Spacetime composability**: components can be inserted, replaced, and removed at runtime; effects are reversed in order on teardown, so hot-swaps leave no residue.
|
|
98
|
+
- **Eval as infrastructure**: strategies, tasks, evidence, verdicts, and runs are pluggable primitives, and evaluation is also the fitness function for self-evolution.
|
|
99
|
+
- **Self-evolution**: `evolve` proposes candidates, evaluates them in isolated scopes, and accepts or rejects them through deterministic gates.
|
|
100
|
+
|
|
101
|
+
See the [Chinese guide](docs/zh-CN.md) for the detailed design, model pricing table, library contracts, and roadmap.
|
|
102
|
+
|
|
103
|
+
## Development
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pnpm install
|
|
107
|
+
pnpm test
|
|
108
|
+
pnpm typecheck
|
|
109
|
+
pnpm lint
|
|
110
|
+
pnpm build
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
MIT
|