nolo-cli 0.8.0-alpha.7 → 0.9.0

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 (99) hide show
  1. package/{_executeModel-XIGO7HW5.js → _executeModel-UD44KGZ4.js} +33 -28
  2. package/{action-PAXRPJJF.js → action-ZJWE3Y5S.js} +5 -4
  3. package/{addContentAction-CZVWF3QZ.js → addContentAction-TVDBNJM5.js} +4 -3
  4. package/{addDialogAgentAction-CCIDTPHC.js → addDialogAgentAction-EKH774VT.js} +3 -2
  5. package/{agentDeleteCommand-47B24JYG.js → agentDeleteCommand-TCPEFJTF.js} +15 -11
  6. package/{agentEmailCommands-D4FC6OZJ.js → agentEmailCommands-CZ3UILZ4.js} +36 -31
  7. package/{agentListCommands-UFET7CC4.js → agentListCommands-SJKO2FFB.js} +16 -12
  8. package/{agentMachineCommands-LH7QDQPP.js → agentMachineCommands-PSNABISZ.js} +15 -11
  9. package/{agentRecordCommands-CWS2B5IA.js → agentRecordCommands-MH2JKFHS.js} +36 -31
  10. package/{agentRunCommand-3FRPISLG.js → agentRunCommand-4KH6MIZR.js} +42 -34
  11. package/{agentRuntimeLocal-JNQQC2WG.js → agentRuntimeLocal-SKHJUWSS.js} +20 -15
  12. package/{agentSlice-XDFSELFJ.js → agentSlice-3WXXN4VK.js} +5 -4
  13. package/{authCommand-WXMD3IPR.js → authCommand-PXFX6JDT.js} +8 -1
  14. package/{authCommands-X74AFDTC.js → authCommands-356AYWEK.js} +10 -1
  15. package/{chunk-E5HMHIKL.js → chunk-2K2ECKSG.js} +4 -4
  16. package/{chunk-364VYAX2.js → chunk-2PUGVR6E.js} +1 -1
  17. package/chunk-3TZDXYSF.js +71 -0
  18. package/{chunk-YIJFUVKA.js → chunk-3WYQEUBI.js} +1 -1
  19. package/{chunk-543C7RDK.js → chunk-4K2KKCSD.js} +23 -8
  20. package/chunk-4ZDM73SD.js +34 -0
  21. package/{chunk-TDIQFT2F.js → chunk-5CS33IBL.js} +1 -1
  22. package/chunk-5KLGBAAR.js +386 -0
  23. package/{chunk-YD43KPCK.js → chunk-5PJ3VWCS.js} +3 -3
  24. package/{chunk-IAXBCTTE.js → chunk-63SLEOLK.js} +2 -2
  25. package/{chunk-BSTNFPHD.js → chunk-6GANEXVO.js} +1 -1
  26. package/{chunk-6PWWWMI7.js → chunk-7OOXPE3N.js} +2 -2
  27. package/{chunk-KK6SWS5B.js → chunk-7QRKCBOP.js} +5 -5
  28. package/{chunk-LM25IZBJ.js → chunk-AUQ747NZ.js} +2 -2
  29. package/{chunk-572EKYLF.js → chunk-BBYVOSU2.js} +1 -1
  30. package/{chunk-2MALU52L.js → chunk-C3RUNRHT.js} +1 -1
  31. package/{chunk-G5H7RNFL.js → chunk-COMXDWNM.js} +2 -2
  32. package/{chunk-2LMT6K6N.js → chunk-CPB2YM4D.js} +2 -2
  33. package/{chunk-USZMK5UT.js → chunk-DCOA4QSN.js} +1 -1
  34. package/{chunk-OF5H3QWS.js → chunk-EXTIQUCI.js} +182 -0
  35. package/{chunk-B76D3JJK.js → chunk-G43KEVSC.js} +4 -4
  36. package/{chunk-USZDUWOV.js → chunk-GG4AJPSR.js} +2 -2
  37. package/chunk-I42VC5KR.js +15 -0
  38. package/{chunk-BR2WP3DF.js → chunk-IWX4UW2E.js} +9 -9
  39. package/chunk-JEXVIMYZ.js +55 -0
  40. package/{chunk-XDVAYP26.js → chunk-JRKKFRAV.js} +1 -1
  41. package/{chunk-DA2OEKS6.js → chunk-KKY4B2Q2.js} +2 -8
  42. package/{chunk-A3X4Y7MO.js → chunk-KOCA5FCS.js} +482 -26
  43. package/{chunk-IYQV26RA.js → chunk-KTVVPRJS.js} +2 -2
  44. package/{chunk-V2F4OGYM.js → chunk-LARL2V6G.js} +22 -18
  45. package/{chunk-H2RMRZJE.js → chunk-MGOJ5R6J.js} +1 -1
  46. package/{chunk-UVPF33PW.js → chunk-MKMWT7SA.js} +63 -19862
  47. package/chunk-OPZYGHUC.js +89 -0
  48. package/chunk-PAKN26FP.js +239 -0
  49. package/{chunk-OVGXXUVI.js → chunk-PCWC3JTN.js} +2 -2
  50. package/{chunk-AR7ZSGDI.js → chunk-PG5PNA7Y.js} +16 -6
  51. package/{chunk-HEIIIZBX.js → chunk-Q2YZULBH.js} +1 -1
  52. package/{chunk-2JHWPW5B.js → chunk-SBR32ZZS.js} +77 -303
  53. package/{chunk-PN7AFLOK.js → chunk-SH2CFQOH.js} +3 -13
  54. package/{chunk-CM54RSSA.js → chunk-SL35K7AH.js} +21 -1
  55. package/{chunk-VEJLAVTC.js → chunk-TSS3XJY4.js} +4 -4
  56. package/{chunk-IECI4YHR.js → chunk-UUJDGGAK.js} +3 -3
  57. package/{chunk-GEKCOPTN.js → chunk-WKM6FH35.js} +1 -1
  58. package/{chunk-SL3EPWB4.js → chunk-XE635NI4.js} +21 -22
  59. package/{chunk-NE3E3XJ2.js → chunk-XS466O7S.js} +96 -99
  60. package/{chunk-5XH3NZ4T.js → chunk-YBWOP46I.js} +20 -379
  61. package/{chunk-VQ2AJRGD.js → chunk-YPRZSPF3.js} +1 -1
  62. package/{chunk-AUGHVUFE.js → chunk-YYUCRDOK.js} +1 -1
  63. package/{chunk-KTI2WDDG.js → chunk-ZIG5LJ7X.js} +357 -266
  64. package/{chunk-NXZGF7F7.js → chunk-ZQ2UM4KG.js} +1 -1
  65. package/{createAgentAutomationAction-3QTGNYJC.js → createAgentAutomationAction-63OIP6X5.js} +15 -13
  66. package/{createDialogAction-5YX3ARBK.js → createDialogAction-ZLYZDYBB.js} +18 -16
  67. package/{createPageAction-EQNQQRCW.js → createPageAction-AL5FSDCK.js} +16 -14
  68. package/{dbSlice-C4UJLRZP.js → dbSlice-PR44QPXY.js} +3 -2
  69. package/{dialogCommands-AOQS23FV.js → dialogCommands-F6YI5742.js} +17 -13
  70. package/{dialogSlice-GZE3NCMC.js → dialogSlice-JSBNZRLR.js} +15 -13
  71. package/{docCreateCommands-GVOQVJON.js → docCreateCommands-4CTO7ERT.js} +16 -12
  72. package/{docDeleteCommands-GEB7YAUZ.js → docDeleteCommands-VBWERDRG.js} +17 -13
  73. package/{docReadCommands-XYKI2DF2.js → docReadCommands-KNP4MFYB.js} +16 -12
  74. package/{docStore-MLM5AME5.js → docStore-ADP5VYY4.js} +16 -14
  75. package/{docUpdateCommands-4L3RAMHZ.js → docUpdateCommands-4BCBJQHA.js} +16 -12
  76. package/{fetchMessages-JOCYIFKL.js → fetchMessages-U6ZHN56A.js} +3 -2
  77. package/{getPricing-PWPJ6MNV.js → getPricing-3E6UNPKL.js} +3 -3
  78. package/{handleSendMessageAction-WG2GKTGZ.js → handleSendMessageAction-IJDQ6ARA.js} +15 -13
  79. package/index.js +60 -56
  80. package/lib-FYYBQIXS.js +19839 -0
  81. package/{localDialogRead-D3BELSTF.js → localDialogRead-Z5UTAJPU.js} +1 -1
  82. package/{machineCommands-ZNXKLH6Q.js → machineCommands-EA3M4XTN.js} +38 -33
  83. package/{machineWsRunDispatch-7WRG6HNV.js → machineWsRunDispatch-NAPKE5ZA.js} +34 -29
  84. package/{models-XLEOET3E.js → models-4OPOOLFS.js} +2 -2
  85. package/package.json +1 -1
  86. package/{readlineWorkspace-AQURUDN4.js → readlineWorkspace-KMWT4T4S.js} +196 -44
  87. package/{removeDialogAgentAction-CXLST3N6.js → removeDialogAgentAction-GJQJNDW6.js} +5 -4
  88. package/{runAgentClientLoop-VQUEKGA5.js → runAgentClientLoop-U5Q6NDTJ.js} +28 -25
  89. package/{setDialogExtraReferencesAction-LP6VYGU7.js → setDialogExtraReferencesAction-M7OQG54N.js} +3 -2
  90. package/{setPrimaryDialogAgentAction-D3GGH23T.js → setPrimaryDialogAgentAction-46UNFJDL.js} +5 -4
  91. package/{settingSlice-J4I3Z5H7.js → settingSlice-FVUUH4JA.js} +4 -3
  92. package/{spaceCommands-R2RXD5UY.js → spaceCommands-E2CFRPZJ.js} +15 -11
  93. package/{spaceSlice-5UT4JNIN.js → spaceSlice-L3R6IMXE.js} +15 -13
  94. package/{streamAgentChatTurn-NRWSQKFN.js → streamAgentChatTurn-UBDAOQWE.js} +60 -35
  95. package/{tableCommands-66XEWHAK.js → tableCommands-GOFP7QKA.js} +1 -1
  96. package/{tools-TNMUDDRK.js → tools-TMJXZTCA.js} +22 -20
  97. package/tuiSummaryLlmCaller-RV3THLZF.js +78 -0
  98. package/{understanding-HCSFPE7R.js → understanding-GQKNDDWM.js} +7 -54
  99. package/{updateDialogTitleAction-IXOKAVX3.js → updateDialogTitleAction-ZTWRDXI2.js} +17 -14
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  MEMORY_USE_GUIDANCE,
3
3
  wrapHistoricalSummaryWithReplayGuard
