tensor-cli 0.3.1-beta → 0.3.8

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 (3) hide show
  1. package/README.md +145 -1
  2. package/dist/cli.js +116424 -111753
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,4 +13,148 @@ bun dev
13
13
  ```
14
14
 
15
15
  This project was created using `bun create tui`. [create-tui](https://git.new/create-tui) is the easiest way to get started with OpenTUI.
16
- \n## Tasks/To-Do\n\n- [ ] Implement image upload functionality for the TUI application.\n- [ ] Create UI components for image selection and preview in the terminal interface.\n- [ ] Integrate image processing libraries for handling uploads (e.g., resizing, format conversion).\n- [ ] Ensure compatibility with common image formats (JPEG, PNG, GIF).\n- [ ] Add error handling for upload failures and user feedback.\n- [ ] Update documentation with instructions on using image upload features.\n- [ ] Test image upload with various file sizes and network conditions.
16
+
17
+ ## Tools
18
+
19
+ Tensor exposes one decision tool per step. Core tools are always described in
20
+ the prompt; deferred tools appear as an index line and their full schema comes
21
+ from `tool_help` (see `docs/tool-routing-and-lazy-schemas.md`).
22
+
23
+ **Core (11):** `read`, `grep`, `glob`, `lsp`, `edit`, `write`, `shell`, `mcp`,
24
+ `ask_user_question`, `load_skill`, `tool_help`.
25
+
26
+ **Deferred (3):** `web_search`, `bg`, `ui`. `invoke_agent` is available when
27
+ the workspace defines sub-agents.
28
+
29
+ The model sees one entry where it used to see several. These are folds, not
30
+ removals, and the internal names still execute:
31
+
32
+ - `write` takes `mode: overwrite | append`; `append` is no longer advertised.
33
+ - `bg` takes `action: start | list | logs | kill` and folds the four `bg_*`
34
+ tools.
35
+ - `ui` takes `action: browser | figma | compare` and folds `browser`, `figma`
36
+ and `design_compare`.
37
+ - `lsp` installs the curated server automatically in build mode when none is
38
+ found, so `lsp_install` is no longer advertised. Plan mode still refuses to
39
+ install.
40
+
41
+ Route by operation first: FIND (`grep`/`glob`/`lsp`/`read`), READ, CHANGE
42
+ (`edit`/`write`, or `shell`), RUN (`shell`/`bg`), ASK (`ask_user_question`).
43
+ Before the model chooses, `src/tools/tool-recommend.ts` scores the task text
44
+ against a fixed set of intent signals and puts a short, deterministic
45
+ `recommendedTools` block at the top of the decision prompt: the most likely
46
+ first tool, a 4-tool shortlist and up to 3 tools that do not fit. Same task,
47
+ same shortlist — no model call, no randomness. A second clause-based pass,
48
+ `src/tools/harness-tools-recommendation.ts`, adds `taskTools.sequence`: the
49
+ ordered tool families the task needs across steps (`edit, write, shell, bg` for
50
+ "edit this file then run the tests"), plan-mode filtered and deduped. Recommended
51
+ deferred tools from either list are preloaded so they do not cost a `tool_help`
52
+ step. Shell runs programs and may
53
+ read, write, edit or delete files: `sed -i`, `tee`,
54
+ redirects, heredocs and inline scripts all run. `edit`/`write` are still
55
+ preferred for tracked changes because they keep the read ledger and diff.
56
+ `BASECODE_SHELL_GUARD=off|warn|enforce` (default `warn`) controls the hint:
57
+ `warn` adds a preference note and runs the command, `off` runs it silently, and
58
+ `enforce` refuses the risky form. Plan mode is a hard boundary: a blocked
59
+ write/edit/shell/operation ends the turn and tells the user to press Tab, rather
60
+ than letting the model retry it. Lazy schemas can be disabled with
61
+ `TENSOR_LAZY_TOOLS=0` or `--no-lazy-tools`; the routing block and intent check
62
+ with `TENSOR_TOOL_ROUTING=0` or `--no-tool-routing`.
63
+
64
+ Every attempted call is counted by internal tool name in
65
+ `src/tools/tool-metrics.ts`. Set `TENSOR_TOOL_METRICS=1` (or enable the debug
66
+ trace) to print the table at the end of a turn. That is how a future fold is
67
+ checked against real traces instead of guessed: tools under roughly 2% of calls
68
+ are the first candidates.
69
+
70
+ The read-only investigation pass is skipped for short, explicit requests that
71
+ name one file (for example "change the timeout in `src/config.js`"). Use
72
+ `TENSOR_INVESTIGATION=always` to keep it for every task, or `=off` to disable
73
+ it entirely (`--investigation auto|always|off`). See
74
+ [agent-workflow.md](./docs/agent-workflow.md#investigation-read-only).
75
+
76
+ A finished answer ends the turn. Continuation is regex-only by default; set
77
+ `BASECODE_CONTINUATION_JEV=1` to restore the model-judged fallback. There is no
78
+ post-turn completion gate and no adversarial critic: nothing runs tests,
79
+ typecheck or an extra model review after the answer, so a finished task is not
80
+ followed by a minute of verification. The agent runs its own checks while it
81
+ works. Tool-call JSON from other model dialects
82
+ (`{"action": ..., "action_input": ...}`) is hidden from the answer and
83
+ normalised into a real tool call when the action is known. The same applies to
84
+ `tool_call:` / `function_call:` lines: they are stripped from the transcript and
85
+ recovered into real calls.
86
+
87
+ A write or edit is hash-verified. The file named in the user's message is hashed
88
+ when the turn starts, and every `write` / `edit` / `append` is hashed before and
89
+ after. If the bytes did not move, the tool reports `No change detected …` and
90
+ the next reasoning pass gets that as evidence: the model re-evaluates what it
91
+ actually did and decides on a corrected action, instead of reading a fixed
92
+ "do this next" instruction. The same applies to a file-mutating shell command
93
+ that exits successfully but changes no tracked file. If the final answer claims
94
+ a change to a file the user named but that file's hash still matches the start of
95
+ the turn, the turn runs a short read-only verification phase over that file so
96
+ the model reads the real contents and re-evaluates, then continues instead of
97
+ ending on a false claim. During read-only recon, `echo` and every bash edit
98
+ command are disabled; use `read` / `grep` / `glob` there and `edit` / `write` in
99
+ build mode.
100
+
101
+ A successful `read` (including a re-read that restores a lost record) is what
102
+ allows `edit` / `write` (including `mode: append`) on an existing file. If compaction or an
103
+ external change invalidated the record, the harness lets the re-read run so the
104
+ file becomes editable again.
105
+
106
+ ## Context
107
+
108
+ The decision loop reads the live transcript — every tool result, every earlier
109
+ turn, and its own prior decisions — until the request reaches the model's
110
+ compaction watermark. There is no fixed message window. Above the watermark the
111
+ oldest messages are dropped whole (and, later, summarized), so the newest file
112
+ read and the most recent error stay visible. Earlier turns are no longer
113
+ truncated to a short excerpt, so a follow-up keeps the details it refers back to.
114
+
115
+ The enriched task — the worktree summary or diff, pasted content, loaded skills
116
+ and the agent roster — is sent once per turn and then lives in that transcript.
117
+ The loop reuses one stable system prefix and appends process, sub-agent, question
118
+ and plan notes only when they change, so a long turn does not repay for the same
119
+ payload on every step.
120
+
121
+ ## Tool calling
122
+
123
+ On OpenAI, DeepSeek and Anthropic, the agent uses the provider's native tool
124
+ calling: a reply may call several tools at once, and a reply that calls none
125
+ ends the turn only when no work is outstanding. The harness owns the plan,
126
+ derives each call's intent from the tool,
127
+ and does not ask for a `needs_more_steps` flag; the loop is unbounded and stops
128
+ on facts (a policy refusal, an unanswered question, a third identical call, or
129
+ twelve consecutive failures). A no-tool reply is only final when nothing is
130
+ outstanding; otherwise the loop continues and resets its no-progress guard on
131
+ any real progress. Every call gets exactly one matching tool result,
132
+ so a multi-call batch stays a valid provider conversation. Other providers keep
133
+ the JSON decision fallback. See
134
+ [native-tool-calls.md](./docs/native-tool-calls.md).
135
+
136
+ ## Effort
137
+
138
+ `/effort low|medium|high|max|ultra` sets the provider's reasoning effort. The
139
+ harness itself always runs the deepest interleaved reflection pass between tool
140
+ steps — the behavior `ultra` used to have is now the base behavior at every
141
+ level, including `low`. The deep pass has a 10,000-token per-step cap and a
142
+ 40,000-token whole-turn budget. The level is sent to the provider as `reasoning_effort`
143
+ (OpenAI, DeepSeek and Tensor models), so `low` asks for a lighter model pass
144
+ while `max` and `ultra` ask for the deepest one. The active level is shown next
145
+ to the model name in the header, `/effort` with no argument opens the current
146
+ level and accepted values, and the setting is saved in `~/.tensor/EFFORT.json`
147
+ so it survives restarts.
148
+
149
+ ## Undo and redo
150
+
151
+ `/undo` removes the most recent user message, every response after it, and the
152
+ file changes that turn made. The removed prompt goes back into the composer so
153
+ it can be edited and resent. `/redo` restores the message and files removed by
154
+ the last undo. Undo is refused while a turn is running.
155
+
156
+ Snapshots are per file and live only for the current process. A session loaded
157
+ from disk has messages but no snapshots, so `/undo` refuses rather than leaving
158
+ that turn's file changes behind. Binary or oversized files are reported as
159
+ skipped instead of being written from a partial text snapshot. See
160
+ [agent-workflow.md](./docs/agent-workflow.md#undo-and-redo).