primethink-cli 1.4.1__tar.gz → 1.6.0__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 (52) hide show
  1. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/DEVELOPER.md +12 -7
  2. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/MANIFEST.in +5 -0
  3. {primethink_cli-1.4.1/primethink_cli.egg-info → primethink_cli-1.6.0}/PKG-INFO +23 -13
  4. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/README.md +16 -12
  5. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/SPECS.md +12 -9
  6. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/USER_GUIDE.md +29 -6
  7. primethink_cli-1.6.0/docs/agent-tools.md +116 -0
  8. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/docs/cli-reference.md +116 -15
  9. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/docs/install.md +14 -0
  10. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/primethink.py +361 -31
  11. primethink_cli-1.6.0/primethink_agent_tools/__init__.py +63 -0
  12. primethink_cli-1.6.0/primethink_agent_tools/client.py +46 -0
  13. primethink_cli-1.6.0/primethink_agent_tools/settings.py +99 -0
  14. primethink_cli-1.6.0/primethink_agent_tools/tools.py +1594 -0
  15. {primethink_cli-1.4.1 → primethink_cli-1.6.0/primethink_cli.egg-info}/PKG-INFO +23 -13
  16. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/primethink_cli.egg-info/SOURCES.txt +10 -0
  17. primethink_cli-1.6.0/primethink_cli.egg-info/entry_points.txt +5 -0
  18. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/primethink_cli.egg-info/requires.txt +7 -0
  19. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/primethink_cli.egg-info/top_level.txt +1 -0
  20. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/primethink_mcp.py +90 -16
  21. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/pyproject.toml +23 -3
  22. primethink_cli-1.6.0/pytest.ini +4 -0
  23. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/skills/primethink-cli/SKILL.md +15 -8
  24. primethink_cli-1.6.0/tests/__init__.py +1 -0
  25. primethink_cli-1.6.0/tests/conftest.py +58 -0
  26. primethink_cli-1.6.0/tests/test_agent_tools.py +805 -0
  27. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_cli.py +130 -3
  28. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_install_developer_skill.py +28 -0
  29. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_live_app.py +188 -0
  30. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_mcp_server.py +98 -1
  31. primethink_cli-1.6.0/tests/test_packaging.py +120 -0
  32. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_project_workflows.py +271 -0
  33. primethink_cli-1.4.1/primethink_cli.egg-info/entry_points.txt +0 -2
  34. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/LICENSE +0 -0
  35. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/docs/primethink_help_llms.txt +0 -0
  36. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/install/homebrew/primethink-cli.rb +0 -0
  37. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/install/install.cmd +0 -0
  38. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/install/install.ps1 +0 -0
  39. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/install/install.sh +0 -0
  40. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/primethink_cli.egg-info/dependency_links.txt +0 -0
  41. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/scripts/build.sh +0 -0
  42. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/scripts/deploy.sh +0 -0
  43. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/scripts/publish.sh +0 -0
  44. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/setup.cfg +0 -0
  45. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/setup.py +0 -0
  46. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/skills/__init__.py +0 -0
  47. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_agent_commands.py +0 -0
  48. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_env_config.py +0 -0
  49. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_install_skill.py +0 -0
  50. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_search_commands.py +0 -0
  51. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_task_commands.py +0 -0
  52. {primethink_cli-1.4.1 → primethink_cli-1.6.0}/tests/test_whoami.py +0 -0
@@ -55,8 +55,8 @@ pip install -e ".[dev]"
55
55
  primethink-cli/
56
56
  ├── primethink.py # Main CLI implementation (single module)
57
57
  ├── primethink_mcp.py # MCP server (pt mcp), reuses primethink.py's helpers; optional [mcp] extra
58
- ├── internal_tools/ # primethink-agent-tools: LangChain tools plugin for PT agents
59
- │ # (own distribution; depends on primethink-cli; reuses its helpers)
58
+ ├── primethink_agent_tools/ # Agent tools plugin: LangChain tools for PT agents; optional [agent-tools] extra
59
+ │ # (entry point primethink.tools; reuses primethink.py's helpers)
60
60
  ├── pyproject.toml # Package configuration (entry point: pt)
61
61
  ├── setup.py # Legacy packaging shim
62
62
  ├── requirements.txt # Runtime dependencies
@@ -85,7 +85,10 @@ primethink-cli/
85
85
  ├── test_task_commands.py # Task command tests
86
86
  ├── test_live_app.py # Safe GitHub template scaffolding tests
87
87
  ├── test_install_developer_skill.py # Recursive public skill installer tests
