zjcode 0.0.1__py3-none-any.whl

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 (163) hide show
  1. deepagents_code/__init__.py +42 -0
  2. deepagents_code/__main__.py +6 -0
  3. deepagents_code/_ask_user_types.py +90 -0
  4. deepagents_code/_cli_context.py +96 -0
  5. deepagents_code/_constants.py +41 -0
  6. deepagents_code/_debug.py +148 -0
  7. deepagents_code/_debug_buffer.py +204 -0
  8. deepagents_code/_env_vars.py +411 -0
  9. deepagents_code/_fake_models.py +66 -0
  10. deepagents_code/_git.py +521 -0
  11. deepagents_code/_paths.py +69 -0
  12. deepagents_code/_server_config.py +576 -0
  13. deepagents_code/_session_stats.py +235 -0
  14. deepagents_code/_startup_error.py +45 -0
  15. deepagents_code/_testing_models.py +305 -0
  16. deepagents_code/_textual_patches.py +420 -0
  17. deepagents_code/_tool_stream.py +694 -0
  18. deepagents_code/_version.py +46 -0
  19. deepagents_code/agent.py +1976 -0
  20. deepagents_code/app.py +19239 -0
  21. deepagents_code/app.tcss +438 -0
  22. deepagents_code/approval_mode.py +131 -0
  23. deepagents_code/ask_user.py +306 -0
  24. deepagents_code/auth_display.py +185 -0
  25. deepagents_code/auth_store.py +545 -0
  26. deepagents_code/built_in_skills/__init__.py +5 -0
  27. deepagents_code/built_in_skills/remember/SKILL.md +118 -0
  28. deepagents_code/built_in_skills/skill-creator/SKILL.md +383 -0
  29. deepagents_code/built_in_skills/skill-creator/scripts/init_skill.py +366 -0
  30. deepagents_code/built_in_skills/skill-creator/scripts/quick_validate.py +158 -0
  31. deepagents_code/client/__init__.py +1 -0
  32. deepagents_code/client/commands/__init__.py +1 -0
  33. deepagents_code/client/commands/auth.py +541 -0
  34. deepagents_code/client/commands/config.py +714 -0
  35. deepagents_code/client/commands/mcp.py +250 -0
  36. deepagents_code/client/commands/tools.py +416 -0
  37. deepagents_code/client/launch/__init__.py +1 -0
  38. deepagents_code/client/launch/server.py +978 -0
  39. deepagents_code/client/launch/server_manager.py +540 -0
  40. deepagents_code/client/non_interactive.py +1758 -0
  41. deepagents_code/client/remote_client.py +794 -0
  42. deepagents_code/clipboard.py +217 -0
  43. deepagents_code/command_registry.py +450 -0
  44. deepagents_code/config.py +4829 -0
  45. deepagents_code/config_manifest.py +1451 -0
  46. deepagents_code/configurable_model.py +577 -0
  47. deepagents_code/default_agent_prompt.md +12 -0
  48. deepagents_code/doctor.py +559 -0
  49. deepagents_code/editor.py +142 -0
  50. deepagents_code/event_bus.py +411 -0
  51. deepagents_code/extras_info.py +661 -0
  52. deepagents_code/file_ops.py +576 -0
  53. deepagents_code/formatting.py +135 -0
  54. deepagents_code/goal_rubric.py +497 -0
  55. deepagents_code/goal_tools.py +459 -0
  56. deepagents_code/hooks.py +348 -0
  57. deepagents_code/input.py +1041 -0
  58. deepagents_code/integrations/__init__.py +1 -0
  59. deepagents_code/integrations/openai_codex.py +551 -0
  60. deepagents_code/integrations/sandbox_config.py +198 -0
  61. deepagents_code/integrations/sandbox_factory.py +1124 -0
  62. deepagents_code/integrations/sandbox_provider.py +137 -0
  63. deepagents_code/integrations/sandbox_registry.py +350 -0
  64. deepagents_code/iterm_cursor_guide.py +176 -0
  65. deepagents_code/local_context.py +926 -0
  66. deepagents_code/main.py +3985 -0
  67. deepagents_code/managed_tools.py +642 -0
  68. deepagents_code/mcp_auth.py +1950 -0
  69. deepagents_code/mcp_config.py +176 -0
  70. deepagents_code/mcp_disabled.py +212 -0
  71. deepagents_code/mcp_login_service.py +281 -0
  72. deepagents_code/mcp_oauth_ui.py +199 -0
  73. deepagents_code/mcp_providers/__init__.py +23 -0
  74. deepagents_code/mcp_providers/_registry.py +39 -0
  75. deepagents_code/mcp_providers/base.py +133 -0
  76. deepagents_code/mcp_providers/github.py +102 -0
  77. deepagents_code/mcp_providers/slack.py +175 -0
  78. deepagents_code/mcp_tools.py +2427 -0
  79. deepagents_code/mcp_trust.py +207 -0
  80. deepagents_code/media_utils.py +826 -0
  81. deepagents_code/memory_guard.py +474 -0
  82. deepagents_code/model_config.py +4156 -0
  83. deepagents_code/notifications.py +247 -0
  84. deepagents_code/offload.py +402 -0
  85. deepagents_code/onboarding.py +223 -0
  86. deepagents_code/output.py +69 -0
  87. deepagents_code/paste_collapse.py +103 -0
  88. deepagents_code/project_utils.py +231 -0
  89. deepagents_code/py.typed +0 -0
  90. deepagents_code/reasoning_effort.py +641 -0
  91. deepagents_code/reliable_rubric.py +97 -0
  92. deepagents_code/resume_state.py +237 -0
  93. deepagents_code/server_graph.py +310 -0
  94. deepagents_code/session_end_summary.py +329 -0
  95. deepagents_code/sessions.py +1716 -0
  96. deepagents_code/skills/__init__.py +18 -0
  97. deepagents_code/skills/commands.py +1252 -0
  98. deepagents_code/skills/invocation.py +112 -0
  99. deepagents_code/skills/load.py +196 -0
  100. deepagents_code/skills/trust.py +547 -0
  101. deepagents_code/state_migration.py +136 -0
  102. deepagents_code/subagents.py +278 -0
  103. deepagents_code/system_prompt.md +204 -0
  104. deepagents_code/terminal_capabilities.py +115 -0
  105. deepagents_code/terminal_escape.py +287 -0
  106. deepagents_code/theme.py +891 -0
  107. deepagents_code/todo_list_prompt.md +12 -0
  108. deepagents_code/tool_catalog.py +509 -0
  109. deepagents_code/tool_display.py +367 -0
  110. deepagents_code/tools.py +516 -0
  111. deepagents_code/tui/__init__.py +1 -0
  112. deepagents_code/tui/textual_adapter.py +2553 -0
  113. deepagents_code/tui/widgets/__init__.py +9 -0
  114. deepagents_code/tui/widgets/_js_eval_display.py +139 -0
  115. deepagents_code/tui/widgets/_links.py +261 -0
  116. deepagents_code/tui/widgets/agent_selector.py +420 -0
  117. deepagents_code/tui/widgets/approval.py +602 -0
  118. deepagents_code/tui/widgets/ask_user.py +515 -0
  119. deepagents_code/tui/widgets/auth.py +1997 -0
  120. deepagents_code/tui/widgets/autocomplete.py +890 -0
  121. deepagents_code/tui/widgets/chat_input.py +3181 -0
  122. deepagents_code/tui/widgets/codex_auth.py +452 -0
  123. deepagents_code/tui/widgets/cwd_switch.py +242 -0
  124. deepagents_code/tui/widgets/debug_console.py +868 -0
  125. deepagents_code/tui/widgets/diff.py +252 -0
  126. deepagents_code/tui/widgets/effort_selector.py +189 -0
  127. deepagents_code/tui/widgets/goal_review.py +390 -0
  128. deepagents_code/tui/widgets/goal_status.py +50 -0
  129. deepagents_code/tui/widgets/history.py +194 -0
  130. deepagents_code/tui/widgets/install_confirm.py +248 -0
  131. deepagents_code/tui/widgets/launch_init.py +482 -0
  132. deepagents_code/tui/widgets/loading.py +227 -0
  133. deepagents_code/tui/widgets/mcp_login.py +539 -0
  134. deepagents_code/tui/widgets/mcp_reconnect.py +212 -0
  135. deepagents_code/tui/widgets/mcp_viewer.py +1634 -0
  136. deepagents_code/tui/widgets/message_store.py +999 -0
  137. deepagents_code/tui/widgets/messages.py +3846 -0
  138. deepagents_code/tui/widgets/model_selector.py +2343 -0
  139. deepagents_code/tui/widgets/notification_center.py +456 -0
  140. deepagents_code/tui/widgets/notification_detail.py +257 -0
  141. deepagents_code/tui/widgets/notification_settings.py +170 -0
  142. deepagents_code/tui/widgets/restart_prompt.py +158 -0
  143. deepagents_code/tui/widgets/skill_trust.py +131 -0
  144. deepagents_code/tui/widgets/startup_tip.py +91 -0
  145. deepagents_code/tui/widgets/status.py +781 -0
  146. deepagents_code/tui/widgets/subagent_panel.py +969 -0
  147. deepagents_code/tui/widgets/theme_selector.py +401 -0
  148. deepagents_code/tui/widgets/thread_selector.py +2564 -0
  149. deepagents_code/tui/widgets/tool_renderers.py +190 -0
  150. deepagents_code/tui/widgets/tool_widgets.py +304 -0
  151. deepagents_code/tui/widgets/update_available.py +311 -0
  152. deepagents_code/tui/widgets/update_confirm.py +184 -0
  153. deepagents_code/tui/widgets/update_progress.py +327 -0
  154. deepagents_code/tui/widgets/welcome.py +508 -0
  155. deepagents_code/turn_end_summary.py +522 -0
  156. deepagents_code/ui.py +858 -0
  157. deepagents_code/unicode_security.py +563 -0
  158. deepagents_code/update_check.py +3124 -0
  159. zjcode-0.0.1.data/data/deepagents_code/default_agent_prompt.md +12 -0
  160. zjcode-0.0.1.dist-info/METADATA +220 -0
  161. zjcode-0.0.1.dist-info/RECORD +163 -0
  162. zjcode-0.0.1.dist-info/WHEEL +4 -0
  163. zjcode-0.0.1.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,131 @@
