deepvista-cli 1.1.0__tar.gz → 2.0.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.
- deepvista_cli-2.0.0/.release-please-manifest.json +3 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/CHANGELOG.md +31 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/PKG-INFO +10 -17
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/README.md +9 -16
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/client/http.py +36 -32
- deepvista_cli-2.0.0/deepvista_cli/commands/agents.py +366 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/card.py +177 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/notes.py +4 -254
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/schedule.py +3 -3
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/skill.py +94 -529
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/tasks.py +866 -249
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/upgrade.py +15 -147
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/main.py +1 -3
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/resources/workflow_host_runtime.md +11 -39
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/session_note.py +1 -7
- deepvista_cli-2.0.0/deepvista_cli/workflow_doc.py +116 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/README.md +14 -37
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/commands/deepvista.md +2 -2
- deepvista_cli-2.0.0/plugins/claude-code/commands/refresh-skills.md +25 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/scripts/deepvista-sync.sh +6 -26
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/skills/install-deepvista-cli/SKILL.md +4 -5
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/pyproject.toml +2 -1
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/SKILL.md +9 -11
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/notes.md +9 -20
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/openclaw.md +4 -4
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/shared.md +9 -17
- deepvista_cli-2.0.0/skills/deepvista/reference/skill-create-from-note.md +60 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/skill-research-to-skill.md +1 -2
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/skill.md +10 -31
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/tasks.md +7 -2
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/vistabase-card.md +9 -2
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/dv-workflow/SKILL.md +3 -3
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_agent_id_tagging.py +4 -4
- deepvista_cli-2.0.0/tests/test_entry_points.py +35 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_tasks_commands.py +405 -101
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/uv.lock +1 -1
- deepvista_cli-1.1.0/.release-please-manifest.json +0 -3
- deepvista_cli-1.1.0/deepvista_cli/agent_catalog.py +0 -606
- deepvista_cli-1.1.0/deepvista_cli/commands/agents.py +0 -1210
- deepvista_cli-1.1.0/deepvista_cli/commands/lint.py +0 -303
- deepvista_cli-1.1.0/deepvista_cli/workflow_doc.py +0 -256
- deepvista_cli-1.1.0/plugins/claude-code/agents/.gitignore +0 -10
- deepvista_cli-1.1.0/plugins/claude-code/commands/refresh-skills.md +0 -29
- deepvista_cli-1.1.0/skills/deepvista/reference/lint.md +0 -54
- deepvista_cli-1.1.0/skills/deepvista/reference/skill-create-from-note.md +0 -75
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/.claude-plugin/marketplace.json +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/.github/workflows/ci.yml +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/.github/workflows/publish.yml +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/.github/workflows/release-please.yml +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/.gitignore +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/.pre-commit-config.yaml +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/CLAUDE.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/CONTRIBUTING.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/LICENSE +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/auth/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/auth/callback_server.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/auth/login.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/auth/tokens.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/client/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/client/origin.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/auth.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/chat.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/config.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/project.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/commands/session.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/config.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/output/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/output/formatter.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/resources/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/deepvista_cli/skill_catalog.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/docs/assets/deepvista-banner.png +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/install.ps1 +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/install.sh +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/README.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/hooks/hooks.json +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/scripts/deepvista-agent-sync.sh +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/scripts/deepvista-session-end.sh +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/scripts/deepvista-session-start.sh +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/scripts/deepvista-session-turn.sh +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/scripts/deepvista-skill-url.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/plugins/claude-code/skills/.gitignore +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/release-please-config.json +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/scripts/check_plugin_version.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/chat.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/project.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/session.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/skill-analyze-notes.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/skills/deepvista/reference/skill-import-files.md +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/__init__.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_project_commands.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_session_note_format.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_skill_catalog.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_skill_commands.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/tests/test_workflow_doc_phases.py +0 -0
- {deepvista_cli-1.1.0 → deepvista_cli-2.0.0}/uninstall.sh +0 -0
|
@@ -37,6 +37,37 @@ users what's new between the version they have installed and the latest release.
|
|
|
37
37
|
adopts a pre-existing server-side row instead of failing when the local
|
|
38
38
|
file is missing.
|
|
39
39
|
|
|
40
|
+
## [2.0.0](https://github.com/DeepVista-AI/deepvista-cli/compare/v1.2.0...v2.0.0) (2026-07-06)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### ⚠ BREAKING CHANGES
|
|
44
|
+
|
|
45
|
+
* simplify the CLI surface (84 → 69 commands, −1,470 lines) ([#189](https://github.com/DeepVista-AI/deepvista-cli/issues/189))
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
* **DV-1428:** stream task-card execution incrementally, report live progress ([#185](https://github.com/DeepVista-AI/deepvista-cli/issues/185)) ([7f081b5](https://github.com/DeepVista-AI/deepvista-cli/commit/7f081b598085d52280fb84c4396d573672b6cb5a))
|
|
50
|
+
* **DV-1429:** tasks clean, auto-detect agent --type, prune stale agents ([#183](https://github.com/DeepVista-AI/deepvista-cli/issues/183)) ([38252e7](https://github.com/DeepVista-AI/deepvista-cli/commit/38252e71b33275bc7976037192a082c7f2ccb391))
|
|
51
|
+
* run task queue jobs in parallel (max 5) ([#193](https://github.com/DeepVista-AI/deepvista-cli/issues/193)) ([b22a727](https://github.com/DeepVista-AI/deepvista-cli/commit/b22a7275a59aef3e69896846a86ddfb263d43a24))
|
|
52
|
+
* simplify the CLI surface (84 → 69 commands, −1,470 lines) ([#189](https://github.com/DeepVista-AI/deepvista-cli/issues/189)) ([5056442](https://github.com/DeepVista-AI/deepvista-cli/commit/50564429a84ff044967cab8db831e282b5fac67b))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* **tasks:** use single-quoted f-string to avoid escaped double quotes in task note hint ([#181](https://github.com/DeepVista-AI/deepvista-cli/issues/181)) ([297de78](https://github.com/DeepVista-AI/deepvista-cli/commit/297de78ee188cd9dcd9b4031b5b29b76733b160d))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Documentation
|
|
61
|
+
|
|
62
|
+
* **DV-1434:** fix schedule command docstring to reference schedule_job cards ([#182](https://github.com/DeepVista-AI/deepvista-cli/issues/182)) ([d01f98d](https://github.com/DeepVista-AI/deepvista-cli/commit/d01f98d03a21256ee96ee4cae8b78f81c4b44a85))
|
|
63
|
+
|
|
64
|
+
## [1.2.0](https://github.com/DeepVista-AI/deepvista-cli/compare/v1.1.0...v1.2.0) (2026-06-27)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Features
|
|
68
|
+
|
|
69
|
+
* **DV-1324:** add dv CLI alias ([#177](https://github.com/DeepVista-AI/deepvista-cli/issues/177)) ([f1973a3](https://github.com/DeepVista-AI/deepvista-cli/commit/f1973a35b488477df187ff2ccb5c0662b2f3efa8))
|
|
70
|
+
|
|
40
71
|
## [1.1.0](https://github.com/DeepVista-AI/deepvista-cli/compare/v1.0.0...v1.1.0) (2026-06-26)
|
|
41
72
|
|
|
42
73
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepvista-cli
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: CLI for DeepVista — chat, notes, skills, and memory from your terminal.
|
|
5
5
|
Project-URL: Homepage, https://deepvista.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/DeepVista-AI/deepvista-cli
|
|
@@ -127,6 +127,9 @@ deepvista card +search "founder mindset"
|
|
|
127
127
|
deepvista chat +send "What did I learn last week?"
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
+
> **Tip:** `dv` is a short alias for `deepvista` — `dv <args>` and `deepvista <args>`
|
|
131
|
+
> are fully interchangeable (e.g. `dv notes +quick "..."`).
|
|
132
|
+
|
|
130
133
|
That's it. Your knowledge base is now accessible from any terminal.
|
|
131
134
|
|
|
132
135
|
---
|
|
@@ -240,13 +243,12 @@ One skill, `deepvista`, with per-subcommand detail under `skills/deepvista/refer
|
|
|
240
243
|
| `reference/vistabase-card.md` | Knowledge-base cards (`card` / `vistabase`) — create, search, pin, edit, grep |
|
|
241
244
|
| `reference/session.md` | Agent session transcripts — init, tick, finalize |
|
|
242
245
|
| `reference/chat.md` | Chat sessions and NDJSON stream format |
|
|
243
|
-
| `reference/skill.md` | Structured Skill workflows — list, run,
|
|
246
|
+
| `reference/skill.md` | Structured Skill workflows — list, run, phase, complete |
|
|
244
247
|
| `reference/skill-create-from-note.md` | Synthesize a Skill from one or more notes |
|
|
245
248
|
| `reference/skill-analyze-notes.md` | Pattern: search → read → synthesize notes |
|
|
246
249
|
| `reference/skill-research-to-skill.md` | Pattern: research the KB, then run a Skill |
|
|
247
250
|
| `reference/skill-import-files.md` | Bulk-import a folder as file cards |
|
|
248
251
|
| `reference/tasks.md` | Run work dispatched to this machine — `tasks run` / `setup` |
|
|
249
|
-
| `reference/lint.md` | Health-check the vistabase for dupes / contradictions / gaps |
|
|
250
252
|
| `reference/openclaw.md` | Auto-capture rules for OpenClaw agents |
|
|
251
253
|
|
|
252
254
|
The agent loads only the index at first; when a subcommand is needed, it reads the matching reference file on demand.
|
|
@@ -315,11 +317,10 @@ deepvista notes # Hand-written notes (cards with type=note)
|
|
|
315
317
|
Supporting commands:
|
|
316
318
|
|
|
317
319
|
```
|
|
318
|
-
deepvista agents #
|
|
320
|
+
deepvista agents # Agent identity heartbeat (auto-registers on first sync)
|
|
319
321
|
deepvista session # Agent conversation transcripts (init / tick / finalize)
|
|
320
322
|
deepvista tasks # Run work dispatched to this machine (task cards, queued commands)
|
|
321
323
|
deepvista schedule # Manage the recurring daily-planning job (opt-in)
|
|
322
|
-
deepvista lint # Health-check the vistabase with the DeepVista agent
|
|
323
324
|
deepvista auth # Authenticate with DeepVista
|
|
324
325
|
deepvista config # Manage CLI profiles (local, staging, production, …)
|
|
325
326
|
deepvista upgrade # Check for and install CLI + skill updates
|
|
@@ -348,16 +349,14 @@ Card types: `person` · `organization` · `message` · `todo` · `topic` · `key
|
|
|
348
349
|
```bash
|
|
349
350
|
deepvista skill list [--limit N]
|
|
350
351
|
deepvista skill get <skill_id>
|
|
351
|
-
deepvista skill run <skill_id> [--
|
|
352
|
+
deepvista skill run <skill_id> [--input "context"]
|
|
352
353
|
deepvista skill phase open <skill_id> "Phase N: <title>"
|
|
353
354
|
deepvista skill phase done <skill_id> "Phase N: <title>" [--artifact-card-id ID]... [--next-phase "Phase N+1: …"]
|
|
354
355
|
deepvista skill phase pause <skill_id> --reason "<short sentence>"
|
|
355
|
-
deepvista skill phase run-on-deepvista <skill_id> "Phase N: <title>"
|
|
356
356
|
deepvista skill complete <skill_id> --review "<retrospective bullets>"
|
|
357
|
-
deepvista skill status <run_chat_id>
|
|
358
357
|
```
|
|
359
358
|
|
|
360
|
-
`skill run`
|
|
359
|
+
`skill run` prints a JSON header + the workflow's SKILL.md body + a host runtime contract on stdout, and the host agent (Claude Code / OpenClaw / Cursor) drives the run via the `phase` shims and `complete`.
|
|
361
360
|
|
|
362
361
|
### chat — AI agent
|
|
363
362
|
|
|
@@ -411,13 +410,7 @@ deepvista schedule deactivate
|
|
|
411
410
|
deepvista schedule delete <job_id>
|
|
412
411
|
```
|
|
413
412
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
```bash
|
|
417
|
-
deepvista lint [--limit N] # surface duplicates, contradictions, stale claims, orphans, gaps
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
Run `deepvista <command> --help` for the full options of any group, including `agents`, `auth`, `config`, `upgrade`, and `ui`. Auth, profiles, and agent registration are also covered in `skills/deepvista/reference/shared.md`.
|
|
413
|
+
Run `deepvista <command> --help` for the full options of any group, including `agents`, `auth`, `config`, and `upgrade`. Auth, profiles, and the agent heartbeat are also covered in `skills/deepvista/reference/shared.md`.
|
|
421
414
|
|
|
422
415
|
---
|
|
423
416
|
|
|
@@ -557,7 +550,7 @@ deepvista-cli/
|
|
|
557
550
|
│ ├── config.py # Config + profiles
|
|
558
551
|
│ ├── auth/ # Login, token storage, callback server
|
|
559
552
|
│ ├── client/ # HTTP client, SSE streaming
|
|
560
|
-
│ ├── commands/ # card, skill, chat, notes, agents, session, tasks, schedule, auth, config,
|
|
553
|
+
│ ├── commands/ # card, skill, chat, notes, agents, session, tasks, schedule, auth, config, upgrade
|
|
561
554
|
│ └── output/ # JSON + table formatters
|
|
562
555
|
└── skills/ # SKILL.md files for agent integration
|
|
563
556
|
```
|
|
@@ -100,6 +100,9 @@ deepvista card +search "founder mindset"
|
|
|
100
100
|
deepvista chat +send "What did I learn last week?"
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
> **Tip:** `dv` is a short alias for `deepvista` — `dv <args>` and `deepvista <args>`
|
|
104
|
+
> are fully interchangeable (e.g. `dv notes +quick "..."`).
|
|
105
|
+
|
|
103
106
|
That's it. Your knowledge base is now accessible from any terminal.
|
|
104
107
|
|
|
105
108
|
---
|
|
@@ -213,13 +216,12 @@ One skill, `deepvista`, with per-subcommand detail under `skills/deepvista/refer
|
|
|
213
216
|
| `reference/vistabase-card.md` | Knowledge-base cards (`card` / `vistabase`) — create, search, pin, edit, grep |
|
|
214
217
|
| `reference/session.md` | Agent session transcripts — init, tick, finalize |
|
|
215
218
|
| `reference/chat.md` | Chat sessions and NDJSON stream format |
|
|
216
|
-
| `reference/skill.md` | Structured Skill workflows — list, run,
|
|
219
|
+
| `reference/skill.md` | Structured Skill workflows — list, run, phase, complete |
|
|
217
220
|
| `reference/skill-create-from-note.md` | Synthesize a Skill from one or more notes |
|
|
218
221
|
| `reference/skill-analyze-notes.md` | Pattern: search → read → synthesize notes |
|
|
219
222
|
| `reference/skill-research-to-skill.md` | Pattern: research the KB, then run a Skill |
|
|
220
223
|
| `reference/skill-import-files.md` | Bulk-import a folder as file cards |
|
|
221
224
|
| `reference/tasks.md` | Run work dispatched to this machine — `tasks run` / `setup` |
|
|
222
|
-
| `reference/lint.md` | Health-check the vistabase for dupes / contradictions / gaps |
|
|
223
225
|
| `reference/openclaw.md` | Auto-capture rules for OpenClaw agents |
|
|
224
226
|
|
|
225
227
|
The agent loads only the index at first; when a subcommand is needed, it reads the matching reference file on demand.
|
|
@@ -288,11 +290,10 @@ deepvista notes # Hand-written notes (cards with type=note)
|
|
|
288
290
|
Supporting commands:
|
|
289
291
|
|
|
290
292
|
```
|
|
291
|
-
deepvista agents #
|
|
293
|
+
deepvista agents # Agent identity heartbeat (auto-registers on first sync)
|
|
292
294
|
deepvista session # Agent conversation transcripts (init / tick / finalize)
|
|
293
295
|
deepvista tasks # Run work dispatched to this machine (task cards, queued commands)
|
|
294
296
|
deepvista schedule # Manage the recurring daily-planning job (opt-in)
|
|
295
|
-
deepvista lint # Health-check the vistabase with the DeepVista agent
|
|
296
297
|
deepvista auth # Authenticate with DeepVista
|
|
297
298
|
deepvista config # Manage CLI profiles (local, staging, production, …)
|
|
298
299
|
deepvista upgrade # Check for and install CLI + skill updates
|
|
@@ -321,16 +322,14 @@ Card types: `person` · `organization` · `message` · `todo` · `topic` · `key
|
|
|
321
322
|
```bash
|
|
322
323
|
deepvista skill list [--limit N]
|
|
323
324
|
deepvista skill get <skill_id>
|
|
324
|
-
deepvista skill run <skill_id> [--
|
|
325
|
+
deepvista skill run <skill_id> [--input "context"]
|
|
325
326
|
deepvista skill phase open <skill_id> "Phase N: <title>"
|
|
326
327
|
deepvista skill phase done <skill_id> "Phase N: <title>" [--artifact-card-id ID]... [--next-phase "Phase N+1: …"]
|
|
327
328
|
deepvista skill phase pause <skill_id> --reason "<short sentence>"
|
|
328
|
-
deepvista skill phase run-on-deepvista <skill_id> "Phase N: <title>"
|
|
329
329
|
deepvista skill complete <skill_id> --review "<retrospective bullets>"
|
|
330
|
-
deepvista skill status <run_chat_id>
|
|
331
330
|
```
|
|
332
331
|
|
|
333
|
-
`skill run`
|
|
332
|
+
`skill run` prints a JSON header + the workflow's SKILL.md body + a host runtime contract on stdout, and the host agent (Claude Code / OpenClaw / Cursor) drives the run via the `phase` shims and `complete`.
|
|
334
333
|
|
|
335
334
|
### chat — AI agent
|
|
336
335
|
|
|
@@ -384,13 +383,7 @@ deepvista schedule deactivate
|
|
|
384
383
|
deepvista schedule delete <job_id>
|
|
385
384
|
```
|
|
386
385
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
deepvista lint [--limit N] # surface duplicates, contradictions, stale claims, orphans, gaps
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
Run `deepvista <command> --help` for the full options of any group, including `agents`, `auth`, `config`, `upgrade`, and `ui`. Auth, profiles, and agent registration are also covered in `skills/deepvista/reference/shared.md`.
|
|
386
|
+
Run `deepvista <command> --help` for the full options of any group, including `agents`, `auth`, `config`, and `upgrade`. Auth, profiles, and the agent heartbeat are also covered in `skills/deepvista/reference/shared.md`.
|
|
394
387
|
|
|
395
388
|
---
|
|
396
389
|
|
|
@@ -530,7 +523,7 @@ deepvista-cli/
|
|
|
530
523
|
│ ├── config.py # Config + profiles
|
|
531
524
|
│ ├── auth/ # Login, token storage, callback server
|
|
532
525
|
│ ├── client/ # HTTP client, SSE streaming
|
|
533
|
-
│ ├── commands/ # card, skill, chat, notes, agents, session, tasks, schedule, auth, config,
|
|
526
|
+
│ ├── commands/ # card, skill, chat, notes, agents, session, tasks, schedule, auth, config, upgrade
|
|
534
527
|
│ └── output/ # JSON + table formatters
|
|
535
528
|
└── skills/ # SKILL.md files for agent integration
|
|
536
529
|
```
|
|
@@ -13,6 +13,7 @@ from __future__ import annotations
|
|
|
13
13
|
import json
|
|
14
14
|
import logging
|
|
15
15
|
import sys
|
|
16
|
+
import threading
|
|
16
17
|
from collections.abc import Iterator
|
|
17
18
|
from typing import Any, NoReturn
|
|
18
19
|
|
|
@@ -32,6 +33,7 @@ class DeepVistaClient:
|
|
|
32
33
|
def __init__(self, config: CLIConfig) -> None:
|
|
33
34
|
self.config = config
|
|
34
35
|
self._client: httpx.Client | None = None
|
|
36
|
+
self._lock = threading.Lock()
|
|
35
37
|
|
|
36
38
|
def _get_client(self) -> httpx.Client:
|
|
37
39
|
if self._client is None:
|
|
@@ -140,25 +142,26 @@ class DeepVistaClient:
|
|
|
140
142
|
)
|
|
141
143
|
sys.exit(0)
|
|
142
144
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
145
|
+
with self._lock:
|
|
146
|
+
try:
|
|
147
|
+
client = self._get_client()
|
|
148
|
+
if method == "GET":
|
|
149
|
+
resp = client.get(path, headers=headers, params=params)
|
|
150
|
+
elif method == "POST":
|
|
151
|
+
resp = client.post(path, headers=headers, json=body or {})
|
|
152
|
+
elif method == "PATCH":
|
|
153
|
+
resp = client.patch(path, headers=headers, json=body or {})
|
|
154
|
+
elif method == "DELETE":
|
|
155
|
+
resp = client.delete(path, headers=headers, params=params)
|
|
156
|
+
else:
|
|
157
|
+
raise ValueError(f"Unsupported method: {method}")
|
|
158
|
+
except (httpx.ConnectError, httpx.TimeoutException) as exc:
|
|
159
|
+
self._handle_network_error(exc)
|
|
160
|
+
|
|
161
|
+
self._log_response(resp)
|
|
162
|
+
if resp.status_code >= 400:
|
|
163
|
+
self._handle_error(resp)
|
|
164
|
+
return resp.json()
|
|
162
165
|
|
|
163
166
|
def get(self, path: str, params: dict | None = None, extra_headers: dict[str, str] | None = None) -> Any:
|
|
164
167
|
"""HTTP GET, returns parsed JSON."""
|
|
@@ -184,19 +187,20 @@ class DeepVistaClient:
|
|
|
184
187
|
err=True,
|
|
185
188
|
)
|
|
186
189
|
sys.exit(0)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
data
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
190
|
+
with self._lock:
|
|
191
|
+
try:
|
|
192
|
+
client = self._get_client()
|
|
193
|
+
resp = client.post(path, headers=headers, json=body or {})
|
|
194
|
+
except (httpx.ConnectError, httpx.TimeoutException) as exc:
|
|
195
|
+
self._handle_network_error(exc)
|
|
196
|
+
self._log_response(resp)
|
|
197
|
+
try:
|
|
198
|
+
data = resp.json()
|
|
199
|
+
if isinstance(data, dict):
|
|
200
|
+
data["_status_code"] = resp.status_code
|
|
201
|
+
return data
|
|
202
|
+
except Exception:
|
|
203
|
+
return {"error": resp.text, "status_code": resp.status_code, "_status_code": resp.status_code}
|
|
200
204
|
|
|
201
205
|
def patch(self, path: str, body: dict | None = None) -> Any:
|
|
202
206
|
"""HTTP PATCH, returns parsed JSON."""
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"""deepvista agents — the agent identity heartbeat.
|
|
2
|
+
|
|
3
|
+
Each agent tool (Claude Code, OpenClaw, Cursor, etc.) gets a persistent
|
|
4
|
+
identity with config stored in DeepVista. ``agents sync`` is the single
|
|
5
|
+
command: it auto-registers on first run, then heartbeats config/state.
|
|
6
|
+
|
|
7
|
+
Agent IDs are stored locally at ~/.config/deepvista/agents/<agent_type>.json
|
|
8
|
+
(or ``<agent_type>__<project_id>.json`` per project) so the CLI knows which
|
|
9
|
+
agent it's running inside. The storage helpers here are shared with
|
|
10
|
+
``tasks``, ``session``, ``notes`` and origin detection.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import json as _json
|
|
16
|
+
import os
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
import click
|
|
20
|
+
|
|
21
|
+
from deepvista_cli.client.http import DeepVistaClient
|
|
22
|
+
from deepvista_cli.client.origin import build_origin, detect_agent_tool
|
|
23
|
+
from deepvista_cli.config import CONFIG_DIR
|
|
24
|
+
from deepvista_cli.output.formatter import format_output, output_error
|
|
25
|
+
|
|
26
|
+
AGENTS_DIR = CONFIG_DIR / "agents"
|
|
27
|
+
|
|
28
|
+
ERROR_CODE_AGENT_NOT_FOUND = "AGENT_NOT_FOUND"
|
|
29
|
+
ERROR_CODE_AGENT_ALREADY_REGISTERED = "AGENT_ALREADY_REGISTERED"
|
|
30
|
+
|
|
31
|
+
_AGENT_TYPE_LABELS = {
|
|
32
|
+
"claude-code": "Claude Code",
|
|
33
|
+
"opencode": "OpenCode",
|
|
34
|
+
"openclaw": "OpenClaw",
|
|
35
|
+
"cursor": "Cursor",
|
|
36
|
+
"windsurf": "Windsurf",
|
|
37
|
+
"cline": "Cline",
|
|
38
|
+
"aider": "Aider",
|
|
39
|
+
"github-copilot": "GitHub Copilot",
|
|
40
|
+
"deepvista-cli": "DeepVista CLI",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _agent_id_path(agent_type: str, project_id: str | None = None) -> Path:
|
|
45
|
+
if project_id:
|
|
46
|
+
return AGENTS_DIR / f"{agent_type}__{project_id}.json"
|
|
47
|
+
return AGENTS_DIR / f"{agent_type}.json"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _save_agent_id(
|
|
51
|
+
agent_type: str,
|
|
52
|
+
agent_id: str,
|
|
53
|
+
project_id: str | None = None,
|
|
54
|
+
project_name: str | None = None,
|
|
55
|
+
) -> None:
|
|
56
|
+
AGENTS_DIR.mkdir(parents=True, exist_ok=True)
|
|
57
|
+
path = _agent_id_path(agent_type, project_id)
|
|
58
|
+
data: dict = {"agent_id": agent_id, "agent_type": agent_type}
|
|
59
|
+
if project_id:
|
|
60
|
+
data["project_id"] = project_id
|
|
61
|
+
if project_name:
|
|
62
|
+
data["project_name"] = project_name
|
|
63
|
+
path.write_text(_json.dumps(data))
|
|
64
|
+
os.chmod(path, 0o600)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _read_agent_id_file(path: Path) -> dict | None:
|
|
68
|
+
try:
|
|
69
|
+
return _json.loads(path.read_text())
|
|
70
|
+
except (_json.JSONDecodeError, OSError, KeyError):
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _load_agent_id(agent_type: str, project_id: str | None = None) -> str | None:
|
|
75
|
+
path = _agent_id_path(agent_type, project_id)
|
|
76
|
+
if not path.exists():
|
|
77
|
+
return None
|
|
78
|
+
if data := _read_agent_id_file(path):
|
|
79
|
+
if aid := data.get("agent_id"):
|
|
80
|
+
return aid
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def load_agent_id_for_active_agent() -> str | None:
|
|
85
|
+
"""Return the active agent UUID from the local cache, or None."""
|
|
86
|
+
try:
|
|
87
|
+
agent_type, _ = detect_agent_tool()
|
|
88
|
+
except Exception:
|
|
89
|
+
return None
|
|
90
|
+
if not agent_type:
|
|
91
|
+
return None
|
|
92
|
+
return _load_agent_id(agent_type)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _remove_agent_id(agent_type: str, project_id: str | None = None) -> None:
|
|
96
|
+
_agent_id_path(agent_type, project_id).unlink(missing_ok=True)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _machine_fingerprint() -> str:
|
|
100
|
+
import hashlib
|
|
101
|
+
import platform
|
|
102
|
+
import uuid
|
|
103
|
+
|
|
104
|
+
raw = f"{platform.node()}:{uuid.getnode()}:{platform.system()}"
|
|
105
|
+
return hashlib.sha256(raw.encode()).hexdigest()[:16]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _build_config_snapshot(_agent_type: str) -> dict:
|
|
109
|
+
"""Minimal config: origin metadata + working directory."""
|
|
110
|
+
origin = build_origin()
|
|
111
|
+
config: dict = {
|
|
112
|
+
"machine_fingerprint": _machine_fingerprint(),
|
|
113
|
+
"working_directory": str(Path.cwd()),
|
|
114
|
+
}
|
|
115
|
+
for key in ("machine", "model", "tool_version"):
|
|
116
|
+
if val := origin.get(key):
|
|
117
|
+
config[key] = val
|
|
118
|
+
return config
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _default_agent_name(agent_type: str) -> str:
|
|
122
|
+
import platform
|
|
123
|
+
|
|
124
|
+
label = _AGENT_TYPE_LABELS.get(agent_type, agent_type)
|
|
125
|
+
hostname = platform.node() or "unknown-host"
|
|
126
|
+
return f"{label} — {hostname}"
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _find_local_registration_for_project(
|
|
130
|
+
project_id: str,
|
|
131
|
+
agent_type: str | None = None,
|
|
132
|
+
) -> tuple[str, str] | None:
|
|
133
|
+
"""Return ``(agent_id, agent_type)`` from the local cache for ``project_id``."""
|
|
134
|
+
if agent_type:
|
|
135
|
+
if cached := _load_agent_id(agent_type, project_id):
|
|
136
|
+
return cached, agent_type
|
|
137
|
+
if not AGENTS_DIR.exists():
|
|
138
|
+
return None
|
|
139
|
+
candidates: list[tuple[float, Path]] = []
|
|
140
|
+
for path in AGENTS_DIR.glob("*.json"):
|
|
141
|
+
try:
|
|
142
|
+
candidates.append((path.stat().st_mtime, path))
|
|
143
|
+
except OSError:
|
|
144
|
+
continue
|
|
145
|
+
for _, path in sorted(candidates, reverse=True):
|
|
146
|
+
data = _read_agent_id_file(path)
|
|
147
|
+
if not data or data.get("project_id") != project_id:
|
|
148
|
+
continue
|
|
149
|
+
aid = data.get("agent_id")
|
|
150
|
+
if not aid:
|
|
151
|
+
continue
|
|
152
|
+
atype = str(data.get("agent_type") or agent_type or "deepvista-cli")
|
|
153
|
+
return str(aid), atype
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _project_headers(project_id: str) -> dict[str, str]:
|
|
158
|
+
return {"X-Project-Id": project_id}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _resolve_agent_type(agent_type: str | None = None) -> str:
|
|
162
|
+
if agent_type:
|
|
163
|
+
return agent_type
|
|
164
|
+
try:
|
|
165
|
+
detected, _ = detect_agent_tool()
|
|
166
|
+
except Exception:
|
|
167
|
+
detected = None
|
|
168
|
+
return detected or "deepvista-cli"
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def _agent_exists_on_server(ctx: click.Context, agent_id: str, project_id: str) -> bool:
|
|
172
|
+
"""Return True when ``agent_id`` is a managed agent for this user in ``project_id``."""
|
|
173
|
+
data = _client(ctx).get(f"/agents/{agent_id}", extra_headers=_project_headers(project_id))
|
|
174
|
+
return bool(data.get("agent"))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _sync_machine_online(
|
|
178
|
+
ctx: click.Context,
|
|
179
|
+
agent_id: str,
|
|
180
|
+
project_id: str,
|
|
181
|
+
config: dict,
|
|
182
|
+
) -> None:
|
|
183
|
+
_client(ctx).post(
|
|
184
|
+
f"/agents/{agent_id}/sync",
|
|
185
|
+
{"status": "online", "sync_type": "manual", "config_patch": config},
|
|
186
|
+
extra_headers=_project_headers(project_id),
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def _register_agent_via_api(
|
|
191
|
+
ctx: click.Context,
|
|
192
|
+
name: str,
|
|
193
|
+
agent_type: str,
|
|
194
|
+
config: dict,
|
|
195
|
+
*,
|
|
196
|
+
project_id: str | None = None,
|
|
197
|
+
project_name: str | None = None,
|
|
198
|
+
agent_role: str = "misc",
|
|
199
|
+
) -> tuple[str | None, str | None]:
|
|
200
|
+
body: dict = {
|
|
201
|
+
"name": name,
|
|
202
|
+
"agent_type": agent_type,
|
|
203
|
+
"agent_role": agent_role,
|
|
204
|
+
"config": config,
|
|
205
|
+
}
|
|
206
|
+
extra_headers = _project_headers(project_id) if project_id else None
|
|
207
|
+
data = _client(ctx).post("/agents", body, extra_headers=extra_headers)
|
|
208
|
+
agent = data.get("agent")
|
|
209
|
+
save_project_id = project_id or (agent.get("project_id") if agent else None)
|
|
210
|
+
if agent and agent.get("id"):
|
|
211
|
+
_save_agent_id(agent_type, agent["id"], save_project_id, project_name)
|
|
212
|
+
return agent["id"], None
|
|
213
|
+
if data.get("error_code") == ERROR_CODE_AGENT_ALREADY_REGISTERED and agent and agent.get("id"):
|
|
214
|
+
_save_agent_id(agent_type, agent["id"], save_project_id, project_name)
|
|
215
|
+
return agent["id"], None
|
|
216
|
+
return None, data.get("error", "Registration failed")
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def resolve_or_register_machine(
|
|
220
|
+
ctx: click.Context,
|
|
221
|
+
project_id: str,
|
|
222
|
+
*,
|
|
223
|
+
agent_type: str | None = None,
|
|
224
|
+
agent_role: str = "misc",
|
|
225
|
+
project_name: str | None = None,
|
|
226
|
+
quiet: bool = False,
|
|
227
|
+
) -> str | None:
|
|
228
|
+
"""Resolve this machine's managed agent for ``project_id``, registering when needed.
|
|
229
|
+
|
|
230
|
+
Trust-but-verify flow:
|
|
231
|
+
1. Use the local cache when the server still knows that agent id.
|
|
232
|
+
2. Otherwise register (or adopt an existing server row via
|
|
233
|
+
``AGENT_ALREADY_REGISTERED``), save locally, and mark online.
|
|
234
|
+
"""
|
|
235
|
+
resolved_type = _resolve_agent_type(agent_type)
|
|
236
|
+
config = _build_config_snapshot(resolved_type)
|
|
237
|
+
|
|
238
|
+
local = _find_local_registration_for_project(project_id, resolved_type)
|
|
239
|
+
cached_id = local[0] if local else None
|
|
240
|
+
cached_type = local[1] if local else resolved_type
|
|
241
|
+
if cached_id and _agent_exists_on_server(ctx, cached_id, project_id):
|
|
242
|
+
_sync_machine_online(ctx, cached_id, project_id, config)
|
|
243
|
+
return cached_id
|
|
244
|
+
if cached_id:
|
|
245
|
+
_remove_agent_id(cached_type, project_id)
|
|
246
|
+
|
|
247
|
+
agent_id, error = _register_agent_via_api(
|
|
248
|
+
ctx,
|
|
249
|
+
_default_agent_name(resolved_type),
|
|
250
|
+
resolved_type,
|
|
251
|
+
config,
|
|
252
|
+
project_id=project_id,
|
|
253
|
+
project_name=project_name,
|
|
254
|
+
agent_role=agent_role,
|
|
255
|
+
)
|
|
256
|
+
if not agent_id:
|
|
257
|
+
if not quiet:
|
|
258
|
+
click.echo(
|
|
259
|
+
f" [warn] could not register agent for project {project_id}: {error or 'unknown'}",
|
|
260
|
+
err=True,
|
|
261
|
+
)
|
|
262
|
+
return None
|
|
263
|
+
|
|
264
|
+
_sync_machine_online(ctx, agent_id, project_id, config)
|
|
265
|
+
if not quiet:
|
|
266
|
+
click.echo(f" registered agent {agent_id} for project {project_id}", err=True)
|
|
267
|
+
return agent_id
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def _ensure_agent_registered(ctx: click.Context, agent_type: str) -> str:
|
|
271
|
+
if existing := _load_agent_id(agent_type):
|
|
272
|
+
return existing
|
|
273
|
+
config = _build_config_snapshot(agent_type)
|
|
274
|
+
agent_id, error = _register_agent_via_api(ctx, _default_agent_name(agent_type), agent_type, config)
|
|
275
|
+
if not agent_id:
|
|
276
|
+
output_error(1, "Auto-registration failed", error or "Unknown error")
|
|
277
|
+
raise SystemExit(1)
|
|
278
|
+
return agent_id
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def _client(ctx: click.Context) -> DeepVistaClient:
|
|
282
|
+
return ctx.obj._client
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def _output(ctx: click.Context, data: object, **kwargs: object) -> None:
|
|
286
|
+
format_output(
|
|
287
|
+
data,
|
|
288
|
+
ctx.obj.output_format,
|
|
289
|
+
entity_type="agent",
|
|
290
|
+
base_url=ctx.obj.auth_url,
|
|
291
|
+
project_id=ctx.obj.project_id,
|
|
292
|
+
**kwargs, # type: ignore[arg-type]
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
@click.group("agents")
|
|
297
|
+
def agents_group() -> None:
|
|
298
|
+
"""Agent identity heartbeat for DeepVista."""
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
@agents_group.command("sync")
|
|
302
|
+
@click.argument("agent_id", required=False, default=None)
|
|
303
|
+
@click.option("--type", "agent_type", default=None, help="Resolve agent by type from local storage.")
|
|
304
|
+
@click.option("--status", default=None, type=click.Choice(["online", "offline", "error"]))
|
|
305
|
+
@click.option("--memory", default=None, help="Memory JSON to merge into config.")
|
|
306
|
+
@click.option("--dry-run", is_flag=True, default=False, help="Preview without making changes.")
|
|
307
|
+
@click.pass_context
|
|
308
|
+
def agents_sync(
|
|
309
|
+
ctx: click.Context,
|
|
310
|
+
agent_id: str | None,
|
|
311
|
+
agent_type: str | None,
|
|
312
|
+
status: str | None,
|
|
313
|
+
memory: str | None,
|
|
314
|
+
dry_run: bool,
|
|
315
|
+
) -> None:
|
|
316
|
+
"""Heartbeat + push state to DeepVista. Auto-registers on first run.
|
|
317
|
+
|
|
318
|
+
> [!CAUTION] This is a write command — confirm with the user before executing.
|
|
319
|
+
"""
|
|
320
|
+
resolved_type = agent_type
|
|
321
|
+
if not resolved_type:
|
|
322
|
+
try:
|
|
323
|
+
resolved_type, _ = detect_agent_tool()
|
|
324
|
+
except Exception:
|
|
325
|
+
resolved_type = None
|
|
326
|
+
|
|
327
|
+
if agent_id:
|
|
328
|
+
resolved_id = agent_id
|
|
329
|
+
elif resolved_type:
|
|
330
|
+
resolved_id = _ensure_agent_registered(ctx, resolved_type)
|
|
331
|
+
else:
|
|
332
|
+
output_error(3, "Cannot resolve agent ID", "Provide --agent-id or --type, or run inside a registered agent.")
|
|
333
|
+
raise SystemExit(3)
|
|
334
|
+
|
|
335
|
+
body: dict = {"sync_type": "manual"}
|
|
336
|
+
if status:
|
|
337
|
+
body["status"] = status
|
|
338
|
+
|
|
339
|
+
config_patch = _build_config_snapshot(resolved_type or "")
|
|
340
|
+
if memory:
|
|
341
|
+
try:
|
|
342
|
+
config_patch["memory"] = _json.loads(memory)
|
|
343
|
+
except _json.JSONDecodeError:
|
|
344
|
+
output_error(3, "Invalid --memory JSON", f"Got: {memory}")
|
|
345
|
+
return
|
|
346
|
+
if config_patch:
|
|
347
|
+
body["config_patch"] = config_patch
|
|
348
|
+
|
|
349
|
+
if dry_run:
|
|
350
|
+
_output(
|
|
351
|
+
ctx,
|
|
352
|
+
{"dry_run": True, "would": "sync agent state", "agent_id": resolved_id, "payload": body},
|
|
353
|
+
title="Dry Run: Sync Agent",
|
|
354
|
+
)
|
|
355
|
+
return
|
|
356
|
+
|
|
357
|
+
data = _client(ctx).post(f"/agents/{resolved_id}/sync", body)
|
|
358
|
+
if not data.get("success") and data.get("error_code") == ERROR_CODE_AGENT_NOT_FOUND and resolved_type:
|
|
359
|
+
_remove_agent_id(resolved_type)
|
|
360
|
+
resolved_id = _ensure_agent_registered(ctx, resolved_type)
|
|
361
|
+
data = _client(ctx).post(f"/agents/{resolved_id}/sync", body)
|
|
362
|
+
|
|
363
|
+
if not data.get("success"):
|
|
364
|
+
output_error(1, "Sync failed", data.get("error", ""))
|
|
365
|
+
return
|
|
366
|
+
_output(ctx, data["agent"], title="Synced Agent")
|