88
- └── test_install_skill.py # bundled CLI skill installer tests
88
+ ├── test_install_skill.py # bundled CLI skill installer tests
89
+ ├── test_mcp_server.py # MCP server tests (skipped without the mcp SDK)
90
+ ├── test_agent_tools.py # Agent tools plugin tests (skipped without langchain-core)
91
+ └── test_packaging.py # Wheel/entry-point/extras contract (runs on a base install)
89
92
  ```
90
93
 
91
94
  ## Architecture
@@ -142,7 +145,7 @@ def my_command(thing_id, profile, api_url):
142
145
 
143
146
  Security boundaries are enforced before the destination is exposed: HTTPS GitHub repository URLs only, compressed/expanded size and file-count limits, repository-relative manifest paths, path-traversal and duplicate-path checks, symbolic-link rejection, and refusal to touch an existing destination. Tests build in-memory ZIP archives and mock `requests.request`; do not make live GitHub calls in the test suite. The default catalog lives in the separate `primethink-app-templates` repository.
144
147
 
145
- Because this command only creates local source files and does not call the PrimeThink API, it has no MCP or `primethink-agent-tools` equivalent.
148
+ Because this command only creates local source files and does not call the PrimeThink API, it has no MCP or agent-tools equivalent.
146
149
 
147
150
  #### 4. Agent Skill Installation
148
151
 
@@ -185,16 +188,18 @@ Key differences from the CLI, driven by MCP-over-stdio constraints:
185
188
 
186
189
  `mcp` is an optional dependency (the `[mcp]` extra, Python 3.10+); `pt mcp` imports `primethink_mcp` lazily and prints an install hint if the SDK is missing. Tests live in `tests/test_mcp_server.py` and `pytest.importorskip("mcp")` so they skip cleanly where the SDK isn't installed.
187
190
 
188
- #### 7. Agent Tools Plugin (`internal_tools/`)
191
+ #### 7. Agent Tools Plugin (`primethink_agent_tools/`)
189
192
 
190
- `internal_tools/` is a **separate distribution** (`primethink-agent-tools`) that depends on `primethink-cli` and exposes the admin/management API as LangChain tools for PrimeThink agents, discovered via the `primethink.tools` entry point. It reuses the CLI's code rather than re-implementing it:
193
+ `primethink_agent_tools/` ships **inside the `primethink-cli` wheel**, enabled by the optional `[agent-tools]` extra (`langchain-core`, `pydantic`; Python 3.9+). It exposes the admin/management API as LangChain tools for PrimeThink agents, discovered via the `primethink.tools` entry point that `pyproject.toml` declares (`primethink_admin = "primethink_agent_tools:register"`). It reuses the CLI's code rather than re-implementing it:
191
194
 
192
195
  - **Transport reuse without a rewrite.** Tools call `primethink._api_call` (the CLI's `requests` layer) through a small async wrapper (`client.api_json`) that runs it in `asyncio.to_thread` — the agent runtime is async, and `requests` is sync. No httpx dependency; `requests` comes transitively from `primethink-cli`.
193
196
  - **Payload reuse.** Tools import `_clean_payload`, `_TASK_PORTABLE_FIELDS`, `_VERSION_FIELDS`, etc. from `primethink`, so payload shaping matches `pt`/`pt mcp`. Only endpoint path strings are written locally (the accepted trade for not restructuring the CLI).
194
197
  - **Auth.** Per-user token from the `ADMIN_PRIMETHINK_API_TOKEN` setting, resolved via the injected `get_user_setting_value` context (`settings.PrimethinkSettingsProvider`), with a `StaticSettingsProvider` fallback for tests/standalone.
195
198
  - **Scope.** Admin/management only (tasks, agents, chats, collections + collection↔chat assignment). Excludes hot-path search, document byte transfer, messaging/orchestration, and destructive deletes — those stay native.
196
199
 
197
- This directory is **not** part of the `primethink-cli` wheel (the main `pyproject.toml` ships only `primethink`/`primethink_mcp`); it builds and tests independently (`pip install -e ./internal_tools[dev]`, `cd internal_tools && pytest`). When you add or change an API command that belongs in the agent surface, add/update the matching tool in `internal_tools/src/primethink_agent_tools/tools.py` and its test.
200
+ Because the plugin and the private CLI helpers it imports (`_api_call`, `_clean_payload`, `_TASK_PORTABLE_FIELDS`, `_VERSION_FIELDS`) always ship in the same wheel, there is no cross-package version skew to guard against. The base CLI install is unaffected: the entry point is declared, but nothing loads it unless the PrimeThink API calls it, and `register()` imports langchain lazily — and when it is called without the extra, it raises a `ModuleNotFoundError` whose message names `pip install 'primethink-cli[agent-tools]'` (the API logs it and continues without the plugin). The API image installs `primethink-cli[agent-tools]==<version>`; see [`docs/agent-tools.md`](docs/agent-tools.md) for setup.
201
+
202
+ Tests live in `tests/test_agent_tools.py` and `pytest.importorskip("langchain_core")`, so they skip where the extra isn't installed (the `dev` extra installs it); the packaging contract (entry point, `pyproject.toml` packages/extras, RECORD contents of a non-editable install, the `register()` install hint) lives in `tests/test_packaging.py` and needs no extra. When you add or change an API command that belongs in the agent surface, add/update the matching tool in `primethink_agent_tools/tools.py` and its test.
198
203
 
199
204
  ## Adding New Commands
200
205
 
@@ -7,6 +7,11 @@ recursive-include docs *.md *.txt
7
7
  recursive-include install *.sh *.ps1 *.cmd *.rb
8
8
  recursive-include scripts *.sh
9
9
  recursive-include skills *.md
10
+ # setuptools auto-includes tests/test_*.py; add the package marker and shared
11
+ # fixtures the test modules import (`from tests.conftest import ...`), plus the
12
+ # pytest config, so a bare `pytest` inside an unpacked sdist collects `tests/`.
13
+ recursive-include tests *.py
14
+ include pytest.ini
10
15
  # Internal design/spec artifacts live under docs/ but must not ship in the sdist.
11
16
  prune docs/superpowers
12
17
  global-exclude __pycache__
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: primethink-cli
3
- Version: 1.4.1
3
+ Version: 1.6.0
4
4
  Summary: PrimeThink CLI - A powerful tool for interacting with PrimeThink AI API
5
5
  Author-email: PrimeThink <support@primethink.ai>
6
6
  License-Expression: MIT
@@ -26,10 +26,16 @@ Requires-Dist: click>=8.0.0
26
26
  Requires-Dist: requests>=2.25.0
27
27
  Provides-Extra: mcp
28
28
  Requires-Dist: mcp<2,>=1.2.0; extra == "mcp"
29
+ Requires-Dist: pydantic>=2.0; extra == "mcp"
30
+ Provides-Extra: agent-tools
31
+ Requires-Dist: langchain-core>=0.3.0; extra == "agent-tools"
32
+ Requires-Dist: pydantic>=2.0; extra == "agent-tools"
29
33
  Provides-Extra: dev
30
34
  Requires-Dist: pytest>=7.0.0; extra == "dev"
31
35
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
32
36
  Requires-Dist: mcp<2,>=1.2.0; python_version >= "3.10" and extra == "dev"
37
+ Requires-Dist: langchain-core>=0.3.0; python_version >= "3.10" and extra == "dev"
38
+ Requires-Dist: pydantic>=2.0; python_version >= "3.10" and extra == "dev"
33
39
  Dynamic: license-file
34
40
 
35
41
  # PrimeThink CLI
@@ -79,7 +85,7 @@ pt chat send --agent AGENT_ID --message "your message"
79
85
  | `pt profile remove` | Remove a profile |
80
86
  | `pt chat send` | Send a message to a chat (by ID/mention) or an agent |
81
87
  | `pt chat list` | List chats (paginated, filterable by star/archive/workspace) |
82
- | `pt chat create` | Create a new chat |
88
+ | `pt chat create` | Create a new chat (`--from-task-id` launches a task into it) |
83
89
  | `pt chat rename` | Rename a chat |
84
90
  | `pt chat goal` | Update a chat's goal |
85
91
  | `pt chat type` | Switch a chat between `live-app` and `chat` mode |
@@ -99,7 +105,7 @@ pt chat send --agent AGENT_ID --message "your message"
99
105
  | `pt chat sync-from` | Sync a chat's files to a local directory |
100
106
  | `pt chat sync` | Two-way sync between a chat folder and a local directory |
101
107
  | `pt chatdb init` | Initialize a chat's ChatDB (Live App data) store |
102
- | `pt chatdb list` | List entities in a chat's ChatDB store |
108
+ | `pt chatdb list` | List entities in a chat's ChatDB store (or an attached DB Collection via `--collection`/`--collection-id`) |
103
109
  | `pt chatdb get` | Get one ChatDB entity by ID |
104
110
  | `pt chatdb add` | Add one or more rows to a ChatDB entity |
105
111
  | `pt chatdb update` | Update ChatDB entities (single or bulk) |
@@ -158,7 +164,8 @@ pt chat send --agent AGENT_ID --message "your message"
158
164
  | `pt task delete` | Delete a task (asks for confirmation; `--yes` to skip) |
159
165
  | `pt task duplicate` | Duplicate a task |
160
166
  | `pt task set-public` / `pt task set-private` | Make a task public / private |
161
- | `pt task publish` | Create/update a task from a project directory |
167
+ | `pt task publish` | Create/update a task from a project directory (`--type`, feature toggles, optional `task.json`) |
168
+ | `pt task launch` | Launch a task into a new chat, optionally inside a workspace |
162
169
  | `pt task test` | Sync a task goal into a new or existing chat |
163
170
  | `pt task export` | Export a task's portable config as JSON (for `pt task import`) |
164
171
  | `pt task import` | Create a new task from an exported JSON file (deploy across environments with `--profile`) |
@@ -349,8 +356,12 @@ pt task import tasks/briefing.json --profile production
349
356
 
350
357
  # Publish a conventional task project (GOAL.md required); pass an ID to update
351
358
  pt task publish ./tasks/briefing --virtual-assistant-id 7
359
+ pt task publish ./tasks/briefing --virtual-assistant-id 7 --type group --chat-history --docs-enabled --scheduled-jobs
352
360
  pt task publish ./tasks/briefing --task-id 99 --virtual-assistant-id 7
353
361
 
362
+ # Launch a task into a chat (optionally inside a workspace), as the web app does
363
+ pt task launch 99 --workspace-id 738
364
+
354
365
  # Make the resulting task public/private, or test its goal in a chat
355
366
  pt task set-public 99
356
367
  pt task set-private 99
@@ -439,21 +450,20 @@ for the full tool list.
439
450
 
440
451
  ## Agent Tools Plugin
441
452
 
442
- Beyond the CLI and MCP server, this repo also ships **[`primethink-agent-tools`](internal_tools/)**
443
- (under `internal_tools/`) — a plugin that exposes the PrimeThink admin/management
444
- API (tasks, agents, chats, collections) as **LangChain tools for PrimeThink
445
- agents**, reusing the same client code as `pt`. It's a separate distribution that
446
- depends on `primethink-cli`, so the CLI stays lean, and the plugin is installed
447
- only in the agent runtime:
453
+ Beyond the CLI and MCP server, the package also ships the **agent tools plugin**
454
+ (`primethink_agent_tools`) — it exposes the PrimeThink admin/management API
455
+ (tasks, agents, chats, collections) as **LangChain tools for PrimeThink
456
+ agents**, reusing the same client code as `pt`. It's enabled by the optional
457
+ `agent-tools` extra, so plain CLI installs stay lean (no langchain) and the
458
+ plugin is installed only in the agent runtime / API image:
448
459
 
449
460
  ```bash
