@palettelab/cli 0.3.73 → 0.3.75

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. package/README.md +50 -15
  2. package/backend-sdk/palette_sdk/__init__.py +1 -1
  3. package/backend-sdk/palette_sdk/connections_generated.py +26 -0
  4. package/backend-sdk/palette_sdk/platform_services.py +73 -1
  5. package/backend-sdk/palette_sdk/plugin_context.py +8 -2
  6. package/backend-sdk/pyproject.toml +1 -1
  7. package/docs/python-backend-sdk.md +35 -11
  8. package/lib/acp.js +227 -25
  9. package/lib/agent-client.js +56 -27
  10. package/lib/cli.js +1 -0
  11. package/lib/commands/agent.js +145 -50
  12. package/lib/commands/dev.js +19 -2
  13. package/lib/connection-catalog.json +132 -0
  14. package/lib/dev-simulator.js +29 -14
  15. package/package.json +1 -1
  16. package/template-fallback/backend/pytest.ini +3 -0
  17. package/template-fallback/backend/tests/test_import.py +4 -8
  18. package/template-fallback/package.json +1 -1
  19. package/template-fallback/pyproject.toml +5 -0
  20. package/template-fallback/templates/consumer-app/package.json +1 -1
  21. package/template-fallback/templates/dashboard/package.json +1 -1
  22. package/template-fallback/templates/database/package.json +1 -1
  23. package/template-fallback/templates/external-service/backend/api/main.py +7 -6
  24. package/template-fallback/templates/external-service/package.json +1 -1
  25. package/template-fallback/templates/external-service/palette-plugin.json +7 -0
  26. package/template-fallback/templates/frontend-only/package.json +1 -1
  27. package/template-fallback/templates/next/package.json +1 -1
  28. package/template-fallback/templates/palette-app/package.json +1 -1
  29. package/template-fallback/templates/provider-app/package.json +1 -1
@@ -1,11 +1,7 @@
1
- import importlib.util
2
- from pathlib import Path
1
+ # pytest.ini puts backend/api on the import path, as the platform loader does.
3
2
 
4
3
 
5
4
  def test_backend_entry_exports_router():
6
- entry = Path(__file__).resolve().parents[1] / "api" / "main.py"
7
- spec = importlib.util.spec_from_file_location("plugin_backend_entry", entry)
8
- assert spec and spec.loader
9
- module = importlib.util.module_from_spec(spec)
10
- spec.loader.exec_module(module)
11
- assert getattr(module, "router", None) is not None
5
+ from main import router
6
+
7
+ assert router is not None
@@ -4,7 +4,7 @@
4
4
  "private": true,
5
5
  "description": "A Palette platform plugin",
6
6
  "dependencies": {
7
- "@palettelab/sdk": "^0.1.38"
7
+ "@palettelab/sdk": "^0.1.39"
8
8
  },
9
9
  "devDependencies": {
10
10
  "typescript": "^5.0.0",
@@ -17,3 +17,8 @@ dependencies = [
17
17
  # `pltt test` ships the backend SDK on PYTHONPATH. Pin a released
18
18
  # palette-sdk package here only if you run backend tests outside the CLI.
19
19
  ]
20
+
21
+ [tool.pytest.ini_options]
22
+ # The backend entry's folder is on the import path, as the platform loader puts it (backend/pytest.ini does the same
23
+ # for runs from backend/): backend/tests import `main` directly.
24
+ pythonpath = ["backend/api"]
@@ -2,7 +2,7 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@palettelab/sdk": "^0.1.38",
5
+ "@palettelab/sdk": "^0.1.39",
6
6
  "react": "^19.0.0",
7
7
  "react-dom": "^19.0.0"
8
8
  }
@@ -3,7 +3,7 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@palettelab/sdk": "^0.1.38",
6
+ "@palettelab/sdk": "^0.1.39",
7
7
  "react": "^19.0.0"
8
8
  }
9
9
  }
@@ -2,5 +2,5 @@
2
2
  "name": "my-db-plugin",
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
- "dependencies": { "@palettelab/sdk": "^0.1.38", "react": "^19.0.0" }
5
+ "dependencies": { "@palettelab/sdk": "^0.1.39", "react": "^19.0.0" }
6
6
  }
@@ -1,12 +1,12 @@
1
1
  """External-service plugin backend.
2
2
 
3
- Reads a per-org config token (set when the org installs the plugin) and
4
- forwards a request to a declared external host. The host MUST be listed
5
- in capabilities.external_network in the manifest — the platform enforces
6
- the allowlist at runtime.
3
+ Reads a per-org API token (the install-scoped EXAMPLE_API_TOKEN secret the
4
+ manifest declares, set when the org installs the plugin) and forwards a
5
+ request to a declared external host. The host MUST be listed in
6
+ capabilities.external_network in the manifest — the platform enforces the
7
+ allowlist at runtime.
7
8
  """
8
9
 
9
- import os
10
10
  from fastapi import Depends, HTTPException
11
11
 
12
12
  from palette_sdk import PluginRouter, PluginContext, get_plugin_context, require_permission
@@ -21,7 +21,8 @@ async def proxy(ctx: PluginContext = Depends(get_plugin_context)) -> dict:
21
21
  import httpx
22
22
 
23
23
  connection = await ctx.connections.status("example_oauth")
24
- token = os.environ.get("EXAMPLE_API_TOKEN")
24
+ # Declared secrets come from the install's config, never the server's environment.
25
+ token = ctx.secret("EXAMPLE_API_TOKEN")
25
26
  if not token:
26
27
  raise HTTPException(status_code=500, detail="EXAMPLE_API_TOKEN not configured")
27
28
  async with httpx.AsyncClient() as client:
@@ -2,5 +2,5 @@
2
2
  "name": "my-external-svc",
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
- "dependencies": { "@palettelab/sdk": "^0.1.38", "react": "^19.0.0" }
5
+ "dependencies": { "@palettelab/sdk": "^0.1.39", "react": "^19.0.0" }
6
6
  }
@@ -24,6 +24,13 @@
24
24
  "frontend": { "entry": "./frontend/src/index.tsx", "sandbox": true },
25
25
  "backend": { "entry": "./backend/api/main.py" },
26
26
  "permissions": ["resources:read"],
27
+ "secrets": {
28
+ "EXAMPLE_API_TOKEN": {
29
+ "scope": "install",
30
+ "required": false,
31
+ "help": "API token for api.example.com, entered by the installing organization."
32
+ }
33
+ },
27
34
  "connections": [
28
35
  {
29
36
  "id": "example_oauth",
@@ -3,7 +3,7 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@palettelab/sdk": "^0.1.38",
6
+ "@palettelab/sdk": "^0.1.39",
7
7
  "react": "^19.0.0"
8
8
  }
9
9
  }
@@ -3,7 +3,7 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@palettelab/sdk": "^0.1.38",
6
+ "@palettelab/sdk": "^0.1.39",
7
7
  "react": "^19.0.0"
8
8
  },
9
9
  "devDependencies": {
@@ -3,7 +3,7 @@
3
3
  "version": "1.0.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@palettelab/sdk": "^0.1.38",
6
+ "@palettelab/sdk": "^0.1.39",
7
7
  "react": "^19.0.0"
8
8
  },
9
9
  "devDependencies": {
@@ -2,7 +2,7 @@
2
2
  "private": true,
3
3
  "type": "module",
4
4
  "dependencies": {
5
- "@palettelab/sdk": "^0.1.38",
5
+ "@palettelab/sdk": "^0.1.39",
6
6
  "react": "^19.0.0"
7
7
  }
8
8
  }