deepwrap 0.2.1__tar.gz → 0.2.3__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.
Files changed (50) hide show
  1. {deepwrap-0.2.1 → deepwrap-0.2.3}/PKG-INFO +173 -2
  2. {deepwrap-0.2.1 → deepwrap-0.2.3}/README.md +172 -1
  3. deepwrap-0.2.3/deepwrap/__init__.py +27 -0
  4. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/api/chat_session.py +228 -11
  5. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/client.py +108 -2
  6. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/config.py +1 -1
  7. deepwrap-0.2.3/deepwrap/function_calling.py +189 -0
  8. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/interfaces/api.py +4 -0
  9. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/interfaces/cli.py +455 -16
  10. deepwrap-0.2.3/deepwrap/memory.py +250 -0
  11. deepwrap-0.2.3/deepwrap/native_tools.py +458 -0
  12. deepwrap-0.2.3/deepwrap/project_intelligence.py +146 -0
  13. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/config_store.py +5 -3
  14. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap.egg-info/PKG-INFO +173 -2
  15. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap.egg-info/SOURCES.txt +10 -1
  16. {deepwrap-0.2.1 → deepwrap-0.2.3}/pyproject.toml +1 -1
  17. deepwrap-0.2.3/tests/test_agent_acceptance.py +230 -0
  18. {deepwrap-0.2.1 → deepwrap-0.2.3}/tests/test_chat_session.py +85 -0
  19. deepwrap-0.2.3/tests/test_cli_agent_tools.py +114 -0
  20. deepwrap-0.2.3/tests/test_cli_markdown.py +47 -0
  21. deepwrap-0.2.3/tests/test_memory.py +102 -0
  22. deepwrap-0.2.3/tests/test_native_tools.py +155 -0
  23. deepwrap-0.2.3/tests/test_project_intelligence.py +40 -0
  24. deepwrap-0.2.1/deepwrap/__init__.py +0 -4
  25. deepwrap-0.2.1/deepwrap/function_calling.py +0 -104
  26. {deepwrap-0.2.1 → deepwrap-0.2.3}/LICENSE +0 -0
  27. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/__main__.py +0 -0
  28. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/api/__init__.py +0 -0
  29. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/api/base.py +0 -0
  30. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/api/chats.py +0 -0
  31. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/api/files.py +0 -0
  32. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/api/pow.py +0 -0
  33. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/core/__init__.py +0 -0
  34. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/core/auth.py +0 -0
  35. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/core/session_manager.py +0 -0
  36. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/interfaces/__init__.py +0 -0
  37. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/modules/__init__.py +0 -0
  38. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/modules/pow_asm.py +0 -0
  39. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/py.typed +0 -0
  40. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/bearer_token_extractor.py +0 -0
  41. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/browser_finder.py +0 -0
  42. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/browser_process.py +0 -0
  43. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/cdp_client.py +0 -0
  44. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/dev_tools_http.py +0 -0
  45. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap/utils/port_finder.py +0 -0
  46. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap.egg-info/dependency_links.txt +0 -0
  47. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap.egg-info/entry_points.txt +0 -0
  48. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap.egg-info/requires.txt +0 -0
  49. {deepwrap-0.2.1 → deepwrap-0.2.3}/deepwrap.egg-info/top_level.txt +0 -0
  50. {deepwrap-0.2.1 → deepwrap-0.2.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepwrap
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Python SDK, CLI, and local FastAPI wrapper for DeepSeek Chat.
5
5
  Author-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
6
6
  Maintainer-email: Nika Kudukhashvili <nikakuduxashvili0@gmail.com>
@@ -73,6 +73,9 @@ Dynamic: license-file
73
73
  - [Basic Non-Streaming Chat](#basic-non-streaming-chat)
74
74
  - [Streaming Chat](#streaming-chat)
75
75
  - [Multi-Turn Chat](#multi-turn-chat)
76
+ - [Agent Mode](#agent-mode)
77
+ - [Vision File Uploads](#vision-file-uploads)
78
+ - [Pseudo Function Calling](#pseudo-function-calling)
76
79
  - [Supported Models](#supported-models)
77
80
  - [God Mode](#god-mode)
78
81
  - [Python SDK](#python-sdk)
@@ -113,6 +116,7 @@ It provides:
113
116
  - Interactive terminal UI
114
117
  - FastAPI server mode
115
118
  - Internal proof-of-work handling
119
+ - Default autonomous agent mode with native command, code, search, and file tools
116
120
 
117
121
  > Repository: [https://github.com/Kuduxaaa/deepwrap](https://github.com/Kuduxaaa/deepwrap)
118
122
 
@@ -327,6 +331,173 @@ The `ChatSession` keeps track of the latest message ID internally, so follow-up
327
331
 
328
332
  ---
329
333
 
334
+ ### Agent mode
335
+
336
+ Agent mode is enabled by default. It upgrades regular chat sessions with native
337
+ tools that the model can call repeatedly before returning its final answer:
338
+
339
+ - `exec` — execute a command with the host operating system's shell.
340
+ - `grep` — regex-search file contents with optional glob filters.
341
+ - `read_file` — read any text file.
342
+ - `write_file` — write complete content to a file.
343
+ - `edit_file` — perform guarded exact-string substitutions.
344
+ - `exec_code` — run Python code with access to installed modules.
345
+ - `start_job` — launch a long command in its own background process.
346
+ - `job_status` — check a background job without blocking.
347
+ - `job_output` — read paginated stdout or stderr while a job runs.
348
+ - `list_jobs` — list jobs owned by the current client.
349
+ - `stop_job` — terminate a job and its process group.
350
+
351
+ ```python
352
+ from pathlib import Path
353
+
354
+ from deepwrap import Client
355
+
356
+ client = Client(
357
+ working_directory=Path.cwd(),
358
+ command_timeout=30,
359
+ max_agent_rounds=8,
360
+ )
361
+ chat = client.chats.create_session(model="expert")
362
+
363
+ result = chat.respond(
364
+ "Find every Python file containing ChatSession and summarize its usage.",
365
+ stream=False,
366
+ )
367
+ print(result)
368
+ for execution in result.tools_used:
369
+ print(execution.name, execution.arguments, execution.output)
370
+ ```
371
+
372
+ Streaming returns an `AgentStream`. Final-answer chunks arrive incrementally, and
373
+ the same execution history is available after or during consumption:
374
+
375
+ ```python
376
+ response = chat.respond("Inspect this project.", stream=True)
377
+
378
+ for chunk in response:
379
+ print(chunk, end="", flush=True)
380
+
381
+ for execution in response.tools_used:
382
+ print(execution.name, execution.arguments, execution.output)
383
+ ```
384
+
385
+ For immediate progress while the agent is planning or running tools, pass an
386
+ event callback:
387
+
388
+ ```python
389
+ def show_progress(event):
390
+ print(f"[{event.type}] {event.message}", flush=True)
391
+
392
+ response = chat.respond(
393
+ "Build a complete landing page in one HTML file.",
394
+ stream=True,
395
+ on_event=show_progress,
396
+ )
397
+ ```
398
+
399
+ Events include `started`, `planning`, `thinking`, `tool_started`, `tool_completed`,
400
+ `responding`, and `completed`. The history remains available as
401
+ `response.events`; tool events also include arguments, output, and duration.
402
+
403
+ #### Background jobs
404
+
405
+ Long-running commands can execute concurrently without blocking the agent response:
406
+
407
+ ```python
408
+ response = chat.respond(
409
+ "Start the crawler as a background job and return immediately.",
410
+ stream=False,
411
+ )
412
+
413
+ job = next(
414
+ execution.output
415
+ for execution in response.tools_used
416
+ if execution.name == "start_job"
417
+ )
418
+ print(job["id"], job["state"])
419
+
420
+ # A later turn in the same Client can inspect status and logs.
421
+ print(chat.respond("Check that job and show its latest output.", stream=False))
422
+ ```
423
+
424
+ Each job has an independent process group and file-backed stdout/stderr logs.
425
+ `job_output` returns `next_offset`, allowing the agent to resume reading only new
426
+ output. Jobs remain available across chat turns while the same `Client` process is
427
+ alive. See `examples/15_background_jobs.py` for a complete example.
428
+
429
+ > Run network scanners and similar tools only against systems and networks you own
430
+ > or are explicitly authorized to assess.
431
+
432
+ Non-streaming `AgentResponse` remains a subclass of `str`, so existing string
433
+ handling continues to work. Each `tools_used` entry contains `name`, `arguments`,
434
+ and `output`.
435
+
436
+ Disable agent operations globally or for one request:
437
+
438
+ ```python
439
+ client = Client(agent_mode=False)
440
+ plain_response = chat.respond("Hello", agent=False, stream=False)
441
+ ```
442
+
443
+ The interactive CLI always starts directly in agent mode; no activation command
444
+ is required. The Python SDK and local HTTP API still accept an `agent` boolean
445
+ for applications that explicitly need plain-chat behavior.
446
+
447
+ #### Natural-language CLI actions
448
+
449
+ Every slash-command capability is also registered as an agent tool. Users can
450
+ control the CLI naturally without remembering command syntax:
451
+
452
+ ```text
453
+ Please clear this chat and screen.
454
+ Start a new conversation.
455
+ Switch to the default model and enable search.
456
+ Hide thinking output.
457
+ Save my current settings.
458
+ Show the current status.
459
+ Exit DeepWrap.
460
+ ```
461
+
462
+ Token changes schedule the secure hidden-input prompt; credentials are never
463
+ accepted as model-generated tool arguments. Direct slash commands remain available.
464
+
465
+ Local images are handled automatically through a dedicated vision session, even
466
+ when the current model is `expert`:
467
+
468
+ ```text
469
+ What can you see in /home/user/Pictures/photo.jpg?
470
+ ```
471
+
472
+ The CLI agent selects `inspect_image`, uploads the file to a temporary vision chat,
473
+ and feeds the visual analysis back into the current conversation. Manual
474
+ `/model vision` and `/attach` remain useful when several follow-up prompts should
475
+ reuse the same uploaded image.
476
+
477
+ Thinking output works in agent mode as well as plain mode. Enabling or disabling
478
+ God Mode updates the current session in place, so conversation and image context
479
+ are preserved.
480
+
481
+ For large repositories, `grep` and `read_file` return bounded pages with
482
+ `has_more` and `next_offset`. The agent protocol instructs the model to search
483
+ broadly, narrow relevant files, and follow pagination instead of flooding its
484
+ context with entire projects.
485
+
486
+ > Agent mode executes model-generated commands and code and can read or modify any
487
+ > path available to the current operating-system user. Run it only in an environment
488
+ > where that level of access is intended. Use `working_directory`, a dedicated user,
489
+ > container, or virtual machine when isolation is required.
490
+
491
+ Runnable examples:
492
+
493
+ - `examples/11_agent.py` — agent-driven project search and summary.
494
+ - `examples/12_native_tools.py` — direct use of all six native tools.
495
+ - `examples/13_agent_file_edit.py` — autonomous read/edit/verification workflow.
496
+ - `examples/14_agent_exec.py` — command and Python execution workflow.
497
+ - `examples/15_background_jobs.py` — concurrent process jobs and later inspection.
498
+
499
+ ---
500
+
330
501
  ### Vision file uploads
331
502
 
332
503
  Files can be attached only to a `vision` session. DeepWrap uploads the file,
@@ -578,7 +749,7 @@ Example response:
578
749
  {
579
750
  "ok": true,
580
751
  "app": "deepwrap",
581
- "version": "0.2.1",
752
+ "version": "0.2.3",
582
753
  "token_configured": true,
583
754
  "cached_clients": 1,
584
755
  "active_sessions": 0
@@ -18,6 +18,9 @@
18
18
  - [Basic Non-Streaming Chat](#basic-non-streaming-chat)
19
19
  - [Streaming Chat](#streaming-chat)
20
20
  - [Multi-Turn Chat](#multi-turn-chat)
21
+ - [Agent Mode](#agent-mode)
22
+ - [Vision File Uploads](#vision-file-uploads)
23
+ - [Pseudo Function Calling](#pseudo-function-calling)
21
24
  - [Supported Models](#supported-models)
22
25
  - [God Mode](#god-mode)
23
26
  - [Python SDK](#python-sdk)
@@ -58,6 +61,7 @@ It provides:
58
61
  - Interactive terminal UI
59
62
  - FastAPI server mode
60
63
  - Internal proof-of-work handling
64
+ - Default autonomous agent mode with native command, code, search, and file tools
61
65
 
62
66
  > Repository: [https://github.com/Kuduxaaa/deepwrap](https://github.com/Kuduxaaa/deepwrap)
63
67
 
@@ -272,6 +276,173 @@ The `ChatSession` keeps track of the latest message ID internally, so follow-up
272
276
 
273
277
  ---
274
278
 
279
+ ### Agent mode
280
+
281
+ Agent mode is enabled by default. It upgrades regular chat sessions with native
282
+ tools that the model can call repeatedly before returning its final answer:
283
+
284
+ - `exec` — execute a command with the host operating system's shell.
285
+ - `grep` — regex-search file contents with optional glob filters.
286
+ - `read_file` — read any text file.
287
+ - `write_file` — write complete content to a file.
288
+ - `edit_file` — perform guarded exact-string substitutions.
289
+ - `exec_code` — run Python code with access to installed modules.
290
+ - `start_job` — launch a long command in its own background process.
291
+ - `job_status` — check a background job without blocking.
292
+ - `job_output` — read paginated stdout or stderr while a job runs.
293
+ - `list_jobs` — list jobs owned by the current client.
294
+ - `stop_job` — terminate a job and its process group.
295
+
296
+ ```python
297
+ from pathlib import Path
298
+
299
+ from deepwrap import Client
300
+
301
+ client = Client(
302
+ working_directory=Path.cwd(),
303
+ command_timeout=30,
304
+ max_agent_rounds=8,
305
+ )
306
+ chat = client.chats.create_session(model="expert")
307
+
308
+ result = chat.respond(
309
+ "Find every Python file containing ChatSession and summarize its usage.",
310
+ stream=False,
311
+ )
312
+ print(result)
313
+ for execution in result.tools_used:
314
+ print(execution.name, execution.arguments, execution.output)
315
+ ```
316
+
317
+ Streaming returns an `AgentStream`. Final-answer chunks arrive incrementally, and
318
+ the same execution history is available after or during consumption:
319
+
320
+ ```python
321
+ response = chat.respond("Inspect this project.", stream=True)
322
+
323
+ for chunk in response:
324
+ print(chunk, end="", flush=True)
325
+
326
+ for execution in response.tools_used:
327
+ print(execution.name, execution.arguments, execution.output)
328
+ ```
329
+
330
+ For immediate progress while the agent is planning or running tools, pass an
331
+ event callback:
332
+
333
+ ```python
334
+ def show_progress(event):
335
+ print(f"[{event.type}] {event.message}", flush=True)
336
+
337
+ response = chat.respond(
338
+ "Build a complete landing page in one HTML file.",
339
+ stream=True,
340
+ on_event=show_progress,
341
+ )
342
+ ```
343
+
344
+ Events include `started`, `planning`, `thinking`, `tool_started`, `tool_completed`,
345
+ `responding`, and `completed`. The history remains available as
346
+ `response.events`; tool events also include arguments, output, and duration.
347
+
348
+ #### Background jobs
349
+
350
+ Long-running commands can execute concurrently without blocking the agent response:
351
+
352
+ ```python
353
+ response = chat.respond(
354
+ "Start the crawler as a background job and return immediately.",
355
+ stream=False,
356
+ )
357
+
358
+ job = next(
359
+ execution.output
360
+ for execution in response.tools_used
361
+ if execution.name == "start_job"
362
+ )
363
+ print(job["id"], job["state"])
364
+
365
+ # A later turn in the same Client can inspect status and logs.
366
+ print(chat.respond("Check that job and show its latest output.", stream=False))
367
+ ```
368
+
369
+ Each job has an independent process group and file-backed stdout/stderr logs.
370
+ `job_output` returns `next_offset`, allowing the agent to resume reading only new
371
+ output. Jobs remain available across chat turns while the same `Client` process is
372
+ alive. See `examples/15_background_jobs.py` for a complete example.
373
+
374
+ > Run network scanners and similar tools only against systems and networks you own
375
+ > or are explicitly authorized to assess.
376
+
377
+ Non-streaming `AgentResponse` remains a subclass of `str`, so existing string
378
+ handling continues to work. Each `tools_used` entry contains `name`, `arguments`,
379
+ and `output`.
380
+
381
+ Disable agent operations globally or for one request:
382
+
383
+ ```python
384
+ client = Client(agent_mode=False)
385
+ plain_response = chat.respond("Hello", agent=False, stream=False)
386
+ ```
387
+
388
+ The interactive CLI always starts directly in agent mode; no activation command
389
+ is required. The Python SDK and local HTTP API still accept an `agent` boolean
390
+ for applications that explicitly need plain-chat behavior.
391
+
392
+ #### Natural-language CLI actions
393
+
394
+ Every slash-command capability is also registered as an agent tool. Users can
395
+ control the CLI naturally without remembering command syntax:
396
+
397
+ ```text
398
+ Please clear this chat and screen.
399
+ Start a new conversation.
400
+ Switch to the default model and enable search.
401
+ Hide thinking output.
402
+ Save my current settings.
403
+ Show the current status.
404
+ Exit DeepWrap.
405
+ ```
406
+
407
+ Token changes schedule the secure hidden-input prompt; credentials are never
408
+ accepted as model-generated tool arguments. Direct slash commands remain available.
409
+
410
+ Local images are handled automatically through a dedicated vision session, even
411
+ when the current model is `expert`:
412
+
413
+ ```text
414
+ What can you see in /home/user/Pictures/photo.jpg?
415
+ ```
416
+
417
+ The CLI agent selects `inspect_image`, uploads the file to a temporary vision chat,
418
+ and feeds the visual analysis back into the current conversation. Manual
419
+ `/model vision` and `/attach` remain useful when several follow-up prompts should
420
+ reuse the same uploaded image.
421
+
422
+ Thinking output works in agent mode as well as plain mode. Enabling or disabling
423
+ God Mode updates the current session in place, so conversation and image context
424
+ are preserved.
425
+
426
+ For large repositories, `grep` and `read_file` return bounded pages with
427
+ `has_more` and `next_offset`. The agent protocol instructs the model to search
428
+ broadly, narrow relevant files, and follow pagination instead of flooding its
429
+ context with entire projects.
430
+
431
+ > Agent mode executes model-generated commands and code and can read or modify any
432
+ > path available to the current operating-system user. Run it only in an environment
433
+ > where that level of access is intended. Use `working_directory`, a dedicated user,
434
+ > container, or virtual machine when isolation is required.
435
+
436
+ Runnable examples:
437
+
438
+ - `examples/11_agent.py` — agent-driven project search and summary.
439
+ - `examples/12_native_tools.py` — direct use of all six native tools.
440
+ - `examples/13_agent_file_edit.py` — autonomous read/edit/verification workflow.
441
+ - `examples/14_agent_exec.py` — command and Python execution workflow.
442
+ - `examples/15_background_jobs.py` — concurrent process jobs and later inspection.
443
+
444
+ ---
445
+
275
446
  ### Vision file uploads
276
447
 
277
448
  Files can be attached only to a `vision` session. DeepWrap uploads the file,
@@ -523,7 +694,7 @@ Example response:
523
694
  {
524
695
  "ok": true,
525
696
  "app": "deepwrap",
526
- "version": "0.2.1",
697
+ "version": "0.2.3",
527
698
  "token_configured": true,
528
699
  "cached_clients": 1,
529
700
  "active_sessions": 0
@@ -0,0 +1,27 @@
1
+ from .client import Client
2
+ from .function_calling import (
3
+ AgentResponse,
4
+ AgentEvent,
5
+ AgentStream,
6
+ Tool,
7
+ ToolCall,
8
+ ToolExecution,
9
+ ToolResponse,
10
+ )
11
+ from .native_tools import NativeTools
12
+ from .memory import MemoryStore
13
+ from .project_intelligence import ProjectIntelligence
14
+
15
+ __all__ = [
16
+ "AgentResponse",
17
+ "AgentEvent",
18
+ "AgentStream",
19
+ "Client",
20
+ "NativeTools",
21
+ "MemoryStore",
22
+ "ProjectIntelligence",
23
+ "Tool",
24
+ "ToolCall",
25
+ "ToolExecution",
26
+ "ToolResponse",
27
+ ]