@stina/extension-api 0.30.2 → 0.31.1-alpha.67639c6

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.
@@ -102,6 +102,7 @@
102
102
  "storage.collections",
103
103
  "secrets.manage",
104
104
  "user.profile.read",
105
+ "user.list",
105
106
  "user.location.read",
106
107
  "chat.history.read",
107
108
  "chat.current.read",
@@ -856,6 +857,21 @@
856
857
  "type": "object",
857
858
  "additionalProperties": {},
858
859
  "description": "Parameter schema (JSON Schema)"
860
+ },
861
+ "requiresConfirmation": {
862
+ "type": "boolean",
863
+ "description": "Whether this tool requires user confirmation before execution (default: true)"
864
+ },
865
+ "confirmationPrompt": {
866
+ "anyOf": [
867
+ {
868
+ "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/tools/items/properties/name/anyOf/0"
869
+ },
870
+ {
871
+ "$ref": "#/definitions/ExtensionManifest/properties/contributes/properties/tools/items/properties/name/anyOf/1"
872
+ }
873
+ ],
874
+ "description": "Custom confirmation prompt"
859
875
  }
860
876
  },
861
877
  "required": [
package/src/messages.ts CHANGED
@@ -201,6 +201,7 @@ export type RequestMethod =
201
201
  | 'settings.get'
202
202
  | 'settings.set'
203
203
  | 'user.getProfile'
204
+ | 'user.listIds'
204
205
  | 'events.emit'
205
206
  | 'scheduler.schedule'
206
207
  | 'scheduler.cancel'
package/src/runtime.ts CHANGED
@@ -823,6 +823,9 @@ function buildContext(
823
823
  async getProfile(): Promise<UserProfile> {
824
824
  return sendRequest<UserProfile>('user.getProfile', {})
825
825
  },
826
+ async listIds(): Promise<string[]> {
827
+ return sendRequest<string[]>('user.listIds', {})
828
+ },
826
829
  }
827
830
  ;(context as { user: UserAPI }).user = userApi
828
831
  }
@@ -353,6 +353,8 @@ export const ToolDefinitionSchema = z
353
353
  name: LocalizedStringSchema.describe('Display name'),
354
354
  description: LocalizedStringSchema.describe('Description for Stina'),
355
355
  parameters: z.record(z.unknown()).optional().describe('Parameter schema (JSON Schema)'),
356
+ requiresConfirmation: z.boolean().optional().describe('Whether this tool requires user confirmation before execution (default: true)'),
357
+ confirmationPrompt: LocalizedStringSchema.optional().describe('Custom confirmation prompt'),
356
358
  })
357
359
  .describe('Tool definition')
358
360
 
@@ -16,6 +16,7 @@ export const VALID_PERMISSIONS = [
16
16
  'storage.collections',
17
17
  'secrets.manage',
18
18
  'user.profile.read',
19
+ 'user.list',
19
20
  'user.location.read',
20
21
  'chat.history.read',
21
22
  'chat.current.read',
@@ -73,7 +74,7 @@ const StoragePermissionSchema = z.enum(['storage.collections', 'secrets.manage']
73
74
  * User data permission schema
74
75
  */
75
76
  const UserDataPermissionSchema = z
76
- .enum(['user.profile.read', 'user.location.read', 'chat.history.read', 'chat.current.read'])
77
+ .enum(['user.profile.read', 'user.list', 'user.location.read', 'chat.history.read', 'chat.current.read'])
77
78
  .describe('User data access permission')
78
79
 
79
80
  /**
@@ -319,6 +319,7 @@ export interface UserProfile {
319
319
  */
320
320
  export interface UserAPI {
321
321
  getProfile(): Promise<UserProfile>
322
+ listIds(): Promise<string[]>
322
323
  }
323
324
 
324
325
  /**
@@ -374,13 +374,20 @@ export interface ToolDefinition {
374
374
  /** Parameter schema (JSON Schema) */
375
375
  parameters?: Record<string, unknown>
376
376
  /**
377
- * Confirmation configuration. If set, user must confirm before tool runs.
378
- * If not set, tool runs without confirmation.
377
+ * Whether this tool requires user confirmation before execution.
378
+ * Defaults to true if not specified tools require confirmation unless explicitly opted out.
379
379
  */
380
- confirmation?: ToolConfirmationConfig
380
+ requiresConfirmation?: boolean
381
+ /**
382
+ * Optional custom confirmation prompt to show the user.
383
+ * Only used when confirmation is required.
384
+ * @example { en: "Allow sending email?", sv: "Tillåt att skicka e-post?" }
385
+ */
386
+ confirmationPrompt?: LocalizedString
381
387
  }
382
388
 
383
389
  /**
390
+ * @deprecated Use `requiresConfirmation` and `confirmationPrompt` directly on ToolDefinition instead.
384
391
  * Configuration for tool confirmation.
385
392
  */
386
393
  export interface ToolConfirmationConfig {
@@ -24,6 +24,7 @@ export type StoragePermission = 'storage.collections' | 'secrets.manage'
24
24
  /** User data permissions */
25
25
  export type UserDataPermission =
26
26
  | 'user.profile.read'
27
+ | 'user.list'
27
28
  | 'user.location.read'
28
29
  | 'chat.history.read'
29
30
  | 'chat.current.read'