450
- pip install primethink-cli primethink-agent-tools
461
+ pip install 'primethink-cli[agent-tools]'
451
462
  ```
452
463
 
453
464
  The PrimeThink API discovers it automatically via the `primethink.tools` entry
454
465
  point. Authentication uses a per-user `ADMIN_PRIMETHINK_API_TOKEN` setting. See
455
- [`internal_tools/README.md`](internal_tools/README.md) for the tool list, auth,
456
- and setup.
466
+ [`docs/agent-tools.md`](docs/agent-tools.md) for the tool list, auth, and setup.
457
467
 
458
468
  ## Agent Skills
459
469
 
@@ -45,7 +45,7 @@ pt chat send --agent AGENT_ID --message "your message"
45
45
  | `pt profile remove` | Remove a profile |
46
46
  | `pt chat send` | Send a message to a chat (by ID/mention) or an agent |
47
47
  | `pt chat list` | List chats (paginated, filterable by star/archive/workspace) |
48
- | `pt chat create` | Create a new chat |
48
+ | `pt chat create` | Create a new chat (`--from-task-id` launches a task into it) |
49
49
  | `pt chat rename` | Rename a chat |
50
50
  | `pt chat goal` | Update a chat's goal |
51
51
  | `pt chat type` | Switch a chat between `live-app` and `chat` mode |
@@ -65,7 +65,7 @@ pt chat send --agent AGENT_ID --message "your message"
65
65
  | `pt chat sync-from` | Sync a chat's files to a local directory |
66
66
  | `pt chat sync` | Two-way sync between a chat folder and a local directory |
67
67
  | `pt chatdb init` | Initialize a chat's ChatDB (Live App data) store |
68
- | `pt chatdb list` | List entities in a chat's ChatDB store |
68
+ | `pt chatdb list` | List entities in a chat's ChatDB store (or an attached DB Collection via `--collection`/`--collection-id`) |
69
69
  | `pt chatdb get` | Get one ChatDB entity by ID |
70
70
  | `pt chatdb add` | Add one or more rows to a ChatDB entity |
71
71
  | `pt chatdb update` | Update ChatDB entities (single or bulk) |
@@ -124,7 +124,8 @@ pt chat send --agent AGENT_ID --message "your message"
124
124
  | `pt task delete` | Delete a task (asks for confirmation; `--yes` to skip) |
125
125
  | `pt task duplicate` | Duplicate a task |
126
126
  | `pt task set-public` / `pt task set-private` | Make a task public / private |
127
- | `pt task publish` | Create/update a task from a project directory |
127
+ | `pt task publish` | Create/update a task from a project directory (`--type`, feature toggles, optional `task.json`) |
128
+ | `pt task launch` | Launch a task into a new chat, optionally inside a workspace |
128
129
  | `pt task test` | Sync a task goal into a new or existing chat |
129
130
  | `pt task export` | Export a task's portable config as JSON (for `pt task import`) |
130
131
  | `pt task import` | Create a new task from an exported JSON file (deploy across environments with `--profile`) |
@@ -315,8 +316,12 @@ pt task import tasks/briefing.json --profile production
315
316
 
316
317
  # Publish a conventional task project (GOAL.md required); pass an ID to update
317
318
  pt task publish ./tasks/briefing --virtual-assistant-id 7
319
+ pt task publish ./tasks/briefing --virtual-assistant-id 7 --type group --chat-history --docs-enabled --scheduled-jobs
318
320
  pt task publish ./tasks/briefing --task-id 99 --virtual-assistant-id 7
319
321
 
322
+ # Launch a task into a chat (optionally inside a workspace), as the web app does
323
+ pt task launch 99 --workspace-id 738
324
+
320
325
  # Make the resulting task public/private, or test its goal in a chat
321
326
  pt task set-public 99
322
327
  pt task set-private 99
@@ -405,21 +410,20 @@ for the full tool list.
405
410
 
406
411
  ## Agent Tools Plugin
407
412
 
408
- Beyond the CLI and MCP server, this repo also ships **[`primethink-agent-tools`](internal_tools/)**
409
- (under `internal_tools/`) — a plugin that exposes the PrimeThink admin/management
410
- API (tasks, agents, chats, collections) as **LangChain tools for PrimeThink
411
- agents**, reusing the same client code as `pt`. It's a separate distribution that
412
- depends on `primethink-cli`, so the CLI stays lean, and the plugin is installed
413
- only in the agent runtime:
413
+ Beyond the CLI and MCP server, the package also ships the **agent tools plugin**
414
+ (`primethink_agent_tools`) — it exposes the PrimeThink admin/management API
415
+ (tasks, agents, chats, collections) as **LangChain tools for PrimeThink
416
+ agents**, reusing the same client code as `pt`. It's enabled by the optional
417
+ `agent-tools` extra, so plain CLI installs stay lean (no langchain) and the
418
+ plugin is installed only in the agent runtime / API image:
414
419
 
415
420
  ```bash
