@appilots/sdk 0.8.0 → 0.11.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.
@@ -1,159 +0,0 @@
1
- import React__default from 'react';
2
-
3
- interface AppilotsNavigationContainerProps {
4
- children: React__default.ReactElement;
5
- }
6
- /**
7
- * Wraps your NavigationContainer from the outside and automatically
8
- * injects `ref` and `onStateChange` to track the current screen.
9
- *
10
- * ```tsx
11
- * import { NavigationContainer } from '@react-navigation/native';
12
- * import { AppilotsNavigationContainer } from '@appilots/sdk';
13
- *
14
- * <AppilotsProvider>
15
- * <AppilotsNavigationContainer>
16
- * <NavigationContainer>
17
- * <Stack.Navigator>...</Stack.Navigator>
18
- * </NavigationContainer>
19
- * </AppilotsNavigationContainer>
20
- * <AppilotsChat />
21
- * </AppilotsProvider>
22
- * ```
23
- */
24
- declare function AppilotsNavigationContainer({ children }: AppilotsNavigationContainerProps): React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
25
-
26
- /**
27
- * Navigation-related types for the Appilots SDK.
28
- */
29
- interface ScreenFieldMetadata {
30
- /** Field identifier (used by AI model to reference this field) */
31
- id: string;
32
- /** Human-readable label (must match the UI component's label) */
33
- label: string;
34
- /** Field type */
35
- type: 'text' | 'number' | 'select' | 'toggle' | 'date' | string;
36
- /** Whether the field is required */
37
- required?: boolean;
38
- /** Options for select fields */
39
- options?: {
40
- label: string;
41
- value: string;
42
- }[];
43
- }
44
- interface ScreenActionMetadata {
45
- /** Action identifier (used by AI model to reference this action) */
46
- id: string;
47
- /** Human-readable label (must match the UI component's label) */
48
- label: string;
49
- /** Action type */
50
- type: 'submit' | 'button' | 'link' | string;
51
- /** Target screen for navigation/link actions, when known. */
52
- targetScreen?: string;
53
- /**
54
- * When true, the agent MUST present a confirmation card to the user
55
- * before executing this action. Set at registerScreen time for
56
- * high-risk or destructive operations.
57
- *
58
- * The server's permission policy honours this flag when present in
59
- * the MCP doc, but a stale MCP can miss it. As defense-in-depth,
60
- * the SDK also gates such actions locally: when a `ui_interaction`
61
- * targets an action with `requiresConfirmation: true` and there is
62
- * NO already-pending confirm action in the queue, the executor
63
- * synthesises one and waits for user input before pressing.
64
- */
65
- requiresConfirmation?: boolean;
66
- /**
67
- * Structured risk/effect metadata. Prefer these fields over label
68
- * heuristics for multilingual apps: the runtime can gate the action
69
- * without trying to infer intent from Portuguese/English/etc. text.
70
- */
71
- effect?: 'read' | 'write' | 'destructive' | string;
72
- riskLevel?: 'low' | 'medium' | 'high' | string;
73
- destructive?: boolean;
74
- /**
75
- * Static-analysis hints produced by the MCP generator (Camada B).
76
- * Present only when the generator could statically prove the
77
- * handler's async shape — otherwise undefined and the SDK falls
78
- * back to agnostic runtime signals (ActivityIndicator,
79
- * pressed-button-still-disabled, fingerprint quiescence).
80
- *
81
- * Mirrors `AppilotsInferredAction` from `@appilots/mcp-generator`.
82
- * Kept as a structural type here to avoid a runtime dependency
83
- * between sdk and mcp-generator packages.
84
- */
85
- appilotsInferred?: AppilotsInferredAction;
86
- }
87
- /**
88
- * Inferred metadata about an action's expected async behavior.
89
- * See `packages/mcp-generator/docs/INFERRED_ACTION_FIELDS.md` for
90
- * the full schema and detection rules.
91
- */
92
- interface AppilotsInferredAction {
93
- isAsyncTrigger?: boolean;
94
- expectedOutcome?: 'navigation' | 'inline-feedback' | 'data-arrival' | 'mixed' | 'none';
95
- loadingStateBindings?: string[];
96
- }
97
- interface ScreenMetadata {
98
- /** Unique screen identifier */
99
- name: string;
100
- /** Human-readable title */
101
- title?: string;
102
- /** Description of what this screen does */
103
- description?: string;
104
- /** Available actions on this screen (legacy: string[], new: ScreenActionMetadata[]) */
105
- actions?: (string | ScreenActionMetadata)[];
106
- /** Form fields available on this screen (legacy: string[], new: ScreenFieldMetadata[]) */
107
- fields?: ScreenFieldMetadata[];
108
- /** Legacy: simple list of form field names */
109
- formFields?: string[];
110
- /** Tags for categorisation */
111
- tags?: string[];
112
- /**
113
- * Dev-defined prompts to surface as chips when the chat opens on this
114
- * screen. Highest priority — these win over screen-action and global
115
- * popular prompts. Keep them short and specific to the screen ("Adicionar
116
- * cliente" beats "Me ajude").
117
- *
118
- * @example
119
- * registerScreen({
120
- * name: 'Customers',
121
- * suggestedPrompts: ['Adicionar cliente', 'Buscar por nome'],
122
- * });
123
- */
124
- suggestedPrompts?: string[];
125
- }
126
- interface NavigationConfig {
127
- /** Root navigator name */
128
- rootNavigator?: string;
129
- /** Map of screen names to metadata */
130
- screens?: Record<string, ScreenMetadata>;
131
- /** Navigation linking config */
132
- linking?: {
133
- prefixes?: string[];
134
- config?: Record<string, unknown>;
135
- };
136
- }
137
-
138
- /**
139
- * Register a screen with metadata so the AI agent can understand it.
140
- *
141
- * @example
142
- * ```tsx
143
- * registerScreen({
144
- * name: 'ItemList',
145
- * title: 'Items',
146
- * description: 'Lists items available in this app',
147
- * actions: ['viewDetails', 'addItem'],
148
- * });
149
- * ```
150
- */
151
- declare function registerScreen(metadata: ScreenMetadata): void;
152
- /** Get metadata for a specific screen */
153
- declare function getScreenMetadata(name: string): ScreenMetadata | undefined;
154
- /** Get all registered screens */
155
- declare function getAllScreens(): ScreenMetadata[];
156
- /** Clear the screen registry (useful for testing) */
157
- declare function clearScreenRegistry(): void;
158
-
159
- export { AppilotsNavigationContainer as A, type NavigationConfig as N, type ScreenActionMetadata as S, type ScreenFieldMetadata as a, type ScreenMetadata as b, clearScreenRegistry as c, getScreenMetadata as d, getAllScreens as g, registerScreen as r };
@@ -1,159 +0,0 @@
1
- import React__default from 'react';
2
-
3
- interface AppilotsNavigationContainerProps {
4
- children: React__default.ReactElement;
5
- }
6
- /**
7
- * Wraps your NavigationContainer from the outside and automatically
8
- * injects `ref` and `onStateChange` to track the current screen.
9
- *
10
- * ```tsx
11
- * import { NavigationContainer } from '@react-navigation/native';
12
- * import { AppilotsNavigationContainer } from '@appilots/sdk';
13
- *
14
- * <AppilotsProvider>
15
- * <AppilotsNavigationContainer>
16
- * <NavigationContainer>
17
- * <Stack.Navigator>...</Stack.Navigator>
18
- * </NavigationContainer>
19
- * </AppilotsNavigationContainer>
20
- * <AppilotsChat />
21
- * </AppilotsProvider>
22
- * ```
23
- */
24
- declare function AppilotsNavigationContainer({ children }: AppilotsNavigationContainerProps): React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
25
-
26
- /**
27
- * Navigation-related types for the Appilots SDK.
28
- */
29
- interface ScreenFieldMetadata {
30
- /** Field identifier (used by AI model to reference this field) */
31
- id: string;
32
- /** Human-readable label (must match the UI component's label) */
33
- label: string;
34
- /** Field type */
35
- type: 'text' | 'number' | 'select' | 'toggle' | 'date' | string;
36
- /** Whether the field is required */
37
- required?: boolean;
38
- /** Options for select fields */
39
- options?: {
40
- label: string;
41
- value: string;
42
- }[];
43
- }
44
- interface ScreenActionMetadata {
45
- /** Action identifier (used by AI model to reference this action) */
46
- id: string;
47
- /** Human-readable label (must match the UI component's label) */
48
- label: string;
49
- /** Action type */
50
- type: 'submit' | 'button' | 'link' | string;
51
- /** Target screen for navigation/link actions, when known. */
52
- targetScreen?: string;
53
- /**
54
- * When true, the agent MUST present a confirmation card to the user
55
- * before executing this action. Set at registerScreen time for
56
- * high-risk or destructive operations.
57
- *
58
- * The server's permission policy honours this flag when present in
59
- * the MCP doc, but a stale MCP can miss it. As defense-in-depth,
60
- * the SDK also gates such actions locally: when a `ui_interaction`
61
- * targets an action with `requiresConfirmation: true` and there is
62
- * NO already-pending confirm action in the queue, the executor
63
- * synthesises one and waits for user input before pressing.
64
- */
65
- requiresConfirmation?: boolean;
66
- /**
67
- * Structured risk/effect metadata. Prefer these fields over label
68
- * heuristics for multilingual apps: the runtime can gate the action
69
- * without trying to infer intent from Portuguese/English/etc. text.
70
- */
71
- effect?: 'read' | 'write' | 'destructive' | string;
72
- riskLevel?: 'low' | 'medium' | 'high' | string;
73
- destructive?: boolean;
74
- /**
75
- * Static-analysis hints produced by the MCP generator (Camada B).
76
- * Present only when the generator could statically prove the
77
- * handler's async shape — otherwise undefined and the SDK falls
78
- * back to agnostic runtime signals (ActivityIndicator,
79
- * pressed-button-still-disabled, fingerprint quiescence).
80
- *
81
- * Mirrors `AppilotsInferredAction` from `@appilots/mcp-generator`.
82
- * Kept as a structural type here to avoid a runtime dependency
83
- * between sdk and mcp-generator packages.
84
- */
85
- appilotsInferred?: AppilotsInferredAction;
86
- }
87
- /**
88
- * Inferred metadata about an action's expected async behavior.
89
- * See `packages/mcp-generator/docs/INFERRED_ACTION_FIELDS.md` for
90
- * the full schema and detection rules.
91
- */
92
- interface AppilotsInferredAction {
93
- isAsyncTrigger?: boolean;
94
- expectedOutcome?: 'navigation' | 'inline-feedback' | 'data-arrival' | 'mixed' | 'none';
95
- loadingStateBindings?: string[];
96
- }
97
- interface ScreenMetadata {
98
- /** Unique screen identifier */
99
- name: string;
100
- /** Human-readable title */
101
- title?: string;
102
- /** Description of what this screen does */
103
- description?: string;
104
- /** Available actions on this screen (legacy: string[], new: ScreenActionMetadata[]) */
105
- actions?: (string | ScreenActionMetadata)[];
106
- /** Form fields available on this screen (legacy: string[], new: ScreenFieldMetadata[]) */
107
- fields?: ScreenFieldMetadata[];
108
- /** Legacy: simple list of form field names */
109
- formFields?: string[];
110
- /** Tags for categorisation */
111
- tags?: string[];
112
- /**
113
- * Dev-defined prompts to surface as chips when the chat opens on this
114
- * screen. Highest priority — these win over screen-action and global
115
- * popular prompts. Keep them short and specific to the screen ("Adicionar
116
- * cliente" beats "Me ajude").
117
- *
118
- * @example
119
- * registerScreen({
120
- * name: 'Customers',
121
- * suggestedPrompts: ['Adicionar cliente', 'Buscar por nome'],
122
- * });
123
- */
124
- suggestedPrompts?: string[];
125
- }
126
- interface NavigationConfig {
127
- /** Root navigator name */
128
- rootNavigator?: string;
129
- /** Map of screen names to metadata */
130
- screens?: Record<string, ScreenMetadata>;
131
- /** Navigation linking config */
132
- linking?: {
133
- prefixes?: string[];
134
- config?: Record<string, unknown>;
135
- };
136
- }
137
-
138
- /**
139
- * Register a screen with metadata so the AI agent can understand it.
140
- *
141
- * @example
142
- * ```tsx
143
- * registerScreen({
144
- * name: 'ItemList',
145
- * title: 'Items',
146
- * description: 'Lists items available in this app',
147
- * actions: ['viewDetails', 'addItem'],
148
- * });
149
- * ```
150
- */
151
- declare function registerScreen(metadata: ScreenMetadata): void;
152
- /** Get metadata for a specific screen */
153
- declare function getScreenMetadata(name: string): ScreenMetadata | undefined;
154
- /** Get all registered screens */
155
- declare function getAllScreens(): ScreenMetadata[];
156
- /** Clear the screen registry (useful for testing) */
157
- declare function clearScreenRegistry(): void;
158
-
159
- export { AppilotsNavigationContainer as A, type NavigationConfig as N, type ScreenActionMetadata as S, type ScreenFieldMetadata as a, type ScreenMetadata as b, clearScreenRegistry as c, getScreenMetadata as d, getAllScreens as g, registerScreen as r };