@rise-x/apps-sdk 0.11.0 → 0.15.0

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 (83) hide show
  1. package/README.md +904 -20
  2. package/build/_internal.d.ts +4 -1
  3. package/build/_internal.js +67 -0
  4. package/build/cli/index.d.ts +7 -1
  5. package/build/cli/index.js +68 -14
  6. package/build/cli/scan.d.ts +60 -0
  7. package/build/cli/scan.js +725 -0
  8. package/build/cli/validate.d.ts +33 -0
  9. package/build/cli/validate.js +169 -0
  10. package/build/connectors/agents.d.ts +10 -6
  11. package/build/connectors/agents.js +59 -44
  12. package/build/connectors/attachments.d.ts +51 -0
  13. package/build/connectors/attachments.js +76 -0
  14. package/build/connectors/errors.js +24 -0
  15. package/build/connectors/flows.d.ts +13 -2
  16. package/build/connectors/flows.js +64 -19
  17. package/build/connectors/index.d.ts +5 -1
  18. package/build/connectors/index.js +14 -2
  19. package/build/connectors/integrations.d.ts +29 -0
  20. package/build/connectors/integrations.js +32 -0
  21. package/build/connectors/offline.d.ts +34 -0
  22. package/build/connectors/offline.js +135 -0
  23. package/build/connectors/readPolicy.d.ts +29 -0
  24. package/build/connectors/readPolicy.js +105 -0
  25. package/build/connectors/types.d.ts +75 -0
  26. package/build/connectors/types.js +128 -0
  27. package/build/connectors/vectorStores.d.ts +45 -0
  28. package/build/connectors/vectorStores.js +199 -0
  29. package/build/connectors/work.d.ts +14 -2
  30. package/build/connectors/work.js +43 -19
  31. package/build/dependencies/bound.d.ts +87 -0
  32. package/build/dependencies/bound.js +207 -0
  33. package/build/dependencies/index.d.ts +2 -0
  34. package/build/dependencies/index.js +13 -0
  35. package/build/dependencyRegistry.d.ts +15 -0
  36. package/build/dependencyRegistry.js +28 -0
  37. package/build/index.d.ts +2 -1
  38. package/build/index.js +12 -1
  39. package/build/lifecycle.d.ts +10 -1
  40. package/build/manifest.d.ts +69 -0
  41. package/build/manifest.js +229 -0
  42. package/build/manifestSource.d.ts +27 -0
  43. package/build/manifestSource.js +99 -0
  44. package/build/mockShell.d.ts +2 -0
  45. package/build/mockShell.js +13 -0
  46. package/build/query/client.js +9 -1
  47. package/build/query/dependencies.d.ts +22 -0
  48. package/build/query/dependencies.js +73 -0
  49. package/build/query/flows.d.ts +8 -8
  50. package/build/query/index.d.ts +1 -0
  51. package/build/query/index.js +4 -2
  52. package/build/query/layer.d.ts +9 -9
  53. package/build/query/shared.js +10 -0
  54. package/build/query/work.d.ts +4 -4
  55. package/build/rsbuild/index.d.ts +3 -1
  56. package/build/rsbuild/index.js +36 -2
  57. package/build/rsbuild/riseAppManifestPlugin.d.ts +19 -0
  58. package/build/rsbuild/riseAppManifestPlugin.js +79 -0
  59. package/build/shell/installShellBridge.d.ts +2 -0
  60. package/build/shell/installShellBridge.js +3 -1
  61. package/build/shellBridge.d.ts +233 -1
  62. package/build/shellBridge.js +8 -7
  63. package/build/ui/components/app-frame.d.ts +1 -1
  64. package/build/ui/demo.html +365 -360
  65. package/build/ui/shadcn.css +629 -0
  66. package/build/ui/standalone.js +17 -15
  67. package/build/ui/styles.css +1 -1
  68. package/build/ui/tailwind.css +12 -0
  69. package/build/ui/theme.css +412 -0
  70. package/build/ui/tw-animate.css +1 -0
  71. package/build/webpack/index.d.ts +1 -0
  72. package/build/webpack/index.js +7 -0
  73. package/build/webpack/riseAppManifestPlugin.d.ts +61 -0
  74. package/build/webpack/riseAppManifestPlugin.js +103 -0
  75. package/dependencies/package.json +8 -0
  76. package/package.json +17 -4
  77. package/template/AGENTS.md +34 -4
  78. package/template/README.md +85 -2
  79. package/template/package.json +4 -0
  80. package/template/rise-x-app.json +4 -0
  81. package/template/src/App.tsx +7 -17
  82. package/template/src/styles.css +5 -0
  83. package/webpack/package.json +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rise-x/apps-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.15.0",