4
- } from "./chunk-DA2OEKS6.js";
4
+ } from "./chunk-KKY4B2Q2.js";
5
5
  import {
6
6
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
7
7
  isAntigravityOAuthAgent
8
- } from "./chunk-2MALU52L.js";
8
+ } from "./chunk-C3RUNRHT.js";
9
9
  import {
10
10
  clipMultilineText,
11
11
  fetchAndSerializeTable
12
- } from "./chunk-UVPF33PW.js";
12
+ } from "./chunk-MKMWT7SA.js";
13
13
  import {
14
14
  normalizeNonNegativeMs,
15
15
  parseRetryAfterHeaderMs
@@ -22,39 +22,45 @@ import {
22
22
  } from "./chunk-VP4WJWKW.js";
23
23
  import {
24
24
  resolvePageSkillMetadata
25
- } from "./chunk-NXZGF7F7.js";
25
+ } from "./chunk-ZQ2UM4KG.js";
26
26
  import {
27
27
  estimateTokenCount,
28
- fetchAndCacheMessages
29
- } from "./chunk-KTI2WDDG.js";
28
+ fetchAndCacheMessages,
29
+ shouldUseServerProxy
30
+ } from "./chunk-ZIG5LJ7X.js";
30
31
  import {
31
32
  fetchServerSyncedCredential
32
- } from "./chunk-543C7RDK.js";
33
+ } from "./chunk-4K2KKCSD.js";
33
34
  import {
34
35
  createSpaceKey
35
36
  } from "./chunk-UAD2WT54.js";
37
+ import {
38
+ buildCurrentTimeBlock,
39
+ buildIdentityBlock,
40
+ buildRuntimeGuidanceBlocks
41
+ } from "./chunk-PAKN26FP.js";
36
42
  import {
37
43
  OPENAI_RESPONSES_ENDPOINT,
38
44
  buildProviderAuthHeaders,
39
45
  convertMessagesToResponsesInput,
40
46
  isOpenAiResponsesModel,
41
47
  resolvePlatformChatCompletionsEndpoint
42
- } from "./chunk-XDVAYP26.js";
48
+ } from "./chunk-JRKKFRAV.js";
43
49
  import {
44
50
  canonicalizeToolNames
45
- } from "./chunk-LM25IZBJ.js";
51
+ } from "./chunk-AUQ747NZ.js";
46
52
  import {
47
53
  getModelConfig,
48
54
  isModelSupportReasoningEffort
49
- } from "./chunk-572EKYLF.js";
55
+ } from "./chunk-BBYVOSU2.js";
50
56
  import {
51
57
  createFileCredentialBroker
52
- } from "./chunk-TDIQFT2F.js";
58
+ } from "./chunk-5CS33IBL.js";
53
59
  import {
54
60
  isDeepInfraKimiModel,
55
61
  isFireworksKimiModel,
56
62
  resolveFireworksKimiModel
57
- } from "./chunk-BR2WP3DF.js";
63
+ } from "./chunk-IWX4UW2E.js";
58
64
  import {
59
65
  extractCustomId
60
66
  } from "./chunk-DFFIZ25G.js";
@@ -63,10 +69,10 @@ import {
63
69
  } from "./chunk-HNMXYYJR.js";
64
70
  import {
65
71
  read
66
- } from "./chunk-G5H7RNFL.js";
72
+ } from "./chunk-COMXDWNM.js";
67
73
  import {
68
74
  asNonEmptyStringArray
69
- } from "./chunk-PN7AFLOK.js";
75
+ } from "./chunk-I42VC5KR.js";
70
76
  import {
71
77
  asTrimmedLowercaseString
72
78
  } from "./chunk-QSJ3HFEF.js";
@@ -400,45 +406,6 @@ var resolveToolsFromKeys = async (keys, dispatch, preloaded) => {
400
406
  };
401
407
  };
402
408
 
403
- // packages/agent-runtime/serverProxyPolicy.ts
404
- var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
405
- "antigravity",
406
- "xai",
407
- "chatgpt",
408
- "claude"
409
- ]);
410
- function isGoogleFamilyProvider(provider) {
411
- const normalized = asTrimmedLowercaseString(provider);
412
- return normalized === "google" || normalized.startsWith("google-");
413
- }
414
- function isOAuthApiKeyRef(value) {
415
- const ref = asTrimmedLowercaseString(value);
416
- return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
417
- }
418
- function shouldUseServerProxy(agentConfig, requestProvider) {
419
- const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
420
- if (isGoogleFamilyProvider(effectiveProvider)) {
421
- return true;
422
- }
423
- if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
424
- return true;
425
- }
426
- if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
427
- return true;
428
- }
429
- return !!agentConfig.useServerProxy;
430
- }
431
- var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
432
- function isRemoteCustomEndpoint(url) {
433
- if (typeof url !== "string") return false;
434
- try {
435
- const host = new URL(url).hostname.toLowerCase();
436
- return !LOCAL_HOSTS.has(host);
437
- } catch {
438
- return false;
439
- }
440
- }
441
-
442
409
  // packages/agent-runtime/agentCallPlan.ts
443
410
  var CODEX_RESPONSES_URL = "https://chatgpt.com/backend-api/codex/responses";
444
411
  var CURSOR_AGENT_URL = "https://api2.cursor.sh/agent.v1.AgentService/Run";
@@ -614,163 +581,6 @@ var mapLanguage = (responseLanguage) => {
614
581
  return languageMap[responseLanguage] || responseLanguage;
615
582
  };
