nolo-cli 0.27.1 → 0.28.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 (68) hide show
  1. package/{_executeModel-M6KLIXW5.js → _executeModel-SUMILI7E.js} +13 -13
  2. package/{agentDeleteCommand-VFHDZJG3.js → agentDeleteCommand-GEHAXWM6.js} +7 -7
  3. package/{agentEmailCommands-NQ3SJXZX.js → agentEmailCommands-PQXAKGK2.js} +17 -17
  4. package/{agentListCommands-BDDUYHLP.js → agentListCommands-V2IIWNTX.js} +8 -8
  5. package/{agentMachineCommands-5WU7B2UY.js → agentMachineCommands-Y47CABE2.js} +7 -7
  6. package/{agentRecordCommands-FFFARZTU.js → agentRecordCommands-UYUJUT4K.js} +16 -16
  7. package/{agentRunCommand-GZYQTIYF.js → agentRunCommand-3P6CCJQK.js} +17 -17
  8. package/{agentRuntimeLocal-552R4CZA.js → agentRuntimeLocal-ZALQDCZ3.js} +4 -4
  9. package/{agentSlice-N7E7SG25.js → agentSlice-LH2YKWE7.js} +1 -1
  10. package/{appDeleteCommands-IPJT6IYW.js → appDeleteCommands-XELAKISE.js} +8 -8
  11. package/{appDeployCommands-24P4CADQ.js → appDeployCommands-PFHVHXJ3.js} +8 -8
  12. package/{appDeployStatusCommands-3DRZOUAG.js → appDeployStatusCommands-RULB3DGE.js} +8 -8
  13. package/{appGetCommands-JEOSBLUL.js → appGetCommands-A3NLQ2U5.js} +8 -8
  14. package/{appListCommands-EIBM54WR.js → appListCommands-NQLJ7RHY.js} +8 -8
  15. package/{authCommand-MKMYHD52.js → authCommand-XMQHBK5L.js} +470 -40
  16. package/chunk-2FX23RGA.js +162 -0
  17. package/{chunk-6MBOZ4UP.js → chunk-2TYLTEAH.js} +1 -1
  18. package/{chunk-NWDOO373.js → chunk-4O2L6YR5.js} +3 -3
  19. package/{chunk-X43U4JUJ.js → chunk-4UYKPT74.js} +1 -1
  20. package/{chunk-TTPVLL5F.js → chunk-7IX2Z2IF.js} +8 -8
  21. package/{chunk-ESKT7YVG.js → chunk-7OYY7W4W.js} +2 -2
  22. package/{chunk-ZNFZGHKL.js → chunk-7ZKK4F22.js} +1 -1
  23. package/{chunk-YZV4676I.js → chunk-A6WDXLAG.js} +2 -2
  24. package/{chunk-KXEWHQAW.js → chunk-ATGTWONB.js} +1 -1
  25. package/{chunk-PPAJNYFB.js → chunk-BTA2CW6H.js} +6 -6
  26. package/{chunk-FL42U2NZ.js → chunk-D36OKPFG.js} +1 -1
  27. package/{chunk-MAFUFDFV.js → chunk-D5D3XTWF.js} +30 -35
  28. package/{chunk-BAKXXTAC.js → chunk-E4XWECLB.js} +2 -2
  29. package/{chunk-J2GZXLI7.js → chunk-HTLBU4ZY.js} +5 -5
  30. package/{chunk-4RXTDRTJ.js → chunk-IVMPWUAR.js} +1 -1
  31. package/{chunk-O5VFD7V6.js → chunk-MSXDPLDQ.js} +1 -1
  32. package/{chunk-NCRWA6ZB.js → chunk-MY54LNPC.js} +2 -2
  33. package/{chunk-6V6MYXPV.js → chunk-OMN2LILO.js} +1 -1
  34. package/{chunk-C4KV25UH.js → chunk-PASYOZYI.js} +22 -65
  35. package/{chunk-AL2V7U3E.js → chunk-PJY5AH5A.js} +25 -8
  36. package/chunk-PSK2RUHV.js +529 -0
  37. package/{chunk-4OHJCHIL.js → chunk-QUXMWSCQ.js} +21 -47
  38. package/{chunk-PVWFM7JP.js → chunk-RRWRVIQU.js} +1 -1
  39. package/{chunk-7ORW7XI4.js → chunk-SFFG3HJH.js} +3 -3
  40. package/{chunk-7WMLPRXP.js → chunk-UP7UFQOH.js} +1 -1
  41. package/{chunk-VV4TYWNV.js → chunk-WX3ZOSTL.js} +376 -656
  42. package/{chunk-AYQYOZYH.js → chunk-XMAELUQW.js} +11 -11
  43. package/{chunk-7OBMZCRD.js → chunk-ZVZMT3EA.js} +7 -5
  44. package/{createAgentAutomationAction-GU766YRL.js → createAgentAutomationAction-FAYQK5ME.js} +2 -2
  45. package/{createDialogAction-ADMDJITX.js → createDialogAction-NDBK6IQG.js} +3 -3
  46. package/{createPageAction-N7EZJVO5.js → createPageAction-CQTLV7FP.js} +2 -2
  47. package/{dialogCommands-O4CJJRTQ.js → dialogCommands-ZR42K2M5.js} +8 -8
  48. package/{dialogSlice-JB5YIV5K.js → dialogSlice-ZLGEYKLO.js} +2 -2
  49. package/{docCreateCommands-2U5AIF3O.js → docCreateCommands-2WXA3BCQ.js} +7 -7
  50. package/{docDeleteCommands-EDCAUQEF.js → docDeleteCommands-HSL7CD32.js} +8 -8
  51. package/{docReadCommands-KFMBFGPY.js → docReadCommands-YSPUU2DP.js} +7 -7
  52. package/{docStore-EXPYXKAO.js → docStore-LJQIY2ZU.js} +3 -3
  53. package/{docUpdateCommands-57M4XOT7.js → docUpdateCommands-EFYOIVM7.js} +7 -7
  54. package/{handleSendMessageAction-5E3MBI4X.js → handleSendMessageAction-JL6GGVNW.js} +2 -2
  55. package/index.js +46 -46
  56. package/{machineCommands-UPDXXKGX.js → machineCommands-VAANUFNC.js} +15 -15
  57. package/{machineWsRunDispatch-M43IR6SD.js → machineWsRunDispatch-ABWV2WZO.js} +15 -15
  58. package/package.json +1 -1
  59. package/{readlineWorkspace-NEADCABU.js → readlineWorkspace-GQI3XP5E.js} +41 -44
  60. package/{runAgentClientLoop-NYY3IGNZ.js → runAgentClientLoop-U632N2KO.js} +9 -9
  61. package/{skillDiscovery-KJWT7JBU.js → skillDiscovery-ITA7BI7A.js} +4 -2
  62. package/{spaceCommands-XK46FRYG.js → spaceCommands-DE6KNJIV.js} +7 -7
  63. package/{spaceSlice-S6HBDF4N.js → spaceSlice-QTMWWQHQ.js} +2 -2
  64. package/{streamAgentChatTurn-2NP4RW7O.js → streamAgentChatTurn-VU7BM3K3.js} +12 -12
  65. package/{tools-2HPUZOTG.js → tools-LSIS6NY6.js} +5 -5
  66. package/{updateDialogTitleAction-27EH4CEC.js → updateDialogTitleAction-T77A54DE.js} +2 -2
  67. package/chunk-UTYJ47H2.js +0 -51
  68. package/chunk-ZJ7WLPDP.js +0 -553