416
- pip install primethink-cli primethink-agent-tools
421
+ pip install 'primethink-cli[agent-tools]'
417
422
  ```
418
423
 
419
424
  The PrimeThink API discovers it automatically via the `primethink.tools` entry
420
425
  point. Authentication uses a per-user `ADMIN_PRIMETHINK_API_TOKEN` setting. See
421
- [`internal_tools/README.md`](internal_tools/README.md) for the tool list, auth,
422
- and setup.
426
+ [`docs/agent-tools.md`](docs/agent-tools.md) for the tool list, auth, and setup.
423
427
 
424
428
  ## Agent Skills
425
429
 
@@ -38,7 +38,7 @@ To obtain an API key, go to `Settings > API Keys` in the PrimeThink app and gene
38
38
  | `pt chat send CHAT_ID` | `POST /api/v1/chats/{chat_id_or_mention}/messages` |
39
39
  | `pt chat send --agent ID` | `POST /api/v1/virtual-assistants/{agent_id}/messages` |
40
40
  | `pt chat list` | `GET /api/v1/chats` |
41
- | `pt chat create` | `POST /api/v1/chats` |
41
+ | `pt chat create` | `POST /api/v1/chats` (`--from-task-id` adds `?copy_from_task_id=`) |
42
42
  | `pt chat rename` | `PUT /api/v1/chats/{chat_id}/name` |
43
43
  | `pt chat goal` | `PUT /api/v1/chats/{chat_id}/goal` |
44
44
  | `pt chat type` | `PUT /api/v1/chats/{chat_id}/page_type?page_type=html\|chat` |
@@ -66,13 +66,13 @@ To obtain an API key, go to `Settings > API Keys` in the PrimeThink app and gene
66
66
  | `pt scheduled-job delete` | `DELETE /api/v1/scheduled_jobs/scheduled_job_in_chat/{job_id}` |
67
67
  | document download (used by `download-file` and `sync-from`) | `GET /api/v1/documents/{document_id}/download` |
68
68
  | `pt chatdb init` | `POST /api/v1/chats/{chat_id}/chatdb/init` |
69
- | `pt chatdb list` | `POST /api/v1/chats/{chat_id}/chatdb/list` |
70
- | `pt chatdb get` | `GET /api/v1/chats/{chat_id}/chatdb/entities/{entity_id}` |
71
- | `pt chatdb add` | `POST /api/v1/chats/{chat_id}/chatdb/entities` |
72
- | `pt chatdb update` | `PATCH /api/v1/chats/{chat_id}/chatdb/entities` |
73
- | `pt chatdb delete` | `DELETE /api/v1/chats/{chat_id}/chatdb/entities` |
69
+ | `pt chatdb list` | `POST /api/v1/chats/{chat_id}/chatdb/list` (body may add `collection_name`/`collection_id`) |
70
+ | `pt chatdb get` | `GET /api/v1/chats/{chat_id}/chatdb/entities/{entity_id}` (query: `collection_name`, `collection_id`) |
71
+ | `pt chatdb add` | `POST /api/v1/chats/{chat_id}/chatdb/entities` (body may add `collection_name`/`collection_id`) |
72
+ | `pt chatdb update` | `PATCH /api/v1/chats/{chat_id}/chatdb/entities` (body may add `collection_name`/`collection_id`) |
73
+ | `pt chatdb delete` | `DELETE /api/v1/chats/{chat_id}/chatdb/entities` (body may add `collection_name`/`collection_id`) |
74
74
  | `pt collection list` | `GET /api/v1/collections` |
75
- | `pt collection create` | `POST /api/v1/collections` (params: `name`, `description`, `type`, `public`) |
75
+ | `pt collection create` | `POST /api/v1/collections` (params: `name`, `description`, `type` = `collection`/`skill`/`external_source`/`db`, `public`) |
76
76
  | `pt collection get` | `GET /api/v1/collections/{collection_id}` |
77
77
  | `pt collection update` | `PATCH /api/v1/collections/{collection_id}` |
78
78
  | `pt collection reindex` | `POST /api/v1/collections/{collection_id}/reindex` |
@@ -114,7 +114,8 @@ To obtain an API key, go to `Settings > API Keys` in the PrimeThink app and gene
114
114
  | `pt task delete` | `DELETE /api/v1/tasks/{task_id}` |
115
115
  | `pt task duplicate` | `POST /api/v1/tasks/{task_id}/duplicate` |
116
116
  | `pt task set-public` / `set-private` | `PATCH /api/v1/tasks/{task_id}/public-status?task_type=public\|private` |
117
- | `pt task publish` | `POST /api/v1/tasks/` or `PATCH /api/v1/tasks/{task_id}` |
117
+ | `pt task publish` | `POST /api/v1/tasks/` or `PATCH /api/v1/tasks/{task_id}` (type/toggles from options or the project's `task.json`) |
118
+ | `pt task launch` | `POST /api/v1/chats?copy_from_task_id={task_id}[&task_version_number=N]` (body: optional `chat_workspace_id`, `name`) |
118
119
  | `pt task test` | `POST /api/v1/chats` (new only), `PUT /api/v1/chats/{chat_id}/page_type` (existing only), `PUT /api/v1/chats/{chat_id}/goal` |
119
120
  | `pt live-app publish` | task create/update + task version + task directory/document/version endpoints |
120
121
  | `pt live-app test` | chat create/page-type/goal + chat directory/document/version endpoints |
@@ -309,11 +310,13 @@ pt chat list [--page N] [--page-size N] [--search TEXT] [--starred/--no-starred]
309
310
 
310
311
  **Body**: JSON object; all fields optional and omitted unless set — `name`, `goal`, `virtual_assistant_id` (int), `chat_workspace_id`, `parent_chat_id` (int), `type` (`standard` | `direct_users`; server default `standard`), `public` (bool), `members` (int array).
311
312
 
313
+ **Query parameters** (task launch): `copy_from_task_id` (int) makes the server copy that task's goal, default agent, settings, documents, collections and scheduled job into the new chat and post its initial prompt — the route the web app uses to open a task; `task_version_number` (int, optional) launches a specific version. A `task_id` in the body is ignored by the server. Exposed as `pt task launch` / `pt chat create --from-task-id` and the `launch_task` MCP tool.
314
+
312
315
  **Success statuses**: 200, 201
313
316
 
314
317
  **CLI Command**:
315
318
  ```bash
