@rise-x/apps-sdk 0.16.0 → 0.16.4

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
@@ -761,8 +761,11 @@ Requirements in the app:
761
761
 
762
762
  2. Federated, components render from the shell's copy. The preset's standalone
763
763
  branch aliases `@rise-x/ui` to the SDK's own
764
- compiled bundle (`./ui/standalone`) instead — a self-contained snapshot
765
- with its CSS self-injected, so components render for real with no shell.
764
+ compiled bundle (`./ui/standalone`) instead: a snapshot with its CSS
765
+ self-injected, so components render for real with no shell. `MapView`'s
766
+ libraries (`leaflet`, `maplibre-gl`, and `@maplibre/maplibre-gl-leaflet`)
767
+ aren't in it. They install as dependencies of the SDK, and your app's
768
+ bundler loads each one in its own chunk when a map needs it.
766
769
  It's a snapshot, not the source of truth: verify in a host (or deployed)
767
770
  before release.
768
771
 
@@ -806,6 +809,18 @@ import { MapView, mapPin } from '@rise-x/apps-sdk/ui';
806
809
  custom raster layer (`{ url, ...TileLayerOptions }`), a MapLibre style
807
810
  (`{ style }`), or `null` for no basemap at all.
808
811
 
812
+ OpenStreetMap blocks tile requests that carry no `Referer`, and a host page
813
+ whose `Referrer-Policy` is `same-origin` or `no-referrer` strips it. The
814
+ `streets` preset sets `referrerPolicy: 'strict-origin-when-cross-origin'` for
815
+ this. Pass the same option to any OpenStreetMap layer you add yourself:
816
+
817
+ ```tsx
818
+ L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
819
+ referrerPolicy: 'strict-origin-when-cross-origin',
820
+ attribution: '© OpenStreetMap',
821
+ }).addTo(map);
822
+ ```
823
+
809
824
  The built-in presets fetch from third-party hosts, so the host page's CSP must
810
825
  allow them: `light` and `dark` need `connect-src https://tiles.openfreemap.org`
811
826
  and `worker-src blob:` (MapLibre renders in a web worker); `streets` and
@@ -853,11 +868,11 @@ import type { InstallHook, UninstallHook, UpdateHook } from '@rise-x/apps-sdk';
853
868
  import localforage from 'localforage';
854
869
 
855
870
  export const onInstall: InstallHook = async ({ manifest, user, environment }) => {
856
- // first time this device sees the app — pre-warm caches, seed defaults, etc.
871
+ // first time this device opens the app — pre-warm caches, seed defaults, etc.
857
872
  };
858
873
 
859
874
  export const onUpdate: UpdateHook = async (ctx, { from, to }) => {
860
- // version bumped in the registry — run migrations if needed.
875
+ // first open after a version bump — run migrations if needed.
861
876
  };
862
877
 