@@ -0,0 +1,162 @@
1
+ import {
2
+ trimTrailingSlash
3
+ } from "./chunk-XS7UPVR7.js";
4
+ import {
5
+ toErrorMessage
6
+ } from "./chunk-HNMXYYJR.js";
7
+ import {
8
+ asOptionalFiniteNumber
9
+ } from "./chunk-WWC7I6TA.js";
10
+ import {
11
+ asTrimmedLowercaseString
12
+ } from "./chunk-QSJ3HFEF.js";
13
+ import {
14
+ asOptionalTrimmedString
15
+ } from "./chunk-G3SUCT4W.js";
16
+
17
+ // packages/agent-runtime/antigravityOAuth.ts
18
+ var decodeBase64 = (s) => Buffer.from(s, "base64").toString("utf8");
19
+ var ANTIGRAVITY_CLIENT_ID = decodeBase64(
20
+ "MTA3MTAwNjA2MDU5MS10bWhzc2luMmgyMWxjcmUyMzV2dG9sb2poNGc0MDNlcC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbQ=="
21
+ );
22
+ var ANTIGRAVITY_CLIENT_SECRET = decodeBase64(
23
+ "R09DU1BYLUs1OEZXUjQ4NkxkTEoxbUxCOHNYQzR6NnFEQWY="
24
+ );
25
+ var ANTIGRAVITY_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
26
+ var ANTIGRAVITY_TOKEN_URL = "https://oauth2.googleapis.com/token";
27
+ var ANTIGRAVITY_USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json";
28
+ var ANTIGRAVITY_CALLBACK_PORT = 51121;
29
+ var ANTIGRAVITY_CALLBACK_PATH = "/oauth-callback";
30
+ var ANTIGRAVITY_CALLBACK_URL = `http://127.0.0.1:${ANTIGRAVITY_CALLBACK_PORT}${ANTIGRAVITY_CALLBACK_PATH}`;
31
+ var ANTIGRAVITY_SCOPES = [
32
+ "https://www.googleapis.com/auth/cloud-platform",
33
+ "https://www.googleapis.com/auth/userinfo.email",
34
+ "https://www.googleapis.com/auth/userinfo.profile",
35
+ "https://www.googleapis.com/auth/cclog",
36
+ "https://www.googleapis.com/auth/experimentsandconfigs"
37
+ ];
38
+ var ANTIGRAVITY_ACCESS_TOKEN_CLIENT_SKEW_MS = 5 * 60 * 1e3;
39
+ var ANTIGRAVITY_TOKEN_REQUEST_TIMEOUT_MS = 3e4;
40
+ var ANTIGRAVITY_CLOUD_CODE_BASE_URL = "https://daily-cloudcode-pa.googleapis.com";
41
+ var ANTIGRAVITY_CLOUD_CODE_HOST = "cloudcode-pa.googleapis.com";
42
+ var ANTIGRAVITY_LEGACY_GENERIC_BASE_RE = /^https?:\/\/cloudcode-pa\.googleapis\.com$/i;
43
+ function getAntigravityUserAgent() {
44
+ const version = process.env.NOLO_ANTIGRAVITY_VERSION || "2.1.4";
45
+ const os = process.platform === "win32" ? "windows" : process.platform;
46
+ const arch = process.arch === "x64" ? "amd64" : process.arch === "ia32" ? "386" : process.arch;
47
+ return `antigravity/hub/${version} ${os}/${arch}`;
48
+ }
49
+ function resolveAntigravityCloudCodeBaseUrl(customProviderUrl) {
50
+ const raw = (customProviderUrl ?? "").trim();
51
+ if (!raw) return ANTIGRAVITY_CLOUD_CODE_BASE_URL;
52
+ const trimmed = trimTrailingSlash(raw);
53
+ if (trimmed.includes(ANTIGRAVITY_CLOUD_CODE_HOST)) {
54
+ const base = trimmed.replace(/\/v1internal:.*$/i, "").replace(/\/$/, "");
55
+ if (ANTIGRAVITY_LEGACY_GENERIC_BASE_RE.test(base)) {
56
+ return ANTIGRAVITY_CLOUD_CODE_BASE_URL;
57
+ }
58
+ return base;
59
+ }
60
+ return ANTIGRAVITY_CLOUD_CODE_BASE_URL;
61
+ }
62
+ function isAntigravityOAuthAgent(agentConfig) {
63
+ if (!agentConfig) return false;
64
+ const apiKeyRef = asTrimmedLowercaseString(agentConfig.apiKeyRef);
65
+ const provider = asTrimmedLowercaseString(agentConfig.provider);
66
+ const url = asTrimmedLowercaseString(agentConfig.customProviderUrl);
67
+ return apiKeyRef === "antigravity" || provider === "google-antigravity" || url.includes(ANTIGRAVITY_CLOUD_CODE_HOST);
68
+ }
69
+ function readAntigravityProjectId(metadata) {
70
+ return asOptionalTrimmedString(metadata?.projectId);
71
+ }
72
+ function normalizeAntigravityTokenPayload(args) {
73
+ const {
74
+ payload,
75
+ baseCredential,
76
+ now = Date.now(),
77
+ clientSkewMs = ANTIGRAVITY_ACCESS_TOKEN_CLIENT_SKEW_MS
78
+ } = args;
79
+ if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
80
+ throw new Error("Antigravity token response missing access_token");
81
+ }
82
+ const accessToken = payload.access_token.trim();
83
+ const expiresIn = asOptionalFiniteNumber(payload.expires_in);
84
+ const expiresAt = expiresIn !== void 0 ? now + expiresIn * 1e3 - clientSkewMs : baseCredential?.expiresAt;
85
+ const refreshToken = typeof payload.refresh_token === "string" && payload.refresh_token.trim() ? payload.refresh_token.trim() : baseCredential?.refreshToken;
86
+ const scope = typeof payload.scope === "string" && payload.scope.trim() ? payload.scope.trim() : baseCredential?.scope;
87
+ return {
88
+ ...baseCredential ?? {},
89
+ provider: baseCredential?.provider ?? "antigravity",
90
+ accessToken,
91
+ ...refreshToken ? { refreshToken } : {},
92
+ ...expiresAt !== void 0 ? { expiresAt } : {},
93
+ ...scope ? { scope } : {},
94
+ obtainedAt: now
95
+ };
96
+ }
97
+ async function refreshAntigravityToken(credential, deps = {}) {
98
+ if (!credential.refreshToken || !credential.refreshToken.trim()) {
99
+ throw new Error("Antigravity credential has no refresh_token");
100
+ }
101
+ const fetchImpl = deps.fetchImpl ?? fetch;
102
+ let response;
103
+ try {
104
+ response = await fetchImpl(ANTIGRAVITY_TOKEN_URL, {
105
+ method: "POST",
106
+ headers: {
107
+ "Content-Type": "application/x-www-form-urlencoded",
108
+ Accept: "application/json"
109
+ },
110
+ body: new URLSearchParams({
111
+ client_id: ANTIGRAVITY_CLIENT_ID,
112
+ client_secret: ANTIGRAVITY_CLIENT_SECRET,
113
+ refresh_token: credential.refreshToken.trim(),
114
+ grant_type: "refresh_token"
115
+ }),
116
+ signal: AbortSignal.timeout(ANTIGRAVITY_TOKEN_REQUEST_TIMEOUT_MS)
117
+ });
118
+ } catch (error) {
119
+ throw new Error(
120
+ `Antigravity token refresh failed: ${toErrorMessage(error)}`
121
+ );
122
+ }
123
+ let rawBodyText = "";
124
+ let payload;
125
+ try {
126
+ rawBodyText = await response.text();
127
+ payload = rawBodyText ? JSON.parse(rawBodyText) : {};
128
+ } catch {
129
+ payload = {};
130
+ }
131
+ if (!response.ok) {
132
+ const detail = typeof payload.error_description === "string" && payload.error_description.trim() ? payload.error_description.trim() : typeof payload.error === "string" && payload.error.trim() ? payload.error.trim() : rawBodyText.trim() || `HTTP ${response.status}`;
133
+ throw new Error(`Antigravity token refresh failed: ${detail}`);
134
+ }
135
+ if (typeof payload.access_token !== "string" || !payload.access_token.trim()) {
136
+ throw new Error("Antigravity token refresh response missing access_token");
137
+ }
138
+ const now = deps.now?.() ?? Date.now();
139
+ return normalizeAntigravityTokenPayload({
140
+ payload,
141
+ baseCredential: credential,
142
+ now
143
+ });
144
+ }
145
+
146
+ export {
147
+ ANTIGRAVITY_CLIENT_ID,
148
+ ANTIGRAVITY_CLIENT_SECRET,
149
+ ANTIGRAVITY_AUTH_URL,
150
+ ANTIGRAVITY_TOKEN_URL,
151
+ ANTIGRAVITY_USERINFO_URL,
152
+ ANTIGRAVITY_CALLBACK_PORT,
153
+ ANTIGRAVITY_CALLBACK_PATH,
154
+ ANTIGRAVITY_SCOPES,
155
+ ANTIGRAVITY_CLOUD_CODE_BASE_URL,
156
+ getAntigravityUserAgent,
157
+ resolveAntigravityCloudCodeBaseUrl,
158
+ isAntigravityOAuthAgent,
159
+ readAntigravityProjectId,
160
+ normalizeAntigravityTokenPayload,
161
+ refreshAntigravityToken
162
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generatePkcePair,
3
3
  startCallbackServer
4
- } from "./chunk-VV4TYWNV.js";
4
+ } from "./chunk-WX3ZOSTL.js";
5
5
  import {
6
6
  toErrorMessage
7
7
  } from "./chunk-HNMXYYJR.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-C4KV25UH.js";
