gumloop 0.5.6__tar.gz → 0.5.7__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.
- {gumloop-0.5.6 → gumloop-0.5.7}/PKG-INFO +1 -1
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/_version.py +1 -1
- gumloop-0.5.7/src/gumloop/cli/commands/_item_access.py +253 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/_sync_output.py +5 -1
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/artifacts.py +89 -1
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/sessions.py +63 -1
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/skills.py +61 -1
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/plugin_assets/gumloop/skills/gumloop-cli/references/commands.md +18 -0
- gumloop-0.5.7/src/gumloop/resources/_item_access.py +21 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/artifacts.py +50 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/sessions.py +39 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/skills.py +39 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/installed.py +39 -6
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/reconcile.py +10 -2
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/reporting.py +1 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/results.py +2 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/target_files.py +5 -2
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/types.py +48 -0
- gumloop-0.5.7/tests/cli/test_item_access.py +151 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_installed.py +16 -11
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_reconciliation_safety.py +60 -0
- gumloop-0.5.7/tests/cli/test_sync_symlinks.py +240 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/.env.example +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/.github/workflows/ci.yml +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/.github/workflows/release.yml +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/.gitignore +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/.pre-commit-config.yaml +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/.python-version +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/LICENSE +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/README.md +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/pyproject.toml +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/scripts/check +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/scripts/fmt +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/scripts/import-logins.sh +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/scripts/install.sh +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/scripts/sdk_examples.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/_auth.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/_client.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/_gumcp_transport.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/_http.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/brain_sync.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/browser_logins/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/browser_logins/chromium_cookies.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/browser_logins/discovery.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/browser_logins/extract.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/browser_logins/filter.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/browser_logins/firefox_cookies.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/_args_input.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/_downloads.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/agents.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/auth.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/brain.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/browser.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/chat.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/evaluations.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/mcp.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/models.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/plugin.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/sync.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/commands/update.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/console.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/context.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/credentials.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/errors.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/main.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/oauth.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/plugin_assets/gumloop/plugin.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/cli/plugin_assets/gumloop/skills/gumloop-cli/SKILL.md +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/errors.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/oauth.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/py.typed +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/agents.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/brain.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/browser_profiles.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/chat.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/decisions.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/evaluations.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/mcp.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/organizations.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/sync.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/resources/teams.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/spec/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/spec/_compat.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/spec/_decisions.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/spec/_extensions.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/archive.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/bundle.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/bundle_validation.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/errors.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/hashing.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/local_state.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/lock.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/markers.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/run.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/scheduler.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/targets.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/src/gumloop/sync/wire.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/conftest.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/sync_scenario_helpers.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/sync_test_fakes.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_agents.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_args_input.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_artifacts.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_brain.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_brain_sync.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_browser_logins.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_chat.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_context.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_credentials.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_evaluations.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_home_isolation.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_login.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_main.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_mcp.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_models.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_plugin.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sessions.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_skills.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_bundle.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_command.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_command_safety.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_contract_fixtures.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_enrollment.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_fixture_corpus.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_hashing.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_scheduler_macos.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/cli/test_sync_targets.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/conftest.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/README.md +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/generated-bundle-transfer-limit.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-absolute-path.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-bytes-per-file-limit.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-device.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-duplicate-entry.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-fifo.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-files-per-skill-limit.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-nul-name.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-parent-traversal.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-reserved-marker.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-socket.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-symlink.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-total-uncompressed-limit.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/invalid-windows-drive-prefix.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/valid-single-skill-stored.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/archives/valid-single-skill.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/bundles/newer-than-plan.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/bundles/normal.zip +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/catalog.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/corpus.sha256 +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/hashes/content-v1.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/hashes/manifest-v1.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/manifests/invalid-duplicate-identity.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/manifests/invalid-duplicate-install-name.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/manifests/invalid-manifest-hash.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/manifests/newer-than-plan.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/manifests/normal-bundle.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/responses/below-pro.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/responses/cli-upgrade-required.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/responses/lost-membership.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/responses/normal-empty-plan.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/fixtures/skill_sync/v1/responses/normal-plan.json +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/integration/conftest.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/integration/test_live.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/__init__.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/conftest.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/helpers.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_agents.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_artifacts.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_brain.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_chat.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_client.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_decisions.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_errors.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_evaluations.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_gumcp_transport.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_mcp.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_mcp_accounts.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_models.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_oauth.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_organizations.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_sessions.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_skills.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_sync.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/sdk/test_teams.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/skill_sync_fixtures.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/tests/test_client.py +0 -0
- {gumloop-0.5.6 → gumloop-0.5.7}/uv.lock +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
from collections.abc import Callable
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
import typer
|
|
9
|
+
|
|
10
|
+
from gumloop import Gumloop
|
|
11
|
+
from gumloop import GumloopError
|
|
12
|
+
from gumloop.cli.console import console
|
|
13
|
+
from gumloop.cli.console import print_json
|
|
14
|
+
from gumloop.cli.context import CliContext
|
|
15
|
+
from gumloop.cli.errors import exit_with_error
|
|
16
|
+
from gumloop.types import ArtifactPasswordResponse
|
|
17
|
+
from gumloop.types import ItemAccessChangeResponse
|
|
18
|
+
from gumloop.types import ItemAccessResponse
|
|
19
|
+
|
|
20
|
+
_LINK_MODES = frozenset({"none", "anyone", "password"})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class ParsedItemAccess:
|
|
25
|
+
share: list[dict[str, str]] | None
|
|
26
|
+
remove: list[dict[str, str]] | None
|
|
27
|
+
link: dict[str, str] | None
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def is_empty(self) -> bool:
|
|
31
|
+
return self.share is None and self.remove is None and self.link is None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def share_option() -> Any:
|
|
35
|
+
return typer.Option("--share", help="Person to add or update, as email:role. Repeatable.")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def remove_option() -> Any:
|
|
39
|
+
return typer.Option("--remove", help="Person to remove, by email. Repeatable.")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def share_team_option() -> Any:
|
|
43
|
+
return typer.Option("--share-team", help="Team to add or update, as team_id:role. Repeatable.")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def remove_team_option() -> Any:
|
|
47
|
+
return typer.Option("--remove-team", help="Team to remove, by team id. Repeatable.")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def organization_option() -> Any:
|
|
51
|
+
return typer.Option("--organization", help="Organization role. none removes organization access.")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def link_option() -> Any:
|
|
55
|
+
return typer.Option("--link", help="Link mode: none, anyone, or password.")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def link_role_option() -> Any:
|
|
59
|
+
return typer.Option("--link-role", help="Role for the link. Uses the item default when omitted.")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def json_option() -> Any:
|
|
63
|
+
return typer.Option("--json", help="Print the raw SDK response as JSON.")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def parse_item_access_flags(
|
|
67
|
+
*,
|
|
68
|
+
share: list[str] | None,
|
|
69
|
+
remove: list[str] | None,
|
|
70
|
+
share_team: list[str] | None,
|
|
71
|
+
remove_team: list[str] | None,
|
|
72
|
+
organization: str | None,
|
|
73
|
+
link: str | None,
|
|
74
|
+
link_role: str | None,
|
|
75
|
+
) -> ParsedItemAccess:
|
|
76
|
+
share_parts: list[dict[str, str]] = []
|
|
77
|
+
remove_parts: list[dict[str, str]] = []
|
|
78
|
+
|
|
79
|
+
for value in share or []:
|
|
80
|
+
email, role = _split_pair(value, flag="--share", kind="email")
|
|
81
|
+
share_parts.append({"type": "person", "email": email, "role": role})
|
|
82
|
+
for value in remove or []:
|
|
83
|
+
email = value.strip()
|
|
84
|
+
if not email:
|
|
85
|
+
raise GumloopError("--remove needs an email.")
|
|
86
|
+
remove_parts.append({"type": "person", "email": email})
|
|
87
|
+
for value in share_team or []:
|
|
88
|
+
team_id, role = _split_pair(value, flag="--share-team", kind="team_id")
|
|
89
|
+
share_parts.append({"type": "team", "team_id": team_id, "role": role})
|
|
90
|
+
for value in remove_team or []:
|
|
91
|
+
team_id = value.strip()
|
|
92
|
+
if not team_id:
|
|
93
|
+
raise GumloopError("--remove-team needs a team id.")
|
|
94
|
+
remove_parts.append({"type": "team", "team_id": team_id})
|
|
95
|
+
|
|
96
|
+
if organization is not None:
|
|
97
|
+
role = organization.strip()
|
|
98
|
+
if not role:
|
|
99
|
+
raise GumloopError("--organization needs a role, or none to remove it.")
|
|
100
|
+
if role == "none":
|
|
101
|
+
remove_parts.append({"type": "organization"})
|
|
102
|
+
else:
|
|
103
|
+
share_parts.append({"type": "organization", "role": role})
|
|
104
|
+
|
|
105
|
+
link_body: dict[str, str] | None = None
|
|
106
|
+
if link is not None:
|
|
107
|
+
mode = link.strip()
|
|
108
|
+
if mode not in _LINK_MODES:
|
|
109
|
+
raise GumloopError("--link must be none, anyone, or password.")
|
|
110
|
+
link_body = {"mode": mode}
|
|
111
|
+
if link_role is not None:
|
|
112
|
+
role = link_role.strip()
|
|
113
|
+
if not role:
|
|
114
|
+
raise GumloopError("--link-role needs a role.")
|
|
115
|
+
link_body["role"] = role
|
|
116
|
+
elif link_role is not None:
|
|
117
|
+
raise GumloopError("--link-role needs --link.")
|
|
118
|
+
|
|
119
|
+
return ParsedItemAccess(
|
|
120
|
+
share=share_parts or None,
|
|
121
|
+
remove=remove_parts or None,
|
|
122
|
+
link=link_body,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def read_password_stdin() -> str:
|
|
127
|
+
password = sys.stdin.read()
|
|
128
|
+
if password.endswith("\r\n"):
|
|
129
|
+
password = password[:-2]
|
|
130
|
+
elif password.endswith("\n"):
|
|
131
|
+
password = password[:-1]
|
|
132
|
+
return password
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def show_item_access(
|
|
136
|
+
ctx: typer.Context,
|
|
137
|
+
*,
|
|
138
|
+
json_output: bool,
|
|
139
|
+
read: Callable[[Gumloop], ItemAccessResponse],
|
|
140
|
+
) -> None:
|
|
141
|
+
cli: CliContext = ctx.obj
|
|
142
|
+
try:
|
|
143
|
+
response = cli.call_with_refresh(read)
|
|
144
|
+
except GumloopError as error:
|
|
145
|
+
exit_with_error(error, json_output=json_output)
|
|
146
|
+
|
|
147
|
+
if json_output:
|
|
148
|
+
print_json(response)
|
|
149
|
+
return
|
|
150
|
+
_print_item_access(response)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def apply_item_access(
|
|
154
|
+
ctx: typer.Context,
|
|
155
|
+
*,
|
|
156
|
+
share: list[str] | None,
|
|
157
|
+
remove: list[str] | None,
|
|
158
|
+
share_team: list[str] | None,
|
|
159
|
+
remove_team: list[str] | None,
|
|
160
|
+
organization: str | None,
|
|
161
|
+
link: str | None,
|
|
162
|
+
link_role: str | None,
|
|
163
|
+
json_output: bool,
|
|
164
|
+
update: Callable[[Gumloop, ParsedItemAccess], ItemAccessChangeResponse],
|
|
165
|
+
set_password: Callable[[Gumloop], ArtifactPasswordResponse] | None = None,
|
|
166
|
+
) -> None:
|
|
167
|
+
cli: CliContext = ctx.obj
|
|
168
|
+
try:
|
|
169
|
+
parsed = parse_item_access_flags(
|
|
170
|
+
share=share,
|
|
171
|
+
remove=remove,
|
|
172
|
+
share_team=share_team,
|
|
173
|
+
remove_team=remove_team,
|
|
174
|
+
organization=organization,
|
|
175
|
+
link=link,
|
|
176
|
+
link_role=link_role,
|
|
177
|
+
)
|
|
178
|
+
if parsed.is_empty and set_password is None:
|
|
179
|
+
raise GumloopError("Pass at least one access change.")
|
|
180
|
+
|
|
181
|
+
def apply(client: Gumloop) -> ItemAccessChangeResponse | ArtifactPasswordResponse:
|
|
182
|
+
password_response: ArtifactPasswordResponse | None = None
|
|
183
|
+
if set_password is not None:
|
|
184
|
+
password_response = set_password(client)
|
|
185
|
+
if parsed.is_empty:
|
|
186
|
+
return password_response
|
|
187
|
+
return update(client, parsed)
|
|
188
|
+
|
|
189
|
+
response = cli.call_with_refresh(apply)
|
|
190
|
+
except GumloopError as error:
|
|
191
|
+
exit_with_error(error, json_output=json_output)
|
|
192
|
+
|
|
193
|
+
if json_output:
|
|
194
|
+
print_json(response)
|
|
195
|
+
return
|
|
196
|
+
if isinstance(response, ArtifactPasswordResponse):
|
|
197
|
+
console.print("[green]Password set.[/green]")
|
|
198
|
+
return
|
|
199
|
+
console.print("[green]Access updated.[/green]")
|
|
200
|
+
_print_item_access(response)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _split_pair(value: str, *, flag: str, kind: str) -> tuple[str, str]:
|
|
204
|
+
left, separator, role = value.partition(":")
|
|
205
|
+
left = left.strip()
|
|
206
|
+
role = role.strip()
|
|
207
|
+
if separator == "" or left == "" or role == "":
|
|
208
|
+
raise GumloopError(f"{flag} must be {kind}:role.")
|
|
209
|
+
return left, role
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def _print_item_access(response: ItemAccessResponse) -> None:
|
|
213
|
+
access = response.access
|
|
214
|
+
console.print(f"Visibility: {access.grants_visibility}", markup=False, highlight=False)
|
|
215
|
+
if access.link_role:
|
|
216
|
+
console.print(f"Link: {access.link} ({access.link_role})", markup=False, highlight=False)
|
|
217
|
+
else:
|
|
218
|
+
console.print(f"Link: {access.link}", markup=False, highlight=False)
|
|
219
|
+
console.print(
|
|
220
|
+
f"Password protected: {'yes' if access.password_protected else 'no'}",
|
|
221
|
+
markup=False,
|
|
222
|
+
highlight=False,
|
|
223
|
+
)
|
|
224
|
+
if access.organization_access is None:
|
|
225
|
+
console.print("Organization: none", markup=False, highlight=False)
|
|
226
|
+
else:
|
|
227
|
+
console.print(f"Organization: {access.organization_access.role}", markup=False, highlight=False)
|
|
228
|
+
|
|
229
|
+
if access.people:
|
|
230
|
+
console.print("People:")
|
|
231
|
+
for person in access.people:
|
|
232
|
+
console.print(
|
|
233
|
+
f" {person.email}\t{person.name or ''}\t{person.role}",
|
|
234
|
+
markup=False,
|
|
235
|
+
highlight=False,
|
|
236
|
+
)
|
|
237
|
+
else:
|
|
238
|
+
console.print("People: none")
|
|
239
|
+
|
|
240
|
+
if access.teams:
|
|
241
|
+
console.print("Teams:")
|
|
242
|
+
for team in access.teams:
|
|
243
|
+
console.print(f" {team.team_id}\t{team.role}", markup=False, highlight=False)
|
|
244
|
+
else:
|
|
245
|
+
console.print("Teams: none")
|
|
246
|
+
|
|
247
|
+
if access.hidden_by_role:
|
|
248
|
+
console.print("Hidden by role:")
|
|
249
|
+
for role, counts in access.hidden_by_role.items():
|
|
250
|
+
console.print(f" {role}: {counts.people} people, {counts.teams} teams", markup=False, highlight=False)
|
|
251
|
+
|
|
252
|
+
if isinstance(response, ItemAccessChangeResponse) and response.notified:
|
|
253
|
+
console.print("Notified: " + ", ".join(response.notified), markup=False, highlight=False)
|
|
@@ -23,6 +23,7 @@ _ACTION_LABELS = {
|
|
|
23
23
|
"overwritten_collision": "replaced",
|
|
24
24
|
"overwritten_local_edit": "replaced local edit",
|
|
25
25
|
"removed": "removed",
|
|
26
|
+
"skipped": "skipped",
|
|
26
27
|
"unchanged": "unchanged",
|
|
27
28
|
"updated": "updated",
|
|
28
29
|
}
|
|
@@ -294,12 +295,15 @@ class SyncOutput:
|
|
|
294
295
|
if change.get("error"):
|
|
295
296
|
line += f" error: {change['error']}"
|
|
296
297
|
error_console.print(line, markup=False, highlight=False)
|
|
298
|
+
elif change.get("warning"):
|
|
299
|
+
line += f" warning: {change['warning']}"
|
|
300
|
+
error_console.print(line, markup=False, highlight=False)
|
|
297
301
|
else:
|
|
298
302
|
console.print(line, markup=False, highlight=False)
|
|
299
303
|
|
|
300
304
|
def _change_is_visible(self, change: dict[str, object], *, verbose: bool) -> bool:
|
|
301
305
|
action = change.get("action")
|
|
302
|
-
if change.get("error"):
|
|
306
|
+
if change.get("error") or change.get("warning"):
|
|
303
307
|
return True
|
|
304
308
|
if action == "unchanged":
|
|
305
309
|
return False
|
|
@@ -1,18 +1,35 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from functools import partial
|
|
3
5
|
from typing import Annotated
|
|
4
6
|
|
|
5
7
|
import typer
|
|
6
8
|
from rich.markup import escape as escape_markup
|
|
7
9
|
|
|
10
|
+
from gumloop import Gumloop
|
|
8
11
|
from gumloop import GumloopError
|
|
9
12
|
from gumloop.cli.commands._downloads import download_response
|
|
13
|
+
from gumloop.cli.commands._item_access import apply_item_access
|
|
14
|
+
from gumloop.cli.commands._item_access import json_option
|
|
15
|
+
from gumloop.cli.commands._item_access import link_option
|
|
16
|
+
from gumloop.cli.commands._item_access import link_role_option
|
|
17
|
+
from gumloop.cli.commands._item_access import organization_option
|
|
18
|
+
from gumloop.cli.commands._item_access import read_password_stdin
|
|
19
|
+
from gumloop.cli.commands._item_access import remove_option
|
|
20
|
+
from gumloop.cli.commands._item_access import remove_team_option
|
|
21
|
+
from gumloop.cli.commands._item_access import share_option
|
|
22
|
+
from gumloop.cli.commands._item_access import share_team_option
|
|
23
|
+
from gumloop.cli.commands._item_access import show_item_access
|
|
10
24
|
from gumloop.cli.console import console
|
|
11
25
|
from gumloop.cli.console import print_json
|
|
12
26
|
from gumloop.cli.context import CliContext
|
|
13
27
|
from gumloop.cli.errors import exit_with_error
|
|
28
|
+
from gumloop.types import ArtifactPasswordResponse
|
|
14
29
|
|
|
15
|
-
artifacts_app = typer.Typer(
|
|
30
|
+
artifacts_app = typer.Typer(
|
|
31
|
+
help="List, download, and share Gumloop artifacts.", no_args_is_help=True, rich_markup_mode="rich"
|
|
32
|
+
)
|
|
16
33
|
|
|
17
34
|
|
|
18
35
|
@artifacts_app.command(
|
|
@@ -116,3 +133,74 @@ def download_artifact(
|
|
|
116
133
|
if result["path"] is None:
|
|
117
134
|
return
|
|
118
135
|
console.print(f"[green]Saved[/green] {result['path']} ({result['bytes']} bytes)")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@artifacts_app.command("access", epilog="Example:\n gumloop artifacts access artifact_abc --json")
|
|
139
|
+
def artifact_access(
|
|
140
|
+
ctx: typer.Context,
|
|
141
|
+
artifact_id: Annotated[str, typer.Argument(help="Artifact id.")],
|
|
142
|
+
json_output: Annotated[bool, json_option()] = False,
|
|
143
|
+
) -> None:
|
|
144
|
+
"""Show who can access an artifact."""
|
|
145
|
+
show_item_access(
|
|
146
|
+
ctx,
|
|
147
|
+
json_output=json_output,
|
|
148
|
+
read=lambda client: client.artifacts.get_access(artifact_id),
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@artifacts_app.command(
|
|
153
|
+
"set-access",
|
|
154
|
+
epilog=(
|
|
155
|
+
"Examples:\n"
|
|
156
|
+
" gumloop artifacts set-access artifact_abc --share ada@example.com:viewer\n"
|
|
157
|
+
" gumloop artifacts set-access artifact_abc --share-team team_abc:editor --link anyone\n"
|
|
158
|
+
" printf '%s' 'secret' | gumloop artifacts set-access artifact_abc --password-stdin --link password"
|
|
159
|
+
),
|
|
160
|
+
)
|
|
161
|
+
def set_artifact_access(
|
|
162
|
+
ctx: typer.Context,
|
|
163
|
+
artifact_id: Annotated[str, typer.Argument(help="Artifact id.")],
|
|
164
|
+
share: Annotated[list[str] | None, share_option()] = None,
|
|
165
|
+
remove: Annotated[list[str] | None, remove_option()] = None,
|
|
166
|
+
share_team: Annotated[list[str] | None, share_team_option()] = None,
|
|
167
|
+
remove_team: Annotated[list[str] | None, remove_team_option()] = None,
|
|
168
|
+
organization: Annotated[str | None, organization_option()] = None,
|
|
169
|
+
link: Annotated[str | None, link_option()] = None,
|
|
170
|
+
link_role: Annotated[str | None, link_role_option()] = None,
|
|
171
|
+
password_stdin: Annotated[
|
|
172
|
+
bool,
|
|
173
|
+
typer.Option("--password-stdin", help="Read the new link password from stdin."),
|
|
174
|
+
] = False,
|
|
175
|
+
json_output: Annotated[bool, json_option()] = False,
|
|
176
|
+
) -> None:
|
|
177
|
+
"""Change who can access an artifact."""
|
|
178
|
+
set_password: Callable[[Gumloop], ArtifactPasswordResponse] | None = None
|
|
179
|
+
if password_stdin:
|
|
180
|
+
password = read_password_stdin()
|
|
181
|
+
if password == "":
|
|
182
|
+
exit_with_error(GumloopError("Password from stdin is empty."), json_output=json_output)
|
|
183
|
+
set_password = partial(_set_artifact_password, artifact_id=artifact_id, password=password)
|
|
184
|
+
|
|
185
|
+
apply_item_access(
|
|
186
|
+
ctx,
|
|
187
|
+
share=share,
|
|
188
|
+
remove=remove,
|
|
189
|
+
share_team=share_team,
|
|
190
|
+
remove_team=remove_team,
|
|
191
|
+
organization=organization,
|
|
192
|
+
link=link,
|
|
193
|
+
link_role=link_role,
|
|
194
|
+
json_output=json_output,
|
|
195
|
+
update=lambda client, parsed: client.artifacts.update_access(
|
|
196
|
+
artifact_id,
|
|
197
|
+
share=parsed.share,
|
|
198
|
+
remove=parsed.remove,
|
|
199
|
+
link=parsed.link,
|
|
200
|
+
),
|
|
201
|
+
set_password=set_password,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _set_artifact_password(client: Gumloop, *, artifact_id: str, password: str) -> ArtifactPasswordResponse:
|
|
206
|
+
return client.artifacts.set_password(artifact_id, password)
|
|
@@ -8,6 +8,16 @@ import typer
|
|
|
8
8
|
from rich.markup import escape as escape_markup
|
|
9
9
|
|
|
10
10
|
from gumloop import GumloopError
|
|
11
|
+
from gumloop.cli.commands._item_access import apply_item_access
|
|
12
|
+
from gumloop.cli.commands._item_access import json_option
|
|
13
|
+
from gumloop.cli.commands._item_access import link_option
|
|
14
|
+
from gumloop.cli.commands._item_access import link_role_option
|
|
15
|
+
from gumloop.cli.commands._item_access import organization_option
|
|
16
|
+
from gumloop.cli.commands._item_access import remove_option
|
|
17
|
+
from gumloop.cli.commands._item_access import remove_team_option
|
|
18
|
+
from gumloop.cli.commands._item_access import share_option
|
|
19
|
+
from gumloop.cli.commands._item_access import share_team_option
|
|
20
|
+
from gumloop.cli.commands._item_access import show_item_access
|
|
11
21
|
from gumloop.cli.console import console
|
|
12
22
|
from gumloop.cli.console import print_json
|
|
13
23
|
from gumloop.cli.context import CliContext
|
|
@@ -15,7 +25,9 @@ from gumloop.cli.errors import exit_with_error
|
|
|
15
25
|
from gumloop.types import SessionResponse
|
|
16
26
|
|
|
17
27
|
sessions_app = typer.Typer(
|
|
18
|
-
help="Create, inspect, and
|
|
28
|
+
help="Create, inspect, continue, and share Gumloop agent sessions.",
|
|
29
|
+
no_args_is_help=True,
|
|
30
|
+
rich_markup_mode="rich",
|
|
19
31
|
)
|
|
20
32
|
|
|
21
33
|
|
|
@@ -350,3 +362,53 @@ def cancel_session(
|
|
|
350
362
|
return
|
|
351
363
|
|
|
352
364
|
console.print(f"[green]Cancelled[/green] session {session_id}")
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
@sessions_app.command("access", epilog="Example:\n gumloop sessions access session_abc --json")
|
|
368
|
+
def session_access(
|
|
369
|
+
ctx: typer.Context,
|
|
370
|
+
session_id: Annotated[str, typer.Argument(help="Session id.")],
|
|
371
|
+
json_output: Annotated[bool, json_option()] = False,
|
|
372
|
+
) -> None:
|
|
373
|
+
"""Show who can access a session."""
|
|
374
|
+
show_item_access(
|
|
375
|
+
ctx,
|
|
376
|
+
json_output=json_output,
|
|
377
|
+
read=lambda client: client.sessions.get_access(session_id),
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
@sessions_app.command(
|
|
382
|
+
"set-access",
|
|
383
|
+
epilog="Example:\n gumloop sessions set-access session_abc --share ada@example.com:viewer --link anyone",
|
|
384
|
+
)
|
|
385
|
+
def set_session_access(
|
|
386
|
+
ctx: typer.Context,
|
|
387
|
+
session_id: Annotated[str, typer.Argument(help="Session id.")],
|
|
388
|
+
share: Annotated[list[str] | None, share_option()] = None,
|
|
389
|
+
remove: Annotated[list[str] | None, remove_option()] = None,
|
|
390
|
+
share_team: Annotated[list[str] | None, share_team_option()] = None,
|
|
391
|
+
remove_team: Annotated[list[str] | None, remove_team_option()] = None,
|
|
392
|
+
organization: Annotated[str | None, organization_option()] = None,
|
|
393
|
+
link: Annotated[str | None, link_option()] = None,
|
|
394
|
+
link_role: Annotated[str | None, link_role_option()] = None,
|
|
395
|
+
json_output: Annotated[bool, json_option()] = False,
|
|
396
|
+
) -> None:
|
|
397
|
+
"""Change who can access a session."""
|
|
398
|
+
apply_item_access(
|
|
399
|
+
ctx,
|
|
400
|
+
share=share,
|
|
401
|
+
remove=remove,
|
|
402
|
+
share_team=share_team,
|
|
403
|
+
remove_team=remove_team,
|
|
404
|
+
organization=organization,
|
|
405
|
+
link=link,
|
|
406
|
+
link_role=link_role,
|
|
407
|
+
json_output=json_output,
|
|
408
|
+
update=lambda client, parsed: client.sessions.update_access(
|
|
409
|
+
session_id,
|
|
410
|
+
share=parsed.share,
|
|
411
|
+
remove=parsed.remove,
|
|
412
|
+
link=parsed.link,
|
|
413
|
+
),
|
|
414
|
+
)
|
|
@@ -8,13 +8,23 @@ from rich.markup import escape as escape_markup
|
|
|
8
8
|
|
|
9
9
|
from gumloop import GumloopError
|
|
10
10
|
from gumloop.cli.commands._downloads import download_response
|
|
11
|
+
from gumloop.cli.commands._item_access import apply_item_access
|
|
12
|
+
from gumloop.cli.commands._item_access import json_option
|
|
13
|
+
from gumloop.cli.commands._item_access import link_option
|
|
14
|
+
from gumloop.cli.commands._item_access import link_role_option
|
|
15
|
+
from gumloop.cli.commands._item_access import organization_option
|
|
16
|
+
from gumloop.cli.commands._item_access import remove_option
|
|
17
|
+
from gumloop.cli.commands._item_access import remove_team_option
|
|
18
|
+
from gumloop.cli.commands._item_access import share_option
|
|
19
|
+
from gumloop.cli.commands._item_access import share_team_option
|
|
20
|
+
from gumloop.cli.commands._item_access import show_item_access
|
|
11
21
|
from gumloop.cli.console import console
|
|
12
22
|
from gumloop.cli.console import print_json
|
|
13
23
|
from gumloop.cli.context import CliContext
|
|
14
24
|
from gumloop.cli.errors import exit_with_error
|
|
15
25
|
from gumloop.resources.skills import SkillFile
|
|
16
26
|
|
|
17
|
-
skills_app = typer.Typer(help="Manage Gumloop skills.", no_args_is_help=True, rich_markup_mode="rich")
|
|
27
|
+
skills_app = typer.Typer(help="Manage and share Gumloop skills.", no_args_is_help=True, rich_markup_mode="rich")
|
|
18
28
|
|
|
19
29
|
|
|
20
30
|
@skills_app.command(
|
|
@@ -246,3 +256,53 @@ def download_skill(
|
|
|
246
256
|
if result["path"] is None:
|
|
247
257
|
return
|
|
248
258
|
console.print(f"[green]Saved[/green] {result['path']} ({result['bytes']} bytes)")
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
@skills_app.command("access", epilog="Example:\n gumloop skills access skill_abc --json")
|
|
262
|
+
def skill_access(
|
|
263
|
+
ctx: typer.Context,
|
|
264
|
+
skill_id: Annotated[str, typer.Argument(help="Skill id.")],
|
|
265
|
+
json_output: Annotated[bool, json_option()] = False,
|
|
266
|
+
) -> None:
|
|
267
|
+
"""Show who can access a skill."""
|
|
268
|
+
show_item_access(
|
|
269
|
+
ctx,
|
|
270
|
+
json_output=json_output,
|
|
271
|
+
read=lambda client: client.skills.get_access(skill_id),
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
@skills_app.command(
|
|
276
|
+
"set-access",
|
|
277
|
+
epilog="Example:\n gumloop skills set-access skill_abc --share ada@example.com:editor --organization viewer",
|
|
278
|
+
)
|
|
279
|
+
def set_skill_access(
|
|
280
|
+
ctx: typer.Context,
|
|
281
|
+
skill_id: Annotated[str, typer.Argument(help="Skill id.")],
|
|
282
|
+
share: Annotated[list[str] | None, share_option()] = None,
|
|
283
|
+
remove: Annotated[list[str] | None, remove_option()] = None,
|
|
284
|
+
share_team: Annotated[list[str] | None, share_team_option()] = None,
|
|
285
|
+
remove_team: Annotated[list[str] | None, remove_team_option()] = None,
|
|
286
|
+
organization: Annotated[str | None, organization_option()] = None,
|
|
287
|
+
link: Annotated[str | None, link_option()] = None,
|
|
288
|
+
link_role: Annotated[str | None, link_role_option()] = None,
|
|
289
|
+
json_output: Annotated[bool, json_option()] = False,
|
|
290
|
+
) -> None:
|
|
291
|
+
"""Change who can access a skill."""
|
|
292
|
+
apply_item_access(
|
|
293
|
+
ctx,
|
|
294
|
+
share=share,
|
|
295
|
+
remove=remove,
|
|
296
|
+
share_team=share_team,
|
|
297
|
+
remove_team=remove_team,
|
|
298
|
+
organization=organization,
|
|
299
|
+
link=link,
|
|
300
|
+
link_role=link_role,
|
|
301
|
+
json_output=json_output,
|
|
302
|
+
update=lambda client, parsed: client.skills.update_access(
|
|
303
|
+
skill_id,
|
|
304
|
+
share=parsed.share,
|
|
305
|
+
remove=parsed.remove,
|
|
306
|
+
link=parsed.link,
|
|
307
|
+
),
|
|
308
|
+
)
|
|
@@ -57,6 +57,11 @@ gumloop sessions get <session_id> [--json] # --json returns the full tr
|
|
|
57
57
|
gumloop sessions send <session_id> [--input text | --input-stdin -] [--json]
|
|
58
58
|
gumloop sessions rename <session_id> <name>
|
|
59
59
|
gumloop sessions cancel <session_id>
|
|
60
|
+
gumloop sessions access <session_id> [--json]
|
|
61
|
+
gumloop sessions set-access <session_id>
|
|
62
|
+
[--share email:role]... [--remove email]...
|
|
63
|
+
[--share-team team_id:role]... [--remove-team team_id]...
|
|
64
|
+
[--organization role|none] [--link none|anyone|password] [--link-role role] [--json]
|
|
60
65
|
```
|
|
61
66
|
|
|
62
67
|
`--name` sets the name shown in the sidebar; without it the session keeps the agent's name until renamed. `list --search` matches session names (and message content), so named sessions are findable by name.
|
|
@@ -105,6 +110,11 @@ gumloop skills create <file>... [--json]
|
|
|
105
110
|
gumloop skills update <skill_id> <file>... [--json] # full replace of all files
|
|
106
111
|
gumloop skills delete <skill_id> [--json]
|
|
107
112
|
gumloop skills download <skill_id> [-o path|-] [--version-id v] [--json]
|
|
113
|
+
gumloop skills access <skill_id> [--json]
|
|
114
|
+
gumloop skills set-access <skill_id>
|
|
115
|
+
[--share email:role]... [--remove email]...
|
|
116
|
+
[--share-team team_id:role]... [--remove-team team_id]...
|
|
117
|
+
[--organization role|none] [--link none|anyone|password] [--link-role role] [--json]
|
|
108
118
|
```
|
|
109
119
|
|
|
110
120
|
## Artifacts
|
|
@@ -112,8 +122,16 @@ gumloop skills download <skill_id> [-o path|-] [--version-id v] [--json]
|
|
|
112
122
|
```bash
|
|
113
123
|
gumloop artifacts list <agent_id> [--session id] [--limit n] [--cursor c] [--json]
|
|
114
124
|
gumloop artifacts download <artifact_id> [-o path|-] [--version-id v] [--json]
|
|
125
|
+
gumloop artifacts access <artifact_id> [--json]
|
|
126
|
+
gumloop artifacts set-access <artifact_id>
|
|
127
|
+
[--share email:role]... [--remove email]...
|
|
128
|
+
[--share-team team_id:role]... [--remove-team team_id]...
|
|
129
|
+
[--organization role|none] [--link none|anyone|password] [--link-role role]
|
|
130
|
+
[--password-stdin] [--json]
|
|
115
131
|
```
|
|
116
132
|
|
|
133
|
+
`artifacts set-access --password-stdin` reads the link password from stdin and sets it before the access change. `--link password` only works after a password is stored.
|
|
134
|
+
|
|
117
135
|
## Skill sync
|
|
118
136
|
|
|
119
137
|
```bash
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from collections.abc import Sequence
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def item_access_body(
|
|
9
|
+
*,
|
|
10
|
+
share: Sequence[Mapping[str, Any]] | None,
|
|
11
|
+
remove: Sequence[Mapping[str, Any]] | None,
|
|
12
|
+
link: Mapping[str, Any] | None,
|
|
13
|
+
) -> dict[str, Any]:
|
|
14
|
+
body: dict[str, Any] = {}
|
|
15
|
+
if share is not None:
|
|
16
|
+
body["share"] = list(share)
|
|
17
|
+
if remove is not None:
|
|
18
|
+
body["remove"] = list(remove)
|
|
19
|
+
if link is not None:
|
|
20
|
+
body["link"] = dict(link)
|
|
21
|
+
return body
|