863
878
  export const onUninstall: UninstallHook = async ({ manifest }) => {
@@ -874,7 +889,9 @@ export const onUninstall: UninstallHook = async ({ manifest }) => {
874
889
  defineAppConfig({ pkg, port: 5101, exposes: { './Widget': './src/Widget' } });
875
890
  ```
876
891
 
877
- The shell invokes hooks best-effort: errors are logged, 10s timeout per hook, missing hooks skip silently. Hooks run inside the shell's page — `getShellApi()` / `getShellApiV4()` work from inside them.
892
+ The shell runs `onInstall` and `onUpdate` when the user opens the app, before its first render, not when the user opens an ecosystem. An app that the user never opens on a device gets neither hook there. `onUninstall` runs when the app is deleted.
893
+
894
+ The shell invokes hooks best-effort: errors are logged, 10s timeout per hook, missing hooks skip silently. If `onInstall` or `onUpdate` fails, the shell runs it again on the next open. Hooks run inside the shell's page — `getShellApi()` / `getShellApiV4()` work from inside them.
878
895
 
879
896
  ### Storage
880
897
 
@@ -1379,8 +1396,10 @@ Notes:
1379
1396
  for you — see the preceding "Vector stores" section for
1380
1397
  `vectorStores.create`/`addFiles`. For documents belonging to a single turn,
1381
1398
  `attachments` needs no setup at all.
1382
- - Stored MCP `apiKey`s are redacted to `"***"` on read; `agents.update()` strips
1383
- the sentinel so read-modify-write can't clobber the stored secret.
1399
+ - Stored MCP `apiKey`s are redacted to `"***"` on read. To keep a stored key on
1400
+ `agents.update()`, send `"***"` back unchanged for a server with the same
1401
+ `name`. A new or renamed server needs the real key. When you change a server's
1402
+ `url`, send the real key too.
1384
1403
 
1385
1404
  ### Integrations — runtime endpoint invoke
1386
1405
 
@@ -17,23 +17,6 @@ const AGENT_PATH = "/api/v4/config/agent";
17
17
  // api-config deployable as AGENT_PATH, so it rides the same getApiV4('config')
18
18
  // client — the ai/* prefix is just the AI-runtime data namespace.
19
19
  const AGENT_CHAT_PATH = "/api/v4/ai/agent-chat";
20
- // The API redacts stored MCP api keys to this sentinel on every read.
21
- const REDACTED_SECRET = "***";
22
- // PATCH must never echo the redaction sentinel back — the server would store
23
- // the literal "***" as the key. Drop redacted apiKey fields from the payload.
24
- function stripRedactedSecrets(patch) {
25
- if (!patch.mcpServers)
26
- return patch;
27
- return {
28
- ...patch,
29
- mcpServers: patch.mcpServers.map((server) => {
30
- if (server.apiKey !== REDACTED_SECRET)
31
- return server;
32
- const { apiKey: _redacted, ...rest } = server;
33
- return rest;
34
- }),
35
- };
36
- }
37
20
  function eventData(raw) {
38
21
  // Tolerate non-JSON frames (keep-alive text, partial vendor events) — a bad
39
22
  // frame must not kill the stream.
@@ -241,7 +224,7 @@ function createAgentsConnector(deps = { shell: _internal_1.requireShell }) {
241
224
  };
242
225
  const update = async (id, patch, opts = {}) => {
243
226
  try {
244
- const { data } = await configApi().patch(`${AGENT_PATH}/${id}`, stripRedactedSecrets(patch), { signal: opts.signal });
227
+ const { data } = await configApi().patch(`${AGENT_PATH}/${id}`, patch, { signal: opts.signal });
245
228
  return (0, types_1.mapAgent)(data ?? {});
246
229
  }
247
230
  catch (e) {
@@ -277,6 +277,7 @@ export declare const AGENT_ERROR = "error";
277
277
  export type AgentEventType = "MESSAGE" | "REASONING" | "TOOL_CALL" | "HANDOFF";
278
278
  export interface AgentToolCall {
279
279
  tool_name?: string;
280
+ arguments?: string;
280
281
  result?: string;
281
282
  status?: string;
282
283
  }
@@ -163,6 +163,14 @@ function defineAppConfig({ pkg, port, standalone = false, exposes, define, }) {
163
163
  'react-dom': (0, node_path_1.dirname)(appRequire.resolve('react-dom/package.json')),
164
164
  },
165
165
  },
166
+ tools: {
167
+ ...base.tools,
168
+ rspack: {
169
+ // MapLibre's worker-URL helper trips this on every build, and Rsbuild
170
+ // prints its whole minified line; MapView sets the worker itself.
171
+ ignoreWarnings: [{ module: /[/\\]maplibre-gl[/\\]/, message: /Critical dependency/ }],
172
+ },
173
+ },
166
174
  };
167
175
  }
168
176
  return {
@@ -40,7 +40,7 @@ declare function AiActivity({ className, glyph, meta, label, ...props }: Omit<Re
40
40
  declare function AiToolGroup({ className, summary, tools, ...props }: React.ComponentProps<'details'> & {
41
41
  /** The collapsed line, e.g. "Used 3 tools". Localise at the call site. */
42
42
  summary: React.ReactNode;
43
- /** Display names of this group's calls, in call order. */
43
+ /** This group's calls, in call order: a display name, or a row the caller renders. */
44
44
  tools: React.ReactNode[];
45
45
  }): React.JSX.Element | null;
46
46
  /**