@stina/extension-api 0.19.1 → 0.21.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -3
- package/dist/index.d.ts +62 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +29 -43
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +29 -43
- package/dist/runtime.js.map +1 -1
- package/dist/{types-CvfONPis.d.cts → types.tools-BQrCW_wq.d.cts} +250 -217
- package/dist/{types-CvfONPis.d.ts → types.tools-BQrCW_wq.d.ts} +250 -217
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/runtime.ts +37 -49
- package/src/types.components.ts +21 -0
- package/src/types.context.ts +399 -0
- package/src/types.contributions.ts +404 -0
- package/src/types.localization.ts +39 -0
- package/src/types.manifest.ts +45 -0
- package/src/types.permissions.ts +48 -0
- package/src/types.provider.ts +111 -0
- package/src/types.tools.ts +70 -0
- package/src/types.ts +92 -1038
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool and Action Types
|
|
3
|
+
*
|
|
4
|
+
* Types for tool and action implementations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { ExecutionContext } from './types.context.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Tool implementation
|
|
11
|
+
*/
|
|
12
|
+
export interface Tool {
|
|
13
|
+
/** Tool ID (must match manifest) */
|
|
14
|
+
id: string
|
|
15
|
+
/** Display name */
|
|
16
|
+
name: string
|
|
17
|
+
/** Description for Stina */
|
|
18
|
+
description: string
|
|
19
|
+
/** Parameter schema (JSON Schema) */
|
|
20
|
+
parameters?: Record<string, unknown>
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Execute the tool
|
|
24
|
+
* @param params Tool parameters from the AI
|
|
25
|
+
* @param context Request-scoped execution context with userId and extension metadata
|
|
26
|
+
*/
|
|
27
|
+
execute(params: Record<string, unknown>, context: ExecutionContext): Promise<ToolResult>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Tool execution result
|
|
32
|
+
*/
|
|
33
|
+
export interface ToolResult {
|
|
34
|
+
/** Whether the tool succeeded */
|
|
35
|
+
success: boolean
|
|
36
|
+
/** Result data (for Stina to use) */
|
|
37
|
+
data?: unknown
|
|
38
|
+
/** Human-readable message */
|
|
39
|
+
message?: string
|
|
40
|
+
/** Error message if failed */
|
|
41
|
+
error?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Action implementation for UI interactions.
|
|
46
|
+
* Actions are invoked by UI components, not by Stina (AI).
|
|
47
|
+
*/
|
|
48
|
+
export interface Action {
|
|
49
|
+
/** Action ID (unique within the extension) */
|
|
50
|
+
id: string
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Execute the action
|
|
54
|
+
* @param params Parameters from the UI component (with $-values already resolved)
|
|
55
|
+
* @param context Request-scoped execution context with userId and extension metadata
|
|
56
|
+
*/
|
|
57
|
+
execute(params: Record<string, unknown>, context: ExecutionContext): Promise<ActionResult>
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Action execution result
|
|
62
|
+
*/
|
|
63
|
+
export interface ActionResult {
|
|
64
|
+
/** Whether the action succeeded */
|
|
65
|
+
success: boolean
|
|
66
|
+
/** Result data (returned to UI) */
|
|
67
|
+
data?: unknown
|
|
68
|
+
/** Error message if failed */
|
|
69
|
+
error?: string
|
|
70
|
+
}
|