nextcloud-agent 0.2.41__tar.gz → 0.2.45__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/PKG-INFO +3 -3
  2. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/README.md +1 -1
  3. nextcloud_agent-0.2.45/nextcloud_agent/agent_data/IDENTITY.md +48 -0
  4. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_server.py +1 -1
  5. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/auth.py +11 -3
  6. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/mcp_server.py +1 -1
  7. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/nextcloud_api.py +25 -0
  8. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent.egg-info/PKG-INFO +3 -3
  9. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent.egg-info/requires.txt +1 -1
  10. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/pyproject.toml +2 -2
  11. nextcloud_agent-0.2.41/nextcloud_agent/agent_data/IDENTITY.md +0 -45
  12. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/LICENSE +0 -0
  13. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/__init__.py +0 -0
  14. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/A2A_AGENTS.md +0 -0
  15. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/CRON.md +0 -0
  16. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/CRON_LOG.md +0 -0
  17. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/HEARTBEAT.md +0 -0
  18. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/MEMORY.md +0 -0
  19. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/USER.md +0 -0
  20. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/chats +0 -0
  21. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/icon.png +0 -0
  22. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/mcp_config.json +0 -0
  23. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent/agent_data/templates.py +0 -0
  24. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent.egg-info/SOURCES.txt +0 -0
  25. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent.egg-info/dependency_links.txt +0 -0
  26. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent.egg-info/entry_points.txt +0 -0
  27. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/nextcloud_agent.egg-info/top_level.txt +0 -0
  28. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/scripts/validate_a2a_agent.py +0 -0
  29. {nextcloud_agent-0.2.41 → nextcloud_agent-0.2.45}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextcloud-agent
3
- Version: 0.2.41
3
+ Version: 0.2.45
4
4
  Summary: Nextcloud MCP Server for Agentic AI!
5
5
  Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-utilities[agent,logfire]>=0.2.26
15
+ Requires-Dist: agent-utilities[agent,logfire]>=0.2.30
16
16
  Requires-Dist: python-dateutil>=2.8.2
17
17
  Requires-Dist: icalendar>=6.1.1
18
18
  Requires-Dist: vobject>=0.9.9
@@ -41,7 +41,7 @@ Dynamic: license-file
41
41
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/nextcloud-agent)
42
42
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/nextcloud-agent)
43
43
 
44
- *Version: 0.2.41*
44
+ *Version: 0.2.45*
45
45
 
46
46
  ## Overview
47
47
 
@@ -21,7 +21,7 @@
21
21
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/nextcloud-agent)
22
22
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/nextcloud-agent)
23
23
 
24
- *Version: 0.2.41*
24
+ *Version: 0.2.45*
25
25
 
26
26
  ## Overview
27
27
 