4
4
  "description": "SDK for building federated apps on top of the Rise-X Diana shell. Includes a CLI for scaffolding new apps.",
5
5
  "author": {
6
6
  "name": "Rise-X",
@@ -34,6 +34,10 @@
34
34
  "types": "./build/connectors/index.d.ts",
35
35
  "default": "./build/connectors/index.js"
36
36
  },
37
+ "./dependencies": {
38
+ "types": "./build/dependencies/index.d.ts",
39
+ "default": "./build/dependencies/index.js"
40
+ },
37
41
  "./query": {
38
42
  "types": "./build/query/index.d.ts",
39
43
  "default": "./build/query/index.js"
@@ -43,21 +47,28 @@
43
47
  "default": "./build/ui/index.js"
44
48
  },
45
49
  "./ui/standalone": "./build/ui/standalone.js",
50
+ "./ui/tailwind.css": "./build/ui/tailwind.css",
46
51
  "./ui/standalone-stub": "./build/ui/standalone-stub.js",
47
52
  "./rsbuild": {
48
53
  "types": "./build/rsbuild/index.d.ts",
49
54
  "default": "./build/rsbuild/index.js"
50
55
  },
56
+ "./webpack": {
57
+ "types": "./build/webpack/index.d.ts",
58
+ "default": "./build/webpack/index.js"
59
+ },
51
60
  "./package.json": "./package.json"
52
61
  },
53
62
  "files": [
54
63
  "build",
55
64
  "shell",
56
65
  "connectors",
66
+ "dependencies",
57
67
  "query",
58
68
  "rsbuild",
59
69
  "template",
60
- "ui"
70
+ "ui",
71
+ "webpack"
61
72
  ],
62
73
  "engines": {
63
74
  "node": ">=18.19.0"
@@ -67,7 +78,7 @@
67
78
  "test": "jest",
68
79
  "build:package": "pnpm clean && tsc -p tsconfig.package.json && tsc -p tsconfig.ui.json && node scripts/build-ui.js && node scripts/build-classes.js && node scripts/prerender-demo.js && shx chmod +x build/cli/index.js",
69
80
  "build": "pnpm build:package",
70
- "start:package": "tsc-watch -p ./tsconfig.package.json",
81
+ "start:package": "pnpm build:package && tsc-watch -p ./tsconfig.package.json",
71
82
  "prepack": "pnpm --filter @rise-x/ui build && pnpm build:package"
72
83
  },
73
84
  "peerDependencies": {
@@ -100,6 +111,7 @@
100
111
  }
101
112
  },
102
113
  "dependencies": {
114
+ "@tailwindcss/postcss": "^4.3.3",
103
115
  "@tanstack/react-table": "^8.21.3",
104
116
  "@types/leaflet": "^1.9.12",
105
117
  "class-variance-authority": "^0.7.1",
@@ -110,7 +122,8 @@
110
122
  "radix-ui": "^1.6.2",
111
123
  "react-resizable-panels": "^4.12.2",
112
124
  "recharts": "^3.8.0",
113
- "sonner": "^2.0.7"
125
+ "sonner": "^2.0.7",
126
+ "tailwindcss": "^4.3.3"
114
127
  },
