@palettelab/cli 0.3.56 → 0.3.58

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 CHANGED
@@ -4,6 +4,20 @@ Developer CLI for building plugins for the Palette platform. Works without any a
4
4
 
5
5
  The installed executable is `pltt`.
6
6
 
7
+ ## API Surface Split
8
+
9
+ Use the right helper for the runtime you are coding in:
10
+
11
+ | Runtime | Package/helper | Use it for |
12
+ |---|---|---|
13
+ | Frontend TypeScript/React | `@palettelab/sdk`, `createPaletteClient(...)`, `palette.*` | UI code, current-user OS APIs, frontend broker clients, Data Room browsing/upload from the browser, toasts, and current-user OS notifications |
14
+ | Backend Python/FastAPI | `palette_sdk`, `PluginContext`, `ctx.*`, `services(ctx)` | Backend routes, permission gates, app-owned data, migrations, cross-user notifications, server-side Data Rooms, managed services, app-to-app service handlers, and lifecycle hooks |
15
+ | CLI tooling | `pltt ...` | Scaffolding, local dev, testing, packaging, publishing, hosted sandbox previews, and generating frontend/backend typed service clients |
16
+
17
+ The CLI bundles `palette_sdk` for local backend simulation, but backend app
18
+ code should import `palette_sdk`, not `@palettelab/sdk`. Frontend app code
19
+ should import `@palettelab/sdk`, not `palette_sdk`.
20
+
7
21
  ## Requirements
8
22
 
9
23
  - Node.js 18+
@@ -337,7 +351,12 @@ async def sync_invoices(ctx: PluginContext = Depends(get_plugin_context)):
337
351
 
338
352
  Storage upload responses include both snake_case and camelCase aliases for object metadata (`object_path`/`objectPath`, `file_url`/`fileUrl`, `content_type`/`contentType`) so local simulator and hosted OS responses can be consumed with the same app code.
339
353
 
340
- App storage is different from Data Room uploads. Use `ctx.storage` or `palette.storage` for app-owned files written directly to the OS-configured storage backend, currently GCS in hosted environments. Use `ctx.data_rooms` / `palette.dataRooms` only when the file should be managed as a Data Room document.
354
+ App storage is different from Data Room uploads. Backend Python code uses
355
+ `ctx.storage`; frontend TypeScript code uses `palette.storage`. Both write
356
+ app-owned files directly to the OS-configured storage backend, currently GCS in
357
+ hosted environments. Use backend `ctx.data_rooms` or frontend
358
+ `palette.dataRooms` only when the file should be managed as a Data Room
359
+ document.
341
360
 
342
361
  Python backend app-storage example:
343
362
 
@@ -398,28 +417,10 @@ package dependency policy, and backend package size.
398
417
 
399
418
  ## OS Notifications
400
419
 
401
- Apps can push persistent notifications into the Palette OS notification center
402
- (the bell) with `@palettelab/sdk@0.1.27+`:
403
-
404
- ```ts
405
- import { notifications } from "@palettelab/sdk"
406
- // or: palette.notifications.push(...)
407
-
408
- await notifications.push({
409
- title: "Export complete",
410
- body: "Your report is ready to download.",
411
- severity: "success", // "info" | "success" | "warning" | "error"
412
- targetApp: "reports-app", // app icon that owns the unread badge
413
- route: "/exports/123", // opened inside your app on click
414
- })
415
- ```
416
-
417
- The notification shows as a live toast plus a notification-center entry;
418
- clicking it opens/focuses the target app at the resolved route. Use the SDK
419
- helper rather than hand-building platform notification API calls.
420
-
421
- Python plugin backends can push too, via `ctx.notifications` in the CLI-bundled
422
- backend SDK:
420
+ Backend apps created or served by the CLI should use the Python helper from the
421
+ CLI-bundled backend SDK. This is the helper to use for cross-user flows such as
422
+ leave approvals, review requests, task assignment, and same-organisation
423
+ recipient targeting:
423
424
 
424
425
  ```python
425
426
  from palette_sdk import PluginContext, get_plugin_context, require_permission
@@ -432,14 +433,39 @@ async def start_export(ctx: PluginContext = Depends(get_plugin_context)):
432
433
  body="A leave request needs approval.",
433
434
  to=ctx.notifications.user(approver_user_id),
434
435
  target_app="hierarchy-app",
436
+ route=f"/approvals/{request_id}",
437
+ severity="warning", # "info" | "success" | "warning" | "error"
438
+ data={"request_id": request_id},
435
439
  )
436
440
  ```
437
441
 
438
442
  By default the backend helper notifies the user making the current request;
439
443
  pass `to=ctx.notifications.user(...)`, `.email(...)`, `.member(...)`,
440
444
  `.role(...)`, `.team(...)`, or `.mentions_from(...)` to notify other same-org
441
- members. `target_app` controls the app icon badge and default click target. See
442
- `docs/python-backend-sdk.md` ("OS Notifications From Python") for details.
445
+ members. `target_app` controls the app icon badge and default click target.
446
+ `route` is optional and should only be set when the target app has a matching
447
+ deep-link page. See `docs/python-backend-sdk.md` ("OS Notifications From
448
+ Python") for details.
449
+
450
+ Frontend apps can also push notifications for the current signed-in user with
451
+ `@palettelab/sdk@0.1.27+`. This TypeScript helper is frontend-only and is not
452
+ the Python backend helper:
453
+
454
+ ```ts
455
+ import { notifications } from "@palettelab/sdk"
456
+ // or: palette.notifications.push(...)
457
+
458
+ await notifications.push({
459
+ title: "Export complete",
460
+ body: "Your report is ready to download.",
461
+ severity: "success", // "info" | "success" | "warning" | "error"
462
+ targetApp: "reports-app", // app icon that owns the unread badge
463
+ route: "/exports/123", // opened inside your app on click
464
+ })
465
+ ```
466
+
467
+ Both helpers create a live toast plus a notification-center entry. Use these
468
+ helpers rather than hand-building platform notification API calls.
443
469
 
444
470
  During `pltt dev`, frontend pushes call the platform backend directly
445
471
  (`NEXT_PUBLIC_API_URL`, default `http://localhost:8000`) in the user's session,
@@ -881,7 +881,12 @@ Example mock:
881
881
  }
882
882
  ```
883
883
 
884
- App storage is separate from Data Rooms. Use `ctx.storage` and `palette.storage` for app-owned files that go directly to the OS-configured storage backend, currently GCS in hosted environments. Use `ctx.data_rooms` or `palette.dataRooms` only when the file should be visible and governed as a Data Room document.
884
+ App storage is separate from Data Rooms. Backend Python code uses
885
+ `ctx.storage`; frontend TypeScript code uses `palette.storage`. Both write
886
+ app-owned files directly to the OS-configured storage backend, currently GCS in
887
+ hosted environments. Use backend `ctx.data_rooms` or frontend
888
+ `palette.dataRooms` only when the file should be visible and governed as a Data
889
+ Room document.
885
890
 
886
891
  Palette scopes storage the same way. Files written through `ctx.storage` or the
887
892
  frontend storage client live under:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palettelab/cli",
3
- "version": "0.3.56",
3
+ "version": "0.3.58",
4
4
  "description": "Developer CLI for building Palette platform plugins — no platform source access required.",
5
5
  "bin": {
6
6
  "pltt": "bin/pltt.js"