nolo-cli 0.8.0-alpha.14 → 0.8.0-alpha.19

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 (98) hide show
  1. package/README.md +1 -1
  2. package/{_executeModel-KBMAUV6G.js → _executeModel-BOMQGOZC.js} +33 -30
  3. package/{action-SQGI5JY5.js → action-AEHDRQHP.js} +4 -4
  4. package/{addContentAction-ZX2PUS3X.js → addContentAction-OL5YQ6LW.js} +3 -3
  5. package/{addDialogAgentAction-ULADQX2Q.js → addDialogAgentAction-XU5Y2E2X.js} +2 -2
  6. package/{agentDeleteCommand-GNVYHOGZ.js → agentDeleteCommand-5DD2IM3J.js} +12 -11
  7. package/{agentEmailCommands-QETL62SU.js → agentEmailCommands-SE7MBTAG.js} +35 -32
  8. package/{agentListCommands-FM4OWXYT.js → agentListCommands-I6KZYCIG.js} +13 -12
  9. package/{agentMachineCommands-LDHJBWQO.js → agentMachineCommands-SBYN6EXT.js} +13 -12
  10. package/{agentRecordCommands-UW76EZ25.js → agentRecordCommands-F74NBFOZ.js} +35 -32
  11. package/{agentRunCommand-UFBOW4ZF.js → agentRunCommand-3DGDK4Y3.js} +41 -36
  12. package/{agentRuntimeLocal-XL5PLRJV.js → agentRuntimeLocal-ZYEIPTY4.js} +9 -8
  13. package/{agentSlice-2IBSFH4O.js → agentSlice-XEH6Y334.js} +3 -3
  14. package/{authCommand-PXFX6JDT.js → authCommand-EB5JSOX5.js} +3 -3
  15. package/{authCommands-356AYWEK.js → authCommands-XPEHTKSM.js} +2 -2
  16. package/{chunk-QTFSBLCF.js → chunk-2BIV3FMX.js} +25 -236
  17. package/{chunk-ZDXZSXYQ.js → chunk-2NNJ6S5U.js} +1 -1
  18. package/{chunk-6A3LI5TZ.js → chunk-2T2C6CNY.js} +2 -2
  19. package/{chunk-2IRF4LEX.js → chunk-4NDK6NWB.js} +87 -114
  20. package/{chunk-SRLZ7IVA.js → chunk-4P2MDGKS.js} +78 -211
  21. package/{chunk-MXLQWBVM.js → chunk-4QEWT7KD.js} +33 -3
  22. package/{chunk-DSNONPGW.js → chunk-5KLGBAAR.js} +1 -1
  23. package/{chunk-6CBN7GGH.js → chunk-64AAZRGY.js} +4 -4
  24. package/{chunk-QKRUUZCL.js → chunk-6RSAUKSQ.js} +24 -13
  25. package/{chunk-TWPGVS2U.js → chunk-7DAJ4AI4.js} +2 -2
  26. package/{chunk-RLCFUU46.js → chunk-7KCUSYT2.js} +4 -10
  27. package/chunk-AFON4QUU.js +112 -0
  28. package/chunk-AGFH73SK.js +239 -0
  29. package/{chunk-572EKYLF.js → chunk-BBYVOSU2.js} +1 -1
  30. package/{chunk-2MALU52L.js → chunk-C3RUNRHT.js} +1 -1
  31. package/{chunk-SL35K7AH.js → chunk-C4FTUXVF.js} +2 -82
  32. package/{chunk-JRPR5M4O.js → chunk-C77B4AFC.js} +2 -2
  33. package/{chunk-USZMK5UT.js → chunk-DCOA4QSN.js} +1 -1
  34. package/{chunk-BKPVTIEK.js → chunk-FVYY6MCS.js} +3 -3
  35. package/{chunk-3TZDXYSF.js → chunk-HNW7IJSK.js} +1 -1
  36. package/{chunk-B6DFDN4R.js → chunk-IEKTE4JQ.js} +2 -2
  37. package/{chunk-BR2WP3DF.js → chunk-IWX4UW2E.js} +9 -9
  38. package/{chunk-MMRAIO5Y.js → chunk-IX4C5TCO.js} +3 -3
  39. package/{chunk-6XKX2N2E.js → chunk-JRCUAPXX.js} +1 -1
  40. package/{chunk-XDVAYP26.js → chunk-JRKKFRAV.js} +1 -1
  41. package/{chunk-V2AISYMA.js → chunk-KPSWSDUF.js} +2 -2
  42. package/chunk-LTRXGFMS.js +83 -0
  43. package/{chunk-PCWC3JTN.js → chunk-MTU75CZ2.js} +1 -1
  44. package/{chunk-DGFWICQJ.js → chunk-N54XAP77.js} +1 -1
  45. package/{chunk-SACYB45H.js → chunk-O2ZNTTET.js} +5 -5
  46. package/{chunk-SH2CFQOH.js → chunk-O4BU24WZ.js} +2 -181
  47. package/{chunk-PFUCDPUH.js → chunk-OFM4S5P3.js} +13 -13
  48. package/{chunk-VH4YK6KZ.js → chunk-OI54SUZ7.js} +6 -6
  49. package/{chunk-QO4YO77G.js → chunk-OZNNTJM7.js} +2 -2
  50. package/{chunk-DG7AAAR3.js → chunk-P3PKED2I.js} +62 -2
  51. package/{chunk-JW43YCM5.js → chunk-PY4NLIAF.js} +1 -1
  52. package/{chunk-7IPLJUYC.js → chunk-RL776AGR.js} +1 -1
  53. package/{chunk-EQHI2AR3.js → chunk-RM7KF6OT.js} +41 -22
  54. package/{chunk-RJKDVL4L.js → chunk-SDJDLO5W.js} +2 -2
  55. package/{chunk-RTZFUR3V.js → chunk-SHAFJ4TI.js} +3 -3
  56. package/{chunk-YYUCRDOK.js → chunk-SOTZ6RDN.js} +1 -1
  57. package/chunk-VC6OZXO5.js +298 -0
  58. package/{chunk-EXTIQUCI.js → chunk-VVX233PH.js} +1 -1
  59. package/{chunk-ZQ2UM4KG.js → chunk-WZSRQNQG.js} +1 -292
  60. package/{chunk-Q2YZULBH.js → chunk-XENYHRUE.js} +1 -1
  61. package/{chunk-VQ2AJRGD.js → chunk-YPRZSPF3.js} +1 -1
  62. package/{chunk-I6DI7SGU.js → chunk-YRG2GO6E.js} +222 -63
  63. package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
  64. package/{createAgentAutomationAction-CSWOQOY5.js → createAgentAutomationAction-MBUL3ALA.js} +12 -12
  65. package/{createDialogAction-6VWL2TDI.js → createDialogAction-3JLD4VED.js} +16 -15
  66. package/{createPageAction-INRC4MH2.js → createPageAction-Z2AOWGIW.js} +17 -16
  67. package/{dbSlice-TO2TSMWM.js → dbSlice-LSKJDY2R.js} +2 -2
  68. package/{dialogCommands-DWSE4PMW.js → dialogCommands-4IX4XIZE.js} +14 -13
  69. package/{dialogSlice-CELFVS3F.js → dialogSlice-NRQ5WIJO.js} +12 -12
  70. package/{docCreateCommands-UFJL5PUM.js → docCreateCommands-SIL3NPGT.js} +14 -12
  71. package/{docDeleteCommands-XHEIBAB2.js → docDeleteCommands-7IOMLUS4.js} +16 -14
  72. package/{docReadCommands-PEDIC2CW.js → docReadCommands-FNFXUA5L.js} +14 -12
  73. package/{docStore-Q5AFYT6G.js → docStore-DBFNPMHU.js} +13 -13
  74. package/{docUpdateCommands-WBRODQ7P.js → docUpdateCommands-X2HNDVUC.js} +14 -12
  75. package/{fetchMessages-U6ZHN56A.js → fetchMessages-KTNM7QAR.js} +2 -2
  76. package/{getPricing-PWPJ6MNV.js → getPricing-3E6UNPKL.js} +3 -3
  77. package/{handleSendMessageAction-PPIGKCBQ.js → handleSendMessageAction-G3WLT6I7.js} +12 -12
  78. package/index.js +45 -45
  79. package/{localDialogRead-Z5UTAJPU.js → localDialogRead-2VRI24F4.js} +1 -1
  80. package/{machineCommands-3D7JMHUP.js → machineCommands-GPEWO27H.js} +37 -34
  81. package/{machineWsRunDispatch-PA5BR4AX.js → machineWsRunDispatch-2LSYCV4S.js} +34 -31
  82. package/{models-XLEOET3E.js → models-4OPOOLFS.js} +2 -2
  83. package/package.json +3 -2
  84. package/{readlineWorkspace-7WPA5OUS.js → readlineWorkspace-UL4LXWHX.js} +252 -78
  85. package/{removeDialogAgentAction-3MUQGFZX.js → removeDialogAgentAction-U3CP2M2H.js} +4 -4
  86. package/{runAgentClientLoop-DRAXPP6R.js → runAgentClientLoop-KKV7BWWC.js} +27 -24
  87. package/{setDialogExtraReferencesAction-MXHX2HPK.js → setDialogExtraReferencesAction-S7GUFLTN.js} +2 -2
  88. package/{setPrimaryDialogAgentAction-7DLDZHDT.js → setPrimaryDialogAgentAction-5SF7G5OS.js} +4 -4
  89. package/{settingSlice-PNLASZGI.js → settingSlice-EXYZ5EFP.js} +3 -3
  90. package/skillDiscovery-UGSQGX2U.js +16 -0
  91. package/{spaceCommands-ORSFAWEY.js → spaceCommands-E7VOF4LO.js} +16 -19
  92. package/{spaceSlice-5F2CDP2O.js → spaceSlice-KIDVQWOV.js} +16 -14
  93. package/{streamAgentChatTurn-ROOB5RLM.js → streamAgentChatTurn-YQH6ZGE6.js} +41 -36
  94. package/{tools-BAWXW4F6.js → tools-5C7OGJEW.js} +21 -19
  95. package/{tuiSummaryLlmCaller-JSI4GL6W.js → tuiSummaryLlmCaller-RV3THLZF.js} +4 -4
  96. package/{understanding-GQKNDDWM.js → understanding-3CUQQ6SV.js} +3 -3
  97. package/{updateDialogTitleAction-KJM65IGF.js → updateDialogTitleAction-JHAVYVIP.js} +12 -12
  98. package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
