nolo-cli 0.29.2 → 0.30.0-alpha.1

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 (135) hide show
  1. package/{_executeModel-BFVTGZXE.js → _executeModel-VBHHG7LT.js} +62 -68
  2. package/{action-LG32A6DJ.js → action-FENWPT3C.js} +14 -15
  3. package/{addContentAction-MPGMBJTQ.js → addContentAction-Z5S5ZQ7I.js} +12 -12
  4. package/{addDialogAgentAction-ZH23WDID.js → addDialogAgentAction-VUNVD2XR.js} +11 -11
  5. package/{agentDeleteCommand-4S4STG42.js → agentDeleteCommand-LLGZXUYJ.js} +60 -39
  6. package/{agentEmailCommands-3F4IP4DI.js → agentEmailCommands-LC2FPN6G.js} +76 -81
  7. package/{agentGrantCommands-JNDE4RWR.js → agentGrantCommands-E7ZZFRHK.js} +2 -1
  8. package/{agentListCommands-JCRV2XF6.js → agentListCommands-A6OBQ3QX.js} +57 -40
  9. package/{agentMachineCommands-KYXPYSFP.js → agentMachineCommands-4O4Q5B5X.js} +53 -35
  10. package/{agentPullCommand-ZZGU5KOY.js → agentPullCommand-4V36XNGV.js} +4 -3
  11. package/{agentRecordCommands-UADUPIXO.js → agentRecordCommands-W22RIQRV.js} +73 -78
  12. package/{agentRunCommand-MJWSR53W.js → agentRunCommand-V4OBU4FB.js} +77 -82
  13. package/{agentRunControl-SNUKXN6J.js → agentRunControl-AKBN2366.js} +13 -1
  14. package/{agentRuntimeLocal-PC5RRRPT.js → agentRuntimeLocal-I57YSGH4.js} +48 -30
  15. package/{agentSlice-C5OYLNBT.js → agentSlice-3ZHY7RAO.js} +12 -13
  16. package/{appDeleteCommands-ZXODZ5AD.js → appDeleteCommands-DJJF466K.js} +53 -35
  17. package/{appDeployCommands-AWC6JPZH.js → appDeployCommands-WJZGIOEZ.js} +53 -35
  18. package/{appDeployStatusCommands-74NXMDAI.js → appDeployStatusCommands-ICYXUJNO.js} +53 -35
  19. package/{appGetCommands-6YGIAP5L.js → appGetCommands-UOCWYJPV.js} +53 -35
  20. package/{appListCommands-DZWBHMNK.js → appListCommands-EOKWTXPW.js} +53 -35
  21. package/{authCommand-XMQHBK5L.js → authCommand-H5KE7K7K.js} +16 -16
  22. package/{authCommands-JSOG2H4E.js → authCommands-CXJ6PI2O.js} +7 -7
  23. package/{chunk-OEWEE4VW.js → chunk-2XM5KUNE.js} +4 -2
  24. package/{chunk-7H3UTGPM.js → chunk-3AUWC6EM.js} +82 -3
  25. package/{chunk-HEXXIS77.js → chunk-3RIWR23B.js} +1 -1
  26. package/{chunk-R7LOFGRE.js → chunk-446VANPP.js} +18 -14
  27. package/{chunk-RZNYL4LW.js → chunk-4SAV7BD7.js} +65 -1
  28. package/{chunk-QC6ZWDSV.js → chunk-56IUA7RU.js} +3 -3
  29. package/{chunk-R3JSTDQO.js → chunk-66O5MZYH.js} +1 -1
  30. package/{chunk-PSK2RUHV.js → chunk-7CD24PU4.js} +360 -2
  31. package/{chunk-G2BZ43DV.js → chunk-A4JDTA5T.js} +13 -13
  32. package/{chunk-DZ3XJVET.js → chunk-AOS5IN2I.js} +1 -1
  33. package/{chunk-SKDNBYZK.js → chunk-BOL2D2JW.js} +1 -1
  34. package/{chunk-YTA2QOEE.js → chunk-CAENRKNJ.js} +15 -0
  35. package/{chunk-2TYLTEAH.js → chunk-CV6I4HBA.js} +1 -1
  36. package/chunk-DCDL3GC4.js +171 -0
  37. package/{chunk-FVOSIYXM.js → chunk-DCWBP2O7.js} +42 -393
  38. package/{chunk-OLWMGSW2.js → chunk-DI6MXJK5.js} +37 -37
  39. package/{chunk-HRPWRVBI.js → chunk-DKRT67FG.js} +11 -11
  40. package/{chunk-L6RBX4L4.js → chunk-DWQNDGO7.js} +20 -8
  41. package/{chunk-VKBTAQWT.js → chunk-FS5TTXPS.js} +6 -6
  42. package/chunk-G5JHHUAK.js +73 -0
  43. package/{chunk-TOGGHWHI.js → chunk-G6VITLCZ.js} +3 -3
  44. package/{chunk-RJBTU7AS.js → chunk-GAGUBI42.js} +302 -14
  45. package/{chunk-NXMJ55RU.js → chunk-GVKTKT3O.js} +3 -3
  46. package/{chunk-5ZXNLOAG.js → chunk-HI7QZNWX.js} +17 -10
  47. package/{chunk-DF7SMWEV.js → chunk-HLG6GAUD.js} +1 -1
  48. package/{chunk-MQRZ5QUH.js → chunk-IXZX5CJK.js} +1 -1
  49. package/{chunk-IC7W63RM.js → chunk-IZ3CBMD5.js} +3 -3
  50. package/{chunk-VHBWHNVT.js → chunk-K6QEHQZ3.js} +8 -4
  51. package/chunk-KW47OSRJ.js +3246 -0
  52. package/{chunk-Q5RXHXKU.js → chunk-KWKD3BCC.js} +189 -122
  53. package/{chunk-L65QKSVJ.js → chunk-L3GCUVOH.js} +1 -1
  54. package/{chunk-4BDPDTJU.js → chunk-L3VQOVKK.js} +8 -8
  55. package/{chunk-HALKDXKP.js → chunk-MEUZFIAJ.js} +8 -4
  56. package/{chunk-H5S4XUGI.js → chunk-MMCVBEAD.js} +174 -149
  57. package/{chunk-XOIF2TNF.js → chunk-OB6FBSH3.js} +13 -0
  58. package/chunk-OYK7PA5U.js +1707 -0
  59. package/{chunk-6HTWA77J.js → chunk-Q24P6TUS.js} +1 -1
  60. package/{chunk-GMJS5AYP.js → chunk-QLV2GKU5.js} +16 -178
  61. package/{chunk-WMB7GVPN.js → chunk-SWOTB2TX.js} +134 -1166
  62. package/{chunk-GC34RRTQ.js → chunk-SWYMCHM7.js} +1 -69
  63. package/{chunk-BBGRJB5E.js → chunk-SZ5CBYMZ.js} +4 -4
  64. package/chunk-T27IEBNQ.js +149 -0
  65. package/{chunk-WX3ZOSTL.js → chunk-T3Y5EMJS.js} +24 -26
  66. package/{chunk-UFL6WHHJ.js → chunk-THTAR67C.js} +1056 -137
  67. package/{chunk-2FX23RGA.js → chunk-TJYWZ3LO.js} +4 -4
  68. package/{chunk-KEF5OBOZ.js → chunk-UKC5HU2C.js} +33 -27
  69. package/{chunk-HRJEPMZY.js → chunk-UTQZ73QQ.js} +2 -2
  70. package/{chunk-GT3GG2H7.js → chunk-VSTUQGLT.js} +1 -1
  71. package/{chunk-32ZM6HVI.js → chunk-W2YKDXT7.js} +95 -95
  72. package/{chunk-L3QFIBZG.js → chunk-WTGCTVJG.js} +1 -1
  73. package/{chunk-XS7UPVR7.js → chunk-XD5NQEOH.js} +5 -5
  74. package/{chunk-WSQLK2KR.js → chunk-XFGM5PJP.js} +6 -6
  75. package/{chunk-JSB4N6NU.js → chunk-YLADSPDU.js} +3 -3
  76. package/{chunk-FRN5QOKN.js → chunk-YWGSCF37.js} +19 -4
  77. package/{codingSkills-EN6Z6G6U.js → codingSkills-V35TRR4Y.js} +1 -2
  78. package/{createAgentAutomationAction-BK4UZJKU.js → createAgentAutomationAction-3GMH6ORX.js} +30 -37
  79. package/{createDialogAction-MJJUI2MK.js → createDialogAction-R5MCL4RE.js} +32 -38
  80. package/{createPageAction-YMZ7K363.js → createPageAction-QYTG656R.js} +43 -50
  81. package/{dbSlice-6QJYQUBV.js → dbSlice-OBV7VFCF.js} +11 -11
  82. package/{deleteFile-WDZ3VM7B.js → deleteFile-AC45HYSM.js} +5 -5
  83. package/{dialogCommands-OKH45ASS.js → dialogCommands-NUQGIXVZ.js} +53 -37
  84. package/{dialogSlice-UDOKNDHB.js → dialogSlice-CFDECXEU.js} +27 -34
  85. package/{docCreateCommands-MCLMR4TE.js → docCreateCommands-UNFCXB5N.js} +52 -36
  86. package/{docDeleteCommands-ONDHI7JV.js → docDeleteCommands-NG5IVKE5.js} +54 -38
  87. package/{docReadCommands-FCXBMISW.js → docReadCommands-6J7MUUX6.js} +52 -36
  88. package/{docStore-N66O4CGH.js → docStore-MZZWJM4F.js} +28 -35
  89. package/{docUpdateCommands-T3XN6XOX.js → docUpdateCommands-6AW3VZOX.js} +55 -39
  90. package/{fetchMessages-W4IKHPCS.js → fetchMessages-VPPQDDZ4.js} +3 -3
  91. package/{getPricing-X6I23RN6.js → getPricing-XQYSSVV6.js} +6 -7
  92. package/{handleSendMessageAction-KC4AYUZP.js → handleSendMessageAction-IU2QNTLM.js} +30 -37
  93. package/index.js +72 -72
  94. package/{localDialogRead-UFLBS6OT.js → localDialogRead-P72W2U2R.js} +1 -1
  95. package/{machineCommands-DIMRFA3Y.js → machineCommands-Z2QEWTHZ.js} +76 -81
  96. package/{machineWsRunDispatch-2DYJZI6Z.js → machineWsRunDispatch-SJTYHZHN.js} +71 -76
  97. package/{models-YT32CTT5.js → models-WDUTTYFS.js} +2 -2
  98. package/{offlineMarxistsAgentCommand-5OOWZLJI.js → offlineMarxistsAgentCommand-E6LUG63A.js} +6 -2
  99. package/package.json +1 -1
  100. package/{read-C7Y6LSBM.js → read-QK7ZRX6G.js} +6 -6
  101. package/{readDocTool-TOHRYJHP.js → readDocTool-EYDMVRBL.js} +2 -1
  102. package/{readlineWorkspace-HUPHMLDG.js → readlineWorkspace-EY3BPXIU.js} +150 -162
  103. package/{removeDialogAgentAction-WZXPOH5S.js → removeDialogAgentAction-TBW3UZJW.js} +15 -16
  104. package/{runAgentClientLoop-5TGSUKHV.js → runAgentClientLoop-N3YDLTMS.js} +61 -66
  105. package/{setDialogExtraReferencesAction-INZY2ENI.js → setDialogExtraReferencesAction-Q3ANF2NR.js} +12 -12
  106. package/{setPrimaryDialogAgentAction-WCVLPYCF.js → setPrimaryDialogAgentAction-FQ5R3EFJ.js} +15 -16
  107. package/{settingSlice-IDUM4LWU.js → settingSlice-JKKV2T7O.js} +13 -14
  108. package/{skillDiscovery-ITA7BI7A.js → skillDiscovery-I3QRA7NE.js} +2 -2
  109. package/{spaceCommands-XSSDB3YK.js → spaceCommands-R6AEQNLG.js} +57 -40
  110. package/{spaceSlice-BXDCO6PT.js → spaceSlice-MCH7RLLP.js} +27 -34
  111. package/{streamAgentChatTurn-HRFMVSVC.js → streamAgentChatTurn-Q4U2CVMI.js} +130 -1300
  112. package/{switchDialogAgentAction-YBFFCBOD.js → switchDialogAgentAction-QQGVE4SL.js} +11 -11
  113. package/{toolApiClient-WVTUYOFM.js → toolApiClient-ARGFDJAG.js} +2 -2
  114. package/{tools-5V6FHWQU.js → tools-Y3UBLLYW.js} +50 -56
  115. package/{tuiSummaryLlmCaller-GCUPULOV.js → tuiSummaryLlmCaller-4474IBTI.js} +12 -12
  116. package/{updateDialogTitleAction-W62C4W4K.js → updateDialogTitleAction-3J7GH67I.js} +35 -43
  117. package/chunk-5CS33IBL.js +0 -301
  118. package/chunk-5MMAK75Q.js +0 -15
  119. package/chunk-HYSJHRWD.js +0 -669
  120. package/chunk-MRC4Q34M.js +0 -188
  121. package/chunk-SIZQB7BD.js +0 -91
  122. package/chunk-UEOPA6MV.js +0 -641
  123. package/chunk-VIDPVFP3.js +0 -20
  124. package/chunk-W2LZV5GE.js +0 -231
  125. package/chunk-Y5GCAMGP.js +0 -9
  126. package/chunk-YYLHWIW6.js +0 -48
  127. package/chunk-Z54ZAZZC.js +0 -1791
  128. package/chunk-ZZ2MH7LE.js +0 -84
  129. package/{chunk-OMP5L5NF.js → chunk-44HACRCK.js} +3 -3
  130. package/{chunk-ZVZMT3EA.js → chunk-KWCLUYGQ.js} +3 -3
  131. package/{chunk-NRY4GCKJ.js → chunk-WHLVPK32.js} +3 -3
  132. package/{chunk-RQSOAMPJ.js → chunk-Z5MXSEOJ.js} +2 -2
  133. package/{chunk-XMLRJUU5.js → chunk-ZFTCLBEX.js} +9 -9
  134. package/{runtimeDoctorCommands-HSU632DY.js → runtimeDoctorCommands-E2OUORHK.js} +3 -3
  135. package/{tableCommands-QSZILI7I.js → tableCommands-PRJNWN6Q.js} +6 -6
