@uploadista/flow-images-replicate 0.0.20-beta.7 → 0.0.20-beta.8
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/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/image-ai-plugin.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@uploadista/core/errors`),l=require(`@uploadista/core/flow`),u=require(`@uploadista/observability`),d=require(`effect`),f=require(`replicate`);f=s(f);const p=(e,t)=>{let n=typeof e==`string`,r=n?e:null,i=n?null:e.credentialProvider,a=n?!1:e.useCredentialProviderService,o=(n?t?.removeBackgroundModelId:e.removeBackgroundModelId)||`lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1`,s=(n?t?.describeImageModelId:e.describeImageModelId)||`zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1`,p=e=>r?d.Effect.succeed(r):a?d.Effect.gen(function*(){let t=yield*d.Effect.serviceOption(l.CredentialProvider);if(d.Option.isNone(t))return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Credential provider service not found`)}));{let n=yield*t.value.getCredential({clientId:e.clientId,serviceType:`replicate`});if(typeof n==`object`&&n&&`apiKey`in n&&typeof n.apiKey==`string`)return n.apiKey}return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Invalid credential format from service`)}))}):i?d.Effect.gen(function*(){return(yield*i({...e,serviceType:`replicate`})).apiKey}):d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`No API credentials configured`)}));return d.Layer.succeed(l.ImageAiPlugin,l.ImageAiPlugin.of({removeBackground:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{outputUrl:(yield*d.Effect.tryPromise({try:async()=>{let t=new f.default({auth:n}),r={image:e};return console.log(`input`,r),await t.run(o,{input:r})},catch:e=>(console.log(`error`,e),c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e}))})).url()}}).pipe((0,u.withOperationSpan)(`ai`,`remove-background`,{"ai.provider":`replicate`,"ai.model":o,"ai.
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@uploadista/core/errors`),l=require(`@uploadista/core/flow`),u=require(`@uploadista/observability`),d=require(`effect`),f=require(`replicate`);f=s(f);const p=(e,t)=>{let n=typeof e==`string`,r=n?e:null,i=n?null:e.credentialProvider,a=n?!1:e.useCredentialProviderService,o=(n?t?.removeBackgroundModelId:e.removeBackgroundModelId)||`lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1`,s=(n?t?.describeImageModelId:e.describeImageModelId)||`zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1`,p=e=>r?d.Effect.succeed(r):a?d.Effect.gen(function*(){let t=yield*d.Effect.serviceOption(l.CredentialProvider);if(d.Option.isNone(t))return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Credential provider service not found`)}));{let n=yield*t.value.getCredential({clientId:e.clientId,serviceType:`replicate`});if(typeof n==`object`&&n&&`apiKey`in n&&typeof n.apiKey==`string`)return n.apiKey}return yield*d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Invalid credential format from service`)}))}):i?d.Effect.gen(function*(){return(yield*i({...e,serviceType:`replicate`})).apiKey}):d.Effect.fail(c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:Error(`No API credentials configured`)}));return d.Layer.succeed(l.ImageAiPlugin,l.ImageAiPlugin.of({removeBackground:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{outputUrl:(yield*d.Effect.tryPromise({try:async()=>{let t=new f.default({auth:n}),r={image:e};return console.log(`input`,r),await t.run(o,{input:r})},catch:e=>(console.log(`error`,e),c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e}))})).url()}}).pipe((0,u.withOperationSpan)(`ai`,`remove-background`,{"ai.provider":`replicate`,"ai.model":o,"ai.client_id":t.clientId})),describeImage:(e,t)=>d.Effect.gen(function*(){let n=yield*p(t);return{description:yield*d.Effect.tryPromise({try:async()=>await new f.default({auth:n}).run(s,{input:{image:e,top_k:50,top_p:1,caption:!1,question:`What is shown in the image?`,do_sample:!1,num_beams:1,temperature:1,system_prompt:`A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.`,length_penalty:1,max_new_tokens:768,repetition_penalty:1}}),catch:e=>c.UploadistaError.fromCode(`UNKNOWN_ERROR`,{cause:e})})}}).pipe((0,u.withOperationSpan)(`ai`,`describe-image`,{"ai.provider":`replicate`,"ai.model":s,"ai.client_id":t.clientId}))}))};exports.imageAiPlugin=p;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{UploadistaError as e}from"@uploadista/core/errors";import{CredentialProvider as t,ImageAiPlugin as n}from"@uploadista/core/flow";import{withOperationSpan as r}from"@uploadista/observability";import{Effect as i,Layer as a,Option as o}from"effect";import s from"replicate";const c=(c,l)=>{let u=typeof c==`string`,d=u?c:null,f=u?null:c.credentialProvider,p=u?!1:c.useCredentialProviderService,m=(u?l?.removeBackgroundModelId:c.removeBackgroundModelId)||`lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1`,h=(u?l?.describeImageModelId:c.describeImageModelId)||`zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1`,g=n=>d?i.succeed(d):p?i.gen(function*(){let r=yield*i.serviceOption(t);if(o.isNone(r))return yield*i.fail(e.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Credential provider service not found`)}));{let e=yield*r.value.getCredential({clientId:n.clientId,serviceType:`replicate`});if(typeof e==`object`&&e&&`apiKey`in e&&typeof e.apiKey==`string`)return e.apiKey}return yield*i.fail(e.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Invalid credential format from service`)}))}):f?i.gen(function*(){return(yield*f({...n,serviceType:`replicate`})).apiKey}):i.fail(e.fromCode(`UNKNOWN_ERROR`,{cause:Error(`No API credentials configured`)}));return a.succeed(n,n.of({removeBackground:(t,n)=>i.gen(function*(){let r=yield*g(n);return{outputUrl:(yield*i.tryPromise({try:async()=>{let e=new s({auth:r}),n={image:t};return console.log(`input`,n),await e.run(m,{input:n})},catch:t=>(console.log(`error`,t),e.fromCode(`UNKNOWN_ERROR`,{cause:t}))})).url()}}).pipe(r(`ai`,`remove-background`,{"ai.provider":`replicate`,"ai.model":m,"ai.
|
|
1
|
+
import{UploadistaError as e}from"@uploadista/core/errors";import{CredentialProvider as t,ImageAiPlugin as n}from"@uploadista/core/flow";import{withOperationSpan as r}from"@uploadista/observability";import{Effect as i,Layer as a,Option as o}from"effect";import s from"replicate";const c=(c,l)=>{let u=typeof c==`string`,d=u?c:null,f=u?null:c.credentialProvider,p=u?!1:c.useCredentialProviderService,m=(u?l?.removeBackgroundModelId:c.removeBackgroundModelId)||`lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1`,h=(u?l?.describeImageModelId:c.describeImageModelId)||`zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1`,g=n=>d?i.succeed(d):p?i.gen(function*(){let r=yield*i.serviceOption(t);if(o.isNone(r))return yield*i.fail(e.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Credential provider service not found`)}));{let e=yield*r.value.getCredential({clientId:n.clientId,serviceType:`replicate`});if(typeof e==`object`&&e&&`apiKey`in e&&typeof e.apiKey==`string`)return e.apiKey}return yield*i.fail(e.fromCode(`UNKNOWN_ERROR`,{cause:Error(`Invalid credential format from service`)}))}):f?i.gen(function*(){return(yield*f({...n,serviceType:`replicate`})).apiKey}):i.fail(e.fromCode(`UNKNOWN_ERROR`,{cause:Error(`No API credentials configured`)}));return a.succeed(n,n.of({removeBackground:(t,n)=>i.gen(function*(){let r=yield*g(n);return{outputUrl:(yield*i.tryPromise({try:async()=>{let e=new s({auth:r}),n={image:t};return console.log(`input`,n),await e.run(m,{input:n})},catch:t=>(console.log(`error`,t),e.fromCode(`UNKNOWN_ERROR`,{cause:t}))})).url()}}).pipe(r(`ai`,`remove-background`,{"ai.provider":`replicate`,"ai.model":m,"ai.client_id":n.clientId})),describeImage:(t,n)=>i.gen(function*(){let r=yield*g(n);return{description:yield*i.tryPromise({try:async()=>await new s({auth:r}).run(h,{input:{image:t,top_k:50,top_p:1,caption:!1,question:`What is shown in the image?`,do_sample:!1,num_beams:1,temperature:1,system_prompt:`A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.`,length_penalty:1,max_new_tokens:768,repetition_penalty:1}}),catch:t=>e.fromCode(`UNKNOWN_ERROR`,{cause:t})})}}).pipe(r(`ai`,`describe-image`,{"ai.provider":`replicate`,"ai.model":h,"ai.client_id":n.clientId}))}))};export{c as imageAiPlugin};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["CredentialProviderService"],"sources":["../src/image-ai-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n CredentialProvider as CredentialProviderService,\n type ImageAiContext,\n ImageAiPlugin,\n} from \"@uploadista/core/flow\";\nimport { withOperationSpan } from \"@uploadista/observability\";\nimport { Effect, Layer, Option } from \"effect\";\nimport Replicate from \"replicate\";\n\ntype ModelId = `${string}/${string}` | `${string}/${string}:${string}`;\n\ntype RemoveBackgroundOutput = {\n url: () => string;\n};\n\ntype ReplicateCredentials = {\n apiKey: string;\n};\n\n// Credential provider function type\ntype CredentialProvider = (\n context: ImageAiContext & { serviceType: \"replicate\" },\n) => Effect.Effect<ReplicateCredentials, UploadistaError>;\n\n// Plugin configuration can be either a static API key or options with credential provider or service\ntype PluginConfig =\n | string\n | {\n credentialProvider?: CredentialProvider;\n useCredentialProviderService?: boolean;\n removeBackgroundModelId?: ModelId;\n describeImageModelId?: ModelId;\n };\n\n/**\n * Create the Replicate ImageAI plugin\n * Supports both static credentials (OSS) and dynamic credential providers (UploadistaCloud)\n *\n * @example\n * // Static credentials (OSS)\n * imageAiPlugin(process.env.REPLICATE_API_TOKEN)\n *\n * @example\n * // Dynamic credentials with function (UploadistaCloud)\n * imageAiPlugin({\n * credentialProvider: (context) => Effect.succeed({ apiKey: \"...\" })\n * })\n *\n * @example\n * // Dynamic credentials with Effect service (UploadistaCloud)\n * imageAiPlugin({\n * useCredentialProviderService: true\n * })\n */\nexport const imageAiPlugin = (\n config: PluginConfig,\n options?: {\n removeBackgroundModelId?: ModelId;\n describeImageModelId?: ModelId;\n },\n) => {\n // Parse configuration\n const isStatic = typeof config === \"string\";\n const staticApiKey = isStatic ? config : null;\n const credentialProvider = isStatic ? null : config.credentialProvider;\n const useCredentialProviderService = isStatic\n ? false\n : config.useCredentialProviderService;\n\n // Model IDs can come from either the config object or the options parameter\n const removeBackgroundModelId =\n (isStatic\n ? options?.removeBackgroundModelId\n : config.removeBackgroundModelId) ||\n \"lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1\";\n const describeImageModelId =\n (isStatic ? options?.describeImageModelId : config.describeImageModelId) ||\n \"zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1\";\n\n // Helper to get API token (either static, from provider function, or from service)\n const getApiToken = (context: ImageAiContext) => {\n if (staticApiKey) {\n return Effect.succeed(staticApiKey);\n }\n if (useCredentialProviderService) {\n return Effect.gen(function* () {\n const credentialProviderService = yield* Effect.serviceOption(\n CredentialProviderService,\n );\n\n if (Option.isNone(credentialProviderService)) {\n return yield* Effect.fail(\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: new Error(\"Credential provider service not found\"),\n }),\n );\n } else {\n const credentials =\n yield* credentialProviderService.value.getCredential({\n clientId: context.clientId,\n serviceType: \"replicate\",\n });\n\n if (\n typeof credentials === \"object\" &&\n credentials !== null &&\n \"apiKey\" in credentials &&\n typeof credentials.apiKey === \"string\"\n ) {\n return credentials.apiKey;\n }\n }\n\n return yield* Effect.fail(\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: new Error(\"Invalid credential format from service\"),\n }),\n );\n });\n }\n if (credentialProvider) {\n return Effect.gen(function* () {\n const credentials = yield* credentialProvider({\n ...context,\n serviceType: \"replicate\",\n });\n return credentials.apiKey;\n });\n }\n return Effect.fail(\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: new Error(\"No API credentials configured\"),\n }),\n );\n };\n\n return Layer.succeed(\n ImageAiPlugin,\n ImageAiPlugin.of({\n removeBackground: (inputUrl, context) => {\n return Effect.gen(function* () {\n // Get API token (static or from credential provider)\n const apiToken = yield* getApiToken(context);\n\n const output = yield* Effect.tryPromise({\n try: async () => {\n const replicate = new Replicate({\n auth: apiToken,\n });\n\n const input = {\n image: inputUrl,\n };\n\n console.log(\"input\", input);\n\n return (await replicate.run(removeBackgroundModelId, {\n input,\n })) as RemoveBackgroundOutput;\n },\n catch: (error) => {\n console.log(\"error\", error);\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n return { outputUrl: output.url() };\n }).pipe(\n withOperationSpan(\"ai\", \"remove-background\", {\n \"ai.provider\": \"replicate\",\n \"ai.model\": removeBackgroundModelId,\n \"ai.
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["CredentialProviderService"],"sources":["../src/image-ai-plugin.ts"],"sourcesContent":["import { UploadistaError } from \"@uploadista/core/errors\";\nimport {\n CredentialProvider as CredentialProviderService,\n type ImageAiContext,\n ImageAiPlugin,\n} from \"@uploadista/core/flow\";\nimport { withOperationSpan } from \"@uploadista/observability\";\nimport { Effect, Layer, Option } from \"effect\";\nimport Replicate from \"replicate\";\n\ntype ModelId = `${string}/${string}` | `${string}/${string}:${string}`;\n\ntype RemoveBackgroundOutput = {\n url: () => string;\n};\n\ntype ReplicateCredentials = {\n apiKey: string;\n};\n\n// Credential provider function type\ntype CredentialProvider = (\n context: ImageAiContext & { serviceType: \"replicate\" },\n) => Effect.Effect<ReplicateCredentials, UploadistaError>;\n\n// Plugin configuration can be either a static API key or options with credential provider or service\ntype PluginConfig =\n | string\n | {\n credentialProvider?: CredentialProvider;\n useCredentialProviderService?: boolean;\n removeBackgroundModelId?: ModelId;\n describeImageModelId?: ModelId;\n };\n\n/**\n * Create the Replicate ImageAI plugin\n * Supports both static credentials (OSS) and dynamic credential providers (UploadistaCloud)\n *\n * @example\n * // Static credentials (OSS)\n * imageAiPlugin(process.env.REPLICATE_API_TOKEN)\n *\n * @example\n * // Dynamic credentials with function (UploadistaCloud)\n * imageAiPlugin({\n * credentialProvider: (context) => Effect.succeed({ apiKey: \"...\" })\n * })\n *\n * @example\n * // Dynamic credentials with Effect service (UploadistaCloud)\n * imageAiPlugin({\n * useCredentialProviderService: true\n * })\n */\nexport const imageAiPlugin = (\n config: PluginConfig,\n options?: {\n removeBackgroundModelId?: ModelId;\n describeImageModelId?: ModelId;\n },\n) => {\n // Parse configuration\n const isStatic = typeof config === \"string\";\n const staticApiKey = isStatic ? config : null;\n const credentialProvider = isStatic ? null : config.credentialProvider;\n const useCredentialProviderService = isStatic\n ? false\n : config.useCredentialProviderService;\n\n // Model IDs can come from either the config object or the options parameter\n const removeBackgroundModelId =\n (isStatic\n ? options?.removeBackgroundModelId\n : config.removeBackgroundModelId) ||\n \"lucataco/remove-bg:95fcc2a26d3899cd6c2691c900465aaeff466285a65c14638cc5f36f34befaf1\";\n const describeImageModelId =\n (isStatic ? options?.describeImageModelId : config.describeImageModelId) ||\n \"zsxkib/blip-3:499bec581d8f64060fd695ec0c34d7595c6824c4118259aa8b0788e0d2d903e1\";\n\n // Helper to get API token (either static, from provider function, or from service)\n const getApiToken = (context: ImageAiContext) => {\n if (staticApiKey) {\n return Effect.succeed(staticApiKey);\n }\n if (useCredentialProviderService) {\n return Effect.gen(function* () {\n const credentialProviderService = yield* Effect.serviceOption(\n CredentialProviderService,\n );\n\n if (Option.isNone(credentialProviderService)) {\n return yield* Effect.fail(\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: new Error(\"Credential provider service not found\"),\n }),\n );\n } else {\n const credentials =\n yield* credentialProviderService.value.getCredential({\n clientId: context.clientId,\n serviceType: \"replicate\",\n });\n\n if (\n typeof credentials === \"object\" &&\n credentials !== null &&\n \"apiKey\" in credentials &&\n typeof credentials.apiKey === \"string\"\n ) {\n return credentials.apiKey;\n }\n }\n\n return yield* Effect.fail(\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: new Error(\"Invalid credential format from service\"),\n }),\n );\n });\n }\n if (credentialProvider) {\n return Effect.gen(function* () {\n const credentials = yield* credentialProvider({\n ...context,\n serviceType: \"replicate\",\n });\n return credentials.apiKey;\n });\n }\n return Effect.fail(\n UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: new Error(\"No API credentials configured\"),\n }),\n );\n };\n\n return Layer.succeed(\n ImageAiPlugin,\n ImageAiPlugin.of({\n removeBackground: (inputUrl, context) => {\n return Effect.gen(function* () {\n // Get API token (static or from credential provider)\n const apiToken = yield* getApiToken(context);\n\n const output = yield* Effect.tryPromise({\n try: async () => {\n const replicate = new Replicate({\n auth: apiToken,\n });\n\n const input = {\n image: inputUrl,\n };\n\n console.log(\"input\", input);\n\n return (await replicate.run(removeBackgroundModelId, {\n input,\n })) as RemoveBackgroundOutput;\n },\n catch: (error) => {\n console.log(\"error\", error);\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n return { outputUrl: output.url() };\n }).pipe(\n withOperationSpan(\"ai\", \"remove-background\", {\n \"ai.provider\": \"replicate\",\n \"ai.model\": removeBackgroundModelId,\n \"ai.client_id\": context.clientId,\n }),\n );\n },\n describeImage: (inputUrl, context) => {\n return Effect.gen(function* () {\n // Get API token (static or from credential provider)\n const apiToken = yield* getApiToken(context);\n\n const output = yield* Effect.tryPromise({\n try: async () => {\n const replicate = new Replicate({\n auth: apiToken,\n });\n\n return (await replicate.run(describeImageModelId, {\n input: {\n image: inputUrl,\n top_k: 50,\n top_p: 1,\n caption: false,\n question: \"What is shown in the image?\",\n do_sample: false,\n num_beams: 1,\n temperature: 1,\n system_prompt:\n \"A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.\",\n length_penalty: 1,\n max_new_tokens: 768,\n repetition_penalty: 1,\n },\n })) as unknown as string;\n },\n catch: (error) => {\n return UploadistaError.fromCode(\"UNKNOWN_ERROR\", {\n cause: error,\n });\n },\n });\n return { description: output };\n }).pipe(\n withOperationSpan(\"ai\", \"describe-image\", {\n \"ai.provider\": \"replicate\",\n \"ai.model\": describeImageModelId,\n \"ai.client_id\": context.clientId,\n }),\n );\n },\n }),\n );\n};\n"],"mappings":"sRAuDA,MAAa,GACX,EACA,IAIG,CAEH,IAAM,EAAW,OAAO,GAAW,SAC7B,EAAe,EAAW,EAAS,KACnC,EAAqB,EAAW,KAAO,EAAO,mBAC9C,EAA+B,EACjC,GACA,EAAO,6BAGL,GACH,EACG,GAAS,wBACT,EAAO,0BACX,sFACI,GACH,EAAW,GAAS,qBAAuB,EAAO,uBACnD,iFAGI,EAAe,GACf,EACK,EAAO,QAAQ,EAAa,CAEjC,EACK,EAAO,IAAI,WAAa,CAC7B,IAAM,EAA4B,MAAO,EAAO,cAC9CA,EACD,CAED,GAAI,EAAO,OAAO,EAA0B,CAC1C,OAAO,MAAO,EAAO,KACnB,EAAgB,SAAS,gBAAiB,CACxC,MAAW,MAAM,wCAAwC,CAC1D,CAAC,CACH,CACI,CACL,IAAM,EACJ,MAAO,EAA0B,MAAM,cAAc,CACnD,SAAU,EAAQ,SAClB,YAAa,YACd,CAAC,CAEJ,GACE,OAAO,GAAgB,UACvB,GACA,WAAY,GACZ,OAAO,EAAY,QAAW,SAE9B,OAAO,EAAY,OAIvB,OAAO,MAAO,EAAO,KACnB,EAAgB,SAAS,gBAAiB,CACxC,MAAW,MAAM,yCAAyC,CAC3D,CAAC,CACH,EACD,CAEA,EACK,EAAO,IAAI,WAAa,CAK7B,OAJoB,MAAO,EAAmB,CAC5C,GAAG,EACH,YAAa,YACd,CAAC,EACiB,QACnB,CAEG,EAAO,KACZ,EAAgB,SAAS,gBAAiB,CACxC,MAAW,MAAM,gCAAgC,CAClD,CAAC,CACH,CAGH,OAAO,EAAM,QACX,EACA,EAAc,GAAG,CACf,kBAAmB,EAAU,IACpB,EAAO,IAAI,WAAa,CAE7B,IAAM,EAAW,MAAO,EAAY,EAAQ,CAyB5C,MAAO,CAAE,WAvBM,MAAO,EAAO,WAAW,CACtC,IAAK,SAAY,CACf,IAAM,EAAY,IAAI,EAAU,CAC9B,KAAM,EACP,CAAC,CAEI,EAAQ,CACZ,MAAO,EACR,CAID,OAFA,QAAQ,IAAI,QAAS,EAAM,CAEnB,MAAM,EAAU,IAAI,EAAyB,CACnD,QACD,CAAC,EAEJ,MAAQ,IACN,QAAQ,IAAI,QAAS,EAAM,CACpB,EAAgB,SAAS,gBAAiB,CAC/C,MAAO,EACR,CAAC,EAEL,CAAC,EACyB,KAAK,CAAE,EAClC,CAAC,KACD,EAAkB,KAAM,oBAAqB,CAC3C,cAAe,YACf,WAAY,EACZ,eAAgB,EAAQ,SACzB,CAAC,CACH,CAEH,eAAgB,EAAU,IACjB,EAAO,IAAI,WAAa,CAE7B,IAAM,EAAW,MAAO,EAAY,EAAQ,CAgC5C,MAAO,CAAE,YA9BM,MAAO,EAAO,WAAW,CACtC,IAAK,SAKK,MAJU,IAAI,EAAU,CAC9B,KAAM,EACP,CAAC,CAEsB,IAAI,EAAsB,CAChD,MAAO,CACL,MAAO,EACP,MAAO,GACP,MAAO,EACP,QAAS,GACT,SAAU,8BACV,UAAW,GACX,UAAW,EACX,YAAa,EACb,cACE,6JACF,eAAgB,EAChB,eAAgB,IAChB,mBAAoB,EACrB,CACF,CAAC,CAEJ,MAAQ,GACC,EAAgB,SAAS,gBAAiB,CAC/C,MAAO,EACR,CAAC,CAEL,CAAC,CAC4B,EAC9B,CAAC,KACD,EAAkB,KAAM,iBAAkB,CACxC,cAAe,YACf,WAAY,EACZ,eAAgB,EAAQ,SACzB,CAAC,CACH,CAEJ,CAAC,CACH"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uploadista/flow-images-replicate",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.20-beta.
|
|
4
|
+
"version": "0.0.20-beta.8",
|
|
5
5
|
"description": "Replicate image AI processing service for Uploadista Flow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Uploadista",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"replicate": "1.4.0",
|
|
18
|
-
"@uploadista/core": "0.0.20-beta.
|
|
19
|
-
"@uploadista/observability": "0.0.20-beta.
|
|
18
|
+
"@uploadista/core": "0.0.20-beta.8",
|
|
19
|
+
"@uploadista/observability": "0.0.20-beta.8"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"effect": "^3.0.0",
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@effect/vitest": "0.27.0",
|
|
27
|
-
"@types/node": "24.10.
|
|
28
|
-
"effect": "3.19.
|
|
29
|
-
"tsdown": "0.
|
|
27
|
+
"@types/node": "24.10.4",
|
|
28
|
+
"effect": "3.19.12",
|
|
29
|
+
"tsdown": "0.18.0",
|
|
30
30
|
"vitest": "4.0.15",
|
|
31
|
-
"zod": "4.
|
|
32
|
-
"@uploadista/typescript-config": "0.0.20-beta.
|
|
31
|
+
"zod": "4.2.0",
|
|
32
|
+
"@uploadista/typescript-config": "0.0.20-beta.8"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsdown",
|
|
35
|
+
"build": "tsc --noEmit && tsdown",
|
|
36
36
|
"format": "biome format --write ./src",
|
|
37
37
|
"lint": "biome lint --write ./src",
|
|
38
38
|
"check": "biome check --write ./src",
|
package/src/image-ai-plugin.ts
CHANGED
|
@@ -171,7 +171,7 @@ export const imageAiPlugin = (
|
|
|
171
171
|
withOperationSpan("ai", "remove-background", {
|
|
172
172
|
"ai.provider": "replicate",
|
|
173
173
|
"ai.model": removeBackgroundModelId,
|
|
174
|
-
"ai.
|
|
174
|
+
"ai.client_id": context.clientId,
|
|
175
175
|
}),
|
|
176
176
|
);
|
|
177
177
|
},
|
|
@@ -215,7 +215,7 @@ export const imageAiPlugin = (
|
|
|
215
215
|
withOperationSpan("ai", "describe-image", {
|
|
216
216
|
"ai.provider": "replicate",
|
|
217
217
|
"ai.model": describeImageModelId,
|
|
218
|
-
"ai.
|
|
218
|
+
"ai.client_id": context.clientId,
|
|
219
219
|
}),
|
|
220
220
|
);
|
|
221
221
|
},
|