4
+ } from "./chunk-PASYOZYI.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-AYQYOZYH.js";
7
+ } from "./chunk-XMAELUQW.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-YZV4676I.js";
10
+ } from "./chunk-A6WDXLAG.js";
11
11
  import {
12
12
  resolveLocalRuntimeEnvFromPolicy
13
13
  } from "./chunk-5CS33IBL.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readDbRecord,
3
3
  writeAgentRecord
4
- } from "./chunk-ZNFZGHKL.js";
4
+ } from "./chunk-7ZKK4F22.js";
5
5
  import {
6
6
  buildSkillSummaryMarker
7
7
  } from "./chunk-VF4K2QE6.js";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  parseToolArgumentsJson,
10
10
  resolveHistoricalToolContentCap
11
- } from "./chunk-YZV4676I.js";
11
+ } from "./chunk-A6WDXLAG.js";
12
12
  import {
13
13
  createThinkParserState,
14
14
  createToolCallAccumulator,
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  requiresBareImageUrl,
21
21
  toBareImageUrlMessages
22
- } from "./chunk-ZJ7WLPDP.js";
22
+ } from "./chunk-PSK2RUHV.js";
23
23
  import {
24
24
  shouldStripReasoningContentForOutbound,
25
25
  toOpenAiCompatibleMessages
@@ -1516,7 +1516,7 @@ function buildWorkspacePathProperty() {
1516
1516
  return {
1517
1517
  type: "string",
1518
1518
  minLength: 1,
1519
- description: "Path relative to the workspace root. Required and must be non-empty for readFile/writeFile/editFile; for listFiles/searchFiles/globFiles it is optional and defaults to the workspace root when omitted."
1519
+ description: "Path relative to the workspace root. Defaults to workspace root when omitted."
1520
1520
  };
1521
1521
  }
1522
1522
  function buildListWorkspaceDescription(variant) {
@@ -1889,17 +1889,17 @@ function buildExecShellTool(toolName) {
1889
1889
  type: "function",
1890
1890
  function: {
1891
1891
  name: toolName,
1892
- description: `Execute a shell command from the workspace root. Prefer one compound command (e.g. 'git status && git diff --stat') to perform complete verification instead of multiple small roundtrips. Do not cd into guessed paths (e.g. /workspace, /repo, /home/user); commands already run from the workspace root. Use portable POSIX commands for macOS/BSD shells; do not use cat -A or brittle byte-offset tools such as xxd -s -32. For text-file content or trailing-newline checks, prefer readFile over shell byte inspection. After a successful command returned the needed status/commit info, do not run repeated git status/log/rev-parse checks; use one final verification command. Commands block until exit. Long-running commands (sleep over ${IMMEDIATE_DETACH_SLEEP_THRESHOLD_SECONDS}s, dev servers, watchers) automatically detach to background returning {detached: true, pid, label}; for persistent services, prefer launchProcess.`,
1892
+ description: `Execute a shell command from the workspace root. Prefer one compound command (e.g. 'git status && git diff --stat') to perform complete verification in one step instead of multiple small roundtrips. Do not cd into guessed paths; commands already run from the workspace root. Commands block until exit. Long-running commands (sleep over ${IMMEDIATE_DETACH_SLEEP_THRESHOLD_SECONDS}s, dev servers, watchers) automatically detach to background returning {detached: true, pid, label}; for persistent services, prefer launchProcess.`,
1893
1893
  parameters: {
1894
1894
  type: "object",
1895
1895
  properties: {
1896
1896
  cmd: {
1897
1897
  type: "string",
1898
- description: "Shell command to run. Must be a non-empty command string \u2014 never pass an empty string, whitespace-only text, or null."
1898
+ description: "Shell command to run (non-empty)."
1899
1899
  },
1900
1900
  command: {
1901
1901
  type: "string",
1902
- description: "Shell command to run. Compatibility field for providers that model the command under this name; the executor reads cmd first, then falls back to command. Must also be non-empty when used."
1902
+ description: "Compatibility alias for cmd."
1903
1903
  }
1904
1904
  }
1905
1905
  }
@@ -4091,7 +4091,7 @@ function buildLoadSkillExecutor(args) {
4091
4091
  metadata: { loadSkill: true, resolved: false }
4092
4092
  };
4093
4093
  }
4094
- const { resolveSkillByName } = await import("./skillDiscovery-KJWT7JBU.js");
4094
+ const { resolveSkillByName } = await import("./skillDiscovery-ITA7BI7A.js");
4095
4095
  const resolved = resolveSkillByName(args.cwd, name);
4096
4096
  if (!resolved) {
4097
4097
  const { resolveCodingBuiltinSlug, buildCodingSkillContentBySlug } = await import("./codingSkills-EN6Z6G6U.js");
@@ -4129,7 +4129,7 @@ ${body}`,
4129
4129
  };
4130
4130
  }
4131
4131
  async function formatUnknownSkillMessage(cwd, requestedName) {
4132
- const { discoverSkills } = await import("./skillDiscovery-KJWT7JBU.js");
4132
+ const { discoverSkills } = await import("./skillDiscovery-ITA7BI7A.js");
4133
4133
  let available = [];
4134
4134
  try {
4135
4135
  available = discoverSkills(cwd).map((s) => s.name);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  updateContentTitle
3
- } from "./chunk-4OHJCHIL.js";
3
+ } from "./chunk-QUXMWSCQ.js";
4
4
  import {
5
5
  require_date_fns
6
6
  } from "./chunk-M76ECQRD.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-N7EZJVO5.js");
370
+ const { createPageAction } = await import("./createPageAction-CQTLV7FP.js");
371
371
  return createPageAction(args, thunkApi);
372
372
  }
373
373
  function subscribe(listener) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildLocalAgentLookupKeys,
3
3
  shouldReadAgentKeyRemotely
4
- } from "./chunk-7WMLPRXP.js";
4
+ } from "./chunk-UP7UFQOH.js";
5
5
  import {
6
6
  resolveCliAgentKeyInput
7
7
  } from "./chunk-VHBWHNVT.js";
@@ -3,7 +3,7 @@ import {
3
3
  buildIdentityBlock,
4
4
  buildRuntimeGuidanceBlocks,
5
5
  resolveToolGuidedSections
6
- } from "./chunk-ZJ7WLPDP.js";
6
+ } from "./chunk-PSK2RUHV.js";
7
7
  import {
8
8
  estimateTokenCount,
9
9
  getModelContextWindow,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-GT3GG2H7.js";
21
21
  import {
22
22
  buildDialogSummaryLayer
23
- } from "./chunk-AL2V7U3E.js";
23
+ } from "./chunk-PJY5AH5A.js";
24
24
  import {
25
25
  canonicalizeToolName,
26
26
  canonicalizeToolNames
@@ -2,7 +2,7 @@ import {
2
2
  deleteDbRecord,
3
3
  queryUserRecords,
4
4
  readDbRecord
5
- } from "./chunk-ZNFZGHKL.js";
5
+ } from "./chunk-7ZKK4F22.js";
6
6
  import {
7
7
  mergeAndDedupUserData
8
8
  } from "./chunk-KQHGZWSV.js";
@@ -5,10 +5,10 @@ import {
5
5
  inlineImageUrlsForCustomProvider,
6
6
  prepareTools,
7
7
  shouldInlineImageUrlsForAgent
8
- } from "./chunk-FL42U2NZ.js";
8
+ } from "./chunk-D36OKPFG.js";
9
9
  import {
10
10
  performFetchRequest
11
- } from "./chunk-J2GZXLI7.js";
11
+ } from "./chunk-HTLBU4ZY.js";
12
12
  import {
13
13
  createSSEParser,
14
14
  createToolRunId,
@@ -19,7 +19,7 @@ import {
19
19
  toolRunSetPending,
20
20
  toolRunStarted,
21
21
  toolRunSucceeded
22
- } from "./chunk-AYQYOZYH.js";
22
+ } from "./chunk-XMAELUQW.js";
23
23
  import {
24
24
  getPublicImageAgentMode
25
25
  } from "./chunk-VIDPVFP3.js";
@@ -29,13 +29,13 @@ import {
29
29
  messageStreaming,
30
30
  selectCurrentSpaceId,
31
31
  updateToolMessage
32
- } from "./chunk-4OHJCHIL.js";
32
+ } from "./chunk-QUXMWSCQ.js";
33
33
  import {
34
34
  streamAgentChatTurn
35
- } from "./chunk-7ORW7XI4.js";
35
+ } from "./chunk-SFFG3HJH.js";
36
36
  import {
37
37
  EMPTY_ASSISTANT_REPAIR_PROMPT
38
- } from "./chunk-YZV4676I.js";
38
+ } from "./chunk-A6WDXLAG.js";
39
39
  import {
40
40
  accumulateToolCallDelta,
41
41
  createThinkParserState,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  i18n_default,
3
3
  toolRegistry
4
- } from "./chunk-AYQYOZYH.js";
4
+ } from "./chunk-XMAELUQW.js";
5
5
  import {
6
6
  canonicalizeToolNames
7
7
  } from "./chunk-ZZ2MH7LE.js";
@@ -19,7 +19,7 @@ import {
19
19
  parseAgentRunEvent,
20
20
  t,
21
21
  toolLabel
22
- } from "./chunk-C4KV25UH.js";
22
+ } from "./chunk-PASYOZYI.js";
23
23
  import {
24
24
  getReadableCliDb
25
25
  } from "./chunk-WFHXMLHZ.js";
@@ -27,7 +27,7 @@ import {
27
27
  normalizeAgentHandle,
28
28
  readDbRecord,
29
29
  resolveAgentRecordFromHybridStore
30
- } from "./chunk-ZNFZGHKL.js";
30
+ } from "./chunk-7ZKK4F22.js";
31
31
  import {
32
32
  NOLO_PROJECT_MANAGER_AGENT_KEY,
33
33
  isLocalCliAgentKey
@@ -38,7 +38,7 @@ import {
38
38
  } from "./chunk-LTRXGFMS.js";
39
39
  import {
40
40
  formatAgentListCard
41
- } from "./chunk-AYQYOZYH.js";
41
+ } from "./chunk-XMAELUQW.js";
42
42
  import {
43
43
  isGatewayHttpStatus
44
44
  } from "./chunk-RQSOAMPJ.js";
@@ -50,15 +50,15 @@ import {
50
50
  chooseMemoryOwners,
51
51
  loadMemoryCandidatesFromDb,
52
52
  resolveAgentMemoryPolicy
53
- } from "./chunk-4RXTDRTJ.js";
53
+ } from "./chunk-IVMPWUAR.js";
54
54
  import {
55
55
  API_REPORTED_COST_MULTIPLIER,
56
56
  normalizeUsage,
57
57
  parseUiAskChoiceContent
58
- } from "./chunk-4OHJCHIL.js";
58
+ } from "./chunk-QUXMWSCQ.js";
59
59
  import {
60
- buildSkillDiscoveryContextBlock
61
- } from "./chunk-7OBMZCRD.js";
60
+ buildSkillDiscoveryContextLayer
61
+ } from "./chunk-ZVZMT3EA.js";
62
62
  import {
63
63
  parseExternalSkillMarkdown,
64
64
  parseSkillDocProtocol
@@ -71,7 +71,7 @@ import {
71
71
  LOCAL_TURN_ABORTED_CODE,
72
72
  readActionGate,
73
73
  readCommandActionGatePayload
74
- } from "./chunk-YZV4676I.js";
74
+ } from "./chunk-A6WDXLAG.js";
75
75
  import {
76
76
  createThinkParserState,
77
77
  flushThinkParser,
@@ -91,9 +91,12 @@ import {
91
91
  findModelConfig
92
92
  } from "./chunk-GT3GG2H7.js";
93
93
  import {
94
+ buildAgentsMdLayer,
94
95
  buildMemoryOverlayLayer,
95
- buildMemoryUseGuidanceLayer
96
- } from "./chunk-AL2V7U3E.js";
96
+ buildMemoryUseGuidanceLayer,
97
+ partitionScopedBlocks,
98
+ renderTurnContextBlocksWithScope
99
+ } from "./chunk-PJY5AH5A.js";
97
100
  import {
98
101
  compactWhitespace
99
102
  } from "./chunk-DWLEOOGR.js";
@@ -3480,7 +3483,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
3480
3483
  // packages/cli/client/agentRun.ts
3481
3484
  import { ulid } from "ulid";
3482
3485
  async function loadRunLocalAgentTurn() {
3483
- const { runLocalAgentTurn } = await import("./agentRuntimeLocal-552R4CZA.js");
3486
+ const { runLocalAgentTurn } = await import("./agentRuntimeLocal-ZALQDCZ3.js");
3484
3487
  return runLocalAgentTurn;
3485
3488
  }
3486
3489
  async function resolveCurrentMachineId(options) {
@@ -4966,6 +4969,8 @@ async function runAgentRunCommand(args, deps) {
4966
4969
  }
4967
4970
  const cliCwd = parsed.cwd ?? process.cwd();
4968
4971
  const isSubtask = isSubtaskRun(env);
4972
+ const scopedLayers = [];
4973
+ const skillContentBlocks = [];
4969
4974
  const extraContextBlocks = [];
4970
4975
  const contextBlockScopes = [];
4971
4976
  let memoryPromptBlock = null;
@@ -4982,18 +4987,14 @@ async function runAgentRunCommand(args, deps) {
4982
4987
  if (Buffer.byteLength(mdContent, "utf8") > AGENTS_MD_MAX) {
4983
4988
  mdContent = Buffer.from(mdContent, "utf8").subarray(0, AGENTS_MD_MAX).toString("utf8") + "\n\n<!-- AGENTS.md truncated -->";
4984
4989
  }
4985
- extraContextBlocks.push(`--- \u9879\u76EE\u6307\u4EE4\uFF08${name}\uFF09---
4986
- ${mdContent}`);
4990
+ scopedLayers.push(buildAgentsMdLayer(mdContent, name));
4987
4991
  break;
4988
4992
  } catch {
4989
4993
  }
4990
4994
  }
4991
4995
  }
4992
- extraContextBlocks.push(...buildSkillContextBlocks(skillReferences));
4993
- const skillDiscoveryBlock = buildSkillDiscoveryContextBlock(cliCwd);
4994
- if (skillDiscoveryBlock) {
4995
- extraContextBlocks.push(skillDiscoveryBlock);
4996
- }
4996
+ skillContentBlocks.push(...buildSkillContextBlocks(skillReferences));
4997
+ scopedLayers.push(buildSkillDiscoveryContextLayer(cliCwd));
4997
4998
  if (!deps.memoryRecallDisabled) {
4998
4999
  const memoryServerUrl = resolveServerUrl(env);
4999
5000
  const memoryAuthToken = resolveAuthToken(args, env);
@@ -5041,23 +5042,17 @@ ${mdContent}`);
5041
5042
  }
5042
5043
  memoryOverlayLayer = buildMemoryOverlayLayer({ promptBlock: memoryPromptBlock });
5043
5044
  memoryUseGuidanceLayer = buildMemoryUseGuidanceLayer({ promptBlock: memoryPromptBlock });
5044
- const agentsMdMarker = "--- \u9879\u76EE\u6307\u4EE4\uFF08";
5045
- for (const block of extraContextBlocks) {
5046
- if (block.startsWith(agentsMdMarker)) {
5047
- contextBlockScopes.push({ content: block, cacheScope: "session" });
5048
- }
5049
- }
5050
- if (memoryUseGuidanceLayer?.content?.trim()) {
5051
- contextBlockScopes.push({ content: memoryUseGuidanceLayer.content, cacheScope: "session" });
5052
- }
5053
- for (const block of extraContextBlocks) {
5054
- if (!block.startsWith(agentsMdMarker)) {
5055
- contextBlockScopes.push({ content: block, cacheScope: "turn" });
5056
- }
5057
- }
5058
- if (memoryOverlayLayer?.content?.trim()) {
5059
- contextBlockScopes.push({ content: memoryOverlayLayer.content, cacheScope: "turn" });
5060
- }
5045
+ contextBlockScopes.push(
5046
+ ...partitionScopedBlocks([
5047
+ ...renderTurnContextBlocksWithScope([
5048
+ ...scopedLayers,
5049
+ memoryUseGuidanceLayer
5050
+ ]),
5051
+ ...skillContentBlocks.map((content) => content.trim()).filter((content) => content.length > 0).map((content) => ({ content, cacheScope: "turn" })),
5052
+ ...renderTurnContextBlocksWithScope([memoryOverlayLayer])
5053
+ ])
5054
+ );
5055
+ extraContextBlocks.push(...contextBlockScopes.map((block) => block.content));
5061
5056
  }
5062
5057
  const buildRunOptions = (targetAgentKey) => ({
5063
5058
  agentName: targetAgentKey,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  clearCliLocalRuntimePreparedAgentCache
3
- } from "./chunk-C4KV25UH.js";
3
+ } from "./chunk-PASYOZYI.js";
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-WFHXMLHZ.js";
@@ -12,7 +12,7 @@ import {
12
12
  resolveAgentRecordFromHybridStore,
13
13
  sanitizeAgentRecordForCliOutput,
14
14
  writeAgentRecord
15
- } from "./chunk-ZNFZGHKL.js";
15
+ } from "./chunk-7ZKK4F22.js";
16
16
  import {
17
17
  resolveCliAgentKeyInput
18
18
  } from "./chunk-VHBWHNVT.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ANTIGRAVITY_CLOUD_CODE_BASE_URL,