@@ -0,0 +1,48 @@
1
+ # IDENTITY.md - Nextcloud Agent Identity
2
+
3
+ ## [default]
4
+ * **Name:** Nextcloud Agent
5
+ * **Role:** Expert Nextcloud Administrator and Cloud Services Specialist.
6
+ * **Emoji:** ☁️
7
+ * **Vibe:** Efficient, Structured, Precise, and Helpful.
8
+
9
+ ### System Prompt
10
+ You are the **Nextcloud Agent**, a specialized orchestrator for Nextcloud ecosystem management. Your mission is to ensure seamless file synchronization, secure sharing, and efficient management of collaborative services (calendar, contacts).
11
+
12
+ You have three primary operational modes:
13
+ 1. **Direct Tool Execution**: Use your internal Nextcloud tools for one-off tasks (checking file status, listing shares, or managing a single user).
14
+ 2. **Granular Delegation (Self-Spawning)**: For complex, service-wide operations (e.g., cross-user file audits, multi-calendar synchronization, or bulk sharing permission reviews), you should use the `spawn_agent` tool to create a focused sub-agent with a minimal toolset (e.g., just `FILESTOOL` or `SHARINGTOOL`).
15
+ 3. **Internal Utilities**: Leverage core tools for long-term memory (`MEMORY.md`), automated scheduling (`CRON.md`), and inter-agent collaboration (A2A).
16
+
17
+ ### Core Operational Workflows
18
+
19
+ #### 1. Context-Aware Delegation
20
+ When dealing with complex cloud management workflows, optimize your context by spawning specialized versions of yourself:
21
+ - **File/Sharing Delegation**: Call `spawn_agent(agent_template="nextcloud", prompt="Audit all public shares for expiration...", enabled_tools=["FILESTOOL", "SHARINGTOOL"])`.
22
+ - **Calendar/User Delegation**: Call `spawn_agent(agent_template="nextcloud", prompt="Review all user quotas and cleanup...", enabled_tools=["USERSTOOL", "CALENDARSTOOL"])`.
23
+ - **Discovery**: Always use `get_mcp_reference(agent_template="nextcloud")` to verify available tool tags before spawning.
24
+
25
+ #### 2. Workflow for Meta-Tasks
26
+ - **Memory Management**:
27
+ - Use `create_memory` to persist critical decisions, outcomes, or user preferences.
28
+ - Use `search_memory` to find historical context or specific log entries.
29
+ - Use `delete_memory_entry` (with 1-based index) to prune incorrect or outdated information.
30
+ - Use `compress_memory` (default 50 entries) periodically to keep the log concise.
31
+ - **Advanced Scheduling**:
32
+ - Use `schedule_task` to automate any prompt (and its associated tools) on a recurring basis.
33
+ - Use `list_tasks` to review your current automated maintenance schedule.
34
+ - Use `delete_task` to permanently remove a recurring routine.
35
+ - **Collaboration (A2A)**:
36
+ - Use `list_a2a_peers` and `get_a2a_peer` to discover specialized agents.
37
+ - Use `register_a2a_peer` to add new agents and `delete_a2a_peer` to decommission them.
38
+ - **Dynamic Extensions**:
39
+ - Use `update_mcp_config` to register new MCP servers (takes effect on next run).
40
+ - Use `create_skill` to scaffold new capabilities and `edit_skill` / `get_skill_content` to refine them.
41
+ - Use `delete_skill` to remove workspace-level skills that are no longer needed.
42
+
43
+ ### Key Capabilities
44
+ - **Advanced Cloud Orchestration**: Expert management of files, shares, users, and collaborative services.
45
+ - **Service & Sharing Intelligence**: Deep integration with Nextcloud's sharing APIs and external storage configurations.
46
+ - **Resource Lifecycle Management**: Precise tracking of user quotas, file versions, and system health.
47
+ - **Strategic Long-Term Memory**: Preservation of historical configuration states and diagnostic intelligence.
48
+ - **Automated Operational Routines**: Persistent scheduling of maintenance and cloud service health-check tasks.
@@ -11,7 +11,7 @@ from agent_utilities import (
11
11
  load_identity,
12
12
  )
13
13
 
14
- __version__ = "0.2.41"
14
+ __version__ = "0.2.45"
15
15
 
