@alia.onl/sdk 21.1.0 → 21.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @alia.onl/sdk
2
2
 
3
+ ## 21.2.0
4
+
5
+ ### Added
6
+
7
+ - **`parseCatalogueTool` and `toolRendererKey` from `@alia.onl/sdk/tools`.** Which app a tool call
8
+ belongs to (`oxy_<app>__<tool>` / `self_<app>__<tool>`) is now readable without loading React
9
+ Native, so a host's own pure models and tests — the code that decides what a screen shows —
10
+ can tell its catalogue's results apart. The main entry exports the same two functions as before.
11
+
3
12
  ## 21.1.0
4
13
 
5
14
  A shared conversation has one address, Alia's, whichever app minted it (`docs/agent-embedding.md`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alia.onl/sdk",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "description": "Alia AI chat SDK — the conversation runtime, chat UI, voice calls and dictation for Oxy apps",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@ export type { AliaParticipantsHeaderProps } from './components/AliaParticipantsH
17
17
  export { ALIA_LEAD, leadOf } from './lib/participants';
18
18
  export type { AliaChatParticipants, AliaLead, AliaParticipant } from './lib/participants';
19
19
  export { ANCHORS, leadToProfile } from './lib/flights';
20
- export { parseCatalogueTool, toolRendererKey } from './lib/tool-renderers';
20
+ export { parseCatalogueTool, toolRendererKey } from './lib/catalogue-tool';
21
21
  export type { AliaToolRenderers, AliaToolResult } from './lib/tool-renderers';
22
22
  export { AliaAskProvider, useAskAgent } from './components/AliaAskProvider';
23
23
  export type { AliaAsk, AliaAskAgents, AliaAskProviderProps } from './components/AliaAskProvider';
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The canonical name of an app's catalogue tool — `oxy_<app>__<tool>` for the person's
3
+ * account, `self_<app>__<tool>` for the agent's own — read back into its app and tool.
4
+ *
5
+ * Pure (no React, no React Native), so a host's own models and tests can tell which
6
+ * app a tool call belongs to: it is the `@alia.onl/sdk/tools` entry's, and the renderers
7
+ * (`tool-renderers.tsx`) key on it. The app part is an Oxy app slug; the tool part is
8
+ * whatever follows the separator. Nothing else names a renderer — never the model's text.
9
+ */
10
+ const CANONICAL_TOOL = /^(?:oxy|self)_([a-z][a-z0-9-]{0,63})__([A-Za-z0-9_-]+)$/;
11
+
12
+ /** The app and tool of a canonical catalogue tool name, or `null` for any other name. */
13
+ export function parseCatalogueTool(toolName: string): { app: string; tool: string } | null {
14
+ const match = CANONICAL_TOOL.exec(toolName);
15
+ return match ? { app: match[1], tool: match[2] } : null;
16
+ }
17
+
18
+ /** The renderer key of a tool name (`<app>:<tool>`), or `null` when it is not a catalogue tool. */
19
+ export function toolRendererKey(toolName: string): string | null {
20
+ const parsed = parseCatalogueTool(toolName);
21
+ return parsed ? `${parsed.app}:${parsed.tool}` : null;
22
+ }
@@ -22,23 +22,7 @@ export interface AliaToolResult {
22
22
  */
23
23
  export type AliaToolRenderers = Readonly<Record<string, (result: AliaToolResult) => ReactNode>>;
24
24
 
25
- /**
26
- * `oxy_<app>__<tool>` or `self_<app>__<tool>`: the only names a renderer is keyed from. The app
27
- * part is an Oxy app slug; the tool part is whatever follows the separator.
28
- */
29
- const CANONICAL_TOOL = /^(?:oxy|self)_([a-z][a-z0-9-]{0,63})__([A-Za-z0-9_-]+)$/;
30
-
31
- /** The app and tool of a canonical catalogue tool name, or `null` for any other name. */
32
- export function parseCatalogueTool(toolName: string): { app: string; tool: string } | null {
33
- const match = CANONICAL_TOOL.exec(toolName);
34
- return match ? { app: match[1], tool: match[2] } : null;
35
- }
36
-
37
- /** The renderer key of a tool name (`<app>:<tool>`), or `null` when it is not a catalogue tool. */
38
- export function toolRendererKey(toolName: string): string | null {
39
- const parsed = parseCatalogueTool(toolName);
40
- return parsed ? `${parsed.app}:${parsed.tool}` : null;
41
- }
25
+ export { parseCatalogueTool, toolRendererKey } from './catalogue-tool';
42
26
 
43
27
  const RenderersContext = createContext<AliaToolRenderers>({});
44
28
 
package/src/tools.ts CHANGED
@@ -9,6 +9,7 @@ export {
9
9
  normalizeCitationMarkers,
10
10
  } from './lib/citations';
11
11
  export { domainOf } from './lib/domain';
12
+ export { parseCatalogueTool, toolRendererKey } from './lib/catalogue-tool';
12
13
  export type { CitationSource } from './lib/citations';
13
14
  export { getToolDoneLabel, getToolPillLabel } from './lib/task-labels';
14
15
  export {