115
128
  "devDependencies": {
116
129
  "@fontsource-variable/inter": "^5.3.0",
@@ -32,10 +32,36 @@ Rise-X host (the Diana app):
32
32
  workspace's hoisted `react@18`. The scaffold pins both to the app's own
33
33
  copy — `tsconfig.json`'s `paths` for types, the preset's standalone
34
34
  `resolve.alias` for the runtime — don't remove those pins.
35
- - All platform access goes through `@rise-x/apps-sdk`: shell hooks/accessors,
36
- typed connectors (`@rise-x/apps-sdk/connectors`), cached react-query hooks
37
- (`@rise-x/apps-sdk/query`). Never instantiate your own axios, wire your own
38
- auth, or call backend services directly.
35
+ - All platform access goes through `@rise-x/apps-sdk`, in this order: a declared
36
+ dependency (`deps.<alias>`, from `@rise-x/apps-sdk/dependencies`) for anything
37
+ named in `rise-x-app.json`; cached react-query hooks
38
+ (`@rise-x/apps-sdk/query`) for data a component renders, taking
39
+ `dep.flowOriginId` or `dep.agentId` as the ref (an integration dependency has
40
+ no cacheable data — call `dep.integration.invoke()` directly); typed connectors
41
+ (`@rise-x/apps-sdk/connectors`) for what a dependency can't express, such as a
42
+ ref the user picks at runtime, discovery, and the operations no bound surface
43
+ carries; and `getShellApiV4` only for endpoints no connector covers. Shell
44
+ hooks and accessors (`useShellUser`, `useShellEnvironment`,
45
+ `useShellNavigate`) cover user and environment state. Never instantiate your
46
+ own axios, wire your own auth, or call backend services directly.
47
+ - **A GUID literal in app source belongs in `rise-x-app.json`.** Declare each
48
+ flow, asset type, agent, and integration endpoint there under an alias, with
49
+ one id (or id pair, for an integration) per environment, and read it through
50
+ `useAppDependencies()` (from
51
+ `@rise-x/apps-sdk/dependencies`). The ids differ
52
+ between test and prod, and the build resolves them for the environment it
53
+ targets. Each dependency also exposes the connector operations that take its
54
+ ref, pre-filled (`deps.riskFlow.work.list()`). Declare only the environments
55
+ you have ids for — the file starts at `["test"]`, and every dependency needs
56
+ an id for every environment listed. Never invent an id or half-fill a
57
+ dependency to satisfy an environment: ask for the real id, or leave that
58
+ environment undeclared until you have it. Run `pnpm validate` after editing
59
+ the file, since the build only checks the environment it targets — it also
60
+ scans `src/` and warns about any Rise-X id still hardcoded there, which is the
61
+ check that catches you pasting a GUID instead of declaring it. `npx
62
+ @rise-x/apps-sdk scan` reports only that, and `rise-x-app-ignore` in a
63
+ comment silences a GUID that genuinely isn't a Rise-X object (a step id, a
64
+ fixture).
39
65
  - UI is built exclusively from `@rise-x/apps-sdk/ui` (the Rise-X design
40
66
  system). The root layout is the `AppFrame` primitives: `AppRail` (fixed
41
67
  left rail of `Nav` items, directly on the page background — never inside a
@@ -58,6 +84,9 @@ Rise-X host (the Diana app):
58
84
  - TypeScript + React (host-provided at runtime), Rspack Module Federation
59
85
  - `@rise-x/apps-sdk` — shell bridge, connectors, query layer, design system
60
86
  - `@tanstack/react-query` v5 — shared singleton with the host
87
+ - Tailwind v4 via `src/styles.css`. This app compiles its own utilities
88
+ against the design-system theme, so write classes, not inline styles. Add a
89
+ `@source` line there for any component directory outside `src/`.
61
90
 
62
91
  ## Commands
63
92
 
@@ -66,6 +95,7 @@ Rise-X host (the Diana app):
66
95
  | `pnpm start` | Standalone dev server on port __APP_PORT__ — mock shell; design system renders via the SDK's bundled snapshot (host copy is canonical); shell APIs throw here |
67
96
  | `pnpm start:federated` | Federated dev server — for running inside a host |
68
97
  | `pnpm build` | Production bundle → `dist/remoteEntry.js` |
98
+ | `pnpm validate` | Check `rise-x-app.json` against every declared environment, and scan `src/` for hardcoded Rise-X ids |
69
99
 
70
100
  Deploy: zip the **contents** of `dist/` (`remoteEntry.js` at the archive
71
101
  root), then deploy via the Rise-X MCP or the host's Apps page (New App —
@@ -30,13 +30,73 @@ Uses the preset's standalone branch (`rsbuild dev --env-mode standalone`): bundl
30
30
  ## Build for the shell
31
31
 
32
32
  ```bash
33
- pnpm build # federated production bundle (dist/remoteEntry.js)
33
+ pnpm build # federated bundle (dist/remoteEntry.js), ids for "test"
34
+ pnpm build:staging # the same, once "staging" is declared with its ids
35
+ pnpm build:prod # the same, for "prod"
34
36
  pnpm start:federated # federated dev server — only meaningful when consumed
35
37
  # by the shell (alongside tools/apps-dev-server)
36
38
  ```
37
39
 
38
40
  `pnpm build` publishes `dist/remoteEntry.js` + chunks. The shell loads this bundle via Module Federation.
39
41
 
42
+ ## App dependencies
43
+
44
+ `rise-x-app.json` declares the flows, asset types, agents, and integration
45
+ endpoints this app uses, each under a stable alias with one id (an id *pair* —
46
+ `integrationId` and `endpointId` — for an integration) per environment. **A GUID
47
+ literal in app source belongs in that file.** It starts at
48
+ `"environments": ["test"]`; add
49
+ `staging` or `prod` when you have their ids, since every dependency needs an id
50
+ for every environment listed there. The build resolves the file for one
51
+ environment (`pnpm build` → `test`, `pnpm build:prod` → `prod`), emits
52
+ `dist/rise-x-app.json` for the backend, and injects it for the app:
53
+
54
+ ```ts
55
+ import { useAppDependencies } from '@rise-x/apps-sdk/dependencies';
56
+
57
+ const deps = useAppDependencies();
58
+ await deps.riskFlow.work.list({ pageSize: 20 }); // connector, ref pre-filled
59
+ ```
60
+
61
+ A declared dependency is the first choice for every Rise-X object this app knows
62
+ at authoring time. Use the generic connectors (`@rise-x/apps-sdk/connectors`)
63
+ only where a dependency can't reach: a ref the user picks at runtime, discovery,
64
+ and the operations no bound surface carries.
65
+
66
+ Validate it before you ship, since a build only resolves the environment it
67
+ targets and so proves nothing about the others:
68
+
69
+ ```bash
70
+ pnpm validate # every environment declared in rise-x-app.json
71
+ ```
72
+
73
+ It exits non-zero if any environment fails, and prints the ids each one would
74
+ ship. It cannot tell you an id has been deleted from the ecosystem, and neither
75
+ can the deploy, which checks the manifest's shape and stores it without looking
76
+ the ids up. A stale id surfaces in the running app.
77
+
78
+ `pnpm validate` also scans `src/` for Rise-X ids hardcoded in the code and lists
79
+ them as warnings, since a valid manifest is no use if a GUID is pasted into a
80
+ component anyway. To see only that, or to gate a CI job on it:
81
+
82
+ ```bash
83
+ npx @rise-x/apps-sdk scan # report undeclared ids in app source
84
+ npx @rise-x/apps-sdk scan --show-ignored # ...and what it set aside, and why
85
+ npx @rise-x/apps-sdk scan --strict # ...exiting non-zero on a finding, a skipped scan, or an unreadable file
86
+ ```
87
+
88
+ For a GUID that genuinely isn't a Rise-X object — a step id, a fixture — put
89
+ `rise-x-app-ignore` in a comment on its line or the line above.
90
+
91
+ The scan also sets aside ids it judges not to be dependencies (step and section
92
+ ids, sample data, row ids — an integration id or endpoint id is *not* set aside,
93
+ since those are a real dependency kind). That's a heuristic, so if it seems to be
94
+ missing something you expected, run `--show-ignored` and read what it dropped
95
+ rather than assuming the id isn't there.
96
+
97
+ See the SDK README's "App dependencies" section for the file format and the
98
+ bound surface each kind gets.
99
+
40
100
  ## SDK cheatsheet
41
101
 
42
102
  ```ts
@@ -49,7 +109,7 @@ import {
49
109
  } from '@rise-x/apps-sdk';
50
110
 
51
111
  // Typed API wrappers (event handlers, lifecycle hooks, non-React code):
52
- import { flows, work, assets, agents } from '@rise-x/apps-sdk/connectors';
112
+ import { flows, work, assets, agents, integrations } from '@rise-x/apps-sdk/connectors';
53
113
 
54
114
  // Cached react-query hooks for component data (what App.tsx uses):
55
115
  import { useFlows, useWorkRows, useSubmitWork } from '@rise-x/apps-sdk/query';
@@ -82,6 +142,29 @@ snapshot with its own CSS injected, so components render for real without a
82
142
  host. It's a snapshot, not the source of truth: verify in a host (or
83
143
  deployed) before release.
84
144
 
145
+ ## Styling
146
+
147
+ This app compiles its own Tailwind. `src/styles.css` is the entry:
148
+
149
+ ```css
150
+ @import '@rise-x/apps-sdk/ui/tailwind.css';
151
+ @source '.';
152
+ ```
153
+
154
+ The import brings in the design-system theme (the token mapping, the px-pinned
155
+ scale, the `dark` variant). `@source '.'` names the directory Tailwind scans for class
156
+ names, relative to the stylesheet. Add another line for each directory of
157
+ components outside `src/`. Without a matching `@source`, a class you write has
158
+ no rule and no build error: the host's own CSS covers the design system's
159
+ classes only.
160
+
161
+ `src/App.tsx` imports the stylesheet, because that is the module the shell
162
+ loads. Importing it from `src/bootstrap.tsx` styles nothing in a host.
163
+
164
+ Don't import Tailwind preflight or `tokens.css`. The host owns the page reset
165
+ and publishes the token values, which this app inherits by cascade, live
166
+ dark-mode switching included.
167
+
85
168
  ## Lifecycle hooks
86
169
 
87
170
  `src/lifecycle.ts` exports optional `onInstall`, `onUpdate`, `onUninstall` hooks. The shell loads this module via MF and invokes them:
@@ -4,6 +4,9 @@
4
4
  "version": "0.1.0",
5
5
  "scripts": {
6
6
  "build": "rsbuild build",
7
+ "build:staging": "cross-env APP_ENV=staging rsbuild build",
8
+ "build:prod": "cross-env APP_ENV=prod rsbuild build",
9
+ "validate": "apps-sdk validate",
7
10
  "start": "rsbuild dev --env-mode standalone",
8
11
  "start:federated": "rsbuild dev",
9
12
  "typecheck": "tsc --noEmit"
@@ -22,6 +25,7 @@
22
25
  "@types/react": "^18.2.0",
23
26
  "@types/react-dom": "^18.2.0",
24
27
  "axios": "^1.7.7",
28
+ "cross-env": "^7.0.3",
25
29
  "react": "^18.2.0",
26
30
  "react-dom": "^18.2.0",
27
31
  "react-router-dom": "^6.19.0",
@@ -0,0 +1,4 @@
1
+ {
2
+ "environments": ["test"],
3
+ "dependencies": {}
4
+ }
@@ -25,6 +25,9 @@ import {
25
25
  PageHeaderTitle,
26
26
  } from "@rise-x/apps-sdk/ui";
27
27
 
28
+ // Imported from the exposed module so the styles load under Module Federation; bootstrap.tsx never runs in a host.
29
+ import "./styles.css";
30
+
28
31
  /*
29
32
  * CANONICAL APP LAYOUT — keep this composition as the app grows:
30
33
  *
@@ -79,9 +82,7 @@ function Shell() {
79
82
 
80
83
  return (
81
84
  // The host paints the page background and hands the app a full-height
82
- // region. NOTE: the host ships only the utility classes used inside the
83
- // design system itself; app-specific values go in inline styles or your
84
- // own CSS — the AppFrame primitives carry their own classes.
85
+ // region.
85
86
  <AppFrame mobileNav="tabs">
86
87
  {/* Left rail: a borderless list on the page background — NOT a Card. */}
87
88
  <AppRail>
@@ -150,14 +151,8 @@ function Shell() {
150
151
  </PageHeader>
151
152
 
152
153
  {/* Stat tiles: plain divs (bg-card + shadow-card), not Card — see the
153
- CANONICAL APP LAYOUT comment above. `sm:grid-cols-3` isn't in the
154
- host's compiled CSS, so the column count is an inline style. */}
155
- <div
156
- className="grid gap-3"
157
- style={{
158
- gridTemplateColumns: "repeat(auto-fit, minmax(160px, 1fr))",
159
- }}
160
- >
154
+ CANONICAL APP LAYOUT comment above. */}
155
+ <div className="grid gap-3 grid-cols-[repeat(auto-fit,minmax(160px,1fr))]">
161
156
  {[
162
157
  ["Records", "1,284"],
163
158
  ["Open", "104"],
@@ -172,12 +167,7 @@ function Shell() {
172
167
  ))}
173
168
  </div>
174
169
 
175
- {/* `min-h-[104px]` isn't in the host's compiled CSS either — same
176
- inline-style treatment. */}
177
- <div
178
- className="mt-3 rounded-xl bg-card p-3.5 shadow-card"
179
- style={{ minHeight: 104 }}
180
- >
170
+ <div className="mt-3 min-h-[104px] rounded-xl bg-card p-3.5 shadow-card">
181
171
  <div className="text-ui font-medium">Results</div>
182
172
  <div className="mt-1 text-xs text-muted-foreground">
183
173
  Tables, cards and charts are each their own tile. Replace these
@@ -0,0 +1,5 @@
1
+ /* Compiles this app's own utilities against the design-system theme.
2
+ * `@source '.'` scans this directory; add another for code outside src/.
3
+ * No preflight or tokens: the host owns those. */
4
+ @import '@rise-x/apps-sdk/ui/tailwind.css';
5
+ @source '.';
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@rise-x/apps-sdk/webpack",
3
+ "description": "Legacy-resolution stub for the webpack subpath. See parent package.json `exports` for the canonical wiring.",
4
+ "main": "../build/webpack/index.js",
5
+ "module": "../build/webpack/index.js",
6
+ "types": "../build/webpack/index.d.ts",
7
+ "private": true
8
+ }