@picteus/extension-sdk 0.14.0 → 0.16.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/dist/featureViewGrammar.d.ts +2814 -0
- package/dist/featureViewGrammar.js +2612 -0
- package/dist/generated/featureViewGrammar.d.ts +3913 -0
- package/dist/generated/featureViewGrammar.js +4099 -0
- package/dist/generated/viewKit.d.ts +3884 -0
- package/dist/generated/viewKit.js +4099 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/intents.d.ts +64 -1
- package/dist/intents.js +6 -0
- package/dist/picteus-ws-client/apis/AdministrationApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/AdministrationApi.js +1 -1
- package/dist/picteus-ws-client/apis/ApiSecretApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/ApiSecretApi.js +1 -1
- package/dist/picteus-ws-client/apis/CollectionApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/CollectionApi.js +1 -1
- package/dist/picteus-ws-client/apis/ExtensionApi.d.ts +84 -26
- package/dist/picteus-ws-client/apis/ExtensionApi.js +99 -26
- package/dist/picteus-ws-client/apis/ImageApi.d.ts +87 -33
- package/dist/picteus-ws-client/apis/ImageApi.js +99 -32
- package/dist/picteus-ws-client/apis/ImageAttachmentApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/ImageAttachmentApi.js +1 -1
- package/dist/picteus-ws-client/apis/MiscellaneousApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/MiscellaneousApi.js +1 -1
- package/dist/picteus-ws-client/apis/RepositoryApi.d.ts +5 -5
- package/dist/picteus-ws-client/apis/RepositoryApi.js +3 -3
- package/dist/picteus-ws-client/apis/SettingsApi.d.ts +1 -1
- package/dist/picteus-ws-client/apis/SettingsApi.js +1 -1
- package/dist/picteus-ws-client/models/ApiSecret.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApiSecret.js +1 -1
- package/dist/picteus-ws-client/models/ApiSecretSummary.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApiSecretSummary.js +1 -1
- package/dist/picteus-ws-client/models/ApiSecretType.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApiSecretType.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationConfiguration.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationConfiguration.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadata.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadata.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItem.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItem.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItemValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationMetadataItemValue.js +1 -1
- package/dist/picteus-ws-client/models/ApplicationSettings.d.ts +1 -1
- package/dist/picteus-ws-client/models/ApplicationSettings.js +1 -1
- package/dist/picteus-ws-client/models/Collection.d.ts +1 -1
- package/dist/picteus-ws-client/models/Collection.js +1 -1
- package/dist/picteus-ws-client/models/CommandEntity.d.ts +1 -1
- package/dist/picteus-ws-client/models/CommandEntity.js +1 -1
- package/dist/picteus-ws-client/models/ComputedImageFormat.d.ts +1 -1
- package/dist/picteus-ws-client/models/ComputedImageFormat.js +1 -1
- package/dist/picteus-ws-client/models/ConfigurationCapability.d.ts +1 -1
- package/dist/picteus-ws-client/models/ConfigurationCapability.js +1 -1
- package/dist/picteus-ws-client/models/ConfigurationExtensionCommand.d.ts +1 -1
- package/dist/picteus-ws-client/models/ConfigurationExtensionCommand.js +1 -1
- package/dist/picteus-ws-client/models/ConstantsRegistry.d.ts +1 -1
- package/dist/picteus-ws-client/models/ConstantsRegistry.js +1 -1
- package/dist/picteus-ws-client/models/Dates.d.ts +1 -1
- package/dist/picteus-ws-client/models/Dates.js +1 -1
- package/dist/picteus-ws-client/models/Extension.d.ts +5 -5
- package/dist/picteus-ws-client/models/Extension.js +5 -5
- package/dist/picteus-ws-client/models/ExtensionActivity.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionActivity.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionActivityKind.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionActivityKind.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionAndManual.d.ts +5 -5
- package/dist/picteus-ws-client/models/ExtensionAndManual.js +5 -5
- package/dist/picteus-ws-client/models/ExtensionCategory.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionCategory.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionGenerationOptions.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionGenerationOptions.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionIdImageEmbeddingName.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionIdImageEmbeddingName.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageEmbeddings.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageEmbeddings.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeature.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeature.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeatureName.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeatureName.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeaturesAttribute.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageFeaturesAttribute.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTag.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTag.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTagsAttribute.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionImageTagsAttribute.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionManual.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionManual.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionSettings.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionSettings.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionState.d.ts +25 -0
- package/dist/picteus-ws-client/models/ExtensionState.js +43 -0
- package/dist/picteus-ws-client/models/ExtensionStatus.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionStatus.js +1 -1
- package/dist/picteus-ws-client/models/ExtensionsConfiguration.d.ts +1 -1
- package/dist/picteus-ws-client/models/ExtensionsConfiguration.js +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipe.d.ts +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipe.js +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipePrompt.d.ts +1 -1
- package/dist/picteus-ws-client/models/GenerationRecipePrompt.js +1 -1
- package/dist/picteus-ws-client/models/Image.d.ts +1 -1
- package/dist/picteus-ws-client/models/Image.js +1 -1
- package/dist/picteus-ws-client/models/ImageDimensions.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageDimensions.js +1 -1
- package/dist/picteus-ws-client/models/ImageDistance.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageDistance.js +1 -1
- package/dist/picteus-ws-client/models/ImageEmbedding.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageEmbedding.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeature.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeature.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureFormat.d.ts +3 -1
- package/dist/picteus-ws-client/models/ImageFeatureFormat.js +4 -2
- package/dist/picteus-ws-client/models/ImageFeatureNullValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureNullValue.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureType.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureType.js +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageFeatureValue.js +1 -1
- package/dist/picteus-ws-client/models/ImageFormat.d.ts +2 -2
- package/dist/picteus-ws-client/models/ImageFormat.js +2 -2
- package/dist/picteus-ws-client/models/ImageMediaUrl.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageMediaUrl.js +1 -1
- package/dist/picteus-ws-client/models/ImageMetadata.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageMetadata.js +1 -1
- package/dist/picteus-ws-client/models/ImageResizeRender.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageResizeRender.js +1 -1
- package/dist/picteus-ws-client/models/ImageSummary.d.ts +1 -1
- package/dist/picteus-ws-client/models/ImageSummary.js +1 -1
- package/dist/picteus-ws-client/models/InstructionsPrompt.d.ts +1 -1
- package/dist/picteus-ws-client/models/InstructionsPrompt.js +1 -1
- package/dist/picteus-ws-client/models/Manifest.d.ts +1 -1
- package/dist/picteus-ws-client/models/Manifest.js +1 -1
- package/dist/picteus-ws-client/models/ManifestCapability.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestCapability.js +1 -1
- package/dist/picteus-ws-client/models/ManifestCapabilityId.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestCapabilityId.js +1 -1
- package/dist/picteus-ws-client/models/ManifestEvent.d.ts +3 -1
- package/dist/picteus-ws-client/models/ManifestEvent.js +3 -1
- package/dist/picteus-ws-client/models/ManifestExecution.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExecution.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommand.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommand.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandOn.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandOn.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandSpecification.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandSpecification.js +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandUi.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestExtensionCommandUi.js +1 -1
- package/dist/picteus-ws-client/models/ManifestInstructions.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestInstructions.js +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElement.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElement.js +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElementIntegration.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestInterfaceElementIntegration.js +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntime.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntime.js +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntimeEnvironment.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestRuntimeEnvironment.js +1 -1
- package/dist/picteus-ws-client/models/ManifestThrottlingPolicy.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestThrottlingPolicy.js +1 -1
- package/dist/picteus-ws-client/models/ManifestUserInterface.d.ts +1 -1
- package/dist/picteus-ws-client/models/ManifestUserInterface.js +1 -1
- package/dist/picteus-ws-client/models/PromptKind.d.ts +1 -1
- package/dist/picteus-ws-client/models/PromptKind.js +1 -1
- package/dist/picteus-ws-client/models/Repository.d.ts +5 -5
- package/dist/picteus-ws-client/models/Repository.js +5 -5
- package/dist/picteus-ws-client/models/RepositoryActivity.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryActivity.js +1 -1
- package/dist/picteus-ws-client/models/RepositoryActivityKind.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryActivityKind.js +1 -1
- package/dist/picteus-ws-client/models/RepositoryLocationType.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryLocationType.js +1 -1
- package/dist/picteus-ws-client/models/RepositoryState.d.ts +27 -0
- package/dist/picteus-ws-client/models/RepositoryState.js +45 -0
- package/dist/picteus-ws-client/models/RepositoryStatus.d.ts +1 -1
- package/dist/picteus-ws-client/models/RepositoryStatus.js +1 -1
- package/dist/picteus-ws-client/models/RunCommandParameters.d.ts +39 -0
- package/dist/picteus-ws-client/models/RunCommandParameters.js +46 -0
- package/dist/picteus-ws-client/models/SearchCriteria.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchCriteria.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureComparisonOperator.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureComparisonOperator.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureCondition.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureCondition.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureConditionValue.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureConditionValue.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureLogicalOperator.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatureLogicalOperator.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeatures.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeatures.js +1 -1
- package/dist/picteus-ws-client/models/SearchFeaturesResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFeaturesResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchFilter.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFilter.js +1 -1
- package/dist/picteus-ws-client/models/SearchFilterOrigin.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchFilterOrigin.js +1 -1
- package/dist/picteus-ws-client/models/SearchImageIdResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImageIdResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchImageResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImageResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchImageSummaryResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImageSummaryResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchImagesOrigin.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchImagesOrigin.js +1 -1
- package/dist/picteus-ws-client/models/SearchKeyword.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchKeyword.js +1 -1
- package/dist/picteus-ws-client/models/SearchMediaUrlResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchMediaUrlResult.js +1 -1
- package/dist/picteus-ws-client/models/SearchOriginNature.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchOriginNature.js +1 -1
- package/dist/picteus-ws-client/models/SearchParameters.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchParameters.js +1 -1
- package/dist/picteus-ws-client/models/SearchProperties.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchProperties.js +1 -1
- package/dist/picteus-ws-client/models/SearchPropertyRange.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchPropertyRange.js +1 -1
- package/dist/picteus-ws-client/models/SearchRange.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchRange.js +1 -1
- package/dist/picteus-ws-client/models/SearchRepositoriesOrigin.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchRepositoriesOrigin.js +1 -1
- package/dist/picteus-ws-client/models/SearchSorting.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchSorting.js +1 -1
- package/dist/picteus-ws-client/models/SearchSortingProperty.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchSortingProperty.js +1 -1
- package/dist/picteus-ws-client/models/SearchTags.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchTags.js +1 -1
- package/dist/picteus-ws-client/models/SearchTagsResult.d.ts +1 -1
- package/dist/picteus-ws-client/models/SearchTagsResult.js +1 -1
- package/dist/picteus-ws-client/models/Software.d.ts +1 -1
- package/dist/picteus-ws-client/models/Software.js +1 -1
- package/dist/picteus-ws-client/models/TextualPrompt.d.ts +1 -1
- package/dist/picteus-ws-client/models/TextualPrompt.js +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceAnchor.d.ts +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceAnchor.js +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceSidebarIntegration.d.ts +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceSidebarIntegration.js +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceWindowIntegration.d.ts +1 -1
- package/dist/picteus-ws-client/models/UserInterfaceWindowIntegration.js +1 -1
- package/dist/picteus-ws-client/models/index.d.ts +3 -2
- package/dist/picteus-ws-client/models/index.js +3 -2
- package/dist/picteus-ws-client/runtime.d.ts +1 -1
- package/dist/picteus-ws-client/runtime.js +1 -1
- package/dist/picteusExtension.d.ts +46 -23
- package/dist/picteusExtension.js +172 -63
- package/package.json +1 -1
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
import { Socket } from "socket.io-client";
|
|
2
2
|
import { ApiSecretApi, CollectionApi, Configuration, ExtensionApi, ImageApi, ImageAttachmentApi, Manifest, MiscellaneousApi, RepositoryApi } from "./index.js";
|
|
3
3
|
import { Intent } from "./intents.js";
|
|
4
|
-
export type
|
|
5
|
-
export declare
|
|
6
|
-
Cancel
|
|
7
|
-
Error
|
|
4
|
+
export type EventValue = Record<string, any>;
|
|
5
|
+
export declare const InstructionReturnedErrorCause: {
|
|
6
|
+
readonly Cancel: 0;
|
|
7
|
+
readonly Error: 1;
|
|
8
|
+
};
|
|
9
|
+
export type InstructionReturnedErrorCause = (typeof InstructionReturnedErrorCause)[keyof typeof InstructionReturnedErrorCause];
|
|
10
|
+
export declare class InstructionReturnedError extends Error {
|
|
11
|
+
readonly reason: InstructionReturnedErrorCause;
|
|
12
|
+
constructor(message: string, reason: InstructionReturnedErrorCause);
|
|
8
13
|
}
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export declare enum NotificationEvent {
|
|
14
|
-
ProcessRunCommand = "process.runCommand",
|
|
15
|
-
ImageCreated = "image.created",
|
|
16
|
-
ImageUpdated = "image.updated",
|
|
17
|
-
ImageTagsUpdated = "image.tags.updated",
|
|
18
|
-
ImageFeaturesUpdated = "image.features.updated",
|
|
19
|
-
ImageDeleted = "image.deleted",
|
|
20
|
-
ImageComputeFeatures = "image.computeFeatures",
|
|
21
|
-
ImageComputeEmbeddings = "image.computeEmbeddings",
|
|
22
|
-
ImageComputeTags = "image.computeTags",
|
|
23
|
-
ImageRunCommand = "image.runCommand",
|
|
24
|
-
TextComputeEmbeddings = "text.computeEmbeddings"
|
|
14
|
+
export type CommandParameters = Record<string, any>;
|
|
15
|
+
export declare class CommandError extends Error {
|
|
16
|
+
static fromError(error: CommandParameters): CommandError;
|
|
17
|
+
constructor(message: string);
|
|
25
18
|
}
|
|
19
|
+
export declare const EventName: {
|
|
20
|
+
readonly ProcessRunCommand: "process.runCommand";
|
|
21
|
+
readonly ImageCreated: "image.created";
|
|
22
|
+
readonly ImageUpdated: "image.updated";
|
|
23
|
+
readonly ImageTagsUpdated: "image.tags.updated";
|
|
24
|
+
readonly ImageFeaturesUpdated: "image.features.updated";
|
|
25
|
+
readonly ImageDeleted: "image.deleted";
|
|
26
|
+
readonly ImageComputeFeatures: "image.computeFeatures";
|
|
27
|
+
readonly ImageComputeEmbeddings: "image.computeEmbeddings";
|
|
28
|
+
readonly ImageComputeTags: "image.computeTags";
|
|
29
|
+
readonly ImageRunCommand: "image.runCommand";
|
|
30
|
+
readonly TextComputeEmbeddings: "text.computeEmbeddings";
|
|
31
|
+
};
|
|
32
|
+
export type EventName = (typeof EventName)[keyof typeof EventName];
|
|
26
33
|
export declare class Helper {
|
|
27
34
|
static readonly GENERATION_RECIPE_SCHEMA_VERSION = 1;
|
|
28
35
|
}
|
|
@@ -61,7 +68,7 @@ declare class MessageSender {
|
|
|
61
68
|
private _maximumPayloadSizeInBytes?;
|
|
62
69
|
constructor(logger: Logger, parameters: ExtensionParameters, socket: Socket, toString: () => string, contextId?: string);
|
|
63
70
|
set maximumPayloadSizeInBytes(value: number);
|
|
64
|
-
sendMessage(
|
|
71
|
+
sendMessage(event: string, body: Record<string, any>, callback?: (result: any) => Promise<void>): void;
|
|
65
72
|
}
|
|
66
73
|
export declare class Communicator {
|
|
67
74
|
private readonly logger;
|
|
@@ -73,6 +80,10 @@ export declare class Communicator {
|
|
|
73
80
|
private sendMessage;
|
|
74
81
|
}
|
|
75
82
|
export type SettingsValue = Record<string, any>;
|
|
83
|
+
export type Versions = {
|
|
84
|
+
previous: string | undefined;
|
|
85
|
+
current: string;
|
|
86
|
+
};
|
|
76
87
|
export declare class PicteusExtension {
|
|
77
88
|
static getManifest(): Manifest;
|
|
78
89
|
static getSdkVersion(): string;
|
|
@@ -86,15 +97,26 @@ export declare class PicteusExtension {
|
|
|
86
97
|
protected readonly apiKey: string;
|
|
87
98
|
protected readonly configuration: Configuration;
|
|
88
99
|
private socket?;
|
|
89
|
-
private globalCommunicator?;
|
|
90
100
|
constructor();
|
|
91
101
|
run(): Promise<void>;
|
|
92
102
|
protected toString(): string;
|
|
93
103
|
protected initialize(): Promise<boolean>;
|
|
104
|
+
protected onUpgrade(_communicator: Communicator, _versions: Versions): Promise<void>;
|
|
94
105
|
protected onReady(_communicator?: Communicator): Promise<void>;
|
|
95
106
|
protected onTerminate(): Promise<void>;
|
|
96
107
|
protected onSettings(_communicator: Communicator, _value: SettingsValue): Promise<void>;
|
|
97
|
-
protected onEvent(
|
|
108
|
+
protected onEvent(communicator: Communicator, event: EventName, value: EventValue): Promise<any>;
|
|
109
|
+
protected onImageCreated(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
110
|
+
protected onImageUpdated(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
111
|
+
protected onImageDeleted(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
112
|
+
protected onImageTagsUpdated(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
113
|
+
protected onImageFeaturesUpdated(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
114
|
+
protected onComputeImageTags(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
115
|
+
protected onComputeImageFeatures(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
116
|
+
protected onComputeImageEmbeddings(_communicator: Communicator, _imageId: string): Promise<void>;
|
|
117
|
+
protected onImagesCommand(_communicator: Communicator, _commandId: string, _imageIds: string[], _parameters: CommandParameters): Promise<void>;
|
|
118
|
+
protected onProcessCommand(_communicator: Communicator, _commandId: string, _parameters: CommandParameters): Promise<void>;
|
|
119
|
+
protected onComputeTextEmbeddings(_communicator: Communicator, _text: string): Promise<number[]>;
|
|
98
120
|
protected getMiscellaneousApi(): MiscellaneousApi;
|
|
99
121
|
protected getApiSecretApi(): ApiSecretApi;
|
|
100
122
|
protected getExtensionApi(): ExtensionApi;
|
|
@@ -106,6 +128,7 @@ export declare class PicteusExtension {
|
|
|
106
128
|
private getParameters;
|
|
107
129
|
private connectSocket;
|
|
108
130
|
private disconnectSocket;
|
|
131
|
+
private exit;
|
|
109
132
|
private getApiConfiguration;
|
|
110
133
|
}
|
|
111
134
|
export {};
|
package/dist/picteusExtension.js
CHANGED
|
@@ -4,35 +4,39 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
// We do not import the "process" package on purpose, otherwise we get the runtime error "process.on is not a function"
|
|
5
5
|
import console from "node:console";
|
|
6
6
|
import { io } from "socket.io-client";
|
|
7
|
-
import { ApiSecretApi, CollectionApi, Configuration, ExtensionApi, ImageApi, ImageAttachmentApi, ManifestFromJSON, MiscellaneousApi, RepositoryApi } from "./index.js";
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
NotificationReturnedErrorCause[NotificationReturnedErrorCause["Cancel"] = 0] = "Cancel";
|
|
11
|
-
NotificationReturnedErrorCause[NotificationReturnedErrorCause["Error"] = 1] = "Error";
|
|
12
|
-
})(NotificationReturnedErrorCause || (NotificationReturnedErrorCause = {}));
|
|
13
|
-
export class NotificationReturnedError extends Error {
|
|
7
|
+
import { ApiSecretApi, CollectionApi, Configuration, ExtensionApi, ImageApi, ImageAttachmentApi, IntentToastType, ManifestFromJSON, MiscellaneousApi, RepositoryApi } from "./index.js";
|
|
8
|
+
export const InstructionReturnedErrorCause = { Cancel: 0, Error: 1 };
|
|
9
|
+
export class InstructionReturnedError extends Error {
|
|
14
10
|
reason;
|
|
15
11
|
constructor(message, reason) {
|
|
16
12
|
super(message);
|
|
17
13
|
this.reason = reason;
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
export class CommandError extends Error {
|
|
17
|
+
static fromError(error) {
|
|
18
|
+
return new CommandError(error.message);
|
|
19
|
+
}
|
|
20
|
+
constructor(message) {
|
|
21
|
+
super(message);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export const EventName = {
|
|
25
|
+
ProcessRunCommand: "process.runCommand",
|
|
26
|
+
ImageCreated: "image.created",
|
|
27
|
+
ImageUpdated: "image.updated",
|
|
28
|
+
ImageTagsUpdated: "image.tags.updated",
|
|
29
|
+
ImageFeaturesUpdated: "image.features.updated",
|
|
30
|
+
ImageDeleted: "image.deleted",
|
|
31
|
+
ImageComputeFeatures: "image.computeFeatures",
|
|
32
|
+
ImageComputeEmbeddings: "image.computeEmbeddings",
|
|
33
|
+
ImageComputeTags: "image.computeTags",
|
|
34
|
+
ImageRunCommand: "image.runCommand",
|
|
35
|
+
TextComputeEmbeddings: "text.computeEmbeddings"
|
|
36
|
+
};
|
|
37
|
+
const extensionVersionsChannel = "extension.versions";
|
|
38
|
+
const extensionReadyChannel = "extension.ready";
|
|
39
|
+
const extensionSettingsChannel = "extension.settings";
|
|
36
40
|
// noinspection JSUnusedGlobalSymbols
|
|
37
41
|
export class Helper {
|
|
38
42
|
static GENERATION_RECIPE_SCHEMA_VERSION = 1;
|
|
@@ -40,7 +44,7 @@ export class Helper {
|
|
|
40
44
|
export class ApiCallError extends Error {
|
|
41
45
|
details;
|
|
42
46
|
constructor(details) {
|
|
43
|
-
super();
|
|
47
|
+
super(details.message);
|
|
44
48
|
this.details = details;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -106,9 +110,9 @@ class MessageSender {
|
|
|
106
110
|
set maximumPayloadSizeInBytes(value) {
|
|
107
111
|
this._maximumPayloadSizeInBytes = value;
|
|
108
112
|
}
|
|
109
|
-
sendMessage(
|
|
113
|
+
sendMessage(event, body, callback) {
|
|
110
114
|
const contextId = this.contextId;
|
|
111
|
-
this.logger.debug(`Sending the message '${stringifyWithStrippedBuffers(body)}'
|
|
115
|
+
this.logger.debug(`Sending the message '${stringifyWithStrippedBuffers(body)}' through the '${event}' event for ${this.toString()}${contextId === undefined ? "" : ` attached to the context with id '${contextId}'`}${callback === undefined ? "" : " and waiting for a callback"}`);
|
|
112
116
|
const value = {
|
|
113
117
|
extensionId: this.parameters.extensionId,
|
|
114
118
|
...body
|
|
@@ -121,14 +125,14 @@ class MessageSender {
|
|
|
121
125
|
value.contextId = contextId;
|
|
122
126
|
}
|
|
123
127
|
if (callback === undefined) {
|
|
124
|
-
this.socket.emit(
|
|
128
|
+
this.socket.emit(event, value);
|
|
125
129
|
}
|
|
126
130
|
else {
|
|
127
|
-
this.socket.emit(
|
|
131
|
+
this.socket.emit(event, value, callback);
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
const
|
|
135
|
+
const instructionsEvent = "instructions";
|
|
132
136
|
export class Communicator {
|
|
133
137
|
logger;
|
|
134
138
|
sender;
|
|
@@ -138,21 +142,21 @@ export class Communicator {
|
|
|
138
142
|
}
|
|
139
143
|
sendLog(message, level) {
|
|
140
144
|
this.logger[level](message);
|
|
141
|
-
this.sendMessage(
|
|
145
|
+
this.sendMessage(instructionsEvent, { log: { message, level } });
|
|
142
146
|
}
|
|
143
147
|
// noinspection JSUnusedGlobalSymbols
|
|
144
148
|
sendNotification(value) {
|
|
145
|
-
this.sendMessage(
|
|
149
|
+
this.sendMessage(instructionsEvent, { notification: value });
|
|
146
150
|
}
|
|
147
151
|
async launchIntent(intent) {
|
|
148
152
|
return await new Promise((resolve, reject) => {
|
|
149
|
-
this.sendMessage(
|
|
153
|
+
this.sendMessage(instructionsEvent, { intent }, async ({ value, cancel, error }) => {
|
|
150
154
|
this.logger.debug(`Received a result related to the intent '${stringifyWithStrippedBuffers(intent)}' for ${this.sender.toString()}`);
|
|
151
155
|
if (cancel !== undefined) {
|
|
152
|
-
reject(new
|
|
156
|
+
reject(new InstructionReturnedError(cancel, InstructionReturnedErrorCause.Cancel));
|
|
153
157
|
}
|
|
154
158
|
else if (error !== undefined) {
|
|
155
|
-
reject(new
|
|
159
|
+
reject(new InstructionReturnedError(error, InstructionReturnedErrorCause.Error));
|
|
156
160
|
}
|
|
157
161
|
else {
|
|
158
162
|
resolve(value);
|
|
@@ -160,8 +164,8 @@ export class Communicator {
|
|
|
160
164
|
});
|
|
161
165
|
});
|
|
162
166
|
}
|
|
163
|
-
sendMessage(
|
|
164
|
-
this.sender.sendMessage(
|
|
167
|
+
sendMessage(event, body, callback) {
|
|
168
|
+
this.sender.sendMessage(event, body, callback);
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
export class PicteusExtension {
|
|
@@ -171,6 +175,7 @@ export class PicteusExtension {
|
|
|
171
175
|
static getSdkVersion() {
|
|
172
176
|
return JSON.parse(fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "package.json"), { encoding: "utf8" })).version;
|
|
173
177
|
}
|
|
178
|
+
// noinspection JSUnusedGlobalSymbols
|
|
174
179
|
static getCacheDirectoryPath() {
|
|
175
180
|
return path.join(PicteusExtension.getExtensionHomeDirectoryPath(), ".cache");
|
|
176
181
|
}
|
|
@@ -185,7 +190,6 @@ export class PicteusExtension {
|
|
|
185
190
|
apiKey;
|
|
186
191
|
configuration;
|
|
187
192
|
socket;
|
|
188
|
-
globalCommunicator;
|
|
189
193
|
constructor() {
|
|
190
194
|
this.logger.info(`Instantiating the ${this.toString()} through the process with id '${process.pid}' relying on the SDK version '${PicteusExtension.getSdkVersion()}'`);
|
|
191
195
|
process.on("SIGTERM", async (signal) => {
|
|
@@ -212,41 +216,105 @@ export class PicteusExtension {
|
|
|
212
216
|
result = await this.initialize();
|
|
213
217
|
}
|
|
214
218
|
catch (error) {
|
|
215
|
-
this.
|
|
216
|
-
process.exit(1);
|
|
219
|
+
this.exit(1, error, "the initialization failed");
|
|
217
220
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
this.connectSocket();
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
this.logger.error(`The connection of the ${this.toString()} failed. Reason: '${error.message}'`, error);
|
|
225
|
-
process.exit(2);
|
|
226
|
-
}
|
|
221
|
+
if (result === true) {
|
|
222
|
+
try {
|
|
223
|
+
this.connectSocket();
|
|
227
224
|
}
|
|
228
|
-
|
|
229
|
-
|
|
225
|
+
catch (error) {
|
|
226
|
+
this.exit(2, error, "the connection failed");
|
|
230
227
|
}
|
|
231
228
|
}
|
|
232
|
-
|
|
233
|
-
|
|
229
|
+
else {
|
|
230
|
+
await this.onReady();
|
|
234
231
|
}
|
|
235
232
|
}
|
|
236
233
|
toString() {
|
|
237
|
-
return `extension
|
|
234
|
+
return `extension${this.extensionId === undefined ? "" : ` with id '${this.extensionId}'`} of class '${this.constructor.name}'`;
|
|
238
235
|
}
|
|
239
236
|
async initialize() {
|
|
240
237
|
return true;
|
|
241
238
|
}
|
|
239
|
+
async onUpgrade(_communicator, _versions) {
|
|
240
|
+
}
|
|
242
241
|
async onReady(_communicator) {
|
|
243
242
|
}
|
|
244
243
|
async onTerminate() {
|
|
245
244
|
}
|
|
246
245
|
async onSettings(_communicator, _value) {
|
|
247
|
-
return Promise.resolve();
|
|
248
246
|
}
|
|
249
|
-
async onEvent(
|
|
247
|
+
async onEvent(communicator, event, value) {
|
|
248
|
+
if (event === EventName.ImageCreated) {
|
|
249
|
+
const imageId = value["id"];
|
|
250
|
+
return await this.onImageCreated(communicator, imageId);
|
|
251
|
+
}
|
|
252
|
+
else if (event === EventName.ImageUpdated) {
|
|
253
|
+
const imageId = value["id"];
|
|
254
|
+
return await this.onImageUpdated(communicator, imageId);
|
|
255
|
+
}
|
|
256
|
+
else if (event === EventName.ImageDeleted) {
|
|
257
|
+
const imageId = value["id"];
|
|
258
|
+
return await this.onImageDeleted(communicator, imageId);
|
|
259
|
+
}
|
|
260
|
+
else if (event === EventName.ImageTagsUpdated) {
|
|
261
|
+
const imageId = value["id"];
|
|
262
|
+
return await this.onImageTagsUpdated(communicator, imageId);
|
|
263
|
+
}
|
|
264
|
+
else if (event === EventName.ImageFeaturesUpdated) {
|
|
265
|
+
const imageId = value["id"];
|
|
266
|
+
return await this.onImageFeaturesUpdated(communicator, imageId);
|
|
267
|
+
}
|
|
268
|
+
else if (event === EventName.ImageComputeTags) {
|
|
269
|
+
const imageId = value["id"];
|
|
270
|
+
return await this.onComputeImageTags(communicator, imageId);
|
|
271
|
+
}
|
|
272
|
+
else if (event === EventName.ImageComputeFeatures) {
|
|
273
|
+
const imageId = value["id"];
|
|
274
|
+
return await this.onComputeImageFeatures(communicator, imageId);
|
|
275
|
+
}
|
|
276
|
+
else if (event === EventName.ImageComputeEmbeddings) {
|
|
277
|
+
const imageId = value["id"];
|
|
278
|
+
return await this.onComputeImageEmbeddings(communicator, imageId);
|
|
279
|
+
}
|
|
280
|
+
else if (event === EventName.ImageRunCommand) {
|
|
281
|
+
const commandId = value["commandId"];
|
|
282
|
+
const imageIds = value["imageIds"];
|
|
283
|
+
const parameters = value["parameters"] ?? {};
|
|
284
|
+
return await this.onImagesCommand(communicator, commandId, imageIds, parameters);
|
|
285
|
+
}
|
|
286
|
+
else if (event === EventName.ProcessRunCommand) {
|
|
287
|
+
const commandId = value["commandId"];
|
|
288
|
+
const parameters = value["parameters"] ?? {};
|
|
289
|
+
return await this.onProcessCommand(communicator, commandId, parameters);
|
|
290
|
+
}
|
|
291
|
+
else if (event === EventName.TextComputeEmbeddings) {
|
|
292
|
+
const text = value["text"];
|
|
293
|
+
return await this.onComputeTextEmbeddings(communicator, text);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
async onImageCreated(_communicator, _imageId) {
|
|
297
|
+
}
|
|
298
|
+
async onImageUpdated(_communicator, _imageId) {
|
|
299
|
+
}
|
|
300
|
+
async onImageDeleted(_communicator, _imageId) {
|
|
301
|
+
}
|
|
302
|
+
async onImageTagsUpdated(_communicator, _imageId) {
|
|
303
|
+
}
|
|
304
|
+
async onImageFeaturesUpdated(_communicator, _imageId) {
|
|
305
|
+
}
|
|
306
|
+
async onComputeImageTags(_communicator, _imageId) {
|
|
307
|
+
}
|
|
308
|
+
async onComputeImageFeatures(_communicator, _imageId) {
|
|
309
|
+
}
|
|
310
|
+
async onComputeImageEmbeddings(_communicator, _imageId) {
|
|
311
|
+
}
|
|
312
|
+
async onImagesCommand(_communicator, _commandId, _imageIds, _parameters) {
|
|
313
|
+
}
|
|
314
|
+
async onProcessCommand(_communicator, _commandId, _parameters) {
|
|
315
|
+
}
|
|
316
|
+
async onComputeTextEmbeddings(_communicator, _text) {
|
|
317
|
+
return [];
|
|
250
318
|
}
|
|
251
319
|
// noinspection JSUnusedGlobalSymbols
|
|
252
320
|
getMiscellaneousApi() {
|
|
@@ -293,7 +361,6 @@ export class PicteusExtension {
|
|
|
293
361
|
const globalSender = new MessageSender(this.logger, this.parameters, this.socket, () => {
|
|
294
362
|
return this.toString();
|
|
295
363
|
});
|
|
296
|
-
this.globalCommunicator = new Communicator(this.logger, globalSender);
|
|
297
364
|
this.socket.on("connect", async () => {
|
|
298
365
|
this.logger.info(`The ${this.toString()} socket is connected`);
|
|
299
366
|
globalSender.sendMessage("connection", {
|
|
@@ -304,7 +371,6 @@ export class PicteusExtension {
|
|
|
304
371
|
const maximumPayloadSizeInBytes = result.maximumPayloadSizeInBytes;
|
|
305
372
|
this.logger.debug(`The ${this.toString()} socket has a maximum payload size of ${maximumPayloadSizeInBytes} bytes`);
|
|
306
373
|
globalSender.maximumPayloadSizeInBytes = maximumPayloadSizeInBytes;
|
|
307
|
-
await this.onReady(this.globalCommunicator);
|
|
308
374
|
});
|
|
309
375
|
});
|
|
310
376
|
this.socket.on("connect_error", async () => {
|
|
@@ -321,22 +387,53 @@ export class PicteusExtension {
|
|
|
321
387
|
}, contextId);
|
|
322
388
|
sender.maximumPayloadSizeInBytes = globalSender.maximumPayloadSizeInBytes;
|
|
323
389
|
const communicator = new Communicator(this.logger, sender);
|
|
324
|
-
const
|
|
390
|
+
const requiresResult = channel !== extensionSettingsChannel;
|
|
325
391
|
let result;
|
|
326
392
|
let success = false;
|
|
393
|
+
let eventName;
|
|
327
394
|
try {
|
|
328
|
-
|
|
395
|
+
if (channel === extensionSettingsChannel) {
|
|
396
|
+
result = await this.onSettings(communicator, value.value);
|
|
397
|
+
}
|
|
398
|
+
else if (channel === extensionVersionsChannel) {
|
|
399
|
+
const { upgrade, ...versions } = value;
|
|
400
|
+
if (upgrade === true) {
|
|
401
|
+
await this.onUpgrade(communicator, versions);
|
|
402
|
+
result = true;
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
result = true;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
else if (channel === extensionReadyChannel) {
|
|
409
|
+
try {
|
|
410
|
+
await this.onReady(communicator);
|
|
411
|
+
result = true;
|
|
412
|
+
}
|
|
413
|
+
catch (error) {
|
|
414
|
+
this.exit(3, error, "an error occurred during the execution of the 'onReady()' method: stopping the process");
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
eventName = channel;
|
|
419
|
+
result = await this.onEvent(communicator, eventName, value);
|
|
420
|
+
}
|
|
329
421
|
success = true;
|
|
330
422
|
}
|
|
331
423
|
catch (error) {
|
|
332
424
|
// We want the process to continue even if an exception occurs
|
|
333
425
|
this.logger.error(`An error occurred during the handling of the event on channel '${channel}'`, error);
|
|
334
|
-
|
|
426
|
+
if ((eventName === EventName.ImageRunCommand || eventName === EventName.ProcessRunCommand) && error instanceof CommandError) {
|
|
427
|
+
void communicator.launchIntent({ toast: { type: IntentToastType.Error, subtitle: error.message } });
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
communicator.sendLog(`The handling of the event failed for the ${this.toString()}. Reason: '${error.message}'`, "error");
|
|
431
|
+
}
|
|
335
432
|
}
|
|
336
433
|
finally {
|
|
337
|
-
sender.sendMessage(
|
|
434
|
+
sender.sendMessage(instructionsEvent, { acknowledgment: { success } });
|
|
338
435
|
}
|
|
339
|
-
if (
|
|
436
|
+
if (requiresResult === true && onResult !== undefined) {
|
|
340
437
|
onResult(result);
|
|
341
438
|
}
|
|
342
439
|
});
|
|
@@ -348,6 +445,10 @@ export class PicteusExtension {
|
|
|
348
445
|
this.socket = undefined;
|
|
349
446
|
}
|
|
350
447
|
}
|
|
448
|
+
exit(code, error, message) {
|
|
449
|
+
this.logger.error(`For the ${this.toString()}, ${message}. Reason: '${error.message}'`, error);
|
|
450
|
+
process.exit(code);
|
|
451
|
+
}
|
|
351
452
|
getApiConfiguration() {
|
|
352
453
|
if (this.parameters.webServicesBaseUrl.startsWith("https://localhost") == true) {
|
|
353
454
|
// This enables to discard the warning log message, caused by the fact that we are issuing HTTPS request on the localhost exposing a self-served certificate
|
|
@@ -374,7 +475,15 @@ export class PicteusExtension {
|
|
|
374
475
|
message = await response.text();
|
|
375
476
|
}
|
|
376
477
|
return Promise.reject(new ApiCallError({ status: response.status, code, message }));
|
|
377
|
-
}
|
|
478
|
+
},
|
|
479
|
+
middleware: [
|
|
480
|
+
{
|
|
481
|
+
onError: async (context) => {
|
|
482
|
+
// We rethrow the original error directly, e.g. an "ApiCallError"
|
|
483
|
+
throw context.error;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
]
|
|
378
487
|
});
|
|
379
488
|
}
|
|
380
489
|
}
|