616
583
 
617
- // packages/ai/agent/contextLayerContract.ts
618
- var buildContextLayerContractBlock = (options = {}) => {
619
- const lines = [
620
- "--- \u77E5\u8BC6\u5B58\u50A8\u7EA6\u5B9A ---",
621
- "\u4E0D\u8981\u628A\u6240\u6709\u4FE1\u606F\u90FD\u585E\u8FDB\u540C\u4E00\u5C42\u3002\u4F18\u5148\u5229\u7528\u5DF2\u6709\u7684 memory / knowledge / doc\uFF0C\u800C\u4E0D\u662F\u628A\u5B83\u4EEC\u6DF7\u6210\u4E00\u6BB5\u957F\u5BF9\u8BDD\u3002",
622
- "",
623
- "\u5C42\u6B21\u8FB9\u754C\uFF1A",
624
- "1. memory layer\uFF1A\u653E\u77ED\u5230\u4E2D\u671F\u3001\u53EF\u590D\u7528\u4F46\u4E0D\u5FC5\u6C38\u4E45\u6302\u8F7D\u7684\u504F\u597D\u3001\u8FD1\u671F\u5171\u8BC6\u548C\u538B\u7F29\u540E\u7684\u7ECF\u9A8C\uFF1B\u8981\u77ED\u3001\u53EF\u68C0\u7D22\u3001\u53EF\u66FF\u6362\u3002",
625
- "2. knowledge layer\uFF1A\u653E\u7A33\u5B9A\u89C4\u5219\u3001\u957F\u671F\u6709\u6548\u4E8B\u5B9E\u548C\u6BCF\u8F6E\u90FD\u4F1A\u53CD\u590D\u4F9D\u8D56\u7684\u8BF4\u660E\uFF1B\u4F18\u5148\u901A\u8FC7 prompt / references \u81EA\u52A8\u52A0\u8F7D\u3002",
626
- "3. doc layer\uFF1A\u653E\u9700\u8981\u8DE8\u8F6E\u6B21\u6301\u7EED\u7EF4\u62A4\u7684\u5916\u90E8\u5DE5\u4F5C\u53F0\uFF0C\u4F8B\u5982 runbook\u3001mission\u3001incident\u3001checkpoint\u3001idea backlog\u3001experiment log\uFF1B\u9700\u8981\u65F6\u663E\u5F0F\u8BFB\u53D6\u548C\u66F4\u65B0\u3002",
627
- "",
628
- "\u5199\u5165\u539F\u5219\uFF1A",
629
- "- \u4E34\u65F6\u6B65\u9AA4\u3001\u539F\u59CB\u957F\u65E5\u5FD7\u3001\u4E00\u6B21\u6027\u601D\u8DEF\uFF0C\u4E0D\u8981\u76F4\u63A5\u5199\u8FDB memory \u6216 knowledge\u3002",
630
- "- \u7A33\u5B9A\u884C\u4E3A\u89C4\u5219\u3001\u957F\u671F\u56FA\u5B9A\u7EA6\u675F\uFF0C\u4F18\u5148\u6C89\u6DC0\u5230 knowledge layer\u3002",
631
- "- \u7528\u6237\u504F\u597D\u3001\u6700\u8FD1\u5F62\u6210\u7684\u534F\u4F5C\u5171\u8BC6\u3001\u8FD1\u671F\u53CD\u590D\u6709\u7528\u7684\u7ECF\u9A8C\uFF0C\u4F18\u5148\u6C89\u6DC0\u5230 memory layer\u3002",
632
- "- \u9700\u8981\u8DE8\u8F6E\u6B21\u63A5\u529B\u7684\u4EFB\u52A1\u72B6\u6001\u3001\u8FD0\u884C\u624B\u518C\u3001\u4E8B\u6545\u8BB0\u5F55\u3001\u68C0\u67E5\u70B9\uFF0C\u4F18\u5148\u5199\u5165 doc layer\u3002"
633
- ];
634
- if (options.hasRememberMemoryTool) {
635
- lines.push(
636
- "- \u5F53\u67D0\u6761\u504F\u597D\u3001\u8FD1\u671F\u5171\u8BC6\u6216\u590D\u7528\u7ECF\u9A8C\u5BF9\u672A\u6765\u660E\u663E\u6709\u5E2E\u52A9\u65F6\uFF0C\u53EF\u4EE5\u8C03\u7528 rememberMemory\uFF0C\u4F46\u8981\u5199\u6210\u7B80\u6D01\u53EF\u590D\u7528\u7684\u4E00\u53E5\u8BDD\uFF1B\u53EA\u6709\u5F53\u524D dialog \u660E\u786E\u7ED1\u5B9A\u4E86 space\uFF0C\u4E14\u5185\u5BB9\u5C5E\u4E8E\u5171\u4EAB\u534F\u4F5C\u89C4\u5219\u65F6\u624D\u5199 space memory\u3002"
637
- );
638
- }
639
- if (options.hasDocTools) {
640
- lines.push(
641
- "- \u5F53\u4EFB\u52A1\u9700\u8981 24h \u8FDE\u7EED\u8FD0\u884C\u3001\u8DE8 dialog \u63A5\u529B\u6216\u4EBA\u5DE5\u4E0E agent \u5171\u8BFB\u65F6\uFF0C\u4F18\u5148\u628A mission / runbook / incident / checkpoint / idea backlog / experiment log \u5199\u5165 doc layer\u3002"
642
- );
643
- }
644
- return lines.join("\n");
645
- };
646
-
647
- // packages/ai/agent/startupProtocol.ts
648
- var buildStartupProtocolBlock = (options = {}) => {
649
- const lines = [
650
- "--- \u542F\u52A8\u534F\u8BAE ---",
651
- "\u542F\u52A8\u987A\u5E8F\uFF1A",
652
- "1. \u5148\u8BFB\u53D6 policy / knowledge\uFF1A\u4F60\u7684\u6838\u5FC3 prompt\u3001\u81EA\u52A8\u52A0\u8F7D\u7684 references\u3001\u4EE5\u53CA\u7528\u6237\u7B56\u7565\u7EA6\u675F\u3002",
653
- "2. \u518D\u63D0\u70BC current mission\uFF1A\u4F18\u5148\u4ECE\u5F53\u524D\u7528\u6237\u8F93\u5165\u548C\u5F53\u524D\u8F93\u5165\u4E0A\u4E0B\u6587\u91CC\u786E\u8BA4\u672C\u8F6E\u76EE\u6807\u3001\u4EA4\u4ED8\u7269\u548C\u505C\u6B62\u6761\u4EF6\u3002",
654
- "3. \u518D\u5438\u6536 recent memory\uFF1A\u7ED3\u5408 Memory Overlay\u3001\u5386\u53F2\u6458\u8981\u3001\u6700\u8FD1\u5DE5\u4F5C\u8BB0\u5FC6\u548C\u5FC5\u8981\u7684\u5386\u53F2\u5F15\u7528\uFF0C\u53EA\u4FDD\u7559\u5BF9\u672C\u8F6E\u771F\u6B63\u6709\u5E2E\u52A9\u7684\u90E8\u5206\u3002",
655
- "4. \u9700\u8981\u65F6\u518D\u8BFB\u53D6 doc\uFF1A\u5982\u679C\u4EFB\u52A1\u6D89\u53CA\u8DE8\u8F6E\u6B21\u63A5\u529B\u3001\u8FD0\u884C\u624B\u518C\u6216\u5171\u4EAB\u5DE5\u4F5C\u53F0\uFF0C\u8BFB\u53D6\u76F8\u5173 doc \u83B7\u53D6\u6700\u65B0\u72B6\u6001\u3002",
656
- "",
657
- "\u5728\u7B2C\u4E00\u6B21\u5DE5\u5177\u8C03\u7528\u524D\uFF0C\u5148\u5F62\u6210\u4E00\u4EFD\u5185\u90E8 working state\uFF0C\u81F3\u5C11\u5305\u542B\uFF1A",
658
- "- current_goal\uFF1A\u8FD9\u4E00\u8F6E\u771F\u6B63\u8981\u5B8C\u6210\u4EC0\u4E48",
659
- "- constraints\uFF1A\u5F53\u524D\u7EA6\u675F\u3001\u504F\u597D\u3001\u8FB9\u754C\u6761\u4EF6",
660
- "- missing_facts\uFF1A\u8FD8\u7F3A\u54EA\u4E9B\u4E8B\u5B9E\u624D\u80FD\u5B89\u5168\u884C\u52A8",
661
- "- next_action\uFF1A\u4E0B\u4E00\u6B65\u6700\u5C0F\u4E14\u9AD8\u4EF7\u503C\u7684\u52A8\u4F5C",
662
- "",
663
- "\u51B3\u7B56\u89C4\u5219\uFF1A",
664
- "- \u5982\u679C policy / knowledge \u5DF2\u7ECF\u8DB3\u591F\u56DE\u7B54\uFF0C\u5C31\u76F4\u63A5\u56DE\u7B54\uFF0C\u4E0D\u8981\u4E3A\u4E86\u663E\u5F97\u5FD9\u800C\u4E71\u8C03\u7528\u5DE5\u5177\u3002",
665
- "- \u5982\u679C recent memory \u4E0E\u5F53\u524D\u7528\u6237\u8F93\u5165\u51B2\u7A81\uFF0C\u4EE5\u5F53\u524D\u7528\u6237\u8F93\u5165\u4E3A\u51C6\u3002",
666
- "- \u5982\u679C\u9700\u8981\u4F9D\u8D56\u73AF\u5883\u3001\u6587\u4EF6\u72B6\u6001\u3001\u8FD0\u884C\u65F6\u4E8B\u5B9E\u6216\u5916\u90E8\u771F\u503C\uFF0C\u5148\u9A8C\u8BC1\uFF0C\u518D\u884C\u52A8\u3002",
667
- "- \u4F18\u5148\u5C0F\u6B65\u63A8\u8FDB\uFF1B\u6BCF\u4E00\u8F6E\u5148\u505A\u6700\u80FD\u964D\u4F4E\u4E0D\u786E\u5B9A\u6027\u7684\u52A8\u4F5C\u3002"
668
- ];
669
- if (options.hasCheckEnvTool || options.hasExecShellTool) {
670
- lines.push(
671
- "- \u53EA\u8981\u4EFB\u52A1\u6D89\u53CA\u547D\u4EE4\u6267\u884C\u3001shell \u8BED\u6CD5\u3001\u8DEF\u5F84\u7EA6\u5B9A\u3001\u8FD0\u884C\u5E73\u53F0\u6216\u670D\u52A1\u72B6\u6001\uFF0C\u5E76\u4E14\u8FD9\u4E9B\u4E8B\u5B9E\u8FD8\u4E0D\u591F\u660E\u786E\uFF0C\u5C31\u5148\u786E\u8BA4\u73AF\u5883\u3002"
672
- );
673
- }
674
- if (options.hasCheckEnvTool) {
675
- lines.push(
676
- "- \u73AF\u5883\u4E0D\u660E\u786E\u65F6\uFF0C\u4F18\u5148\u8C03\u7528 checkEnv({ check: 'context' })\uFF0C\u518D\u51B3\u5B9A\u540E\u7EED\u547D\u4EE4\u548C\u5DE5\u5177\u8DEF\u5F84\u3002"
677
- );
678
- }
679
- if (options.hasExecShellTool) {
680
- lines.push(
681
- "- \u9700\u8981\u6267\u884C\u547D\u4EE4\u65F6\uFF0C\u5148\u6839\u636E\u5DF2\u786E\u8BA4\u7684\u73AF\u5883\u9009\u62E9 shell\uFF1BWindows \u9ED8\u8BA4 PowerShell\uFF0CLinux/macOS \u9ED8\u8BA4 bash\u3002"
682
- );
683
- lines.push(
684
- "- \u5982\u679C\u53EA\u662F\u6536\u96C6\u591A\u4E2A\u53EA\u8BFB\u73AF\u5883\u4E8B\u5B9E\uFF0C\u4F18\u5148\u5408\u5E76\u6210\u4E00\u6B21 shell \u8C03\u7528\u6216\u4E00\u6761\u7EC4\u5408\u547D\u4EE4\uFF0C\u907F\u514D\u62C6\u6210\u5F88\u591A\u5C0F\u63A2\u9488\u3002"
685
- );
686
- }
687
- return lines.join("\n");
688
- };
689
-
690
- // packages/ai/agent/runtimeGuidance.ts
691
- var normalizeToolName = (name) => name.replace(/[-_]/g, "").toLowerCase();
692
- var hasAnyTool = (normalizedTools, candidates) => candidates.some((candidate) => normalizedTools.has(normalizeToolName(candidate)));
693
- var hasAllTools = (normalizedTools, candidates) => candidates.every((candidate) => normalizedTools.has(normalizeToolName(candidate)));
694
- var buildEmailRegistrationWorkflowBlock = (enabled) => {
695
- if (!enabled) return "";
696
- return [
697
- "--- \u90AE\u7BB1\u9A8C\u8BC1\u7801\u6CE8\u518C\u6D41\u7A0B ---",
698
- "\u5F53\u7528\u6237\u8981\u6C42\u4F60\u6CE8\u518C\u7F51\u7AD9\u8D26\u53F7\u65F6\uFF0C\u53EA\u5141\u8BB8\u5904\u7406\u7528\u6237\u660E\u786E\u6307\u5B9A\u7684\u5F53\u524D\u76EE\u6807\u7F51\u7AD9\uFF0C\u4E0D\u8981\u81EA\u884C\u6269\u5C55\u5230\u5176\u4ED6\u7F51\u7AD9\u3001\u6279\u91CF\u6CE8\u518C\u6216\u89C4\u907F\u5E73\u53F0\u98CE\u63A7\u3002",
699
- "",
700
- "\u5206\u9636\u6BB5\u534F\u8BAE\uFF1Adiscover before acting -> assess supportability -> register -> verify -> closeout\u3002",
701
- "",
702
- "\u63A8\u8350\u6D41\u7A0B\uFF1A",
703
- "1. discover before acting\uFF1A\u5148\u7528 browser_openSession / browser_readContent \u9605\u8BFB\u9875\u9762\uFF0C\u786E\u8BA4\u76EE\u6807\u6CE8\u518C\u9875 URL\u3001\u8D26\u53F7\u7528\u9014\u3001\u5FC5\u586B\u9879\u548C\u505C\u6B62\u6761\u4EF6\uFF1B\u4E0D\u8981\u4E00\u6253\u5F00\u9875\u9762\u5C31\u76F2\u70B9\u6309\u94AE\u3002\u5982\u679C\u7F3A\u5C11\u76EE\u6807\u7F51\u7AD9\uFF0C\u5148\u8BE2\u95EE\u7528\u6237\u3002",
704
- "2. assess supportability\uFF1A\u5148\u5224\u65AD\u8BE5\u6D41\u7A0B\u662F\u5426\u652F\u6301\u5F53\u524D\u53D7\u63A7\u81EA\u52A8\u5316\u3002\u9047\u5230 CAPTCHA\u3001\u624B\u673A\u53F7\u9A8C\u8BC1\u3001\u652F\u4ED8\u3001\u8EAB\u4EFD/KYC\u3001OAuth-only\u3001\u670D\u52A1\u6761\u6B3E\u786E\u8BA4\u3001\u6216\u4EFB\u4F55\u770B\u8D77\u6765\u50CF\u89C4\u907F\u98CE\u63A7\u7684\u6B65\u9AA4\u65F6\uFF0C\u5FC5\u987B\u7ACB\u5373\u505C\u6B62\u5E76\u5411\u7528\u6237\u8BF4\u660E blockingReason\uFF1B\u4E0D\u8981\u786C\u95EF\u3002",
705
- "3. register\uFF1A\u53EA\u6709\u5728\u786E\u8BA4\u652F\u6301\u540E\uFF0C\u624D\u4F7F\u7528 email_provision_identity \u4E3A\u5F53\u524D agent \u751F\u6210\u53D7\u63A7\u57DF\u540D\u90AE\u7BB1\u8EAB\u4EFD\uFF0C\u518D\u4F7F\u7528 browser_openSession / browser_typeText / browser_click / browser_readContent \u586B\u5199\u5E76\u63D0\u4EA4\u6CE8\u518C\u8868\u5355\u3002",
706
- "4. verify\uFF1A\u63D0\u4EA4\u540E\u4F7F\u7528 email_wait_for \u7B49\u5F85\u8BE5 agent \u6536\u4EF6\u7BB1\u91CC\u7684\u9A8C\u8BC1\u90AE\u4EF6\uFF0C\u518D\u7528 email_extract_verification \u63D0\u53D6\u9A8C\u8BC1\u7801\u6216\u9A8C\u8BC1\u94FE\u63A5\uFF0C\u56DE\u586B\u9A8C\u8BC1\u7801\u6216\u6253\u5F00\u9A8C\u8BC1\u94FE\u63A5\u5B8C\u6210\u9A8C\u8BC1\u3002",
707
- "5. closeout\uFF1A\u65E0\u8BBA\u6210\u529F\u8FD8\u662F\u5931\u8D25\u90FD\u8981 always close sessions\uFF0C\u4E3B\u52A8\u6E05\u7406\u6D4F\u89C8\u5668\u4F1A\u8BDD\uFF08\u4F8B\u5982 browser_closeSession\uFF09\u3002\u5982\u679C\u6D41\u7A0B\u5931\u8D25\uFF0C\u5FC5\u987B\u660E\u786E failedStage \u4E0E blockingReason\uFF0C\u5E76\u8BF4\u660E\u53EF\u6062\u590D\u9009\u9879\uFF1B\u4E0D\u8981\u76F2\u76EE\u5C1D\u8BD5\u65E0\u5173\u7F51\u7AD9\u6216\u7ED5\u8FC7\u9A8C\u8BC1\u3002",
708
- "6. \u6700\u7EC8\u53EA\u5728\u5BF9\u8BDD\u4E2D\u8FD4\u56DE\u8D26\u53F7\u3001\u90AE\u7BB1\u548C\u4E00\u6B21\u6027\u751F\u6210\u7684\u5BC6\u7801\uFF1B\u4E0D\u8981\u6301\u4E45\u5316\u5BC6\u7801\uFF0C\u4E0D\u8981\u5199\u5165 agent metadata\u3001\u6570\u636E\u5E93\u3001\u6587\u6863\u6216\u8BB0\u5FC6\u3002",
709
- "",
710
- "\u5FC5\u987B\u6682\u505C\u5E76\u8BE2\u95EE\u7528\u6237\u7684\u60C5\u51B5\uFF1ACAPTCHA\u3001\u624B\u673A\u53F7\u9A8C\u8BC1\u3001\u652F\u4ED8\u3001\u8EAB\u4EFD/KYC\u3001OAuth \u6388\u6743\u3001OAuth-only\u3001\u670D\u52A1\u6761\u6B3E\u786E\u8BA4\u3001\u6216\u4EFB\u4F55\u770B\u8D77\u6765\u50CF\u89C4\u907F\u98CE\u63A7\u7684\u6B65\u9AA4\u3002",
711
- "\u5982\u679C\u6D41\u7A0B\u5931\u8D25\uFF0C\u8BF4\u660E failedStage\u3001blockingReason \u548C\u53EF\u6062\u590D\u9009\u9879\uFF0C\u4E0D\u8981\u76F2\u76EE\u5C1D\u8BD5\u65E0\u5173\u7F51\u7AD9\u6216\u7ED5\u8FC7\u9A8C\u8BC1\u3002"
712
- ].join("\n");
713
- };
714
- var buildWebResearchToolPolicyBlock = (hasExecShellTool, hasFetchWebpageTool) => {
715
- if (!hasExecShellTool || !hasFetchWebpageTool) return "";
716
- return [
717
- "--- \u751F\u4EA7\u73AF\u5883\u7F51\u9875\u7814\u7A76\u5DE5\u5177\u7B56\u7565 ---",
718
- "\u751F\u4EA7\u73AF\u5883\u7F51\u9875\u7814\u7A76\u4F18\u5148\u4F7F\u7528 fetchWebpage\u3001\u7AD9\u70B9 Markdown / llms.txt\u3001\u6216\u4E13\u7528\u6D4F\u89C8/\u641C\u7D22\u5DE5\u5177\u3002",
719
- "\u4E0D\u8981\u7528 execShell \u8C03 curl\u3001grep\u3001sed \u7B49\u547D\u4EE4\u6293\u7F51\u9875\u6216\u622A\u53D6\u7F51\u9875\u6BB5\u843D\uFF1B\u751F\u4EA7\u73AF\u5883\u901A\u5E38\u4F1A\u7981\u7528 dev shell\uFF0C\u53CD\u590D\u5C1D\u8BD5\u53EA\u4F1A\u6D6A\u8D39\u56DE\u5408\u3002",
720
- "\u5982\u679C\u7F51\u9875\u5185\u5BB9\u8FC7\u957F\u6216\u951A\u70B9\u6BB5\u843D\u6CA1\u6709\u88AB\u5355\u72EC\u63D0\u53D6\uFF0C\u5148\u5BFB\u627E\u8BE5\u6587\u6863\u7AD9\u63D0\u4F9B\u7684 Markdown \u7248\u672C\u3001\u72EC\u7ACB\u9875\u9762\u3001llms.txt \u7D22\u5F15\u6216\u66F4\u5177\u4F53 URL\uFF0C\u518D\u7EE7\u7EED\u56DE\u7B54\u3002"
721
- ].join("\n");
722
- };
723
- var resolveRuntimeGuidanceToolOptions = (tools = []) => {
724
- const normalizedTools = canonicalizeToolNames(tools);
725
- const normalizedToolSet = new Set(normalizedTools.map(normalizeToolName));
726
- const hasBrowserTools = hasAllTools(normalizedToolSet, [
727
- "browser_openSession",
728
- "browser_readContent",
729
- "browser_typeText",
730
- "browser_click",
731
- "browser_closeSession"
732
- ]);
733
- const hasBrowserProbe = hasAnyTool(normalizedToolSet, ["browser_probePage", "browserProbePage"]);
734
- const hasEmailRegistrationTools = hasAllTools(normalizedToolSet, [
735
- "email_provision_identity",
736
- "email_wait_for",
737
- "email_extract_verification"
738
- ]);
739
- return {
740
- hasCheckEnvTool: normalizedTools.includes("checkEnv"),
741
- hasExecShellTool: normalizedTools.includes("execShell"),
742
- hasRememberMemoryTool: normalizedTools.includes("rememberMemory"),
743
- hasDocTools: normalizedTools.some(
744
- (tool) => ["read", "readDoc", "readPage", "createDoc", "updateDoc"].includes(tool)
745
- ),
746
- hasBrowserTools,
747
- hasEmailRegistrationTools,
748
- // Require browser_probePage to be present before enabling email registration workflow guidance.
749
- hasEmailRegistrationWorkflow: hasBrowserTools && hasBrowserProbe && hasEmailRegistrationTools
750
- };
751
- };
752
- var buildRuntimeGuidanceBlocks = (tools = []) => {
753
- const options = resolveRuntimeGuidanceToolOptions(tools);
754
- const normalizedTools = canonicalizeToolNames(tools);
755
- return {
756
- startupProtocol: buildStartupProtocolBlock({
757
- hasCheckEnvTool: options.hasCheckEnvTool,
758
- hasExecShellTool: options.hasExecShellTool
759
- }),
760
- contextLayerContract: buildContextLayerContractBlock({
761
- hasRememberMemoryTool: options.hasRememberMemoryTool,
762
- hasDocTools: options.hasDocTools
763
- }),
764
- emailRegistrationWorkflow: buildEmailRegistrationWorkflowBlock(
765
- options.hasEmailRegistrationWorkflow
766
- ),
767
- webResearchToolPolicy: buildWebResearchToolPolicyBlock(
768
- options.hasExecShellTool,
769
- normalizedTools.includes("fetchWebpage")
770
- )
771
- };
772
- };
773
-
774
584
  // packages/ai/agent/pageBuilderHandoffRules.ts
