@blastlauncher/runtime 1.0.5 → 3.0.0-alpha.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/README.md +4 -10
- package/dist/api/action-panel.d.ts +134 -0
- package/dist/api/action-panel.js +36 -0
- package/dist/api/action.d.ts +386 -0
- package/dist/api/action.js +260 -0
- package/dist/api/ai-browser.d.ts +423 -0
- package/dist/api/ai-browser.js +113 -0
- package/dist/api/ai-decide.d.ts +41 -0
- package/dist/api/ai-decide.js +62 -0
- package/dist/api/applications.d.ts +13 -0
- package/dist/api/applications.js +48 -0
- package/dist/api/cache.d.ts +27 -0
- package/dist/api/cache.js +126 -0
- package/dist/api/capability.d.ts +14 -0
- package/dist/api/capability.js +30 -0
- package/dist/api/clipboard.d.ts +57 -0
- package/dist/api/clipboard.js +83 -0
- package/dist/api/detail.d.ts +33 -0
- package/dist/api/detail.js +11 -0
- package/dist/api/diagnostics.d.ts +16 -0
- package/dist/api/diagnostics.js +26 -0
- package/dist/api/dropdown.d.ts +17 -0
- package/dist/api/dropdown.js +48 -0
- package/dist/api/enums.generated.d.ts +750 -0
- package/dist/api/enums.generated.js +719 -0
- package/dist/api/environment.d.ts +44 -0
- package/dist/api/environment.js +61 -0
- package/dist/api/feedback.d.ts +94 -0
- package/dist/api/feedback.js +228 -0
- package/dist/api/form.d.ts +162 -0
- package/dist/api/form.js +345 -0
- package/dist/api/grid.d.ts +293 -0
- package/dist/api/grid.js +36 -0
- package/dist/api/implemented.d.ts +53 -0
- package/dist/api/implemented.js +43 -0
- package/dist/api/index.d.ts +612 -0
- package/dist/api/index.js +82 -0
- package/dist/api/keyboard.d.ts +182 -0
- package/dist/api/keyboard.js +107 -0
- package/dist/api/launch.d.ts +40 -0
- package/dist/api/launch.js +27 -0
- package/dist/api/legacy.d.ts +9 -0
- package/dist/api/legacy.js +25 -0
- package/dist/api/list.d.ts +291 -0
- package/dist/api/list.js +28 -0
- package/dist/api/menu-bar.d.ts +54 -0
- package/dist/api/menu-bar.js +30 -0
- package/dist/api/metadata.d.ts +62 -0
- package/dist/api/metadata.js +33 -0
- package/dist/api/navigation.d.ts +36 -0
- package/dist/api/navigation.js +99 -0
- package/dist/api/oauth.d.ts +84 -0
- package/dist/api/oauth.js +125 -0
- package/dist/api/open.d.ts +18 -0
- package/dist/api/open.js +36 -0
- package/dist/api/preferences.d.ts +43 -0
- package/dist/api/preferences.js +41 -0
- package/dist/api/selection.d.ts +10 -0
- package/dist/api/selection.js +31 -0
- package/dist/api/slot.d.ts +7 -0
- package/dist/api/slot.js +11 -0
- package/dist/api/storage.d.ts +24 -0
- package/dist/api/storage.js +45 -0
- package/dist/api/types.d.ts +46 -0
- package/dist/api/types.js +5 -0
- package/dist/api/unsupported.d.ts +18 -0
- package/dist/api/unsupported.generated.d.ts +1255 -0
- package/dist/api/unsupported.generated.js +56 -0
- package/dist/api/unsupported.js +65 -0
- package/dist/api/window-management.d.ts +97 -0
- package/dist/api/window-management.js +164 -0
- package/dist/api/window.d.ts +16 -0
- package/dist/api/window.js +32 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +339 -0
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +107 -0
- package/dist/reconciler/index.d.ts +9 -0
- package/dist/reconciler/index.js +186 -0
- package/dist/reconciler/serialize.d.ts +3 -0
- package/dist/reconciler/serialize.js +53 -0
- package/dist/reconciler/types.d.ts +8 -0
- package/dist/reconciler/types.js +1 -0
- package/package.json +32 -23
- package/.eslintrc.js +0 -6
- package/CHANGELOG.md +0 -19
- package/dist/App.d.ts +0 -5
- package/dist/App.js +0 -10
- package/dist/components/CommandList/index.d.ts +0 -1
- package/dist/components/CommandList/index.js +0 -20
- package/dist/components/CommandList/utils.d.ts +0 -1
- package/dist/components/CommandList/utils.js +0 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -11
- package/dist/utils/connectDevtools.d.ts +0 -1
- package/dist/utils/connectDevtools.js +0 -11
- package/dist/utils/run.d.ts +0 -4
- package/dist/utils/run.js +0 -12
- package/dist/utils/window.d.ts +0 -0
- package/dist/utils/window.js +0 -2
- package/src/@types/raycast.d.ts +0 -4
- package/src/@types/react-devtools-core.d.ts +0 -19
- package/src/App.tsx +0 -18
- package/src/components/CommandList/index.tsx +0 -27
- package/src/components/CommandList/utils.ts +0 -26
- package/src/index.ts +0 -13
- package/src/utils/connectDevtools.ts +0 -8
- package/src/utils/run.ts +0 -7
- package/src/utils/window.js +0 -1
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { experimental_decide } from "./ai-decide.js";
|
|
2
|
+
import { AI as enums } from "./enums.generated.js";
|
|
3
|
+
import type { ActionStyle } from "./action.js";
|
|
4
|
+
export declare const OPTIONAL_API: symbol;
|
|
5
|
+
export type Creativity = "none" | "low" | "medium" | "high" | "maximum" | number;
|
|
6
|
+
export type ModelSelector = (typeof enums.Model)[keyof typeof enums.Model] | {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
export type AskOptions = {
|
|
10
|
+
creativity?: Creativity;
|
|
11
|
+
model?: ModelSelector;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
};
|
|
14
|
+
declare function ask(prompt: string, options?: AskOptions): Promise<string> & {
|
|
15
|
+
on(event: "data", listener: (chunk: string) => void): void;
|
|
16
|
+
};
|
|
17
|
+
export declare const AI: {
|
|
18
|
+
[OPTIONAL_API]: string;
|
|
19
|
+
Model: {
|
|
20
|
+
readonly "OpenAI_GPT-5.4": "openai-gpt-5.4";
|
|
21
|
+
readonly "OpenAI_GPT-5.4_mini": "openai-gpt-5.4-mini";
|
|
22
|
+
readonly "OpenAI_GPT-5.5": "openai-gpt-5.5";
|
|
23
|
+
readonly "OpenAI_GPT-5.5_Instant": "openai-gpt-5.5-instant";
|
|
24
|
+
readonly "OpenAI_GPT-5.6_Terra": "openai-gpt-5.6-terra";
|
|
25
|
+
readonly "OpenAI_GPT-5.6_Luna": "openai-gpt-5.6-luna";
|
|
26
|
+
readonly "OpenAI_GPT-6_Astra": "openai-gpt-6-astra";
|
|
27
|
+
readonly "OpenAI_GPT-6_Sol": "openai-gpt-6-sol";
|
|
28
|
+
readonly "OpenAI_GPT-6.1_Sol": "openai-gpt-6.1-sol";
|
|
29
|
+
readonly "OpenAI_GPT-6_Luna": "openai-gpt-6-luna";
|
|
30
|
+
readonly "Groq_GPT-OSS_20b": "groq-openai/gpt-oss-20b";
|
|
31
|
+
readonly "Groq_GPT-OSS_120b": "groq-openai/gpt-oss-120b";
|
|
32
|
+
readonly "Anthropic_Claude_Haiku_5.5": "anthropic-claude-haiku-5-5";
|
|
33
|
+
readonly "Anthropic_Claude_Sonnet_4.6": "anthropic-claude-sonnet-4-6";
|
|
34
|
+
readonly Anthropic_Claude_Sonnet_5: "anthropic-claude-sonnet-5";
|
|
35
|
+
readonly "Anthropic_Claude_Sonnet_5.5": "anthropic-claude-sonnet-5-5";
|
|
36
|
+
readonly Anthropic_Claude_Opus_5: "anthropic-claude-opus-5";
|
|
37
|
+
readonly "Anthropic_Claude_Opus_5.5": "anthropic-claude-opus-5-5";
|
|
38
|
+
readonly "Anthropic_Claude_Fable_5.1": "anthropic-claude-fable-5-1";
|
|
39
|
+
readonly Perplexity_Sonar: "perplexity-sonar";
|
|
40
|
+
readonly Perplexity_Sonar_Pro: "perplexity-sonar-pro";
|
|
41
|
+
readonly "Vercel_Muse_Spark_1.3": "gateway-meta/muse-spark-1.3";
|
|
42
|
+
readonly "Vercel_Muse_Wonder_1.0": "gateway-meta/muse-wonder-1.0";
|
|
43
|
+
readonly Mistral_Large: "mistral-mistral-large-latest";
|
|
44
|
+
readonly Mistral_Medium: "mistral-mistral-medium-latest";
|
|
45
|
+
readonly Mistral_Small: "mistral-mistral-small-latest";
|
|
46
|
+
readonly Mistral_Codestral: "mistral-codestral-latest";
|
|
47
|
+
readonly Google_Gemini_4_Argon: "google-gemini-4-argon";
|
|
48
|
+
readonly "Google_Gemini_3.8_Flash": "google-gemini-3.8-flash";
|
|
49
|
+
readonly "Google_Gemini_3.5_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
50
|
+
readonly "Google_Gemini_3.1_Pro": "google-gemini-3.1-pro";
|
|
51
|
+
readonly "xAI_Grok-4.7": "xai-grok-4.7";
|
|
52
|
+
readonly "xAI_Grok-4.6": "xai-grok-4.6";
|
|
53
|
+
readonly "Vercel_GLM-5.2": "gateway-zai/glm-5.2";
|
|
54
|
+
readonly "Vercel_GLM-5.3": "gateway-zai/glm-5.3";
|
|
55
|
+
readonly "Vercel_GLM-5.3_Flash": "gateway-zai/glm-5.3-flash";
|
|
56
|
+
readonly "Vercel_Kimi_K2.7_Code": "gateway-moonshotai/kimi-k2.7-code";
|
|
57
|
+
readonly Vercel_Kimi_K3: "gateway-moonshotai/kimi-k3";
|
|
58
|
+
readonly Vercel_Gemma_4_31B: "gateway-google/gemma-4-31b-it";
|
|
59
|
+
readonly Vercel_Inkling: "gateway-thinkingmachines/inkling";
|
|
60
|
+
readonly Vercel_Inkling_Small: "gateway-thinkingmachines/inkling-small";
|
|
61
|
+
readonly Vercel_DeepSeek_V4_Flash: "gateway-deepseek/deepseek-v4-flash";
|
|
62
|
+
readonly "Vercel_DeepSeek_V4.1_Flash": "gateway-deepseek/deepseek-v4.1-flash";
|
|
63
|
+
readonly Vercel_DeepSeek_V4_Pro: "gateway-deepseek/deepseek-v4-pro-0813";
|
|
64
|
+
readonly "Vercel_Qwen3.8_Max": "gateway-alibaba/qwen3.8-max";
|
|
65
|
+
readonly "Anthropic_Claude_Haiku_4.5": "anthropic-claude-4-5-haiku";
|
|
66
|
+
readonly Mistral_Nemo: "mistral-open-mistral-nemo";
|
|
67
|
+
readonly "Google_Gemini_3.7_Flash": "google-gemini-3.7-flash";
|
|
68
|
+
readonly "OpenAI_GPT-5.3_Codex": "openai-gpt-6-sol";
|
|
69
|
+
readonly "OpenAI_GPT-5.4_nano": "openai-gpt-6-luna";
|
|
70
|
+
readonly "OpenAI_GPT-5.6_Sol": "openai-gpt-6.1-sol";
|
|
71
|
+
readonly "Anthropic_Claude_Opus_4.7": "anthropic-claude-opus-5";
|
|
72
|
+
readonly "Anthropic_Claude_Opus_4.8": "anthropic-claude-opus-5";
|
|
73
|
+
readonly "Google_Gemini_3.6_Flash": "google-gemini-3.8-flash";
|
|
74
|
+
readonly "Google_Gemini_3.5_Flash": "google-gemini-3.8-flash";
|
|
75
|
+
readonly "Google_Gemini_3.1_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
76
|
+
readonly Google_Gemini_3_Flash: "google-gemini-3.8-flash";
|
|
77
|
+
readonly "xAI_Grok-4.5": "xai-grok-4.6";
|
|
78
|
+
readonly "xAI_Grok-4.3": "xai-grok-4.6";
|
|
79
|
+
readonly "OpenAI_GPT-5_mini": "openai-gpt-5.4-mini";
|
|
80
|
+
readonly "OpenAI_GPT-5_nano": "openai-gpt-6-luna";
|
|
81
|
+
readonly "OpenAI_GPT-4.1": "openai-gpt-6-sol";
|
|
82
|
+
readonly "OpenAI_GPT-4.1_mini": "openai-gpt-6-luna";
|
|
83
|
+
readonly "OpenAI_GPT-4.1_nano": "openai-gpt-6-luna";
|
|
84
|
+
readonly "OpenAI_GPT-4": "openai-gpt-6-sol";
|
|
85
|
+
readonly "OpenAI_GPT-4o": "openai-gpt-6-sol";
|
|
86
|
+
readonly "OpenAI_GPT-4o_mini": "openai-gpt-6-luna";
|
|
87
|
+
readonly "OpenAI_GPT-5.1": "openai-gpt-6-sol";
|
|
88
|
+
readonly "OpenAI_GPT-5.2": "openai-gpt-6-sol";
|
|
89
|
+
readonly "OpenAI_GPT-5.3_Instant": "openai-gpt-6.1-sol";
|
|
90
|
+
readonly "OpenAI_o4-mini": "openai-gpt-6-luna";
|
|
91
|
+
readonly "OpenAI_o3-mini": "openai-gpt-6-luna";
|
|
92
|
+
readonly "Google_Gemini_2.5_Pro": "google-gemini-3.1-pro";
|
|
93
|
+
readonly "Google_Gemini_2.5_Flash": "google-gemini-3.8-flash";
|
|
94
|
+
readonly "Google_Gemini_2.5_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
95
|
+
readonly "OpenAI_GPT-5": "openai-gpt-5.6-terra";
|
|
96
|
+
readonly OpenAI_o3: "openai-gpt-5.6-terra";
|
|
97
|
+
readonly "Anthropic_Claude_Sonnet_4.5": "anthropic-claude-sonnet-5";
|
|
98
|
+
readonly "xAI_Grok-4.20": "xai-grok-4.6";
|
|
99
|
+
readonly "OpenAI_GPT-4_Turbo": "openai-gpt-5.6-terra";
|
|
100
|
+
readonly "OpenAI_GPT-5.2_Instant": "openai-gpt-6.1-sol";
|
|
101
|
+
readonly OpenAI_o1: "openai-gpt-5.6-terra";
|
|
102
|
+
readonly "Groq_Llama_3.3_70B": "groq-openai/gpt-oss-120b";
|
|
103
|
+
readonly "Groq_Llama_3.1_8B": "groq-openai/gpt-oss-20b";
|
|
104
|
+
readonly "Groq_Qwen3-32B": "groq-openai/gpt-oss-120b";
|
|
105
|
+
readonly "Baseten_Kimi_K2.7_Code": "gateway-moonshotai/kimi-k2.7-code";
|
|
106
|
+
readonly "Baseten_GLM-5.2": "gateway-zai/glm-5.2";
|
|
107
|
+
readonly Baseten_DeepSeek_V4_Pro: "gateway-deepseek/deepseek-v4-pro-0813";
|
|
108
|
+
readonly "xAI_Grok-3_Mini_Beta": "xai-grok-4.6";
|
|
109
|
+
readonly "Baseten_GLM-5": "gateway-zai/glm-5.2";
|
|
110
|
+
readonly Gateway_Kimi_K3: "gateway-moonshotai/kimi-k3";
|
|
111
|
+
readonly "OpenAI_GPT-5.1_Instant": "openai-gpt-5.5-instant";
|
|
112
|
+
readonly "Baseten_Kimi_K2.6": "gateway-moonshotai/kimi-k3";
|
|
113
|
+
readonly "OpenAI_GPT-5.1_Codex": "openai-gpt-6-sol";
|
|
114
|
+
readonly "Anthropic_Claude_Opus_4.6": "anthropic-claude-opus-5";
|
|
115
|
+
readonly Groq_Llama_4_Scout: "groq-openai/gpt-oss-120b";
|
|
116
|
+
readonly "Baseten_MiniMax_M2.5": "gateway-deepseek/deepseek-v4-pro-0813";
|
|
117
|
+
readonly "Baseten_Kimi_K2.5": "gateway-moonshotai/kimi-k3";
|
|
118
|
+
readonly Anthropic_Claude_Sonnet_4: "anthropic-claude-sonnet-4-6";
|
|
119
|
+
readonly "Anthropic_Claude_3.5_Haiku": "anthropic-claude-4-5-haiku";
|
|
120
|
+
readonly "Anthropic_Claude_4.5_Haiku": "anthropic-claude-4-5-haiku";
|
|
121
|
+
readonly Anthropic_Claude_4_Sonnet: "anthropic-claude-sonnet-4-6";
|
|
122
|
+
readonly "Anthropic_Claude_4.5_Sonnet": "anthropic-claude-sonnet-5";
|
|
123
|
+
readonly Anthropic_Claude_4_Opus: "anthropic-claude-opus-5";
|
|
124
|
+
readonly "Anthropic_Claude_4.1_Opus": "anthropic-claude-opus-5";
|
|
125
|
+
readonly "Together_AI_Llama_3.1_405B": "openai-gpt-5.4-mini";
|
|
126
|
+
readonly Mistral_Small_3: "mistral-mistral-small-latest";
|
|
127
|
+
readonly Groq_Kimi_K2_Instruct: "groq-openai/gpt-oss-120b";
|
|
128
|
+
readonly "Google_Gemini_2.0_Flash": "google-gemini-3.8-flash";
|
|
129
|
+
readonly "Together_AI_Qwen3-235B-A22B-Instruct-2507-tput": "openai-gpt-5.4-mini";
|
|
130
|
+
readonly "Together_AI_DeepSeek-R1": "openai-gpt-5.4-mini";
|
|
131
|
+
readonly "Together_AI_DeepSeek-V3": "openai-gpt-5.4-mini";
|
|
132
|
+
readonly "xAI_Grok-4": "xai-grok-4.6";
|
|
133
|
+
readonly "xAI_Grok-4_Fast": "xai-grok-4.6";
|
|
134
|
+
readonly xAI_Grok_Code_Fast_1: "xai-grok-4.6";
|
|
135
|
+
readonly "xAI_Grok-3_Beta": "xai-grok-4.6";
|
|
136
|
+
readonly "xAI_Grok-2": "xai-grok-4.6";
|
|
137
|
+
readonly "Anthropic_Claude_3.7_Sonnet": "anthropic-claude-sonnet-5";
|
|
138
|
+
readonly "OpenAI_GPT3.5-turbo-instruct": "openai-gpt-6-luna";
|
|
139
|
+
readonly Anthropic_Claude_Opus: "anthropic-claude-opus-5";
|
|
140
|
+
readonly "Google_Gemini_2.0_Flash_Thinking": "google-gemini-3.8-flash";
|
|
141
|
+
readonly Llama2_70B: "groq-openai/gpt-oss-120b";
|
|
142
|
+
readonly Perplexity_Sonar_Medium_Online: "perplexity-sonar";
|
|
143
|
+
readonly Perplexity_Sonar_Small_Online: "perplexity-sonar";
|
|
144
|
+
readonly Codellama_70B_instruct: "groq-openai/gpt-oss-120b";
|
|
145
|
+
readonly Perplexity_Llama3_Sonar_Large: "perplexity-sonar";
|
|
146
|
+
readonly Perplexity_Llama3_Sonar_Small: "perplexity-sonar";
|
|
147
|
+
readonly "OpenAI_GPT3.5-turbo": "openai-gpt-6-luna";
|
|
148
|
+
readonly "Llama3.1_70B": "groq-openai/gpt-oss-120b";
|
|
149
|
+
readonly "Perplexity_Llama3.1_Sonar_Huge": "perplexity-sonar-pro";
|
|
150
|
+
readonly "Perplexity_Llama3.1_Sonar_Large": "perplexity-sonar";
|
|
151
|
+
readonly "Perplexity_Llama3.1_Sonar_Small": "perplexity-sonar";
|
|
152
|
+
readonly Mistral_Large2: "mistral-mistral-large-latest";
|
|
153
|
+
readonly "Groq_DeepSeek_R1_Distill_Llama_3.3_70B": "openai-gpt-5.4-mini";
|
|
154
|
+
readonly Together_DeepSeek_R1: "openai-gpt-5.4-mini";
|
|
155
|
+
readonly MixtraL_8x7B: "mistral-open-mistral-nemo";
|
|
156
|
+
readonly "Google_Gemini_1.5_Flash": "google-gemini-3.8-flash";
|
|
157
|
+
readonly "Google_Gemini_1.5_Pro": "google-gemini-3.8-flash";
|
|
158
|
+
readonly Mixtral_8x7B: "mistral-open-mistral-nemo";
|
|
159
|
+
readonly "Qwen_2.5_32B": "openai-gpt-6-luna";
|
|
160
|
+
readonly "OpenAI_o1-preview": "openai-gpt-5.6-terra";
|
|
161
|
+
readonly "OpenAI_o1-mini": "openai-gpt-6-luna";
|
|
162
|
+
readonly Llama3_70B: "groq-openai/gpt-oss-120b";
|
|
163
|
+
readonly "Anthropic_Claude_Sonnet_3.7": "anthropic-claude-sonnet-5";
|
|
164
|
+
readonly Anthropic_Claude_Sonnet: "anthropic-claude-sonnet-5";
|
|
165
|
+
readonly Perplexity_Sonar_Reasoning: "perplexity-sonar-pro";
|
|
166
|
+
readonly OpenAI_GPT_OSS_20b: "groq-openai/gpt-oss-20b";
|
|
167
|
+
readonly OpenAI_GPT_OSS_120b: "groq-openai/gpt-oss-120b";
|
|
168
|
+
readonly OpenAI_GPT5: "openai-gpt-5.6-terra";
|
|
169
|
+
readonly "OpenAI_GPT5-mini": "openai-gpt-5.4-mini";
|
|
170
|
+
readonly "OpenAI_GPT5-nano": "openai-gpt-6-luna";
|
|
171
|
+
readonly OpenAI_GPT4: "openai-gpt-6-sol";
|
|
172
|
+
readonly "OpenAI_GPT4-turbo": "openai-gpt-5.6-terra";
|
|
173
|
+
readonly "OpenAI_GPT4.1": "openai-gpt-6-sol";
|
|
174
|
+
readonly "OpenAI_GPT4.1-nano": "openai-gpt-6-luna";
|
|
175
|
+
readonly "OpenAI_GPT4.1-mini": "openai-gpt-6-luna";
|
|
176
|
+
readonly OpenAI_GPT4o: "openai-gpt-6-sol";
|
|
177
|
+
readonly "OpenAI_GPT4o-mini": "openai-gpt-6-luna";
|
|
178
|
+
readonly Anthropic_Claude_Haiku: "anthropic-claude-4-5-haiku";
|
|
179
|
+
readonly "Llama3.3_70B": "groq-openai/gpt-oss-120b";
|
|
180
|
+
readonly "Llama3.1_8B": "groq-openai/gpt-oss-20b";
|
|
181
|
+
readonly "Llama3.1_405B": "openai-gpt-5.4-mini";
|
|
182
|
+
readonly Llama4_Scout: "groq-openai/gpt-oss-120b";
|
|
183
|
+
readonly DeepSeek_R1: "openai-gpt-5.4-mini";
|
|
184
|
+
readonly DeepSeek_V3: "openai-gpt-5.4-mini";
|
|
185
|
+
readonly xAI_Grok_2: "xai-grok-4.6";
|
|
186
|
+
readonly xAI_Grok_3: "xai-grok-4.6";
|
|
187
|
+
readonly xAI_Grok_4: "xai-grok-4.6";
|
|
188
|
+
readonly xAI_Grok_3_Mini: "xai-grok-4.6";
|
|
189
|
+
readonly Groq_Qwen3_32B: "groq-openai/gpt-oss-120b";
|
|
190
|
+
readonly Groq_Qwen3_235B_A22B_Instruct_2507_tput: "openai-gpt-5.4-mini";
|
|
191
|
+
readonly "Anthropic_Claude_4.6_Sonnet": "anthropic-claude-sonnet-4-6";
|
|
192
|
+
readonly "Anthropic_Claude_4.5_Opus": "anthropic-claude-opus-5";
|
|
193
|
+
readonly "Anthropic_Claude_4.6_Opus": "anthropic-claude-opus-5";
|
|
194
|
+
readonly "Anthropic_Claude_4.7_Opus": "anthropic-claude-opus-5";
|
|
195
|
+
readonly "Together_AI_Kimi_K2.5": "together-moonshotai/Kimi-K2.5";
|
|
196
|
+
readonly "xAI_Grok-4.1_Fast": "xai-grok-4.6";
|
|
197
|
+
readonly Google_Gemini_3_Pro: "google-gemini-3.1-pro";
|
|
198
|
+
readonly "OpenAI_GPT-5_Codex": "openai-gpt-6-sol";
|
|
199
|
+
readonly "Google_Gemini_2.0_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
200
|
+
};
|
|
201
|
+
ask: typeof ask;
|
|
202
|
+
experimental_decide: typeof experimental_decide;
|
|
203
|
+
refreshModels(): Promise<void>;
|
|
204
|
+
};
|
|
205
|
+
export declare const unstable_AI: {
|
|
206
|
+
[OPTIONAL_API]: string;
|
|
207
|
+
Model: {
|
|
208
|
+
readonly "OpenAI_GPT-5.4": "openai-gpt-5.4";
|
|
209
|
+
readonly "OpenAI_GPT-5.4_mini": "openai-gpt-5.4-mini";
|
|
210
|
+
readonly "OpenAI_GPT-5.5": "openai-gpt-5.5";
|
|
211
|
+
readonly "OpenAI_GPT-5.5_Instant": "openai-gpt-5.5-instant";
|
|
212
|
+
readonly "OpenAI_GPT-5.6_Terra": "openai-gpt-5.6-terra";
|
|
213
|
+
readonly "OpenAI_GPT-5.6_Luna": "openai-gpt-5.6-luna";
|
|
214
|
+
readonly "OpenAI_GPT-6_Astra": "openai-gpt-6-astra";
|
|
215
|
+
readonly "OpenAI_GPT-6_Sol": "openai-gpt-6-sol";
|
|
216
|
+
readonly "OpenAI_GPT-6.1_Sol": "openai-gpt-6.1-sol";
|
|
217
|
+
readonly "OpenAI_GPT-6_Luna": "openai-gpt-6-luna";
|
|
218
|
+
readonly "Groq_GPT-OSS_20b": "groq-openai/gpt-oss-20b";
|
|
219
|
+
readonly "Groq_GPT-OSS_120b": "groq-openai/gpt-oss-120b";
|
|
220
|
+
readonly "Anthropic_Claude_Haiku_5.5": "anthropic-claude-haiku-5-5";
|
|
221
|
+
readonly "Anthropic_Claude_Sonnet_4.6": "anthropic-claude-sonnet-4-6";
|
|
222
|
+
readonly Anthropic_Claude_Sonnet_5: "anthropic-claude-sonnet-5";
|
|
223
|
+
readonly "Anthropic_Claude_Sonnet_5.5": "anthropic-claude-sonnet-5-5";
|
|
224
|
+
readonly Anthropic_Claude_Opus_5: "anthropic-claude-opus-5";
|
|
225
|
+
readonly "Anthropic_Claude_Opus_5.5": "anthropic-claude-opus-5-5";
|
|
226
|
+
readonly "Anthropic_Claude_Fable_5.1": "anthropic-claude-fable-5-1";
|
|
227
|
+
readonly Perplexity_Sonar: "perplexity-sonar";
|
|
228
|
+
readonly Perplexity_Sonar_Pro: "perplexity-sonar-pro";
|
|
229
|
+
readonly "Vercel_Muse_Spark_1.3": "gateway-meta/muse-spark-1.3";
|
|
230
|
+
readonly "Vercel_Muse_Wonder_1.0": "gateway-meta/muse-wonder-1.0";
|
|
231
|
+
readonly Mistral_Large: "mistral-mistral-large-latest";
|
|
232
|
+
readonly Mistral_Medium: "mistral-mistral-medium-latest";
|
|
233
|
+
readonly Mistral_Small: "mistral-mistral-small-latest";
|
|
234
|
+
readonly Mistral_Codestral: "mistral-codestral-latest";
|
|
235
|
+
readonly Google_Gemini_4_Argon: "google-gemini-4-argon";
|
|
236
|
+
readonly "Google_Gemini_3.8_Flash": "google-gemini-3.8-flash";
|
|
237
|
+
readonly "Google_Gemini_3.5_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
238
|
+
readonly "Google_Gemini_3.1_Pro": "google-gemini-3.1-pro";
|
|
239
|
+
readonly "xAI_Grok-4.7": "xai-grok-4.7";
|
|
240
|
+
readonly "xAI_Grok-4.6": "xai-grok-4.6";
|
|
241
|
+
readonly "Vercel_GLM-5.2": "gateway-zai/glm-5.2";
|
|
242
|
+
readonly "Vercel_GLM-5.3": "gateway-zai/glm-5.3";
|
|
243
|
+
readonly "Vercel_GLM-5.3_Flash": "gateway-zai/glm-5.3-flash";
|
|
244
|
+
readonly "Vercel_Kimi_K2.7_Code": "gateway-moonshotai/kimi-k2.7-code";
|
|
245
|
+
readonly Vercel_Kimi_K3: "gateway-moonshotai/kimi-k3";
|
|
246
|
+
readonly Vercel_Gemma_4_31B: "gateway-google/gemma-4-31b-it";
|
|
247
|
+
readonly Vercel_Inkling: "gateway-thinkingmachines/inkling";
|
|
248
|
+
readonly Vercel_Inkling_Small: "gateway-thinkingmachines/inkling-small";
|
|
249
|
+
readonly Vercel_DeepSeek_V4_Flash: "gateway-deepseek/deepseek-v4-flash";
|
|
250
|
+
readonly "Vercel_DeepSeek_V4.1_Flash": "gateway-deepseek/deepseek-v4.1-flash";
|
|
251
|
+
readonly Vercel_DeepSeek_V4_Pro: "gateway-deepseek/deepseek-v4-pro-0813";
|
|
252
|
+
readonly "Vercel_Qwen3.8_Max": "gateway-alibaba/qwen3.8-max";
|
|
253
|
+
readonly "Anthropic_Claude_Haiku_4.5": "anthropic-claude-4-5-haiku";
|
|
254
|
+
readonly Mistral_Nemo: "mistral-open-mistral-nemo";
|
|
255
|
+
readonly "Google_Gemini_3.7_Flash": "google-gemini-3.7-flash";
|
|
256
|
+
readonly "OpenAI_GPT-5.3_Codex": "openai-gpt-6-sol";
|
|
257
|
+
readonly "OpenAI_GPT-5.4_nano": "openai-gpt-6-luna";
|
|
258
|
+
readonly "OpenAI_GPT-5.6_Sol": "openai-gpt-6.1-sol";
|
|
259
|
+
readonly "Anthropic_Claude_Opus_4.7": "anthropic-claude-opus-5";
|
|
260
|
+
readonly "Anthropic_Claude_Opus_4.8": "anthropic-claude-opus-5";
|
|
261
|
+
readonly "Google_Gemini_3.6_Flash": "google-gemini-3.8-flash";
|
|
262
|
+
readonly "Google_Gemini_3.5_Flash": "google-gemini-3.8-flash";
|
|
263
|
+
readonly "Google_Gemini_3.1_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
264
|
+
readonly Google_Gemini_3_Flash: "google-gemini-3.8-flash";
|
|
265
|
+
readonly "xAI_Grok-4.5": "xai-grok-4.6";
|
|
266
|
+
readonly "xAI_Grok-4.3": "xai-grok-4.6";
|
|
267
|
+
readonly "OpenAI_GPT-5_mini": "openai-gpt-5.4-mini";
|
|
268
|
+
readonly "OpenAI_GPT-5_nano": "openai-gpt-6-luna";
|
|
269
|
+
readonly "OpenAI_GPT-4.1": "openai-gpt-6-sol";
|
|
270
|
+
readonly "OpenAI_GPT-4.1_mini": "openai-gpt-6-luna";
|
|
271
|
+
readonly "OpenAI_GPT-4.1_nano": "openai-gpt-6-luna";
|
|
272
|
+
readonly "OpenAI_GPT-4": "openai-gpt-6-sol";
|
|
273
|
+
readonly "OpenAI_GPT-4o": "openai-gpt-6-sol";
|
|
274
|
+
readonly "OpenAI_GPT-4o_mini": "openai-gpt-6-luna";
|
|
275
|
+
readonly "OpenAI_GPT-5.1": "openai-gpt-6-sol";
|
|
276
|
+
readonly "OpenAI_GPT-5.2": "openai-gpt-6-sol";
|
|
277
|
+
readonly "OpenAI_GPT-5.3_Instant": "openai-gpt-6.1-sol";
|
|
278
|
+
readonly "OpenAI_o4-mini": "openai-gpt-6-luna";
|
|
279
|
+
readonly "OpenAI_o3-mini": "openai-gpt-6-luna";
|
|
280
|
+
readonly "Google_Gemini_2.5_Pro": "google-gemini-3.1-pro";
|
|
281
|
+
readonly "Google_Gemini_2.5_Flash": "google-gemini-3.8-flash";
|
|
282
|
+
readonly "Google_Gemini_2.5_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
283
|
+
readonly "OpenAI_GPT-5": "openai-gpt-5.6-terra";
|
|
284
|
+
readonly OpenAI_o3: "openai-gpt-5.6-terra";
|
|
285
|
+
readonly "Anthropic_Claude_Sonnet_4.5": "anthropic-claude-sonnet-5";
|
|
286
|
+
readonly "xAI_Grok-4.20": "xai-grok-4.6";
|
|
287
|
+
readonly "OpenAI_GPT-4_Turbo": "openai-gpt-5.6-terra";
|
|
288
|
+
readonly "OpenAI_GPT-5.2_Instant": "openai-gpt-6.1-sol";
|
|
289
|
+
readonly OpenAI_o1: "openai-gpt-5.6-terra";
|
|
290
|
+
readonly "Groq_Llama_3.3_70B": "groq-openai/gpt-oss-120b";
|
|
291
|
+
readonly "Groq_Llama_3.1_8B": "groq-openai/gpt-oss-20b";
|
|
292
|
+
readonly "Groq_Qwen3-32B": "groq-openai/gpt-oss-120b";
|
|
293
|
+
readonly "Baseten_Kimi_K2.7_Code": "gateway-moonshotai/kimi-k2.7-code";
|
|
294
|
+
readonly "Baseten_GLM-5.2": "gateway-zai/glm-5.2";
|
|
295
|
+
readonly Baseten_DeepSeek_V4_Pro: "gateway-deepseek/deepseek-v4-pro-0813";
|
|
296
|
+
readonly "xAI_Grok-3_Mini_Beta": "xai-grok-4.6";
|
|
297
|
+
readonly "Baseten_GLM-5": "gateway-zai/glm-5.2";
|
|
298
|
+
readonly Gateway_Kimi_K3: "gateway-moonshotai/kimi-k3";
|
|
299
|
+
readonly "OpenAI_GPT-5.1_Instant": "openai-gpt-5.5-instant";
|
|
300
|
+
readonly "Baseten_Kimi_K2.6": "gateway-moonshotai/kimi-k3";
|
|
301
|
+
readonly "OpenAI_GPT-5.1_Codex": "openai-gpt-6-sol";
|
|
302
|
+
readonly "Anthropic_Claude_Opus_4.6": "anthropic-claude-opus-5";
|
|
303
|
+
readonly Groq_Llama_4_Scout: "groq-openai/gpt-oss-120b";
|
|
304
|
+
readonly "Baseten_MiniMax_M2.5": "gateway-deepseek/deepseek-v4-pro-0813";
|
|
305
|
+
readonly "Baseten_Kimi_K2.5": "gateway-moonshotai/kimi-k3";
|
|
306
|
+
readonly Anthropic_Claude_Sonnet_4: "anthropic-claude-sonnet-4-6";
|
|
307
|
+
readonly "Anthropic_Claude_3.5_Haiku": "anthropic-claude-4-5-haiku";
|
|
308
|
+
readonly "Anthropic_Claude_4.5_Haiku": "anthropic-claude-4-5-haiku";
|
|
309
|
+
readonly Anthropic_Claude_4_Sonnet: "anthropic-claude-sonnet-4-6";
|
|
310
|
+
readonly "Anthropic_Claude_4.5_Sonnet": "anthropic-claude-sonnet-5";
|
|
311
|
+
readonly Anthropic_Claude_4_Opus: "anthropic-claude-opus-5";
|
|
312
|
+
readonly "Anthropic_Claude_4.1_Opus": "anthropic-claude-opus-5";
|
|
313
|
+
readonly "Together_AI_Llama_3.1_405B": "openai-gpt-5.4-mini";
|
|
314
|
+
readonly Mistral_Small_3: "mistral-mistral-small-latest";
|
|
315
|
+
readonly Groq_Kimi_K2_Instruct: "groq-openai/gpt-oss-120b";
|
|
316
|
+
readonly "Google_Gemini_2.0_Flash": "google-gemini-3.8-flash";
|
|
317
|
+
readonly "Together_AI_Qwen3-235B-A22B-Instruct-2507-tput": "openai-gpt-5.4-mini";
|
|
318
|
+
readonly "Together_AI_DeepSeek-R1": "openai-gpt-5.4-mini";
|
|
319
|
+
readonly "Together_AI_DeepSeek-V3": "openai-gpt-5.4-mini";
|
|
320
|
+
readonly "xAI_Grok-4": "xai-grok-4.6";
|
|
321
|
+
readonly "xAI_Grok-4_Fast": "xai-grok-4.6";
|
|
322
|
+
readonly xAI_Grok_Code_Fast_1: "xai-grok-4.6";
|
|
323
|
+
readonly "xAI_Grok-3_Beta": "xai-grok-4.6";
|
|
324
|
+
readonly "xAI_Grok-2": "xai-grok-4.6";
|
|
325
|
+
readonly "Anthropic_Claude_3.7_Sonnet": "anthropic-claude-sonnet-5";
|
|
326
|
+
readonly "OpenAI_GPT3.5-turbo-instruct": "openai-gpt-6-luna";
|
|
327
|
+
readonly Anthropic_Claude_Opus: "anthropic-claude-opus-5";
|
|
328
|
+
readonly "Google_Gemini_2.0_Flash_Thinking": "google-gemini-3.8-flash";
|
|
329
|
+
readonly Llama2_70B: "groq-openai/gpt-oss-120b";
|
|
330
|
+
readonly Perplexity_Sonar_Medium_Online: "perplexity-sonar";
|
|
331
|
+
readonly Perplexity_Sonar_Small_Online: "perplexity-sonar";
|
|
332
|
+
readonly Codellama_70B_instruct: "groq-openai/gpt-oss-120b";
|
|
333
|
+
readonly Perplexity_Llama3_Sonar_Large: "perplexity-sonar";
|
|
334
|
+
readonly Perplexity_Llama3_Sonar_Small: "perplexity-sonar";
|
|
335
|
+
readonly "OpenAI_GPT3.5-turbo": "openai-gpt-6-luna";
|
|
336
|
+
readonly "Llama3.1_70B": "groq-openai/gpt-oss-120b";
|
|
337
|
+
readonly "Perplexity_Llama3.1_Sonar_Huge": "perplexity-sonar-pro";
|
|
338
|
+
readonly "Perplexity_Llama3.1_Sonar_Large": "perplexity-sonar";
|
|
339
|
+
readonly "Perplexity_Llama3.1_Sonar_Small": "perplexity-sonar";
|
|
340
|
+
readonly Mistral_Large2: "mistral-mistral-large-latest";
|
|
341
|
+
readonly "Groq_DeepSeek_R1_Distill_Llama_3.3_70B": "openai-gpt-5.4-mini";
|
|
342
|
+
readonly Together_DeepSeek_R1: "openai-gpt-5.4-mini";
|
|
343
|
+
readonly MixtraL_8x7B: "mistral-open-mistral-nemo";
|
|
344
|
+
readonly "Google_Gemini_1.5_Flash": "google-gemini-3.8-flash";
|
|
345
|
+
readonly "Google_Gemini_1.5_Pro": "google-gemini-3.8-flash";
|
|
346
|
+
readonly Mixtral_8x7B: "mistral-open-mistral-nemo";
|
|
347
|
+
readonly "Qwen_2.5_32B": "openai-gpt-6-luna";
|
|
348
|
+
readonly "OpenAI_o1-preview": "openai-gpt-5.6-terra";
|
|
349
|
+
readonly "OpenAI_o1-mini": "openai-gpt-6-luna";
|
|
350
|
+
readonly Llama3_70B: "groq-openai/gpt-oss-120b";
|
|
351
|
+
readonly "Anthropic_Claude_Sonnet_3.7": "anthropic-claude-sonnet-5";
|
|
352
|
+
readonly Anthropic_Claude_Sonnet: "anthropic-claude-sonnet-5";
|
|
353
|
+
readonly Perplexity_Sonar_Reasoning: "perplexity-sonar-pro";
|
|
354
|
+
readonly OpenAI_GPT_OSS_20b: "groq-openai/gpt-oss-20b";
|
|
355
|
+
readonly OpenAI_GPT_OSS_120b: "groq-openai/gpt-oss-120b";
|
|
356
|
+
readonly OpenAI_GPT5: "openai-gpt-5.6-terra";
|
|
357
|
+
readonly "OpenAI_GPT5-mini": "openai-gpt-5.4-mini";
|
|
358
|
+
readonly "OpenAI_GPT5-nano": "openai-gpt-6-luna";
|
|
359
|
+
readonly OpenAI_GPT4: "openai-gpt-6-sol";
|
|
360
|
+
readonly "OpenAI_GPT4-turbo": "openai-gpt-5.6-terra";
|
|
361
|
+
readonly "OpenAI_GPT4.1": "openai-gpt-6-sol";
|
|
362
|
+
readonly "OpenAI_GPT4.1-nano": "openai-gpt-6-luna";
|
|
363
|
+
readonly "OpenAI_GPT4.1-mini": "openai-gpt-6-luna";
|
|
364
|
+
readonly OpenAI_GPT4o: "openai-gpt-6-sol";
|
|
365
|
+
readonly "OpenAI_GPT4o-mini": "openai-gpt-6-luna";
|
|
366
|
+
readonly Anthropic_Claude_Haiku: "anthropic-claude-4-5-haiku";
|
|
367
|
+
readonly "Llama3.3_70B": "groq-openai/gpt-oss-120b";
|
|
368
|
+
readonly "Llama3.1_8B": "groq-openai/gpt-oss-20b";
|
|
369
|
+
readonly "Llama3.1_405B": "openai-gpt-5.4-mini";
|
|
370
|
+
readonly Llama4_Scout: "groq-openai/gpt-oss-120b";
|
|
371
|
+
readonly DeepSeek_R1: "openai-gpt-5.4-mini";
|
|
372
|
+
readonly DeepSeek_V3: "openai-gpt-5.4-mini";
|
|
373
|
+
readonly xAI_Grok_2: "xai-grok-4.6";
|
|
374
|
+
readonly xAI_Grok_3: "xai-grok-4.6";
|
|
375
|
+
readonly xAI_Grok_4: "xai-grok-4.6";
|
|
376
|
+
readonly xAI_Grok_3_Mini: "xai-grok-4.6";
|
|
377
|
+
readonly Groq_Qwen3_32B: "groq-openai/gpt-oss-120b";
|
|
378
|
+
readonly Groq_Qwen3_235B_A22B_Instruct_2507_tput: "openai-gpt-5.4-mini";
|
|
379
|
+
readonly "Anthropic_Claude_4.6_Sonnet": "anthropic-claude-sonnet-4-6";
|
|
380
|
+
readonly "Anthropic_Claude_4.5_Opus": "anthropic-claude-opus-5";
|
|
381
|
+
readonly "Anthropic_Claude_4.6_Opus": "anthropic-claude-opus-5";
|
|
382
|
+
readonly "Anthropic_Claude_4.7_Opus": "anthropic-claude-opus-5";
|
|
383
|
+
readonly "Together_AI_Kimi_K2.5": "together-moonshotai/Kimi-K2.5";
|
|
384
|
+
readonly "xAI_Grok-4.1_Fast": "xai-grok-4.6";
|
|
385
|
+
readonly Google_Gemini_3_Pro: "google-gemini-3.1-pro";
|
|
386
|
+
readonly "OpenAI_GPT-5_Codex": "openai-gpt-6-sol";
|
|
387
|
+
readonly "Google_Gemini_2.0_Flash_Lite": "google-gemini-3.5-flash-lite";
|
|
388
|
+
};
|
|
389
|
+
ask: typeof ask;
|
|
390
|
+
experimental_decide: typeof experimental_decide;
|
|
391
|
+
refreshModels(): Promise<void>;
|
|
392
|
+
};
|
|
393
|
+
export declare const useUnstableAI: () => undefined;
|
|
394
|
+
export type BrowserTab = {
|
|
395
|
+
id: number;
|
|
396
|
+
url: string;
|
|
397
|
+
title?: string;
|
|
398
|
+
favicon?: string;
|
|
399
|
+
active: boolean;
|
|
400
|
+
};
|
|
401
|
+
export type BrowserContentOptions = {
|
|
402
|
+
cssSelector?: string;
|
|
403
|
+
tabId?: number;
|
|
404
|
+
format?: "html" | "text" | "markdown";
|
|
405
|
+
};
|
|
406
|
+
export declare const BrowserExtension: {
|
|
407
|
+
[OPTIONAL_API]: string;
|
|
408
|
+
getTabs(): Promise<BrowserTab[]>;
|
|
409
|
+
getContent(options?: BrowserContentOptions): Promise<string>;
|
|
410
|
+
};
|
|
411
|
+
export type ToolConfirmation<T> = (input: T) => Promise<undefined | {
|
|
412
|
+
style?: ActionStyle;
|
|
413
|
+
info?: {
|
|
414
|
+
name: string;
|
|
415
|
+
value?: string;
|
|
416
|
+
}[];
|
|
417
|
+
message?: string;
|
|
418
|
+
image?: string | {
|
|
419
|
+
fileIcon: string;
|
|
420
|
+
};
|
|
421
|
+
}>;
|
|
422
|
+
export declare const Tool: {};
|
|
423
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { experimental_decide } from "./ai-decide.js";
|
|
2
|
+
import { requestCapability } from "./capability.js";
|
|
3
|
+
import { AI as enums } from "./enums.generated.js";
|
|
4
|
+
export const OPTIONAL_API = Symbol.for("blast.optionalAPI");
|
|
5
|
+
function ask(prompt, options = {}) {
|
|
6
|
+
const listeners = [];
|
|
7
|
+
const promise = new Promise((resolve, reject) => {
|
|
8
|
+
const signal = options.signal;
|
|
9
|
+
let settled = false;
|
|
10
|
+
let streamed = false;
|
|
11
|
+
const progress = (value) => {
|
|
12
|
+
if (settled)
|
|
13
|
+
return;
|
|
14
|
+
if (typeof value !== "string")
|
|
15
|
+
return finish(new Error("AI.ask: expected a text chunk"));
|
|
16
|
+
streamed = true;
|
|
17
|
+
try {
|
|
18
|
+
for (const listener of listeners)
|
|
19
|
+
listener(value);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
finish(error);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const finish = (error, text) => {
|
|
26
|
+
if (settled)
|
|
27
|
+
return;
|
|
28
|
+
settled = true;
|
|
29
|
+
signal?.removeEventListener("abort", abort);
|
|
30
|
+
if (error)
|
|
31
|
+
reject(error);
|
|
32
|
+
else {
|
|
33
|
+
try {
|
|
34
|
+
if (!streamed)
|
|
35
|
+
for (const listener of listeners)
|
|
36
|
+
listener(text);
|
|
37
|
+
resolve(text);
|
|
38
|
+
}
|
|
39
|
+
catch (listenerError) {
|
|
40
|
+
reject(listenerError);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const abort = () => finish(new DOMException("The operation was aborted", "AbortError"));
|
|
45
|
+
if (signal?.aborted) {
|
|
46
|
+
abort();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
50
|
+
const params = {
|
|
51
|
+
prompt,
|
|
52
|
+
...(options.model === undefined
|
|
53
|
+
? {}
|
|
54
|
+
: { model: typeof options.model === "object" ? { id: options.model.id } : options.model }),
|
|
55
|
+
...(options.creativity === undefined
|
|
56
|
+
? {}
|
|
57
|
+
: {
|
|
58
|
+
creativity: typeof options.creativity === "number"
|
|
59
|
+
? Math.max(0, Math.min(2, options.creativity))
|
|
60
|
+
: options.creativity,
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
void requestCapability("ai.ask", params, {
|
|
64
|
+
...(signal ? { signal } : {}),
|
|
65
|
+
onProgress: progress,
|
|
66
|
+
}).then((text) => typeof text === "string"
|
|
67
|
+
? finish(null, text)
|
|
68
|
+
: finish(new Error("AI.ask: expected a text answer")), (error) => finish(error));
|
|
69
|
+
});
|
|
70
|
+
return Object.assign(promise, {
|
|
71
|
+
on(_event, listener) {
|
|
72
|
+
listeners.push(listener);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export const AI = {
|
|
77
|
+
[OPTIONAL_API]: "AI",
|
|
78
|
+
Model: enums.Model,
|
|
79
|
+
ask,
|
|
80
|
+
experimental_decide,
|
|
81
|
+
async refreshModels() {
|
|
82
|
+
await requestCapability("ai.models.refresh", {});
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export const unstable_AI = AI;
|
|
86
|
+
export const useUnstableAI = () => undefined;
|
|
87
|
+
export const BrowserExtension = {
|
|
88
|
+
[OPTIONAL_API]: "BrowserExtension",
|
|
89
|
+
async getTabs() {
|
|
90
|
+
const tabs = await requestCapability("browser.tabs", {});
|
|
91
|
+
if (!Array.isArray(tabs) ||
|
|
92
|
+
tabs.some((tab) => !tab ||
|
|
93
|
+
typeof tab !== "object" ||
|
|
94
|
+
Array.isArray(tab) ||
|
|
95
|
+
typeof tab.id !== "number" ||
|
|
96
|
+
typeof tab.url !== "string" ||
|
|
97
|
+
typeof tab.active !== "boolean" ||
|
|
98
|
+
(tab.title !== undefined && typeof tab.title !== "string") ||
|
|
99
|
+
(tab.favicon !== undefined && typeof tab.favicon !== "string")))
|
|
100
|
+
throw new Error("BrowserExtension.getTabs: invalid tabs answer");
|
|
101
|
+
return tabs;
|
|
102
|
+
},
|
|
103
|
+
async getContent(options = {}) {
|
|
104
|
+
if (options.cssSelector !== undefined && options.format === "markdown")
|
|
105
|
+
throw new Error("BrowserExtension.getContent: cssSelector cannot be used with markdown");
|
|
106
|
+
const content = await requestCapability("browser.content", { ...options });
|
|
107
|
+
if (typeof content !== "string")
|
|
108
|
+
throw new Error("BrowserExtension.getContent: expected text content");
|
|
109
|
+
return content;
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
// Tool currently contains only type declarations.
|
|
113
|
+
export const Tool = {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type DecisionQuestion = {
|
|
2
|
+
type: "noul";
|
|
3
|
+
instructions: string;
|
|
4
|
+
} | {
|
|
5
|
+
type: "score";
|
|
6
|
+
instructions: string;
|
|
7
|
+
criteria: readonly string[];
|
|
8
|
+
} | {
|
|
9
|
+
type: "choice";
|
|
10
|
+
instructions: string;
|
|
11
|
+
criteria: Record<string, string | null>;
|
|
12
|
+
};
|
|
13
|
+
type Answer<Q extends DecisionQuestion> = Q extends {
|
|
14
|
+
type: "choice";
|
|
15
|
+
criteria: infer C;
|
|
16
|
+
} ? {
|
|
17
|
+
type: "choice";
|
|
18
|
+
choice: keyof C;
|
|
19
|
+
confidence: number;
|
|
20
|
+
probabilities: Record<keyof C, number>;
|
|
21
|
+
} : Q extends {
|
|
22
|
+
type: "score";
|
|
23
|
+
} ? {
|
|
24
|
+
type: "score";
|
|
25
|
+
score: number;
|
|
26
|
+
confidence: number;
|
|
27
|
+
legend: Record<string, string>;
|
|
28
|
+
probabilities: Record<string, number>;
|
|
29
|
+
} : {
|
|
30
|
+
type: "noul";
|
|
31
|
+
noul: number;
|
|
32
|
+
};
|
|
33
|
+
export declare function experimental_decide<const Q extends Record<string, DecisionQuestion>>(input: {
|
|
34
|
+
state: unknown;
|
|
35
|
+
questions: Q;
|
|
36
|
+
}, options?: {
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
[K in keyof Q]: Answer<Q[K]>;
|
|
40
|
+
}>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { requestCapability } from "./capability.js";
|
|
2
|
+
const toJsonQuestion = (question) => question.type === "score"
|
|
3
|
+
? { type: "score", instructions: question.instructions, criteria: [...question.criteria] }
|
|
4
|
+
: question;
|
|
5
|
+
const object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
const range = (value, max = 1) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= max;
|
|
7
|
+
const keysMatch = (value, keys) => Object.keys(value).length === keys.length && keys.every((key) => Object.hasOwn(value, key));
|
|
8
|
+
const invalid = () => new Error("AI.experimental_decide: invalid answer");
|
|
9
|
+
export async function experimental_decide(input, options = {}) {
|
|
10
|
+
const questions = JSON.parse(JSON.stringify(input.questions));
|
|
11
|
+
const state = typeof input.state === "string" ? input.state : JSON.stringify(input.state);
|
|
12
|
+
if (state === undefined)
|
|
13
|
+
throw new Error("AI.experimental_decide: state must be JSON-serializable");
|
|
14
|
+
for (const question of Object.values(questions)) {
|
|
15
|
+
if (typeof question.instructions !== "string" ||
|
|
16
|
+
(question.type === "score" &&
|
|
17
|
+
(!Array.isArray(question.criteria) ||
|
|
18
|
+
question.criteria.length < 2 ||
|
|
19
|
+
question.criteria.length > 10 ||
|
|
20
|
+
question.criteria.some((item) => typeof item !== "string"))) ||
|
|
21
|
+
(question.type === "choice" &&
|
|
22
|
+
(!object(question.criteria) ||
|
|
23
|
+
!Object.keys(question.criteria).length ||
|
|
24
|
+
Object.values(question.criteria).some((item) => item !== null && typeof item !== "string"))) ||
|
|
25
|
+
!["noul", "score", "choice"].includes(question.type))
|
|
26
|
+
throw new Error("AI.experimental_decide: invalid question");
|
|
27
|
+
}
|
|
28
|
+
const jsonQuestions = Object.fromEntries(Object.entries(questions).map(([key, question]) => [key, toJsonQuestion(question)]));
|
|
29
|
+
const answers = await requestCapability("ai.decide", { state, questions: jsonQuestions }, options);
|
|
30
|
+
if (!object(answers) || !keysMatch(answers, Object.keys(questions)))
|
|
31
|
+
throw invalid();
|
|
32
|
+
for (const [key, question] of Object.entries(questions)) {
|
|
33
|
+
const answer = answers[key];
|
|
34
|
+
if (!object(answer) || answer.type !== question.type)
|
|
35
|
+
throw invalid();
|
|
36
|
+
if (question.type === "noul") {
|
|
37
|
+
if (!range(answer.noul))
|
|
38
|
+
throw invalid();
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const keys = question.type === "score"
|
|
42
|
+
? question.criteria.map((_, i) => String(i))
|
|
43
|
+
: Object.keys(question.criteria);
|
|
44
|
+
if (!range(answer.confidence) ||
|
|
45
|
+
!object(answer.probabilities) ||
|
|
46
|
+
!keysMatch(answer.probabilities, keys) ||
|
|
47
|
+
Object.values(answer.probabilities).some((value) => !range(value)))
|
|
48
|
+
throw invalid();
|
|
49
|
+
if (Math.abs(Object.values(answer.probabilities).reduce((sum, value) => sum + value, 0) - 1) > 0.000001)
|
|
50
|
+
throw invalid();
|
|
51
|
+
if (question.type === "choice") {
|
|
52
|
+
if (typeof answer.choice !== "string" || !keys.includes(answer.choice))
|
|
53
|
+
throw invalid();
|
|
54
|
+
}
|
|
55
|
+
else if (!range(answer.score, question.criteria.length - 1) ||
|
|
56
|
+
!object(answer.legend) ||
|
|
57
|
+
!keysMatch(answer.legend, keys) ||
|
|
58
|
+
keys.some((level) => answer.legend[level] !== question.criteria[Number(level)]))
|
|
59
|
+
throw invalid();
|
|
60
|
+
}
|
|
61
|
+
return answers;
|
|
62
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JsonValue } from "../reconciler/index.js";
|
|
2
|
+
import type { Application } from "./open.js";
|
|
3
|
+
/** `PathLike`, which the declarations take from `node:fs`. */
|
|
4
|
+
export type ApplicationPath = string | Buffer | URL;
|
|
5
|
+
export declare function pathParam(path: ApplicationPath, api: string): string;
|
|
6
|
+
export declare function toApplication(value: JsonValue, api?: string): Application;
|
|
7
|
+
export declare function getApplications(path?: ApplicationPath): Promise<Application[]>;
|
|
8
|
+
/**
|
|
9
|
+
* `getDefaultApplication(path)`: the application the machine would open the
|
|
10
|
+
* path with. Rejects when there is none, exactly as the declarations promise
|
|
11
|
+
* and as a headless host without an application database always does.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getDefaultApplication(path: ApplicationPath): Promise<Application>;
|