ponch-mcp-server 1.0.96 → 1.0.98

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.js CHANGED
@@ -12578,14 +12578,19 @@ Luego llama execute_photo_edit con tu analisis y prompt.`,
12578
12578
  async ({ fotoId, brandId: inputBrandId }) => {
12579
12579
  const tenantId = session.requireTenant();
12580
12580
  const brandId = inputBrandId ?? session.requireBrand();
12581
- const lang = await resolveTenantLanguage(tenantId);
12582
12581
  const ctx = await buildContext(session, brandId);
12583
12582
  const dispatchResult = await dispatchWithContract({
12584
12583
  contract: photoDirectorPlanContract,
12585
- helper: (input) => photoDirectorPlan({
12584
+ // `lang` se resuelve DENTRO del closure helper: dispatchWithContract
12585
+ // solo invoca `helper` en Modo A (admin SDK disponible); en Modo B
12586
+ // corre el `callable` (CF), cuyo runtime resuelve idioma server-side.
12587
+ // resolveTenantLanguage usa firebase-admin getFirestore(), que en el
12588
+ // proceso MCP Modo B (Client SDK, sin initializeApp) NO tiene default
12589
+ // app y lanzaba "The default Firebase app does not exist".
12590
+ helper: async (input) => photoDirectorPlan({
12586
12591
  ...input,
12587
12592
  deps: { compressImageForTransport },
12588
- lang
12593
+ lang: await resolveTenantLanguage(tenantId)
12589
12594
  }),
12590
12595
  callable: callPhotoDirectorPlan,
12591
12596
  input: { tenantId, brandId, fotoId },
@@ -12620,7 +12625,9 @@ Retorna la foto editada para que la revises. Si no te gusta:
12620
12625
  - Llama de nuevo con prompt ajustado
12621
12626
  - Maximo 3 iteraciones por foto
12622
12627
 
12623
- Si estrategia era 'tal_cual', pasa acciones=['none'] \u2014 no se edita pero si se genera thumbnail y embedding con tus tags.`,
12628
+ Si estrategia era 'tal_cual', pasa acciones=['none'] \u2014 no se edita pero si se genera thumbnail y embedding con tus tags.
12629
+
12630
+ Consume creditos: la primera llamada retorna state=pending_confirmation; pasa confirm=true en la segunda llamada para ejecutar la edicion.`,
12624
12631
  {
12625
12632
  fotoId: import_zod63.z.string(),
12626
12633
  brandId: import_zod63.z.string().optional().describe("Brand identifier (defaults to session brand)"),
@@ -12630,12 +12637,12 @@ Si estrategia era 'tal_cual', pasa acciones=['none'] \u2014 no se edita pero si
12630
12637
  tipo: import_zod63.z.string().nullable().describe("Tipo del catalogoVisual del tenant"),
12631
12638
  tagsPrimarios: import_zod63.z.array(import_zod63.z.string()),
12632
12639
  tagsSecundarios: import_zod63.z.array(import_zod63.z.string()),
12633
- tagsContexto: import_zod63.z.array(import_zod63.z.string())
12640
+ tagsContexto: import_zod63.z.array(import_zod63.z.string()),
12641
+ confirm: import_zod63.z.boolean().optional().describe("Set to true on the re-invocation after the user confirms. Default false. First call returns state=pending_confirmation (consumes credits).")
12634
12642
  },
12635
- async ({ fotoId, brandId: inputBrandId, prompt, acciones, descripcion, tipo, tagsPrimarios, tagsSecundarios, tagsContexto }) => {
12643
+ async ({ fotoId, brandId: inputBrandId, prompt, acciones, descripcion, tipo, tagsPrimarios, tagsSecundarios, tagsContexto, confirm }) => {
12636
12644
  const tenantId = session.requireTenant();
12637
12645
  const brandId = inputBrandId ?? session.requireBrand();
12638
- const lang = await resolveTenantLanguage(tenantId);
12639
12646
  const executePhotoEditAdapter = async (payload) => {
12640
12647
  const cfUrl = process.env.MARKETING_PHOTO_EDIT_CF_URL || "https://us-central1-atteyo-ops.cloudfunctions.net/marketingExecutePhotoEdit";
12641
12648
  const { GoogleAuth: GoogleAuth2 } = await import("google-auth-library");
@@ -12649,13 +12656,17 @@ Si estrategia era 'tal_cual', pasa acciones=['none'] \u2014 no se edita pero si
12649
12656
  });
12650
12657
  return response.data ?? {};
12651
12658
  };
12652
- const ctx = await buildContext(session, brandId);
12659
+ const ctx = await buildContext(session, brandId, { confirmationGranted: confirm === true });
12653
12660
  const dispatchResult = await dispatchWithContract({
12654
12661
  contract: photoDirectorExecuteContract,
12655
- helper: (input) => photoDirectorExecute({
12662
+ // `lang` resuelto DENTRO del closure helper (solo corre en Modo A).
12663
+ // Ver nota en plan_photo_edit: en Modo B corre el callable (CF) y
12664
+ // resolveTenantLanguage (firebase-admin) no tiene default app en el
12665
+ // proceso MCP Client SDK.
12666
+ helper: async (input) => photoDirectorExecute({
12656
12667
  ...input,
12657
12668
  deps: { compressImageForTransport, executePhotoEdit: executePhotoEditAdapter },
12658
- lang
12669
+ lang: await resolveTenantLanguage(tenantId)
12659
12670
  }),
12660
12671
  callable: callPhotoDirectorExecute,
12661
12672
  // Refactor 7.2: tenantId+brandId requeridos en input para path