@@ -8,15 +8,14 @@ import {
8
8
  patch,
9
9
  remove,
10
10
  write
11
- } from "./chunk-V2AISYMA.js";
11
+ } from "./chunk-KPSWSDUF.js";
12
12
  import {
13
13
  asRecordOrEmpty
14
14
  } from "./chunk-KX6YBIHG.js";
15
15
  import {
16
16
  createAgentKey,
17
- require_index_umd,
18
17
  toTrimmedString
19
- } from "./chunk-SH2CFQOH.js";
18
+ } from "./chunk-O4BU24WZ.js";
20
19
  import {
21
20
  asyncThunkCreator,
22
21
  buildCreateSlice,
@@ -28,9 +27,6 @@ import {
28
27
  import {
29
28
  asOptionalTrimmedString
30
29
  } from "./chunk-G3SUCT4W.js";
31
- import {
32
- __toESM
33
- } from "./chunk-4VNS5WPM.js";
34
30
 
35
31
  // packages/ai/chat/agentCredentialSyncClient.ts
36
32
  function buildUrl(currentServer, credentialRef) {
@@ -76,8 +72,17 @@ async function pushServerSyncedCredential(ctx, credentialRef, apiKey) {
76
72
  }
77
73
  }
78
74
 
75
+ // packages/core/sanitizeModelString.ts
76
+ var sanitizeOptionalModelString = (value) => {
77
+ const s = typeof value === "string" ? value.trim() : "";
78
+ if (!s) return "";
79
+ const lower = s.toLowerCase();
80
+ if (lower === "undefined" || lower === "null" || lower === "nan") return "";
81
+ return s;
82
+ };
83
+
79
84
  // packages/ai/agent/agentSlice.ts
80
- var import_ulid = __toESM(require_index_umd());
85
+ import { ulid } from "ulid";
81
86
  var createAgentCredentialBroker = createFileCredentialBroker;
82
87
  function setAgentCredentialBrokerFactoryForTests(factory) {
83
88
  createAgentCredentialBroker = factory ?? createFileCredentialBroker;
@@ -151,6 +156,12 @@ var processAgentCreateForm = (formData, userId) => {
151
156
  };
152
157
  result.runtimeBinding = binding;
153
158
  }
159
+ if ("model" in result) {
160
+ result.model = sanitizeOptionalModelString(result.model);
161
+ }
162
+ if ("provider" in result) {
163
+ result.provider = sanitizeOptionalModelString(result.provider);
164
+ }
154
165
  return result;
155
166
  };
156
167
  var processAgentUpdateChanges = (data, userId, previousAgent) => {
@@ -159,10 +170,10 @@ var processAgentUpdateChanges = (data, userId, previousAgent) => {
159
170
  changes.name = String(data.name ?? "").trim();
160
171
  }
161
172
  if ("model" in data) {
162
- changes.model = (data.model ?? "").trim();
173
+ changes.model = sanitizeOptionalModelString(data.model);
163
174
  }
164
175
  if ("provider" in data) {
165
- changes.provider = (data.provider ?? "").trim();
176
+ changes.provider = sanitizeOptionalModelString(data.provider);
166
177
  }
167
178
  if ("prompt" in data) {
168
179
  changes.prompt = (data.prompt ?? "").trim();
@@ -289,7 +300,7 @@ var slice = createSliceWithThunks({
289
300
  const overrides = {};
290
301
  if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
291
302
  if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
292
- const { _executeModel } = await import("./_executeModel-KBMAUV6G.js");
303
+ const { _executeModel } = await import("./_executeModel-BOMQGOZC.js");
293
304
  return _executeModel(
294
305
  {
295
306
  isStreaming: args.isStreaming ?? false,
@@ -310,7 +321,7 @@ var slice = createSliceWithThunks({
310
321
  * - 循环直到无工具调用或触发其他运行时停止条件
311
322
  */
312
323
  runAgent: create.asyncThunk(async (args, thunkApi) => {
313
- const { runAgentClientLoop } = await import("./runAgentClientLoop-DRAXPP6R.js");
324
+ const { runAgentClientLoop } = await import("./runAgentClientLoop-KKV7BWWC.js");
314
325
  const { content: loopContent, toolCallCount } = await runAgentClientLoop(
315
326
  {
316
327
  agentKey: args.agentKey,
@@ -326,7 +337,7 @@ var slice = createSliceWithThunks({
326
337
  * 聊天轮次流式 Agent 调用
327
338
  */
328
339
  streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
329
- const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-ROOB5RLM.js");
340
+ const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-YQH6ZGE6.js");
330
341
  return streamAgentChatTurnHandler(args, thunkApi);
331
342
  }),
332
343
  /**
@@ -340,7 +351,7 @@ var slice = createSliceWithThunks({
340
351
  const effectiveUserId = asOptionalTrimmedString(userId) ?? "local";
341
352
  const processed = processAgentCreateForm(formData, effectiveUserId);
342
353
  const now = Date.now();
343
- const id = (0, import_ulid.ulid)();
354
+ const id = ulid();
344
355
  const privateKey = createAgentKey.private(effectiveUserId, id);
345
356
  const publicKey = createAgentKey.public(id);
346
357
  let agent = {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-7IPLJUYC.js";
4
+ } from "./chunk-RL776AGR.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-RJKDVL4L.js";
7
+ } from "./chunk-SDJDLO5W.js";
8
8
 
9
9
  // packages/cli/agentListHelpers.ts
10
10
  function parseAgentRecordId(privateKey, explicitId) {
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-RJKDVL4L.js";
4
+ } from "./chunk-SDJDLO5W.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
8
8
  import {
9
9
  buildSkillDocMarkdown
10
- } from "./chunk-ZQ2UM4KG.js";
10
+ } from "./chunk-VC6OZXO5.js";
11
11
  import {
12
12
  createSpaceKey
13
13
  } from "./chunk-UAD2WT54.js";
@@ -17,9 +17,6 @@ import {
17
17
  resolveAuthToken,
18
18
  resolveServerUrl
19
19
  } from "./chunk-ISNCLGUZ.js";
20
- import {
21
- require_index_umd
22
- } from "./chunk-SH2CFQOH.js";
23
20
  import {
24
21
  asTrimmedLowercaseString
25
22
  } from "./chunk-QSJ3HFEF.js";
@@ -32,13 +29,10 @@ import {
32
29
  import {
33
30
  normalizeServerOrigin
34
31
  } from "./chunk-CF7PE763.js";
35
- import {
36
- __toESM
37
- } from "./chunk-4VNS5WPM.js";
38
32
 
39
33
  // packages/cli/docPageHelpers.ts
40
- var import_ulid = __toESM(require_index_umd(), 1);
41
34
  import { readFileSync } from "node:fs";
35
+ import { ulid } from "ulid";
42
36
  function getCliArg(args, flag) {
43
37
  const idx = args.indexOf(flag);
44
38
  return idx !== -1 ? args[idx + 1] : void 0;
@@ -57,7 +51,7 @@ function textToSlate(text) {
57
51
  }));
58
52
  }
59
53
  function createPageId() {
60
- return (0, import_ulid.ulid)();
54
+ return ulid();
61
55
  }
62
56
  function buildPageKey(userId, pageId) {
63
57
  return `page-${userId}-${pageId}`;
@@ -0,0 +1,112 @@
1
+ import {
2
+ buildSkillDiscoveryLayer
3
+ } from "./chunk-C4FTUXVF.js";
4
+ import {
5
+ load
6
+ } from "./chunk-WZSRQNQG.js";
7
+
8
+ // packages/agent-runtime/skillDiscovery.ts
9
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ var SKILL_SCAN_DIRS = [".agents/skills", "docs/skills"];
12
+ var MAX_DISCOVERED_SKILLS = 50;
13
+ function parseSkillFrontmatter(filePath) {
14
+ try {
15
+ const content = readFileSync(filePath, "utf8").slice(0, 2048);
16
+ const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
17
+ if (!fmMatch) return {};
18
+ const fm = load(fmMatch[1]);
19
+ if (!fm || typeof fm !== "object") return {};
20
+ const name = typeof fm.name === "string" ? fm.name : void 0;
21
+ const rawDesc = fm.description;
22
+ const description = typeof rawDesc === "string" ? rawDesc : rawDesc == null ? void 0 : String(rawDesc);
23
+ const sanitize = (s) => s?.trim().replace(/^["']|["']$/g, "").replace(/[\n\r]+/g, " ").slice(0, 200);
24
+ return { name: sanitize(name), description: sanitize(description) };
25
+ } catch {
26
+ return {};
27
+ }
28
+ }
29
+ function discoverSkills(cwd) {
30
+ const skills = [];
31
+ for (const dir of SKILL_SCAN_DIRS) {
32
+ if (skills.length >= MAX_DISCOVERED_SKILLS) break;
33
+ const absDir = join(cwd, dir);
34
+ if (!existsSync(absDir) || !statSync(absDir).isDirectory()) continue;
35
+ try {
36
+ for (const entry of readdirSync(absDir)) {
37
+ if (skills.length >= MAX_DISCOVERED_SKILLS) break;
38
+ const skillMdPath = join(absDir, entry, "SKILL.md");
39
+ if (existsSync(skillMdPath)) {
40
+ const { name, description } = parseSkillFrontmatter(skillMdPath);
41
+ skills.push({ name: name ?? entry, description: description ?? "", relativePath: join(dir, entry, "SKILL.md") });
42
+ continue;
43
+ }
44
+ if (dir === "docs/skills" && entry.endsWith(".md")) {
45
+ const flatPath = join(absDir, entry);
46
+ const { name, description } = parseSkillFrontmatter(flatPath);
47
+ skills.push({ name: name ?? entry.replace(/\.md$/, ""), description: description ?? "", relativePath: join(dir, entry) });
48
+ }
49
+ }
50
+ } catch {
51
+ }
52
+ }
53
+ return skills;
54
+ }
55
+ function resolveSkillByName(cwd, name) {
56
+ const trimmed = name.trim();
57
+ if (!trimmed || trimmed.includes("/") || trimmed.includes("\\") || trimmed.includes("..")) {
58
+ return null;
59
+ }
60
+ const agentsDir = join(cwd, ".agents", "skills", trimmed);
61
+ const agentsSkillMd = join(agentsDir, "SKILL.md");
62
+ if (existsSync(agentsSkillMd)) return agentsSkillMd;
63
+ const agentsParent = join(cwd, ".agents", "skills");
64
+ if (existsSync(agentsParent) && statSync(agentsParent).isDirectory()) {
65
+ try {
66
+ for (const entry of readdirSync(agentsParent)) {
67
+ const candidate = join(agentsParent, entry, "SKILL.md");
68
+ if (!existsSync(candidate)) continue;
69
+ try {
70
+ const { name: fmName } = parseSkillFrontmatter(candidate);
71
+ if (fmName && fmName === trimmed) return candidate;
72
+ } catch {
73
+ }
74
+ }
75
+ } catch {
76
+ }
77
+ }
78
+ const docsFlat = join(cwd, "docs", "skills", `${trimmed}.md`);
79
+ if (existsSync(docsFlat)) return docsFlat;
80
+ const docsDir = join(cwd, "docs", "skills");
81
+ if (existsSync(docsDir) && statSync(docsDir).isDirectory()) {
82
+ try {
83
+ for (const entry of readdirSync(docsDir)) {
84
+ if (!entry.endsWith(".md")) continue;
85
+ const candidate = join(docsDir, entry);
86
+ try {
87
+ const { name: fmName } = parseSkillFrontmatter(candidate);
88
+ if (fmName && fmName === trimmed) return candidate;
89
+ } catch {
90
+ }
91
+ }
92
+ } catch {
93
+ }
94
+ }
95
+ return null;
96
+ }
97
+ function buildSkillDiscoveryContextBlock(cwd) {
98
+ try {
99
+ const discovered = discoverSkills(cwd);
100
+ const layer = buildSkillDiscoveryLayer(discovered, cwd);
101
+ return layer?.content ?? null;
102
+ } catch {
103
+ return null;
104
+ }
105
+ }
106
+
107
+ export {
108
+ parseSkillFrontmatter,
109
+ discoverSkills,
110
+ resolveSkillByName,
111
+ buildSkillDiscoveryContextBlock
112
+ };
@@ -0,0 +1,239 @@
1
+ import {
2
+ canonicalizeToolNames
3
+ } from "./chunk-P3PKED2I.js";
4
+ import {
5
+ asTrimmedString
6
+ } from "./chunk-3EUW3WEO.js";
7
+
8
+ // packages/agent-runtime/identityBlock.ts
9
+ var buildIdentityBlock = (input) => {
10
+ const lines = [
11
+ "--- \u8EAB\u4EFD\u4FE1\u606F ---",
12
+ asTrimmedString(input.agentName) ? `\u540D\u79F0: ${asTrimmedString(input.agentName)}` : "",
13
+ asTrimmedString(input.agentId) ? `ID: ${asTrimmedString(input.agentId)}` : "",
14
+ asTrimmedString(input.model) ? `\u6A21\u578B: ${asTrimmedString(input.model)}` : "",
15
+ `\u56DE\u590D\u8BED\u8A00: ${asTrimmedString(input.responseLanguage) || "\u9ED8\u8BA4\u8DDF\u968F\u7528\u6237\u672C\u8F6E\u8F93\u5165\u8BED\u8A00"}`
16
+ ].filter(Boolean);
17
+ return lines.join("\n");
18
+ };
19
+
20
+ // packages/agent-runtime/contextLayerContract.ts
21
+ var buildContextLayerContractBlock = (options = {}) => {
22
+ const lines = [
23
+ "--- \u77E5\u8BC6\u5B58\u50A8\u7EA6\u5B9A ---",
24
+ "\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",
25
+ "",
26
+ "\u5C42\u6B21\u8FB9\u754C\uFF1A",
27
+ "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",
28
+ "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",
29
+ "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",
30
+ "",
31
+ "\u5199\u5165\u539F\u5219\uFF1A",
32
+ "- \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",
33
+ "- \u7A33\u5B9A\u884C\u4E3A\u89C4\u5219\u3001\u957F\u671F\u56FA\u5B9A\u7EA6\u675F\uFF0C\u4F18\u5148\u6C89\u6DC0\u5230 knowledge layer\u3002",
34
+ "- \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",
35
+ "- \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"
36
+ ];
37
+ if (options.hasRememberMemoryTool) {
38
+ lines.push(
39
+ "- \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"
40
+ );
41
+ }
42
+ if (options.hasDocTools) {
43
+ lines.push(
44
+ "- \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"
45
+ );
46
+ }
47
+ return lines.join("\n");
48
+ };
49
+
50
+ // packages/agent-runtime/startupProtocol.ts
51
+ var buildStartupProtocolBlock = (options = {}) => {
52
+ const lines = [
53
+ "--- \u542F\u52A8\u534F\u8BAE ---",
54
+ "\u542F\u52A8\u987A\u5E8F\uFF1A",
55
+ "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",
56
+ "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",
57
+ "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",
58
+ "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",
59
+ "",
60
+ "\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",
61
+ "- current_goal\uFF1A\u8FD9\u4E00\u8F6E\u771F\u6B63\u8981\u5B8C\u6210\u4EC0\u4E48",
62
+ "- constraints\uFF1A\u5F53\u524D\u7EA6\u675F\u3001\u504F\u597D\u3001\u8FB9\u754C\u6761\u4EF6",
63
+ "- missing_facts\uFF1A\u8FD8\u7F3A\u54EA\u4E9B\u4E8B\u5B9E\u624D\u80FD\u5B89\u5168\u884C\u52A8",
64
+ "- next_action\uFF1A\u4E0B\u4E00\u6B65\u6700\u5C0F\u4E14\u9AD8\u4EF7\u503C\u7684\u52A8\u4F5C",
65
+ "",
66
+ "\u51B3\u7B56\u89C4\u5219\uFF1A",
67
+ "- \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",
68
+ "- \u5982\u679C recent memory \u4E0E\u5F53\u524D\u7528\u6237\u8F93\u5165\u51B2\u7A81\uFF0C\u4EE5\u5F53\u524D\u7528\u6237\u8F93\u5165\u4E3A\u51C6\u3002",
69
+ "- \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",
70
+ "- \u4F18\u5148\u5C0F\u6B65\u63A8\u8FDB\uFF1B\u6BCF\u4E00\u8F6E\u5148\u505A\u6700\u80FD\u964D\u4F4E\u4E0D\u786E\u5B9A\u6027\u7684\u52A8\u4F5C\u3002"
71
+ ];
72
+ if (options.hasCheckEnvTool || options.hasExecShellTool) {
73
+ lines.push(
74
+ "- \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"
75
+ );
76
+ }
77
+ if (options.hasCheckEnvTool) {
78
+ lines.push(
79
+ "- \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"
80
+ );
81
+ }
82
+ if (options.hasExecShellTool) {
83
+ lines.push(
84
+ "- \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"
85
+ );
86
+ lines.push(
87
+ "- \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"
88
+ );
89
+ }
90
+ return lines.join("\n");
91
+ };
92
+
93
+ // packages/agent-runtime/runtimeGuidance.ts
94
+ var normalizeToolName = (name) => name.replace(/[-_]/g, "").toLowerCase();
95
+ var hasAnyTool = (normalizedTools, candidates) => candidates.some((candidate) => normalizedTools.has(normalizeToolName(candidate)));
96
+ var hasAllTools = (normalizedTools, candidates) => candidates.every((candidate) => normalizedTools.has(normalizeToolName(candidate)));
97
+ var buildEmailRegistrationWorkflowBlock = (enabled) => {
98
+ if (!enabled) return "";
99
+ return [
100
+ "--- \u90AE\u7BB1\u9A8C\u8BC1\u7801\u6CE8\u518C\u6D41\u7A0B ---",
101
+ "\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",
102
+ "",
103
+ "\u5206\u9636\u6BB5\u534F\u8BAE\uFF1Adiscover before acting -> assess supportability -> register -> verify -> closeout\u3002",
104
+ "",
105
+ "\u63A8\u8350\u6D41\u7A0B\uFF1A",
106
+ "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",
107
+ "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",
108
+ "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",
109
+ "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",
110
+ "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",
111
+ "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",
112
+ "",
113
+ "\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",
114
+ "\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"
115
+ ].join("\n");
116
+ };
117
+ var buildWebResearchToolPolicyBlock = (hasExecShellTool, hasFetchWebpageTool) => {
118
+ if (!hasExecShellTool || !hasFetchWebpageTool) return "";
119
+ return [
120
+ "--- \u751F\u4EA7\u73AF\u5883\u7F51\u9875\u7814\u7A76\u5DE5\u5177\u7B56\u7565 ---",
121
+ "\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",
122
+ "\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",
123
+ "\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"
124
+ ].join("\n");
125
+ };
126
+ var resolveRuntimeGuidanceToolOptions = (tools = []) => {
127
+ const normalizedTools = canonicalizeToolNames(tools);
128
+ const normalizedToolSet = new Set(normalizedTools.map(normalizeToolName));
129
+ const hasBrowserTools = hasAllTools(normalizedToolSet, [
130
+ "browser_openSession",
131
+ "browser_readContent",
132
+ "browser_typeText",
133
+ "browser_click",
134
+ "browser_closeSession"
135
+ ]);
136
+ const hasBrowserProbe = hasAnyTool(normalizedToolSet, ["browser_probePage", "browserProbePage"]);
137
+ const hasEmailRegistrationTools = hasAllTools(normalizedToolSet, [
138
+ "email_provision_identity",
139
+ "email_wait_for",
140
+ "email_extract_verification"
141
+ ]);
142
+ return {
143
+ hasCheckEnvTool: normalizedTools.includes("checkEnv"),
144
+ hasExecShellTool: normalizedTools.includes("execShell"),
145
+ hasRememberMemoryTool: normalizedTools.includes("rememberMemory"),
146
+ hasDocTools: normalizedTools.some(
147
+ (tool) => ["read", "readDoc", "readPage", "createDoc", "updateDoc"].includes(tool)
148
+ ),
149
+ hasBrowserTools,
150
+ hasEmailRegistrationTools,
151
+ // Require browser_probePage to be present before enabling email registration workflow guidance.
152
+ hasEmailRegistrationWorkflow: hasBrowserTools && hasBrowserProbe && hasEmailRegistrationTools
153
+ };
154
+ };
155
+ var buildRuntimeGuidanceBlocks = (tools = []) => {
156
+ const options = resolveRuntimeGuidanceToolOptions(tools);
157
+ const normalizedTools = canonicalizeToolNames(tools);
158
+ return {
159
+ startupProtocol: buildStartupProtocolBlock({
160
+ hasCheckEnvTool: options.hasCheckEnvTool,
161
+ hasExecShellTool: options.hasExecShellTool
162
+ }),
163
+ contextLayerContract: buildContextLayerContractBlock({
164
+ hasRememberMemoryTool: options.hasRememberMemoryTool,
165
+ hasDocTools: options.hasDocTools
166
+ }),
167
+ emailRegistrationWorkflow: buildEmailRegistrationWorkflowBlock(
168
+ options.hasEmailRegistrationWorkflow
169
+ ),
170
+ webResearchToolPolicy: buildWebResearchToolPolicyBlock(
171
+ options.hasExecShellTool,
172
+ normalizedTools.includes("fetchWebpage")
173
+ )
174
+ };
175
+ };
176
+
177
+ // packages/agent-runtime/currentTimeContext.ts
178
+ var pad2 = (value) => String(value).padStart(2, "0");
179
+ var resolveDefaultTimeZone = () => {
180
+ try {
181
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
182
+ } catch {
183
+ return "UTC";
184
+ }
185
+ };
186
+ var partsForTimeZone = (date, timeZone) => {
187
+ const parts = new Intl.DateTimeFormat("en-US", {
188
+ timeZone,
189
+ year: "numeric",
190
+ month: "2-digit",
191
+ day: "2-digit",
192
+ hour: "2-digit",
193
+ minute: "2-digit",
194
+ second: "2-digit",
195
+ hour12: false
196
+ }).formatToParts(date);
197
+ return Object.fromEntries(
198
+ parts.filter((part) => part.type !== "literal").map((part) => [part.type, part.value])
199
+ );
200
+ };
201
+ var zonedDateTime = (date, timeZone) => {
202
+ const parts = partsForTimeZone(date, timeZone);
203
+ return [
204
+ `${parts.year}-${parts.month}-${parts.day}`,
205
+ `${parts.hour}:${parts.minute}:${parts.second}`
206
+ ].join(" ");
207
+ };
208
+ var timeZoneOffset = (date, timeZone) => {
209
+ const parts = partsForTimeZone(date, timeZone);
210
+ const utcMs = Date.UTC(
211
+ Number(parts.year),
212
+ Number(parts.month) - 1,
213
+ Number(parts.day),
214
+ Number(parts.hour),
215
+ Number(parts.minute),
216
+ Number(parts.second)
217
+ );
218
+ const offsetMinutes = Math.round((utcMs - date.getTime()) / 6e4);
219
+ const sign = offsetMinutes >= 0 ? "+" : "-";
220
+ const absolute = Math.abs(offsetMinutes);
221
+ return `UTC${sign}${pad2(Math.floor(absolute / 60))}:${pad2(absolute % 60)}`;
222
+ };
223
+ var buildCurrentTimeBlock = (now = /* @__PURE__ */ new Date(), timeZone = resolveDefaultTimeZone()) => [
224
+ "--- \u5F53\u524D\u65F6\u95F4 ---",
225
+ `\u5F53\u524D\u65E5\u671F: ${zonedDateTime(now, timeZone).slice(0, 10)}`,
226
+ `\u5F53\u524D\u672C\u5730\u65F6\u95F4: ${zonedDateTime(now, timeZone).slice(0, 16)}`,
227
+ // HH:MM only, no seconds
228
+ `\u672C\u5730\u65F6\u533A: ${timeZone} / ${timeZoneOffset(now, timeZone)}`,
229
+ `UTC \u65F6\u95F4: ${now.toISOString().slice(0, 16)}`,
230
+ // YYYY-MM-DDTHH:MM only
231
+ "\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",
232
+ "\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"
233
+ ].join("\n");
234
+
235
+ export {
236
+ buildIdentityBlock,
237
+ buildRuntimeGuidanceBlocks,
238
+ buildCurrentTimeBlock
239
+ };
@@ -15,7 +15,7 @@ import {
15
15
  openrouterModels,
16
16
  xaiModels,
17
17
  zaiModels
18
- } from "./chunk-BR2WP3DF.js";
18
+ } from "./chunk-IWX4UW2E.js";
19
19
 
20
20
  // packages/integrations/anthropic/anthropicModels.ts
21
21
  var anthropicModels = [
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-XDVAYP26.js";
3
+ } from "./chunk-JRKKFRAV.js";
4
4
  import {
5
5
  asTrimmedLowercaseString
6
6
  } from "./chunk-QSJ3HFEF.js";
@@ -2,85 +2,6 @@ import {
2
2
  MEMORY_USE_GUIDANCE
3
3
  } from "./chunk-KKY4B2Q2.js";
4
4
 
5
- // packages/agent-runtime/modelLayerOverride.ts
6
- var MODEL_LAYER_KEYS = [
7
- "provider",
8
- "model",
9
- "apiSource",
10
- "cliProvider",
11
- "useServerProxy",
12
- "apiKey",
13
- "apiKeyRef",
14
- "apiKeyHeader",
15
- "customProviderUrl",
16
- "credentialRef",
17
- "credentialSynced",
18
- "temperature",
19
- "top_p",
20
- "frequency_penalty",
21
- "presence_penalty",
22
- "max_tokens",
23
- "reasoning_effort",
24
- "enableThinking",
25
- "thinkingBudget"
26
- ];
27
- function mergeReferences(base, extra) {
28
- const safeBase = Array.isArray(base) ? base : [];
29
- const safeExtra = Array.isArray(extra) ? extra : [];
30
- const seen = /* @__PURE__ */ new Set();
31
- const merged = [];
32
- for (const item of [...safeBase, ...safeExtra]) {
33
- const key = item?.dbKey;
34
- if (key && seen.has(key)) continue;
35
- if (key) seen.add(key);
36
- if (item) merged.push(item);
37
- }
38
- return merged;
39
- }
40
- var asNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
41
- function buildModelLayerOverride(agent) {
42
- if (!agent || !asNonEmptyString(agent.provider) || !asNonEmptyString(agent.model)) {
43
- return null;
44
- }
45
- const override = {
46
- provider: agent.provider,
47
- model: agent.model
48
- };
49
- for (const key of MODEL_LAYER_KEYS) {
50
- if (key === "provider" || key === "model") continue;
51
- const value = agent[key];
52
- if (value !== void 0) {
53
- override[key] = value;
54
- }
55
- }
56
- if (Array.isArray(agent.references) && agent.references.length > 0) {
57
- override.references = agent.references;
58
- }
59
- return override;
60
- }
61
- function applyModelLayerOverride(base, override) {
62
- const next = { ...base };
63
- for (const key of MODEL_LAYER_KEYS) {
64
- delete next[key];
65
- }
66
- for (const key of MODEL_LAYER_KEYS) {
67
- const value = override[key];
68
- if (value !== void 0) {
69
- next[key] = value;
70
- }
71
- }
72
- const merged = mergeReferences(
73
- base.references,
74
- override.references
75
- );
76
- if (merged.length > 0) {
77
- next.references = merged;
78
- } else {
79
- delete next.references;
80
- }
81
- return next;
82
- }
83
-
84
5
  // packages/agent-runtime/turnContext.ts
85
6
  var DEFAULT_RECENT_CONTENT_LIMIT = 10;
86
7
  var asTrimmed = (value) => typeof value === "string" ? value.trim() : "";
@@ -160,7 +81,8 @@ var buildSkillDiscoveryLayer = (skills, boundFolder) => {
160
81
  const lines = [
161
82
  "--- \u53EF\u7528\u6280\u80FD\uFF08Skills\uFF09---",
162
83
  `\u5DE5\u4F5C\u533A ${boundFolder} \u4E2D\u53D1\u73B0\u4E86 ${skills.length} \u4E2A\u6280\u80FD\uFF08SKILL.md\uFF09\uFF1A`,
163
- "\u6A21\u578B\u53EF\u6309\u9700\u7528 readFile \u8BFB\u53D6\u4EE5\u4E0B\u6587\u4EF6\u83B7\u53D6\u8BE6\u7EC6\u6307\u4EE4\uFF1A",
84
+ "\u6A21\u578B\u53EF\u6309\u9700\u7528 loadSkill \u5DE5\u5177\u6309\u540D\u52A0\u8F7D\uFF0C\u628A SKILL.md \u5168\u6587\u62C9\u8FDB\u4E0A\u4E0B\u6587\u540E\u9075\u5FAA\u5176\u6307\u4EE4\uFF1B",
85
+ "\u5982 loadSkill \u4E0D\u53EF\u7528\u6216\u60F3\u76F4\u63A5\u8BFB\u53D6\u6587\u4EF6\uFF0C\u4E0B\u65B9 path \u4ECD\u53EF\u7528 readFile \u4F5C\u4E3A fallback\uFF1A",
164
86
  "",
165
87
  ...skills.map(
166
88
  (s) => `- ${s.name}: ${s.description}
@@ -216,8 +138,6 @@ var buildMemoryUseGuidanceLayer = (args) => {
216
138
  };
217
139
 
218
140
  export {
219
- buildModelLayerOverride,
220
- applyModelLayerOverride,
221
141
  buildSpaceContextLayer,
222
142
  buildSkillDiscoveryLayer,
223
143
  buildLinkedSpacesSection,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-I6DI7SGU.js";
4
+ } from "./chunk-YRG2GO6E.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
- } from "./chunk-DG7AAAR3.js";
7
+ } from "./chunk-P3PKED2I.js";
8
8
  import {
9
9
  asTrimmedLowercaseString
10
10
  } from "./chunk-QSJ3HFEF.js";
@@ -12,7 +12,7 @@ import {
12
12
  openrouterModels,
13
13
  xaiModels,
14
14
  zaiModels
15
- } from "./chunk-BR2WP3DF.js";
15
+ } from "./chunk-IWX4UW2E.js";
16
16
 
17
17
  // packages/ai/llm/ollamaCloud.ts
18
18
  var OLLAMA_CLOUD_KIMI_PRICE = {