3
3
  isAntigravityOAuthAgent
4
- } from "./chunk-UTYJ47H2.js";
4
+ } from "./chunk-2FX23RGA.js";
5
5
  import {
6
6
  clipMultilineText,
7
7
  fetchAndSerializeTable,
8
8
  resolveBuiltinSkillPage,
9
9
  waitForAbortableDelay
10
- } from "./chunk-AYQYOZYH.js";
10
+ } from "./chunk-XMAELUQW.js";
11
11
  import {
12
12
  createDrainExhaustedResponse,
13
13
  isCoreDrainingBody,
@@ -23,10 +23,10 @@ import {
23
23
  } from "./chunk-VP4WJWKW.js";
24
24
  import {
25
25
  fetchAndCacheMessages
26
- } from "./chunk-4OHJCHIL.js";
26
+ } from "./chunk-QUXMWSCQ.js";
27
27
  import {
28
28
  fetchServerSyncedCredential
29
- } from "./chunk-7ORW7XI4.js";
29
+ } from "./chunk-SFFG3HJH.js";
30
30
  import {
31
31
  shouldUseServerProxy
32
32
  } from "./chunk-YYLHWIW6.js";
@@ -42,7 +42,7 @@ import {
42
42
  requiresBareImageUrl,
43
43
  resolveToolGuidedSections,
44
44
  toBareImageUrlMessages
45
- } from "./chunk-ZJ7WLPDP.js";
45
+ } from "./chunk-PSK2RUHV.js";
46
46
  import {
47
47
  convertMessagesToResponsesInput,
48
48
  preserveAgentStateFields
@@ -3,7 +3,7 @@ import {
3
3
  prepareAndPersistMessage,
4
4
  uiAskChoiceFunc,
5
5
  uiAskChoiceFunctionSchema
6
- } from "./chunk-4OHJCHIL.js";
6
+ } from "./chunk-QUXMWSCQ.js";
7
7
  import {
8
8
  require_date_fns
9
9
  } from "./chunk-M76ECQRD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  requireTokenUser
3
- } from "./chunk-X43U4JUJ.js";
3
+ } from "./chunk-4UYKPT74.js";
4
4
  import {
5
5
  resolveServerUrl
6
6
  } from "./chunk-A7GB5UGH.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  listUserRecordsFromServers,
3
3
  readLiveDbRecordAfterTombstoneMerge
4
- } from "./chunk-KXEWHQAW.js";
4
+ } from "./chunk-ATGTWONB.js";
5
5
  import {
6
6
  agentRecordHasConfiguredCredential
7
- } from "./chunk-ZNFZGHKL.js";
7
+ } from "./chunk-7ZKK4F22.js";
8
8
  import {
9
9
  toSafeAgentSummary
10
10
  } from "./chunk-H7N2NOJF.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  fetchReferenceContents,
3
3
  resolveReferenceAssets
4
- } from "./chunk-J2GZXLI7.js";
4
+ } from "./chunk-HTLBU4ZY.js";
5
5
 
6
6
  // packages/ai/agent/fetchAgentContexts.ts
7
7
  async function fetchAgentContexts(references, dispatch) {