@@ -0,0 +1,171 @@
1
+ import {
2
+ createKey
3
+ } from "./chunk-WHLVPK32.js";
4
+ import {
5
+ TOOL_PACKS
6
+ } from "./chunk-CF7S2RYZ.js";
7
+ import {
8
+ buildSkillDocMarkdown
9
+ } from "./chunk-ZWJOGMKH.js";
10
+
11
+ // packages/ai/skills/builtinObjectSkills.ts
12
+ var BUILTIN_OBJECT_SKILL_IDS = {
13
+ table: "builtin-table-skill-v1",
14
+ doc: "builtin-doc-skill-v1",
15
+ // key 改名为 code-style(它本来就叫「编码风格技能」,"code" 这个名字是它抢的,
16
+ // 与「代码执行」能力包撞车)。**id 值保持不变**——skillId 与页面 key 都从它派生,
17
+ // 改了会让存量 agent.references 失配。
18
+ "code-style": "builtin-code-skill-v1",
19
+ image: "builtin-image-skill-v1",
20
+ file: "builtin-file-skill-v1",
21
+ pagebuilder: "builtin-pagebuilder-skill-v1"
22
+ };
23
+ var SKILL_DEFS = {
24
+ doc: {
25
+ id: BUILTIN_OBJECT_SKILL_IDS.doc,
26
+ name: "\u6587\u6863\u7F16\u8F91\u6280\u80FD",
27
+ description: "\u63D0\u4F9B\u6587\u6863\u8BFB\u53D6\u4E0E\u66F4\u65B0\u80FD\u529B\uFF0C\u4F9B\u6587\u6863\u52A9\u624B\u4F7F\u7528\u3002\u89E6\u53D1\u8BCD\uFF1A\u6587\u6863\u3001\u6DA6\u8272\u3001\u6539\u5199\u3001\u7EED\u5199\u3001\u6392\u7248\u3001\u6587\u7AE0\u3001document\u3001polish\u3002",
28
+ toolNames: ["readDoc", "updateDoc"],
29
+ promptPatch: [
30
+ "\u6587\u6863\u7F16\u8F91\u6307\u5357\uFF1A",
31
+ "1. \u4FEE\u6539\u524D\u5148 readDoc \u8BFB\u53D6\u5F53\u524D\u6587\u6863\u771F\u503C\uFF0C\u518D\u57FA\u4E8E\u73B0\u6709\u5185\u5BB9\u7528 updateDoc \u505A\u5B9A\u70B9\u589E\u91CF\u7F16\u8F91\u3002",
32
+ "2. \u4E0D\u8981\u8131\u79BB\u73B0\u6709\u5185\u5BB9\u7A7A\u60F3\u91CD\u5199\uFF1B\u6DA6\u8272/\u6539\u5199/\u7EED\u5199\u90FD\u5E94\u4FDD\u7559\u7528\u6237\u539F\u6709\u7684\u7ED3\u6784\u4E0E\u4E8B\u5B9E\u3002"
33
+ ].join("\n")
34
+ },
35
+ table: {
36
+ id: BUILTIN_OBJECT_SKILL_IDS.table,
37
+ name: "\u8868\u683C\u7F16\u8F91\u6280\u80FD",
38
+ description: "\u63D0\u4F9B\u8868\u683C\u521B\u5EFA\u3001\u67E5\u8BE2\u3001\u65B0\u589E\u3001\u66F4\u65B0\u4E0E\u5220\u9664\u80FD\u529B\uFF0C\u4F9B\u8868\u683C\u52A9\u624B\u4F7F\u7528\u3002\u89E6\u53D1\u8BCD\uFF1A\u8868\u683C\u3001\u5EFA\u8868\u3001\u65B0\u589E\u4E00\u884C\u3001\u8BB0\u5F55\u3001\u5B57\u6BB5\u3001table\u3001spreadsheet\u3001csv\u3002",
39
+ // 与 app-builder 能力包共用同一份清单(TOOL_PACKS.TABLE)。
40
+ // 以前两边各抄一份,改一个忘另一个就会静默不同步。
41
+ toolNames: [...TOOL_PACKS.TABLE],
42
+ promptPatch: [
43
+ "\u8868\u683C\u64CD\u4F5C\u6307\u5357\uFF1A",
44
+ "1. \u7528\u6237\u8981\u65B0\u5EFA\u8868\u683C\u65F6\uFF0C\u8C03\u7528 createTable\uFF0C\u5E76\u4ECE\u9700\u6C42\u63A8\u65AD\u5408\u7406\u7684\u5B57\u6BB5\u8BBE\u8BA1\uFF08\u5B57\u6BB5\u540D\u3001\u7C7B\u578B\u3001\u5FC5\u586B\u3001\u53EF\u9009\u503C\uFF09\u3002",
45
+ "2. \u65B0\u589E\u8BB0\u5F55\u5FC5\u987B\u8C03\u7528 addTableRow / addTableRows\uFF0C\u4E0D\u8981\u53EA\u5728\u56DE\u7B54\u91CC\u53E3\u5934\u63CF\u8FF0\u3002",
46
+ "3. addTableRow \u7684 values \u662F\u5BF9\u8C61\uFF0Ckey \u5FC5\u987B\u7528\u5B57\u6BB5\u540D\uFF08name\uFF0C\u4E0D\u662F\u663E\u793A\u540D label\uFF09\uFF1B\u5C3D\u91CF\u4ECE\u7528\u6237\u81EA\u7136\u8BED\u8A00\u63A8\u65AD\u5E76\u586B\u6EE1\u76F8\u5173\u5B57\u6BB5\uFF0C\u5FC5\u586B\u5B57\u6BB5\u5C24\u5176\u6CE8\u610F\uFF1B\u7528\u6237\u6CA1\u63D0\u5230\u7684\u5B57\u6BB5\u53EF\u7528\u7A7A\u5B57\u7B26\u4E32\u6216 null \u5360\u4F4D\uFF1B\u7EDD\u4E0D\u8981\u4F20\u7A7A\u5BF9\u8C61 {}\u3002",
47
+ "4. \u66F4\u65B0\u6216\u5220\u9664\u524D\uFF0C\u5148\u7528 queryTableRows \u786E\u8BA4\u76EE\u6807\u884C\uFF0C\u5FC5\u8981\u65F6\u5411\u7528\u6237\u786E\u8BA4\u76EE\u6807\u884C/\u5B57\u6BB5\u3002"
48
+ ].join("\n")
49
+ },
50
+ "code-style": {
51
+ id: BUILTIN_OBJECT_SKILL_IDS["code-style"],
52
+ name: "\u7F16\u7801\u98CE\u683C\u6280\u80FD",
53
+ description: "\u63D0\u4F9B\u7F16\u7801\u89C4\u8303\u4E0E\u98CE\u683C\u7EA6\u675F\uFF0C\u4F9B\u4EE3\u7801\u4EFB\u52A1\u4F7F\u7528\u3002\u89E6\u53D1\u8BCD\uFF1A\u4EE3\u7801\u3001\u7F16\u7801\u3001\u91CD\u6784\u3001\u4FEEbug\u3001code\u3001refactor\u3001bugfix\u3001coding-style\u3002",
54
+ toolNames: [],
55
+ promptPatch: [
56
+ "\u7F16\u7801\u98CE\u683C\u4E0E\u89C4\u8303\u6307\u5357\uFF1A",
57
+ "1. \u6587\u4EF6\u62C6\u5206\uFF1A\u4F18\u5148\u62C6\u5206\u4E3A\u591A\u6587\u4EF6\uFF08MANY SMALL FILES\uFF09\uFF0C\u5178\u578B\u957F\u5EA6 200-400 \u884C\uFF0C\u5355\u6587\u4EF6\u6700\u591A 800 \u884C\uFF08800 max\uFF09\u3002",
58
+ "2. \u51FD\u6570\u4E0E\u5D4C\u5957\uFF1A\u51FD\u6570\u4FDD\u6301\u77ED\u5C0F\uFF08<50 lines\uFF09\uFF0C\u4F18\u5148\u4F7F\u7528 early returns \u63D0\u524D\u8FD4\u56DE\uFF0C\u5D4C\u5957\u5C42\u7EA7\u4E0D\u8D85\u8FC7 4 \u5C42\uFF08nesting \u22644\uFF09\u3002",
59
+ "3. \u4E0D\u53EF\u53D8\u6027\uFF08immutability\uFF09\uFF1A\u4FDD\u6301\u6570\u636E\u4E0D\u53EF\u53D8\uFF0C\u4E0D\u8981\u539F\u5730 mutate \u73B0\u6709\u5BF9\u8C61\u6216\u6570\u7EC4\uFF0C\u5FC5\u987B\u8FD4\u56DE\u65B0\u5BF9\u8C61/\u6570\u7EC4\u3002",
60
+ "4. \u9519\u8BEF\u5904\u7406\u4E0E\u6821\u9A8C\uFF1A\u663E\u5F0F\u5904\u7406\u6240\u6709\u9519\u8BEF\uFF08explicit error handling\uFF09\uFF0C\u5728\u7CFB\u7EDF\u8FB9\u754C\u5B8C\u6210\u6821\u9A8C\uFF08validate at boundaries\uFF09\uFF0C\u4E0D\u9690\u5F0F\u541E\u9519\u3002",
61
+ "5. \u5B8C\u6210\u524D Checklist\uFF1A\u5B8C\u6210\u524D\u81EA\u67E5\u51FD\u6570/\u6587\u4EF6\u5C3A\u5BF8\u3001\u5D4C\u5957\u6DF1\u5EA6\u3001\u4E0D\u53EF\u53D8\u6027\u4E0E\u8FB9\u754C\u9519\u8BEF\u5904\u7406\u3002"
62
+ ].join("\n")
63
+ },
64
+ image: {
65
+ id: BUILTIN_OBJECT_SKILL_IDS.image,
66
+ name: "\u56FE\u7247\u5206\u6790\u6280\u80FD",
67
+ description: "\u63D0\u4F9B\u56FE\u7247\u7406\u89E3\u3001\u63CF\u8FF0\u4E0E\u6574\u7406\u5EFA\u8BAE\u80FD\u529B\uFF0C\u4F9B\u56FE\u7247\u52A9\u624B\u4F7F\u7528\u3002\u89E6\u53D1\u8BCD\uFF1A\u56FE\u7247\u3001\u56FE\u50CF\u3001\u5206\u6790\u3001\u63CF\u8FF0\u3001\u547D\u540D\u3001\u6574\u7406\u3001image\u3001photo\u3001picture\u3002",
68
+ toolNames: [],
69
+ promptPatch: [
70
+ "\u56FE\u7247\u5206\u6790\u6307\u5357\uFF1A",
71
+ "1. \u5F53\u524D\u9636\u6BB5\u91CD\u70B9\u56F4\u7ED5\u5F53\u524D\u56FE\u7247\u505A\u7406\u89E3\u3001\u63CF\u8FF0\u3001\u63D0\u70BC\u91CD\u70B9\u3001\u7ED9\u51FA\u547D\u540D/\u6574\u7406\u5EFA\u8BAE\u548C\u540E\u7EED\u5904\u7406\u5EFA\u8BAE\u3002",
72
+ "2. \u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5177\u5907\u590D\u6742\u56FE\u7247\u7F16\u8F91\u80FD\u529B\uFF1B\u5982\u679C\u7528\u6237\u8981\u66F4\u5F3A\u64CD\u4F5C\uFF0C\u660E\u786E\u8BF4\u660E\u5F53\u524D\u53EF\u505A\u7684\u662F\u5206\u6790\u4E0E\u7EC4\u7EC7\u3002"
73
+ ].join("\n")
74
+ },
75
+ file: {
76
+ id: BUILTIN_OBJECT_SKILL_IDS.file,
77
+ name: "\u6587\u4EF6\u5904\u7406\u6280\u80FD",
78
+ description: "\u63D0\u4F9B\u6587\u4EF6\u7406\u89E3\u3001\u6574\u7406\u4E0E\u5904\u7406\u5EFA\u8BAE\u80FD\u529B\uFF0C\u4F9B\u6587\u4EF6\u52A9\u624B\u4F7F\u7528\u3002\u89E6\u53D1\u8BCD\uFF1A\u6587\u4EF6\u3001\u89E3\u6790\u3001\u63D0\u53D6\u3001\u6574\u7406\u3001\u5904\u7406\u3001file\u3001document\u3001pdf\u3002",
79
+ toolNames: [],
80
+ promptPatch: [
81
+ "\u6587\u4EF6\u5904\u7406\u6307\u5357\uFF1A",
82
+ "1. \u5F53\u524D\u9636\u6BB5\u91CD\u70B9\u56F4\u7ED5\u5F53\u524D\u6587\u4EF6\u63D0\u4F9B\u7406\u89E3\u3001\u6574\u7406\u3001\u63D0\u53D6\u4E0E\u540E\u7EED\u5904\u7406\u5EFA\u8BAE\u3002",
83
+ "2. \u4E0D\u8981\u5047\u88C5\u5DF2\u7ECF\u5B8C\u6210\u6587\u4EF6\u5185\u5BB9\u89E3\u6790\uFF1B\u5FC5\u8981\u65F6\u660E\u786E\u544A\u8BC9\u7528\u6237\u5F53\u524D\u66F4\u591A\u662F\u5360\u4F4D\u578B\u5DE5\u4F5C\u6D41\u5165\u53E3\uFF0C\u7B49\u5F85\u540E\u7EED\u63A5\u5165\u66F4\u5B8C\u6574\u7684\u6587\u4EF6\u5904\u7406\u80FD\u529B\u3002"
84
+ ].join("\n")
85
+ },
86
+ pagebuilder: {
87
+ id: BUILTIN_OBJECT_SKILL_IDS.pagebuilder,
88
+ name: "\u52A8\u6001\u4EA4\u4E92\u7EC4\u4EF6\u751F\u6210\u6280\u80FD",
89
+ description: "\u628A\u4E00\u53E5\u8BDD\u9700\u6C42\u53D8\u6210\u53EF\u770B\u7684\u4EA4\u4E92\u9875\u9762\u3001\u62A5\u544A\u3001\u770B\u677F\u3001\u4E3B\u9875\u3001\u6559\u7A0B\u3001\u5BF9\u6BD4\u9875\u6216\u8BA1\u5212\u9875\u3002\u4EFB\u4F55 agent \u5728\u9700\u8981\u8F93\u51FA\u53EF\u4EA4\u4E92\u53EF\u89C6\u5316\u6D88\u606F\u65F6\u6309\u9700\u52A0\u8F7D\u3002\u89E6\u53D1\u8BCD\uFF1A\u9875\u9762\u3001\u62A5\u8868\u3001\u770B\u677F\u3001\u65E5\u62A5\u3001\u5468\u62A5\u3001\u4E3B\u9875\u3001\u6559\u7A0B\u3001\u5BF9\u6BD4\u9875\u3001\u8BA1\u5212\u9875\u3001\u53EF\u89C6\u5316\u3001\u4EA4\u4E92\u9875\u9762\u3001\u4EEA\u8868\u76D8\u3001dashboard\u3001report\u3001page\u3001landing\u3002",
90
+ toolNames: [],
91
+ promptPatch: [
92
+ "\u52A8\u6001\u4EA4\u4E92\u7EC4\u4EF6\u751F\u6210\u89C4\u5219\uFF1A",
93
+ "\u4F60\u73B0\u5728\u7684\u4EFB\u52A1\u662F\u628A\u7528\u6237\u9700\u6C42\u53D8\u6210\u4E00\u4E2A\u53EF\u770B\u7684\u4EA4\u4E92\u9875\u9762/\u62A5\u544A/\u770B\u677F/\u4E3B\u9875/\u6559\u7A0B/\u5BF9\u6BD4\u9875/\u8BA1\u5212\u9875\u3002\u7528\u6237\u770B\u4E0D\u5230\u6E90\u7801\uFF0C\u53EA\u4F1A\u770B\u5230\u9875\u9762\u7ED3\u679C\u3002",
94
+ "",
95
+ "\u7EDD\u5BF9\u89C4\u5219\uFF1A",
96
+ "1. \u53EA\u8F93\u51FA\u4E00\u4E2A Markdown \u4EE3\u7801\u5757\uFF0C\u4EE3\u7801\u5757\u8BED\u8A00\u5FC5\u987B\u662F tsx preview\u3002",
97
+ "2. \u4EE3\u7801\u5757\u5916\u4E0D\u8981\u8F93\u51FA\u89E3\u91CA\u3001\u524D\u8A00\u3001\u7ED3\u5C3E\u3001\u6E05\u5355\u6216\u601D\u8003\u8FC7\u7A0B\u3002",
98
+ "3. \u4EE3\u7801\u5FC5\u987B\u5B9A\u4E49\u9876\u5C42 function Example()\uFF0C\u4E0D\u8981\u8C03\u7528 render()\uFF0C\u4E0D\u8981 export default\u3002",
99
+ "4. \u4E0D\u8981\u5199 import\u3002\u8FD0\u884C\u73AF\u5883\u5DF2\u7ECF\u63D0\u4F9B React\u3001useState\u3001useEffect\u3001useMemo\u3001useCallback\u3001useRef\u3001ReactECharts\u3001react-icons/lu \u7684\u56FE\u6807\u7EC4\u4EF6\u3002",
100
+ "5. \u6240\u6709\u4EA4\u4E92\u5FC5\u987B\u5728 Example \u5185\u7528 React state \u5B9E\u73B0\uFF0C\u6309\u94AE\u3001Tab\u3001FAQ\u3001\u6B65\u9AA4\u5207\u6362\u3001\u7B5B\u9009\u90FD\u8981\u771F\u7684\u53EF\u70B9\u51FB\u3002",
101
+ "6. \u4E3A\u4E3B\u8981\u533A\u5757\u52A0 data-artifact-section \u5C5E\u6027\u3002",
102
+ "7. \u751F\u6210\u7ED3\u679C\u4F18\u5148\u662F\u4E00\u9875\u5B8C\u6574\u53EF\u7528\u7684\u9875\u9762\uFF0C\u4E0D\u8981\u53EA\u505A\u5B64\u7ACB\u5361\u7247\u6216\u4E00\u4E2A\u56FE\u3002",
103
+ "8. \u5982\u679C\u7528\u6237\u6CA1\u6709\u7ED9\u5177\u4F53\u6570\u636E\uFF0C\u53EF\u4EE5\u751F\u6210\u5408\u7406\u7684\u793A\u4F8B\u6570\u636E\uFF0C\u4F46\u8981\u4FDD\u6301\u4E1A\u52A1\u53EF\u4FE1\u3002",
104
+ "",
105
+ "\u5404\u7C7B\u9875\u9762\u9ED8\u8BA4\u7ED3\u6784\uFF1A",
106
+ "- \u4FE1\u606F\u5C55\u793A\u7C7B\uFF08\u4E3B\u9875\u3001\u4EA7\u54C1\u4ECB\u7ECD\u3001\u670D\u52A1\u9875\u3001\u4F5C\u54C1\u96C6\u3001\u6D3B\u52A8\u9875\uFF09\uFF1A\u9996\u5C4F\u5B9A\u4F4D\u3001\u670D\u52A1/\u80FD\u529B\u5361\u7247\u3001\u4EE3\u8868\u6210\u679C\u5361\u7247\u3001\u53EF\u4FE1\u80CC\u4E66\u3001\u8054\u7CFB\u6216\u884C\u52A8\u6309\u94AE\u3002",
107
+ "- \u6570\u636E\u5206\u6790\u7C7B\uFF08\u65E5\u62A5\u3001\u5468\u62A5\u3001\u770B\u677F\u3001\u8D28\u68C0\u3001\u9500\u552E\u6F0F\u6597\u3001\u53CD\u9988\u5206\u6790\uFF09\uFF1A\u9876\u90E8\u6458\u8981\u3001\u6838\u5FC3\u6307\u6807\u3001\u8D8B\u52BF\u56FE\u3001\u660E\u7EC6\u8868\u683C\u6216\u5F02\u5E38\u5217\u8868\u3001\u4E0B\u4E00\u6B65\u5EFA\u8BAE\u3002",
108
+ "- \u6D41\u7A0B\u8BF4\u660E\u7C7B\uFF08\u6559\u7A0B\u3001SOP\u3001onboarding\u3001\u64CD\u4F5C\u6307\u5357\u3001\u8BFE\u7A0B\u6B65\u9AA4\uFF09\uFF1A\u5B66\u4E60\u76EE\u6807\u3001\u6B65\u9AA4\u5361\u7247\u3001\u793A\u4F8B/\u7EC3\u4E60\u3001\u68C0\u67E5\u6E05\u5355\u6216\u4E0B\u4E00\u6B65\u6309\u94AE\u3002",
109
+ "- \u51B3\u7B56\u6BD4\u8F83\u7C7B\uFF08\u65B9\u6848\u5BF9\u6BD4\u3001\u4EA7\u54C1\u9009\u578B\u3001\u7ADE\u54C1\u5206\u6790\u3001\u91C7\u8D2D\u5EFA\u8BAE\uFF09\uFF1A\u5BF9\u6BD4\u7EF4\u5EA6\u8868\u683C\u3001\u4F18\u7F3A\u70B9\u5361\u7247\u3001\u8BC4\u5206\u6216\u9002\u914D\u5EA6\u3001\u63A8\u8350\u7ED3\u8BBA\u3002",
110
+ "- \u8BA1\u5212\u6392\u5E03\u7C7B\uFF08\u9879\u76EE\u8BA1\u5212\u3001\u5B66\u4E60\u8BA1\u5212\u3001\u5185\u5BB9\u65E5\u5386\u3001\u53D1\u5E03\u8282\u594F\uFF09\uFF1A\u9636\u6BB5\u76EE\u6807\u3001\u4EFB\u52A1\u5217\u8868\u3001\u4F18\u5148\u7EA7\u3001\u91CC\u7A0B\u7891\u5361\u7247\u3001\u98CE\u9669\u63D0\u9192\u3002",
111
+ "- \u6DF7\u5408\u6C47\u62A5\u7C7B\uFF08\u878D\u8D44\u9875\u3001\u9879\u76EE\u6982\u89C8\u3001\u590D\u6742\u6C47\u62A5\uFF09\uFF1A\u81F3\u5C11\u5305\u542B MetricCard\u3001Chart\u3001Table \u548C Section\uFF0C\u4E0D\u8981\u53EA\u505A\u5355\u4E00\u5217\u8868\u3002",
112
+ "- \u6559\u7A0B/\u6B65\u9AA4/FAQ/Tab/\u7B5B\u9009/\u9875\u9762\u5185\u8DF3\u8F6C\u5FC5\u987B\u505A\u6210\u771F\u5B9E\u53EF\u70B9\u51FB\u4EA4\u4E92\u3002",
113
+ "",
114
+ "\u4EE3\u7801\u98CE\u683C\uFF1A",
115
+ "1. \u4F7F\u7528\u5185\u8054 style \u6216\u7EC4\u4EF6\u5185 <style>\uFF0C\u4E0D\u8981\u4F9D\u8D56 Tailwind \u6216\u5916\u90E8 CSS\u3002",
116
+ "2. \u9875\u9762\u5BBD\u5EA6\u3001\u95F4\u8DDD\u3001\u5B57\u53F7\u8981\u9002\u5408\u6D88\u606F\u5185\u9884\u89C8\uFF1B\u4E0D\u8981\u7528\u8FC7\u5927\u7684\u843D\u5730\u9875 hero\u3002",
117
+ "3. \u989C\u8272\u8981\u514B\u5236\uFF0C\u6709\u5C42\u6B21\uFF1B\u907F\u514D\u6574\u9875\u5355\u4E00\u84DD\u7D2B\u6E10\u53D8\u3002",
118
+ "4. \u8868\u683C\u3001\u56FE\u8868\u3001\u5361\u7247\u3001\u6309\u94AE\u90FD\u8981\u6709 hover/active/focus \u7684\u7EC6\u8282\u3002",
119
+ "5. \u5FC5\u8981\u65F6\u4F7F\u7528 ReactECharts \u753B\u56FE\uFF1B\u7B80\u5355\u67F1\u72B6\u56FE\u4E5F\u53EF\u4EE5\u7528 div \u5B9E\u73B0\uFF0C\u4FDD\u8BC1\u7A33\u5B9A\u3002",
120
+ "6. \u4EE3\u7801\u5C3D\u91CF\u77ED\u800C\u5B8C\u6574\uFF0C\u9ED8\u8BA4 150-260 \u884C\u4EE5\u5185\u3002",
121
+ "",
122
+ "\u8F93\u51FA\u683C\u5F0F\u793A\u4F8B\uFF1A",
123
+ "```tsx preview",
124
+ "function Example() {",
125
+ " const [tab, setTab] = useState('overview');",
126
+ " return <main><section data-artifact-section>...</section></main>;",
127
+ "}",
128
+ "```"
129
+ ].join("\n")
130
+ }
131
+ };
132
+ function buildBuiltinObjectSkillConfig(kind) {
133
+ const def = SKILL_DEFS[kind];
134
+ return {
135
+ version: "0.1",
136
+ kind: "skill",
137
+ id: def.id,
138
+ name: def.name,
139
+ description: def.description,
140
+ triggerMode: "explicit",
141
+ toolNames: def.toolNames,
142
+ promptPatch: def.promptPatch
143
+ };
144
+ }
145
+ function buildBuiltinObjectSkillDbKey(kind, userId) {
146
+ return createKey("page" /* DOC */, userId, BUILTIN_OBJECT_SKILL_IDS[kind]);
147
+ }
148
+ function buildBuiltinObjectSkillReference(kind, userId) {
149
+ return {
150
+ dbKey: buildBuiltinObjectSkillDbKey(kind, userId),
151
+ title: SKILL_DEFS[kind].name,
152
+ type: "instruction"
153
+ };
154
+ }
155
+ function buildBuiltinObjectSkillPageContent(kind) {
156
+ const def = SKILL_DEFS[kind];
157
+ return buildSkillDocMarkdown({
158
+ body: `# ${def.name}
159
+
160
+ ${def.description}`,
161
+ skillConfig: buildBuiltinObjectSkillConfig(kind)
162
+ });
163
+ }
164
+
165
+ export {
166
+ BUILTIN_OBJECT_SKILL_IDS,
167
+ buildBuiltinObjectSkillConfig,
168
+ buildBuiltinObjectSkillDbKey,
169
+ buildBuiltinObjectSkillReference,
170
+ buildBuiltinObjectSkillPageContent
171
+ };
@@ -1,40 +1,7 @@
1
1
  import {
2
2
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
3
3
  isAntigravityOAuthAgent
4
- } from "./chunk-2FX23RGA.js";
5
- import {
6
- clipMultilineText,
7
- fetchAndSerializeTable,
8
- resolveBuiltinSkillPage,
9
- waitForAbortableDelay
10
- } from "./chunk-WMB7GVPN.js";
11
- import {
12
- createDrainExhaustedResponse,
13
- isCoreDrainingBody,
14
- isGatewayHttpStatus,
15
- normalizeNonNegativeMs,
16
- parseRetryAfterHeaderMs
17
- } from "./chunk-RQSOAMPJ.js";
18
- import {
19
- slateToSimplifiedMarkdown
20
- } from "./chunk-GC34RRTQ.js";
21
- import {
22
- extractCategorizedMentions
23
- } from "./chunk-VP4WJWKW.js";
24
- import {
25
- fetchAndCacheMessages
26
- } from "./chunk-UFL6WHHJ.js";
27
- import {
28
- fetchServerSyncedCredential
29
- } from "./chunk-RJBTU7AS.js";
30
- import {
31
- shouldUseServerProxy
32
- } from "./chunk-YYLHWIW6.js";
33
- import {
34
- buildSkillGuidancePromptBlock,
35
- extractRuntimePageCapabilities,
36
- resolveSkillGraphFromRoots
37
- } from "./chunk-7H3UTGPM.js";
4
+ } from "./chunk-TJYWZ3LO.js";
38
5
  import {
39
6
  buildCurrentTimeBlock,
40
7
  buildIdentityBlock,
@@ -42,7 +9,7 @@ import {
42
9
  requiresBareImageUrl,
43
10
  resolveToolGuidedSections,
44
11
  toBareImageUrlMessages
45
- } from "./chunk-PSK2RUHV.js";
12
+ } from "./chunk-7CD24PU4.js";
46
13
  import {
47
14
  convertMessagesToResponsesInput,
48
15
  preserveAgentStateFields
@@ -52,60 +19,69 @@ import {
52
19
  isOpenAiResponsesModel,
53
20
  resolvePlatformChatCompletionsEndpoint,
54
21
  resolvePlatformResponsesEndpoint
55
- } from "./chunk-XS7UPVR7.js";
56
- import {
57
- estimateTokenCount
58
- } from "./chunk-HYSJHRWD.js";
59
- import {
60
- createFileCredentialBroker
61
- } from "./chunk-5CS33IBL.js";
62
- import {
63
- clampReasoningEffort,
64
- getModelConfig,
65
- isModelSupportReasoningEffort
66
- } from "./chunk-GT3GG2H7.js";
22
+ } from "./chunk-XD5NQEOH.js";
67
23
  import {
68
24
  MEMORY_USE_GUIDANCE,
69
25
  wrapHistoricalSummaryWithReplayGuard
70
26
  } from "./chunk-4PWB7JRR.js";
