agentdev 0.1.4 → 0.1.5

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.
@@ -4804,8 +4804,10 @@ function generateViewerHtml(port) {
4804
4804
  return '/template/agentdev/' + mapped + '.render.js';
4805
4805
  }
4806
4806
 
4807
- // 3. \u515C\u5E95\uFF1A\u4F7F\u7528 /template/agentdev/{template}.render.js
4808
- return '/template/agentdev/' + templateName + '.render.js';
4807
+ // 3. \u515C\u5E95\uFF1A\u8FD4\u56DE null\uFF0C\u8BA9\u8C03\u7528\u8005\u7B49\u5F85\u6216\u4F7F\u7528\u9ED8\u8BA4\u6A21\u677F
4808
+ // \u4E0D\u518D\u76F2\u76EE\u751F\u6210\u9519\u8BEF\u7684URL\uFF0C\u800C\u662F\u7B49\u5F85 FEATURE_TEMPLATE_MAP \u52A0\u8F7D\u5B8C\u6210
4809
+ console.warn('[Viewer] Template "' + templateName + '" not found in FEATURE_TEMPLATE_MAP or SYSTEM_TEMPLATE_MAP, waiting...');
4810
+ return null;
4809
4811
  }
4810
4812
 
4811
4813
  /**
@@ -4813,7 +4815,7 @@ function generateViewerHtml(port) {
4813
4815
  * \u652F\u6301\u4ECE Feature \u76EE\u5F55\u6216\u7CFB\u7EDF\u76EE\u5F55\u52A0\u8F7D
4814
4816
  * \u5982\u679C\u52A0\u8F7D\u5931\u8D25\uFF0C\u56DE\u9000\u5230\u5185\u7F6E\u6A21\u677F
4815
4817
  */
4816
- async function loadTemplate(templateName) {
4818
+ async function loadTemplate(templateName, retryCount = 0) {
4817
4819
  if (templateCache.has(templateName)) {
4818
4820
  return templateCache.get(templateName);
4819
4821
  }
@@ -4827,6 +4829,24 @@ function generateViewerHtml(port) {
4827
4829
  try {
4828
4830
  const path = resolveTemplatePath(templateName);
4829
4831
 
4832
+ // \u5982\u679C path \u4E3A null\uFF0C\u8BF4\u660E FEATURE_TEMPLATE_MAP \u8FD8\u672A\u52A0\u8F7D\u5B8C\u6210
4833
+ if (!path) {
4834
+ // \u6700\u591A\u91CD\u8BD5 3 \u6B21\uFF0C\u6BCF\u6B21\u7B49\u5F85 500ms
4835
+ if (retryCount < 3) {
4836
+ console.log('[Viewer] Waiting for FEATURE_TEMPLATE_MAP to load... (attempt ' + (retryCount + 1) + ')');
4837
+ await new Promise(resolve => setTimeout(resolve, 500));
4838
+ // \u91CD\u65B0\u52A0\u8F7D\u6A21\u677F\u6620\u5C04
4839
+ await loadFeatureTemplateMap();
4840
+ return loadTemplate(templateName, retryCount + 1);
4841
+ }
4842
+ console.warn('[Viewer] Template "' + templateName + '" not found after retries');
4843
+ // \u56DE\u9000\u5230\u5185\u7F6E json \u6A21\u677F
4844
+ if (RENDER_TEMPLATES['json']) {
4845
+ return RENDER_TEMPLATES['json'];
4846
+ }
4847
+ return null;
4848
+ }
4849
+
4830
4850
  // \u7EDF\u4E00\u4F7F\u7528 URL \u65B9\u5F0F\u52A0\u8F7D\u6A21\u677F
4831
4851
  // Feature \u6A21\u677F: /template/agentdev/shell/bash.render.js
4832
4852
  const module = await import(path);
@@ -7601,4 +7621,4 @@ if (isMainModule(import.meta.url)) {
7601
7621
  export {
7602
7622
  ViewerWorker
7603
7623
  };
7604
- //# sourceMappingURL=chunk-VYY63N2T.js.map
7624
+ //# sourceMappingURL=chunk-LLV3W326.js.map