316
- pt chat create [--name TEXT] [--goal TEXT | --goal-file PATH] [--virtual-assistant-id ID] [--workspace-id ID] [--parent-chat-id ID] [--type TYPE] [--public/--no-public] [--member USER_ID]...
319
+ pt chat create [--name TEXT] [--goal TEXT | --goal-file PATH] [--virtual-assistant-id ID] [--workspace-id ID] [--parent-chat-id ID] [--type TYPE] [--public/--no-public] [--member USER_ID]... [--from-task-id TASK_ID]
317
320
  ```
318
321
 
319
322
  ---
@@ -77,7 +77,7 @@ pt version
77
77
 
78
78
  You should see output like:
79
79
  ```
80
- PrimeThink CLI v1.3.3
80
+ PrimeThink CLI v1.6.0
81
81
  ```
82
82
 
83
83
  ## Getting Started
@@ -713,6 +713,19 @@ pt chatdb delete 123 --entity-id 7 # asks for confirmation; --yes to sk
713
713
 
714
714
  `--data` takes a single JSON object; `--items` takes a JSON array for bulk operations. On update, `--merge` patches the existing row while `--replace` overwrites it, and `--if-unchanged-since TIMESTAMP` guards against overwriting a row that changed underneath you.
715
715
 
716
+ ### DB Collections
717
+
718
+ A **DB Collection** is a collection of type `db` that holds the same kind of entities, but can be shared between chats. Once one is attached to a chat, `list`, `get`, `add`, `update` and `delete` can target it instead of the chat's own ChatDB, by name or by ID:
719
+
720
+ ```bash
721
+ pt collection create --name project-db --type db # note the id, e.g. 42
722
+ # attach it to the chat in the web app, then:
723
+ pt chatdb add 123 --entity tasks --data '{"title": "a"}' --collection project-db
724
+ pt chatdb list 123 --entity tasks --collection-id 42
725
+ ```
726
+
727
+ Prefer `--collection-id` when two attached DB Collections share a name, or in scripts that should survive a rename. If you pass both, they must identify the same collection. A collection attached read-only accepts `list`/`get` but rejects writes. This mirrors `pt.db('project-db')` / `pt.db(42)` in a Live App.
728
+
716
729
  > Building the Live App itself (the front-end that uses this data) is covered by the **primethink-developer** skill; `pt chatdb` is the deterministic data plane underneath it.
717
730
 
718
731
  ## Semantic Search
@@ -977,8 +990,12 @@ pt task duplicate 99
977
990
 
978
991
  # Publish a conventional task project; GOAL.md is required
979
992
  pt task publish ./tasks/briefing --virtual-assistant-id 7
993
+ pt task publish ./tasks/briefing --virtual-assistant-id 7 --type group --chat-history --docs-enabled --scheduled-jobs
980
994
  pt task publish ./tasks/briefing --task-id 99 --virtual-assistant-id 7
981
995
 
996
+ # Launch a task into a new chat, optionally inside a workspace (prints the chat JSON + URL)
997
+ pt task launch 99 --workspace-id 738
998
+
982
999
  # Sync the project goal into a new temporary chat or an existing chat
983
1000
  pt task test ./tasks/briefing
984
1001
  pt task test ./tasks/briefing --chat-id CHAT_UUID
@@ -994,7 +1011,9 @@ pt task delete 99 --yes
994
1011
 
995
1012
  A project directory can override its folder name with `.name.config`, its description with `.description.config`, and its initial prompt with `INITIAL_PROMPT.md`. For type changes other than public/private (e.g. `group` or `catalog`), use `pt task update 99 --type group`.
996
1013
 
997
- `pt task publish` prints progress lines rather than JSON, ending with `Task ID: 81`. It takes no task-field options — a created task is private and published with the optional features (memory, chat history, search, summary, documents and collections, scheduled jobs, email integration) switched off. Turn them on afterwards with `pt task update`; a later `pt task publish --task-id` only re-syncs name, description, goal, initial prompt, virtual assistant, and page type, so those settings are not overwritten.
1014
+ `pt task publish` prints progress lines rather than JSON, ending with `Task ID: 81`. Task type and feature toggles come from its options (`--type`, `--chat-history`, `--docs-enabled`, `--scheduled-jobs`, `--global-memory`, `--search-in-chat`, `--search-in-documents`, `--summary-enabled`, `--email-integration`, `--share-action`, `--public-chat`, `--run-immediately`), else from an optional `task.json` in the project directory (`{"type": "group", "chat_history": true, "documents_and_collections_enabled": true, "scheduled_jobs_enabled": true}`), else from the conservative defaults: a created task is **private** with memory, chat history, search, summary, documents and collections, scheduled jobs and email integration **switched off** — so a task that relies on its documents or on scheduling must enable them. A later `pt task publish --task-id` re-syncs name, description, goal, initial prompt, virtual assistant and page type plus every type/toggle given on the command line and every accepted field present in `task.json`; settings the project does not state are not overwritten.
1015
+
1016
+ `pt task launch TASK_ID` starts a task the way the web app does when you open one: it creates a chat (inside `--workspace-id` when given) that inherits the task's goal, default agent, settings, documents, collections and scheduled job, posts the task's initial prompt, and prints the chat JSON followed by `Chat URL: …`. `pt chat create --from-task-id TASK_ID` does the same through the generic chat-create command.
998
1017
 
999
1018
  `pt task test` creates a **new** chat unless you pass `--chat-id`, and prints the chat URL as its last line. A test chat is temporary by default; pass `--permanent` when you mean to keep it. To keep re-testing in the same chat, record the ID on the first run:
1000
1019
 
@@ -1138,10 +1157,10 @@ pt eval delete 99 EVAL_ID
1138
1157
  ### 2. Configure how evaluations run
1139
1158
 
1140
1159
  ```bash