71
27
  import {
72
- canonicalizeToolNames
73
- } from "./chunk-ZZ2MH7LE.js";
28
+ waitForAbortableDelay
29
+ } from "./chunk-SWOTB2TX.js";
30
+ import {
31
+ createDrainExhaustedResponse,
32
+ isCoreDrainingBody,
33
+ isGatewayHttpStatus,
34
+ normalizeNonNegativeMs,
35
+ parseRetryAfterHeaderMs
36
+ } from "./chunk-Z5MXSEOJ.js";
37
+ import {
38
+ resolveBuiltinSkillPage
39
+ } from "./chunk-OYK7PA5U.js";
40
+ import {
41
+ estimateTokenCount,
42
+ shouldUseServerProxy
43
+ } from "./chunk-THTAR67C.js";
44
+ import {
45
+ createFileCredentialBroker,
46
+ fetchServerSyncedCredential
47
+ } from "./chunk-GAGUBI42.js";
74
48
  import {
75
49
  toErrorMessage
76
50
  } from "./chunk-HNMXYYJR.js";
51
+ import {
52
+ clampReasoningEffort,
53
+ getModelConfig,
54
+ isModelSupportReasoningEffort
55
+ } from "./chunk-VSTUQGLT.js";
77
56
  import {
78
57
  isDeepInfraKimiModel,
79
58
  isFireworksKimiModel,
80
59
  resolveFireworksKimiModel
81
- } from "./chunk-YTA2QOEE.js";
82
- import {
83
- createSpaceKey
84
- } from "./chunk-JSB4N6NU.js";
60
+ } from "./chunk-CAENRKNJ.js";
85
61
  import {
86
62
  read
87
- } from "./chunk-G2BZ43DV.js";
63
+ } from "./chunk-A4JDTA5T.js";
88
64
  import {
89
65
  asTrimmedLowercaseString
90
66
  } from "./chunk-QSJ3HFEF.js";
