@raycast/api 1.48.4 → 1.48.6
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 +95 -10
- package/package.json +1 -1
- package/types/index.d.ts +110 -6
package/api.d.ts
CHANGED
|
@@ -4992,6 +4992,29 @@ export declare const ImageMask: typeof Image.Mask;
|
|
|
4992
4992
|
*/
|
|
4993
4993
|
export declare type ImageSource = Image.Source;
|
|
4994
4994
|
|
|
4995
|
+
declare type InterExtensionLaunchOptions = IntraExtensionLaunchOptions & {
|
|
4996
|
+
/** when launching command from a different extension, the owner or author (as defined in the extension's manifest) is necessary */
|
|
4997
|
+
ownerOrAuthorName: string;
|
|
4998
|
+
/** when launching command from a different extension, the extension name (as defined in the extension's manifest) is necessary */
|
|
4999
|
+
extensionName: string;
|
|
5000
|
+
};
|
|
5001
|
+
|
|
5002
|
+
/**
|
|
5003
|
+
* Options for launching a command from the same extension.
|
|
5004
|
+
*/
|
|
5005
|
+
declare type IntraExtensionLaunchOptions = {
|
|
5006
|
+
/** command name as defined in the extension's manifest */
|
|
5007
|
+
name: string;
|
|
5008
|
+
/** {@link LaunchType.UserInitiated} or {@link LaunchType.Background} */
|
|
5009
|
+
type: LaunchType;
|
|
5010
|
+
/** optional object for the argument properties and values as defined in the extension's manifest, for example: `{ "argument1": "value1" }` */
|
|
5011
|
+
arguments?: Arguments | null;
|
|
5012
|
+
/** arbitrary object for custom data that should be passed to the command and accessible as `environment.launchContext`; the object must be JSON serializable (Dates and Buffers supported) */
|
|
5013
|
+
context?: LaunchContext | null;
|
|
5014
|
+
/** optional string to send as fallback text to the command */
|
|
5015
|
+
fallbackText?: string | null;
|
|
5016
|
+
};
|
|
5017
|
+
|
|
4995
5018
|
/**
|
|
4996
5019
|
* See {@link List.Item}
|
|
4997
5020
|
*/
|
|
@@ -5361,12 +5384,7 @@ declare interface LabelProps {
|
|
|
5361
5384
|
* };
|
|
5362
5385
|
* ```
|
|
5363
5386
|
*/
|
|
5364
|
-
export declare function launchCommand(options:
|
|
5365
|
-
name: string;
|
|
5366
|
-
type: LaunchType;
|
|
5367
|
-
arguments?: Arguments | null;
|
|
5368
|
-
context?: LaunchContext | null;
|
|
5369
|
-
}): Promise<void>;
|
|
5387
|
+
export declare function launchCommand(options: LaunchOptions): Promise<void>;
|
|
5370
5388
|
|
|
5371
5389
|
declare interface LaunchContext {
|
|
5372
5390
|
/**
|
|
@@ -5375,6 +5393,8 @@ declare interface LaunchContext {
|
|
|
5375
5393
|
[item: string]: any;
|
|
5376
5394
|
}
|
|
5377
5395
|
|
|
5396
|
+
declare type LaunchOptions = IntraExtensionLaunchOptions | InterExtensionLaunchOptions;
|
|
5397
|
+
|
|
5378
5398
|
/**
|
|
5379
5399
|
* The top-level props that a Command receives on launch
|
|
5380
5400
|
*/
|
|
@@ -7856,22 +7876,59 @@ declare interface TrashProps {
|
|
|
7856
7876
|
}
|
|
7857
7877
|
|
|
7858
7878
|
/**
|
|
7859
|
-
*
|
|
7879
|
+
* The AI API is not stable, it will likely change in the future based the community's feedback.
|
|
7880
|
+
* If you have any feedback, concerns, or use-cases that aren't covered by the API, please reach out to us on the [Raycast Community Slack](https://raycast.com/community).
|
|
7860
7881
|
*/
|
|
7861
7882
|
export declare namespace unstable_AI {
|
|
7862
7883
|
/**
|
|
7884
|
+
* Returns a prompt completion.
|
|
7863
7885
|
*
|
|
7886
|
+
* @example
|
|
7887
|
+
* ```typescript
|
|
7888
|
+
* import { Detail, unstable_AI, LaunchProps } from "@raycast/api";
|
|
7889
|
+
* import { usePromise } from "@raycast/utils";
|
|
7890
|
+
* import { useState } from "react";
|
|
7891
|
+
*
|
|
7892
|
+
* export default function Command(props: LaunchProps<{ arguments: { instruction: string } }>) {
|
|
7893
|
+
* const [data, setData] = useState("");
|
|
7894
|
+
* const { isLoading } = usePromise(
|
|
7895
|
+
* async (instruction) => {
|
|
7896
|
+
* const stream = unstable_AI.ask(instruction);
|
|
7897
|
+
* stream.on("data", (data) => {
|
|
7898
|
+
* setData((x) => x + data);
|
|
7899
|
+
* });
|
|
7900
|
+
* await stream;
|
|
7901
|
+
* },
|
|
7902
|
+
* [props.arguments.instruction]
|
|
7903
|
+
* );
|
|
7904
|
+
*
|
|
7905
|
+
* return <Detail isLoading={isLoading} markdown={data} />;
|
|
7906
|
+
* }
|
|
7907
|
+
* ```
|
|
7864
7908
|
*/
|
|
7865
|
-
export function
|
|
7909
|
+
export function ask(instruction: string, options?: AnswerOptions): Promise<string> & {
|
|
7866
7910
|
on(event: "data", listener: (chunk: string) => void): void;
|
|
7867
7911
|
};
|
|
7868
7912
|
export type AnswerOptions = {
|
|
7869
7913
|
/**
|
|
7870
7914
|
* Between 0 and 1
|
|
7871
7915
|
*/
|
|
7872
|
-
|
|
7873
|
-
|
|
7916
|
+
creativity?: Creativity;
|
|
7917
|
+
/**
|
|
7918
|
+
* Abort signal to cancel the request.
|
|
7919
|
+
*/
|
|
7920
|
+
signal?: AbortSignal;
|
|
7874
7921
|
};
|
|
7922
|
+
/**
|
|
7923
|
+
* Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
|
|
7924
|
+
*/
|
|
7925
|
+
export enum Creativity {
|
|
7926
|
+
None = 0,
|
|
7927
|
+
Low = 0.25,
|
|
7928
|
+
Medium = 0.5,
|
|
7929
|
+
High = 0.75,
|
|
7930
|
+
Maximum = 1
|
|
7931
|
+
}
|
|
7875
7932
|
}
|
|
7876
7933
|
|
|
7877
7934
|
/**
|
|
@@ -7957,4 +8014,32 @@ export declare const useId: any;
|
|
|
7957
8014
|
*/
|
|
7958
8015
|
export declare function useNavigation(): Navigation;
|
|
7959
8016
|
|
|
8017
|
+
/**
|
|
8018
|
+
* The AI API is not stable and should move to @raycast/utils eventually, it will likely change in the future based the community's feedback.
|
|
8019
|
+
* If you have any feedback, concerns, or use-cases that aren't covered by the API, please reach out to us on the [Raycast Community Slack](https://raycast.com/community).
|
|
8020
|
+
*
|
|
8021
|
+
* ---
|
|
8022
|
+
*
|
|
8023
|
+
* Stream an instruction completion.
|
|
8024
|
+
*
|
|
8025
|
+
* @example
|
|
8026
|
+
* ```typescript
|
|
8027
|
+
* import { Detail, useUnstableAI, LaunchProps } from "@raycast/api";
|
|
8028
|
+
*
|
|
8029
|
+
* export default function Command(props: LaunchProps<{ arguments: { instruction: string } }>) {
|
|
8030
|
+
* const { isLoading, data } = useUnstableAI(props.arguments.instruction);
|
|
8031
|
+
*
|
|
8032
|
+
* return <Detail isLoading={isLoading} markdown={data} />;
|
|
8033
|
+
* }
|
|
8034
|
+
* ```
|
|
8035
|
+
*/
|
|
8036
|
+
export declare function useUnstableAI(instruction: string, options?: {
|
|
8037
|
+
creativity?: unstable_AI.Creativity;
|
|
8038
|
+
}): {
|
|
8039
|
+
isLoading: boolean;
|
|
8040
|
+
data: string;
|
|
8041
|
+
error: Error;
|
|
8042
|
+
revalidate: () => Promise<void>;
|
|
8043
|
+
};
|
|
8044
|
+
|
|
7960
8045
|
export { }
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -4988,6 +4988,29 @@ export declare const ImageMask: typeof Image.Mask;
|
|
|
4988
4988
|
*/
|
|
4989
4989
|
export declare type ImageSource = Image.Source;
|
|
4990
4990
|
|
|
4991
|
+
declare type InterExtensionLaunchOptions = IntraExtensionLaunchOptions & {
|
|
4992
|
+
/** when launching command from a different extension, the owner or author (as defined in the extension's manifest) is necessary */
|
|
4993
|
+
ownerOrAuthorName: string;
|
|
4994
|
+
/** when launching command from a different extension, the extension name (as defined in the extension's manifest) is necessary */
|
|
4995
|
+
extensionName: string;
|
|
4996
|
+
};
|
|
4997
|
+
|
|
4998
|
+
/**
|
|
4999
|
+
* Options for launching a command from the same extension.
|
|
5000
|
+
*/
|
|
5001
|
+
declare type IntraExtensionLaunchOptions = {
|
|
5002
|
+
/** command name as defined in the extension's manifest */
|
|
5003
|
+
name: string;
|
|
5004
|
+
/** {@link LaunchType.UserInitiated} or {@link LaunchType.Background} */
|
|
5005
|
+
type: LaunchType;
|
|
5006
|
+
/** optional object for the argument properties and values as defined in the extension's manifest, for example: `{ "argument1": "value1" }` */
|
|
5007
|
+
arguments?: Arguments | null;
|
|
5008
|
+
/** arbitrary object for custom data that should be passed to the command and accessible as `environment.launchContext`; the object must be JSON serializable (Dates and Buffers supported) */
|
|
5009
|
+
context?: LaunchContext | null;
|
|
5010
|
+
/** optional string to send as fallback text to the command */
|
|
5011
|
+
fallbackText?: string | null;
|
|
5012
|
+
};
|
|
5013
|
+
|
|
4991
5014
|
/**
|
|
4992
5015
|
* See {@link List.Item}
|
|
4993
5016
|
*/
|
|
@@ -5357,12 +5380,7 @@ declare interface LabelProps {
|
|
|
5357
5380
|
* };
|
|
5358
5381
|
* ```
|
|
5359
5382
|
*/
|
|
5360
|
-
export declare function launchCommand(options:
|
|
5361
|
-
name: string;
|
|
5362
|
-
type: LaunchType;
|
|
5363
|
-
arguments?: Arguments | null;
|
|
5364
|
-
context?: LaunchContext | null;
|
|
5365
|
-
}): Promise<void>;
|
|
5383
|
+
export declare function launchCommand(options: LaunchOptions): Promise<void>;
|
|
5366
5384
|
|
|
5367
5385
|
declare interface LaunchContext {
|
|
5368
5386
|
/**
|
|
@@ -5371,6 +5389,8 @@ declare interface LaunchContext {
|
|
|
5371
5389
|
[item: string]: any;
|
|
5372
5390
|
}
|
|
5373
5391
|
|
|
5392
|
+
declare type LaunchOptions = IntraExtensionLaunchOptions | InterExtensionLaunchOptions;
|
|
5393
|
+
|
|
5374
5394
|
/**
|
|
5375
5395
|
* The top-level props that a Command receives on launch
|
|
5376
5396
|
*/
|
|
@@ -7851,6 +7871,62 @@ declare interface TrashProps {
|
|
|
7851
7871
|
onTrash?: (paths: PathLike | PathLike[]) => void;
|
|
7852
7872
|
}
|
|
7853
7873
|
|
|
7874
|
+
/**
|
|
7875
|
+
* The AI API is not stable, it will likely change in the future based the community's feedback.
|
|
7876
|
+
* If you have any feedback, concerns, or use-cases that aren't covered by the API, please reach out to us on the [Raycast Community Slack](https://raycast.com/community).
|
|
7877
|
+
*/
|
|
7878
|
+
export declare namespace unstable_AI {
|
|
7879
|
+
/**
|
|
7880
|
+
* Returns a prompt completion.
|
|
7881
|
+
*
|
|
7882
|
+
* @example
|
|
7883
|
+
* ```typescript
|
|
7884
|
+
* import { Detail, unstable_AI, LaunchProps } from "@raycast/api";
|
|
7885
|
+
* import { usePromise } from "@raycast/utils";
|
|
7886
|
+
* import { useState } from "react";
|
|
7887
|
+
*
|
|
7888
|
+
* export default function Command(props: LaunchProps<{ arguments: { instruction: string } }>) {
|
|
7889
|
+
* const [data, setData] = useState("");
|
|
7890
|
+
* const { isLoading } = usePromise(
|
|
7891
|
+
* async (instruction) => {
|
|
7892
|
+
* const stream = unstable_AI.ask(instruction);
|
|
7893
|
+
* stream.on("data", (data) => {
|
|
7894
|
+
* setData((x) => x + data);
|
|
7895
|
+
* });
|
|
7896
|
+
* await stream;
|
|
7897
|
+
* },
|
|
7898
|
+
* [props.arguments.instruction]
|
|
7899
|
+
* );
|
|
7900
|
+
*
|
|
7901
|
+
* return <Detail isLoading={isLoading} markdown={data} />;
|
|
7902
|
+
* }
|
|
7903
|
+
* ```
|
|
7904
|
+
*/
|
|
7905
|
+
export function ask(instruction: string, options?: AnswerOptions): Promise<string> & {
|
|
7906
|
+
on(event: "data", listener: (chunk: string) => void): void;
|
|
7907
|
+
};
|
|
7908
|
+
export type AnswerOptions = {
|
|
7909
|
+
/**
|
|
7910
|
+
* Between 0 and 1
|
|
7911
|
+
*/
|
|
7912
|
+
creativity?: Creativity;
|
|
7913
|
+
/**
|
|
7914
|
+
* Abort signal to cancel the request.
|
|
7915
|
+
*/
|
|
7916
|
+
signal?: AbortSignal;
|
|
7917
|
+
};
|
|
7918
|
+
/**
|
|
7919
|
+
* Concrete tasks, such as fixing grammar, require less creativity while open-ended questions, such as generating ideas, require more.
|
|
7920
|
+
*/
|
|
7921
|
+
export enum Creativity {
|
|
7922
|
+
None = 0,
|
|
7923
|
+
Low = 0.25,
|
|
7924
|
+
Medium = 0.5,
|
|
7925
|
+
High = 0.75,
|
|
7926
|
+
Maximum = 1
|
|
7927
|
+
}
|
|
7928
|
+
}
|
|
7929
|
+
|
|
7854
7930
|
/**
|
|
7855
7931
|
* Update the values of properties declared in the manifest of a command.
|
|
7856
7932
|
*
|
|
@@ -7934,4 +8010,32 @@ export declare const useId: any;
|
|
|
7934
8010
|
*/
|
|
7935
8011
|
export declare function useNavigation(): Navigation;
|
|
7936
8012
|
|
|
8013
|
+
/**
|
|
8014
|
+
* The AI API is not stable and should move to @raycast/utils eventually, it will likely change in the future based the community's feedback.
|
|
8015
|
+
* If you have any feedback, concerns, or use-cases that aren't covered by the API, please reach out to us on the [Raycast Community Slack](https://raycast.com/community).
|
|
8016
|
+
*
|
|
8017
|
+
* ---
|
|
8018
|
+
*
|
|
8019
|
+
* Stream an instruction completion.
|
|
8020
|
+
*
|
|
8021
|
+
* @example
|
|
8022
|
+
* ```typescript
|
|
8023
|
+
* import { Detail, useUnstableAI, LaunchProps } from "@raycast/api";
|
|
8024
|
+
*
|
|
8025
|
+
* export default function Command(props: LaunchProps<{ arguments: { instruction: string } }>) {
|
|
8026
|
+
* const { isLoading, data } = useUnstableAI(props.arguments.instruction);
|
|
8027
|
+
*
|
|
8028
|
+
* return <Detail isLoading={isLoading} markdown={data} />;
|
|
8029
|
+
* }
|
|
8030
|
+
* ```
|
|
8031
|
+
*/
|
|
8032
|
+
export declare function useUnstableAI(instruction: string, options?: {
|
|
8033
|
+
creativity?: unstable_AI.Creativity;
|
|
8034
|
+
}): {
|
|
8035
|
+
isLoading: boolean;
|
|
8036
|
+
data: string;
|
|
8037
|
+
error: Error;
|
|
8038
|
+
revalidate: () => Promise<void>;
|
|
8039
|
+
};
|
|
8040
|
+
|
|
7937
8041
|
export { }
|