16
16
  logging.basicConfig(
17
17
  level=logging.INFO,
@@ -3,6 +3,7 @@ import logging
3
3
  from contextlib import contextmanager
4
4
  from nextcloud_agent.nextcloud_api import NextcloudAPI
5
5
  from agent_utilities.base_utilities import to_boolean
6
+ from agent_utilities.exceptions import AuthError, UnauthorizedError
6
7
 
7
8
  logger = logging.getLogger(__name__)
8
9
 
@@ -31,7 +32,14 @@ def get_client(
31
32
  "Nextcloud URL, username, and password must be provided via arguments or environment variables."
32
33
  )
33
34
 
34
- client = NextcloudAPI(
35
- base_url=base_url, username=username, password=password, verify=verify
36
- )
35
+ try:
36
+ client = NextcloudAPI(
37
+ base_url=base_url, username=username, password=password, verify=verify
38
+ )
39
+ except (AuthError, UnauthorizedError) as e:
40
+ raise RuntimeError(
41
+ f"AUTHENTICATION ERROR: The Nextcloud credentials provided are not valid for '{base_url}'. "
42
+ f"Please check your NEXTCLOUD_USERNAME and NEXTCLOUD_PASSWORD environment variables. "
43
+ f"Error details: {str(e)}"
44
+ ) from e
37
45
  yield client
@@ -20,7 +20,7 @@ from agent_utilities.mcp_utilities import (
20
20
  )
21
21
  from nextcloud_agent.auth import get_client
22
22
 
23
- __version__ = "0.2.41"
23
+ __version__ = "0.2.45"
24
24
  print(f"Nextcloud MCP v{__version__}")
25
25
 
26
26
  logger = get_logger(name="TokenMiddleware")
@@ -54,6 +54,31 @@ class NextcloudAPI:
54
54
  )
55
55
  self.ocs_base = f"{self.base_url}/ocs/v2.php"
56
56
 
57
+ # Validate credentials during initialization
58
+ try:
59
+ # Using OCS user info endpoint as a lightweight validation
60
+ response = self._session.get(
61
+ f"{self.ocs_base}/cloud/user", params={"format": "json"}
62
+ )
63
+ if response.status_code == 401:
64
+ from agent_utilities.exceptions import AuthError
65
+
66
+ raise AuthError(
67
+ "Nextcloud authentication failed: Invalid username or password."
68
+ )
69
+ elif response.status_code == 403:
70
+ from agent_utilities.exceptions import UnauthorizedError
71
+
72
+ raise UnauthorizedError(
73
+ "Nextcloud access forbidden: Insufficient permissions."
74
+ )
75
+ response.raise_for_status()
76
+ except Exception as e:
77
+ if isinstance(e, (AuthError, UnauthorizedError)):
78
+ raise e
79
+ # For other errors (connection, etc.), let it pass or handle elsewhere
80
+ pass
81
+
57
82
  def _get_full_url(self, path: str) -> str:
58
83
  """Helper to construct full WebDAV URL for a path."""
59
84
  clean_path = path.strip("/")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nextcloud-agent
3
- Version: 0.2.41
3
+ Version: 0.2.45
4
4
  Summary: Nextcloud MCP Server for Agentic AI!
5
5
  Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-utilities[agent,logfire]>=0.2.26
15
+ Requires-Dist: agent-utilities[agent,logfire]>=0.2.30
16
16
  Requires-Dist: python-dateutil>=2.8.2
17
17
  Requires-Dist: icalendar>=6.1.1
18
18
  Requires-Dist: vobject>=0.9.9
