@raycast/api 1.49.2 → 1.50.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/api.d.ts CHANGED
@@ -1000,7 +1000,7 @@ export declare namespace Color {
1000
1000
  * Raycast user interface. This makes it easy to guarantee a good look and feel when you aren't in control of the
1001
1001
  * color, e.g. get it via a network request.
1002
1002
  *
1003
- * @defaultValue `false`
1003
+ * @defaultValue `true`
1004
1004
  */
1005
1005
  adjustContrast?: boolean | undefined | null;
1006
1006
  }
@@ -2169,6 +2169,21 @@ export declare interface Environment {
2169
2169
  * The type of launch for the command (user initiated or background).
2170
2170
  */
2171
2171
  launchType: LaunchType;
2172
+ /**
2173
+ * Returns whether the user has access to the given API.
2174
+ *
2175
+ * @example
2176
+ * ```typescript
2177
+ * import { unstableAI, environment } from "@raycast/api";
2178
+ *
2179
+ * export default function Command() {
2180
+ * if (environment.canAccess(unstableAI)) {
2181
+ * // use unstableAI
2182
+ * }
2183
+ * }
2184
+ * ```
2185
+ */
2186
+ canAccess(api: unknown): boolean;
2172
2187
  /**
2173
2188
  * @deprecated Use the top-level prop `launchContext` instead.
2174
2189
  */
@@ -4773,6 +4788,7 @@ export declare enum Icon {
4773
4788
  Terminal = "terminal-16",
4774
4789
  Text = "text-16",
4775
4790
  TextCursor = "text-cursor-16",
4791
+ TextInput = "text-input-16",
4776
4792
  Torch = "torch-16",
4777
4793
  Train = "train-16",
4778
4794
  Trash = "trash-16",
@@ -7917,14 +7933,19 @@ export declare namespace unstable_AI {
7917
7933
  * }
7918
7934
  * ```
7919
7935
  */
7920
- export function ask(prompt: string, options?: AnswerOptions): Promise<string> & {
7936
+ export function ask(prompt: string, options?: AskOptions): Promise<string> & {
7921
7937
  on(event: "data", listener: (chunk: string) => void): void;
7922
7938
  };
7923
- export type AnswerOptions = {
7939
+ export type AskOptions = {
7924
7940
  /**
7925
- * Between 0 and 1
7941
+ * Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
7942
+ * If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
7926
7943
  */
7927
7944
  creativity?: Creativity;
7945
+ /**
7946
+ * The AI model to use to answer to the prompt.
7947
+ */
7948
+ model?: Model;
7928
7949
  /**
7929
7950
  * Abort signal to cancel the request.
7930
7951
  */
@@ -7935,6 +7956,10 @@ export declare namespace unstable_AI {
7935
7956
  * If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
7936
7957
  */
7937
7958
  export type Creativity = "none" | "low" | "medium" | "high" | "maximum" | number;
7959
+ /**
7960
+ * @default `"text-davinci-003"``
7961
+ */
7962
+ export type Model = "text-davinci-003" | "gpt-3.5-turbo";
7938
7963
  }
7939
7964
 
7940
7965
  /**
@@ -8040,7 +8065,15 @@ export declare function useNavigation(): Navigation;
8040
8065
  * ```
8041
8066
  */
8042
8067
  export declare function useUnstableAI(prompt: string, options?: {
8068
+ /**
8069
+ * Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
8070
+ * If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
8071
+ */
8043
8072
  creativity?: unstable_AI.Creativity;
8073
+ /**
8074
+ * The AI model to use to answer to the prompt.
8075
+ */
8076
+ model?: unstable_AI.Model;
8044
8077
  stream?: boolean;
8045
8078
  } & Omit<PromiseOptions<FunctionReturningPromise>, "abortable">): {
8046
8079
  isLoading: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.49.2",
3
+ "version": "1.50.0",
4
4
  "description": "Build extensions for Raycast with React and Node.js.",
5
5
  "author": "Raycast Technologies Ltd.",
6
6
  "homepage": "https://developers.raycast.com",
package/types/index.d.ts CHANGED
@@ -996,7 +996,7 @@ export declare namespace Color {
996
996
  * Raycast user interface. This makes it easy to guarantee a good look and feel when you aren't in control of the
997
997
  * color, e.g. get it via a network request.
998
998
  *
999
- * @defaultValue `false`
999
+ * @defaultValue `true`
1000
1000
  */
1001
1001
  adjustContrast?: boolean | undefined | null;
1002
1002
  }
@@ -2165,6 +2165,21 @@ export declare interface Environment {
2165
2165
  * The type of launch for the command (user initiated or background).
2166
2166
  */
2167
2167
  launchType: LaunchType;
2168
+ /**
2169
+ * Returns whether the user has access to the given API.
2170
+ *
2171
+ * @example
2172
+ * ```typescript
2173
+ * import { unstableAI, environment } from "@raycast/api";
2174
+ *
2175
+ * export default function Command() {
2176
+ * if (environment.canAccess(unstableAI)) {
2177
+ * // use unstableAI
2178
+ * }
2179
+ * }
2180
+ * ```
2181
+ */
2182
+ canAccess(api: unknown): boolean;
2168
2183
  /**
2169
2184
  * @deprecated Use the top-level prop `launchContext` instead.
2170
2185
  */
@@ -4769,6 +4784,7 @@ export declare enum Icon {
4769
4784
  Terminal = "terminal-16",
4770
4785
  Text = "text-16",
4771
4786
  TextCursor = "text-cursor-16",
4787
+ TextInput = "text-input-16",
4772
4788
  Torch = "torch-16",
4773
4789
  Train = "train-16",
4774
4790
  Trash = "trash-16",
@@ -7913,14 +7929,19 @@ export declare namespace unstable_AI {
7913
7929
  * }
7914
7930
  * ```
7915
7931
  */
7916
- export function ask(prompt: string, options?: AnswerOptions): Promise<string> & {
7932
+ export function ask(prompt: string, options?: AskOptions): Promise<string> & {
7917
7933
  on(event: "data", listener: (chunk: string) => void): void;
7918
7934
  };
7919
- export type AnswerOptions = {
7935
+ export type AskOptions = {
7920
7936
  /**
7921
- * Between 0 and 1
7937
+ * Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
7938
+ * If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
7922
7939
  */
7923
7940
  creativity?: Creativity;
7941
+ /**
7942
+ * The AI model to use to answer to the prompt.
7943
+ */
7944
+ model?: Model;
7924
7945
  /**
7925
7946
  * Abort signal to cancel the request.
7926
7947
  */
@@ -7931,6 +7952,10 @@ export declare namespace unstable_AI {
7931
7952
  * If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
7932
7953
  */
7933
7954
  export type Creativity = "none" | "low" | "medium" | "high" | "maximum" | number;
7955
+ /**
7956
+ * @default `"text-davinci-003"``
7957
+ */
7958
+ export type Model = "text-davinci-003" | "gpt-3.5-turbo";
7934
7959
  }
7935
7960
 
7936
7961
  /**
@@ -8036,7 +8061,15 @@ export declare function useNavigation(): Navigation;
8036
8061
  * ```
8037
8062
  */
8038
8063
  export declare function useUnstableAI(prompt: string, options?: {
8064
+ /**
8065
+ * Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
8066
+ * If a number is passed, it needs to be in the range 0-2. For larger values, 2 will be used. For lower values, 0 will be used.
8067
+ */
8039
8068
  creativity?: unstable_AI.Creativity;
8069
+ /**
8070
+ * The AI model to use to answer to the prompt.
8071
+ */
8072
+ model?: unstable_AI.Model;
8040
8073
  stream?: boolean;
8041
8074
  } & Omit<PromiseOptions<FunctionReturningPromise>, "abortable">): {
8042
8075
  isLoading: boolean;