1
+ """Trust prompt for skills that resolve outside trusted skill directories.
2
+
3
+ When a `/skill:<name>` invocation reads a `SKILL.md` whose resolved path (via
4
+ symlink) falls outside every trusted skill root, `load_skill_content` refuses
5
+ the read. Rather than forcing the user to quit, edit env/config, and relaunch,
6
+ this non-blocking modal asks for an in-the-moment decision. Allowing persists
7
+ the resolved target directory to the skill trust store.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from typing import TYPE_CHECKING, ClassVar
13
+
14
+ from textual.binding import Binding, BindingType
15
+ from textual.containers import Vertical
16
+ from textual.content import Content
17
+ from textual.screen import ModalScreen
18
+ from textual.widgets import Static
19
+
20
+ if TYPE_CHECKING:
21
+ from textual.app import ComposeResult
22
+
23
+
24
+ class SkillTrustScreen(ModalScreen[bool | None]):
25
+ """Approval overlay for a skill resolving outside trusted directories.
26
+
27
+ Dismisses with `True` when the user allows the resolved target and `False`
28
+ when the user declines. Esc is treated as deny so the user is never forced
29
+ into reading from an untrusted location they did not explicitly choose.
30
+
31
+ Typed `bool | None` rather than `bool`: a programmatic pop, or the app's
32
+ priority Esc binding falling through to `dismiss(None)` (see
33
+ `action_cancel`), can yield `None`. The caller collapses `None` and `False`
34
+ to deny (`if not allowed`), so both dismiss values fail closed.
35
+ """
36
+
37
+ BINDINGS: ClassVar[list[BindingType]] = [
38
+ Binding("enter", "confirm", "Allow", show=False, priority=True),
39
+ Binding("escape", "cancel", "Deny", show=False, priority=True),
40
+ ]
41
+
42
+ CSS = """
43
+ SkillTrustScreen {
44
+ align: center middle;
45
+ }
46
+
47
+ SkillTrustScreen > Vertical {
48
+ width: 72;
49
+ max-width: 90%;
50
+ height: auto;
51
+ background: $surface;
52
+ border: solid $warning;
53
+ padding: 1 2;
54
+ }
55
+
56
+ SkillTrustScreen .skill-trust-title {
57
+ text-style: bold;
58
+ color: $warning;
59
+ text-align: center;
60
+ margin-bottom: 1;
61
+ }
62
+
63
+ SkillTrustScreen .skill-trust-body {
64
+ height: auto;
65
+ color: $text;
66
+ margin-bottom: 1;
67
+ }
68
+
69
+ SkillTrustScreen .skill-trust-help {
70
+ height: 1;
71
+ color: $text-muted;
72
+ text-style: italic;
73
+ text-align: center;
74
+ }
75
+ """
76
+
77
+ def __init__(self, skill_name: str, target_dir: str) -> None:
78
+ """Initialize the prompt.
79
+
80
+ Args:
81
+ skill_name: Name of the skill being invoked.
82
+ target_dir: Resolved directory the skill's `SKILL.md` lives in.
83
+ """
84
+ super().__init__()
85
+ self._skill_name = skill_name
86
+ self._target_dir = target_dir
87
+
88
+ def compose(self) -> ComposeResult:
89
+ """Compose the skill trust dialog.
90
+
91
+ Yields:
92
+ Title, body, and help-row widgets parented inside a `Vertical`.
93
+ """
94
+ with Vertical():
95
+ yield Static(
96
+ "Allow skill from outside trusted directories?",
97
+ classes="skill-trust-title",
98
+ markup=False,
99
+ )
100
+ yield Static(
101
+ Content.from_markup(
102
+ "Skill [bold]$name[/bold] resolves to [bold]$dir[/bold], "
103
+ "outside your trusted skill directories. Allowing reads "
104
+ "instructions from there and remembers this location for "
105
+ "future sessions.",
106
+ name=self._skill_name,
107
+ dir=self._target_dir,
108
+ ),
109
+ classes="skill-trust-body",
110
+ markup=False,
111
+ )
112
+ yield Static(
113
+ "Enter to allow, Esc to deny",
114
+ classes="skill-trust-help",
115
+ markup=False,
116
+ )
117
+
118
+ def action_confirm(self) -> None:
119
+ """Dismiss with `True`."""
120
+ self.dismiss(True)
121
+
122
+ def action_cancel(self) -> None:
123
+ """Dismiss with `False`.
124
+
125
+ The method name must stay `cancel`: the app owns a priority `escape`
126
+ binding that, for an active `ModalScreen`, dispatches to
127
+ `action_cancel` if present and otherwise falls through to
128
+ `dismiss(None)`. Renaming this would silently regress Esc to a
129
+ `None` dismiss instead of an explicit deny.
130
+ """
131
+ self.dismiss(False)
@@ -0,0 +1,91 @@
1
+ """Startup tip widget shown above the chat input."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import random
6
+ from typing import Any
7
+
8
+ from textual.content import Content
9
+ from textual.widgets import Static
10
+
11
+ from deepagents_code._env_vars import HIDE_SPLASH_TIPS, is_env_truthy
12
+
13
+ _TIPS: dict[str, int] = {
14
+ "Use @ to reference files and / for commands": 3,
15
+ "Try /threads to resume a previous conversation": 2,
16
+ "Use /offload when your conversation gets long": 2,
17
+ "Use /copy to copy the latest message": 3,
18
+ "Use /tools to list the tools available to the agent": 1,
19
+ "Use /mcp login <server> to authenticate MCP servers": 1,
20
+ "Use /remember to save learnings from this conversation": 1,
21
+ "Use /model to switch models mid-conversation": 2,
22
+ "Use /effort to change the current model's reasoning effort": 1,
23
+ "Press ctrl+x to compose prompts in your external editor": 1,
24
+ "Use /skill:<name> to invoke a skill directly": 1,
25
+ "Use /theme to customize the TUI's colors": 1,
26
+ "Use /skill-creator to build reusable agent skills": 1,
27
+ "Ask for a workflow to fan work out to subagents in parallel": 3,
28
+ "Use /timestamps to show or hide message timestamp footers": 1,
29
+ "Use /agents to browse and switch between your available agents": 2,
30
+ "Press Shift+Tab to toggle auto-approve mode": 2,
31
+ "Use !! for incognito shell commands that stay out of model context": 1,
32
+ "Deep Agents can explain its own features and look up its docs. Ask it how to use.": 3, # noqa: E501
33
+ }
34
+ """Tips shown above the chat input. One is chosen at random per launch,
35
+ weighted by these relative selection weights."""
36
+
37
+ # Fail fast at import if the registry is ever emptied or given a non-positive
38
+ # weight: `random.choices` would otherwise raise a cryptic error at widget
39
+ # construction. `_TIPS` is a hardcoded constant, so this never fires in
40
+ # practice — it just guards future edits.
41
+ if not _TIPS:
42
+ msg = "_TIPS must not be empty"
43
+ raise ValueError(msg)
44
+ if any(weight <= 0 for weight in _TIPS.values()):
45
+ msg = "_TIPS weights must be positive"
46
+ raise ValueError(msg)
47
+
48
+
49
+ def _pick_tip() -> str:
50
+ """Pick one startup tip using the configured relative weights.
51
+
52
+ Returns:
53
+ Tip text selected from `_TIPS`.
54
+ """
55
+ tips = list(_TIPS.keys())
56
+ weights = list(_TIPS.values())
57
+ return random.choices(tips, weights=weights, k=1)[0] # noqa: S311
58
+
59
+
60
+ def show_startup_tip() -> bool:
61
+ """Return whether startup tips should be shown.
62
+
63
+ Returns:
64
+ `True` when startup tips are enabled for the current process.
65
+ """
66
+ return not is_env_truthy(HIDE_SPLASH_TIPS)
67
+
68
+
69
+ class StartupTip(Static):
70
+ """One startup tip displayed above the chat input."""
71
+
72
+ DEFAULT_CSS = """
73
+ StartupTip {
74
+ height: auto;
75
+ color: $text-muted;
76
+ text-style: dim italic;
77
+ padding: 0 1;
78
+ }
79
+ """
80
+
81
+ def __init__(self, tip: str | None = None, **kwargs: Any) -> None:
82
+ """Initialize the startup tip widget.
83
+
84
+ Args:
85
+ tip: Tip text to display. When omitted, one weighted tip is selected.
86
+ **kwargs: Additional arguments passed to `Static`.
87
+ """
88
+ self.tip: str = tip if tip is not None else _pick_tip()
89
+ # Styling (dim italic, muted color) is owned by DEFAULT_CSS, which
90
+ # applies to the whole widget — no need to restyle the spans here.
91
+ super().__init__(Content.assemble("Tip: ", self.tip), **kwargs)