@rise-x/apps-sdk 0.16.1 → 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 +9 -5
- package/build/connectors/agents.js +1 -18
- package/build/connectors/types.d.ts +1 -0
- package/build/ui/components/ai.d.ts +1 -1
- package/build/ui/demo.html +31 -20
- package/build/ui/standalone.js +2 -2
- package/build/ui/styles.css +1 -1
- package/package.json +1 -1
- package/template/README.md +3 -3
package/README.md
CHANGED
|
@@ -868,11 +868,11 @@ import type { InstallHook, UninstallHook, UpdateHook } from '@rise-x/apps-sdk';
|
|
|
868
868
|
import localforage from 'localforage';
|
|
869
869
|
|
|
870
870
|
export const onInstall: InstallHook = async ({ manifest, user, environment }) => {
|
|
871
|
-
// first time this device
|
|
871
|
+
// first time this device opens the app — pre-warm caches, seed defaults, etc.
|
|
872
872
|
};
|
|
873
873
|
|
|
874
874
|
export const onUpdate: UpdateHook = async (ctx, { from, to }) => {
|
|
875
|
-
//
|
|
875
|
+
// first open after a version bump — run migrations if needed.
|
|
876
876
|
};
|
|
877
877
|
|
|
878
878
|
export const onUninstall: UninstallHook = async ({ manifest }) => {
|
|
@@ -889,7 +889,9 @@ export const onUninstall: UninstallHook = async ({ manifest }) => {
|
|
|
889
889
|
defineAppConfig({ pkg, port: 5101, exposes: { './Widget': './src/Widget' } });
|
|
890
890
|
```
|
|
891
891
|
|
|
892
|
-
The shell
|
|
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.
|
|
893
895
|
|
|
894
896
|
### Storage
|
|
895
897
|
|
|
@@ -1394,8 +1396,10 @@ Notes:
|
|
|
1394
1396
|
for you — see the preceding "Vector stores" section for
|
|
1395
1397
|
`vectorStores.create`/`addFiles`. For documents belonging to a single turn,
|
|
1396
1398
|
`attachments` needs no setup at all.
|
|
1397
|
-
- Stored MCP `apiKey`s are redacted to `"***"` on read
|
|
1398
|
-
|
|
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.
|
|
1399
1403
|
|
|
1400
1404
|
### Integrations — runtime endpoint invoke
|
|
1401
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}`,
|
|
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
|
}
|
|
@@ -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
|
-
/**
|
|
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
|
/**
|