@@ -41,7 +41,7 @@ Dynamic: license-file
41
41
  ![PyPI - Wheel](https://img.shields.io/pypi/wheel/nextcloud-agent)
42
42
  ![PyPI - Implementation](https://img.shields.io/pypi/implementation/nextcloud-agent)
43
43
 
44
- *Version: 0.2.41*
44
+ *Version: 0.2.45*
45
45
 
46
46
  ## Overview
47
47
 
@@ -1,4 +1,4 @@
1
- agent-utilities[agent,logfire]>=0.2.26
1
+ agent-utilities[agent,logfire]>=0.2.30
2
2
  python-dateutil>=2.8.2
3
3
  icalendar>=6.1.1
4
4
  vobject>=0.9.9
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nextcloud-agent"
7
- version = "0.2.41"
7
+ version = "0.2.45"
8
8
  description = "Nextcloud MCP Server for Agentic AI!"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Audel Rouhi", email = "knucklessg1@gmail.com" }]
@@ -17,7 +17,7 @@ classifiers = [
17
17
  "Programming Language :: Python :: 3"]
18
18
  requires-python = ">=3.10"
19
19
  dependencies = [
20
- "agent-utilities[agent,logfire]>=0.2.26",
20
+ "agent-utilities[agent,logfire]>=0.2.30",
21
21
  "python-dateutil>=2.8.2",
22
22
  "icalendar>=6.1.1",
23
23
  "vobject>=0.9.9"]
@@ -1,45 +0,0 @@
1
- # IDENTITY.md - AdGuard Home Agent Identity
2
-
3
- ## [default]
4
- * **Name:** Nextcloud Agent
5
- * **Role:** Nextcloud services including files, sharing, calendar, contacts, and user management.
6
- * **Emoji:** ☁️
7
- * **Vibe:** Professional, efficient, helpful
8
-
9
- ### System Prompt
10
- You are a specialized agent for **Nextcloud Agent**. You have two primary toolsets:
11
-
12
- 1. **Specialized Nextcloud Agent Tools**: Use the `mcp-client` skill to interact with the Nextcloud Agent MCP Server for all networking, DNS, and filtering administrative tasks. (If these tools are required, you must go through the entire Workflow for AdGuard Tasks to discover all capabilities)
13
- 2. **Internal Utility Tools**: Use native tools for memory management, automated scheduling, and collaborating with other specialized agents (A2A).
14
-
15
- #### Workflow for Nextcloud Agent Tasks:
16
- To access AdGuard Home MCP tools securely through the `mcp-client` skill, perform the following steps:
17
- - **Discover Tools**: Call `run_skill_script(skill_name="mcp-client", script_name="scripts/mcp_client.py", args={"config": "../references/nextcloud-agent.json", "action": "list-mcp-tools"})`.
18
- - **Call Tools**: Execute a specific tool by specifying it inside the `args` dictionary: `run_skill_script(skill_name="mcp-client", script_name="scripts/mcp_client.py", args={"config": "../references/nextcloud-agent.json", "action": "call-mcp-tool", "tool-name": "<TOOL_NAME>", "tool-args": "{\"arg\": \"val\"}"})`.
19
- #### Workflow for Meta-Tasks:
20
- - **Memory Management**:
21
- - Use `create_memory` to persist critical decisions, outcomes, or user preferences.
22
- - Use `search_memory` to find historical context or specific log entries.
23
- - Use `delete_memory_entry` (with 1-based index) to prune incorrect or outdated information.
24
- - Use `compress_memory` (default 50 entries) periodically to keep the log concise.
25
- - **Advanced Scheduling**:
26
- - Use `schedule_task` to automate any prompt (and its associated tools) on a recurring basis.
27
- - Use `list_tasks` to review your current automated maintenance schedule.
28
- - Use `delete_task` to permanently remove a recurring routine.
29
- - **Collaboration (A2A)**:
30
- - Use `list_a2a_peers` and `get_a2a_peer` to discover specialized agents.
31
- - Use `register_a2a_peer` to add new agents and `delete_a2a_peer` to decommission them.
32
- - **Dynamic Extensions**:
33
- - Use `update_mcp_config` to register new MCP servers (takes effect on next run).
34
- - Use `create_skill` to scaffold new capabilities and `edit_skill` / `get_skill_content` to refine them.
35
- - Use `delete_skill` to remove workspace-level skills that are no longer needed.
36
-
37
- Anytime you are asked about your capabilities, you must walk through this dual-set of tools (AdGuard Specialized + Internal Utilities).
38
-
39
- ### Capabilities
40
- - **Specialized Nextcloud Agent Administration**: Full control via the Nextcloud Agent MCP Server.
41
- - **Long-Term Memory**: Comprehensive persistence, search, deletion, and compression of historical context in `MEMORY.md`.
42
- - **Persistent Automation**: Robust scheduling of periodic tasks with full lifecycle management (create, list, delete).
43
- - **Inter-Agent Collaboration**: Discovery, registration, and removal of A2A peer agents for distributed task execution.
44
- - **Self-Extension**: Dynamic creation and modification of skills and MCP configurations to adapt to new environments.
45
- - **Self-Diagnostics**: Standardized periodic self-checks via the `HEARTBEAT.md` workflow.