91
- import {
92
- getRuntimeServerContext
93
- } from "./chunk-XMLRJUU5.js";
94
67
  import {
95
68
  isAbortError
96
69
  } from "./chunk-R5V5G73M.js";
97
- import {
98
- asTrimmedString
99
- } from "./chunk-3EUW3WEO.js";
100
- import {
101
- extractCustomId
102
- } from "./chunk-TOW4E763.js";
103
70
  import {
104
71
  API_ENDPOINTS
105
72
  } from "./chunk-LCBAMY2M.js";
106
73
  import {
107
74
  isLoopbackUrl
108
75
  } from "./chunk-4SN6J65J.js";
76
+ import {
77
+ asTrimmedString
78
+ } from "./chunk-3EUW3WEO.js";
79
+ import {
80
+ buildSkillGuidancePromptBlock,
81
+ canonicalizeToolNames,
82
+ extractRuntimePageCapabilities,
83
+ resolveSkillGraphFromRoots
84
+ } from "./chunk-3AUWC6EM.js";
109
85
  import {
110
86
  asOptionalTrimmedString
111
87
  } from "./chunk-G3SUCT4W.js";
@@ -567,6 +543,7 @@ var compileContextLayers = (layers) => {
567
543
  const stablePrefixContent = stablePrefixLayers.map((layer) => layer.content).join("\n\n");
568
544
  const dynamicLayers = compiledLayers.slice(stablePrefixLayers.length);
569
545
  const dynamicContent = dynamicLayers.map((layer) => layer.content).join("\n\n");
546
+ const misorderedLayerIds = dynamicLayers.filter((layer) => layer.cacheScope !== "turn").map((layer) => layer.id);
570
547
  return {
571
548
  content: compiledLayers.map((layer) => layer.content).join("\n\n"),
572
549
  stablePrefixContent,
@@ -576,7 +553,8 @@ var compileContextLayers = (layers) => {
576
553
  stablePrefixHash: createHash("sha256").update(stablePrefixContent).digest("hex"),
577
554
  stablePrefixLayerIds: stablePrefixLayers.map((layer) => layer.id),
578
555
  stablePrefixCharCount: stablePrefixContent.length,
579
- stablePrefixEstimatedTokens: estimateContextTokens(stablePrefixContent)
556
+ stablePrefixEstimatedTokens: estimateContextTokens(stablePrefixContent),
557
+ misorderedLayerIds
580
558
  }
581
559
  };
582
560
  };