775
585
  var PAGE_BUILDER_AGENT_PUBLIC_KEY = "agent-pub-01PAGEBUILDR00000000FT7R9G";
776
586
  var PAGE_BUILDER_SCENARIOS = [
@@ -873,8 +683,12 @@ var compileContextLayers = (layers) => {
873
683
  stablePrefixLayers.push(layer);
874
684
  }
875
685
  const stablePrefixContent = stablePrefixLayers.map((layer) => layer.content).join("\n\n");
686
+ const dynamicLayers = compiledLayers.slice(stablePrefixLayers.length);
687
+ const dynamicContent = dynamicLayers.map((layer) => layer.content).join("\n\n");
876
688
  return {
877
689
  content: compiledLayers.map((layer) => layer.content).join("\n\n"),
690
+ stablePrefixContent,
691
+ dynamicContent,
878
692
  layers: compiledLayers,
879
693
  cacheProfile: {
880
694
  stablePrefixHash: createHash("sha256").update(stablePrefixContent).digest("hex"),
@@ -885,62 +699,6 @@ var compileContextLayers = (layers) => {
885
699
  };
886
700
  };
887
701
 
888
- // packages/ai/agent/currentTimeContext.ts
889
- var pad2 = (value) => String(value).padStart(2, "0");
890
- var resolveDefaultTimeZone = () => {
891
- try {
892
- return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
893
- } catch {
894
- return "UTC";
895
- }
896
- };
897
- var partsForTimeZone = (date, timeZone) => {
898
- const parts = new Intl.DateTimeFormat("en-US", {
899
- timeZone,
900
- year: "numeric",
901
- month: "2-digit",
902
- day: "2-digit",
903
- hour: "2-digit",
904
- minute: "2-digit",
905
- second: "2-digit",
906
- hour12: false
907
- }).formatToParts(date);
908
- return Object.fromEntries(
909
- parts.filter((part) => part.type !== "literal").map((part) => [part.type, part.value])
910
- );
911
- };
912
- var zonedDateTime = (date, timeZone) => {
913
- const parts = partsForTimeZone(date, timeZone);
914
- return [
915
- `${parts.year}-${parts.month}-${parts.day}`,
916
- `${parts.hour}:${parts.minute}:${parts.second}`
917
- ].join(" ");
918
- };
919
- var timeZoneOffset = (date, timeZone) => {
920
- const parts = partsForTimeZone(date, timeZone);
921
- const utcMs = Date.UTC(
922
- Number(parts.year),
923
- Number(parts.month) - 1,
924
- Number(parts.day),
925
- Number(parts.hour),
926
- Number(parts.minute),
927
- Number(parts.second)
928
- );
929
- const offsetMinutes = Math.round((utcMs - date.getTime()) / 6e4);
930
- const sign = offsetMinutes >= 0 ? "+" : "-";
931
- const absolute = Math.abs(offsetMinutes);
932
- return `UTC${sign}${pad2(Math.floor(absolute / 60))}:${pad2(absolute % 60)}`;
933
- };
934
- var buildCurrentTimeBlock = (now = /* @__PURE__ */ new Date(), timeZone = resolveDefaultTimeZone()) => [
935
- "--- \u5F53\u524D\u65F6\u95F4 ---",
936
- `\u5F53\u524D\u65E5\u671F: ${zonedDateTime(now, timeZone).slice(0, 10)}`,
937
- `\u5F53\u524D\u672C\u5730\u65F6\u95F4: ${zonedDateTime(now, timeZone)}`,
938
- `\u672C\u5730\u65F6\u533A: ${timeZone} / ${timeZoneOffset(now, timeZone)}`,
939
- `UTC \u65F6\u95F4: ${now.toISOString()}`,
940
- "\u5F53\u7528\u6237\u95EE\u201C\u73B0\u5728\u201D\u201C\u5F53\u524D\u65F6\u95F4\u201D\u201C\u5317\u4EAC\u65F6\u95F4\u201D\u7B49\u65F6\u95F4\u95EE\u9898\u65F6\uFF0C\u76F4\u63A5\u4F7F\u7528\u8FD9\u91CC\u7684\u5F53\u524D\u65F6\u95F4\uFF1B\u4E0D\u8981\u53EA\u56DE\u7B54\u65E5\u671F\u3002",
941
- "\u5F53\u7528\u6237\u8BF4\u201C\u4ECA\u5929\u201D\u201C\u4ECA\u65E5\u201D\u6216 today \u65F6\uFF0C\u9ED8\u8BA4\u6307\u5F53\u524D\u672C\u5730\u65E5\u671F\uFF0C\u9664\u975E\u7528\u6237\u660E\u786E\u7ED9\u51FA\u5176\u5B83\u65E5\u671F\u3002"
942
- ].join("\n");
943
-
944
702
  // packages/ai/agent/buildSystemPrompt.ts
945
703
  var CONTEXT_USAGE_INSTRUCTIONS = `\u53C2\u8003\u8D44\u6599\u4F7F\u7528\u8BF4\u660E\uFF1A
946
704
  - \u4E0B\u65B9\u63D0\u4F9B\u7684\u8D44\u6599\u662F\u4F60\u7684\u4E3B\u8981\u6743\u5A01\u4FE1\u606F\u6765\u6E90\u3002
@@ -1181,13 +939,12 @@ var buildSystemPromptContext = (options) => {
1181
939
  const safeLanguage = options.language ?? (typeof navigator !== "undefined" ? navigator.language : "en");
1182
940
  const { name, prompt: mainPrompt, dbKey, model } = agentConfig;
1183
941
  const mappedLanguage = mapLanguage(safeLanguage);
1184
- const identitySection = [
1185
- "--- \u8EAB\u4EFD\u4FE1\u606F ---",
1186
- name ? `\u540D\u79F0: ${name} ` : "",
1187
- dbKey ? `ID: ${dbKey} ` : "",
1188
- model ? `\u6A21\u578B: ${model} ` : "",
1189
- mappedLanguage ? `\u56DE\u590D\u8BED\u8A00: ${mappedLanguage} ` : ""
1190
- ].filter(Boolean).join("\n");
942
+ const identitySection = buildIdentityBlock({
943
+ agentName: name,
944
+ agentId: dbKey,
945
+ model,
946
+ responseLanguage: mappedLanguage
947
+ });
1191
948
  const corePersonaSection = mainPrompt ? `-- - \u6838\u5FC3\u89D2\u8272\u4E0E\u4EFB\u52A1-- -
1192
949
  ${mainPrompt}` : "";
1193
950
  const agentTools = canonicalizeToolNames(agentConfig.tools ?? []);
@@ -1208,13 +965,15 @@ ${contexts.userGlobalPrompt.trim()} ` : "";
1208
965
  const appWorkingMemorySection = buildAppWorkingMemoryBlock(contexts);
1209
966
  const spaceContextSection = buildSpaceContextBlock(contexts);
1210
967
  const rawMemoryOverlay = asOptionalTrimmedString(contexts.memoryOverlay) ?? "";
1211
- const memoryOverlaySection = rawMemoryOverlay ? rawMemoryOverlay + "\n\n" + MEMORY_USE_GUIDANCE : "";
968
+ const memoryOverlaySection = rawMemoryOverlay;
969
+ const hasMemoryTools = Array.isArray(agentConfig.tools) && agentConfig.tools.some(
970
+ (t) => /memory/i.test(t)
971
+ );
972
+ const memoryUseGuidanceSection = hasMemoryTools ? MEMORY_USE_GUIDANCE : "";
1212
973
  const skillGuidanceSection = buildSkillGuidanceBlock(agentConfig);
1213
974
  const referenceMaterialsSection = buildReferenceMaterialsBlock(contexts);
1214
975
  const dialogSummarySection = contexts.dialogSummary?.trim() ? `--- \u5386\u53F2\u5BF9\u8BDD\u6458\u8981 ---
1215
976
  ${wrapHistoricalSummaryWithReplayGuard(contexts.dialogSummary)}` : "";
1216
- const proactiveSummarySection = contexts.proactiveSummary?.trim() ? `--- \u9636\u6BB5\u5DE5\u4F5C\u6458\u8981 ---
1217
- ${wrapHistoricalSummaryWithReplayGuard(contexts.proactiveSummary)}` : "";
1218
977
  return compileContextLayers([
1219
978
  { id: "identity", owner: "platform", cacheScope: "session", content: identitySection },
1220
979
  { id: "startup-protocol", owner: "platform", cacheScope: "static", content: startupProtocol },
@@ -1242,13 +1001,13 @@ ${wrapHistoricalSummaryWithReplayGuard(contexts.proactiveSummary)}` : "";
1242
1001
  },
1243
1002
  { id: "user-global-prompt", owner: "user", cacheScope: "session", content: userGlobalPromptSection },
1244
1003
  { id: "response-guidelines", owner: "platform", cacheScope: "session", content: responseGuidelinesSection },
1245
- { id: "skill-guidance", owner: "runtime", cacheScope: "turn", content: skillGuidanceSection },
1246
- { id: "space-context", owner: "runtime", cacheScope: "turn", content: spaceContextSection },
1004
+ { id: "skill-guidance", owner: "runtime", cacheScope: "session", content: skillGuidanceSection },
1005
+ { id: "space-context", owner: "runtime", cacheScope: "session", content: spaceContextSection },
1006
+ { id: "memory-use-guidance", owner: "platform", cacheScope: "session", content: memoryUseGuidanceSection },
1247
1007
  { id: "reference-materials", owner: "agent", cacheScope: "turn", content: referenceMaterialsSection },
1248
1008
  { id: "memory-overlay", owner: "runtime", cacheScope: "turn", content: memoryOverlaySection },
1249
1009
  { id: "app-working-memory", owner: "runtime", cacheScope: "turn", content: appWorkingMemorySection },
1250
1010
  { id: "dialog-summary", owner: "runtime", cacheScope: "turn", content: dialogSummarySection },
1251
- { id: "proactive-summary", owner: "runtime", cacheScope: "turn", content: proactiveSummarySection },
1252
1011
  { id: "editing-context", owner: "runtime", cacheScope: "turn", content: editingContextSection },
1253
1012
  {
1254
1013
  id: "current-time",
@@ -1276,30 +1035,36 @@ var normalizeChatCompletionsBodyForProvider = ({
1276
1035
 
1277
1036
  // packages/integrations/openai/generateOpenAIRequestBody.ts
1278
1037
  var isClaudeModel = (model) => !!model && (model.includes("claude") || model.includes("anthropic"));
1279
- var applyClaudeCache = (content) => {
1280
- if (typeof content === "string") {
1281
- return [
1282
- { type: "text", text: content, cache_control: { type: "ephemeral" } }
1283
- ];
1284
- }
1285
- if (Array.isArray(content)) {
1286
- const lastIdx = content.length - 1;
1287
- return content.map((part, idx) => {
1288
- if (idx === lastIdx && typeof part === "object") {
1289
- return { ...part, cache_control: { type: "ephemeral" } };
1290
- }
1291
- return part;
1038
+ var applyClaudeCache = (stableContent, dynamicContent) => {
1039
+ const parts = [];
1040
+ if (stableContent.trim()) {
1041
+ parts.push({
1042
+ type: "text",
1043
+ text: stableContent,
1044
+ cache_control: { type: "ephemeral" }
1292
1045
  });
1293
1046
  }
1294
- return content;
1047
+ if (dynamicContent.trim()) {
1048
+ parts.push({ type: "text", text: dynamicContent });
1049
+ }
1050
+ return parts.length > 0 ? parts : stableContent;
1295
1051
  };
1296
1052
  var prependPromptMessage = (messages, agentConfig, resolvedModel, language, contexts, prependSystemPrompt = true) => {
1297
1053
  if (!prependSystemPrompt) return messages;
1298
1054
  if (!contexts && !agentConfig.prompt) return messages;
1055
+ if (isClaudeModel(resolvedModel)) {
1056
+ const compiled = buildSystemPromptContext({ agentConfig, language, contexts });
1057
+ if (!compiled.content.trim()) return messages;
1058
+ const content = applyClaudeCache(
1059
+ compiled.stablePrefixContent,
1060
+ compiled.dynamicContent
1061
+ );
1062
+ const systemMessage2 = { role: "system", content };
1063
+ return [systemMessage2, ...messages];
1064
+ }
1299
1065
  const promptContent = buildSystemPrompt({ agentConfig, language, contexts });
1300
1066
  if (!promptContent.trim()) return messages;
1301
- const content = isClaudeModel(resolvedModel) ? applyClaudeCache(promptContent) : promptContent;
1302
- const systemMessage = { role: "system", content };
1067
+ const systemMessage = { role: "system", content: promptContent };
1303
1068
  return [systemMessage, ...messages];
1304
1069
  };
1305
1070
  var shouldInjectLlamaCppThinkingToggle = (agentConfig) => {
@@ -1380,10 +1145,23 @@ var generateOpenAIRequestBody = (agentConfig, providerName, messages, contexts,
1380
1145
  let processedStable = [...stableMessages];
1381
1146
  if (isClaudeModel(resolvedModel) && processedStable.length > 0) {
1382
1147
  const lastStableIdx = processedStable.length - 1;
1383
- processedStable[lastStableIdx] = {
1384
- ...processedStable[lastStableIdx],
1385
- content: applyClaudeCache(processedStable[lastStableIdx].content)
1386
- };
1148
+ const lastContent = processedStable[lastStableIdx].content;
1149
+ if (typeof lastContent === "string") {
1150
+ processedStable[lastStableIdx] = {
1151
+ ...processedStable[lastStableIdx],
1152
+ content: [
1153
+ { type: "text", text: lastContent, cache_control: { type: "ephemeral" } }
1154
+ ]
1155
+ };
1156
+ } else if (Array.isArray(lastContent)) {
1157
+ const lastPartIdx = lastContent.length - 1;
1158
+ processedStable[lastStableIdx] = {
1159
+ ...processedStable[lastStableIdx],
1160
+ content: lastContent.map(
1161
+ (part, idx) => idx === lastPartIdx && typeof part === "object" ? { ...part, cache_control: { type: "ephemeral" } } : part
1162
+ )
1163
+ };
1164
+ }
1387
1165
  }
1388
1166
  const fullMessages = [...processedStable, ...messages];
1389
1167
  const messagesWithPrompt = prependPromptMessage(
@@ -1930,7 +1708,6 @@ var fetchDialogReference = async (dbKey, refContent, dispatch) => {
1930
1708
  const dialogId = extractCustomId(dbKey) || dbKey.replace(/^dialog-/, "");
1931
1709
  const checkpoint = dialogConfig.runtimeCheckpoint || null;
1932
1710
  const summary = asTrimmedString(dialogConfig.summary);
1933
- const proactiveSummary = asTrimmedString(dialogConfig.proactiveSummary);
1934
1711
  const messages = await dispatch(
1935
1712
  async (_dispatch, getState, { db }) => {
1936
1713
  const state = getState();
@@ -1975,7 +1752,6 @@ var fetchDialogReference = async (dbKey, refContent, dispatch) => {
1975
1752
  `- Use this when continuing work, transferring to another Agent, comparing with the current task, or preparing a document/plan from the prior discussion.`,
1976
1753
  `- Current state source: ${checkpointLines.length ? "Runtime Checkpoint" : "summaries and recent transcript"}.`,
1977
1754
  summary ? `- Compressed background: passive summary is available below; treat it as lossy, not original wording.` : "",
1978
- proactiveSummary ? `- Recent work: proactive summary is available below; use it for current direction, not exact evidence.` : "",
1979
1755
  recentToolEvidence.length ? `- Recent tool evidence:
1980
1756
  ${recentToolEvidence.join("\n")}` : `- Recent tool evidence: none loaded in the latest ${DIALOG_REFERENCE_MESSAGE_LIMIT} messages.`,
1981
1757
  `- 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}.`
@@ -1992,8 +1768,6 @@ ${handoffLines.join("\n")}`,
1992
1768
  ${checkpointLines.join("\n")}` : "",
1993
1769
  summary ? `Passive Summary (compressed history, not original wording):
1994
1770
  ${wrapHistoricalSummaryWithReplayGuard(summary)}` : "",
1995
- proactiveSummary ? `Proactive Summary (recent work summary, not original wording):
1996
- ${wrapHistoricalSummaryWithReplayGuard(proactiveSummary)}` : "",
1997
1771
  `Recent Transcript (original message excerpts, oldest to newest):
1998
1772
  ${transcript || "[no recent messages loaded]"}`,
1999
1773
  [
@@ -1,3 +1,6 @@
1
+ import {
2
+ asNonEmptyStringArray
3
+ } from "./chunk-I42VC5KR.js";
1
4
  import {
2
5
  asOptionalFiniteNumber
3
6
  } from "./chunk-WWC7I6TA.js";
@@ -2568,17 +2571,6 @@ var require_rambda = __commonJS({
2568
2571
  }
2569
2572
  });
2570
2573
 
2571
- // packages/core/stringArray.ts
2572
- function asNonEmptyStringArray(value) {
2573
- if (!Array.isArray(value)) return [];
2574
- return value.filter(
2575
- (item) => typeof item === "string" && !!item.trim()
2576
- );
2577
- }
2578
- function asTrimmedNonEmptyStringArray(value) {
2579
- return asNonEmptyStringArray(value).map((item) => item.trim());
2580
- }
2581
-
2582
2574
  // packages/core/toTrimmedString.ts
2583
2575
  function toTrimmedString(value) {
2584
2576
  return typeof value === "string" ? value.trim() : value == null ? "" : String(value).trim();
@@ -3351,8 +3343,6 @@ var sanitizeShareData = (data) => {
3351
3343
  };
3352
3344
 
3353
3345
  export {
3354
- asNonEmptyStringArray,
3355
- asTrimmedNonEmptyStringArray,
3356
3346
  require_index_umd,
3357
3347
  ulid,
3358
3348
  toTrimmedString,
@@ -1,3 +1,7 @@
1
+ import {
2
+ MEMORY_USE_GUIDANCE
3
+ } from "./chunk-KKY4B2Q2.js";
4
+
1
5
  // packages/agent-runtime/modelLayerOverride.ts
2
6
  var MODEL_LAYER_KEYS = [
3
7
  "provider",
@@ -196,11 +200,27 @@ var buildLinkedSpacesSection = async (args) => {
196
200
  "\u63D0\u793A\uFF1A\u5982\u9700\u67E5\u8BE2\u8FD9\u4E9B\u7A7A\u95F4\u7684\u8BE6\u7EC6\u5185\u5BB9\uFF0C\u53EF\u4F7F\u7528 read \u5DE5\u5177\u914D\u5408\u5BF9\u5E94\u7684 dbKey\u3002"
197
201
  ].join("\n");
198
202
  };
203
+ var buildMemoryOverlayLayer = (args) => {
204
+ const promptBlock = asTrimmed(args.promptBlock);
205
+ if (!promptBlock) return null;
206
+ return makeLayer("memory-overlay", promptBlock);
207
+ };
208
+ var buildMemoryUseGuidanceLayer = (args) => {
209
+ const promptBlock = asTrimmed(args.promptBlock);
210
+ if (!promptBlock) return null;
211
+ return makeLayer(
212
+ "memory-use-guidance",
213
+ MEMORY_USE_GUIDANCE,
214
+ "session"
215
+ );
216
+ };
199
217
 
200
218
  export {
201
219
  buildModelLayerOverride,
202
220
  applyModelLayerOverride,
203
221
  buildSpaceContextLayer,
204
222
  buildSkillDiscoveryLayer,
205
- buildLinkedSpacesSection
223
+ buildLinkedSpacesSection,
224
+ buildMemoryOverlayLayer,
225
+ buildMemoryUseGuidanceLayer
206
226
  };
@@ -7,7 +7,7 @@ import {
7
7
  toTimestampMs,
8
8
  upsert,
9
9
  write
10
- } from "./chunk-G5H7RNFL.js";
10
+ } from "./chunk-COMXDWNM.js";
11
11
  import {
12
12
  asRecordOrEmpty
13
13
  } from "./chunk-KX6YBIHG.js";
@@ -15,7 +15,7 @@ import {
15
15
  createUserKey,
16
16
  createUserPreferenceKey,
17
17
  ulid
18
- } from "./chunk-PN7AFLOK.js";
18
+ } from "./chunk-SH2CFQOH.js";
19
19
  import {
20
20
  asTrimmedLowercaseString
21
21
  } from "./chunk-QSJ3HFEF.js";
@@ -919,8 +919,8 @@ var initialState = {
919
919
  editorTabSize: 2,
920
920
  editorFontFamily: "SF Mono, Monaco, Cascadia Code, Roboto Mono, monospace",
921
921
  enableReadCurrentSpace: true,
922
- globalPrompt: "\u4EE5\u4E0B\u662F\u5173\u4E8E\u6211\u7684\u901A\u7528\u8BF4\u660E\uFF0C\u8BF7\u5728\u4EFB\u610F\u573A\u666F\u4E0B\u90FD\u4EE5\u6B64\u6765\u7406\u89E3\u548C\u670D\u52A1\u6211\uFF1A\n1. \u6211\u5E0C\u671B\u4F60\u7528\u6E05\u6670\u3001\u7B80\u6D01\u7684\u65B9\u5F0F\u56DE\u7B54\u95EE\u9898\uFF0C\u5E76\u5728\u5FC5\u8981\u65F6\u7ED9\u51FA\u793A\u4F8B\u3002\n2. \u5982\u679C\u6709\u591A\u79CD\u89E3\u51B3\u65B9\u6848\uFF0C\u8BF7\u5148\u7ED9\u51FA\u63A8\u8350\u65B9\u6848\uFF0C\u518D\u7B80\u8981\u8BF4\u660E\u5176\u4ED6\u65B9\u6848\u7684\u4F18\u7F3A\u70B9\u3002\n3. \u5F53\u4F60\u4E0D\u786E\u5B9A\u7B54\u6848\u65F6\uFF0C\u8BF7\u660E\u786E\u8BF4\u660E\u4E0D\u786E\u5B9A\uFF0C\u5E76\u63A8\u6D4B\u53EF\u80FD\u7684\u65B9\u5411\uFF0C\u800C\u4E0D\u662F\u7F16\u9020\u4E8B\u5B9E\u3002\n4. \u5982\u679C\u6D89\u53CA\u4EE3\u7801\uFF0C\u8BF7\u4F18\u5148\u4F7F\u7528\u73B0\u4EE3\u3001\u901A\u7528\u7684\u6700\u4F73\u5B9E\u8DF5\u3002",
923
- userTonePreset: DEFAULT_USER_PREFERENCE_PROFILE.tone?.preset ?? "default",
922
+ globalPrompt: "",
923
+ userTonePreset: "",
924
924
  knowledgeCaptureLevel: DEFAULT_USER_PREFERENCE_PROFILE.knowledgeCaptureLevel,
925
925
  spaceContextLevel: DEFAULT_USER_PREFERENCE_PROFILE.spaceContextLevel,
926
926
  autoApproveSelfUpdateFields: [...DEFAULT_AUTO_APPROVED_SELF_UPDATE_FIELDS],
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-KTI2WDDG.js";
3
+ } from "./chunk-ZIG5LJ7X.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.js";
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  patch,
15
15
  readAndWait
16
- } from "./chunk-G5H7RNFL.js";
16
+ } from "./chunk-COMXDWNM.js";
17
17
  import {
18
18
  asOptionalTrimmedString
19
19
  } from "./chunk-G3SUCT4W.js";
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
367
367
  }
368
368
  }
369
369
  async function createDocState(args, thunkApi) {
370
- const { createPageAction } = await import("./createPageAction-EQNQQRCW.js");
370
+ const { createPageAction } = await import("./createPageAction-AL5FSDCK.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {