lumiverse-spindle-types 0.6.44 → 0.6.45

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/api.d.ts CHANGED
@@ -3333,7 +3333,7 @@ export interface ProviderManager {
3333
3333
  key: ProviderKeyDTO;
3334
3334
  }) => void): () => void;
3335
3335
  }
3336
- export type WorkerToHost = import("./file-transfers.js").FileTransferWorkerMessage | import("./desktop-capture.js").DesktopCaptureWorkerMessage | {
3336
+ export type WorkerToHost = import("./decisions.js").DecisionWorkerMessage | import("./file-transfers.js").FileTransferWorkerMessage | import("./desktop-capture.js").DesktopCaptureWorkerMessage | {
3337
3337
  type: "subscribe_event";
3338
3338
  event: string;
3339
3339
  } | {
@@ -0,0 +1,143 @@
1
+ /** Native typed Decision API. Requires decisions permission and decisions-v1 host capability. */
2
+ export type DecisionJsonValue = null | boolean | number | string | DecisionJsonValue[] | {
3
+ [key: string]: DecisionJsonValue;
4
+ };
5
+ export type DecisionDescription = string | DecisionJsonValue[] | {
6
+ [key: string]: DecisionJsonValue;
7
+ };
8
+ export type DecisionState = DecisionDescription;
9
+ export type DecisionQuestion = {
10
+ type: "choice";
11
+ instructions: DecisionDescription;
12
+ criteria: Record<string, DecisionDescription | null>;
13
+ } | {
14
+ type: "score";
15
+ instructions: DecisionDescription;
16
+ criteria: DecisionDescription[];
17
+ } | {
18
+ type: "noul";
19
+ instructions: DecisionDescription;
20
+ criteria?: {
21
+ true: DecisionDescription;
22
+ false: DecisionDescription;
23
+ };
24
+ };
25
+ export type DecisionAnswer = {
26
+ type: "choice";
27
+ choice: string;
28
+ probabilities: Record<string, number>;
29
+ confidence: number;
30
+ } | {
31
+ type: "score";
32
+ score: number;
33
+ probabilities: Record<string, number>;
34
+ confidence: number;
35
+ legend: Record<string, DecisionDescription>;
36
+ } | {
37
+ type: "noul";
38
+ noul: number;
39
+ };
40
+ export type DecisionAnswerFor<Q extends DecisionQuestion> = Q extends {
41
+ type: "choice";
42
+ criteria: infer C;
43
+ } ? Omit<Extract<DecisionAnswer, {
44
+ type: "choice";
45
+ }>, "choice" | "probabilities"> & {
46
+ choice: Extract<keyof C, string>;
47
+ probabilities: Record<Extract<keyof C, string>, number>;
48
+ } : Q extends {
49
+ type: "score";
50
+ } ? Extract<DecisionAnswer, {
51
+ type: "score";
52
+ }> : Extract<DecisionAnswer, {
53
+ type: "noul";
54
+ }>;
55
+ export type DecisionAnswers<Q extends Record<string, DecisionQuestion>> = {
56
+ [K in keyof Q]: DecisionAnswerFor<Q[K]>;
57
+ };
58
+ export interface DecisionResult<Q extends Record<string, DecisionQuestion> = Record<string, DecisionQuestion>> {
59
+ model: string;
60
+ answers: DecisionAnswers<Q>;
61
+ usage?: {
62
+ input_tokens?: number | null;
63
+ output_tokens?: number | null;
64
+ cost?: number | null;
65
+ [key: string]: unknown;
66
+ };
67
+ id?: string;
68
+ provider?: string;
69
+ }
70
+ export interface DecisionEvaluationInput<Q extends Record<string, DecisionQuestion> = Record<string, DecisionQuestion>> {
71
+ connection_id?: string;
72
+ model?: string;
73
+ state: DecisionState;
74
+ questions: Q;
75
+ userId?: string;
76
+ }
77
+ export interface DecisionConnectionProfileDTO {
78
+ id: string;
79
+ name: string;
80
+ provider: string;
81
+ api_url: string;
82
+ model: string;
83
+ is_default: boolean;
84
+ has_api_key: boolean;
85
+ default_parameters: Record<string, unknown>;
86
+ metadata: Record<string, unknown>;
87
+ created_at: number;
88
+ updated_at: number;
89
+ }
90
+ export interface DecisionModelDTO {
91
+ id: string;
92
+ label: string;
93
+ description?: string;
94
+ input_modalities?: string[];
95
+ output_modalities?: string[];
96
+ context_length?: number;
97
+ pricing?: Record<string, string>;
98
+ protocol: "supported" | "unsupported" | "unverified";
99
+ }
100
+ export interface DecisionProviderDTO {
101
+ id: string;
102
+ name: string;
103
+ capabilities: {
104
+ apiKeyRequired: boolean;
105
+ defaultUrl: string;
106
+ suggestedModel: string;
107
+ modelListStyle: "dynamic";
108
+ };
109
+ }
110
+ export interface SpindleDecisionsAPI {
111
+ listProviders(options?: {
112
+ userId?: string;
113
+ }): Promise<DecisionProviderDTO[]>;
114
+ listConnections(options?: {
115
+ userId?: string;
116
+ }): Promise<DecisionConnectionProfileDTO[]>;
117
+ getConnection(id: string, options?: {
118
+ userId?: string;
119
+ }): Promise<DecisionConnectionProfileDTO | null>;
120
+ getModels(id: string, options?: {
121
+ userId?: string;
122
+ }): Promise<DecisionModelDTO[]>;
123
+ evaluate<const Q extends Record<string, DecisionQuestion>>(input: DecisionEvaluationInput<Q>, options?: {
124
+ signal?: AbortSignal;
125
+ }): Promise<DecisionResult<Q>>;
126
+ }
127
+ export type DecisionWorkerMessage = {
128
+ type: "decisions_providers" | "decisions_connections_list";
129
+ requestId: string;
130
+ userId?: string;
131
+ } | {
132
+ type: "decisions_connection_get" | "decisions_models";
133
+ requestId: string;
134
+ connectionId: string;
135
+ userId?: string;
136
+ } | {
137
+ type: "decisions_evaluate";
138
+ requestId: string;
139
+ input: DecisionEvaluationInput;
140
+ } | {
141
+ type: "decisions_cancel";
142
+ requestId: string;
143
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/host.js CHANGED
@@ -11,6 +11,7 @@ export const SPINDLE_HOST_CAPABILITIES = Object.freeze({
11
11
  "frontend-extensibility-v2": 1,
12
12
  "frontend-runtime-capabilities-v1": 1,
13
13
  "mcp-servers-v1": 1,
14
+ "decisions-v1": 1,
14
15
  "file-transfers-v1": 1,
15
16
  });
16
17
  /** Structured error code returned when host compatibility validation fails. */
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export type { DecisionJsonValue, DecisionDescription, DecisionState, DecisionQuestion, DecisionAnswer, DecisionAnswerFor, DecisionAnswers, DecisionResult, DecisionEvaluationInput, DecisionConnectionProfileDTO, DecisionModelDTO, DecisionProviderDTO, SpindleDecisionsAPI, DecisionWorkerMessage } from "./decisions.js";
1
2
  export type { SpindleManifest, SpindlePermission, SpindleCapability, } from "./manifest.js";
2
3
  export { IDENTIFIER_PATTERN, validateIdentifier, } from "./manifest.js";
3
4
  export type { SpindleHostDescriptorV1, SpindleHostLocale, SpindleHostLocaleAPI, } from "./host.js";
@@ -4,6 +4,7 @@
4
4
  * Free tier (no declaration needed): events, storage, macros, dom, variables
5
5
  *
6
6
  * Gated tier (must declare):
7
+ * - "decisions" — inspect and invoke saved Decision model connections
7
8
  * - "generation" — fire generations on behalf of user
8
9
  * - "interceptor" — pre-generation prompt modification
9
10
  * - "tools" — register LLM tools
@@ -41,6 +42,6 @@
41
42
  * device is playing (never samples), desktop client only. Privileged;
42
43
  * the host asks the user on every start.
43
44
  */
44
- export type SpindlePermission = "screen_capture" | "screen_recording" | "system_audio" | "generation" | "interceptor" | "tools" | "cors_proxy" | "context_handler" | "ephemeral_storage" | "chat_mutation" | "event_tracking" | "ui_panels" | "app_manipulation" | "oauth" | "characters" | "chats" | "presets" | "world_books" | "regex_scripts" | "regex_scripts_unrestricted" | "databanks" | "memories" | "media" | "personas" | "push_notification" | "image_gen" | "images" | "generation_parameters" | "macro_interceptor" | "web_search" | "unsafe_eval" | "final_response" | "providers.embedding.register" | "providers.tts.register" | "providers.stt.register" | "providers.sidecar.register" | "mcp_servers" | "mcp_servers.create";
45
+ export type SpindlePermission = "screen_capture" | "screen_recording" | "system_audio" | "generation" | "interceptor" | "tools" | "cors_proxy" | "context_handler" | "ephemeral_storage" | "chat_mutation" | "event_tracking" | "ui_panels" | "app_manipulation" | "oauth" | "characters" | "chats" | "presets" | "world_books" | "regex_scripts" | "regex_scripts_unrestricted" | "databanks" | "memories" | "media" | "personas" | "push_notification" | "decisions" | "image_gen" | "images" | "generation_parameters" | "macro_interceptor" | "web_search" | "unsafe_eval" | "final_response" | "providers.embedding.register" | "providers.tts.register" | "providers.stt.register" | "providers.sidecar.register" | "mcp_servers" | "mcp_servers.create";
45
46
  export declare const ALL_PERMISSIONS: readonly SpindlePermission[];
46
47
  export declare function isValidPermission(p: string): p is SpindlePermission;
@@ -24,6 +24,7 @@ export const ALL_PERMISSIONS = [
24
24
  "media",
25
25
  "personas",
26
26
  "push_notification",
27
+ "decisions",
27
28
  "image_gen",
28
29
  "images",
29
30
  "generation_parameters",
@@ -134,6 +134,8 @@ export interface SpindleConnectionsAPI {
134
134
  }
135
135
  /** The global `spindle` object available in backend extension workers */
136
136
  export interface SpindleAPI {
137
+ /** Typed Decision models (permission: decisions; host capability: decisions-v1). */
138
+ decisions: import("./decisions.js").SpindleDecisionsAPI;
137
139
  /** Disk-backed downloads and bounded reads/writes. Available with file-transfers-v1. */
138
140
  readonly files: SpindleFilesAPI;
139
141
  /** Streaming ZIP64 creation and validated disk-backed extraction. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumiverse-spindle-types",
3
- "version": "0.6.44",
3
+ "version": "0.6.45",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "keywords": [
@@ -26,6 +26,7 @@
26
26
  }
27
27
  },
28
28
  "scripts": {
29
+ "prepack": "npm run build",
29
30
  "build": "tsc -p tsconfig.json",
30
31
  "build:consumer": "tsc -p tsconfig.consumer.json --noEmit && node test/scripts/verify-packed-consumer.mjs",
31
32
  "test": "bun test"