1141
- pt eval settings 99 --active --run-time daily --evaluator-agent-id 7 --pass-threshold 0.8
1160
+ pt eval settings 99 --active --run-time daily --evaluator-agent-id 7 --pass-threshold 80
1142
1161
  ```
1143
1162
 
1144
- `--run-time` is `manual`, `daily`, `weekly`, or `monthly`; `--pass-threshold` is the minimum score to count as a pass; `--message-delay-ms` throttles messages during a run.
1163
+ `--run-time` is `manual`, `daily`, `weekly`, or `monthly`; `--pass-threshold` is the minimum score to count as a pass, as a whole-number percentage from 1 to 100 (`80`, not `0.8`) — anything outside that range is rejected by the CLI before a request is made; `--message-delay-ms` throttles messages during a run.
1145
1164
 
1146
1165
  ### 3. Run it, then read the results
1147
1166
 
@@ -1264,8 +1283,8 @@ Defaults are `--framework react --tailwind --flowbite`. Flowbite depends on Tail
1264
1283
  After generation:
1265
1284
 
1266
1285
  1. Read the generated `README.md`; build and deployment steps differ by template.
1267
- 2. Rename the sample Chat DB entity so it is unique to your app.
1268
- 3. Replace the sample CRUD interface while retaining the PrimeThink runtime, theme, persistence, and real-time patterns.
1286
+ 2. Name every Chat DB entity for your app. The templates ship none, and a generic name such as `item` collides with a sibling app in the same chat.
1287
+ 3. Build the interface on the blank starter, keeping the PrimeThink wiring it ships: the runtime, the host-theme bridge, and the deployment configuration.
1269
1288
  4. Build if required, then upload the files described by the template README.
1270
1289
 
1271
1290
  The default Flowbite React starter is a Vite project and requires a local `npm install` and build. The other default starters are no-build, one-file HTML applications. The CLI itself intentionally runs neither package installation nor generated code.
@@ -1827,6 +1846,10 @@ pt mcp
1827
1846
 
1828
1847
  Point your MCP client at `pt mcp` and provide a `PRIMETHINK_TOKEN` in its server env. See the [MCP Server](#mcp-server) section for a full client-config example.
1829
1848
 
1849
+ ### Q: What is the `agent-tools` extra?
1850
+
1851
+ **A**: It enables the plugin that lets PrimeThink **agents** (not you) manage tasks, agents, chats, and collections through the same client code as `pt`. It's installed in the PrimeThink API image by platform operators, not on your machine — a plain `pip install primethink-cli` doesn't need it. See [docs/agent-tools.md](docs/agent-tools.md).
1852
+
1830
1853
  ### Q: How do I uninstall the CLI?
1831
1854
 
1832
1855
  **A**:
@@ -0,0 +1,116 @@
1
+ # Agent tools plugin (`primethink-cli[agent-tools]`)
2
+
3
+ PrimeThink API tools for PrimeThink **agents**, packaged as a discoverable
4
+ plugin. It exposes the admin/management surface of the PrimeThink API — tasks,
5
+ agents, chats, and collections (including collection↔chat assignment) — as
6
+ LangChain tools, **reusing the `primethink-cli` client code** so the tool
7
+ encoding never drifts from `pt` / `pt mcp`.
8
+
9
+ The plugin is the `primethink_agent_tools` package **inside the `primethink-cli`
10
+ distribution**, enabled by the optional **`agent-tools` extra**. A plain
11
+ `pip install primethink-cli` stays lean (no langchain); the extra pulls in
12
+ `langchain-core` and `pydantic` and is installed only where the tools run — the
13
+ agent runtime / API image. One wheel, one version: the plugin and the CLI
14
+ helpers it imports always ship together.
15
+
16
+ ## What it provides
17
+
18
+ A single capability, code **`primethink_admin`**, with 98 tools (every tool
19
+ name is prefixed `primethink_`):
20
+
21
+ - **Tasks** — list, create, update, get, export, import, duplicate, launch, publish/unpublish, create-version, upload-image
22
+ - **Task evaluation** — list/add/update evaluation items, set evaluation settings, run an evaluation, list runs, get a run, get results, run a simulation, list simulations
23
+ - **Agents** — list, get, create, update, list-types, resolve-capabilities, attach/detach collections, list documents
24
+ - **Capabilities** — list, create, update, archive, duplicate; **model catalog** — list models, list embedding models
25
+ - **Chats** — list, create (optionally from a task), rename, set-goal, archive/unarchive, list-messages, list-files, save-as-task
26
+ - **Chat members & users** — list chat users, invite/remove members, list/search visible users
27
+ - **Notifications** — list, unread-count, mark read/unread, mark-all-read
28
+ - **Scheduled jobs** — list, create, update, set-status
29
+ - **Chat workspaces** — list, create, rename, set-goal, archive, pin, add/remove chat
30
+ - **Collections** — list, create, get, update, reindex, copy, list-files, assign-to-chat (bulk), list-chat-collections, remove-from-chat, set-collection-status
31
+ - **Directories & document versions** — create/move/rename directory; list versions, create text version, set production version (chat/collection/task)
32
+ - **Tags** — list, create, assign; **Groups** — list, get, create, update, list members, remove members, invite, add/remove agents
33
+
34
+ ### Deliberately *not* here
35
+
36
+ Semantic search, document byte transfer (upload/download/sync), messaging/
37
+ orchestration, and destructive deletes are **excluded** — those are hot-path,
38
+ large-payload, or already covered by native platform capabilities, and should
39
+ not round-trip through the public API. See the design notes in
40
+ [`DEVELOPER.md`](../DEVELOPER.md).
41
+
42
+ ## Authentication
43
+
44
+ The tools call the PrimeThink API with a **per-user token** read from PrimeThink
45
+ settings under the name **`ADMIN_PRIMETHINK_API_TOKEN`**. When the API injects a
46
+ plugin context providing `get_user_setting_value`, the token is resolved for the
47
+ acting user (`logged_user_id` / `group_id` come from `RunnableConfig`). This is
48
+ the same `${SETTING}` mechanism MCP capabilities use, so both surfaces share one
49
+ auth story.
50
+
51
+ The API base URL comes from the `PRIMETHINK_API_URL` setting or env var, falling
52
+ back to the CLI's default (`https://api.primethink.ai`).
53
+
54
+ ## Install
55
+
56
+ **Requires Python 3.9+** — the base CLI still supports 3.8, but the tool
57
+ signatures use `typing.Annotated` (3.9+) and `langchain-core>=0.3.0` does not
58
+ resolve on 3.8. The `dev` extra installs the plugin's test dependencies only on
59
+ 3.10+, so plugin tests skip on a 3.9 checkout.
60
+
61
+ ```bash
62
+ # In the API image (production): one pinned line in requirements.txt
63
+ primethink-cli[agent-tools]==1.6.0
64
+
65
+ # From a checkout (dev): the dev extra already includes langchain-core
66
+ pip install -e ".[dev]"
67
+ ```
68
+
69
+ **Upgrading a dev environment that had the old standalone plugin** (installed
70
+ with `pip install -e internal_tools` before 1.5.0; it was never published to
71
+ PyPI): uninstall it first — `pip uninstall primethink-agent-tools` — and only
72
+ then install `primethink-cli[agent-tools]`. Both distributions own the same
73
+ `primethink_agent_tools` modules and declare the same `primethink_admin` entry
74
+ point, so leaving both installed yields duplicate registrations, and removing
75
+ the old one afterwards deletes files the new install relies on.
76
+
77
+ The PrimeThink API discovers the plugin at startup via the `primethink.tools`
78
+ entry point declared by `primethink-cli` — no code changes in the API repo.
79
+ Verify discovery:
80
+
81
+ ```bash
82
+ python -c "from importlib.metadata import entry_points; print(list(entry_points().select(group='primethink.tools')))"
83
+ # [EntryPoint(name='primethink_admin', value='primethink_agent_tools:register', group='primethink.tools')]
84
+ ```
85
+
86
+ Then, as a super-admin, convert the registered `primethink_admin` code into a
87
+ capability (`POST /capabilities/from-registered-tool`, type `internal`), assign
88
+ it to an agent, and set `ADMIN_PRIMETHINK_API_TOKEN` for each user who should be
89
+ able to use it. The tools become available in that agent's chats.
90
+
91
+ Installing the base CLI without the extra is harmless: the entry point is
92
+ declared, but nothing loads it unless the PrimeThink API calls it, and
93
+ `register()` imports langchain lazily. If the API *does* call it on an install
94
+ without the extra, `register()` raises a `ModuleNotFoundError` that names the
95
+ fix (`pip install 'primethink-cli[agent-tools]'`); the API logs it under
96
+ "Failed to load tool plugin: primethink_admin" and starts without the plugin.
97
+ The same message appears on Python 3.8 — the wheel installs there because the
98
+ CLI supports 3.8, but the plugin's tool signatures need `typing.Annotated`
99
+ (3.9+) and the extra's `langchain-core` does not resolve on 3.8, so `register()`
100
+ checks the interpreter first rather than failing on an opaque `typing` import.
101
+
102
+ ## Develop / test
103
+
104
+ Tests live in `tests/test_agent_tools.py` and run with the rest of the suite;
105
+ they `pytest.importorskip("langchain_core")` so they skip cleanly where the
106
+ extra isn't installed. The packaging contract (entry point, `pyproject.toml`
107
+ packages/extras, RECORD of a non-editable install, the `register()` install
108
+ hint) is covered by `tests/test_packaging.py`, which needs no extra:
109
+
110
+ ```bash
111
+ pip install -e ".[dev]"
112
+ pytest -q
113
+ ```
114
+
115
+ Tests mock `primethink.requests.request` (the reused transport) exactly like the
116
+ main CLI tests, so no network access is needed.