lumiverse-spindle-types 0.2.0 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "types": "./src/index.ts",
5
5
  "keywords": [
6
6
  "lumiverse",
package/src/api.ts CHANGED
@@ -25,11 +25,30 @@ export interface ToolRegistrationDTO {
25
25
  council_eligible?: boolean;
26
26
  }
27
27
 
28
+ /** Tool/function schema passed to LLM for inline function calling. */
29
+ export interface ToolSchemaDTO {
30
+ name: string;
31
+ description: string;
32
+ parameters: Record<string, unknown>; // JSON Schema
33
+ }
34
+
35
+ /** A single function call made by the LLM. */
36
+ export interface ToolCallDTO {
37
+ /** Tool name (as given in the schema). */
38
+ name: string;
39
+ /** Parsed JSON arguments as returned by the LLM. */
40
+ args: Record<string, unknown>;
41
+ /** Provider call ID (e.g. Anthropic `id`, OpenAI `id`). Synthetic UUID for providers that don't supply one (e.g. Google). */
42
+ call_id: string;
43
+ }
44
+
28
45
  export interface GenerationRequestDTO {
29
46
  type: "raw" | "quiet" | "batch";
30
47
  messages?: LlmMessageDTO[];
31
48
  parameters?: Record<string, unknown>;
32
49
  connection_id?: string;
50
+ /** Optional tool/function definitions for inline function calling (raw/quiet only). */
51
+ tools?: ToolSchemaDTO[];
33
52
  /**
34
53
  * For operator-scoped extensions: the user ID whose connection profiles
35
54
  * and generation context should be used. For user-scoped extensions this
@@ -618,7 +637,10 @@ export type WorkerToHost =
618
637
  // ─── Chat Memories (gated: "chats") ───────────────────────────────
619
638
  | { type: "chats_get_memories"; requestId: string; chatId: string; topK?: number; userId?: string }
620
639
  // ─── Toast (free tier) ───────────────────────────────────────────────
621
- | { type: "toast_show"; toastType: "success" | "warning" | "error" | "info"; message: string; title?: string; duration?: number };
640
+ | { type: "toast_show"; toastType: "success" | "warning" | "error" | "info"; message: string; title?: string; duration?: number }
641
+ // ─── Push Notifications (gated: "push_notification") ────────────────
642
+ | { type: "push_send"; requestId: string; title: string; body: string; tag?: string; url?: string; userId?: string }
643
+ | { type: "push_get_status"; requestId: string; userId?: string };
622
644
 
623
645
  // ─── Host → Worker messages ──────────────────────────────────────────────
624
646
 
package/src/index.ts CHANGED
@@ -16,6 +16,8 @@ export type {
16
16
  LlmMessageDTO,
17
17
  MacroDefinitionDTO,
18
18
  ToolRegistrationDTO,
19
+ ToolSchemaDTO,
20
+ ToolCallDTO,
19
21
  GenerationRequestDTO,
20
22
  RequestInitDTO,
21
23
  ConnectionProfileDTO,
@@ -28,7 +28,8 @@ export type SpindlePermission =
28
28
  | "characters"
29
29
  | "chats"
30
30
  | "world_books"
31
- | "personas";
31
+ | "personas"
32
+ | "push_notification";
32
33
 
33
34
  export const ALL_PERMISSIONS: readonly SpindlePermission[] = [
34
35
  "generation",
@@ -46,6 +47,7 @@ export const ALL_PERMISSIONS: readonly SpindlePermission[] = [
46
47
  "chats",
47
48
  "world_books",
48
49
  "personas",
50
+ "push_notification",
49
51
  ] as const;
50
52
 
51
53
  export function isValidPermission(p: string): p is SpindlePermission {
@@ -376,6 +376,32 @@ export interface SpindleAPI {
376
376
  error(msg: string): void;
377
377
  };
378
378
 
379
+ /**
380
+ * Push notifications (permission: "push_notification").
381
+ * Send OS-level push notifications to users and check push status.
382
+ * Notifications are attributed to your extension name.
383
+ */
384
+ push: {
385
+ /**
386
+ * Send a push notification to a user's registered devices.
387
+ * Only delivered when the app is not focused (avoids double-notification).
388
+ */
389
+ send(input: {
390
+ title: string;
391
+ body: string;
392
+ tag?: string;
393
+ url?: string;
394
+ }, userId?: string): Promise<{ sent: number }>;
395
+ /**
396
+ * Check if push notifications are available for a user.
397
+ * Returns subscription count and whether the push system is active.
398
+ */
399
+ getStatus(userId?: string): Promise<{
400
+ available: boolean;
401
+ subscriptionCount: number;
402
+ }>;
403
+ };
404
+
379
405
  /** Show toast notifications in the frontend UI (free tier — no permission needed) */
380
406
  toast: {
381
407
  success(message: string, options?: { title?: string; duration?: number }): void;