@vetta-org/plugin-sdk 0.1.1 → 0.3.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/activity-tab.d.ts +2 -0
- package/dist/activity-tab.d.ts.map +1 -1
- package/dist/activity-tab.js +1 -1
- package/dist/activity-tab.js.map +1 -1
- package/dist/agent.d.ts +148 -4
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +14 -1
- package/dist/agent.js.map +1 -1
- package/dist/ai.d.ts +106 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +2 -0
- package/dist/ai.js.map +1 -0
- package/dist/app-actions.d.ts +9 -1
- package/dist/app-actions.d.ts.map +1 -1
- package/dist/app-actions.js.map +1 -1
- package/dist/artifacts.d.ts +31 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +2 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/browser.d.ts +119 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +2 -0
- package/dist/browser.js.map +1 -0
- package/dist/capture.d.ts +64 -0
- package/dist/capture.d.ts.map +1 -0
- package/dist/capture.js +2 -0
- package/dist/capture.js.map +1 -0
- package/dist/cli-provider.d.ts +18 -0
- package/dist/cli-provider.d.ts.map +1 -0
- package/dist/cli-provider.js +2 -0
- package/dist/cli-provider.js.map +1 -0
- package/dist/context.d.ts +59 -7
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/conversation.d.ts +66 -2
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js.map +1 -1
- package/dist/gateway.d.ts +37 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +14 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +26 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +34 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +2 -0
- package/dist/jobs.js.map +1 -0
- package/dist/manifest-schema.d.ts +637 -0
- package/dist/manifest-schema.d.ts.map +1 -0
- package/dist/manifest-schema.js +251 -0
- package/dist/manifest-schema.js.map +1 -0
- package/dist/manifest.d.ts +21 -55
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +468 -1
- package/dist/manifest.js.map +1 -1
- package/dist/media.d.ts +193 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +11 -0
- package/dist/media.js.map +1 -0
- package/dist/models.d.ts +35 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +2 -0
- package/dist/models.js.map +1 -0
- package/dist/network.d.ts +2 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js.map +1 -1
- package/dist/npm-package.d.ts +17 -0
- package/dist/npm-package.d.ts.map +1 -0
- package/dist/npm-package.js +38 -0
- package/dist/npm-package.js.map +1 -0
- package/dist/ocr.d.ts +78 -0
- package/dist/ocr.d.ts.map +1 -0
- package/dist/ocr.js +2 -0
- package/dist/ocr.js.map +1 -0
- package/dist/official.d.ts +219 -10
- package/dist/official.d.ts.map +1 -1
- package/dist/official.js.map +1 -1
- package/dist/permissions.d.ts +2 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +62 -1
- package/dist/permissions.js.map +1 -1
- package/dist/prompt-attachment.d.ts +30 -6
- package/dist/prompt-attachment.d.ts.map +1 -1
- package/dist/prompt-attachment.js +35 -1
- package/dist/prompt-attachment.js.map +1 -1
- package/dist/quickjs.d.ts +147 -0
- package/dist/quickjs.d.ts.map +1 -0
- package/dist/quickjs.js +2 -0
- package/dist/quickjs.js.map +1 -0
- package/dist/secrets.d.ts +27 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +2 -0
- package/dist/secrets.js.map +1 -0
- package/dist/service-provider.d.ts +62 -0
- package/dist/service-provider.d.ts.map +1 -0
- package/dist/service-provider.js +2 -0
- package/dist/service-provider.js.map +1 -0
- package/dist/storage.d.ts +46 -6
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +8 -1
- package/dist/storage.js.map +1 -1
- package/dist/ui.d.ts +341 -22
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/package.json +22 -2
- package/src/tailwind-theme.css +30 -0
- package/dist/settings.d.ts +0 -13
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -2
- package/dist/settings.js.map +0 -1
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import type { PluginArtifactRef } from "./artifacts.js";
|
|
2
|
+
import type { Disposable } from "./disposable.js";
|
|
3
|
+
import type { PluginJob, PluginJobFailure } from "./jobs.js";
|
|
4
|
+
export type PluginMediaKind = "image" | "video" | "audio" | "document";
|
|
5
|
+
export type PluginMediaOutputKind = "image" | "video" | "audio";
|
|
6
|
+
export type PluginMediaOperation = "generate" | "compose" | "transcode";
|
|
7
|
+
export type PluginMediaGenerationMode = "text-to-image" | "image-to-image" | "text-to-video" | "image-to-video" | "video-to-video" | "reference-to-video";
|
|
8
|
+
export type PluginMediaErrorCode = "unauthenticated" | "provider-unavailable" | "operation-unsupported" | "invalid-request" | "not-entitled" | "quota-exhausted" | "content-rejected" | "provider-timeout" | "provider-failed" | "cancelled";
|
|
9
|
+
export interface PluginMediaFailure extends PluginJobFailure {
|
|
10
|
+
code: PluginMediaErrorCode;
|
|
11
|
+
}
|
|
12
|
+
export declare class PluginMediaError extends Error {
|
|
13
|
+
readonly code: PluginMediaErrorCode;
|
|
14
|
+
readonly retryable: boolean;
|
|
15
|
+
constructor(failure: PluginMediaFailure);
|
|
16
|
+
}
|
|
17
|
+
export interface PluginMediaDimensions {
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
export type PluginMediaInputSource = {
|
|
22
|
+
type: "plugin-blob";
|
|
23
|
+
blobId: string;
|
|
24
|
+
} | {
|
|
25
|
+
type: "workspace-file";
|
|
26
|
+
path: string;
|
|
27
|
+
};
|
|
28
|
+
export interface PluginMediaInput {
|
|
29
|
+
id?: string;
|
|
30
|
+
role?: string;
|
|
31
|
+
kind: PluginMediaKind;
|
|
32
|
+
mimeType?: string;
|
|
33
|
+
source: PluginMediaInputSource;
|
|
34
|
+
}
|
|
35
|
+
export interface PluginMediaOutput {
|
|
36
|
+
kind: PluginMediaOutputKind;
|
|
37
|
+
mimeType: string;
|
|
38
|
+
dimensions?: PluginMediaDimensions;
|
|
39
|
+
fps?: number;
|
|
40
|
+
durationSeconds?: number;
|
|
41
|
+
videoCodec?: string;
|
|
42
|
+
audioCodec?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface PluginMediaArtifact extends PluginArtifactRef {
|
|
45
|
+
kind: PluginMediaOutputKind;
|
|
46
|
+
width?: number;
|
|
47
|
+
height?: number;
|
|
48
|
+
durationSeconds?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface PluginMediaGenerateRequest {
|
|
51
|
+
operation: "generate";
|
|
52
|
+
providerId: string;
|
|
53
|
+
kind: "image" | "video";
|
|
54
|
+
mode: PluginMediaGenerationMode;
|
|
55
|
+
prompt: string;
|
|
56
|
+
modelId?: string;
|
|
57
|
+
dimensions?: PluginMediaDimensions;
|
|
58
|
+
aspectRatio?: string;
|
|
59
|
+
resolution?: string;
|
|
60
|
+
durationSeconds?: number;
|
|
61
|
+
inputs?: readonly PluginMediaInput[];
|
|
62
|
+
}
|
|
63
|
+
export interface PluginMediaComposeRequest {
|
|
64
|
+
operation: "compose";
|
|
65
|
+
providerId: string;
|
|
66
|
+
inputs: readonly PluginMediaInput[];
|
|
67
|
+
output: PluginMediaOutput;
|
|
68
|
+
}
|
|
69
|
+
export interface PluginMediaTranscodeRequest {
|
|
70
|
+
operation: "transcode";
|
|
71
|
+
providerId: string;
|
|
72
|
+
inputs: readonly PluginMediaInput[];
|
|
73
|
+
output: PluginMediaOutput;
|
|
74
|
+
}
|
|
75
|
+
export type PluginMediaSubmitRequest = PluginMediaGenerateRequest | PluginMediaComposeRequest | PluginMediaTranscodeRequest;
|
|
76
|
+
export interface PluginMediaGenerationInputSlot {
|
|
77
|
+
role: string;
|
|
78
|
+
kinds: readonly PluginMediaKind[];
|
|
79
|
+
minItems: number;
|
|
80
|
+
maxItems: number;
|
|
81
|
+
}
|
|
82
|
+
export interface PluginMediaGenerationModeCapability {
|
|
83
|
+
mode: PluginMediaGenerationMode;
|
|
84
|
+
inputs: readonly PluginMediaGenerationInputSlot[];
|
|
85
|
+
minTotalItems?: number;
|
|
86
|
+
maxTotalItems?: number;
|
|
87
|
+
aspectRatioPolicy?: "configurable" | "input-derived";
|
|
88
|
+
audioGeneration?: "none" | "always" | "optional";
|
|
89
|
+
}
|
|
90
|
+
export type PluginMediaCapability = {
|
|
91
|
+
operation: "generate";
|
|
92
|
+
kind: "image" | "video";
|
|
93
|
+
modes: readonly PluginMediaGenerationMode[];
|
|
94
|
+
aspectRatios?: readonly string[];
|
|
95
|
+
/** Provider-defined stable option ids; consumers must not infer pixel dimensions from their names. */
|
|
96
|
+
resolutions?: readonly string[];
|
|
97
|
+
/** Preferred option when the consumer has no supported persisted resolution. */
|
|
98
|
+
defaultResolution?: string;
|
|
99
|
+
durationsSeconds?: readonly number[];
|
|
100
|
+
modeCapabilities?: readonly PluginMediaGenerationModeCapability[];
|
|
101
|
+
} | {
|
|
102
|
+
operation: "compose";
|
|
103
|
+
documentMimeTypes: readonly string[];
|
|
104
|
+
outputMimeTypes: readonly string[];
|
|
105
|
+
} | {
|
|
106
|
+
operation: "transcode";
|
|
107
|
+
inputMimeTypes: readonly string[];
|
|
108
|
+
outputMimeTypes: readonly string[];
|
|
109
|
+
};
|
|
110
|
+
export interface PluginMediaProviderDescriptor {
|
|
111
|
+
/** Host-qualified provider id. */
|
|
112
|
+
id: string;
|
|
113
|
+
displayName?: string;
|
|
114
|
+
ownerId: string;
|
|
115
|
+
protocolVersion: number;
|
|
116
|
+
capabilities: readonly PluginMediaCapability[];
|
|
117
|
+
}
|
|
118
|
+
export type PluginMediaJob = Omit<PluginJob<PluginMediaArtifact>, "error"> & {
|
|
119
|
+
error?: PluginMediaFailure;
|
|
120
|
+
};
|
|
121
|
+
/** A media input exposed to its provider without revealing its storage location. */
|
|
122
|
+
export interface PluginMediaProviderInput {
|
|
123
|
+
id: string;
|
|
124
|
+
role?: string;
|
|
125
|
+
kind: PluginMediaKind;
|
|
126
|
+
mimeType?: string;
|
|
127
|
+
}
|
|
128
|
+
type ProviderRequest<Request extends PluginMediaSubmitRequest> = Omit<Request, "providerId" | "inputs"> & {
|
|
129
|
+
readonly inputs: readonly PluginMediaProviderInput[];
|
|
130
|
+
};
|
|
131
|
+
export type PluginMediaProviderSubmitRequest = PluginMediaSubmitRequest extends infer Request ? Request extends PluginMediaSubmitRequest ? ProviderRequest<Request> : never : never;
|
|
132
|
+
export interface PluginMediaInputUploadRequest {
|
|
133
|
+
url: string;
|
|
134
|
+
fieldName: string;
|
|
135
|
+
fileName?: string;
|
|
136
|
+
fields?: Record<string, string>;
|
|
137
|
+
headers?: Record<string, string>;
|
|
138
|
+
timeoutMs?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface PluginMediaTransferResponse<T = unknown> {
|
|
141
|
+
ok: boolean;
|
|
142
|
+
status: number;
|
|
143
|
+
statusText: string;
|
|
144
|
+
headers: Record<string, string>;
|
|
145
|
+
body: T;
|
|
146
|
+
}
|
|
147
|
+
export interface PluginMediaProviderHandlerContext {
|
|
148
|
+
readonly invocationId: string;
|
|
149
|
+
uploadInput<T = unknown>(inputId: string, request: PluginMediaInputUploadRequest): Promise<PluginMediaTransferResponse<T>>;
|
|
150
|
+
}
|
|
151
|
+
export type PluginMediaProviderArtifactSource = {
|
|
152
|
+
type: "remote-url";
|
|
153
|
+
url: string;
|
|
154
|
+
headers?: Record<string, string>;
|
|
155
|
+
} | {
|
|
156
|
+
type: "plugin-blob";
|
|
157
|
+
blobId: string;
|
|
158
|
+
} | {
|
|
159
|
+
type: "workspace-file";
|
|
160
|
+
path: string;
|
|
161
|
+
};
|
|
162
|
+
export interface PluginMediaProviderArtifact {
|
|
163
|
+
kind: PluginMediaOutputKind;
|
|
164
|
+
mimeType?: string;
|
|
165
|
+
name?: string;
|
|
166
|
+
width?: number;
|
|
167
|
+
height?: number;
|
|
168
|
+
durationSeconds?: number;
|
|
169
|
+
source: PluginMediaProviderArtifactSource;
|
|
170
|
+
}
|
|
171
|
+
export interface PluginMediaProviderJob {
|
|
172
|
+
id: string;
|
|
173
|
+
status: PluginMediaJob["status"];
|
|
174
|
+
progress?: number;
|
|
175
|
+
artifacts?: readonly PluginMediaProviderArtifact[];
|
|
176
|
+
error?: PluginMediaFailure;
|
|
177
|
+
}
|
|
178
|
+
export interface PluginMediaProviderRegistration {
|
|
179
|
+
id: string;
|
|
180
|
+
displayName?: string;
|
|
181
|
+
capabilities: readonly PluginMediaCapability[];
|
|
182
|
+
submit(request: PluginMediaProviderSubmitRequest, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;
|
|
183
|
+
getJob?(jobId: string, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;
|
|
184
|
+
cancelJob?(jobId: string, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;
|
|
185
|
+
}
|
|
186
|
+
export interface PluginMediaApi {
|
|
187
|
+
registerProvider(registration: PluginMediaProviderRegistration): Disposable;
|
|
188
|
+
listProviders(): Promise<readonly PluginMediaProviderDescriptor[]>;
|
|
189
|
+
onProvidersChanged(listener: () => void): Disposable;
|
|
190
|
+
submit(request: PluginMediaSubmitRequest): Promise<PluginMediaJob>;
|
|
191
|
+
}
|
|
192
|
+
export {};
|
|
193
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,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SAAS,CAAC,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACnD,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC3B;AAED,MAAM,WAAW,+BAA+B;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC/C,MAAM,CACL,OAAO,EAAE,gCAAgC,EACzC,OAAO,EAAE,iCAAiC,GACxC,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACnC,MAAM,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IACpG,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACvG;AAED,MAAM,WAAW,cAAc;IAC9B,gBAAgB,CAAC,YAAY,EAAE,+BAA+B,GAAG,UAAU,CAAC;IAC5E,aAAa,IAAI,OAAO,CAAC,SAAS,6BAA6B,EAAE,CAAC,CAAC;IACnE,kBAAkB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;IACrD,MAAM,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACnE","sourcesContent":["import type { PluginArtifactRef } from \"./artifacts.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginJob, PluginJobFailure } from \"./jobs.js\";\n\nexport type PluginMediaKind = \"image\" | \"video\" | \"audio\" | \"document\";\nexport type PluginMediaOutputKind = \"image\" | \"video\" | \"audio\";\nexport type PluginMediaOperation = \"generate\" | \"compose\" | \"transcode\";\n\nexport type PluginMediaGenerationMode =\n\t| \"text-to-image\"\n\t| \"image-to-image\"\n\t| \"text-to-video\"\n\t| \"image-to-video\"\n\t| \"video-to-video\"\n\t| \"reference-to-video\";\n\nexport type PluginMediaErrorCode =\n\t| \"unauthenticated\"\n\t| \"provider-unavailable\"\n\t| \"operation-unsupported\"\n\t| \"invalid-request\"\n\t| \"not-entitled\"\n\t| \"quota-exhausted\"\n\t| \"content-rejected\"\n\t| \"provider-timeout\"\n\t| \"provider-failed\"\n\t| \"cancelled\";\n\nexport interface PluginMediaFailure extends PluginJobFailure {\n\tcode: PluginMediaErrorCode;\n}\n\nexport class PluginMediaError extends Error {\n\treadonly code: PluginMediaErrorCode;\n\treadonly retryable: boolean;\n\n\tconstructor(failure: PluginMediaFailure) {\n\t\tsuper(failure.message);\n\t\tthis.name = \"PluginMediaError\";\n\t\tthis.code = failure.code;\n\t\tthis.retryable = failure.retryable;\n\t}\n}\n\nexport interface PluginMediaDimensions {\n\twidth: number;\n\theight: number;\n}\n\nexport type PluginMediaInputSource =\n\t| { type: \"plugin-blob\"; blobId: string }\n\t| { type: \"workspace-file\"; path: string };\n\nexport interface PluginMediaInput {\n\tid?: string;\n\trole?: string;\n\tkind: PluginMediaKind;\n\tmimeType?: string;\n\tsource: PluginMediaInputSource;\n}\n\nexport interface PluginMediaOutput {\n\tkind: PluginMediaOutputKind;\n\tmimeType: string;\n\tdimensions?: PluginMediaDimensions;\n\tfps?: number;\n\tdurationSeconds?: number;\n\tvideoCodec?: string;\n\taudioCodec?: string;\n}\n\nexport interface PluginMediaArtifact extends PluginArtifactRef {\n\tkind: PluginMediaOutputKind;\n\twidth?: number;\n\theight?: number;\n\tdurationSeconds?: number;\n}\n\nexport interface PluginMediaGenerateRequest {\n\toperation: \"generate\";\n\tproviderId: string;\n\tkind: \"image\" | \"video\";\n\tmode: PluginMediaGenerationMode;\n\tprompt: string;\n\tmodelId?: string;\n\tdimensions?: PluginMediaDimensions;\n\taspectRatio?: string;\n\tresolution?: string;\n\tdurationSeconds?: number;\n\tinputs?: readonly PluginMediaInput[];\n}\n\nexport interface PluginMediaComposeRequest {\n\toperation: \"compose\";\n\tproviderId: string;\n\tinputs: readonly PluginMediaInput[];\n\toutput: PluginMediaOutput;\n}\n\nexport interface PluginMediaTranscodeRequest {\n\toperation: \"transcode\";\n\tproviderId: string;\n\tinputs: readonly PluginMediaInput[];\n\toutput: PluginMediaOutput;\n}\n\nexport type PluginMediaSubmitRequest =\n\t| PluginMediaGenerateRequest\n\t| PluginMediaComposeRequest\n\t| PluginMediaTranscodeRequest;\n\nexport interface PluginMediaGenerationInputSlot {\n\trole: string;\n\tkinds: readonly PluginMediaKind[];\n\tminItems: number;\n\tmaxItems: number;\n}\n\nexport interface PluginMediaGenerationModeCapability {\n\tmode: PluginMediaGenerationMode;\n\tinputs: readonly PluginMediaGenerationInputSlot[];\n\tminTotalItems?: number;\n\tmaxTotalItems?: number;\n\taspectRatioPolicy?: \"configurable\" | \"input-derived\";\n\taudioGeneration?: \"none\" | \"always\" | \"optional\";\n}\n\nexport type PluginMediaCapability =\n\t| {\n\t\t\toperation: \"generate\";\n\t\t\tkind: \"image\" | \"video\";\n\t\t\tmodes: readonly PluginMediaGenerationMode[];\n\t\t\taspectRatios?: readonly string[];\n\t\t\t/** Provider-defined stable option ids; consumers must not infer pixel dimensions from their names. */\n\t\t\tresolutions?: readonly string[];\n\t\t\t/** Preferred option when the consumer has no supported persisted resolution. */\n\t\t\tdefaultResolution?: string;\n\t\t\tdurationsSeconds?: readonly number[];\n\t\t\tmodeCapabilities?: readonly PluginMediaGenerationModeCapability[];\n\t }\n\t| {\n\t\t\toperation: \"compose\";\n\t\t\tdocumentMimeTypes: readonly string[];\n\t\t\toutputMimeTypes: readonly string[];\n\t }\n\t| {\n\t\t\toperation: \"transcode\";\n\t\t\tinputMimeTypes: readonly string[];\n\t\t\toutputMimeTypes: readonly string[];\n\t };\n\nexport interface PluginMediaProviderDescriptor {\n\t/** Host-qualified provider id. */\n\tid: string;\n\tdisplayName?: string;\n\townerId: string;\n\tprotocolVersion: number;\n\tcapabilities: readonly PluginMediaCapability[];\n}\n\nexport type PluginMediaJob = Omit<PluginJob<PluginMediaArtifact>, \"error\"> & {\n\terror?: PluginMediaFailure;\n};\n\n/** A media input exposed to its provider without revealing its storage location. */\nexport interface PluginMediaProviderInput {\n\tid: string;\n\trole?: string;\n\tkind: PluginMediaKind;\n\tmimeType?: string;\n}\n\ntype ProviderRequest<Request extends PluginMediaSubmitRequest> = Omit<Request, \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly PluginMediaProviderInput[];\n};\n\nexport type PluginMediaProviderSubmitRequest =\n\tPluginMediaSubmitRequest extends infer Request\n\t\t? Request extends PluginMediaSubmitRequest\n\t\t\t? ProviderRequest<Request>\n\t\t\t: never\n\t\t: never;\n\nexport interface PluginMediaInputUploadRequest {\n\turl: string;\n\tfieldName: string;\n\tfileName?: string;\n\tfields?: Record<string, string>;\n\theaders?: Record<string, string>;\n\ttimeoutMs?: number;\n}\n\nexport interface PluginMediaTransferResponse<T = unknown> {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n}\n\nexport interface PluginMediaProviderHandlerContext {\n\treadonly invocationId: string;\n\tuploadInput<T = unknown>(\n\t\tinputId: string,\n\t\trequest: PluginMediaInputUploadRequest,\n\t): Promise<PluginMediaTransferResponse<T>>;\n}\n\nexport type PluginMediaProviderArtifactSource =\n\t| { type: \"remote-url\"; url: string; headers?: Record<string, string> }\n\t| { type: \"plugin-blob\"; blobId: string }\n\t| { type: \"workspace-file\"; path: string };\n\nexport interface PluginMediaProviderArtifact {\n\tkind: PluginMediaOutputKind;\n\tmimeType?: string;\n\tname?: string;\n\twidth?: number;\n\theight?: number;\n\tdurationSeconds?: number;\n\tsource: PluginMediaProviderArtifactSource;\n}\n\nexport interface PluginMediaProviderJob {\n\tid: string;\n\tstatus: PluginMediaJob[\"status\"];\n\tprogress?: number;\n\tartifacts?: readonly PluginMediaProviderArtifact[];\n\terror?: PluginMediaFailure;\n}\n\nexport interface PluginMediaProviderRegistration {\n\tid: string;\n\tdisplayName?: string;\n\tcapabilities: readonly PluginMediaCapability[];\n\tsubmit(\n\t\trequest: PluginMediaProviderSubmitRequest,\n\t\tcontext: PluginMediaProviderHandlerContext,\n\t): Promise<PluginMediaProviderJob>;\n\tgetJob?(jobId: string, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;\n\tcancelJob?(jobId: string, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;\n}\n\nexport interface PluginMediaApi {\n\tregisterProvider(registration: PluginMediaProviderRegistration): Disposable;\n\tlistProviders(): Promise<readonly PluginMediaProviderDescriptor[]>;\n\tonProvidersChanged(listener: () => void): Disposable;\n\tsubmit(request: PluginMediaSubmitRequest): Promise<PluginMediaJob>;\n}\n"]}
|
package/dist/media.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class PluginMediaError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
retryable;
|
|
4
|
+
constructor(failure) {
|
|
5
|
+
super(failure.message);
|
|
6
|
+
this.name = "PluginMediaError";
|
|
7
|
+
this.code = failure.code;
|
|
8
|
+
this.retryable = failure.retryable;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAgCA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACjC,IAAI,CAAuB;IAC3B,SAAS,CAAU;IAE5B,YAAY,OAA2B,EAAE;QACxC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAAA,CACnC;CACD","sourcesContent":["import type { PluginArtifactRef } from \"./artifacts.js\";\nimport type { Disposable } from \"./disposable.js\";\nimport type { PluginJob, PluginJobFailure } from \"./jobs.js\";\n\nexport type PluginMediaKind = \"image\" | \"video\" | \"audio\" | \"document\";\nexport type PluginMediaOutputKind = \"image\" | \"video\" | \"audio\";\nexport type PluginMediaOperation = \"generate\" | \"compose\" | \"transcode\";\n\nexport type PluginMediaGenerationMode =\n\t| \"text-to-image\"\n\t| \"image-to-image\"\n\t| \"text-to-video\"\n\t| \"image-to-video\"\n\t| \"video-to-video\"\n\t| \"reference-to-video\";\n\nexport type PluginMediaErrorCode =\n\t| \"unauthenticated\"\n\t| \"provider-unavailable\"\n\t| \"operation-unsupported\"\n\t| \"invalid-request\"\n\t| \"not-entitled\"\n\t| \"quota-exhausted\"\n\t| \"content-rejected\"\n\t| \"provider-timeout\"\n\t| \"provider-failed\"\n\t| \"cancelled\";\n\nexport interface PluginMediaFailure extends PluginJobFailure {\n\tcode: PluginMediaErrorCode;\n}\n\nexport class PluginMediaError extends Error {\n\treadonly code: PluginMediaErrorCode;\n\treadonly retryable: boolean;\n\n\tconstructor(failure: PluginMediaFailure) {\n\t\tsuper(failure.message);\n\t\tthis.name = \"PluginMediaError\";\n\t\tthis.code = failure.code;\n\t\tthis.retryable = failure.retryable;\n\t}\n}\n\nexport interface PluginMediaDimensions {\n\twidth: number;\n\theight: number;\n}\n\nexport type PluginMediaInputSource =\n\t| { type: \"plugin-blob\"; blobId: string }\n\t| { type: \"workspace-file\"; path: string };\n\nexport interface PluginMediaInput {\n\tid?: string;\n\trole?: string;\n\tkind: PluginMediaKind;\n\tmimeType?: string;\n\tsource: PluginMediaInputSource;\n}\n\nexport interface PluginMediaOutput {\n\tkind: PluginMediaOutputKind;\n\tmimeType: string;\n\tdimensions?: PluginMediaDimensions;\n\tfps?: number;\n\tdurationSeconds?: number;\n\tvideoCodec?: string;\n\taudioCodec?: string;\n}\n\nexport interface PluginMediaArtifact extends PluginArtifactRef {\n\tkind: PluginMediaOutputKind;\n\twidth?: number;\n\theight?: number;\n\tdurationSeconds?: number;\n}\n\nexport interface PluginMediaGenerateRequest {\n\toperation: \"generate\";\n\tproviderId: string;\n\tkind: \"image\" | \"video\";\n\tmode: PluginMediaGenerationMode;\n\tprompt: string;\n\tmodelId?: string;\n\tdimensions?: PluginMediaDimensions;\n\taspectRatio?: string;\n\tresolution?: string;\n\tdurationSeconds?: number;\n\tinputs?: readonly PluginMediaInput[];\n}\n\nexport interface PluginMediaComposeRequest {\n\toperation: \"compose\";\n\tproviderId: string;\n\tinputs: readonly PluginMediaInput[];\n\toutput: PluginMediaOutput;\n}\n\nexport interface PluginMediaTranscodeRequest {\n\toperation: \"transcode\";\n\tproviderId: string;\n\tinputs: readonly PluginMediaInput[];\n\toutput: PluginMediaOutput;\n}\n\nexport type PluginMediaSubmitRequest =\n\t| PluginMediaGenerateRequest\n\t| PluginMediaComposeRequest\n\t| PluginMediaTranscodeRequest;\n\nexport interface PluginMediaGenerationInputSlot {\n\trole: string;\n\tkinds: readonly PluginMediaKind[];\n\tminItems: number;\n\tmaxItems: number;\n}\n\nexport interface PluginMediaGenerationModeCapability {\n\tmode: PluginMediaGenerationMode;\n\tinputs: readonly PluginMediaGenerationInputSlot[];\n\tminTotalItems?: number;\n\tmaxTotalItems?: number;\n\taspectRatioPolicy?: \"configurable\" | \"input-derived\";\n\taudioGeneration?: \"none\" | \"always\" | \"optional\";\n}\n\nexport type PluginMediaCapability =\n\t| {\n\t\t\toperation: \"generate\";\n\t\t\tkind: \"image\" | \"video\";\n\t\t\tmodes: readonly PluginMediaGenerationMode[];\n\t\t\taspectRatios?: readonly string[];\n\t\t\t/** Provider-defined stable option ids; consumers must not infer pixel dimensions from their names. */\n\t\t\tresolutions?: readonly string[];\n\t\t\t/** Preferred option when the consumer has no supported persisted resolution. */\n\t\t\tdefaultResolution?: string;\n\t\t\tdurationsSeconds?: readonly number[];\n\t\t\tmodeCapabilities?: readonly PluginMediaGenerationModeCapability[];\n\t }\n\t| {\n\t\t\toperation: \"compose\";\n\t\t\tdocumentMimeTypes: readonly string[];\n\t\t\toutputMimeTypes: readonly string[];\n\t }\n\t| {\n\t\t\toperation: \"transcode\";\n\t\t\tinputMimeTypes: readonly string[];\n\t\t\toutputMimeTypes: readonly string[];\n\t };\n\nexport interface PluginMediaProviderDescriptor {\n\t/** Host-qualified provider id. */\n\tid: string;\n\tdisplayName?: string;\n\townerId: string;\n\tprotocolVersion: number;\n\tcapabilities: readonly PluginMediaCapability[];\n}\n\nexport type PluginMediaJob = Omit<PluginJob<PluginMediaArtifact>, \"error\"> & {\n\terror?: PluginMediaFailure;\n};\n\n/** A media input exposed to its provider without revealing its storage location. */\nexport interface PluginMediaProviderInput {\n\tid: string;\n\trole?: string;\n\tkind: PluginMediaKind;\n\tmimeType?: string;\n}\n\ntype ProviderRequest<Request extends PluginMediaSubmitRequest> = Omit<Request, \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly PluginMediaProviderInput[];\n};\n\nexport type PluginMediaProviderSubmitRequest =\n\tPluginMediaSubmitRequest extends infer Request\n\t\t? Request extends PluginMediaSubmitRequest\n\t\t\t? ProviderRequest<Request>\n\t\t\t: never\n\t\t: never;\n\nexport interface PluginMediaInputUploadRequest {\n\turl: string;\n\tfieldName: string;\n\tfileName?: string;\n\tfields?: Record<string, string>;\n\theaders?: Record<string, string>;\n\ttimeoutMs?: number;\n}\n\nexport interface PluginMediaTransferResponse<T = unknown> {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n}\n\nexport interface PluginMediaProviderHandlerContext {\n\treadonly invocationId: string;\n\tuploadInput<T = unknown>(\n\t\tinputId: string,\n\t\trequest: PluginMediaInputUploadRequest,\n\t): Promise<PluginMediaTransferResponse<T>>;\n}\n\nexport type PluginMediaProviderArtifactSource =\n\t| { type: \"remote-url\"; url: string; headers?: Record<string, string> }\n\t| { type: \"plugin-blob\"; blobId: string }\n\t| { type: \"workspace-file\"; path: string };\n\nexport interface PluginMediaProviderArtifact {\n\tkind: PluginMediaOutputKind;\n\tmimeType?: string;\n\tname?: string;\n\twidth?: number;\n\theight?: number;\n\tdurationSeconds?: number;\n\tsource: PluginMediaProviderArtifactSource;\n}\n\nexport interface PluginMediaProviderJob {\n\tid: string;\n\tstatus: PluginMediaJob[\"status\"];\n\tprogress?: number;\n\tartifacts?: readonly PluginMediaProviderArtifact[];\n\terror?: PluginMediaFailure;\n}\n\nexport interface PluginMediaProviderRegistration {\n\tid: string;\n\tdisplayName?: string;\n\tcapabilities: readonly PluginMediaCapability[];\n\tsubmit(\n\t\trequest: PluginMediaProviderSubmitRequest,\n\t\tcontext: PluginMediaProviderHandlerContext,\n\t): Promise<PluginMediaProviderJob>;\n\tgetJob?(jobId: string, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;\n\tcancelJob?(jobId: string, context: PluginMediaProviderHandlerContext): Promise<PluginMediaProviderJob>;\n}\n\nexport interface PluginMediaApi {\n\tregisterProvider(registration: PluginMediaProviderRegistration): Disposable;\n\tlistProviders(): Promise<readonly PluginMediaProviderDescriptor[]>;\n\tonProvidersChanged(listener: () => void): Disposable;\n\tsubmit(request: PluginMediaSubmitRequest): Promise<PluginMediaJob>;\n}\n"]}
|
package/dist/models.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface PluginModelDefinition {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
reasoning?: boolean;
|
|
6
|
+
contextWindow?: number;
|
|
7
|
+
maxTokens?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface PluginModelProviderConfig {
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
api?: string;
|
|
13
|
+
displayName?: string;
|
|
14
|
+
authHeader?: boolean;
|
|
15
|
+
headers?: Record<string, string>;
|
|
16
|
+
models?: PluginModelDefinition[];
|
|
17
|
+
}
|
|
18
|
+
/** Reconciles the complete set of provider ids owned by the calling plugin. */
|
|
19
|
+
export interface PluginModelsApi {
|
|
20
|
+
replaceOwnedProviders(providers: Record<string, PluginModelProviderConfig>): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Reads back what the host currently holds for this plugin, keyed by the same
|
|
23
|
+
* local provider ids `replaceOwnedProviders` accepts.
|
|
24
|
+
*
|
|
25
|
+
* `replaceOwnedProviders` deletes by omission, so a plugin that cannot read its
|
|
26
|
+
* own published state can only clobber it — every write has to reconstruct the
|
|
27
|
+
* whole truth from whatever its (often eventually consistent) upstream happens
|
|
28
|
+
* to report at that instant. Read this first and reconcile against it, so a
|
|
29
|
+
* model that is merely not visible yet is not mistaken for one the user lost.
|
|
30
|
+
*
|
|
31
|
+
* `apiKey` comes back masked; supply the real credential on the next write.
|
|
32
|
+
*/
|
|
33
|
+
listOwnedProviders(): Promise<Record<string, PluginModelProviderConfig>>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC/B,qBAAqB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3F;;;;;;;;;;;OAWG;IACH,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC,CAAC;CACzE","sourcesContent":["export interface PluginModelDefinition {\n\tid: string;\n\tname?: string;\n\tapi?: string;\n\treasoning?: boolean;\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport interface PluginModelProviderConfig {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: PluginModelDefinition[];\n}\n\n/** Reconciles the complete set of provider ids owned by the calling plugin. */\nexport interface PluginModelsApi {\n\treplaceOwnedProviders(providers: Record<string, PluginModelProviderConfig>): Promise<void>;\n\t/**\n\t * Reads back what the host currently holds for this plugin, keyed by the same\n\t * local provider ids `replaceOwnedProviders` accepts.\n\t *\n\t * `replaceOwnedProviders` deletes by omission, so a plugin that cannot read its\n\t * own published state can only clobber it — every write has to reconstruct the\n\t * whole truth from whatever its (often eventually consistent) upstream happens\n\t * to report at that instant. Read this first and reconcile against it, so a\n\t * model that is merely not visible yet is not mistaken for one the user lost.\n\t *\n\t * `apiKey` comes back masked; supply the real credential on the next write.\n\t */\n\tlistOwnedProviders(): Promise<Record<string, PluginModelProviderConfig>>;\n}\n"]}
|
package/dist/models.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"","sourcesContent":["export interface PluginModelDefinition {\n\tid: string;\n\tname?: string;\n\tapi?: string;\n\treasoning?: boolean;\n\tcontextWindow?: number;\n\tmaxTokens?: number;\n}\n\nexport interface PluginModelProviderConfig {\n\tbaseUrl?: string;\n\tapiKey?: string;\n\tapi?: string;\n\tdisplayName?: string;\n\tauthHeader?: boolean;\n\theaders?: Record<string, string>;\n\tmodels?: PluginModelDefinition[];\n}\n\n/** Reconciles the complete set of provider ids owned by the calling plugin. */\nexport interface PluginModelsApi {\n\treplaceOwnedProviders(providers: Record<string, PluginModelProviderConfig>): Promise<void>;\n\t/**\n\t * Reads back what the host currently holds for this plugin, keyed by the same\n\t * local provider ids `replaceOwnedProviders` accepts.\n\t *\n\t * `replaceOwnedProviders` deletes by omission, so a plugin that cannot read its\n\t * own published state can only clobber it — every write has to reconstruct the\n\t * whole truth from whatever its (often eventually consistent) upstream happens\n\t * to report at that instant. Read this first and reconcile against it, so a\n\t * model that is merely not visible yet is not mistaken for one the user lost.\n\t *\n\t * `apiKey` comes back masked; supply the real credential on the next write.\n\t */\n\tlistOwnedProviders(): Promise<Record<string, PluginModelProviderConfig>>;\n}\n"]}
|
package/dist/network.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ export interface PluginNetworkResponse<T = unknown> {
|
|
|
30
30
|
* Host-mediated network access for trusted plugins.
|
|
31
31
|
*
|
|
32
32
|
* Requests run in the main process so plugins do not depend on renderer CORS
|
|
33
|
-
* behavior. Access requires the `network.fetch` permission
|
|
33
|
+
* behavior. Access requires the `network.fetch` permission and a matching
|
|
34
|
+
* `plugin.json` `network.allowedHosts` declaration.
|
|
34
35
|
*/
|
|
35
36
|
export interface PluginNetworkApi {
|
|
36
37
|
request<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;
|
package/dist/network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAC1B;IACA,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CACd,GACD;IACA,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,KAAK,CAA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BAAoB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC,GAAG,OAAO;IACjD,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,CAAC,CAAC;CACR;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAChC,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CACvF","sourcesContent":["export type PluginNetworkBody =\n\t| {\n\t\t\ttype: \"json\";\n\t\t\tvalue: unknown;\n\t }\n\t| {\n\t\t\ttype: \"multipart\";\n\t\t\tfields?: Record<string, string>;\n\t\t\tfiles?: Array<{\n\t\t\t\tfieldName: string;\n\t\t\t\tfileName: string;\n\t\t\t\tmimeType: string;\n\t\t\t\tdata: string;\n\t\t\t}>;\n\t };\n\nexport interface PluginNetworkRequest {\n\turl: string;\n\tmethod?: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\theaders?: Record<string, string>;\n\tbody?: PluginNetworkBody;\n\tresponseType?: \"json\" | \"text\" | \"base64\";\n\ttimeoutMs?: number;\n}\n\nexport interface PluginNetworkResponse<T = unknown> {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n}\n\n/**\n * Host-mediated network access for trusted plugins.\n *\n * Requests run in the main process so plugins do not depend on renderer CORS\n * behavior. Access requires the `network.fetch` permission and a matching\n * `plugin.json` `network.allowedHosts` declaration.\n */\nexport interface PluginNetworkApi {\n\trequest<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;\n}\n"]}
|
package/dist/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"","sourcesContent":["export type PluginNetworkBody =\n\t| {\n\t\t\ttype: \"json\";\n\t\t\tvalue: unknown;\n\t }\n\t| {\n\t\t\ttype: \"multipart\";\n\t\t\tfields?: Record<string, string>;\n\t\t\tfiles?: Array<{\n\t\t\t\tfieldName: string;\n\t\t\t\tfileName: string;\n\t\t\t\tmimeType: string;\n\t\t\t\tdata: string;\n\t\t\t}>;\n\t };\n\nexport interface PluginNetworkRequest {\n\turl: string;\n\tmethod?: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\theaders?: Record<string, string>;\n\tbody?: PluginNetworkBody;\n\tresponseType?: \"json\" | \"text\" | \"base64\";\n\ttimeoutMs?: number;\n}\n\nexport interface PluginNetworkResponse<T = unknown> {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n}\n\n/**\n * Host-mediated network access for trusted plugins.\n *\n * Requests run in the main process so plugins do not depend on renderer CORS\n * behavior. Access requires the `network.fetch` permission.\n */\nexport interface PluginNetworkApi {\n\trequest<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"","sourcesContent":["export type PluginNetworkBody =\n\t| {\n\t\t\ttype: \"json\";\n\t\t\tvalue: unknown;\n\t }\n\t| {\n\t\t\ttype: \"multipart\";\n\t\t\tfields?: Record<string, string>;\n\t\t\tfiles?: Array<{\n\t\t\t\tfieldName: string;\n\t\t\t\tfileName: string;\n\t\t\t\tmimeType: string;\n\t\t\t\tdata: string;\n\t\t\t}>;\n\t };\n\nexport interface PluginNetworkRequest {\n\turl: string;\n\tmethod?: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n\theaders?: Record<string, string>;\n\tbody?: PluginNetworkBody;\n\tresponseType?: \"json\" | \"text\" | \"base64\";\n\ttimeoutMs?: number;\n}\n\nexport interface PluginNetworkResponse<T = unknown> {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n}\n\n/**\n * Host-mediated network access for trusted plugins.\n *\n * Requests run in the main process so plugins do not depend on renderer CORS\n * behavior. Access requires the `network.fetch` permission and a matching\n * `plugin.json` `network.allowedHosts` declaration.\n */\nexport interface PluginNetworkApi {\n\trequest<T = unknown>(request: PluginNetworkRequest): Promise<PluginNetworkResponse<T>>;\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Static } from "@sinclair/typebox";
|
|
2
|
+
export declare const VETTA_NPM_PACKAGE_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const VettaNpmPluginMetadataSchema: import("@sinclair/typebox").TObject<{
|
|
4
|
+
schemaVersion: import("@sinclair/typebox").TLiteral<1>;
|
|
5
|
+
type: import("@sinclair/typebox").TLiteral<"desktop-plugin">;
|
|
6
|
+
pluginId: import("@sinclair/typebox").TString;
|
|
7
|
+
archive: import("@sinclair/typebox").TString;
|
|
8
|
+
}>;
|
|
9
|
+
export type VettaNpmPluginMetadata = Static<typeof VettaNpmPluginMetadataSchema>;
|
|
10
|
+
export interface VettaNpmPluginPackage {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
vetta: VettaNpmPluginMetadata;
|
|
14
|
+
}
|
|
15
|
+
/** Parse the npm distribution envelope without trusting package-owned metadata. */
|
|
16
|
+
export declare function parseVettaNpmPluginPackage(value: unknown): VettaNpmPluginPackage;
|
|
17
|
+
//# sourceMappingURL=npm-package.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-package.d.ts","sourceRoot":"","sources":["../src/npm-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKtD,eAAO,MAAM,gCAAgC,GAAa,CAAC;AAE3D,eAAO,MAAM,4BAA4B;;;;;EAQxC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEjF,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,sBAAsB,CAAC;CAC9B;AAMD,mFAAmF;AACnF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAqBhF","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport { PluginIdSchema, PluginVersionSchema } from \"./manifest-schema.js\";\nimport { validatePluginRelativePath } from \"./manifest.js\";\n\nexport const VETTA_NPM_PACKAGE_SCHEMA_VERSION = 1 as const;\n\nexport const VettaNpmPluginMetadataSchema = Type.Object(\n\t{\n\t\tschemaVersion: Type.Literal(VETTA_NPM_PACKAGE_SCHEMA_VERSION),\n\t\ttype: Type.Literal(\"desktop-plugin\"),\n\t\tpluginId: PluginIdSchema,\n\t\tarchive: Type.String({ minLength: 1 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type VettaNpmPluginMetadata = Static<typeof VettaNpmPluginMetadataSchema>;\n\nexport interface VettaNpmPluginPackage {\n\tname: string;\n\tversion: string;\n\tvetta: VettaNpmPluginMetadata;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Parse the npm distribution envelope without trusting package-owned metadata. */\nexport function parseVettaNpmPluginPackage(value: unknown): VettaNpmPluginPackage {\n\tif (!isRecord(value)) throw new Error(\"Invalid npm plugin package: package.json must contain an object\");\n\tif (typeof value.name !== \"string\" || value.name.trim().length === 0) {\n\t\tthrow new Error(\"Invalid npm plugin package: name is required\");\n\t}\n\tif (!Value.Check(PluginVersionSchema, value.version)) {\n\t\tthrow new Error(\"Invalid npm plugin package: version must be a semantic version\");\n\t}\n\tif (!Value.Check(VettaNpmPluginMetadataSchema, value.vetta)) {\n\t\tthrow new Error(\"Invalid npm plugin package: package.json#vetta does not match schema version 1\");\n\t}\n\n\tconst metadata = value.vetta as VettaNpmPluginMetadata;\n\treturn {\n\t\tname: value.name.trim(),\n\t\tversion: value.version,\n\t\tvetta: {\n\t\t\t...metadata,\n\t\t\tarchive: validatePluginRelativePath(metadata.archive.trim(), \"npm archive\"),\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { Value } from "@sinclair/typebox/value";
|
|
3
|
+
import { PluginIdSchema, PluginVersionSchema } from "./manifest-schema.js";
|
|
4
|
+
import { validatePluginRelativePath } from "./manifest.js";
|
|
5
|
+
export const VETTA_NPM_PACKAGE_SCHEMA_VERSION = 1;
|
|
6
|
+
export const VettaNpmPluginMetadataSchema = Type.Object({
|
|
7
|
+
schemaVersion: Type.Literal(VETTA_NPM_PACKAGE_SCHEMA_VERSION),
|
|
8
|
+
type: Type.Literal("desktop-plugin"),
|
|
9
|
+
pluginId: PluginIdSchema,
|
|
10
|
+
archive: Type.String({ minLength: 1 }),
|
|
11
|
+
}, { additionalProperties: false });
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
/** Parse the npm distribution envelope without trusting package-owned metadata. */
|
|
16
|
+
export function parseVettaNpmPluginPackage(value) {
|
|
17
|
+
if (!isRecord(value))
|
|
18
|
+
throw new Error("Invalid npm plugin package: package.json must contain an object");
|
|
19
|
+
if (typeof value.name !== "string" || value.name.trim().length === 0) {
|
|
20
|
+
throw new Error("Invalid npm plugin package: name is required");
|
|
21
|
+
}
|
|
22
|
+
if (!Value.Check(PluginVersionSchema, value.version)) {
|
|
23
|
+
throw new Error("Invalid npm plugin package: version must be a semantic version");
|
|
24
|
+
}
|
|
25
|
+
if (!Value.Check(VettaNpmPluginMetadataSchema, value.vetta)) {
|
|
26
|
+
throw new Error("Invalid npm plugin package: package.json#vetta does not match schema version 1");
|
|
27
|
+
}
|
|
28
|
+
const metadata = value.vetta;
|
|
29
|
+
return {
|
|
30
|
+
name: value.name.trim(),
|
|
31
|
+
version: value.version,
|
|
32
|
+
vetta: {
|
|
33
|
+
...metadata,
|
|
34
|
+
archive: validatePluginRelativePath(metadata.archive.trim(), "npm archive"),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=npm-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-package.js","sourceRoot":"","sources":["../src/npm-package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAU,CAAC;AAE3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC,MAAM,CACtD;IACC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC;IAC7D,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACpC,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E,aAAa,CAAC;SAC3E;KACD,CAAC;AAAA,CACF","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport { PluginIdSchema, PluginVersionSchema } from \"./manifest-schema.js\";\nimport { validatePluginRelativePath } from \"./manifest.js\";\n\nexport const VETTA_NPM_PACKAGE_SCHEMA_VERSION = 1 as const;\n\nexport const VettaNpmPluginMetadataSchema = Type.Object(\n\t{\n\t\tschemaVersion: Type.Literal(VETTA_NPM_PACKAGE_SCHEMA_VERSION),\n\t\ttype: Type.Literal(\"desktop-plugin\"),\n\t\tpluginId: PluginIdSchema,\n\t\tarchive: Type.String({ minLength: 1 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport type VettaNpmPluginMetadata = Static<typeof VettaNpmPluginMetadataSchema>;\n\nexport interface VettaNpmPluginPackage {\n\tname: string;\n\tversion: string;\n\tvetta: VettaNpmPluginMetadata;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Parse the npm distribution envelope without trusting package-owned metadata. */\nexport function parseVettaNpmPluginPackage(value: unknown): VettaNpmPluginPackage {\n\tif (!isRecord(value)) throw new Error(\"Invalid npm plugin package: package.json must contain an object\");\n\tif (typeof value.name !== \"string\" || value.name.trim().length === 0) {\n\t\tthrow new Error(\"Invalid npm plugin package: name is required\");\n\t}\n\tif (!Value.Check(PluginVersionSchema, value.version)) {\n\t\tthrow new Error(\"Invalid npm plugin package: version must be a semantic version\");\n\t}\n\tif (!Value.Check(VettaNpmPluginMetadataSchema, value.vetta)) {\n\t\tthrow new Error(\"Invalid npm plugin package: package.json#vetta does not match schema version 1\");\n\t}\n\n\tconst metadata = value.vetta as VettaNpmPluginMetadata;\n\treturn {\n\t\tname: value.name.trim(),\n\t\tversion: value.version,\n\t\tvetta: {\n\t\t\t...metadata,\n\t\t\tarchive: validatePluginRelativePath(metadata.archive.trim(), \"npm archive\"),\n\t\t},\n\t};\n}\n"]}
|
package/dist/ocr.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrRequest as DomainOcrRequest, OcrResult } from "@vetta-org/capability-sdk";
|
|
2
|
+
import type { Disposable } from "./disposable.js";
|
|
3
|
+
export type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrResult };
|
|
4
|
+
export type OcrInput = {
|
|
5
|
+
id?: string;
|
|
6
|
+
mimeType?: string;
|
|
7
|
+
source: {
|
|
8
|
+
type: "plugin-blob";
|
|
9
|
+
blobId: string;
|
|
10
|
+
} | {
|
|
11
|
+
type: "workspace-file";
|
|
12
|
+
path: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/** Public consumer request. Ownership and storage namespaces are supplied by the host. */
|
|
16
|
+
export type OcrRequest = Omit<DomainOcrRequest, "ownerId" | "providerId" | "inputs"> & {
|
|
17
|
+
readonly inputs: readonly OcrInput[];
|
|
18
|
+
};
|
|
19
|
+
export type OcrProgress = {
|
|
20
|
+
phase: "queued" | "uploading" | "processing" | "finalizing";
|
|
21
|
+
completed: number;
|
|
22
|
+
total: number;
|
|
23
|
+
itemId?: string;
|
|
24
|
+
};
|
|
25
|
+
export type OcrProviderRequest = Omit<DomainOcrRequest, "ownerId" | "providerId" | "inputs"> & {
|
|
26
|
+
readonly inputs: readonly OcrProviderInput[];
|
|
27
|
+
};
|
|
28
|
+
export type OcrProviderInput = {
|
|
29
|
+
id: string;
|
|
30
|
+
mimeType?: string;
|
|
31
|
+
};
|
|
32
|
+
export type OcrUploadRequest = {
|
|
33
|
+
url: string;
|
|
34
|
+
fieldName: string;
|
|
35
|
+
fileName?: string;
|
|
36
|
+
fields?: Record<string, string>;
|
|
37
|
+
headers?: Record<string, string>;
|
|
38
|
+
timeoutMs?: number;
|
|
39
|
+
};
|
|
40
|
+
export type OcrTransferResponse<T = unknown> = {
|
|
41
|
+
ok: boolean;
|
|
42
|
+
status: number;
|
|
43
|
+
statusText: string;
|
|
44
|
+
headers: Record<string, string>;
|
|
45
|
+
body: T;
|
|
46
|
+
};
|
|
47
|
+
export type OcrProviderContext = {
|
|
48
|
+
readonly signal: AbortSignal;
|
|
49
|
+
readonly invocationId: string;
|
|
50
|
+
getInputUrl(inputId: string): Promise<string>;
|
|
51
|
+
uploadInput<T = unknown>(inputId: string, request: OcrUploadRequest): Promise<OcrTransferResponse<T>>;
|
|
52
|
+
reportProgress(event: OcrProgress): void;
|
|
53
|
+
};
|
|
54
|
+
export type OcrProviderRegistration = {
|
|
55
|
+
readonly id: string;
|
|
56
|
+
readonly displayName: string;
|
|
57
|
+
readonly protocolVersion: 1;
|
|
58
|
+
readonly processing: OcrProviderDescriptor["processing"];
|
|
59
|
+
readonly execution: OcrProviderDescriptor["execution"];
|
|
60
|
+
readonly input: OcrProviderDescriptor["input"];
|
|
61
|
+
readonly output: OcrProviderDescriptor["output"];
|
|
62
|
+
readonly network?: OcrProviderDescriptor["network"];
|
|
63
|
+
readonly configuration?: OcrProviderDescriptor["configuration"];
|
|
64
|
+
recognize(request: OcrProviderRequest, context: OcrProviderContext): Promise<OcrProviderResult>;
|
|
65
|
+
dispose?(): void | Promise<void>;
|
|
66
|
+
};
|
|
67
|
+
export type OcrProviderResult = Omit<OcrResult, "providerId">;
|
|
68
|
+
export type OcrClient = {
|
|
69
|
+
registerProvider(registration: OcrProviderRegistration): Disposable;
|
|
70
|
+
listProviders(): Promise<readonly OcrProviderDescriptor[]>;
|
|
71
|
+
onProvidersChanged(listener: () => void): Disposable;
|
|
72
|
+
recognize(request: OcrRequest, options?: {
|
|
73
|
+
providerId?: string;
|
|
74
|
+
signal?: AbortSignal;
|
|
75
|
+
onProgress?: (event: OcrProgress) => void;
|
|
76
|
+
}): Promise<OcrResult>;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=ocr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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";\nimport type { Disposable } from \"./disposable.js\";\n\nexport type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrResult };\n\nexport type OcrInput = {\n\tid?: string;\n\tmimeType?: string;\n\tsource:\n\t\t| { type: \"plugin-blob\"; blobId: string }\n\t\t| { type: \"workspace-file\"; path: string };\n};\n\n/** Public consumer request. Ownership and storage namespaces are supplied by the host. */\nexport type OcrRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrInput[];\n};\n\nexport type OcrProgress = {\n\tphase: \"queued\" | \"uploading\" | \"processing\" | \"finalizing\";\n\tcompleted: number;\n\ttotal: number;\n\titemId?: string;\n};\n\nexport type OcrProviderRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrProviderInput[];\n};\n\nexport type OcrProviderInput = {\n\tid: string;\n\tmimeType?: string;\n};\n\nexport type OcrUploadRequest = {\n\turl: string;\n\tfieldName: string;\n\tfileName?: string;\n\tfields?: Record<string, string>;\n\theaders?: Record<string, string>;\n\ttimeoutMs?: number;\n};\n\nexport type OcrTransferResponse<T = unknown> = {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n};\n\nexport type OcrProviderContext = {\n\treadonly signal: AbortSignal;\n\treadonly invocationId: string;\n\tgetInputUrl(inputId: string): Promise<string>;\n\tuploadInput<T = unknown>(inputId: string, request: OcrUploadRequest): Promise<OcrTransferResponse<T>>;\n\treportProgress(event: OcrProgress): void;\n};\n\nexport type OcrProviderRegistration = {\n\treadonly id: string;\n\treadonly displayName: string;\n\treadonly protocolVersion: 1;\n\treadonly processing: OcrProviderDescriptor[\"processing\"];\n\treadonly execution: OcrProviderDescriptor[\"execution\"];\n\treadonly input: OcrProviderDescriptor[\"input\"];\n\treadonly output: OcrProviderDescriptor[\"output\"];\n\treadonly network?: OcrProviderDescriptor[\"network\"];\n\treadonly configuration?: OcrProviderDescriptor[\"configuration\"];\n\trecognize(request: OcrProviderRequest, context: OcrProviderContext): Promise<OcrProviderResult>;\n\tdispose?(): void | Promise<void>;\n};\n\nexport type OcrProviderResult = Omit<OcrResult, \"providerId\">;\n\nexport type OcrClient = {\n\tregisterProvider(registration: OcrProviderRegistration): Disposable;\n\tlistProviders(): Promise<readonly OcrProviderDescriptor[]>;\n\tonProvidersChanged(listener: () => void): Disposable;\n\trecognize(request: OcrRequest, options?: {\n\t\tproviderId?: string;\n\t\tsignal?: AbortSignal;\n\t\tonProgress?: (event: OcrProgress) => void;\n\t}): Promise<OcrResult>;\n};\n"]}
|
package/dist/ocr.js
ADDED
package/dist/ocr.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ocr.js","sourceRoot":"","sources":["../src/ocr.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tOcrBlock,\n\tOcrErrorCode,\n\tOcrItemResult,\n\tOcrProviderDescriptor,\n\tOcrRequest as DomainOcrRequest,\n\tOcrResult,\n} from \"@vetta-org/capability-sdk\";\nimport type { Disposable } from \"./disposable.js\";\n\nexport type { OcrBlock, OcrErrorCode, OcrItemResult, OcrProviderDescriptor, OcrResult };\n\nexport type OcrInput = {\n\tid?: string;\n\tmimeType?: string;\n\tsource:\n\t\t| { type: \"plugin-blob\"; blobId: string }\n\t\t| { type: \"workspace-file\"; path: string };\n};\n\n/** Public consumer request. Ownership and storage namespaces are supplied by the host. */\nexport type OcrRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrInput[];\n};\n\nexport type OcrProgress = {\n\tphase: \"queued\" | \"uploading\" | \"processing\" | \"finalizing\";\n\tcompleted: number;\n\ttotal: number;\n\titemId?: string;\n};\n\nexport type OcrProviderRequest = Omit<DomainOcrRequest, \"ownerId\" | \"providerId\" | \"inputs\"> & {\n\treadonly inputs: readonly OcrProviderInput[];\n};\n\nexport type OcrProviderInput = {\n\tid: string;\n\tmimeType?: string;\n};\n\nexport type OcrUploadRequest = {\n\turl: string;\n\tfieldName: string;\n\tfileName?: string;\n\tfields?: Record<string, string>;\n\theaders?: Record<string, string>;\n\ttimeoutMs?: number;\n};\n\nexport type OcrTransferResponse<T = unknown> = {\n\tok: boolean;\n\tstatus: number;\n\tstatusText: string;\n\theaders: Record<string, string>;\n\tbody: T;\n};\n\nexport type OcrProviderContext = {\n\treadonly signal: AbortSignal;\n\treadonly invocationId: string;\n\tgetInputUrl(inputId: string): Promise<string>;\n\tuploadInput<T = unknown>(inputId: string, request: OcrUploadRequest): Promise<OcrTransferResponse<T>>;\n\treportProgress(event: OcrProgress): void;\n};\n\nexport type OcrProviderRegistration = {\n\treadonly id: string;\n\treadonly displayName: string;\n\treadonly protocolVersion: 1;\n\treadonly processing: OcrProviderDescriptor[\"processing\"];\n\treadonly execution: OcrProviderDescriptor[\"execution\"];\n\treadonly input: OcrProviderDescriptor[\"input\"];\n\treadonly output: OcrProviderDescriptor[\"output\"];\n\treadonly network?: OcrProviderDescriptor[\"network\"];\n\treadonly configuration?: OcrProviderDescriptor[\"configuration\"];\n\trecognize(request: OcrProviderRequest, context: OcrProviderContext): Promise<OcrProviderResult>;\n\tdispose?(): void | Promise<void>;\n};\n\nexport type OcrProviderResult = Omit<OcrResult, \"providerId\">;\n\nexport type OcrClient = {\n\tregisterProvider(registration: OcrProviderRegistration): Disposable;\n\tlistProviders(): Promise<readonly OcrProviderDescriptor[]>;\n\tonProvidersChanged(listener: () => void): Disposable;\n\trecognize(request: OcrRequest, options?: {\n\t\tproviderId?: string;\n\t\tsignal?: AbortSignal;\n\t\tonProgress?: (event: OcrProgress) => void;\n\t}): Promise<OcrResult>;\n};\n"]}
|