@@ -1438,336 +1416,7 @@ var performFetchRequest = async (params) => {
1438
1416
  }
1439
1417
  };
1440
1418
 
1441
- // packages/create/editor/transforms/slateToText.ts
1442
- function getNodeText(node) {
1443
- if (node.text) {
1444
- return node.text;
1445
- }
1446
- if (node.children && Array.isArray(node.children)) {
1447
- return node.children.map(getNodeText).join("\n");
1448
- }
1449
- return "";
1450
- }
1451
- function slateToText(nodes) {
1452
- if (!nodes || nodes.length === 0) {
1453
- return "";
1454
- }
1455
- return nodes.map(getNodeText).join("\n\n");
1456
- }
1457
-
1458
- // packages/ai/context/buildReferenceContext.ts
1459
- var MAX_META_TEXT_LENGTH = 80;
1460
- var DIALOG_REFERENCE_MESSAGE_LIMIT = 20;
1461
- var DIALOG_REFERENCE_SNIPPET_CHARS = 1200;
1462
- var DIALOG_HANDOFF_SNIPPET_CHARS = 360;
1463
- var truncateMetaText = (value, max = MAX_META_TEXT_LENGTH) => {
1464
- if (!value) return "";
1465
- if (value.length <= max) return value;
1466
- return `${value.slice(0, max - 3)}...`;
1467
- };
1468
- var readSafe = async (dispatch, dbKey) => {
1469
- try {
1470
- return await dispatch(read({
1471
- dbKey
1472
- })).unwrap();
1473
- } catch {
1474
- return null;
1475
- }
1476
- };
1477
- var buildMentionMetaMap = async (slateData, dispatch) => {
1478
- const metaMap = /* @__PURE__ */ new Map();
1479
- const mentions = extractCategorizedMentions(slateData);
1480
- if (!mentions) return metaMap;
1481
- const pageEntries = await Promise.all(
1482
- (mentions.pages || []).map(async (pageId) => {
1483
- const pageData = await readSafe(dispatch, pageId);
1484
- if (!pageData) {
1485
- return [`page:${pageId}`, { displayType: "page", metaParts: [] }];
1486
- }
1487
- if (pageData.type === "dialog" /* DIALOG */) {
1488
- const agentCount = Array.isArray(pageData.cybots) ? pageData.cybots.length : 0;
1489
- return [
1490
- `page:${pageId}`,
1491
- {
1492
- displayType: "dialog",
1493
- title: pageData.title,
1494
- metaParts: [
1495
- `agents=${agentCount}`,
1496
- `updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
1497
- ]
1498
- }
1499
- ];
1500
- }
1501
- const tags = pageData.tags && pageData.tags.length > 0 ? pageData.tags.slice(0, 5).join(", ") : "";
1502
- return [
1503
- `page:${pageId}`,
1504
- {
1505
- displayType: "page",
1506
- title: pageData.title,
1507
- metaParts: [
1508
- pageData.spaceId ? `space=${pageData.spaceId}` : "",
1509
- tags ? `tags=${tags}` : "",
1510
- `updated=${pageData.updatedAt || pageData.updated_at || pageData.updated || "Unknown"}`
1511
- ].filter(Boolean)
1512
- }
1513
- ];
1514
- })
1515
- );
1516
- pageEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
1517
- const agentEntries = await Promise.all(
1518
- (mentions.agents || []).map(async (agentId) => {
1519
- const agentData = await readSafe(dispatch, agentId);
1520
- if (!agentData) {
1521
- return [`agent:${agentId}`, { displayType: "agent", metaParts: [] }];
1522
- }
1523
- const desc = truncateMetaText(
1524
- agentData.description || agentData.introduction || ""
1525
- );
1526
- return [
1527
- `agent:${agentId}`,
1528
- {
1529
- displayType: "agent",
1530
- title: agentData.name,
1531
- metaParts: [
1532
- `public=${agentData.isPublic ? "yes" : "no"}`,
1533
- desc ? `desc=${desc}` : ""
1534
- ].filter(Boolean)
1535
- }
1536
- ];
1537
- })
1538
- );
1539
- agentEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
1540
- const spaceEntries = await Promise.all(
1541
- (mentions.spaces || []).map(async (spaceId) => {
1542
- const spaceKey = createSpaceKey.space(spaceId);
1543
- const spaceData = await readSafe(dispatch, spaceKey);
1544
- if (!spaceData) {
1545
- return [`space:${spaceId}`, { displayType: "space", metaParts: [] }];
1546
- }
1547
- const desc = truncateMetaText(spaceData.description || "");
1548
- const categoriesCount = Object.keys(spaceData.categories || {}).length;
1549
- const contentsCount = Object.keys(spaceData.contents || {}).length;
1550
- return [
1551
- `space:${spaceId}`,
1552
- {
1553
- displayType: "space",
1554
- title: spaceData.name,
1555
- metaParts: [
1556
- desc ? `desc=${desc}` : "",
1557
- `categories=${categoriesCount}`,
1558
- `contents=${contentsCount}`
1559
- ].filter(Boolean)
1560
- }
1561
- ];
1562
- })
1563
- );
1564
- spaceEntries.forEach((entry) => metaMap.set(entry[0], entry[1]));
1565
- return metaMap;
1566
- };
1567
- var buildInlineMention = (node, metaMap) => {
1568
- const resourceType = node.resourceType || "unknown";
1569
- const resourceId = node.resourceId || "unknown";
1570
- const key = `${resourceType}:${resourceId}`;
1571
- const meta = metaMap.get(key);
1572
- const label = meta?.title || node.label || resourceId || "mention";
1573
- const displayType = meta?.displayType || resourceType;
1574
- const metaParts = meta?.metaParts ?? [];
1575
- const idPart = resourceType === "tool" ? `tool=${resourceId}` : `dbkey=${resourceId}`;
1576
- const metaSuffix = metaParts.length ? ` | ${metaParts.join(" | ")}` : "";
1577
- return `@${label}(${displayType} | ${idPart}${metaSuffix})`;
1578
- };
1579
- var clipReferenceText = (value, max) => {
1580
- const raw = typeof value === "string" ? value : value == null ? "" : JSON.stringify(value);
1581
- return clipMultilineText(raw, max);
1582
- };
1583
- var fetchDialogReference = async (dbKey, refContent, dispatch) => {
1584
- const dialogConfig = refContent;
1585
- const dialogTitle = dialogConfig.title || `Untitled Dialog (${dbKey})`;
1586
- const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
1587
- const checkpoint = dialogConfig.runtimeCheckpoint || null;
1588
- const summary = asTrimmedString(dialogConfig.summary);
1589
- const messages = await dispatch(
1590
- async (_dispatch, getState, { db }) => {
1591
- const state = getState();
1592
- const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
1593
- return await fetchAndCacheMessages({
1594
- db,
1595
- dialogId,
1596
- limit: DIALOG_REFERENCE_MESSAGE_LIMIT,
1597
- token,
1598
- remoteServers: remoteServers.length > 0 ? remoteServers : void 0
1599
- });
1600
- }
1601
- );
1602
- const sortedMessages = [...messages].reverse();
1603
- const formatContent = (content) => clipReferenceText(content, DIALOG_REFERENCE_SNIPPET_CHARS);
1604
- const transcript = sortedMessages.map((msg, index) => {
1605
- const toolLine = msg.toolName ? ` tool=${msg.toolName}` : "";
1606
- const agentLine = msg.cybotKey ? ` agent=${msg.cybotKey}` : "";
1607
- const createdLine = msg.createdAt ? ` at=${msg.createdAt}` : "";
1608
- return [
1609
- `### Message ${index + 1}: ${msg.role || "unknown"} id=${msg.id || "unknown"}${toolLine}${agentLine}${createdLine}`,
1610
- formatContent(msg.content) || "[empty]"
1611
- ].join("\n");
1612
- }).join("\n\n");
1613
- const checkpointLines = [];
1614
- if (checkpoint && typeof checkpoint === "object") {
1615
- if (checkpoint.status) checkpointLines.push(`- status: ${checkpoint.status}`);
1616
- if (checkpoint.lastUserInput) checkpointLines.push(`- lastUserInput: ${formatContent(checkpoint.lastUserInput)}`);
1617
- if (checkpoint.lastAssistantText) checkpointLines.push(`- lastAssistantText: ${formatContent(checkpoint.lastAssistantText)}`);
1618
- if (Array.isArray(checkpoint.lastToolNames) && checkpoint.lastToolNames.length) {
1619
- checkpointLines.push(`- lastToolNames: ${checkpoint.lastToolNames.join(", ")}`);
1620
- }
1621
- if (Array.isArray(checkpoint.availableToolNames) && checkpoint.availableToolNames.length) {
1622
- checkpointLines.push(`- availableToolNames: ${checkpoint.availableToolNames.join(", ")}`);
1623
- }
1624
- }
1625
- const recentToolEvidence = sortedMessages.filter((msg) => msg.role === "tool" || msg.toolName).slice(-3).map((msg) => {
1626
- const label = msg.toolName ? `${msg.toolName}` : "tool";
1627
- return `- ${label} id=${msg.id || "unknown"}: ${clipReferenceText(msg.content, DIALOG_HANDOFF_SNIPPET_CHARS) || "[empty]"}`;
1628
- });
1629
- const handoffLines = [
1630
- `- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
1631
- `- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
1632
- summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
1633
- recentToolEvidence.length ? `- Recent tool evidence:
1634
- ${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
1635
- `- For exact claims, old decisions, original wording, files/tools mentioned earlier, or anything not visible in the recent transcript, call searchDialogMessages with DB Key ${dbKey}.`
1636
- ].filter(Boolean);
1637
- const referenceBody = [
1638
- `Conversation Reference:`,
1639
- `DB Key: ${dbKey}`,
1640
- `Title: ${dialogTitle}`,
1641
- `Status: ${dialogConfig.status || "unknown"}`,
1642
- `Loaded Recent Messages: ${sortedMessages.length}`,
1643
- `Conversation Handoff:
1644
- ${handoffLines.join("\n")}`,
1645
- checkpointLines.length ? `Runtime Checkpoint:
1646
- ${checkpointLines.join("\n")}` : "",
1647
- summary ? `Passive Summary (compressed history, not original wording):
1648
- ${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
1649
- `Recent Transcript (original message excerpts, oldest to newest):
1650
- ${transcript || "[no recent messages loaded]"}`,
1651
- [
1652
- `Coverage Note: This reference intentionally loads only the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages plus summaries/checkpoint to control token load.`,
1653
- `Original Message Lookup Policy: If the user asks for an exact old message, original wording, who said what, why a decision was made, early-history detail, file/tool evidence, failed attempts, or a comparison with prior work, use searchDialogMessages({ dialogKey: "${dbKey}", query: "..." }) before making a factual claim from this referenced conversation.`
1654
- ].join("\n")
1655
- ].filter(Boolean).join("\n\n");
1656
- const tokenEstimate = estimateTokenCount(referenceBody);
1657
- return `${referenceBody}
1658
-
1659
- Token Load Estimate: ${tokenEstimate} tokens for this conversation reference.
1660
- ---
1661
-
1662
- `;
1663
- };
1664
- var fetchTableReference = async (dbKey, refContent, dispatch) => {
1665
- const tableMeta = refContent;
1666
- const title = tableMeta.displayName || tableMeta.description || `Untitled Table (${dbKey})`;
1667
- const { markdown: tableMd } = await dispatch(
1668
- async (_dispatch, getState, { db }) => {
1669
- const state = getState();
1670
- const { currentToken: token, remoteServers } = getRuntimeServerContext(state);
1671
- return await fetchAndSerializeTable(tableMeta, db, {
1672
- token,
1673
- remoteServers
1674
- });
1675
- }
1676
- );
1677
- const tags = tableMeta.tags?.length ? tableMeta.tags.join(", ") : "None";
1678
- const description = tableMeta.description || "No description provided.";
1679
- return `Reference Item (Table):
1680
- DB Key: ${dbKey}
1681
- Title: ${title}
1682
- Description: ${description}
1683
- Tags: ${tags}
1684
- Content (Markdown Table):
1685
-
1686
- ${tableMd}
1687
- ---
1688
-
1689
- `;
1690
- };
1691
- var fetchSlateReference = async (dbKey, refContent, dispatch, options) => {
1692
- if (!refContent?.slateData) return null;
1693
- const title = refContent.title || `Untitled (${dbKey})`;
1694
- let contentString;
1695
- let contentType;
1696
- const inlineMentionMeta = options.inlineMentionMeta ?? options.format === "simplified_markdown";
1697
- switch (options.format) {
1698
- case "text":
1699
- contentType = "Plain Text";
1700
- contentString = slateToText(refContent.slateData);
1701
- break;
1702
- case "simplified_markdown":
1703
- contentType = "Simplified Markdown";
1704
- if (inlineMentionMeta) {
1705
- const metaMap = await buildMentionMetaMap(refContent.slateData, dispatch);
1706
- contentString = slateToSimplifiedMarkdown(refContent.slateData, {
1707
- mentionResolver: (node) => buildInlineMention(node, metaMap)
1708
- });
1709
- } else {
1710
- contentString = slateToSimplifiedMarkdown(refContent.slateData);
1711
- }
1712
- break;
1713
- case "json":
1714
- default:
1715
- contentType = "Slate JSON";
1716
- contentString = JSON.stringify(refContent.slateData, null, 2);
1717
- break;
1718
- }
1719
- if (!contentString || typeof contentString === "string" && !contentString.trim() || contentString === "[]") {
1720
- return null;
1721
- }
1722
- const tags = (refContent.tags || []).length > 0 ? refContent.tags.join(", ") : "None";
1723
- const createdAt = refContent.created || "Unknown Creation Date";
1724
- const updatedAt = refContent.updated || "Unknown Update Date";
1725
- return `Reference Item:
1726
- DB Key: ${dbKey}
1727
- Title: ${title}
1728
- Content (${contentType}):
1729
- ${contentString}
1730
- Tags: ${tags}
1731
- Created At: ${createdAt}
1732
- Updated At: ${updatedAt}
1733
- ---
1734
-
1735
- `;
1736
- };
1737
- var fetchReferenceContents = async (references, dispatch, options = { format: "simplified_markdown" }) => {
1738
- const result = /* @__PURE__ */ new Map();
1739
- if (!references || references.length === 0) return result;
1740
- const referencePromises = references.map(async (dbKey) => {
1741
- try {
1742
- const hasPreloaded = options.preloaded?.has(dbKey);
1743
- const refContent = hasPreloaded ? options.preloaded?.get(dbKey) : await dispatch(read({
1744
- dbKey
1745
- })).unwrap();
1746
- if (!refContent) return null;
1747
- let formatted = null;
1748
- if (refContent.type === "dialog" /* DIALOG */) {
1749
- formatted = await fetchDialogReference(dbKey, refContent, dispatch);
1750
- } else if (refContent.type === "table" /* TABLE */) {
1751
- formatted = await fetchTableReference(dbKey, refContent, dispatch);
1752
- } else {
1753
- formatted = await fetchSlateReference(dbKey, refContent, dispatch, options);
1754
- }
1755
- if (formatted) return [dbKey, formatted];
1756
- return null;
1757
- } catch (error) {
1758
- console.error(`Error fetching reference ${dbKey}:`, error);
1759
- return null;
1760
- }
1761
- });
1762
- const resolved = await Promise.all(referencePromises);
1763
- resolved.forEach((item) => {
1764
- if (item) result.set(item[0], item[1]);
1765
- });
1766
- return result;
1767
- };
1768
-
1769
1419
  export {
1770
- fetchReferenceContents,
1771
1420
  mergeReferences,
1772
1421
  resolveReferenceAssets,
1773
1422
  resolveToolsFromKeys,