@jieunmarslim/server-editable-slides 0.2.13 → 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 +20 -2
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -839,18 +839,28 @@ 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') {
856
866
  parsed.progressPercent = 100;
@@ -936,6 +946,14 @@ async function startMcpServer() {
936
946
  `MANDATORY: Inform user of progress: "🔄 Conversion progress: ${parsed.pagesDone || 0}/${parsed.totalPages || 0} slide(s) (${percent}%) — ${parsed.stage || 'Processing'}"`,
937
947
  `Continue polling check_slide_conversion with sinceUpdatedAt: ${parsed.updatedAt || 0} until status is "done".`,
938
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
+ }
939
957
  }
940
958
 
941
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.13",
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",