@markusylisiurunen/tau 0.1.63 → 0.2.0-alpha.1
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 +135 -43
- package/dist/core/auth/auth_messages.js +6 -0
- package/dist/core/auth/auth_messages.js.map +1 -0
- package/dist/core/auth/auth_paths.js +7 -0
- package/dist/core/auth/auth_paths.js.map +1 -0
- package/dist/core/auth/auth_storage.js +91 -0
- package/dist/core/auth/auth_storage.js.map +1 -0
- package/dist/core/auth/cli.js +88 -0
- package/dist/core/auth/cli.js.map +1 -0
- package/dist/core/auth/codex_prompt.js +13 -0
- package/dist/core/auth/codex_prompt.js.map +1 -0
- package/dist/core/auth/credential_resolver.js +18 -0
- package/dist/core/auth/credential_resolver.js.map +1 -0
- package/dist/core/auth/index.js +7 -0
- package/dist/core/auth/index.js.map +1 -0
- package/dist/{cli.js → core/cli.js} +34 -15
- package/dist/core/cli.js.map +1 -0
- package/dist/core/commands/index.js +2 -0
- package/dist/core/commands/index.js.map +1 -0
- package/dist/core/commands/registry.js +304 -0
- package/dist/core/commands/registry.js.map +1 -0
- package/dist/core/config/bash_commands.js +44 -0
- package/dist/core/config/bash_commands.js.map +1 -0
- package/dist/{content_loader.js → core/config/content_loader.js} +301 -174
- package/dist/core/config/content_loader.js.map +1 -0
- package/dist/core/config/deps.js +18 -0
- package/dist/core/config/deps.js.map +1 -0
- package/dist/core/config/index.js +7 -0
- package/dist/core/config/index.js.map +1 -0
- package/dist/core/config/paths.js +54 -0
- package/dist/core/config/paths.js.map +1 -0
- package/dist/core/config/runtime.js +39 -0
- package/dist/core/config/runtime.js.map +1 -0
- package/dist/core/config/schema.js +346 -0
- package/dist/core/config/schema.js.map +1 -0
- package/dist/core/config/virtual_bundle.js +21 -0
- package/dist/core/config/virtual_bundle.js.map +1 -0
- package/dist/core/config/virtual_defaults.js +12 -0
- package/dist/core/config/virtual_defaults.js.map +1 -0
- package/dist/{debug.js → core/debug.js} +47 -18
- package/dist/core/debug.js.map +1 -0
- package/dist/core/events/index.js +2 -0
- package/dist/core/events/index.js.map +1 -0
- package/dist/core/events/types.js +8 -0
- package/dist/core/events/types.js.map +1 -0
- package/dist/core/index.js +22 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/modes/index.js +2 -0
- package/dist/core/modes/index.js.map +1 -0
- package/dist/core/modes/mode_adapter.js +2 -0
- package/dist/core/modes/mode_adapter.js.map +1 -0
- package/dist/core/modes/rpc_adapter.js +17 -0
- package/dist/core/modes/rpc_adapter.js.map +1 -0
- package/dist/{personas.js → core/personas.js} +20 -48
- package/dist/core/personas.js.map +1 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/runtime/deps.js +26 -0
- package/dist/core/runtime/deps.js.map +1 -0
- package/dist/core/session/core_session.js +32 -0
- package/dist/core/session/core_session.js.map +1 -0
- package/dist/core/session/message_accumulator.js.map +1 -0
- package/dist/core/session/runner.js +313 -0
- package/dist/core/session/runner.js.map +1 -0
- package/dist/core/session/session_engine.js +176 -0
- package/dist/core/session/session_engine.js.map +1 -0
- package/dist/core/subagents/explore.js.map +1 -0
- package/dist/core/subagents/registry.js.map +1 -0
- package/dist/{subagents → core/subagents}/subagent_engine.js +103 -98
- package/dist/core/subagents/subagent_engine.js.map +1 -0
- package/dist/{subagents → core/subagents}/types.js.map +1 -1
- package/dist/core/subagents/web.js.map +1 -0
- package/dist/{tools → core/tools}/bash.js +91 -114
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/catalog.js +37 -0
- package/dist/core/tools/catalog.js.map +1 -0
- package/dist/core/tools/edit.js +283 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/execution_backend.js +356 -0
- package/dist/core/tools/execution_backend.js.map +1 -0
- package/dist/{tools → core/tools}/fork.js +8 -11
- package/dist/core/tools/fork.js.map +1 -0
- package/dist/{tools → core/tools}/grep.js +81 -47
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/{tools → core/tools}/list.js +33 -12
- package/dist/core/tools/list.js.map +1 -0
- package/dist/{tools → core/tools}/read.js +57 -18
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/registry.js +18 -0
- package/dist/core/tools/registry.js.map +1 -0
- package/dist/core/tools/sandbox/docker_sandbox.js +181 -0
- package/dist/core/tools/sandbox/docker_sandbox.js.map +1 -0
- package/dist/{tools → core/tools}/task.js +12 -39
- package/dist/core/tools/task.js.map +1 -0
- package/dist/core/tools/task_schema.js +29 -0
- package/dist/core/tools/task_schema.js.map +1 -0
- package/dist/{tools → core/tools}/web_fetch.js +9 -11
- package/dist/core/tools/web_fetch.js.map +1 -0
- package/dist/{tools → core/tools}/web_search.js +8 -10
- package/dist/core/tools/web_search.js.map +1 -0
- package/dist/{tools → core/tools}/write.js +33 -14
- package/dist/core/tools/write.js.map +1 -0
- package/dist/{types.js → core/types.js} +1 -1
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils/agent_environment.js +48 -0
- package/dist/core/utils/agent_environment.js.map +1 -0
- package/dist/core/utils/agents_files.js +137 -0
- package/dist/core/utils/agents_files.js.map +1 -0
- package/dist/core/utils/color.js.map +1 -0
- package/dist/{utils → core/utils}/context.js +1 -1
- package/dist/core/utils/context.js.map +1 -0
- package/dist/{utils → core/utils}/context_builder.js +15 -18
- package/dist/core/utils/context_builder.js.map +1 -0
- package/dist/core/utils/flex_retry.js.map +1 -0
- package/dist/core/utils/fork.js.map +1 -0
- package/dist/core/utils/format.js.map +1 -0
- package/dist/core/utils/fuzzy.js.map +1 -0
- package/dist/core/utils/git.js.map +1 -0
- package/dist/core/utils/messages.js.map +1 -0
- package/dist/{utils → core/utils}/model_stream.js +10 -3
- package/dist/core/utils/model_stream.js.map +1 -0
- package/dist/core/utils/never.js.map +1 -0
- package/dist/core/utils/parallel_api.js.map +1 -0
- package/dist/{utils → core/utils}/project_files.js +7 -25
- package/dist/core/utils/project_files.js.map +1 -0
- package/dist/core/utils/sandbox_paths.js +29 -0
- package/dist/core/utils/sandbox_paths.js.map +1 -0
- package/dist/core/utils/sanitize_env.js +14 -0
- package/dist/core/utils/sanitize_env.js.map +1 -0
- package/dist/{utils → core/utils}/spawn_capture.js +6 -1
- package/dist/core/utils/spawn_capture.js.map +1 -0
- package/dist/core/utils/streaming_settings.js.map +1 -0
- package/dist/core/utils/subagent_utils.js.map +1 -0
- package/dist/core/utils/token.js.map +1 -0
- package/dist/core/utils/tool_preview.js +45 -0
- package/dist/core/utils/tool_preview.js.map +1 -0
- package/dist/core/utils/truncate.js.map +1 -0
- package/dist/core/utils/zod.js.map +1 -0
- package/dist/core/version.js +2 -0
- package/dist/core/version.js.map +1 -0
- package/dist/main.js +173 -62
- package/dist/main.js.map +1 -1
- package/dist/tui/app.js +52 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/{app.js → tui/chat_controller.js} +578 -661
- package/dist/tui/chat_controller.js.map +1 -0
- package/dist/tui/chat_view.js +233 -0
- package/dist/tui/chat_view.js.map +1 -0
- package/dist/tui/clipboard.js.map +1 -0
- package/dist/tui/export/engine_history.js.map +1 -0
- package/dist/{export → tui/export}/html.js +1 -1
- package/dist/tui/export/html.js.map +1 -0
- package/dist/{export → tui/export}/index.js +1 -1
- package/dist/tui/export/index.js.map +1 -0
- package/dist/{export → tui/export}/types.js.map +1 -1
- package/dist/tui/index.js +2 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/tool_ui_router.js +284 -0
- package/dist/tui/tool_ui_router.js.map +1 -0
- package/dist/tui/ui/app_intro.js +18 -0
- package/dist/tui/ui/app_intro.js.map +1 -0
- package/dist/{ui → tui/ui}/assistant_message.js +12 -4
- package/dist/tui/ui/assistant_message.js.map +1 -0
- package/dist/tui/ui/bash_execution.js +129 -0
- package/dist/tui/ui/bash_execution.js.map +1 -0
- package/dist/{ui → tui/ui}/chat_container.js +31 -23
- package/dist/tui/ui/chat_container.js.map +1 -0
- package/dist/tui/ui/chat_message_model.js +138 -0
- package/dist/tui/ui/chat_message_model.js.map +1 -0
- package/dist/tui/ui/components/dynamic_border.js.map +1 -0
- package/dist/tui/ui/components/editor.js +1233 -0
- package/dist/tui/ui/components/editor.js.map +1 -0
- package/dist/tui/ui/components/header_box.js.map +1 -0
- package/dist/tui/ui/components/header_line.js.map +1 -0
- package/dist/tui/ui/components/one_line_segments.js.map +1 -0
- package/dist/tui/ui/components/padded_container.js.map +1 -0
- package/dist/tui/ui/components/ui_component.js +2 -0
- package/dist/tui/ui/components/ui_component.js.map +1 -0
- package/dist/{ui → tui/ui}/custom_editor.js +105 -88
- package/dist/tui/ui/custom_editor.js.map +1 -0
- package/dist/tui/ui/file_execution.js +100 -0
- package/dist/tui/ui/file_execution.js.map +1 -0
- package/dist/{ui → tui/ui}/footer.js +17 -6
- package/dist/tui/ui/footer.js.map +1 -0
- package/dist/{ui → tui/ui}/queued_messages.js +3 -0
- package/dist/tui/ui/queued_messages.js.map +1 -0
- package/dist/tui/ui/restricted_execution.js +194 -0
- package/dist/tui/ui/restricted_execution.js.map +1 -0
- package/dist/tui/ui/session_divider.js +28 -0
- package/dist/tui/ui/session_divider.js.map +1 -0
- package/dist/{ui → tui/ui}/session_summary.js +11 -3
- package/dist/tui/ui/session_summary.js.map +1 -0
- package/dist/{ui → tui/ui}/slash_autocomplete.js +87 -62
- package/dist/tui/ui/slash_autocomplete.js.map +1 -0
- package/dist/tui/ui/system_message.js +22 -0
- package/dist/tui/ui/system_message.js.map +1 -0
- package/dist/{ui → tui/ui}/task_execution.js +2 -2
- package/dist/tui/ui/task_execution.js.map +1 -0
- package/dist/tui/ui/theme/index.js +4 -0
- package/dist/tui/ui/theme/index.js.map +1 -0
- package/dist/tui/ui/theme/palette.js +209 -0
- package/dist/tui/ui/theme/palette.js.map +1 -0
- package/dist/tui/ui/theme/theme.js +134 -0
- package/dist/tui/ui/theme/theme.js.map +1 -0
- package/dist/{ui/palette_tokens.js → tui/ui/theme/tokens.js} +1 -2
- package/dist/{ui/palette_tokens.js.map → tui/ui/theme/tokens.js.map} +1 -1
- package/dist/{ui/tool_output_layout.js → tui/ui/tool_output.js} +68 -4
- package/dist/tui/ui/tool_output.js.map +1 -0
- package/dist/tui/ui/tool_ui_registry.js +146 -0
- package/dist/tui/ui/tool_ui_registry.js.map +1 -0
- package/dist/tui/ui/user_message.js +23 -0
- package/dist/tui/ui/user_message.js.map +1 -0
- package/package.json +5 -4
- package/dist/app.js.map +0 -1
- package/dist/bash_commands.js +0 -102
- package/dist/bash_commands.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/commands.js +0 -202
- package/dist/commands.js.map +0 -1
- package/dist/config.js +0 -74
- package/dist/config.js.map +0 -1
- package/dist/content_loader.js.map +0 -1
- package/dist/debug.js.map +0 -1
- package/dist/export/engine_history.js.map +0 -1
- package/dist/export/html.js.map +0 -1
- package/dist/export/index.js.map +0 -1
- package/dist/personas.js.map +0 -1
- package/dist/prompts.js.map +0 -1
- package/dist/session/message_accumulator.js.map +0 -1
- package/dist/session/session_engine.js +0 -357
- package/dist/session/session_engine.js.map +0 -1
- package/dist/subagents/explore.js.map +0 -1
- package/dist/subagents/registry.js.map +0 -1
- package/dist/subagents/subagent_engine.js.map +0 -1
- package/dist/subagents/web.js.map +0 -1
- package/dist/terminal.js.map +0 -1
- package/dist/tool_ui_router.js +0 -274
- package/dist/tool_ui_router.js.map +0 -1
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/edit.js +0 -148
- package/dist/tools/edit.js.map +0 -1
- package/dist/tools/fork.js.map +0 -1
- package/dist/tools/grep.js.map +0 -1
- package/dist/tools/list.js.map +0 -1
- package/dist/tools/read.js.map +0 -1
- package/dist/tools/registry.js +0 -23
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/task.js.map +0 -1
- package/dist/tools/web_fetch.js.map +0 -1
- package/dist/tools/web_search.js.map +0 -1
- package/dist/tools/write.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui/app_intro.js +0 -12
- package/dist/ui/app_intro.js.map +0 -1
- package/dist/ui/assistant_message.js.map +0 -1
- package/dist/ui/bash_execution.js +0 -232
- package/dist/ui/bash_execution.js.map +0 -1
- package/dist/ui/chat_container.js.map +0 -1
- package/dist/ui/chat_message_model.js +0 -57
- package/dist/ui/chat_message_model.js.map +0 -1
- package/dist/ui/components/dynamic_border.js.map +0 -1
- package/dist/ui/components/header_box.js.map +0 -1
- package/dist/ui/components/header_line.js.map +0 -1
- package/dist/ui/components/one_line_segments.js.map +0 -1
- package/dist/ui/components/padded_container.js.map +0 -1
- package/dist/ui/custom_editor.js.map +0 -1
- package/dist/ui/file_execution.js +0 -248
- package/dist/ui/file_execution.js.map +0 -1
- package/dist/ui/footer.js.map +0 -1
- package/dist/ui/inline.js +0 -4
- package/dist/ui/inline.js.map +0 -1
- package/dist/ui/queued_messages.js.map +0 -1
- package/dist/ui/restricted_execution.js +0 -251
- package/dist/ui/restricted_execution.js.map +0 -1
- package/dist/ui/session_divider.js +0 -18
- package/dist/ui/session_divider.js.map +0 -1
- package/dist/ui/session_summary.js.map +0 -1
- package/dist/ui/slash_autocomplete.js.map +0 -1
- package/dist/ui/system_message.js +0 -16
- package/dist/ui/system_message.js.map +0 -1
- package/dist/ui/task_execution.js.map +0 -1
- package/dist/ui/theme.js +0 -269
- package/dist/ui/theme.js.map +0 -1
- package/dist/ui/theme_preview.js +0 -154
- package/dist/ui/theme_preview.js.map +0 -1
- package/dist/ui/tool_output.js +0 -29
- package/dist/ui/tool_output.js.map +0 -1
- package/dist/ui/tool_output_helpers.js +0 -30
- package/dist/ui/tool_output_helpers.js.map +0 -1
- package/dist/ui/tool_output_layout.js.map +0 -1
- package/dist/ui/tool_output_preview.js +0 -26
- package/dist/ui/tool_output_preview.js.map +0 -1
- package/dist/ui/tool_truncation.js +0 -21
- package/dist/ui/tool_truncation.js.map +0 -1
- package/dist/ui/user_message.js +0 -15
- package/dist/ui/user_message.js.map +0 -1
- package/dist/utils/agents_files.js +0 -156
- package/dist/utils/agents_files.js.map +0 -1
- package/dist/utils/color.js.map +0 -1
- package/dist/utils/context.js.map +0 -1
- package/dist/utils/context_builder.js.map +0 -1
- package/dist/utils/flex_retry.js.map +0 -1
- package/dist/utils/fork.js.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/fuzzy.js.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/model_stream.js.map +0 -1
- package/dist/utils/never.js.map +0 -1
- package/dist/utils/parallel_api.js.map +0 -1
- package/dist/utils/project_files.js.map +0 -1
- package/dist/utils/restricted_fs.js +0 -55
- package/dist/utils/restricted_fs.js.map +0 -1
- package/dist/utils/spawn_capture.js.map +0 -1
- package/dist/utils/streaming_settings.js.map +0 -1
- package/dist/utils/subagent_utils.js.map +0 -1
- package/dist/utils/token.js.map +0 -1
- package/dist/utils/truncate.js.map +0 -1
- package/dist/utils/zod.js.map +0 -1
- package/dist/version.js +0 -2
- package/dist/version.js.map +0 -1
- /package/dist/{prompts.js → core/prompts.js} +0 -0
- /package/dist/{session → core/session}/message_accumulator.js +0 -0
- /package/dist/{subagents → core/subagents}/explore.js +0 -0
- /package/dist/{subagents → core/subagents}/registry.js +0 -0
- /package/dist/{export → core/subagents}/types.js +0 -0
- /package/dist/{subagents → core/subagents}/web.js +0 -0
- /package/dist/{utils → core/utils}/color.js +0 -0
- /package/dist/{utils → core/utils}/flex_retry.js +0 -0
- /package/dist/{utils → core/utils}/fork.js +0 -0
- /package/dist/{utils → core/utils}/format.js +0 -0
- /package/dist/{utils → core/utils}/fuzzy.js +0 -0
- /package/dist/{utils → core/utils}/git.js +0 -0
- /package/dist/{utils → core/utils}/messages.js +0 -0
- /package/dist/{utils → core/utils}/never.js +0 -0
- /package/dist/{utils → core/utils}/parallel_api.js +0 -0
- /package/dist/{utils → core/utils}/streaming_settings.js +0 -0
- /package/dist/{utils → core/utils}/subagent_utils.js +0 -0
- /package/dist/{utils → core/utils}/token.js +0 -0
- /package/dist/{utils → core/utils}/truncate.js +0 -0
- /package/dist/{utils → core/utils}/zod.js +0 -0
- /package/dist/{clipboard.js → tui/clipboard.js} +0 -0
- /package/dist/{export → tui/export}/engine_history.js +0 -0
- /package/dist/{subagents → tui/export}/types.js +0 -0
- /package/dist/{terminal.js → tui/terminal.js} +0 -0
- /package/dist/{ui → tui/ui}/components/dynamic_border.js +0 -0
- /package/dist/{ui → tui/ui}/components/header_box.js +0 -0
- /package/dist/{ui → tui/ui}/components/header_line.js +0 -0
- /package/dist/{ui → tui/ui}/components/one_line_segments.js +0 -0
- /package/dist/{ui → tui/ui}/components/padded_container.js +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
a terminal-based AI chat client for working with code. tau gives you access to Claude, GPT, and Gemini models, each equipped with tools to explore, write, and edit files in your project, plus optional sub-agents for deeper codebase investigation and web research.
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
|
|
7
7
|
## installation
|
|
8
8
|
|
|
@@ -34,15 +34,37 @@ environment variables take precedence over the config file.
|
|
|
34
34
|
|
|
35
35
|
`parallel` is only needed for the web sub-agent tools (`web_search`/`web_fetch`).
|
|
36
36
|
|
|
37
|
+
### OpenAI Codex subscription (ChatGPT Plus/Pro)
|
|
38
|
+
|
|
39
|
+
to use the OpenAI Codex subscription provider (`openai-codex`), run:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
tau login openai-codex
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
this prints a login URL and starts a local callback server on `127.0.0.1:1455`. complete the
|
|
46
|
+
login in your browser and tau will store tokens in `~/.config/tau/auth.json`. if port `1455`
|
|
47
|
+
is already in use, or the browser callback fails, tau will prompt you to paste the redirect
|
|
48
|
+
URL/code. if you see token refresh errors later, run the login command again to re-authenticate.
|
|
49
|
+
|
|
50
|
+
to remove stored credentials:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
tau logout openai-codex
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`openai-codex` does **not** use `OPENAI_API_KEY` or `apiKeys.openai`; it relies on the OAuth
|
|
57
|
+
tokens in `~/.config/tau/auth.json`.
|
|
58
|
+
|
|
37
59
|
## security notice
|
|
38
60
|
|
|
39
61
|
**the risk level system is a UX guardrail, not a hard security boundary.** it helps prevent accidental writes and guides model behavior, but it has significant limitations:
|
|
40
62
|
|
|
41
63
|
- **model trust**: the bash tool relies on the model honestly declaring whether a command is a read or write. there's no runtime validation that the command actually matches the declared intent. a model could declare `safetyLevel="read"` while running `rm -rf /`.
|
|
42
64
|
- **no command analysis**: the system doesn't inspect command content. it trusts the declared safety level without verifying what the command actually does.
|
|
43
|
-
- **full system access
|
|
65
|
+
- **full system access (by default)**: without sandboxing, the model can access any file on your system that your user account can read or write, not just the current working directory. use `--sandbox` to run tool calls inside a docker container with the project mounted.
|
|
44
66
|
- **no tty / non-interactive tools**: tool commands run with stdin ignored and no TTY. anything that prompts for input or opens an editor can hang or fail (for example `sudo`, `ssh` password prompts, `git` credential prompts). tau also forces git into non-interactive mode (no prompt/editor/pager, batch-mode ssh).
|
|
45
|
-
- **user bypasses**: the `!` prefix executes shell commands directly
|
|
67
|
+
- **user bypasses**: the `!` prefix executes shell commands directly and completely bypasses risk level checks. this is intentional for direct use, but means risk levels only constrain the model, not the user. when `--sandbox` is enabled, these commands still run inside the sandbox.
|
|
46
68
|
|
|
47
69
|
note that there is no confirmation step before tool execution. the model runs commands immediately, and you can only observe the results after the fact.
|
|
48
70
|
|
|
@@ -58,22 +80,48 @@ npm run build
|
|
|
58
80
|
npm start
|
|
59
81
|
```
|
|
60
82
|
|
|
61
|
-
|
|
83
|
+
`npm start` launches the interactive TUI and expects a real terminal.
|
|
62
84
|
|
|
63
|
-
|
|
85
|
+
## themes
|
|
64
86
|
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
tau can load custom palette overrides from theme files. create a theme at:
|
|
88
|
+
|
|
89
|
+
- `.tau/themes/<id>.json` (project)
|
|
90
|
+
- `~/.config/tau/themes/<id>.json` (global)
|
|
91
|
+
|
|
92
|
+
then set `"defaultTheme": "<id>"` in config. any palette token not defined in the file renders as plain text.
|
|
93
|
+
theme values accept `#rgb`, `#rrggbb`, `rgb(r, g, b)`, or `hsl(h, s%, l%)`. hex without `#` is ignored.
|
|
94
|
+
|
|
95
|
+
available palette tokens (theme keys):
|
|
96
|
+
|
|
97
|
+
- core: `brandAccent`, `textMuted`, `textDim`, `linkText`, `thinkingText`, `codeInlineText`, `codeBlockText`
|
|
98
|
+
- status: `statusWarn`, `statusError`, `modeMemory`, `modeBash`
|
|
99
|
+
- action: `actionRunning`, `actionSuccess`, `actionError`, `actionOutput`
|
|
100
|
+
- diff: `diffAdd`, `diffRemove`
|
|
101
|
+
- toasts: `toastSuccess`, `toastWarn`, `toastError`, `toastSuccessBg`, `toastWarnBg`, `toastErrorBg`, `toastMutedBg`
|
|
102
|
+
- user: `userSurface`, `userMemorySurface`, `userMemoryText`
|
|
103
|
+
- risk: `riskReadOnlyText`, `riskReadWriteText`
|
|
104
|
+
|
|
105
|
+
example theme file (`.tau/themes/solarized.json`):
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"brandAccent": "#b58900",
|
|
110
|
+
"textMuted": "#586e75",
|
|
111
|
+
"textDim": "#657b83"
|
|
112
|
+
}
|
|
67
113
|
```
|
|
68
114
|
|
|
69
|
-
|
|
70
|
-
|
|
115
|
+
and in config (`.tau/config.json` or `~/.config/tau/config.json`):
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{ "defaultTheme": "solarized" }
|
|
119
|
+
```
|
|
71
120
|
|
|
72
121
|
## risk levels
|
|
73
122
|
|
|
74
123
|
tau uses risk levels to control what the model can do. this lets you stay in control while working alongside AI.
|
|
75
124
|
|
|
76
|
-
- **restricted**: model can only use safe inspection tools (`read`, `grep`, `list`)
|
|
77
125
|
- **read-only** (default): model can run read-only tools (no file modifications)
|
|
78
126
|
- **read-write**: model can create, edit, and delete files
|
|
79
127
|
|
|
@@ -83,18 +131,42 @@ start with a specific risk level:
|
|
|
83
131
|
tau --risk read-write
|
|
84
132
|
```
|
|
85
133
|
|
|
86
|
-
or change it during a session with `/risk:
|
|
134
|
+
or change it during a session with `/risk:read-only` or `/risk:read-write`.
|
|
87
135
|
|
|
88
136
|
the default is read-only because it lets the model investigate your code and answer questions without risk of unintended changes. bump it to read-write when you're ready to let the model make edits.
|
|
89
137
|
|
|
90
|
-
|
|
138
|
+
## sandboxing
|
|
139
|
+
|
|
140
|
+
when started with `--sandbox`, tau runs all tool calls inside a session-scoped docker container. the project root (git root or cwd) is mounted into the container, and the working directory matches your current subdirectory. only `/workspace` is bound to the host; absolute paths outside `/workspace` refer to the container filesystem.
|
|
141
|
+
|
|
142
|
+
requirements:
|
|
143
|
+
- docker must be available on the host
|
|
144
|
+
- config must include `sandbox.image`
|
|
145
|
+
- sandboxing is only enabled at startup with `--sandbox` (no runtime toggle)
|
|
146
|
+
|
|
147
|
+
example config:
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"sandbox": {
|
|
152
|
+
"image": "ghcr.io/your-org/tau-sandbox:latest",
|
|
153
|
+
"mountPath": "/workspace",
|
|
154
|
+
"pruneAfterHours": 72,
|
|
155
|
+
"extraDockerArgs": ["--network=none"],
|
|
156
|
+
"environmentInfo": "tools run inside a container. project mounted at /workspace."
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
note: when `--sandbox` is enabled, `!` commands also run inside the container.
|
|
91
162
|
|
|
92
163
|
## personas
|
|
93
164
|
|
|
94
165
|
tau comes with several built-in personas across different models:
|
|
95
166
|
|
|
96
167
|
- **Claude Opus 4.5** and **Haiku 4.5** (Anthropic)
|
|
97
|
-
- **GPT-5.2** and **GPT-5.2
|
|
168
|
+
- **GPT-5.2** and **GPT-5.2 flex** (OpenAI)
|
|
169
|
+
- **GPT-5.2 Codex** (OpenAI Codex subscription)
|
|
98
170
|
- **Gemini 3 Pro** and **Gemini 3 Flash** (Google)
|
|
99
171
|
|
|
100
172
|
each model has two variants: a chat variant for general-purpose assistance, and a coder variant optimized for software engineering. GPT-5.2 Codex is a single coder persona. both variants include the `web` sub-agent for web research, and coder variants also include the `explore` sub-agent for multi-turn codebase investigation.
|
|
@@ -112,9 +184,9 @@ some personas can run isolated sub-agents via the internal `task` tool.
|
|
|
112
184
|
tau also supports an internal `fork` tool, which runs an autonomous fork of the current session using the full conversation history and returns the fork's final answer.
|
|
113
185
|
|
|
114
186
|
- `explore`: read-only, multi-turn codebase investigation
|
|
115
|
-
- `web`: high-threshold web research using Parallel Search/Extract (`web_search`/`web_fetch`)
|
|
187
|
+
- `web`: high-threshold web research using Parallel Search/Extract (`web_search`/`web_fetch`) plus read-only bash for curl/filtering
|
|
116
188
|
|
|
117
|
-
to use the web sub-agent, set `apiKeys.parallel` in `~/.config/tau/config.json` (see above). tau will only make web calls when
|
|
189
|
+
to use the web sub-agent, set `apiKeys.parallel` in `~/.config/tau/config.json` (see above). tau will only make web calls when you explicitly ask for web research.
|
|
118
190
|
|
|
119
191
|
## trigger sensitivity
|
|
120
192
|
|
|
@@ -145,18 +217,18 @@ reference skills by typing `$` followed by the skill name (for example, `$skill-
|
|
|
145
217
|
you can also pipe content directly:
|
|
146
218
|
|
|
147
219
|
```sh
|
|
148
|
-
cat src/app.ts | tau --persona opus-4.5-chat
|
|
220
|
+
cat src/tui/app.ts | tau --persona opus-4.5-chat
|
|
149
221
|
```
|
|
150
222
|
|
|
151
|
-
|
|
223
|
+
by default, tau injects your AGENTS.md into the system prompt. use `--no-agent-context-files` to disable this behavior. tau searches for AGENTS.md in the current directory and parent directories up to your home folder (or filesystem root if cwd is outside home).
|
|
152
224
|
|
|
153
|
-
you can also include additional `AGENTS.md` files via
|
|
225
|
+
you can also include additional `AGENTS.md` files via config (when that config is in scope for the current working directory):
|
|
154
226
|
|
|
155
227
|
```json
|
|
156
|
-
{ "
|
|
228
|
+
{ "agentContextFiles": ["packages/pkg1/AGENTS.md"] }
|
|
157
229
|
```
|
|
158
230
|
|
|
159
|
-
paths are resolved relative to the directory containing `.tau
|
|
231
|
+
paths are resolved relative to the directory containing `.tau/` (or relative to home for the global config when it is in scope). entries are only included when their directory is an ancestor or descendant of the current working directory (sibling paths are ignored).
|
|
160
232
|
|
|
161
233
|
run `tau --help` to see all available options, or `tau --debug` to inspect loaded personas, prompts, skills, and the full system prompt for debugging configuration issues.
|
|
162
234
|
|
|
@@ -168,7 +240,7 @@ prefix a message with `#` to update your project's AGENTS.md file. this is usefu
|
|
|
168
240
|
# prefer explicit error messages with context about what operation failed
|
|
169
241
|
```
|
|
170
242
|
|
|
171
|
-
tau will create or update AGENTS.md at your project root, integrating the new information into the existing structure. over time, this builds a knowledge base about your project.
|
|
243
|
+
tau will create or update AGENTS.md at your project root, integrating the new information into the existing structure. over time, this builds a knowledge base about your project. this file is loaded automatically in future sessions unless you pass `--no-agent-context-files`.
|
|
172
244
|
|
|
173
245
|
## commands
|
|
174
246
|
|
|
@@ -181,14 +253,15 @@ tau supports slash commands for common actions:
|
|
|
181
253
|
| `/copy` | copy the last assistant message |
|
|
182
254
|
| `/copy:code` | copy just the code blocks |
|
|
183
255
|
| `/export:html` | export chat history to html |
|
|
184
|
-
| `/reload` | reload personas, prompts, and
|
|
256
|
+
| `/reload` | reload personas, prompts, skills, and themes from disk |
|
|
185
257
|
| `/compact:only-summary` | compress history and continue with a summary |
|
|
186
258
|
| `/compact:with-last-turn` | compress history but keep the last exchange |
|
|
187
259
|
| `/persona:<id>` | switch to a different persona |
|
|
188
260
|
| `/prompt:<id>` | insert a saved prompt template |
|
|
261
|
+
| `/theme:<id>` | switch to a loaded theme |
|
|
189
262
|
| `/bash:<id>` | run a saved shell command |
|
|
190
263
|
| `/risk:<level>` | change the risk level |
|
|
191
|
-
| `!<cmd>` | run a shell command directly
|
|
264
|
+
| `!<cmd>` | run a shell command directly (bypasses risk checks; uses sandbox if enabled) |
|
|
192
265
|
|
|
193
266
|
the compact commands are useful when conversations get long. they compress everything into a summary so the model retains context without the overhead of a full history.
|
|
194
267
|
|
|
@@ -211,7 +284,10 @@ the compact commands are useful when conversations get long. they compress every
|
|
|
211
284
|
|
|
212
285
|
### global config
|
|
213
286
|
|
|
214
|
-
|
|
287
|
+
tau loads config from `~/.config/tau/config.json` only when the current working directory is
|
|
288
|
+
inside your home directory. it also loads any `.tau/config.json` found by walking up from the
|
|
289
|
+
current working directory to home (or to the filesystem root when cwd is outside home).
|
|
290
|
+
settings merge from least-specific to most-specific.
|
|
215
291
|
|
|
216
292
|
```json
|
|
217
293
|
{
|
|
@@ -223,29 +299,27 @@ store settings in `~/.config/tau/config.json`:
|
|
|
223
299
|
},
|
|
224
300
|
"defaultPersona": "gpt-5.2-chat",
|
|
225
301
|
"defaultRisk": "read-write",
|
|
226
|
-
"toolDisplayMode": "compact",
|
|
227
302
|
"disableBuiltinPersonas": false,
|
|
228
|
-
"
|
|
303
|
+
"disableBuiltinPrompts": false,
|
|
304
|
+
"defaultTheme": "solarized"
|
|
229
305
|
}
|
|
230
306
|
```
|
|
231
307
|
|
|
232
308
|
the `defaultPersona` field specifies which persona to use when starting the app. the `--persona` flag overrides this setting.
|
|
233
309
|
|
|
234
|
-
the `defaultRisk` field sets the initial risk level (`
|
|
235
|
-
|
|
236
|
-
the `userPreferences` field lets you set guidance that applies to every conversation: preferred languages, response style, or domain context.
|
|
310
|
+
the `defaultRisk` field sets the initial risk level (`read-only` or `read-write`). the `--risk` flag overrides this setting. if not specified, defaults to `read-only`.
|
|
237
311
|
|
|
238
|
-
`
|
|
312
|
+
if `disableBuiltinPersonas` is set to `true`, tau will not load built-in personas. if `disableBuiltinPrompts` is set to `true`, tau will not load built-in prompts. only entries from `~/.config/tau/` and `.tau/` will be available for those categories. you can also set these flags in any `.tau/config.json`; the most specific value wins.
|
|
239
313
|
|
|
240
|
-
|
|
314
|
+
the `sandbox` field configures docker sandboxing. `sandbox.image` is required when you start tau with `--sandbox`. `sandbox.mountPath` defaults to `/workspace`. `sandbox.pruneAfterHours` controls when old containers are auto-pruned (default `72`). `sandbox.extraDockerArgs` lets you pass additional `docker run` flags. `sandbox.environmentInfo` (optional) is injected into the system prompt to describe the container environment to the model.
|
|
241
315
|
|
|
242
316
|
### project bash commands
|
|
243
317
|
|
|
244
|
-
define shortcuts for common shell commands in
|
|
318
|
+
define shortcuts for common shell commands in any in-scope config file (`~/.config/tau/config.json` when cwd is under home, or `.tau/config.json` in the cwd ancestry). entries merge by `id` with the most specific level winning:
|
|
245
319
|
|
|
246
320
|
```json
|
|
247
321
|
{
|
|
248
|
-
"
|
|
322
|
+
"bashCommands": [
|
|
249
323
|
{ "id": "check", "description": "lint + typecheck", "cmd": "npm run check" },
|
|
250
324
|
{ "id": "test", "cmd": "npm test" }
|
|
251
325
|
]
|
|
@@ -254,19 +328,22 @@ define shortcuts for common shell commands in `.tau/config.json` at your project
|
|
|
254
328
|
|
|
255
329
|
run them with `/bash:check` or `/bash:test`.
|
|
256
330
|
|
|
331
|
+
commands run with cwd set to the config level root (directory containing `.tau`, or home for the global config).
|
|
332
|
+
|
|
257
333
|
### additional agents context
|
|
258
334
|
|
|
259
|
-
|
|
335
|
+
you can tell tau to always include extra `AGENTS.md` files by adding an `agentContextFiles` list to a config file in scope:
|
|
260
336
|
|
|
261
337
|
```json
|
|
262
|
-
{ "
|
|
338
|
+
{ "agentContextFiles": ["packages/pkg1/AGENTS.md"] }
|
|
263
339
|
```
|
|
264
340
|
|
|
265
|
-
paths are resolved relative to the directory containing `.tau
|
|
341
|
+
paths are resolved relative to the directory containing `.tau/` (or relative to home for the global config when it is in scope). entries must point at `AGENTS.md`.
|
|
342
|
+
entries are only included when their directory is an ancestor or descendant of the current working directory (sibling paths are ignored).
|
|
266
343
|
|
|
267
344
|
### custom personas
|
|
268
345
|
|
|
269
|
-
create your own personas by adding markdown files to `~/.config/tau/personas/` (
|
|
346
|
+
create your own personas by adding markdown files to `~/.config/tau/personas/` (global, only when cwd is under home) or `.tau/personas/` (project). `.tau/` directories are discovered by walking up from the current working directory to home (or filesystem root if cwd is outside home):
|
|
270
347
|
|
|
271
348
|
```markdown
|
|
272
349
|
---
|
|
@@ -285,6 +362,8 @@ the frontmatter defines the persona. required fields:
|
|
|
285
362
|
- `provider`: model provider id (for example `openai`, `anthropic`, `google`)
|
|
286
363
|
- `model`: model id for the provider (for example `gpt-5.2`, `claude-opus-4-5`)
|
|
287
364
|
|
|
365
|
+
the persona file name (without the `.md` extension) must match the `id`.
|
|
366
|
+
|
|
288
367
|
optional frontmatter fields:
|
|
289
368
|
|
|
290
369
|
- `label`: display name shown in the ui (defaults to the base persona label if `extends` is used)
|
|
@@ -301,7 +380,7 @@ optional frontmatter fields:
|
|
|
301
380
|
model: claude-haiku-4-5
|
|
302
381
|
reasoning: medium
|
|
303
382
|
```
|
|
304
|
-
- `tools`: list of tool names to enable for this persona. allowed: `bash`, `write`, `edit`, `
|
|
383
|
+
- `tools`: list of tool names to enable for this persona. allowed: `bash`, `write`, `edit`, `task`, `fork`. if omitted, defaults to `bash`, `write`, `edit` (and `task` when subagents are enabled). risk levels still apply.
|
|
305
384
|
|
|
306
385
|
the markdown body becomes the system prompt.
|
|
307
386
|
|
|
@@ -319,11 +398,11 @@ model: claude-haiku-4-5
|
|
|
319
398
|
|
|
320
399
|
```
|
|
321
400
|
|
|
322
|
-
|
|
401
|
+
when persona ids collide across levels, the most specific level wins (for example, a `.tau/personas/` entry overrides a global or built-in persona).
|
|
323
402
|
|
|
324
403
|
### custom prompts
|
|
325
404
|
|
|
326
|
-
save reusable prompt templates in `~/.config/tau/prompts/` (
|
|
405
|
+
save reusable prompt templates in `~/.config/tau/prompts/` (global, only when cwd is under home) or `.tau/prompts/` (project). `.tau/` directories are discovered by walking up from the current working directory to home (or filesystem root if cwd is outside home):
|
|
327
406
|
|
|
328
407
|
```markdown
|
|
329
408
|
---
|
|
@@ -334,11 +413,13 @@ review this code for bugs, edge cases, and style issues.
|
|
|
334
413
|
suggest specific improvements with code examples.
|
|
335
414
|
```
|
|
336
415
|
|
|
337
|
-
insert them with `/prompt:review`. if a
|
|
416
|
+
insert them with `/prompt:review`. if a prompt id conflicts across levels (including built-ins), the most specific level wins.
|
|
417
|
+
|
|
418
|
+
the prompt file name (without the `.md` extension) must match the `id`.
|
|
338
419
|
|
|
339
420
|
### skills
|
|
340
421
|
|
|
341
|
-
skills are optional directories discovered at
|
|
422
|
+
skills are optional directories discovered at `~/.config/tau/skills/` (only when cwd is under home) and `.tau/skills/` in the cwd ancestry (up to home, or filesystem root if cwd is outside home). each skill is a directory containing `SKILL.md`. tau follows the [agent skills spec](https://agentskills.io/home).
|
|
342
423
|
|
|
343
424
|
`SKILL.md` must start with yaml frontmatter:
|
|
344
425
|
|
|
@@ -349,7 +430,7 @@ optional fields: `license`, `compatibility` (<=500 chars), `metadata` (string ma
|
|
|
349
430
|
|
|
350
431
|
enable skills per persona with the `skills` frontmatter field. you can list specific skill names (matched by `name` in skill frontmatter), or use `"*"` to enable all discovered skills. all built-in personas have `skills: "*"` by default. if a project skill conflicts with a user skill by name, the project skill wins. tau injects an index of enabled skills into the system prompt containing only each skill's `name`, `description`, and absolute file path.
|
|
351
432
|
|
|
352
|
-
use `/reload` to pick up changes to personas, prompts, and
|
|
433
|
+
use `/reload` to pick up changes to personas, prompts, skills, and themes without restarting.
|
|
353
434
|
|
|
354
435
|
## how it works
|
|
355
436
|
|
|
@@ -390,3 +471,14 @@ git push --follow-tags
|
|
|
390
471
|
```sh
|
|
391
472
|
gh release create v$(node -p "require('./package.json').version") --generate-notes
|
|
392
473
|
```
|
|
474
|
+
|
|
475
|
+
alpha prereleases are published under the npm `alpha` tag (not `latest`):
|
|
476
|
+
|
|
477
|
+
```sh
|
|
478
|
+
if node -p "require('./package.json').version.includes('-alpha.')"; then
|
|
479
|
+
npm version prerelease --preid alpha
|
|
480
|
+
else
|
|
481
|
+
npm version preminor --preid alpha
|
|
482
|
+
fi
|
|
483
|
+
gh release create v$(node -p "require('./package.json').version") --generate-notes --prerelease
|
|
484
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function formatCodexAuthError(authPath, detail) {
|
|
2
|
+
const base = "OpenAI Codex credentials are missing or expired.";
|
|
3
|
+
const hint = `run "tau login openai-codex" to authenticate and store tokens in ${authPath}.`;
|
|
4
|
+
return detail ? `${base} ${detail} ${hint}` : `${base} ${hint}`;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=auth_messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_messages.js","sourceRoot":"","sources":["../../../src/core/auth/auth_messages.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,MAAe;IACpE,MAAM,IAAI,GAAG,kDAAkD,CAAC;IAChE,MAAM,IAAI,GAAG,oEAAoE,QAAQ,GAAG,CAAC;IAC7F,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_paths.js","sourceRoot":"","sources":["../../../src/core/auth/auth_paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,IAAI,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;IAClC,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { getOAuthApiKey } from "@mariozechner/pi-ai";
|
|
5
|
+
export class AuthStorage {
|
|
6
|
+
authPath;
|
|
7
|
+
data = {};
|
|
8
|
+
static refreshLocks = new Map();
|
|
9
|
+
constructor(authPath) {
|
|
10
|
+
this.authPath = authPath;
|
|
11
|
+
this.reload();
|
|
12
|
+
}
|
|
13
|
+
reload() {
|
|
14
|
+
if (!existsSync(this.authPath)) {
|
|
15
|
+
this.data = {};
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const parsed = JSON.parse(readFileSync(this.authPath, "utf-8"));
|
|
20
|
+
this.data = parsed ?? {};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
this.data = {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
save() {
|
|
27
|
+
const dir = dirname(this.authPath);
|
|
28
|
+
if (!existsSync(dir)) {
|
|
29
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
30
|
+
}
|
|
31
|
+
const tmpPath = `${this.authPath}.${randomUUID()}.tmp`;
|
|
32
|
+
writeFileSync(tmpPath, JSON.stringify(this.data, null, 2), { encoding: "utf-8", mode: 0o600 });
|
|
33
|
+
renameSync(tmpPath, this.authPath);
|
|
34
|
+
chmodSync(this.authPath, 0o600);
|
|
35
|
+
}
|
|
36
|
+
get(provider) {
|
|
37
|
+
return this.data[provider] ?? undefined;
|
|
38
|
+
}
|
|
39
|
+
set(provider, credential) {
|
|
40
|
+
this.data[provider] = credential;
|
|
41
|
+
this.save();
|
|
42
|
+
}
|
|
43
|
+
remove(provider) {
|
|
44
|
+
delete this.data[provider];
|
|
45
|
+
this.save();
|
|
46
|
+
}
|
|
47
|
+
list() {
|
|
48
|
+
return Object.keys(this.data);
|
|
49
|
+
}
|
|
50
|
+
hasAuth(provider) {
|
|
51
|
+
return provider in this.data;
|
|
52
|
+
}
|
|
53
|
+
async getApiKey(provider) {
|
|
54
|
+
return this.withRefreshLock(provider, async () => {
|
|
55
|
+
this.reload();
|
|
56
|
+
const credential = this.data[provider];
|
|
57
|
+
if (!credential) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
if (credential.type === "api_key") {
|
|
61
|
+
return credential.key;
|
|
62
|
+
}
|
|
63
|
+
const oauthCredentials = {};
|
|
64
|
+
for (const [key, value] of Object.entries(this.data)) {
|
|
65
|
+
if (value.type === "oauth") {
|
|
66
|
+
oauthCredentials[key] = value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const result = await getOAuthApiKey(provider, oauthCredentials);
|
|
70
|
+
if (!result) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
this.data[provider] = { type: "oauth", ...result.newCredentials };
|
|
74
|
+
this.save();
|
|
75
|
+
return result.apiKey;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async withRefreshLock(provider, action) {
|
|
79
|
+
const lockKey = `${this.authPath}:${provider}`;
|
|
80
|
+
const existing = AuthStorage.refreshLocks.get(lockKey);
|
|
81
|
+
if (existing) {
|
|
82
|
+
return existing;
|
|
83
|
+
}
|
|
84
|
+
const inFlight = action().finally(() => {
|
|
85
|
+
AuthStorage.refreshLocks.delete(lockKey);
|
|
86
|
+
});
|
|
87
|
+
AuthStorage.refreshLocks.set(lockKey, inFlight);
|
|
88
|
+
return inFlight;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=auth_storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth_storage.js","sourceRoot":"","sources":["../../../src/core/auth/auth_storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SA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|
4
|
+
];
|
|
5
|
+
const DEFAULT_LOGIN_HANDLERS = {
|
|
6
|
+
"openai-codex": (callbacks) => loginOpenAICodex({
|
|
7
|
+
onAuth: callbacks.onAuth,
|
|
8
|
+
onPrompt: callbacks.onPrompt,
|
|
9
|
+
onProgress: callbacks.onProgress,
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
function normalizeProvider(value) {
|
|
13
|
+
return value.trim().toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
function formatProviderList(providers) {
|
|
16
|
+
return providers.map((provider, index) => ` ${index + 1}. ${provider.label}`).join("\n");
|
|
17
|
+
}
|
|
18
|
+
async function promptForProvider(prompt, log, providers) {
|
|
19
|
+
log("select a provider:\n");
|
|
20
|
+
log(formatProviderList(providers));
|
|
21
|
+
log("");
|
|
22
|
+
const selection = await prompt({ message: `enter number (1-${providers.length}):` });
|
|
23
|
+
const index = Number.parseInt(selection, 10) - 1;
|
|
24
|
+
if (!Number.isFinite(index) || index < 0 || index >= providers.length) {
|
|
25
|
+
throw new Error("invalid selection.");
|
|
26
|
+
}
|
|
27
|
+
return providers[index].id;
|
|
28
|
+
}
|
|
29
|
+
function resolveProvider(providerArg, providers) {
|
|
30
|
+
if (!providerArg)
|
|
31
|
+
return undefined;
|
|
32
|
+
const normalized = normalizeProvider(providerArg);
|
|
33
|
+
const resolved = providers.find((provider) => provider.id === normalized)?.id;
|
|
34
|
+
if (!resolved) {
|
|
35
|
+
const available = providers.map((entry) => entry.id).join(", ");
|
|
36
|
+
throw new Error(`unknown provider "${providerArg}". available: ${available}`);
|
|
37
|
+
}
|
|
38
|
+
return resolved;
|
|
39
|
+
}
|
|
40
|
+
export async function runLoginCommand(options) {
|
|
41
|
+
const log = options.log ?? console.log;
|
|
42
|
+
const providers = options.providers ?? SUPPORTED_OAUTH_PROVIDERS;
|
|
43
|
+
let provider = resolveProvider(options.providerArg, providers);
|
|
44
|
+
if (!provider) {
|
|
45
|
+
provider = await promptForProvider(options.prompt, log, providers);
|
|
46
|
+
}
|
|
47
|
+
const handlers = { ...DEFAULT_LOGIN_HANDLERS, ...options.loginHandlers };
|
|
48
|
+
const handler = handlers[provider];
|
|
49
|
+
if (!handler) {
|
|
50
|
+
const available = providers.map((entry) => entry.id).join(", ");
|
|
51
|
+
throw new Error(`unknown provider "${provider}". available: ${available}`);
|
|
52
|
+
}
|
|
53
|
+
log(`logging in to ${provider}...`);
|
|
54
|
+
const credentials = await handler({
|
|
55
|
+
onAuth: (info) => {
|
|
56
|
+
log("");
|
|
57
|
+
if (provider === "openai-codex") {
|
|
58
|
+
log("copy this url into your browser to complete login:");
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
log("open this url in your browser:");
|
|
62
|
+
}
|
|
63
|
+
log(info.url);
|
|
64
|
+
if (info.instructions) {
|
|
65
|
+
log(info.instructions);
|
|
66
|
+
}
|
|
67
|
+
if (provider === "openai-codex") {
|
|
68
|
+
log("if the browser callback fails, you'll be prompted to paste the redirect url/code.");
|
|
69
|
+
}
|
|
70
|
+
log("");
|
|
71
|
+
},
|
|
72
|
+
onPrompt: async (prompt) => options.prompt(prompt),
|
|
73
|
+
onProgress: (message) => log(message),
|
|
74
|
+
});
|
|
75
|
+
options.authStorage.set(provider, { type: "oauth", ...credentials });
|
|
76
|
+
log(`credentials saved to ${options.authPath}`);
|
|
77
|
+
}
|
|
78
|
+
export async function runLogoutCommand(options) {
|
|
79
|
+
const log = options.log ?? console.log;
|
|
80
|
+
const providers = options.providers ?? SUPPORTED_OAUTH_PROVIDERS;
|
|
81
|
+
let provider = resolveProvider(options.providerArg, providers);
|
|
82
|
+
if (!provider) {
|
|
83
|
+
provider = await promptForProvider(options.prompt, log, providers);
|
|
84
|
+
}
|
|
85
|
+
options.authStorage.remove(provider);
|
|
86
|
+
log(`removed credentials for ${provider} from ${options.authPath}`);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AE,IAAI,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC;IACrE,GAAG,CAAC,wBAAwB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAOtC;IACC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACvC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,yBAAyB,CAAC;IAEjE,IAAI,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/D,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,GAAG,CAAC,2BAA2B,QAAQ,SAAS,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PI_STATIC_INSTRUCTIONS } from "@mariozechner/pi-ai";
|
|
2
|
+
const STATIC_PREFIX = PI_STATIC_INSTRUCTIONS.trim();
|
|
3
|
+
export function ensureCodexSystemPrompt(systemPrompt) {
|
|
4
|
+
const trimmedStart = systemPrompt.trimStart();
|
|
5
|
+
if (trimmedStart.startsWith(STATIC_PREFIX)) {
|
|
6
|
+
return STATIC_PREFIX + trimmedStart.slice(STATIC_PREFIX.length);
|
|
7
|
+
}
|
|
8
|
+
if (!systemPrompt.trim()) {
|
|
9
|
+
return STATIC_PREFIX;
|
|
10
|
+
}
|
|
11
|
+
return `${STATIC_PREFIX}\n\n${systemPrompt.trim()}`;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=codex_prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex_prompt.js","sourceRoot":"","sources":["../../../src/core/auth/codex_prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,aAAa,GAAG,sBAAsB,CAAC,IAAI,EAAE,CAAC;AAEpD,MAAM,UAAU,uBAAuB,CAAC,YAAoB;IAC1D,MAAM,YAAY,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC;IAC9C,IAAI,YAAY,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAC3C,OAAO,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;QACzB,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO,GAAG,aAAa,OAAO,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getEnvApiKey } from "@mariozechner/pi-ai";
|
|
2
|
+
import { getApiKeyForProvider } from "../config/schema.js";
|
|
3
|
+
export function createCredentialResolver(options) {
|
|
4
|
+
return {
|
|
5
|
+
getApiKey: async (provider) => {
|
|
6
|
+
const authKey = await options.authStorage.getApiKey(provider);
|
|
7
|
+
if (authKey) {
|
|
8
|
+
return authKey;
|
|
9
|
+
}
|
|
10
|
+
const configKey = getApiKeyForProvider(options.getConfig(), provider);
|
|
11
|
+
if (configKey) {
|
|
12
|
+
return configKey;
|
|
13
|
+
}
|
|
14
|
+
return getEnvApiKey(provider);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=credential_resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential_resolver.js","sourceRoot":"","sources":["../../../src/core/auth/credential_resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAO3D,MAAM,UAAU,wBAAwB,CAAC,OAGxC;IACC,OAAO;QACL,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;YAC5B,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC9D,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO,OAAO,CAAC;YACjB,CAAC;YAED,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAC;YACtE,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { formatCodexAuthError } from "./auth_messages.js";
|
|
2
|
+
export { getAuthPath } from "./auth_paths.js";
|
|
3
|
+
export { AuthStorage } from "./auth_storage.js";
|
|
4
|
+
export { runLoginCommand, runLogoutCommand, SUPPORTED_OAUTH_PROVIDERS, } from "./cli.js";
|
|
5
|
+
export { ensureCodexSystemPrompt } from "./codex_prompt.js";
|
|
6
|
+
export { createCredentialResolver } from "./credential_resolver.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC"}
|