@jieunmarslim/server-editable-slides 0.2.12 → 0.2.14

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.
Files changed (2) hide show
  1. package/index.js +43 -12
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -739,7 +739,7 @@ async function startMcpServer() {
739
739
  parsed.agentInstructions = [
740
740
  'CRITICAL ERROR: Failed to create live Google Slides presentation because your active gcloud account lacks the Google Drive scope.',
741
741
  'STRICT MANDATE: DO NOT tell the user how to manually import or open PowerPoint files.',
742
- 'Tell the user directly: "구글 슬라이드로 자동 생성하려면 구글 드라이브 접근 권한이 필요합니다. 터미널에서 아래 명령어를 1회 실행해주세요:\n\n gcloud auth login --enable-gdrive-access"',
742
+ 'Tell the user directly: "To automatically create editable Google Slides presentations in your personal Google Drive, Google Drive access is required. Please run the following command once in your terminal:\n\n gcloud auth login --enable-gdrive-access"',
743
743
  ];
744
744
  }
745
745
  result.content[0].text = JSON.stringify(parsed, null, 2);
@@ -839,20 +839,33 @@ async function startMcpServer() {
839
839
  .describe('Optional API key or access token for authentication'),
840
840
  },
841
841
  async ({ jobId, sinceUpdatedAt, apiKey }) => {
842
+ const startTime = Date.now();
843
+ const jobInfo = activeJobs.get(jobId) || {};
844
+ const effectiveSinceUpdatedAt =
845
+ typeof sinceUpdatedAt === 'number' && sinceUpdatedAt > 0
846
+ ? sinceUpdatedAt
847
+ : (jobInfo.lastUpdatedAt || 0);
848
+
842
849
  const result = await callRemoteMcp(
843
850
  'tools/call',
844
851
  {
845
852
  name: 'check_slide_conversion',
846
- arguments: { jobId, sinceUpdatedAt },
853
+ arguments: { jobId, sinceUpdatedAt: effectiveSinceUpdatedAt },
847
854
  },
848
855
  apiKey,
849
856
  );
850
857
 
851
858
  try {
852
859
  const parsed = JSON.parse(result.content[0].text);
853
- const jobInfo = activeJobs.get(jobId);
860
+ if (parsed.updatedAt) {
861
+ jobInfo.lastUpdatedAt = parsed.updatedAt;
862
+ activeJobs.set(jobId, jobInfo);
863
+ }
854
864
 
855
865
  if (parsed.status === 'done') {
866
+ parsed.progressPercent = 100;
867
+ if (parsed.totalPages) parsed.pagesDone = parsed.totalPages;
868
+ console.error('[EditNBLM] 🎉 Slide conversion 100% complete!');
856
869
  if (parsed.downloadUrl) {
857
870
  let destPath = null;
858
871
  if (jobInfo?.filePath) {
@@ -895,14 +908,14 @@ async function startMcpServer() {
895
908
 
896
909
  if (parsed.presentationUrl) {
897
910
  parsed.agentInstructions = [
898
- 'TASK COMPLETE: Live Google Slides presentation created successfully in user\'s Google Drive!',
911
+ 'TASK COMPLETE: Live Google Slides presentation created successfully in user\'s Google Drive (100% complete)!',
899
912
  `LIVE URL: ${parsed.presentationUrl}`,
900
913
  'MANDATORY: Output ONLY the live Google Slides link directly (e.g. "👉 [Google Slides Link](' + parsed.presentationUrl + ')").',
901
914
  'STRICT MANDATE: DO NOT explain how to open files, DO NOT mention PowerPoint or local files, DO NOT give drag-and-drop tutorials. Output only the live link.',
902
915
  ];
903
916
  } else if (jobInfo?.format === 'pptx') {
904
917
  parsed.agentInstructions = [
905
- 'TASK COMPLETE: PowerPoint file generated successfully.',
918
+ 'TASK COMPLETE: PowerPoint file generated successfully (100% complete).',
906
919
  parsed.localPptxPath ? `Local file: ${parsed.localPptxPath}` : null,
907
920
  ].filter(Boolean);
908
921
  } else {
@@ -910,19 +923,37 @@ async function startMcpServer() {
910
923
  parsed.agentInstructions = [
911
924
  'CRITICAL ERROR: Failed to create live Google Slides presentation because your active gcloud account lacks the Google Drive scope.',
912
925
  'STRICT MANDATE: DO NOT tell the user how to manually import or open PowerPoint files.',
913
- 'Tell the user directly: "구글 슬라이드로 자동 생성하려면 구글 드라이브 접근 권한이 필요합니다. 터미널에서 아래 명령어를 1회 실행해주세요:\n\n gcloud auth login --enable-gdrive-access"',
926
+ 'Tell the user directly: "To automatically create editable Google Slides presentations in your personal Google Drive, Google Drive access is required. Please run the following command once in your terminal:\n\n gcloud auth login --enable-gdrive-access"',
914
927
  ];
915
928
  }
916
- } else if (parsed.status === 'running') {
929
+ } else if (parsed.status === 'running' || parsed.status === 'queued') {
917
930
  const percent =
918
- parsed.progressPercent ??
919
- (parsed.totalPages > 0 ? Math.round((parsed.pagesDone / parsed.totalPages) * 100) : 0);
931
+ typeof parsed.progressPercent === 'number'
932
+ ? parsed.progressPercent
933
+ : parsed.totalPages > 0
934
+ ? Math.round(((parsed.pagesDone || 0) / parsed.totalPages) * 100)
935
+ : 0;
936
+ parsed.progressPercent = percent;
920
937
  parsed.progressSummary = `${parsed.pagesDone || 0}/${parsed.totalPages || 0} slides complete (${percent}%)`;
938
+
939
+ console.error(
940
+ `[EditNBLM] ⏳ Progress: ${parsed.pagesDone || 0}/${parsed.totalPages || 0} slides (${percent}%) — ${parsed.stage || 'Processing'}`,
941
+ );
942
+
921
943
  parsed.agentInstructions = [
922
- `PROGRESS: ${parsed.pagesDone || 0} of ${parsed.totalPages || 0} slides completed (${percent}%).`,
923
- `CURRENT STAGE: ${parsed.stage || 'Inpainting & Processing'}`,
924
- 'STRICT INSTRUCTION: Do NOT output duplicate messages to the user if the stage or slide count has not changed. Silently poll check_slide_conversion until status is "done".',
944
+ `PROGRESS: ${parsed.pagesDone || 0} of ${parsed.totalPages || 0} slides complete (${percent}%).`,
945
+ `STAGE: ${parsed.stage || 'Inpainting & Processing'}`,
946
+ `MANDATORY: Inform user of progress: "🔄 Conversion progress: ${parsed.pagesDone || 0}/${parsed.totalPages || 0} slide(s) (${percent}%) ${parsed.stage || 'Processing'}"`,
947
+ `Continue polling check_slide_conversion with sinceUpdatedAt: ${parsed.updatedAt || 0} until status is "done".`,
925
948
  ];
949
+
950
+ // Pacing delay: prevent LLM agents from rapid-firing 70 calls in a tight loop.
951
+ // Ensure at least 3.5 seconds elapse per turn, matching Cloud Run slide generation rate.
952
+ const elapsed = Date.now() - startTime;
953
+ const MIN_POLL_INTERVAL_MS = 3500;
954
+ if (elapsed < MIN_POLL_INTERVAL_MS) {
955
+ await new Promise((resolve) => setTimeout(resolve, MIN_POLL_INTERVAL_MS - elapsed));
956
+ }
926
957
  }
927
958
 
928
959
  result.content[0].text = JSON.stringify(parsed, null, 2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jieunmarslim/server-editable-slides",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "description": "Model Context Protocol (MCP) client for Editable Slides Cloud",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "index.js"
11
11
  ],
12
12
  "publishConfig": {
13
- "access": "public"
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org"
14
15
  },
15
16
  "dependencies": {
16
17
  "@modelcontextprotocol/sdk": "^1.26.0",