@palettelab/cli 0.3.76 → 0.3.77
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.
- package/README.md +36 -4
- package/backend-sdk/palette_sdk/__init__.py +1 -1
- package/backend-sdk/palette_sdk/agent_routes.py +28 -2
- package/backend-sdk/palette_sdk/apps.py +16 -1
- package/backend-sdk/palette_sdk/connections_generated.py +27 -0
- package/backend-sdk/palette_sdk/data_rooms.py +59 -0
- package/backend-sdk/palette_sdk/manifest.py +10 -0
- package/backend-sdk/palette_sdk/mcp.py +11 -2
- package/backend-sdk/palette_sdk/tool_definition.py +21 -1
- package/backend-sdk/pyproject.toml +1 -1
- package/docs/connectors.md +154 -0
- package/docs/python-backend-sdk.md +106 -4
- package/lib/bundler.js +5 -2
- package/lib/cli.js +2 -2
- package/lib/commands/capabilities.js +30 -9
- package/lib/commands/check.js +7 -0
- package/lib/commands/package.js +5 -1
- package/lib/commands/publish.js +17 -0
- package/lib/commands/test.js +15 -3
- package/lib/connection-catalog.json +167 -0
- package/lib/connector.js +148 -0
- package/lib/manifest.js +22 -1
- package/package.json +1 -1
- package/template-fallback/backend/api/main.py +4 -2
- package/template-fallback/backend/tools/example_tool.py +4 -0
- package/template-fallback/package.json +1 -1
- package/template-fallback/palette-plugin.json +4 -0
- package/template-fallback/templates/agent-tool/README.md +3 -0
- package/template-fallback/templates/agent-tool/palette-plugin.json +4 -0
- package/template-fallback/templates/agent-tool/skills/echo-check/SKILL.md +15 -0
- package/template-fallback/templates/consumer-app/backend/api/main.py +3 -2
- package/template-fallback/templates/consumer-app/package.json +1 -1
- package/template-fallback/templates/consumer-app/palette-plugin.json +4 -0
- package/template-fallback/templates/dashboard/backend/api/main.py +2 -2
- package/template-fallback/templates/dashboard/package.json +1 -1
- package/template-fallback/templates/dashboard/palette-plugin.json +4 -0
- package/template-fallback/templates/database/backend/api/main.py +3 -3
- package/template-fallback/templates/database/package.json +1 -1
- package/template-fallback/templates/database/palette-plugin.json +4 -0
- package/template-fallback/templates/external-service/backend/api/main.py +3 -2
- package/template-fallback/templates/external-service/package.json +1 -1
- package/template-fallback/templates/external-service/palette-plugin.json +4 -0
- package/template-fallback/templates/frontend-only/package.json +1 -1
- package/template-fallback/templates/frontend-only/palette-plugin.json +4 -0
- package/template-fallback/templates/next/package.json +1 -1
- package/template-fallback/templates/next/palette-plugin.json +4 -0
- package/template-fallback/templates/palette-app/backend/api/main.py +2 -2
- package/template-fallback/templates/palette-app/package.json +1 -1
- package/template-fallback/templates/palette-app/palette-plugin.json +4 -0
- package/template-fallback/templates/provider-app/backend/api/main.py +2 -2
- package/template-fallback/templates/provider-app/package.json +1 -1
- package/template-fallback/templates/provider-app/palette-plugin.json +5 -0
|
@@ -159,13 +159,14 @@ These are the public Python helpers exported by `palette_sdk`.
|
|
|
159
159
|
| `PluginContext`, `get_plugin_context` | Authenticated request context dependency |
|
|
160
160
|
| `MissingSecretError` | Handling missing required declared secrets from `ctx.secret(...)` |
|
|
161
161
|
| `require_permission(permission)` | Route-level permission gate required for protected routes |
|
|
162
|
+
| `agent_route(use, name=, description=, opens=)` | Say how assistants may use a route: `read`, `write` or `hidden` (see 5a) |
|
|
162
163
|
| `KNOWN_PERMISSIONS`, `is_known_permission(...)` | Permission vocabulary checks for manifests/tools |
|
|
163
|
-
| `DataRoomsClient`, `ctx.data_rooms` | Backend Data Room room/folder/file helpers |
|
|
164
|
+
| `DataRoomsClient`, `ctx.data_rooms` | Backend Data Room room/folder/file and share-link helpers |
|
|
164
165
|
| `OrganizationMembersClient`, `ctx.members` | Current-organization member lookup, invite, and role helpers |
|
|
165
166
|
| `NotificationsClient`, `ctx.notifications` | Push notifications into the OS notification center |
|
|
166
167
|
| `TalkClient`, `ctx.talk` | Post into Talk channels the app's agent is seated in |
|
|
167
168
|
| `PluginConnectionsClient`, `ConnectionStatus`, `MissingConnectionError`, `ctx.connections` | Third-party connection status and tool calls (there is no token accessor — the platform holds the credential) |
|
|
168
|
-
| `AppInteropClient`, `AppServiceClient`, `MissingAppServiceError`, `ctx.apps` | Call required apps/services without direct database access |
|
|
169
|
+
| `AppInteropClient`, `AppServiceClient`, `MissingAppServiceError`, `ctx.apps` | Call required apps/services without direct database access. The path-style `ctx.apps.call(app_id, path)` is deprecated; use `services(ctx).call("namespace/version#method", payload)` |
|
|
169
170
|
| `service(...)`, `services(ctx)`, `ServicesClient`, `BrokerCallError` | Provide and consume OS-broker service methods/events |
|
|
170
171
|
| `OrgRepository`, `ctx.repo(Model)` | Org-safe convenience CRUD for app-owned models |
|
|
171
172
|
| `PluginBase`, `OrgScopedTable` | SQLAlchemy declarative bases for plugin-owned tables |
|
|
@@ -175,14 +176,14 @@ These are the public Python helpers exported by `palette_sdk`.
|
|
|
175
176
|
| `ctx.llm`, `ctx.media`, `ctx.web`, `ctx.email` | The platform's model, fal.ai, web-search and email-provider keys, declared in `platform_services` |
|
|
176
177
|
| `MediaStillRunning` | `ctx.media.run` gave up waiting; carries `request_id` to collect the render later |
|
|
177
178
|
| `LocalLLMService`, `LocalMediaService`, `LocalWebService`, `LocalEmailService`, `LocalRedisService`, `LocalVectorService`, `LocalStorageService` | Local `pltt dev` service emulators and test fakes |
|
|
178
|
-
| `McpClient`, `mcp_tool(...)`, `mcp_resource(...)`, `mcp_prompt(...)` | Provide and consume MCP tools
|
|
179
|
+
| `McpClient`, `mcp_tool(...)`, `mcp_resource(...)`, `mcp_prompt(...)` | Provide and consume MCP tools. `mcp_resource` and `mcp_prompt` are inert: recorded, not served |
|
|
179
180
|
| `PlatformServiceUnavailable`, `UnavailablePlatformService` | Clear errors when an undeclared platform service is used |
|
|
180
181
|
| `LifecycleHooks` | Install/update/enable/disable/uninstall callbacks |
|
|
181
182
|
| `Event`, `EventPublisher`, `subscribe_event(...)` | In-process event subscriptions and declared app event publishing |
|
|
182
183
|
| `job(...)`, `JobExecution` | Register durable async job handlers and report progress, heartbeat, or cancellation |
|
|
183
184
|
| `JobHandle`, `JobsClient`, `ctx.jobs` | Enqueue jobs and inspect or cancel runs without retaining request state |
|
|
184
185
|
| `sign_webhook(...)`, `verify_webhook_signature(...)` | HMAC-SHA256 webhook signing and verification |
|
|
185
|
-
| `ToolDefinition` |
|
|
186
|
+
| `ToolDefinition` | Deprecated base class for custom agent tools; use `@capability(...)` with an `agent_exposable` `provides.services` method |
|
|
186
187
|
| `PluginManifest`, `load_manifest(...)` | Typed manifest parsing from `palette-plugin.json` |
|
|
187
188
|
| `SuccessResponse`, `ErrorResponse`, `PaginatedResponse` | Common response schemas for plugin APIs |
|
|
188
189
|
| `route_permission_issues(router, public_routes=None)` | Test helper that reports routes missing `require_permission(...)` |
|
|
@@ -390,6 +391,52 @@ async def invite_member(email: str, ctx: PluginContext = Depends(get_plugin_cont
|
|
|
390
391
|
`invite(email, role="member")`, and `update_role(user_id, role)`. Member
|
|
391
392
|
deletion/removal is intentionally not exposed through the app SDK.
|
|
392
393
|
|
|
394
|
+
## 5a. Routes The Agent Can Use
|
|
395
|
+
|
|
396
|
+
Your routes are tools for assistants and for your app's own agent: the platform calls them in-process as the member,
|
|
397
|
+
through the same `require_permission` checks and data partition as your screens. What an assistant sees is each
|
|
398
|
+
route's path, query parameters, request model and the first line of its docstring, so write those for a reader. Say
|
|
399
|
+
how each route may be used with `agent_route(...)` in `openapi_extra`:
|
|
400
|
+
|
|
401
|
+
```python
|
|
402
|
+
from palette_sdk import agent_route
|
|
403
|
+
|
|
404
|
+
@router.get("/notes", dependencies=[require_permission("resources:read")],
|
|
405
|
+
openapi_extra=agent_route("read"))
|
|
406
|
+
async def list_notes(q: str = "", ctx: PluginContext = Depends(get_plugin_context)):
|
|
407
|
+
"""List my notes, newest first; q searches title and body."""
|
|
408
|
+
|
|
409
|
+
@router.post("/notes/search", dependencies=[require_permission("resources:read")],
|
|
410
|
+
openapi_extra=agent_route("read", name="search_notes",
|
|
411
|
+
description="Search my notes by title and body."))
|
|
412
|
+
async def search(...): ...
|
|
413
|
+
|
|
414
|
+
@router.get("/notes/{note_id}", dependencies=[require_permission("resources:read")],
|
|
415
|
+
openapi_extra=agent_route("read", opens="/notes/{note_id}"))
|
|
416
|
+
async def get_note(note_id: int, ctx: PluginContext = Depends(get_plugin_context)): ...
|
|
417
|
+
|
|
418
|
+
@router.post("/admin/reindex", dependencies=[require_permission("resources:write")],
|
|
419
|
+
openapi_extra=agent_route("hidden"))
|
|
420
|
+
async def reindex(...): ...
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
| Argument | Meaning |
|
|
424
|
+
|---|---|
|
|
425
|
+
| `use` | `"read"` runs at once; `"write"` is a change, staged as an approval card before it runs; `"hidden"` is never offered |
|
|
426
|
+
| `name` | The tool's stable name instead of one built from the path: lowercase letters, digits and underscores, at most 64 characters |
|
|
427
|
+
| `description` | What an assistant reads to choose the tool, instead of the docstring: 1 to 500 characters |
|
|
428
|
+
| `opens` | On a route that reads one item, where the item lives in your screens: `"/notes/{note_id}"` or `"?note={note_id}"`, with the route's own path parameters |
|
|
429
|
+
|
|
430
|
+
A bad value raises `ValueError` when the module loads. A route with no mark is still offered, a `GET` as a read and
|
|
431
|
+
anything else as a change, and `pltt check` warns about it (`connector.route_unmarked`); `include_in_schema=False`
|
|
432
|
+
hides a route too. Keep `name` the same between versions: a member's per-tool switches and permission rules are keyed
|
|
433
|
+
by it. With `opens`, a card for the item opens your app at `/apps/<your app id>/notes/42` and your app receives
|
|
434
|
+
`/notes/42` as `platform.routePath`. A file response (`Content-Disposition: attachment`) is attached to the agent's
|
|
435
|
+
reply, and an upload route accepts a file the member attached in the conversation.
|
|
436
|
+
|
|
437
|
+
Routes are one part of your app as a connector; the `agent` block, typed capabilities, skills and event triggers are
|
|
438
|
+
in [Your App As A Connector](./connectors.md).
|
|
439
|
+
|
|
393
440
|
## 6. App-Owned Data
|
|
394
441
|
|
|
395
442
|
Apps can ship their own tables and migrations. Use `OrgScopedTable` for data
|
|
@@ -717,6 +764,57 @@ async def room_contents(ctx: PluginContext = Depends(get_plugin_context)):
|
|
|
717
764
|
return contents
|
|
718
765
|
```
|
|
719
766
|
|
|
767
|
+
### Share A File Or Folder Outside The Workspace
|
|
768
|
+
|
|
769
|
+
Share a file, a folder or the whole room with people outside the workspace
|
|
770
|
+
through a link, `{frontend}/l/{token}`. The call acts as the member making the
|
|
771
|
+
request, who needs edit permission on the room (or to own it). With no gate
|
|
772
|
+
set, anyone holding the link opens it without signing in to Palette, so pick
|
|
773
|
+
the gates the content needs:
|
|
774
|
+
|
|
775
|
+
```python
|
|
776
|
+
from datetime import datetime, timedelta, timezone
|
|
777
|
+
|
|
778
|
+
@router.post("/share-report", dependencies=[require_permission("data_rooms:write")])
|
|
779
|
+
async def share_report(ctx: PluginContext = Depends(get_plugin_context)):
|
|
780
|
+
room = await ctx.data_rooms.require_room_by_name("Finance")
|
|
781
|
+
f = await ctx.data_rooms.find_file_by_name(room["id"], "q3-report.pdf")
|
|
782
|
+
link = await ctx.data_rooms.create_link(
|
|
783
|
+
room["id"],
|
|
784
|
+
file_id=f["id"], # folder_id=... for a folder; neither for the whole room
|
|
785
|
+
verify_email=True, # a 6-digit code mailed to the viewer proves the address
|
|
786
|
+
allowed_viewers=["@acme.com"], # addresses or @domains
|
|
787
|
+
allow_download=False,
|
|
788
|
+
expires_at=datetime.now(timezone.utc) + timedelta(days=14),
|
|
789
|
+
)
|
|
790
|
+
return {"url": link["url"]}
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
Settings, all optional:
|
|
794
|
+
|
|
795
|
+
- `name`: your label for the link (at most 120 characters), never shown to viewers.
|
|
796
|
+
- `require_login`: the viewer signs in to Palette OS; their account's email is their identity.
|
|
797
|
+
- `require_email`: the viewer enters their email.
|
|
798
|
+
- `verify_email`: the email is proven by a 6-digit code mailed to it (implies `require_email`).
|
|
799
|
+
- `allowed_viewers`: only these addresses (`"ann@acme.com"`) or domains (`"@acme.com"`), at most 100 (implies `require_email`).
|
|
800
|
+
- `password`: 4 to 128 characters, stored hashed and never returned (a link carries `has_password`).
|
|
801
|
+
- `allow_download`: default `True`; when `False`, downloads are refused and the viewer page shows no download button.
|
|
802
|
+
- `notify_on_view`: email the sharer when someone opens the link, at most once an hour per viewer.
|
|
803
|
+
- `watermark`: the viewer's email and the time over the content.
|
|
804
|
+
- `screenshot_protection`: the page blurs when its window loses focus and blocks printing and right-click (deterrence only).
|
|
805
|
+
- `agreement`: text, such as an NDA, the viewer must accept first (at most 10,000 characters).
|
|
806
|
+
- `expires_at`: a `datetime` or ISO string in the future; afterwards the link answers "expired".
|
|
807
|
+
|
|
808
|
+
A link is a dict with `id`, `url`, `token`, `target` (`"file"`, `"folder"` or
|
|
809
|
+
`"room"`), `target_name`, the settings above except `password`, `has_password`, `expired`,
|
|
810
|
+
`view_count`, `last_viewed_at`, `created_by`, `created_by_name` and
|
|
811
|
+
`created_at`. `list_links(room_id)` returns the room's links, newest first
|
|
812
|
+
(`file_id=` or `folder_id=` keeps one item's). `update_link(room_id, link_id,
|
|
813
|
+
**changes)` changes only the keys passed; `None` removes a password, an
|
|
814
|
+
agreement or an expiry. `delete_link(room_id, link_id)` stops the link at once.
|
|
815
|
+
Unknown keys are refused. On a platform without share links the helpers raise
|
|
816
|
+
`RuntimeError`.
|
|
817
|
+
|
|
720
818
|
Available Data Room helpers:
|
|
721
819
|
|
|
722
820
|
```python
|
|
@@ -755,6 +853,10 @@ await ctx.data_rooms.upload_file(
|
|
|
755
853
|
content_type=None,
|
|
756
854
|
public=False, # True: every member of the organisation can read it
|
|
757
855
|
)
|
|
856
|
+
await ctx.data_rooms.list_links(room_id, file_id=None, folder_id=None)
|
|
857
|
+
await ctx.data_rooms.create_link(room_id, file_id=None, folder_id=None, **settings)
|
|
858
|
+
await ctx.data_rooms.update_link(room_id, link_id, **changes)
|
|
859
|
+
await ctx.data_rooms.delete_link(room_id, link_id)
|
|
758
860
|
```
|
|
759
861
|
|
|
760
862
|
Uploads are private to the room's members. With `public=True` every member of
|
package/lib/bundler.js
CHANGED
|
@@ -690,8 +690,11 @@ async function bundleBackend(pluginDir, options = {}) {
|
|
|
690
690
|
|
|
691
691
|
const backendDir = path.join(pluginDir, "backend")
|
|
692
692
|
if (fs.existsSync(backendDir)) copy(backendDir, path.join(stage, "backend"))
|
|
693
|
-
|
|
694
|
-
|
|
693
|
+
// schemas/ are the broker contracts; skills/ are the app's recipes for assistants, reviewed at publish.
|
|
694
|
+
for (const folder of ["schemas", "skills"]) {
|
|
695
|
+
const dir = path.join(pluginDir, folder)
|
|
696
|
+
if (fs.existsSync(dir)) copy(dir, path.join(stage, folder))
|
|
697
|
+
}
|
|
695
698
|
for (const metadataFile of ["package.json", "pyproject.toml", "palette-plugin.json"]) {
|
|
696
699
|
if (metadataFile === "palette-plugin.json" && options.manifest) continue
|
|
697
700
|
const src = path.join(pluginDir, metadataFile)
|
package/lib/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ const COMMANDS = {
|
|
|
92
92
|
},
|
|
93
93
|
capabilities: {
|
|
94
94
|
run: capabilities,
|
|
95
|
-
help: "
|
|
95
|
+
help: "Show the app as a connector (tools, instructions, skills, events); add or inspect capabilities",
|
|
96
96
|
},
|
|
97
97
|
agent: {
|
|
98
98
|
run: agent,
|
|
@@ -143,7 +143,7 @@ function printHelp() {
|
|
|
143
143
|
console.log(" pltt services pull # generate typed TS+Python clients from consumes")
|
|
144
144
|
console.log(" pltt services scaffold NAME # add a provider method (schemas + handler stub)")
|
|
145
145
|
console.log("\nAgent capabilities:")
|
|
146
|
-
console.log(" pltt capabilities list")
|
|
146
|
+
console.log(" pltt capabilities list # the connector as an assistant will see it")
|
|
147
147
|
console.log(" pltt capabilities inspect CAPABILITY_ID")
|
|
148
148
|
console.log(" pltt capabilities add creative.poster.generate --risk write --idempotent")
|
|
149
149
|
console.log("\nSecrets:")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
|
|
3
3
|
const { loadManifest } = require("../manifest")
|
|
4
|
+
const connector = require("../connector")
|
|
4
5
|
const servicesCommand = require("./services")
|
|
5
6
|
|
|
6
7
|
function valueAfter(args, flag) {
|
|
@@ -93,7 +94,7 @@ function collect(manifest) {
|
|
|
93
94
|
return out
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
async function run(args, { cwd }) {
|
|
97
|
+
async function run(args, { cwd, log = console.log }) {
|
|
97
98
|
const manifest = loadManifest(cwd)
|
|
98
99
|
const json = args.includes("--json")
|
|
99
100
|
const positional = args.filter((arg) => !arg.startsWith("-"))
|
|
@@ -130,20 +131,40 @@ async function run(args, { cwd }) {
|
|
|
130
131
|
return
|
|
131
132
|
}
|
|
132
133
|
if (command !== "list") throw new Error("usage: pltt capabilities [list | inspect <id> | add <id>] [--json]")
|
|
134
|
+
// The connector as an agent will see it: what the app says about itself, its tools, skills and events.
|
|
135
|
+
const view = connector.view(cwd, manifest)
|
|
133
136
|
if (json) {
|
|
134
|
-
|
|
137
|
+
log(JSON.stringify({ app_id: manifest.id, capabilities, ...view }, null, 2))
|
|
135
138
|
return
|
|
136
139
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
log("Connector for " + manifest.id + "@" + manifest.version)
|
|
141
|
+
log(" Summary: " + (view.summary || "none in the manifest; the platform uses the tagline or the description"))
|
|
142
|
+
if (view.instructions) {
|
|
143
|
+
log(" Instructions (" + view.instructions.length + " of 2000 characters):")
|
|
144
|
+
for (const line of view.instructions.split("\n")) log(" " + line)
|
|
145
|
+
} else {
|
|
146
|
+
log(" Instructions: none in the manifest; the platform generates them from the description")
|
|
141
147
|
}
|
|
142
|
-
|
|
148
|
+
log("Tools (" + capabilities.length + "):")
|
|
143
149
|
for (const item of capabilities) {
|
|
144
150
|
const scheduling = item.supports_scheduling ? "scheduled" : "interactive-only"
|
|
145
|
-
|
|
146
|
-
|
|
151
|
+
log(" " + item.capability_id + " " + item.risk + ", " + scheduling)
|
|
152
|
+
log(" " + item.name + (item.description ? " - " + item.description : ""))
|
|
153
|
+
}
|
|
154
|
+
if (!capabilities.length) {
|
|
155
|
+
log(" none declared; expose a provides.services method with agent_exposable=true and a stable capability_id")
|
|
156
|
+
}
|
|
157
|
+
if (manifest.backend) {
|
|
158
|
+
log(" plus every backend route a member can call, unless marked agent_route(\"hidden\"); pltt check lists unmarked ones")
|
|
159
|
+
}
|
|
160
|
+
log("Skills (" + view.skills.length + "):")
|
|
161
|
+
for (const skill of view.skills) {
|
|
162
|
+
log(" " + skill.name + " - " + skill.description + (skill.tools.length ? " [tools: " + skill.tools.join(", ") + "]" : ""))
|
|
163
|
+
}
|
|
164
|
+
log("Events (" + view.events.length + "):")
|
|
165
|
+
for (const event of view.events) {
|
|
166
|
+
log(" " + event.topic + " " + (event.trigger ? "can start an agent run" : "not a trigger (needs a description and a payload schema)")
|
|
167
|
+
+ (event.description ? " - " + event.description : ""))
|
|
147
168
|
}
|
|
148
169
|
}
|
|
149
170
|
|
package/lib/commands/check.js
CHANGED
|
@@ -14,6 +14,13 @@ const USAGE = "usage: pltt check [--json] [--publish-type preview|release] [--fi
|
|
|
14
14
|
|
|
15
15
|
const IDS = [
|
|
16
16
|
[/^could not (create Python|install pyproject)/i, "toolchain.python"],
|
|
17
|
+
[/agent\.instructions must be at most/, "connector.instructions_too_long"],
|
|
18
|
+
[/is required when agent_exposable is true|^agent-exposed (action|route) .* has no /, "connector.action_incomplete"],
|
|
19
|
+
[/is offered to agents with no agent_route mark/, "connector.route_unmarked"],
|
|
20
|
+
[/^skill .* names a tool the app does not have/, "connector.skill_unknown_tool"],
|
|
21
|
+
[/^skill .* will not load/, "connector.skill_invalid"],
|
|
22
|
+
[/is not offered as an agent trigger/, "connector.event_not_triggerable"],
|
|
23
|
+
[/^path-style ctx\.apps\.call/, "deprecated.apps_call"],
|
|
17
24
|
[/^manifest invalid/i, "manifest.invalid"],
|
|
18
25
|
[/^frontend bundle failed/i, "bundle.syntax"],
|
|
19
26
|
[/^backend import failed/i, "py.import"],
|
package/lib/commands/package.js
CHANGED
|
@@ -5,6 +5,7 @@ const path = require("path")
|
|
|
5
5
|
const crypto = require("crypto")
|
|
6
6
|
const { loadManifest, validateManifest } = require("../manifest")
|
|
7
7
|
const { bundleFrontend, bundleBackend } = require("../bundler")
|
|
8
|
+
const connector = require("../connector")
|
|
8
9
|
const buildCommand = require("./build")
|
|
9
10
|
|
|
10
11
|
function sha256(buf) {
|
|
@@ -48,7 +49,8 @@ async function run(argv, { cwd }) {
|
|
|
48
49
|
pluginId: manifest.id,
|
|
49
50
|
})
|
|
50
51
|
: null
|
|
51
|
-
|
|
52
|
+
// skills/ travel in the backend bundle, so an app with skills and no backend still gets one (as publish does).
|
|
53
|
+
const backend = manifest.backend || connector.skills(cwd).length ? await bundleBackend(cwd) : null
|
|
52
54
|
|
|
53
55
|
const out = path.join(distDir, `${manifest.id}-${manifest.version}.tar.gz`)
|
|
54
56
|
// Build a simple tar by piping through node-tar via spawn — avoid extra dep
|
|
@@ -80,6 +82,8 @@ async function run(argv, { cwd }) {
|
|
|
80
82
|
} else {
|
|
81
83
|
console.log(`[pltt] packaged ${manifest.id}@${manifest.version} → ${out} (${buf.length} bytes)`)
|
|
82
84
|
console.log(`[pltt] sha256: ${result.sha256}`)
|
|
85
|
+
const review = connector.reviewNote(cwd, manifest)
|
|
86
|
+
if (review) console.log(`[pltt] ${review}`)
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
|
package/lib/commands/publish.js
CHANGED
|
@@ -6,6 +6,7 @@ const path = require("path")
|
|
|
6
6
|
const { spawnSync } = require("child_process")
|
|
7
7
|
const { loadManifest, validateManifest } = require("../manifest")
|
|
8
8
|
const { bundleFrontend, bundleBackend } = require("../bundler")
|
|
9
|
+
const connector = require("../connector")
|
|
9
10
|
const {
|
|
10
11
|
resolveEnvironment,
|
|
11
12
|
parseFlags,
|
|
@@ -408,6 +409,8 @@ async function run(argv, { cwd }) {
|
|
|
408
409
|
log("[pltt] bundling backend")
|
|
409
410
|
const backend = await bundleBackend(cwd, { manifest: publishManifest })
|
|
410
411
|
log(`[pltt] ${backend.length} bytes`)
|
|
412
|
+
const review = connector.reviewNote(cwd, publishManifest)
|
|
413
|
+
if (review) log(`[pltt] ${review}`)
|
|
411
414
|
|
|
412
415
|
const backendSha = sha256(backend)
|
|
413
416
|
const frontendSha = frontend ? sha256(frontend) : null
|
|
@@ -510,6 +513,8 @@ async function run(argv, { cwd }) {
|
|
|
510
513
|
} else if (record.category) {
|
|
511
514
|
console.log(`[pltt] store category: ${record.category}`)
|
|
512
515
|
}
|
|
516
|
+
const lockedNote = lockedSecretsNote(record)
|
|
517
|
+
if (lockedNote) console.log(`[pltt] ${lockedNote}`)
|
|
513
518
|
if (record.preview_url) {
|
|
514
519
|
console.log(`[pltt] preview: ${record.preview_url}`)
|
|
515
520
|
}
|
|
@@ -524,4 +529,16 @@ async function run(argv, { cwd }) {
|
|
|
524
529
|
return record
|
|
525
530
|
}
|
|
526
531
|
|
|
532
|
+
// Pushed plugin secrets the platform kept: a Palette admin locked their values
|
|
533
|
+
// (older platforms send no such field).
|
|
534
|
+
function lockedSecretsNote(record) {
|
|
535
|
+
const keys = record.locked_plugin_secrets || []
|
|
536
|
+
if (!keys.length) return null
|
|
537
|
+
return (
|
|
538
|
+
`kept the server's value for ${keys.join(", ")}: a Palette admin locked ${keys.length === 1 ? "it" : "them"}. ` +
|
|
539
|
+
"Ask an admin to unlock a key for your pushes to change it."
|
|
540
|
+
)
|
|
541
|
+
}
|
|
542
|
+
|
|
527
543
|
module.exports = run
|
|
544
|
+
module.exports.lockedSecretsNote = lockedSecretsNote
|
package/lib/commands/test.js
CHANGED
|
@@ -7,6 +7,8 @@ const { CTX_PERMISSIONS, loadManifest, validateManifest, KNOWN_PERMISSIONS } = r
|
|
|
7
7
|
const { bundleFrontend, bundleBackend } = require("../bundler")
|
|
8
8
|
const { declaredSecrets, loadLocalEnv, loadLocalEnvDetails } = require("../secrets")
|
|
9
9
|
const buildCommand = require("./build")
|
|
10
|
+
const connector = require("../connector")
|
|
11
|
+
const { collect } = require("./capabilities")
|
|
10
12
|
|
|
11
13
|
// Permissions consumed by a `ctx.*` client in a handler body rather than by a
|
|
12
14
|
// route's require_permission() dependency. The route probe cannot see those —
|
|
@@ -192,7 +194,8 @@ function installPythonDependencies(cwd, out) {
|
|
|
192
194
|
return { python: venvPython, env: pythonEnv(), failures: 0, dependencies: deps }
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
|
|
197
|
+
// `onRoutes` receives the routes the probe saw, for the connector checks that need them.
|
|
198
|
+
function checkBackendContract(cwd, manifest, out, pythonInfo, onRoutes = () => {}) {
|
|
196
199
|
const entry = manifest.backend?.entry
|
|
197
200
|
if (!entry) return 0
|
|
198
201
|
const abs = path.resolve(cwd, entry)
|
|
@@ -234,7 +237,8 @@ function checkBackendContract(cwd, manifest, out, pythonInfo) {
|
|
|
234
237
|
" perms.append(perm)",
|
|
235
238
|
" used.add(perm)",
|
|
236
239
|
" stack.extend(getattr(dep, 'dependencies', []) or [])",
|
|
237
|
-
"
|
|
240
|
+
" extra = getattr(route, 'openapi_extra', None) or {}",
|
|
241
|
+
" routes.append({'path': path, 'methods': methods, 'permissions': sorted(set(perms)), 'public': path in public, 'agent': extra.get('x-palette-agent'), 'name': extra.get('x-palette-name'), 'offered': bool(methods) and bool(getattr(route, 'include_in_schema', True)) and path not in public, 'described': bool(extra.get('x-palette-description') or getattr(route, 'summary', None) or getattr(route, 'description', None))})",
|
|
238
242
|
" if path not in public and not perms:",
|
|
239
243
|
" ungated.append({'path': path, 'methods': methods})",
|
|
240
244
|
"capabilities = []",
|
|
@@ -257,6 +261,7 @@ function checkBackendContract(cwd, manifest, out, pythonInfo) {
|
|
|
257
261
|
|
|
258
262
|
let failures = 0
|
|
259
263
|
out.ok(`backend imports successfully: ${entry}`)
|
|
264
|
+
onRoutes(report.routes || [])
|
|
260
265
|
|
|
261
266
|
if (report.ungated_routes?.length) {
|
|
262
267
|
for (const route of report.ungated_routes) {
|
|
@@ -939,6 +944,8 @@ async function run(args, { cwd }) {
|
|
|
939
944
|
}
|
|
940
945
|
}
|
|
941
946
|
|
|
947
|
+
// null until the backend has been imported: its routes are tools too, so the tool list is not known before.
|
|
948
|
+
let routes = manifest.backend?.entry ? null : []
|
|
942
949
|
if (manifest.backend?.entry) {
|
|
943
950
|
const pythonInfo = installPythonDependencies(cwd, out)
|
|
944
951
|
failures += pythonInfo.failures
|
|
@@ -947,7 +954,7 @@ async function run(args, { cwd }) {
|
|
|
947
954
|
failures += out.fail(`backend entry not found: ${manifest.backend.entry}`)
|
|
948
955
|
} else {
|
|
949
956
|
out.ok(`backend entry exists: ${manifest.backend.entry}`)
|
|
950
|
-
failures += checkBackendContract(cwd, manifest, out, pythonInfo)
|
|
957
|
+
failures += checkBackendContract(cwd, manifest, out, pythonInfo, (seen) => { routes = seen })
|
|
951
958
|
}
|
|
952
959
|
|
|
953
960
|
try {
|
|
@@ -965,6 +972,11 @@ async function run(args, { cwd }) {
|
|
|
965
972
|
failures += lintMigrations(cwd, manifest, out)
|
|
966
973
|
failures += lintDependencyPolicy(cwd, out)
|
|
967
974
|
|
|
975
|
+
// The app as a connector for assistants. Warnings only: an app that adds nothing still works.
|
|
976
|
+
const connectorFindings = connector.findings({ cwd, manifest, tools: collect(manifest), routes })
|
|
977
|
+
for (const finding of connectorFindings) out.warn(finding.message, finding.fix, finding)
|
|
978
|
+
if (!connectorFindings.length) out.ok("connector checks passed")
|
|
979
|
+
|
|
968
980
|
if (failures > 0) {
|
|
969
981
|
if (json) {
|
|
970
982
|
console.log(JSON.stringify({ ok: false, failures, results }, null, 2))
|
|
@@ -95,6 +95,35 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
+
{
|
|
99
|
+
"name": "confluence.list_trash",
|
|
100
|
+
"namespace": "confluence",
|
|
101
|
+
"method": "list_trash",
|
|
102
|
+
"description": "List deleted Confluence pages and blog posts still in the trash (whole site, or one space by key or id). Search never returns trashed content; use this to find deleted pages.",
|
|
103
|
+
"mutating": false,
|
|
104
|
+
"risk": "read",
|
|
105
|
+
"input_schema": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"properties": {
|
|
108
|
+
"space_key": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"description": "Only this space's trash"
|
|
111
|
+
},
|
|
112
|
+
"space_id": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "Space id (instead of space_key)"
|
|
115
|
+
},
|
|
116
|
+
"limit": {
|
|
117
|
+
"type": "integer",
|
|
118
|
+
"description": "Max of each kind (default 25, cap 250)"
|
|
119
|
+
},
|
|
120
|
+
"site": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "Atlassian site url, name or cloud id when the account has several (default: first site)"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
98
127
|
{
|
|
99
128
|
"name": "confluence.search",
|
|
100
129
|
"namespace": "confluence",
|
|
@@ -257,6 +286,47 @@
|
|
|
257
286
|
]
|
|
258
287
|
}
|
|
259
288
|
},
|
|
289
|
+
{
|
|
290
|
+
"name": "jira.create_project",
|
|
291
|
+
"namespace": "jira",
|
|
292
|
+
"method": "create_project",
|
|
293
|
+
"description": "Create a Jira project (needs the Jira admin permission). template: kanban (default), scrum, kanban-company, scrum-company, project-management, task-tracking, recruitment, procurement, process-control, lead-tracking, content-management, document-approval, it-service-management, or a full Jira template key. The lead defaults to the connected user.",
|
|
294
|
+
"mutating": true,
|
|
295
|
+
"risk": "external_write",
|
|
296
|
+
"input_schema": {
|
|
297
|
+
"type": "object",
|
|
298
|
+
"properties": {
|
|
299
|
+
"name": {
|
|
300
|
+
"type": "string",
|
|
301
|
+
"description": "Project name"
|
|
302
|
+
},
|
|
303
|
+
"key": {
|
|
304
|
+
"type": "string",
|
|
305
|
+
"description": "Unique project key: an uppercase letter then letters/digits, at most 10 (e.g. RCRT)"
|
|
306
|
+
},
|
|
307
|
+
"template": {
|
|
308
|
+
"type": "string",
|
|
309
|
+
"description": "Template short name or full key (default kanban)"
|
|
310
|
+
},
|
|
311
|
+
"description": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"description": "Project description"
|
|
314
|
+
},
|
|
315
|
+
"lead_account_id": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"description": "Lead's account id (from jira.search_users)"
|
|
318
|
+
},
|
|
319
|
+
"site": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"description": "Atlassian site url, name or cloud id when the account has several (default: first site)"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"required": [
|
|
325
|
+
"name",
|
|
326
|
+
"key"
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
},
|
|
260
330
|
{
|
|
261
331
|
"name": "jira.get_issue",
|
|
262
332
|
"namespace": "jira",
|
|
@@ -2049,6 +2119,103 @@
|
|
|
2049
2119
|
}
|
|
2050
2120
|
]
|
|
2051
2121
|
},
|
|
2122
|
+
{
|
|
2123
|
+
"slug": "rovo",
|
|
2124
|
+
"label": "Atlassian Rovo MCP",
|
|
2125
|
+
"auth_type": "oauth2",
|
|
2126
|
+
"tools": [
|
|
2127
|
+
{
|
|
2128
|
+
"name": "rovo.describe_tool",
|
|
2129
|
+
"namespace": "rovo",
|
|
2130
|
+
"method": "describe_tool",
|
|
2131
|
+
"description": "Read one Atlassian tool's full instructions and argument schema before calling it.",
|
|
2132
|
+
"mutating": false,
|
|
2133
|
+
"risk": "read",
|
|
2134
|
+
"input_schema": {
|
|
2135
|
+
"type": "object",
|
|
2136
|
+
"properties": {
|
|
2137
|
+
"name": {
|
|
2138
|
+
"type": "string",
|
|
2139
|
+
"description": "Tool name from rovo.list_tools (e.g. searchJiraIssuesUsingJql, createConfluenceContent)"
|
|
2140
|
+
}
|
|
2141
|
+
},
|
|
2142
|
+
"required": [
|
|
2143
|
+
"name"
|
|
2144
|
+
]
|
|
2145
|
+
}
|
|
2146
|
+
},
|
|
2147
|
+
{
|
|
2148
|
+
"name": "rovo.execute",
|
|
2149
|
+
"namespace": "rovo",
|
|
2150
|
+
"method": "execute",
|
|
2151
|
+
"description": "Call an Atlassian tool that changes something: createJiraIssue, editJiraIssue, transitionJiraIssue, addOrEditJiraIssueComment, createConfluenceContent, updateConfluenceContent, createJsmRequest, createBitbucketRepoPullRequest \u2026 Most tools need a cloudId: get it first with rovo.query name=getAccessibleAtlassianResources. Staged for approval; Atlassian applies the user's own permissions.",
|
|
2152
|
+
"mutating": true,
|
|
2153
|
+
"risk": "external_write",
|
|
2154
|
+
"input_schema": {
|
|
2155
|
+
"type": "object",
|
|
2156
|
+
"properties": {
|
|
2157
|
+
"name": {
|
|
2158
|
+
"type": "string",
|
|
2159
|
+
"description": "Tool name from rovo.list_tools (e.g. searchJiraIssuesUsingJql, createConfluenceContent)"
|
|
2160
|
+
},
|
|
2161
|
+
"arguments": {
|
|
2162
|
+
"type": "object",
|
|
2163
|
+
"description": "Arguments exactly as rovo.describe_tool's input_schema shows (most take cloudId)"
|
|
2164
|
+
}
|
|
2165
|
+
},
|
|
2166
|
+
"required": [
|
|
2167
|
+
"name"
|
|
2168
|
+
]
|
|
2169
|
+
}
|
|
2170
|
+
},
|
|
2171
|
+
{
|
|
2172
|
+
"name": "rovo.list_tools",
|
|
2173
|
+
"namespace": "rovo",
|
|
2174
|
+
"method": "list_tools",
|
|
2175
|
+
"description": "List the Atlassian tools this account can use (Jira, Confluence, Jira Service Management, Bitbucket, Loom, Goals, Projects, Teams, Assets \u2026), filtered by keyword; each row says read or write.",
|
|
2176
|
+
"mutating": false,
|
|
2177
|
+
"risk": "read",
|
|
2178
|
+
"input_schema": {
|
|
2179
|
+
"type": "object",
|
|
2180
|
+
"properties": {
|
|
2181
|
+
"query": {
|
|
2182
|
+
"type": "string",
|
|
2183
|
+
"description": "Keyword, e.g. 'Jira', 'Confluence', 'sprint', 'pull request'"
|
|
2184
|
+
},
|
|
2185
|
+
"limit": {
|
|
2186
|
+
"type": "integer",
|
|
2187
|
+
"description": "Max tools (default 50, cap 200)"
|
|
2188
|
+
}
|
|
2189
|
+
},
|
|
2190
|
+
"required": []
|
|
2191
|
+
}
|
|
2192
|
+
},
|
|
2193
|
+
{
|
|
2194
|
+
"name": "rovo.query",
|
|
2195
|
+
"namespace": "rovo",
|
|
2196
|
+
"method": "query",
|
|
2197
|
+
"description": "Call a read-only Atlassian tool (atlassianUserInfo, getAccessibleAtlassianResources, getJiraIssue, searchJiraIssuesUsingJql, searchConfluence, getConfluenceContent, listBitbucketRepositories \u2026). Most tools need a cloudId: get it first with rovo.query name=getAccessibleAtlassianResources. Refuses tools that change anything.",
|
|
2198
|
+
"mutating": false,
|
|
2199
|
+
"risk": "read",
|
|
2200
|
+
"input_schema": {
|
|
2201
|
+
"type": "object",
|
|
2202
|
+
"properties": {
|
|
2203
|
+
"name": {
|
|
2204
|
+
"type": "string",
|
|
2205
|
+
"description": "Tool name from rovo.list_tools (e.g. searchJiraIssuesUsingJql, createConfluenceContent)"
|
|
2206
|
+
},
|
|
2207
|
+
"arguments": {
|
|
2208
|
+
"type": "object",
|
|
2209
|
+
"description": "Arguments exactly as rovo.describe_tool's input_schema shows (most take cloudId)"
|
|
2210
|
+
}
|
|
2211
|
+
},
|
|
2212
|
+
"required": [
|
|
2213
|
+
"name"
|
|
2214
|
+
]
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
]
|
|
2218
|
+
},
|
|
2052
2219
|
{
|
|
2053
2220
|
"slug": "slack",
|
|
2054
2221
|
"label": "Slack",
|