deepvista-cli 4.0.0__tar.gz → 4.2.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-4.2.0/.release-please-manifest.json +3 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/CHANGELOG.md +20 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/PKG-INFO +4 -2
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/README.md +3 -1
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/client/http.py +20 -0
- deepvista_cli-4.2.0/deepvista_cli/commands/__init__.py +94 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/agents.py +34 -8
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/auth.py +25 -27
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/card.py +82 -1
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/project.py +45 -23
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/tasks.py +47 -35
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/main.py +1 -1
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/install.sh +5 -11
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/pyproject.toml +1 -1
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/vistabase-card.md +5 -1
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_agent_id_tagging.py +53 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/uv.lock +1 -1
- deepvista_cli-4.0.0/.release-please-manifest.json +0 -3
- deepvista_cli-4.0.0/deepvista_cli/commands/__init__.py +0 -55
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/.claude-plugin/marketplace.json +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/.github/workflows/ci.yml +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/.github/workflows/publish.yml +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/.github/workflows/release-please.yml +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/.gitignore +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/.pre-commit-config.yaml +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/CLAUDE.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/CONTRIBUTING.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/LICENSE +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/__init__.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/auth/__init__.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/auth/callback_server.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/auth/login.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/auth/tokens.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/client/__init__.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/client/origin.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/chat.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/config.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/notes.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/schedule.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/session.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/skill.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/commands/upgrade.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/config.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/output/__init__.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/output/formatter.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/resources/__init__.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/resources/workflow_host_runtime.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/session_note.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/skill_catalog.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/utils.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/workflow_doc.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/docs/assets/deepvista-banner.png +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/install.ps1 +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/README.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/README.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/commands/deepvista.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/commands/refresh-skills.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/hooks/hooks.json +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-agent-sync.sh +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-session-end.sh +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-session-start.sh +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-session-turn.sh +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-skill-url.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-sync.sh +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/skills/.gitignore +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/skills/install-deepvista-cli/SKILL.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/release-please-config.json +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/scripts/check_plugin_version.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/SKILL.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/chat.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/notes.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/openclaw.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/project.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/session.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/shared.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-analyze-notes.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-create-from-note.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-import-files.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-research-to-skill.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/tasks.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/dv-workflow/SKILL.md +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/__init__.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_card_comment_commands.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_entry_points.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_http_client_retry.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_project_commands.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_schedule_commands.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_session_note_format.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_skill_catalog.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_skill_commands.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_tasks_commands.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/tests/test_workflow_doc_phases.py +0 -0
- {deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/uninstall.sh +0 -0
|
@@ -46,6 +46,26 @@ users what's new between the version they have installed and the latest release.
|
|
|
46
46
|
adopts a pre-existing server-side row instead of failing when the local
|
|
47
47
|
file is missing.
|
|
48
48
|
|
|
49
|
+
## [4.2.0](https://github.com/DeepVista-AI/deepvista-cli/compare/v4.1.0...v4.2.0) (2026-07-20)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* **DV-1563,DV-1564,DV-1646,DV-1650:** CLI — per-project daemon lock, slug support, welcome copy, card upload ([#212](https://github.com/DeepVista-AI/deepvista-cli/issues/212)) ([231d4ad](https://github.com/DeepVista-AI/deepvista-cli/commit/231d4ad724ffee18760bb59b7bf5203d63e5faef))
|
|
55
|
+
|
|
56
|
+
## [4.1.0](https://github.com/DeepVista-AI/deepvista-cli/compare/v4.0.0...v4.1.0) (2026-07-16)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Features
|
|
60
|
+
|
|
61
|
+
* **DV-1493:** promote `tasks run` in post-login welcome message ([#208](https://github.com/DeepVista-AI/deepvista-cli/issues/208)) ([282e684](https://github.com/DeepVista-AI/deepvista-cli/commit/282e684631d0e4d8017797d2bff90607bd8fd2a1))
|
|
62
|
+
* **DV-1573:** sync card types with backend; add artifact, drop deprecated skill_run ([#211](https://github.com/DeepVista-AI/deepvista-cli/issues/211)) ([2c89c7a](https://github.com/DeepVista-AI/deepvista-cli/commit/2c89c7a9cb8d4bc7bbee789bf9c4751c1f467b08))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Bug Fixes
|
|
66
|
+
|
|
67
|
+
* **DV-1570:** persist a stable machine id instead of a volatile fingerprint ([#209](https://github.com/DeepVista-AI/deepvista-cli/issues/209)) ([68dbbc6](https://github.com/DeepVista-AI/deepvista-cli/commit/68dbbc63f36b0dd61b7452a468b2e23c0eff9a29))
|
|
68
|
+
|
|
49
69
|
## [4.0.0](https://github.com/DeepVista-AI/deepvista-cli/compare/v3.2.0...v4.0.0) (2026-07-14)
|
|
50
70
|
|
|
51
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepvista-cli
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.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
|
|
@@ -340,7 +340,9 @@ deepvista card +pin <card_id>
|
|
|
340
340
|
deepvista card +archive <card_id>
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
Card types: `person` · `organization` · `message` · `todo` · `topic` · `keypoint` · `file` · `note` · `skill` · `
|
|
343
|
+
Card types: `person` · `organization` · `message` · `email` · `todo` · `topic` · `keypoint` · `file` · `note` · `session` · `skill` · `run_log` · `schedule_job` · `task` · `conversation_starter` · `artifact`
|
|
344
|
+
|
|
345
|
+
> `note` is reserved for human-authored notes; `artifact` is the agent's fallback for its own output when no structured type fits (DV-1573).
|
|
344
346
|
|
|
345
347
|
> `deepvista vistabase` is a backward-compatible alias for `deepvista card` — every `card` subcommand works under `vistabase` too.
|
|
346
348
|
|
|
@@ -313,7 +313,9 @@ deepvista card +pin <card_id>
|
|
|
313
313
|
deepvista card +archive <card_id>
|
|
314
314
|
```
|
|
315
315
|
|
|
316
|
-
Card types: `person` · `organization` · `message` · `todo` · `topic` · `keypoint` · `file` · `note` · `skill` · `
|
|
316
|
+
Card types: `person` · `organization` · `message` · `email` · `todo` · `topic` · `keypoint` · `file` · `note` · `session` · `skill` · `run_log` · `schedule_job` · `task` · `conversation_starter` · `artifact`
|
|
317
|
+
|
|
318
|
+
> `note` is reserved for human-authored notes; `artifact` is the agent's fallback for its own output when no structured type fits (DV-1573).
|
|
317
319
|
|
|
318
320
|
> `deepvista vistabase` is a backward-compatible alias for `deepvista card` — every `card` subcommand works under `vistabase` too.
|
|
319
321
|
|
|
@@ -240,6 +240,26 @@ class DeepVistaClient:
|
|
|
240
240
|
except Exception:
|
|
241
241
|
return {"error": resp.text, "status_code": resp.status_code, "_status_code": resp.status_code}
|
|
242
242
|
|
|
243
|
+
def put_bytes(self, url: str, data: bytes, headers: dict[str, str]) -> None:
|
|
244
|
+
"""PUT raw bytes to an absolute (pre-signed) URL — GCS uploads (DV-1650).
|
|
245
|
+
|
|
246
|
+
Bypasses the API base URL and auth headers: the signature embedded in
|
|
247
|
+
the URL is the auth, and the storage service requires exactly the
|
|
248
|
+
headers returned alongside it. Errors exit like any API call.
|
|
249
|
+
"""
|
|
250
|
+
if self.config.verbose:
|
|
251
|
+
click.echo(f">>> PUT {url} ({len(data)} bytes)", err=True)
|
|
252
|
+
if self.config.dry_run:
|
|
253
|
+
click.echo(json.dumps({"dry_run": True, "method": "PUT", "url": url, "bytes": len(data)}), err=True)
|
|
254
|
+
sys.exit(0)
|
|
255
|
+
try:
|
|
256
|
+
resp = self._call_with_retry(lambda: httpx.put(url, content=data, headers=headers, timeout=120))
|
|
257
|
+
except (httpx.ConnectError, httpx.TimeoutException) as exc:
|
|
258
|
+
self._handle_network_error(exc)
|
|
259
|
+
self._log_response(resp)
|
|
260
|
+
if resp.status_code >= 400:
|
|
261
|
+
self._handle_error(resp)
|
|
262
|
+
|
|
243
263
|
def patch(self, path: str, body: dict | None = None) -> Any:
|
|
244
264
|
"""HTTP PATCH, returns parsed JSON."""
|
|
245
265
|
return self._request("PATCH", path, body=body)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""CLI command groups — auth, vistabase, skill, notes, chat."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
import sys
|
|
7
|
+
from collections.abc import Callable
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
|
|
11
|
+
from deepvista_cli.output.formatter import output_error
|
|
12
|
+
|
|
13
|
+
_UUID_RE = re.compile(r"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def looks_like_uuid(value: str) -> bool:
|
|
17
|
+
return bool(_UUID_RE.fullmatch(value))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def resolve_project_ref(ctx: click.Context, ref: str) -> str:
|
|
21
|
+
"""Resolve a project reference — UUID or slug (DV-1564) — to the canonical UUID.
|
|
22
|
+
|
|
23
|
+
UUIDs pass through without a lookup. Anything else is treated as a slug
|
|
24
|
+
and matched against ``GET /projects``; exits with a validation error when
|
|
25
|
+
no accessible project carries it. Canonicalizing to the UUID keeps every
|
|
26
|
+
project-keyed artifact (persisted profile config, machine cache files,
|
|
27
|
+
run locks) stable regardless of how the user spelled the project.
|
|
28
|
+
"""
|
|
29
|
+
if looks_like_uuid(ref):
|
|
30
|
+
return ref
|
|
31
|
+
raw = ctx.obj._client.get("/projects")
|
|
32
|
+
projects = raw if isinstance(raw, list) else raw.get("projects", []) if isinstance(raw, dict) else []
|
|
33
|
+
for project in projects:
|
|
34
|
+
if project.get("slug") == ref or project.get("id") == ref:
|
|
35
|
+
return str(project["id"])
|
|
36
|
+
output_error(
|
|
37
|
+
3,
|
|
38
|
+
f"Project '{ref}' not found or not accessible",
|
|
39
|
+
"Run `deepvista project list` to see available projects (id and slug).",
|
|
40
|
+
)
|
|
41
|
+
raise SystemExit(3)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def project_option[F: Callable](func: F) -> F:
|
|
45
|
+
"""Add a per-command ``--project <id|slug>`` override.
|
|
46
|
+
|
|
47
|
+
Use together with :func:`apply_project_override` at the top of the command
|
|
48
|
+
body. The override takes precedence over the persisted working project /
|
|
49
|
+
global ``--project`` flag for this single invocation only.
|
|
50
|
+
"""
|
|
51
|
+
return click.option(
|
|
52
|
+
"--project",
|
|
53
|
+
"project_override",
|
|
54
|
+
default=None,
|
|
55
|
+
help="Scope this command to a project id or slug (overrides the working project for this call only).",
|
|
56
|
+
)(func)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def apply_project_override(ctx: click.Context, project_override: str | None) -> None:
|
|
60
|
+
"""Apply a per-command ``--project`` value to the resolved config.
|
|
61
|
+
|
|
62
|
+
Mutating ``ctx.obj.project_id`` is sufficient because the HTTP client holds
|
|
63
|
+
the *same* ``CLIConfig`` object and reads ``project_id`` lazily when it
|
|
64
|
+
builds request headers, so the override flows through to ``X-Project-Id``
|
|
65
|
+
and to emitted web links without touching every callsite. Slugs pass
|
|
66
|
+
through as-is — the backend resolves slug-or-UUID in the header (DV-1564).
|
|
67
|
+
"""
|
|
68
|
+
if project_override:
|
|
69
|
+
ctx.obj.project_id = project_override
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def resolve_content(content: str | None, content_file: str | None) -> str | None:
|
|
73
|
+
"""Resolve content from ``--content`` or ``--content-file``.
|
|
74
|
+
|
|
75
|
+
``--content-file`` takes precedence when provided. Use ``-`` to read from
|
|
76
|
+
stdin. Returns the resolved content string, or *None* if neither option was
|
|
77
|
+
supplied.
|
|
78
|
+
"""
|
|
79
|
+
if content_file is not None:
|
|
80
|
+
if content_file == "-":
|
|
81
|
+
return sys.stdin.read()
|
|
82
|
+
try:
|
|
83
|
+
with open(content_file, encoding="utf-8") as fh:
|
|
84
|
+
return fh.read()
|
|
85
|
+
except UnicodeDecodeError:
|
|
86
|
+
output_error(
|
|
87
|
+
3,
|
|
88
|
+
"Content file is not UTF-8 text",
|
|
89
|
+
f"{content_file} looks binary — use `deepvista card upload {content_file}` "
|
|
90
|
+
"to attach it as a file card instead (DV-1650).",
|
|
91
|
+
)
|
|
92
|
+
except OSError as exc:
|
|
93
|
+
output_error(4, "Cannot read content file", str(exc))
|
|
94
|
+
return content
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"""deepvista agents — Machine identity heartbeat.
|
|
2
2
|
|
|
3
|
-
A Machine is this device (fingerprint =
|
|
4
|
-
a project**. Server
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
A Machine is this device (fingerprint = a UUID persisted once to
|
|
4
|
+
``~/.config/deepvista/machine_id``) **registered to a project**. Server
|
|
5
|
+
uniqueness is ``(project_id, machine_fingerprint)``. A Machine is visible to
|
|
6
|
+
every project member — polling/claiming/syncing works for any of them, not
|
|
7
|
+
just whoever registered it (DV-1570). ``agent_type`` is soft metadata
|
|
8
|
+
(last-seen tool). ``agent_role`` is unused.
|
|
7
9
|
|
|
8
10
|
Local cache: ``~/.config/deepvista/machines/<fingerprint>__<project_id>.json``.
|
|
9
11
|
Legacy ``agents/<type>__<project>.json`` files are migrated on read.
|
|
@@ -45,13 +47,37 @@ _AGENT_TYPE_LABELS = {
|
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
|
|
50
|
+
MACHINE_ID_PATH = CONFIG_DIR / "machine_id"
|
|
51
|
+
|
|
52
|
+
|
|
48
53
|
def _machine_fingerprint() -> str:
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
"""Return this Machine's stable identity, generating + persisting it on first use.
|
|
55
|
+
|
|
56
|
+
Previously derived from ``hostname + uuid.getnode() + OS``. ``uuid.getnode()``
|
|
57
|
+
falls back to a random value whenever it can't read a real hardware MAC —
|
|
58
|
+
common on containers, VMs, and ephemeral cloud sandboxes — and that
|
|
59
|
+
fallback is re-randomized on every process start rather than cached. A
|
|
60
|
+
hostname change across ephemeral container restarts compounded this. The
|
|
61
|
+
result: every restart on such a host looked like a brand-new Machine,
|
|
62
|
+
each registering a fresh, undeduped row server-side (DV-1570).
|
|
63
|
+
|
|
64
|
+
A UUID generated once and persisted to disk survives restarts regardless
|
|
65
|
+
of MAC/hostname availability.
|
|
66
|
+
"""
|
|
67
|
+
try:
|
|
68
|
+
existing = MACHINE_ID_PATH.read_text().strip()
|
|
69
|
+
except OSError:
|
|
70
|
+
existing = ""
|
|
71
|
+
if existing:
|
|
72
|
+
return existing
|
|
73
|
+
|
|
51
74
|
import uuid
|
|
52
75
|
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
new_id = uuid.uuid4().hex
|
|
77
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
78
|
+
MACHINE_ID_PATH.write_text(new_id)
|
|
79
|
+
os.chmod(MACHINE_ID_PATH, 0o600)
|
|
80
|
+
return new_id
|
|
55
81
|
|
|
56
82
|
|
|
57
83
|
def _machine_path(project_id: str, fingerprint: str | None = None) -> Path:
|
|
@@ -14,7 +14,6 @@ from deepvista_cli.auth.tokens import (
|
|
|
14
14
|
remove_account,
|
|
15
15
|
switch_active_account,
|
|
16
16
|
)
|
|
17
|
-
from deepvista_cli.client.origin import detect_agent_tool
|
|
18
17
|
from deepvista_cli.config import credentials_path
|
|
19
18
|
from deepvista_cli.output.formatter import format_output, output_error
|
|
20
19
|
|
|
@@ -24,34 +23,29 @@ def auth_group() -> None:
|
|
|
24
23
|
"""Authenticate with DeepVista."""
|
|
25
24
|
|
|
26
25
|
|
|
27
|
-
def _print_next_steps() -> None:
|
|
28
|
-
"""Print
|
|
26
|
+
def _print_next_steps(project_id: str | None = None) -> None:
|
|
27
|
+
"""Print the post-login welcome on stderr (DV-1493, DV-1646).
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
Short command + description pairs keep the copy scannable; the
|
|
30
|
+
machine-readable login JSON on stdout is untouched.
|
|
32
31
|
"""
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"/refresh-skills — sync the DeepVista skill catalog",
|
|
37
|
-
'say "Help me get started with DeepVista."',
|
|
38
|
-
'deepvista notes +quick "<fact>" — capture your first note',
|
|
39
|
-
]
|
|
40
|
-
elif tool == "deepvista-cli": # direct terminal usage
|
|
41
|
-
steps = [
|
|
42
|
-
'deepvista notes +quick "My first note" — capture a note',
|
|
43
|
-
"deepvista skill list — browse your workflow skills",
|
|
44
|
-
"deepvista chat — talk to your DeepVista agent",
|
|
45
|
-
]
|
|
46
|
-
else: # some other AI agent is driving us
|
|
32
|
+
if project_id:
|
|
33
|
+
steps = [("deepvista tasks run", "start the task daemon for your current project")]
|
|
34
|
+
else:
|
|
47
35
|
steps = [
|
|
48
|
-
|
|
49
|
-
"deepvista
|
|
50
|
-
'deepvista vistabase +search "<topic>" — recall the user\'s stored context',
|
|
36
|
+
("deepvista project use <id|slug>", "pick the project to work in"),
|
|
37
|
+
("deepvista tasks run", "start its task daemon"),
|
|
51
38
|
]
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
|
|
40
|
+
click.echo("\n What's next?", err=True)
|
|
41
|
+
for command, description in steps:
|
|
42
|
+
click.echo(f" {click.style(command, fg='cyan', bold=True)}", err=True)
|
|
43
|
+
click.echo(f" {click.style(description, dim=True)}", err=True)
|
|
44
|
+
|
|
45
|
+
click.echo(
|
|
46
|
+
f"\n New here? Open your AI agent and say: {click.style('Help me get started with DeepVista.', italic=True)}",
|
|
47
|
+
err=True,
|
|
48
|
+
)
|
|
55
49
|
|
|
56
50
|
|
|
57
51
|
@auth_group.command("login")
|
|
@@ -94,8 +88,12 @@ def auth_login(ctx: click.Context, code: str | None, dry_run: bool) -> None:
|
|
|
94
88
|
"user_id": tokens.user_id,
|
|
95
89
|
}
|
|
96
90
|
format_output(result, ctx.obj.output_format)
|
|
97
|
-
click.echo(
|
|
98
|
-
|
|
91
|
+
click.echo(
|
|
92
|
+
f"\n {click.style('✓', fg='green', bold=True)} Logged in as "
|
|
93
|
+
f"{click.style(tokens.email or tokens.user_id, bold=True)}",
|
|
94
|
+
err=True,
|
|
95
|
+
)
|
|
96
|
+
_print_next_steps(ctx.obj.project_id)
|
|
99
97
|
|
|
100
98
|
|
|
101
99
|
@auth_group.command("status")
|
|
@@ -11,6 +11,7 @@ Endpoints:
|
|
|
11
11
|
POST /get_context_cards -> list / search
|
|
12
12
|
POST /get_context_card -> get by id
|
|
13
13
|
POST /create_context_card -> create
|
|
14
|
+
POST /attachments/signed-upload-url -> presigned PUT for `card upload` (DV-1650)
|
|
14
15
|
POST /update_context_card -> update
|
|
15
16
|
POST /edit_context_card -> targeted string replacement (file-ops Edit)
|
|
16
17
|
POST /search_context_cards -> hybrid tsvector + embedding content search
|
|
@@ -29,10 +30,16 @@ from deepvista_cli.client.http import DeepVistaClient
|
|
|
29
30
|
from deepvista_cli.commands import apply_project_override, project_option, resolve_content
|
|
30
31
|
from deepvista_cli.output.formatter import format_output, output_error
|
|
31
32
|
|
|
33
|
+
# Mirrors the backend's vista_common.models.context_card.CardType enum
|
|
34
|
+
# (types are enforced at the API layer, not in the DB). `note` is reserved
|
|
35
|
+
# for human-authored notes; `artifact` (DV-1573) is the agent's fallback for
|
|
36
|
+
# its own output when no structured type fits. The deprecated `skill_run`
|
|
37
|
+
# type (superseded by `run_log`, DV-1130) is intentionally absent.
|
|
32
38
|
CARD_TYPES = [
|
|
33
39
|
"person",
|
|
34
40
|
"organization",
|
|
35
41
|
"message",
|
|
42
|
+
"email",
|
|
36
43
|
"todo",
|
|
37
44
|
"topic",
|
|
38
45
|
"keypoint",
|
|
@@ -40,11 +47,19 @@ CARD_TYPES = [
|
|
|
40
47
|
"note",
|
|
41
48
|
"session",
|
|
42
49
|
"skill",
|
|
43
|
-
"
|
|
50
|
+
"run_log",
|
|
51
|
+
"schedule_job",
|
|
52
|
+
"task",
|
|
53
|
+
"conversation_starter",
|
|
54
|
+
"artifact",
|
|
44
55
|
]
|
|
45
56
|
|
|
46
57
|
CARD_COLUMNS = ["id", "type", "title", "display_status", "updated_at"]
|
|
47
58
|
|
|
59
|
+
# Mirrors the backend's cap on /attachments/signed-upload-url so oversize
|
|
60
|
+
# uploads fail fast without a round trip.
|
|
61
|
+
MAX_UPLOAD_BYTES = 100 * 1024 * 1024
|
|
62
|
+
|
|
48
63
|
COMMENT_COLUMNS = ["id", "commenter_type", "commenter_name", "comment", "created_at"]
|
|
49
64
|
|
|
50
65
|
|
|
@@ -217,6 +232,72 @@ def card_create(
|
|
|
217
232
|
)
|
|
218
233
|
|
|
219
234
|
|
|
235
|
+
@card_group.command("upload")
|
|
236
|
+
@click.argument("file_path", type=click.Path(exists=True, dir_okay=False, readable=True))
|
|
237
|
+
@click.option("--content-type", default=None, help="MIME type (default: guessed from the file name).")
|
|
238
|
+
@click.option("--dry-run", is_flag=True, default=False, help="Preview what would happen without making any changes.")
|
|
239
|
+
@project_option
|
|
240
|
+
@click.pass_context
|
|
241
|
+
def card_upload(
|
|
242
|
+
ctx: click.Context,
|
|
243
|
+
file_path: str,
|
|
244
|
+
content_type: str | None,
|
|
245
|
+
dry_run: bool,
|
|
246
|
+
project_override: str | None,
|
|
247
|
+
) -> None:
|
|
248
|
+
"""Upload a file (binary OK) as a `file` context card (DV-1650).
|
|
249
|
+
|
|
250
|
+
Requests a presigned upload URL, PUTs the raw bytes to storage, and the
|
|
251
|
+
backend mints the `file` card — title = file name, with `url`,
|
|
252
|
+
`file_type`, and `uploaded_at` populated. Use this instead of
|
|
253
|
+
`card create --content-file` for anything that isn't UTF-8 text.
|
|
254
|
+
|
|
255
|
+
> [!CAUTION] This is a write command — confirm with the user before executing.
|
|
256
|
+
"""
|
|
257
|
+
import mimetypes
|
|
258
|
+
from pathlib import Path as _Path
|
|
259
|
+
|
|
260
|
+
apply_project_override(ctx, project_override)
|
|
261
|
+
path = _Path(file_path)
|
|
262
|
+
size = path.stat().st_size
|
|
263
|
+
if size > MAX_UPLOAD_BYTES:
|
|
264
|
+
output_error(
|
|
265
|
+
3,
|
|
266
|
+
f"File exceeds the {MAX_UPLOAD_BYTES // (1024 * 1024)} MB upload limit",
|
|
267
|
+
f"{path} is {size} bytes.",
|
|
268
|
+
)
|
|
269
|
+
resolved_type = content_type or mimetypes.guess_type(path.name)[0] or "application/octet-stream"
|
|
270
|
+
body = {"file_name": path.name, "file_size": size, "content_type": resolved_type}
|
|
271
|
+
|
|
272
|
+
if dry_run:
|
|
273
|
+
format_output(
|
|
274
|
+
{"dry_run": True, "would": "upload file and create a file card", "payload": body},
|
|
275
|
+
ctx.obj.output_format,
|
|
276
|
+
entity_type="card",
|
|
277
|
+
base_url=ctx.obj.auth_url,
|
|
278
|
+
project_id=ctx.obj.project_id,
|
|
279
|
+
)
|
|
280
|
+
return
|
|
281
|
+
|
|
282
|
+
grant = _client(ctx).post("/attachments/signed-upload-url", body)
|
|
283
|
+
_client(ctx).put_bytes(grant["signedUrl"], path.read_bytes(), grant.get("headers") or {})
|
|
284
|
+
result = {
|
|
285
|
+
"uploaded": path.name,
|
|
286
|
+
"bytes": size,
|
|
287
|
+
"file_type": resolved_type,
|
|
288
|
+
"url": grant.get("gsUrl"),
|
|
289
|
+
"card": "file card created by the backend (title = file name)",
|
|
290
|
+
}
|
|
291
|
+
format_output(
|
|
292
|
+
result,
|
|
293
|
+
ctx.obj.output_format,
|
|
294
|
+
title="Uploaded file card",
|
|
295
|
+
entity_type="card",
|
|
296
|
+
base_url=ctx.obj.auth_url,
|
|
297
|
+
project_id=ctx.obj.project_id,
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
|
|
220
301
|
@card_group.command("update")
|
|
221
302
|
@click.argument("card_id")
|
|
222
303
|
@click.option("--title", default=None, help="New title.")
|
|
@@ -16,7 +16,6 @@ Resolution order for the working project (highest wins):
|
|
|
16
16
|
Endpoints:
|
|
17
17
|
GET /projects -> list owned + shared projects
|
|
18
18
|
GET /projects/me -> the resolved/default project
|
|
19
|
-
GET /projects/{id} -> a single project's metadata
|
|
20
19
|
"""
|
|
21
20
|
|
|
22
21
|
from __future__ import annotations
|
|
@@ -31,7 +30,7 @@ from deepvista_cli.config import (
|
|
|
31
30
|
)
|
|
32
31
|
from deepvista_cli.output.formatter import format_output, output_error
|
|
33
32
|
|
|
34
|
-
PROJECT_COLUMNS = ["id", "name", "role"]
|
|
33
|
+
PROJECT_COLUMNS = ["id", "slug", "name", "role"]
|
|
35
34
|
|
|
36
35
|
|
|
37
36
|
def _client(ctx: click.Context) -> DeepVistaClient:
|
|
@@ -53,6 +52,19 @@ def _projects(ctx: click.Context) -> list[dict]:
|
|
|
53
52
|
return []
|
|
54
53
|
|
|
55
54
|
|
|
55
|
+
def _match_project(projects: list[dict], ref: str) -> dict | None:
|
|
56
|
+
"""Find a project by id or slug (DV-1564)."""
|
|
57
|
+
return next((p for p in projects if p.get("id") == ref or (p.get("slug") and p.get("slug") == ref)), None)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _project_not_found(ref: str) -> None:
|
|
61
|
+
output_error(
|
|
62
|
+
EXIT_VALIDATION_ERROR,
|
|
63
|
+
f"Project '{ref}' not found or not accessible",
|
|
64
|
+
detail="Run `deepvista project list` to see available projects (id and slug).",
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
56
68
|
def _project_role(project: dict) -> str | None:
|
|
57
69
|
"""Best-effort role for a project: explicit permission, else owner/shared."""
|
|
58
70
|
permission = project.get("permission")
|
|
@@ -83,7 +95,12 @@ def _slim_project(project: dict) -> dict:
|
|
|
83
95
|
|
|
84
96
|
Keeps the ``id`` so the formatter still attaches a ``/project/{id}`` link.
|
|
85
97
|
"""
|
|
86
|
-
slim: dict = {
|
|
98
|
+
slim: dict = {
|
|
99
|
+
"id": project.get("id"),
|
|
100
|
+
"slug": project.get("slug"),
|
|
101
|
+
"name": project.get("name"),
|
|
102
|
+
"role": _project_role(project),
|
|
103
|
+
}
|
|
87
104
|
for key in _SLIM_OPTIONAL_FIELDS:
|
|
88
105
|
if project.get(key) is not None:
|
|
89
106
|
slim[key] = project[key]
|
|
@@ -94,11 +111,11 @@ def _slim_project(project: dict) -> dict:
|
|
|
94
111
|
def project_group() -> None:
|
|
95
112
|
"""Inspect and switch the CLI's working project.
|
|
96
113
|
|
|
97
|
-
Pick a working project once with `project use <id>`; every subcommand
|
|
98
|
-
scopes to it (sends `X-Project-Id` and emits `/project/{id}/...`
|
|
99
|
-
Override per-invocation with the global `--project <id>` flag
|
|
100
|
-
`DEEPVISTA_PROJECT_ID` env var. `project clear` falls back to the
|
|
101
|
-
default.
|
|
114
|
+
Pick a working project once with `project use <id|slug>`; every subcommand
|
|
115
|
+
then scopes to it (sends `X-Project-Id` and emits `/project/{id}/...`
|
|
116
|
+
links). Override per-invocation with the global `--project <id|slug>` flag
|
|
117
|
+
or the `DEEPVISTA_PROJECT_ID` env var. `project clear` falls back to the
|
|
118
|
+
backend default.
|
|
102
119
|
"""
|
|
103
120
|
|
|
104
121
|
|
|
@@ -136,13 +153,19 @@ def project_current(ctx: click.Context, full: bool) -> None:
|
|
|
136
153
|
|
|
137
154
|
|
|
138
155
|
@project_group.command("show")
|
|
139
|
-
@click.argument("
|
|
156
|
+
@click.argument("project_ref", required=False)
|
|
140
157
|
@click.option("--full", is_flag=True, default=False, help="Show the raw project object (tags, starters, …).")
|
|
141
158
|
@click.pass_context
|
|
142
|
-
def project_show(ctx: click.Context,
|
|
143
|
-
"""Show metadata for a project (defaults to the resolved current project)."""
|
|
144
|
-
if
|
|
145
|
-
|
|
159
|
+
def project_show(ctx: click.Context, project_ref: str | None, full: bool) -> None:
|
|
160
|
+
"""Show metadata for a project — by id or slug (defaults to the resolved current project)."""
|
|
161
|
+
if project_ref:
|
|
162
|
+
# There is no GET /projects/{id}; resolve the ref (id or slug, DV-1564)
|
|
163
|
+
# against the projects list, which returns the full project object.
|
|
164
|
+
match = _match_project(_projects(ctx), project_ref)
|
|
165
|
+
if match is None:
|
|
166
|
+
_project_not_found(project_ref)
|
|
167
|
+
return
|
|
168
|
+
data = match
|
|
146
169
|
else:
|
|
147
170
|
data = _client(ctx).get("/projects/me")
|
|
148
171
|
if not full and isinstance(data, dict):
|
|
@@ -151,27 +174,26 @@ def project_show(ctx: click.Context, project_id: str | None, full: bool) -> None
|
|
|
151
174
|
|
|
152
175
|
|
|
153
176
|
@project_group.command("use")
|
|
154
|
-
@click.argument("
|
|
177
|
+
@click.argument("project_ref")
|
|
155
178
|
@click.pass_context
|
|
156
|
-
def project_use(ctx: click.Context,
|
|
179
|
+
def project_use(ctx: click.Context, project_ref: str) -> None:
|
|
157
180
|
"""Set the working project for this profile after validating membership.
|
|
158
181
|
|
|
159
|
-
|
|
182
|
+
PROJECT_REF is the project's id or slug (DV-1564); the canonical UUID is
|
|
183
|
+
what gets persisted in the active profile. This is client-side scoping
|
|
160
184
|
only — it does not change the backend's per-user default project.
|
|
161
185
|
"""
|
|
162
|
-
|
|
163
|
-
match = next((p for p in projects if p.get("id") == project_id), None)
|
|
186
|
+
match = _match_project(_projects(ctx), project_ref)
|
|
164
187
|
if match is None:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
f"Project {project_id} not found or not accessible",
|
|
168
|
-
detail="Run `deepvista project list` to see available projects.",
|
|
169
|
-
)
|
|
188
|
+
_project_not_found(project_ref)
|
|
189
|
+
return
|
|
170
190
|
|
|
191
|
+
project_id = str(match.get("id"))
|
|
171
192
|
set_working_project(ctx.obj.profile, project_id)
|
|
172
193
|
ctx.obj.project_id = project_id
|
|
173
194
|
result = {
|
|
174
195
|
"working_project": project_id,
|
|
196
|
+
"slug": match.get("slug"),
|
|
175
197
|
"name": match.get("name"),
|
|
176
198
|
"profile": ctx.obj.profile,
|
|
177
199
|
}
|
|
@@ -11,8 +11,9 @@ and run them:
|
|
|
11
11
|
|
|
12
12
|
Polling (DV-1079): ``run`` polls in the foreground by default (--poll-interval,
|
|
13
13
|
bounded by --total-time when given); --run-once does a single claim/execute
|
|
14
|
-
pass, which is what the cron entry installed by ``setup`` uses. A
|
|
15
|
-
allows only one ``tasks run`` per
|
|
14
|
+
pass, which is what the cron entry installed by ``setup`` uses. A per-project
|
|
15
|
+
PID lock file allows only one ``tasks run`` per project at a time; daemons for
|
|
16
|
+
different projects coexist on one machine (DV-1563). Headless runs execute
|
|
16
17
|
concurrently up to --max-parallel (default 5).
|
|
17
18
|
"""
|
|
18
19
|
|
|
@@ -35,6 +36,7 @@ import click
|
|
|
35
36
|
from deepvista_cli.auth.tokens import get_valid_token
|
|
36
37
|
from deepvista_cli.client.http import DeepVistaClient
|
|
37
38
|
from deepvista_cli.client.origin import detect_agent_tool
|
|
39
|
+
from deepvista_cli.commands import resolve_project_ref
|
|
38
40
|
from deepvista_cli.commands.agents import (
|
|
39
41
|
AGENTS_DIR,
|
|
40
42
|
MACHINES_DIR,
|
|
@@ -67,8 +69,8 @@ DEFAULT_MAX_PARALLEL_TASKS = 5
|
|
|
67
69
|
# Idle polls between heartbeat lines in default (non-verbose) mode (~5 min at 10s).
|
|
68
70
|
IDLE_HEARTBEAT_POLLS = 30
|
|
69
71
|
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
+
# Directory holding the per-project `tasks run` locks (DV-1079, DV-1563).
|
|
73
|
+
RUN_LOCK_DIR = CONFIG_DIR
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
# ---------------------------------------------------------------------------
|
|
@@ -140,33 +142,40 @@ def _pid_alive(pid: int) -> bool:
|
|
|
140
142
|
return True
|
|
141
143
|
|
|
142
144
|
|
|
143
|
-
def
|
|
145
|
+
def _run_lock_path(project_id: str) -> Path:
|
|
146
|
+
"""Lock file for a project's `tasks run` daemon — holds the owner PID."""
|
|
147
|
+
return RUN_LOCK_DIR / f"task_queue.run.{project_id}.lock"
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _read_lock_pid(lock_path: Path) -> int | None:
|
|
144
151
|
try:
|
|
145
|
-
return int(
|
|
152
|
+
return int(lock_path.read_text().strip())
|
|
146
153
|
except (OSError, ValueError):
|
|
147
154
|
return None
|
|
148
155
|
|
|
149
156
|
|
|
150
|
-
def _acquire_run_lock() -> bool:
|
|
151
|
-
"""Take the
|
|
157
|
+
def _acquire_run_lock(lock_path: Path) -> bool:
|
|
158
|
+
"""Take the per-project single-instance lock for `tasks run` (DV-1079, DV-1563).
|
|
152
159
|
|
|
153
|
-
Overlapping pollers would double-claim
|
|
154
|
-
be active at a time — a foreground poller and a
|
|
155
|
-
|
|
160
|
+
Overlapping pollers would double-claim a project's queue, so only one
|
|
161
|
+
`run` may be active per project at a time — a foreground poller and a
|
|
162
|
+
cron tick included. Daemons for *different* projects hold different locks
|
|
163
|
+
and coexist on one machine. A lock whose owner PID is dead (crash,
|
|
164
|
+
reboot) is stale and reclaimed.
|
|
156
165
|
"""
|
|
157
|
-
pid = _read_lock_pid()
|
|
166
|
+
pid = _read_lock_pid(lock_path)
|
|
158
167
|
if pid is not None and pid != os.getpid() and _pid_alive(pid):
|
|
159
168
|
return False
|
|
160
|
-
|
|
161
|
-
|
|
169
|
+
lock_path.parent.mkdir(parents=True, exist_ok=True)
|
|
170
|
+
lock_path.write_text(str(os.getpid()))
|
|
162
171
|
return True
|
|
163
172
|
|
|
164
173
|
|
|
165
|
-
def _release_run_lock() -> None:
|
|
166
|
-
if _read_lock_pid() != os.getpid():
|
|
174
|
+
def _release_run_lock(lock_path: Path) -> None:
|
|
175
|
+
if _read_lock_pid(lock_path) != os.getpid():
|
|
167
176
|
return
|
|
168
177
|
try:
|
|
169
|
-
|
|
178
|
+
lock_path.unlink()
|
|
170
179
|
except OSError:
|
|
171
180
|
pass
|
|
172
181
|
|
|
@@ -596,17 +605,17 @@ def _find_registered_agent_for_project(project_id: str) -> str | None:
|
|
|
596
605
|
|
|
597
606
|
|
|
598
607
|
def _resolve_working_project(ctx: click.Context, project_override: str | None = None) -> str | None:
|
|
599
|
-
"""Return the project ``tasks run`` should scope to.
|
|
608
|
+
"""Return the project ``tasks run`` should scope to, as a canonical UUID.
|
|
600
609
|
|
|
601
610
|
Resolution order: per-command ``--project`` → global working project
|
|
602
611
|
(``project use`` / global ``--project`` / ``DEEPVISTA_PROJECT_ID``) →
|
|
603
|
-
backend default via ``GET /projects/me``.
|
|
612
|
+
backend default via ``GET /projects/me``. Slugs are resolved to the
|
|
613
|
+
project UUID (DV-1564) so machine cache files and run locks stay keyed
|
|
614
|
+
consistently.
|
|
604
615
|
"""
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if profile_project:
|
|
609
|
-
return profile_project
|
|
616
|
+
ref = project_override or getattr(ctx.obj, "project_id", None)
|
|
617
|
+
if ref:
|
|
618
|
+
return resolve_project_ref(ctx, ref)
|
|
610
619
|
try:
|
|
611
620
|
data = _client(ctx).get("/projects/me")
|
|
612
621
|
except SystemExit:
|
|
@@ -924,7 +933,7 @@ def _claim_and_submit_all(
|
|
|
924
933
|
"--project",
|
|
925
934
|
"project_id",
|
|
926
935
|
default=None,
|
|
927
|
-
help="Scope to this project (overrides the working project for this call only).",
|
|
936
|
+
help="Scope to this project — id or slug (overrides the working project for this call only).",
|
|
928
937
|
)
|
|
929
938
|
@click.option(
|
|
930
939
|
"--run-once",
|
|
@@ -992,19 +1001,21 @@ def tasks_run(
|
|
|
992
1001
|
unset). --run-once does a single pass and exits; the cron entry installed
|
|
993
1002
|
by ``tasks setup`` uses it.
|
|
994
1003
|
|
|
995
|
-
Only one ``tasks run`` may be active per
|
|
996
|
-
invocations exit with an error instead of
|
|
1004
|
+
Only one ``tasks run`` may be active per project — concurrent
|
|
1005
|
+
invocations for the same project exit with an error instead of
|
|
1006
|
+
double-claiming work. Daemons for different projects coexist (DV-1563).
|
|
997
1007
|
"""
|
|
998
|
-
|
|
1008
|
+
project_names: dict[str, str] = {}
|
|
1009
|
+
working_project = _resolve_working_project(ctx, project_id)
|
|
1010
|
+
|
|
1011
|
+
run_lock_path = _run_lock_path(working_project) if working_project else None
|
|
1012
|
+
if run_lock_path is not None and not _acquire_run_lock(run_lock_path):
|
|
999
1013
|
output_error(
|
|
1000
1014
|
2,
|
|
1001
|
-
"Another `tasks run` is already active
|
|
1002
|
-
f"Stop it first or wait for it to finish (lock: {
|
|
1015
|
+
f"Another `tasks run` is already active for project {working_project}",
|
|
1016
|
+
f"Stop it first or wait for it to finish (lock: {run_lock_path}, pid: {_read_lock_pid(run_lock_path)}).",
|
|
1003
1017
|
)
|
|
1004
1018
|
raise SystemExit(2)
|
|
1005
|
-
|
|
1006
|
-
project_names: dict[str, str] = {}
|
|
1007
|
-
working_project = _resolve_working_project(ctx, project_id)
|
|
1008
1019
|
agents: list[tuple[str, str | None]]
|
|
1009
1020
|
if agent_type:
|
|
1010
1021
|
# Explicit agent filter — single-agent mode (backward-compatible).
|
|
@@ -1026,7 +1037,7 @@ def tasks_run(
|
|
|
1026
1037
|
output_error(
|
|
1027
1038
|
3,
|
|
1028
1039
|
"No working project to poll",
|
|
1029
|
-
"Run `deepvista project use <id>` or pass `--project <id>`.",
|
|
1040
|
+
"Run `deepvista project use <id|slug>` or pass `--project <id|slug>`.",
|
|
1030
1041
|
)
|
|
1031
1042
|
raise SystemExit(3)
|
|
1032
1043
|
agents, project_names = _ensure_agents_for_projects(ctx, project_ids={working_project})
|
|
@@ -1164,7 +1175,8 @@ def tasks_run(
|
|
|
1164
1175
|
raise SystemExit(130) from None
|
|
1165
1176
|
finally:
|
|
1166
1177
|
executor.shutdown()
|
|
1167
|
-
|
|
1178
|
+
if run_lock_path is not None:
|
|
1179
|
+
_release_run_lock(run_lock_path)
|
|
1168
1180
|
|
|
1169
1181
|
|
|
1170
1182
|
TASK_CARD_COLUMNS = ["id", "status", "title", "agent_id", "created_at"]
|
|
@@ -63,7 +63,7 @@ class _RootGroup(click.Group):
|
|
|
63
63
|
"--project",
|
|
64
64
|
"project_id",
|
|
65
65
|
default=None,
|
|
66
|
-
help="Scope this invocation to a project id (overrides the
|
|
66
|
+
help="Scope this invocation to a project id or slug (overrides the working project / DEEPVISTA_PROJECT_ID).",
|
|
67
67
|
)
|
|
68
68
|
@click.pass_context
|
|
69
69
|
def cli(
|
|
@@ -197,18 +197,12 @@ else
|
|
|
197
197
|
fi
|
|
198
198
|
|
|
199
199
|
echo ""
|
|
200
|
-
echo "==>
|
|
200
|
+
echo "==> One last step — connect your AI agent"
|
|
201
201
|
echo ""
|
|
202
|
-
echo "
|
|
202
|
+
echo " Claude Code: /plugin marketplace add DeepVista-AI/deepvista-cli"
|
|
203
|
+
echo " /plugin install deepvista@deepvista-ai"
|
|
203
204
|
echo ""
|
|
204
|
-
echo "
|
|
205
|
-
echo " /plugin install deepvista@deepvista-ai"
|
|
205
|
+
echo " Other agents: https://github.com/DeepVista-AI/deepvista-cli#as-a-claude-code-plugin"
|
|
206
206
|
echo ""
|
|
207
|
-
echo "
|
|
208
|
-
echo ""
|
|
209
|
-
echo " Help me install the deepvista plugin for Claude Code: https://github.com/DeepVista-AI/deepvista-cli#as-a-claude-code-plugin"
|
|
210
|
-
echo ""
|
|
211
|
-
echo "DeepVista is ready. Open your AI agent and say:"
|
|
212
|
-
echo ""
|
|
213
|
-
echo " Help me get started with DeepVista."
|
|
207
|
+
echo "✓ DeepVista is ready. Open your AI agent and say: \"Help me get started with DeepVista.\""
|
|
214
208
|
echo ""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepvista",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Remote-managed skill catalog from DeepVista. Auto-syncs thin stubs into the plugin's skills dir on SessionStart; full bodies are lazy-loaded at invocation time.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "DeepVista AI",
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# Cards — the knowledge base
|
|
2
2
|
|
|
3
3
|
`deepvista card` manages every knowledge base entry. Types: `person`, `organization`,
|
|
4
|
-
`message`, `todo`, `topic`, `keypoint`, `file`, `note`, `
|
|
4
|
+
`message`, `email`, `todo`, `topic`, `keypoint`, `file`, `note`, `session`, `skill`,
|
|
5
|
+
`run_log`, `schedule_job`, `task`, `conversation_starter`, `artifact`.
|
|
6
|
+
|
|
7
|
+
`note` is reserved for human-authored notes; `artifact` is the agent's fallback
|
|
8
|
+
for its own output when no structured type fits (DV-1573).
|
|
5
9
|
|
|
6
10
|
`deepvista vistabase` is a backward-compatible alias — every `card` subcommand
|
|
7
11
|
works under `vistabase` too (hidden from `--help`).
|
|
@@ -228,6 +228,59 @@ def test_migrate_legacy_agents_dir_into_machines_cache(tmp_path: Path, monkeypat
|
|
|
228
228
|
assert cached["project_id"] == project_id
|
|
229
229
|
|
|
230
230
|
|
|
231
|
+
# ---------------------------------------------------------------------------
|
|
232
|
+
# agents.py — _machine_fingerprint() persistence (DV-1570)
|
|
233
|
+
# ---------------------------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def test_machine_fingerprint_persists_across_calls(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
237
|
+
"""A fresh fingerprint is generated once and reused on every subsequent call."""
|
|
238
|
+
from deepvista_cli.commands import agents
|
|
239
|
+
|
|
240
|
+
monkeypatch.setattr(agents, "CONFIG_DIR", tmp_path)
|
|
241
|
+
monkeypatch.setattr(agents, "MACHINE_ID_PATH", tmp_path / "machine_id")
|
|
242
|
+
|
|
243
|
+
first = agents._machine_fingerprint()
|
|
244
|
+
second = agents._machine_fingerprint()
|
|
245
|
+
|
|
246
|
+
assert first == second
|
|
247
|
+
assert (tmp_path / "machine_id").read_text().strip() == first
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def test_machine_fingerprint_survives_process_restart_simulation(
|
|
251
|
+
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
252
|
+
) -> None:
|
|
253
|
+
"""Reloading the module-level function (simulating a fresh CLI process) must
|
|
254
|
+
still return the persisted id — this is what protects against
|
|
255
|
+
``uuid.getnode()``'s per-process randomness on hosts without a real MAC."""
|
|
256
|
+
from deepvista_cli.commands import agents
|
|
257
|
+
|
|
258
|
+
monkeypatch.setattr(agents, "CONFIG_DIR", tmp_path)
|
|
259
|
+
monkeypatch.setattr(agents, "MACHINE_ID_PATH", tmp_path / "machine_id")
|
|
260
|
+
|
|
261
|
+
generated = agents._machine_fingerprint()
|
|
262
|
+
|
|
263
|
+
# No in-memory state to reset — persistence must live entirely on disk.
|
|
264
|
+
assert agents._machine_fingerprint() == generated
|
|
265
|
+
assert (tmp_path / "machine_id").exists()
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def test_machine_fingerprint_ignores_stale_getnode_value(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
269
|
+
"""Once persisted, the fingerprint no longer depends on hostname/MAC at all."""
|
|
270
|
+
from deepvista_cli.commands import agents
|
|
271
|
+
|
|
272
|
+
monkeypatch.setattr(agents, "CONFIG_DIR", tmp_path)
|
|
273
|
+
monkeypatch.setattr(agents, "MACHINE_ID_PATH", tmp_path / "machine_id")
|
|
274
|
+
persisted = agents._machine_fingerprint()
|
|
275
|
+
|
|
276
|
+
import uuid as uuid_module
|
|
277
|
+
|
|
278
|
+
monkeypatch.setattr(uuid_module, "getnode", lambda: 999999999999)
|
|
279
|
+
monkeypatch.setattr("platform.node", lambda: "some-other-ephemeral-hostname")
|
|
280
|
+
|
|
281
|
+
assert agents._machine_fingerprint() == persisted
|
|
282
|
+
|
|
283
|
+
|
|
231
284
|
# ---------------------------------------------------------------------------
|
|
232
285
|
# +quick tag emission
|
|
233
286
|
# ---------------------------------------------------------------------------
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"""CLI command groups — auth, vistabase, skill, notes, chat."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import sys
|
|
6
|
-
from collections.abc import Callable
|
|
7
|
-
|
|
8
|
-
import click
|
|
9
|
-
|
|
10
|
-
from deepvista_cli.output.formatter import output_error
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def project_option[F: Callable](func: F) -> F:
|
|
14
|
-
"""Add a per-command ``--project <id>`` override.
|
|
15
|
-
|
|
16
|
-
Use together with :func:`apply_project_override` at the top of the command
|
|
17
|
-
body. The override takes precedence over the persisted working project /
|
|
18
|
-
global ``--project`` flag for this single invocation only.
|
|
19
|
-
"""
|
|
20
|
-
return click.option(
|
|
21
|
-
"--project",
|
|
22
|
-
"project_override",
|
|
23
|
-
default=None,
|
|
24
|
-
help="Scope this command to a project id (overrides the working project for this call only).",
|
|
25
|
-
)(func)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def apply_project_override(ctx: click.Context, project_override: str | None) -> None:
|
|
29
|
-
"""Apply a per-command ``--project`` value to the resolved config.
|
|
30
|
-
|
|
31
|
-
Mutating ``ctx.obj.project_id`` is sufficient because the HTTP client holds
|
|
32
|
-
the *same* ``CLIConfig`` object and reads ``project_id`` lazily when it
|
|
33
|
-
builds request headers, so the override flows through to ``X-Project-Id``
|
|
34
|
-
and to emitted web links without touching every callsite.
|
|
35
|
-
"""
|
|
36
|
-
if project_override:
|
|
37
|
-
ctx.obj.project_id = project_override
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def resolve_content(content: str | None, content_file: str | None) -> str | None:
|
|
41
|
-
"""Resolve content from ``--content`` or ``--content-file``.
|
|
42
|
-
|
|
43
|
-
``--content-file`` takes precedence when provided. Use ``-`` to read from
|
|
44
|
-
stdin. Returns the resolved content string, or *None* if neither option was
|
|
45
|
-
supplied.
|
|
46
|
-
"""
|
|
47
|
-
if content_file is not None:
|
|
48
|
-
if content_file == "-":
|
|
49
|
-
return sys.stdin.read()
|
|
50
|
-
try:
|
|
51
|
-
with open(content_file, encoding="utf-8") as fh:
|
|
52
|
-
return fh.read()
|
|
53
|
-
except OSError as exc:
|
|
54
|
-
output_error(4, "Cannot read content file", str(exc))
|
|
55
|
-
return content
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/deepvista_cli/resources/workflow_host_runtime.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-agent-sync.sh
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-session-end.sh
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-session-start.sh
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-session-turn.sh
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/plugins/claude-code/scripts/deepvista-skill-url.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-analyze-notes.md
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-create-from-note.md
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-import-files.md
RENAMED
|
File without changes
|
{deepvista_cli-4.0.0 → deepvista_cli-4.2.0}/skills/deepvista/reference/skill-research-to-skill.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|