dsh-agy-link 0.6.3 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.5 (2026-11-07)
4
+
5
+ ### English
6
+
7
+ - **Fix(mcp-bridge): bridged calls work again on DSH 0.2.2 — send the batch shape and unwrap its result (issue #84).** (thanks @hjwsm1989, #85)
8
+ - DSH 0.2.2 changed `tools.execute()` from a single call to a batch (`{ calls, signal, agent }`), so the 0.2.1-shaped payload made `executeToolBatch()` read `input.calls` as `undefined` and **every** bridged call died with `ToolBatchExecutionError` before dispatch (whole reverse-MCP surface, including `agent_teams_*`, unusable). The bridge now sends both shapes — 0.2.1 ignores `calls`, 0.2.2 ignores the extra fields — and `settledToolResult()` unwraps `results[0].result` (matched by call id) while passing a 0.2.1 single result through untouched.
9
+ - Hardening on merge: the PTC nested-dispatch `parent` token from #66 is restored, but only for a PTC surface (`run_code` visible), so 0.2.1 PTC keeps working while native calls never carry it (0.2.2 gates PTC on the execution source).
10
+
11
+ ### 中文
12
+
13
+ - **修复(mcp-bridge):DSH 0.2.2 下桥接调用恢复可用——发送批量形状并解包结果(issue #84)。**(感谢 @hjwsm1989,#85)
14
+ - DSH 0.2.2 把 `tools.execute()` 从单次调用改成批量(`{ calls, signal, agent }`),旧的 0.2.1 形状让 `executeToolBatch()` 读到 `undefined` 的 `input.calls`,于是**所有**桥接调用在派发前就 `ToolBatchExecutionError`(整套反向 MCP 面,含 `agent_teams_*`,全部不可用)。现同时发送两种形状(0.2.1 忽略 `calls`,0.2.2 忽略多余字段),并用 `settledToolResult()` 按 call id 解包 `results[0].result`,0.2.1 的单结果原样透传。
15
+ - 合并时加固:恢复 #66 的 PTC 嵌套派发 `parent` 令牌,但**仅在检测到 PTC 面**(可见 `run_code`)时携带,使 0.2.1 的 PTC 继续可用,而 native 调用永不携带(0.2.2 以执行源判定 PTC)。
16
+
17
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.4...v0.6.5
18
+
19
+ ## 0.6.4 (2026-11-07)
20
+
21
+ ### English
22
+
23
+ - **Fix(goal): a completed goal is no longer re-completed on every later turn, and synthetic call ids are unique (issue #80).** (thanks @hjwsm1989, #82)
24
+ - `detectGoalContext()` scanned the whole history, so markers from an already completed goal still matched a brand-new human turn; the adapter then emitted a synthetic `update_goal(complete)` whose call id was deterministic (`…-<goalId>-<revision>`). Nine identical `tool_call` ids piled up in the transcript — harmless on the agy route (it never serializes the transcript) but an immediate, permanent `400 Duplicate 'call_id'` after switching to an HTTP provider.
25
+ - The scan now stops at the newest genuine human message; a new `resolveGoalContext(messages, live)` makes the live goal view authoritative (`live === null` → never synthesize a completion; `undefined` → history fallback for older hosts); and each emission mints a unique id (`…-<time36>-<seq36>`). The `sessionGoal()` log fallback no longer returns a completed/blocked goal.
26
+
27
+ - **Fix(client): compact the account modal and align the quota progress bars.** (thanks @Ronnoc, #81)
28
+ - 4+ accounts now fit without truncating the fourth card (`max-height: min(88vh, 880px)`, tighter card padding/margins); the left window-label column is a fixed 64px so every progress bar starts/ends on the same X; status badges are `nowrap`/`flexShrink: 0` so `冷却中` no longer wraps character-by-character.
29
+
30
+ ### 中文
31
+
32
+ - **修复(goal):已完成的目标不再在后续每轮重复完成,合成 call id 也保证唯一(issue #80)。**(感谢 @hjwsm1989,#82)
33
+ - `detectGoalContext()` 扫描整段历史,已完成目标的标记仍会匹配到新的用户轮次,适配器因此反复发出 `update_goal(complete)`,call id 又是确定值(`…-<goalId>-<revision>`);九条相同 `tool_call` id 堆积后在 agy 路由上无感,但切到 HTTP provider 就会永久 `400 Duplicate 'call_id'`。
34
+ - 现在扫描在最近一条真实用户消息处停止;新增 `resolveGoalContext(messages, live)` 让实时 goal 视图权威(`null` → 绝不合成完成;`undefined` → 旧宿主走历史回退);每次发号都唯一(`…-<time36>-<seq36>`);`sessionGoal()` 的日志回退也不再返回已完成/阻塞的目标。
35
+
36
+ - **修复(client):压缩账号弹窗、对齐额度进度条。**(感谢 @Ronnoc,#81)
37
+ - 4 个以上账号不再截断第 4 张卡片(`max-height: min(88vh, 880px)`、更紧凑的卡片内外边距);左侧窗口标签列固定 64px,所有进度条起止 X 对齐;状态徽章 `nowrap`+`flexShrink: 0`,`冷却中` 不再逐字换行。
38
+
39
+ **Full Changelog**: https://github.com/amlyczz/dsh-agy-link/compare/v0.6.3...v0.6.4
40
+
3
41
  ## 0.6.3 (2026-11-06)
4
42
 
5
43
  ### English
package/dist/client.js CHANGED
@@ -139,6 +139,7 @@ window.__ModuleLoader__.load({
139
139
  "status.loading": "正在加载 Antigravity 状态...",
140
140
  "status.authRequired": "需重新登录",
141
141
  "account.setActive": "设为当前使用",
142
+ "account.use": "使用",
142
143
  "account.settingActive": "切换中",
143
144
  "account.activeSet": "已切换当前使用账号",
144
145
  "account.activeSetFailed": "该账号当前不可用(冷却或需重新登录)",
@@ -320,6 +321,7 @@ window.__ModuleLoader__.load({
320
321
  "status.loading": "Loading Antigravity status...",
321
322
  "status.authRequired": "Sign in again required",
322
323
  "account.setActive": "Set as in use",
324
+ "account.use": "Use",
323
325
  "account.settingActive": "Switching...",
324
326
  "account.activeSet": "Active account switched",
325
327
  "account.activeSetFailed": "Account not currently eligible (cooldown or auth required)",
@@ -501,6 +503,7 @@ window.__ModuleLoader__.load({
501
503
  "status.loading": "Carregando o status do Antigravity...",
502
504
  "status.authRequired": "É necessário entrar novamente",
503
505
  "account.setActive": "Definir como em uso",
506
+ "account.use": "Usar",
504
507
  "account.settingActive": "Alternando...",
505
508
  "account.activeSet": "Conta em uso alterada",
506
509
  "account.activeSetFailed": "Conta não elegível no momento (cooldown ou login necessário)",
@@ -682,6 +685,7 @@ window.__ModuleLoader__.load({
682
685
  "status.loading": "Cargando el estado de Antigravity...",
683
686
  "status.authRequired": "Debe iniciar sesión de nuevo",
684
687
  "account.setActive": "Establecer como en uso",
688
+ "account.use": "Usar",
685
689
  "account.settingActive": "Cambiando...",
686
690
  "account.activeSet": "Cuenta en uso cambiada",
687
691
  "account.activeSetFailed": "Cuenta no elegible ahora (enfriamiento o requiere login)",
@@ -5673,14 +5677,16 @@ body.dark .agy-tsl-card,
5673
5677
  style: {
5674
5678
  display: "flex",
5675
5679
  alignItems: "center",
5676
- fontSize: "11.5px",
5677
- margin: "4px 0"
5680
+ fontSize: "11px",
5681
+ margin: "1.5px 0"
5678
5682
  }
5679
5683
  }, h("span", { style: {
5680
5684
  width: "64px",
5685
+ minWidth: "64px",
5686
+ maxWidth: "64px",
5681
5687
  color: "var(--agy-text-window-label)",
5682
- fontSize: "11px",
5683
- fontWeight: 700,
5688
+ fontSize: "10.5px",
5689
+ fontWeight: 600,
5684
5690
  flexShrink: 0,
5685
5691
  whiteSpace: "nowrap"
5686
5692
  } }, windowName), h("div", {
@@ -5695,46 +5701,62 @@ body.dark .agy-tsl-card,
5695
5701
  borderRadius: "3px"
5696
5702
  }
5697
5703
  })), h("div", { style: {
5698
- display: "inline-flex",
5704
+ display: "flex",
5699
5705
  alignItems: "center",
5700
- gap: "8px",
5701
- minWidth: "140px",
5702
- justifyContent: "flex-end",
5706
+ gap: "6px",
5707
+ width: "235px",
5708
+ minWidth: "235px",
5709
+ maxWidth: "235px",
5703
5710
  flexShrink: 0
5704
5711
  } }, h("span", {
5705
5712
  title: tooltipText,
5706
5713
  style: {
5707
- padding: "2px 7px",
5708
- borderRadius: "4px",
5714
+ width: "38px",
5715
+ minWidth: "38px",
5716
+ maxWidth: "38px",
5717
+ textAlign: "center",
5718
+ boxSizing: "border-box",
5719
+ padding: "1px 0",
5720
+ borderRadius: "3px",
5709
5721
  background: c.bg,
5710
5722
  color: c.text,
5711
5723
  border: `1px solid ${c.border}`,
5712
5724
  fontWeight: 700,
5713
- fontSize: "11.5px",
5714
- lineHeight: 1.2,
5725
+ fontSize: "10.5px",
5726
+ lineHeight: 1.1,
5727
+ flexShrink: 0,
5715
5728
  cursor: tooltipText ? "help" : "default"
5716
5729
  }
5717
- }, percent < 0 ? "—" : `${percent}%`), resetStr ? h("span", { style: {
5718
- color: "var(--agy-text-secondary)",
5719
- fontSize: "11px",
5720
- fontWeight: 500
5721
- } }, `↻ ${resetStr}`) : null));
5730
+ }, percent < 0 ? "—" : `${percent}%`), h("span", {
5731
+ title: resetStr ? `↻ ${resetStr}` : void 0,
5732
+ style: {
5733
+ flex: "1",
5734
+ minWidth: 0,
5735
+ color: "var(--agy-text-secondary)",
5736
+ fontSize: "10px",
5737
+ fontWeight: 500,
5738
+ whiteSpace: "nowrap",
5739
+ overflow: "hidden",
5740
+ textOverflow: "ellipsis"
5741
+ }
5742
+ }, resetStr ? `↻ ${resetStr}` : "")));
5722
5743
  };
5723
- return h("div", { style: {
5724
- margin: "6px 0",
5725
- padding: "8px 10px",
5726
- background: "var(--agy-bg-subbox)",
5727
- borderRadius: "7px",
5728
- border: "1px solid var(--agy-border-box)"
5729
- } }, h("div", { style: {
5744
+ return h("div", {
5745
+ key: familyKey,
5746
+ style: familyKey !== "google" ? {
5747
+ marginTop: "4px",
5748
+ paddingTop: "4px",
5749
+ borderTop: "1px dashed var(--agy-border-box)"
5750
+ } : void 0
5751
+ }, h("div", { style: {
5730
5752
  display: "flex",
5731
5753
  alignItems: "center",
5732
- gap: "6px",
5754
+ gap: "5px",
5733
5755
  fontWeight: 700,
5734
- fontSize: "12.5px",
5735
- marginBottom: "5px",
5736
- color: "var(--agy-text-primary)"
5737
- } }, brandIcon(FAMILY_BRAND[familyKey], 14), h("span", null, label)), familyKey !== "argon" || has5h ? renderLine(t("quota.fiveHour"), pct5h, c5h, w5h.resetText ? w5h.resetText + cdNote : expiredFull5h ? t("quota.windowReset") + cdNote : cdNote.replace(/^ · /, ""), info?.remainingFraction, info?.resetTime) : null, renderLine(t("quota.weekly"), pctWeekly, cWeekly, wWeekly.resetText ? wWeekly.resetText : expiredFullWeekly ? t("quota.windowReset") : "", info?.weeklyFraction, info?.weeklyResetTime));
5756
+ fontSize: "11px",
5757
+ marginBottom: "2px",
5758
+ color: "var(--agy-text-secondary)"
5759
+ } }, brandIcon(FAMILY_BRAND[familyKey], 12), h("span", null, label)), familyKey !== "argon" || has5h ? renderLine(t("quota.fiveHour"), pct5h, c5h, w5h.resetText ? w5h.resetText + cdNote : expiredFull5h ? t("quota.windowReset") + cdNote : cdNote.replace(/^ · /, ""), info?.remainingFraction, info?.resetTime) : null, renderLine(t("quota.weekly"), pctWeekly, cWeekly, wWeekly.resetText ? wWeekly.resetText : expiredFullWeekly ? t("quota.windowReset") : "", info?.weeklyFraction, info?.weeklyResetTime));
5738
5760
  }
5739
5761
  const GLOBAL_CSS = `
5740
5762
  @keyframes agy-spin {
@@ -6116,11 +6138,11 @@ html.agy-modal-open body {
6116
6138
  .agy-modal-panel {
6117
6139
  position: relative;
6118
6140
  width: 100%;
6119
- max-width: 640px;
6120
- max-height: min(820px, calc(100vh - 48px));
6141
+ max-width: 680px;
6142
+ max-height: min(840px, calc(100vh - 48px));
6121
6143
  background: var(--agy-bg-panel);
6122
6144
  border: 1px solid var(--agy-border-card);
6123
- border-radius: 14px;
6145
+ border-radius: 12px;
6124
6146
  box-shadow: var(--agy-shadow-modal);
6125
6147
  display: flex;
6126
6148
  flex-direction: column;
@@ -6139,12 +6161,12 @@ html.agy-modal-open body {
6139
6161
  display: flex;
6140
6162
  align-items: center;
6141
6163
  justify-content: space-between;
6142
- padding: 7px 10px;
6143
- font-size: 11.5px;
6144
- border-radius: 6px;
6164
+ padding: 4px 8px;
6165
+ font-size: 11px;
6166
+ border-radius: 5px;
6145
6167
  background: var(--agy-bg-subbox);
6146
6168
  border: 1px solid var(--agy-border-box);
6147
- margin: 4px 0;
6169
+ margin: 2px 0;
6148
6170
  color: var(--agy-text-primary);
6149
6171
  }
6150
6172
 
@@ -6228,7 +6250,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6228
6250
  white-space: nowrap;
6229
6251
  }
6230
6252
  .agy-quota-line > div:nth-child(2) { grid-area: bar; margin: 0 !important; }
6231
- .agy-quota-line > div:nth-child(3) { grid-area: cluster; min-width: 0 !important; }
6253
+ .agy-quota-line > div:nth-child(3) { grid-area: cluster; min-width: 0 !important; width: auto !important; }
6232
6254
 
6233
6255
  /* Header actions: the primary action keeps a full row, the two
6234
6256
  secondary ones share the next. */
@@ -6265,13 +6287,14 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6265
6287
  function injectGlobalStyles() {
6266
6288
  if (typeof document === "undefined") return;
6267
6289
  const styleId = "dsh-agy-link-global-css";
6268
- if (document.getElementById(styleId) === null) {
6269
- const st = document.createElement("style");
6290
+ let st = document.getElementById(styleId);
6291
+ if (st === null) {
6292
+ st = document.createElement("style");
6270
6293
  st.id = styleId;
6271
- st.textContent = GLOBAL_CSS;
6272
6294
  const host = document.head ?? document.documentElement;
6273
6295
  if (host) host.appendChild(st);
6274
6296
  }
6297
+ if (st && st.textContent !== GLOBAL_CSS) st.textContent = GLOBAL_CSS;
6275
6298
  }
6276
6299
  const S = {
6277
6300
  container: {
@@ -6284,11 +6307,11 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6284
6307
  display: "flex",
6285
6308
  alignItems: "center",
6286
6309
  justifyContent: "space-between",
6287
- padding: "12px 16px",
6310
+ padding: "8px 12px",
6288
6311
  background: "var(--agy-bg-header)",
6289
6312
  border: "1px solid var(--agy-border-card)",
6290
- borderRadius: "10px",
6291
- marginBottom: "12px",
6313
+ borderRadius: "8px",
6314
+ marginBottom: "8px",
6292
6315
  color: "var(--agy-text-primary)",
6293
6316
  boxShadow: "var(--agy-shadow-card)"
6294
6317
  },
@@ -6314,7 +6337,9 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6314
6337
  padding: "2px 7px",
6315
6338
  borderRadius: "5px",
6316
6339
  fontSize: "11px",
6317
- fontWeight: 600
6340
+ fontWeight: 600,
6341
+ whiteSpace: "nowrap",
6342
+ flexShrink: 0
6318
6343
  },
6319
6344
  badgeReady: {
6320
6345
  display: "inline-flex",
@@ -6344,8 +6369,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6344
6369
  background: "var(--agy-bg-card)",
6345
6370
  border: "1px solid var(--agy-border-card)",
6346
6371
  borderRadius: "8px",
6347
- padding: "10px 14px",
6348
- marginBottom: "8px",
6372
+ padding: "8px 10px",
6373
+ marginBottom: "6px",
6349
6374
  color: "var(--agy-text-primary)",
6350
6375
  boxShadow: "var(--agy-shadow-card)",
6351
6376
  transition: "border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease"
@@ -6354,27 +6379,27 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6354
6379
  background: "var(--agy-bg-card)",
6355
6380
  border: "1px solid var(--agy-border-card)",
6356
6381
  borderRadius: "8px",
6357
- padding: "10px 14px",
6358
- marginBottom: "8px",
6382
+ padding: "8px 10px",
6383
+ marginBottom: "6px",
6359
6384
  color: "var(--agy-text-primary)",
6360
6385
  boxShadow: "var(--agy-shadow-card)",
6361
6386
  transition: "border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease"
6362
6387
  },
6363
6388
  quotaBox: {
6364
- background: "var(--agy-bg-box)",
6389
+ background: "var(--agy-bg-subbox)",
6365
6390
  border: "1px solid var(--agy-border-box)",
6366
- borderRadius: "8px",
6367
- padding: "8px 10px",
6368
- marginTop: "8px"
6391
+ borderRadius: "6px",
6392
+ padding: "5px 8px",
6393
+ marginTop: "5px"
6369
6394
  },
6370
6395
  progressBarBg: {
6371
6396
  flex: "1",
6372
- height: "8px",
6373
- borderRadius: "4px",
6397
+ height: "6px",
6398
+ borderRadius: "3px",
6374
6399
  background: "var(--agy-bg-progress-track)",
6375
6400
  border: "1px solid var(--agy-border-box)",
6376
6401
  overflow: "hidden",
6377
- margin: "0 10px"
6402
+ margin: "0 8px"
6378
6403
  },
6379
6404
  btn: {
6380
6405
  display: "inline-flex",
@@ -6407,8 +6432,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6407
6432
  display: "inline-flex",
6408
6433
  alignItems: "center",
6409
6434
  justifyContent: "center",
6410
- padding: "4px 9px",
6411
- borderRadius: "6px",
6435
+ padding: "2px 6px",
6436
+ borderRadius: "4px",
6412
6437
  border: "1px solid var(--agy-danger-border)",
6413
6438
  background: "var(--agy-danger-bg)",
6414
6439
  color: "var(--agy-danger-text)",
@@ -6420,26 +6445,26 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6420
6445
  display: "inline-flex",
6421
6446
  alignItems: "center",
6422
6447
  justifyContent: "center",
6423
- padding: "4px 9px",
6424
- borderRadius: "5px",
6448
+ padding: "2px 6px",
6449
+ borderRadius: "4px",
6425
6450
  border: "1px solid var(--agy-border-btn)",
6426
6451
  background: "var(--agy-bg-btn)",
6427
6452
  color: "var(--agy-text-btn)",
6428
6453
  cursor: "pointer",
6429
- fontSize: "11.5px",
6454
+ fontSize: "11px",
6430
6455
  fontWeight: 600
6431
6456
  },
6432
6457
  btnSmPrimary: {
6433
6458
  display: "inline-flex",
6434
6459
  alignItems: "center",
6435
6460
  justifyContent: "center",
6436
- padding: "4px 9px",
6437
- borderRadius: "5px",
6461
+ padding: "2px 6px",
6462
+ borderRadius: "4px",
6438
6463
  border: "1px solid var(--agy-border-btn-primary)",
6439
6464
  background: "var(--agy-bg-btn-primary)",
6440
6465
  color: "var(--agy-text-btn-primary)",
6441
6466
  cursor: "pointer",
6442
- fontSize: "11.5px",
6467
+ fontSize: "11px",
6443
6468
  fontWeight: 700
6444
6469
  },
6445
6470
  segGroup: {
@@ -6950,8 +6975,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6950
6975
  const cardStyle = {
6951
6976
  ...S.card,
6952
6977
  cursor: "default",
6953
- padding: "10px 14px",
6954
- marginBottom: "8px",
6978
+ padding: "8px 10px",
6979
+ marginBottom: "6px",
6955
6980
  ...!acc.enabled ? { opacity: .72 } : {}
6956
6981
  };
6957
6982
  const legacyDefault = acc.defaultAlias === void 0 && acc.systemHome && acc.alias === "主账号 (系统登录)";
@@ -6987,21 +7012,22 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
6987
7012
  alignItems: "center",
6988
7013
  justifyContent: "space-between",
6989
7014
  userSelect: "none",
6990
- gap: "8px",
6991
- marginBottom: "8px"
7015
+ gap: "6px",
7016
+ marginBottom: "4px"
6992
7017
  } }, h("div", { style: {
6993
7018
  display: "flex",
6994
7019
  alignItems: "center",
6995
- gap: "6px",
6996
- flexWrap: "wrap",
7020
+ gap: "4px",
7021
+ flexWrap: "nowrap",
6997
7022
  flex: "1",
6998
- minWidth: 0
7023
+ minWidth: 0,
7024
+ overflow: "hidden"
6999
7025
  } }, h("span", {
7000
7026
  style: {
7001
7027
  ...S.badgeTag,
7002
7028
  fontWeight: 700,
7003
- fontSize: "10.5px",
7004
- padding: "1px 5px",
7029
+ fontSize: "10px",
7030
+ padding: "1px 4px",
7005
7031
  background: isPrimary ? "var(--agy-badge-primary-bg)" : "var(--agy-badge-tag-bg)",
7006
7032
  color: isPrimary ? "var(--agy-badge-primary-text)" : "var(--agy-badge-tag-text)",
7007
7033
  borderColor: isPrimary ? "var(--agy-badge-primary-border)" : "var(--agy-badge-tag-border)"
@@ -7016,36 +7042,36 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7016
7042
  className: "agy-btn",
7017
7043
  style: {
7018
7044
  ...S.btnSm,
7019
- padding: "1px 4px",
7020
- fontSize: "10px",
7045
+ padding: "1px 3px",
7046
+ fontSize: "9px",
7021
7047
  lineHeight: 1,
7022
- height: "18px"
7048
+ height: "17px"
7023
7049
  },
7024
7050
  title: t("account.moveUp"),
7025
7051
  onClick: () => void moveAccount(acc.id, -1)
7026
- }, uiIcon("arrowUp", 10)) : null, accIndex < accounts.length - 1 ? h("button", {
7052
+ }, uiIcon("arrowUp", 9)) : null, accIndex < accounts.length - 1 ? h("button", {
7027
7053
  type: "button",
7028
7054
  className: "agy-btn",
7029
7055
  style: {
7030
7056
  ...S.btnSm,
7031
- padding: "1px 4px",
7032
- fontSize: "10px",
7057
+ padding: "1px 3px",
7058
+ fontSize: "9px",
7033
7059
  lineHeight: 1,
7034
- height: "18px"
7060
+ height: "17px"
7035
7061
  },
7036
7062
  title: t("account.moveDown"),
7037
7063
  onClick: () => void moveAccount(acc.id, 1)
7038
- }, uiIcon("arrowDown", 10)) : null) : null, h("span", {
7064
+ }, uiIcon("arrowDown", 9)) : null) : null, h("span", {
7039
7065
  className: "agy-pulse-dot",
7040
7066
  style: {
7041
7067
  background: dotColor,
7042
- boxShadow: `0 0 6px ${dotColor}aa`,
7068
+ boxShadow: `0 0 5px ${dotColor}aa`,
7043
7069
  marginLeft: "1px"
7044
7070
  }
7045
7071
  }), h("span", {
7046
7072
  style: {
7047
7073
  fontWeight: 700,
7048
- fontSize: "13px",
7074
+ fontSize: "12px",
7049
7075
  color: "var(--agy-text-primary)",
7050
7076
  whiteSpace: "nowrap"
7051
7077
  },
@@ -7055,8 +7081,8 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7055
7081
  background: "rgba(59, 130, 246, 0.12)",
7056
7082
  color: "#3b82f6",
7057
7083
  borderColor: "rgba(59, 130, 246, 0.35)",
7058
- fontSize: "10px",
7059
- padding: "1px 5px",
7084
+ fontSize: "9.5px",
7085
+ padding: "1px 4px",
7060
7086
  fontWeight: 700
7061
7087
  } }, "AGY"), isAuthRequired ? h("span", { style: {
7062
7088
  ...S.badgeTag,
@@ -7064,43 +7090,53 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7064
7090
  color: "#ef4444",
7065
7091
  borderColor: "#fca5a5",
7066
7092
  gap: "3px",
7067
- fontSize: "10px",
7068
- padding: "1px 5px",
7069
- fontWeight: 700
7070
- } }, uiIcon("alert", 10, "#ef4444"), t("status.authRequired")) : null, hasCooldown ? h("span", { style: {
7093
+ fontSize: "9.5px",
7094
+ padding: "1px 4px",
7095
+ fontWeight: 700,
7096
+ whiteSpace: "nowrap",
7097
+ flexShrink: 0
7098
+ } }, uiIcon("alert", 9, "#ef4444"), t("status.authRequired")) : null, hasCooldown ? h("span", { style: {
7071
7099
  ...S.badgeTag,
7072
7100
  background: "rgba(245, 158, 11, 0.15)",
7073
7101
  color: "#f59e0b",
7074
7102
  borderColor: "rgba(245, 158, 11, 0.4)",
7075
7103
  gap: "3px",
7076
- fontSize: "10px",
7077
- padding: "1px 5px",
7078
- fontWeight: 700
7079
- } }, uiIcon("alert", 10, "#f59e0b"), "冷却中") : null, acc.email ? h("span", {
7104
+ fontSize: "9.5px",
7105
+ padding: "1px 4px",
7106
+ fontWeight: 700,
7107
+ whiteSpace: "nowrap",
7108
+ flexShrink: 0
7109
+ } }, uiIcon("alert", 9, "#f59e0b"), "冷却中") : null, acc.email ? h("span", {
7080
7110
  style: {
7081
7111
  ...S.badgeTag,
7082
7112
  background: "var(--agy-badge-email-bg)",
7083
7113
  color: "var(--agy-badge-email-text)",
7084
7114
  borderColor: "var(--agy-badge-email-border)",
7085
- gap: "4px",
7086
- fontSize: "11px",
7087
- padding: "1px 6px",
7088
- whiteSpace: "nowrap"
7115
+ gap: "3px",
7116
+ fontSize: "10px",
7117
+ padding: "1px 5px",
7118
+ maxWidth: "135px",
7119
+ overflow: "hidden",
7120
+ textOverflow: "ellipsis",
7121
+ whiteSpace: "nowrap",
7122
+ flexShrink: 1
7089
7123
  },
7090
7124
  title: acc.email
7091
- }, uiIcon("mail", 10, "var(--agy-badge-email-text)"), acc.email) : null, isInUse ? h("span", {
7125
+ }, uiIcon("mail", 9, "var(--agy-badge-email-text)"), acc.email) : null, isInUse ? h("span", {
7092
7126
  style: {
7093
7127
  ...S.badgeTag,
7094
7128
  background: "rgba(16, 185, 129, 0.12)",
7095
7129
  color: "#10b981",
7096
7130
  borderColor: "rgba(16, 185, 129, 0.45)",
7097
- gap: "3px",
7098
- fontSize: "10px",
7099
- padding: "1px 5px",
7100
- fontWeight: 700
7131
+ gap: "2px",
7132
+ fontSize: "9.5px",
7133
+ padding: "1px 4px",
7134
+ fontWeight: 700,
7135
+ whiteSpace: "nowrap",
7136
+ flexShrink: 0
7101
7137
  },
7102
7138
  title: t("status.inUse")
7103
- }, uiIcon("zap", 10, "#10b981"), t("status.inUse")) : null, (() => {
7139
+ }, uiIcon("zap", 9, "#10b981"), t("status.inUse")) : null, (() => {
7104
7140
  const effectiveProxy = acc.proxyUrl || pool?.systemProxy;
7105
7141
  return effectiveProxy ? h("span", {
7106
7142
  style: {
@@ -7108,29 +7144,29 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7108
7144
  background: "var(--agy-badge-proxy-bg)",
7109
7145
  color: "var(--agy-badge-proxy-text)",
7110
7146
  borderColor: "var(--agy-badge-proxy-border)",
7111
- gap: "4px",
7112
- fontSize: "10px",
7113
- padding: "1px 5px"
7147
+ gap: "3px",
7148
+ fontSize: "9.5px",
7149
+ padding: "1px 4px"
7114
7150
  },
7115
7151
  title: effectiveProxy
7116
- }, uiIcon("globe", 10, "var(--agy-badge-proxy-text)"), t("status.proxy")) : null;
7152
+ }, uiIcon("globe", 9, "var(--agy-badge-proxy-text)"), t("status.proxy")) : null;
7117
7153
  })(), !acc.enabled ? h("span", {
7118
7154
  style: {
7119
7155
  ...S.badgeTag,
7120
7156
  background: "var(--agy-bg-subbox)",
7121
7157
  color: "var(--agy-text-secondary)",
7122
7158
  borderColor: "var(--agy-border-subbox)",
7123
- gap: "3px",
7124
- fontSize: "10px",
7125
- padding: "1px 5px",
7159
+ gap: "2px",
7160
+ fontSize: "9.5px",
7161
+ padding: "1px 4px",
7126
7162
  fontWeight: 700
7127
7163
  },
7128
7164
  title: t("status.disabled")
7129
- }, uiIcon("power", 10, "#64748b"), t("status.disabled")) : null), h("div", {
7165
+ }, uiIcon("power", 9, "#64748b"), t("status.disabled")) : null), h("div", {
7130
7166
  className: "agy-card-actions",
7131
7167
  style: {
7132
7168
  display: "flex",
7133
- gap: "4px",
7169
+ gap: "3px",
7134
7170
  alignItems: "center",
7135
7171
  flexShrink: 0
7136
7172
  }
@@ -7139,87 +7175,93 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7139
7175
  className: "agy-btn",
7140
7176
  style: acc.enabled ? {
7141
7177
  ...S.btnSm,
7142
- gap: "3px",
7143
- fontSize: "11px",
7144
- padding: "2px 6px"
7178
+ gap: "2px",
7179
+ fontSize: "10.5px",
7180
+ padding: "1px 5px",
7181
+ height: "21px"
7145
7182
  } : {
7146
7183
  ...S.btnSmPrimary,
7147
- gap: "3px",
7148
- fontSize: "11px",
7149
- padding: "2px 6px"
7184
+ gap: "2px",
7185
+ fontSize: "10.5px",
7186
+ padding: "1px 5px",
7187
+ height: "21px"
7150
7188
  },
7151
7189
  title: acc.enabled ? t("account.disableTitle") : t("account.enableTitle"),
7152
7190
  disabled: accountActionBusy(acc, "enable"),
7153
7191
  onClick: () => void toggleAccountEnabled(acc)
7154
- }, loadingAction === `enable:${acc.id}` ? [renderSpinner(), acc.enabled ? t("account.disable") : t("account.enable")] : [uiIcon("power", 10, acc.enabled ? "var(--agy-text-secondary)" : "#ffffff"), ` ${acc.enabled ? t("account.disable") : t("account.enable")}`]), h("button", {
7192
+ }, loadingAction === `enable:${acc.id}` ? [renderSpinner(), acc.enabled ? t("account.disable") : t("account.enable")] : [uiIcon("power", 9, acc.enabled ? "var(--agy-text-secondary)" : "#ffffff"), ` ${acc.enabled ? t("account.disable") : t("account.enable")}`]), h("button", {
7155
7193
  type: "button",
7156
7194
  className: "agy-btn",
7157
7195
  style: {
7158
7196
  ...S.btnSm,
7159
- gap: "3px",
7160
- fontSize: "11px",
7161
- padding: "2px 6px",
7162
- minWidth: "58px",
7197
+ gap: "2px",
7198
+ fontSize: "10.5px",
7199
+ padding: "1px 5px",
7200
+ height: "21px",
7163
7201
  justifyContent: "center"
7164
7202
  },
7165
7203
  title: t("account.syncTitle"),
7166
7204
  disabled: accountActionBusy(acc, "refresh"),
7167
7205
  onClick: () => void refreshQuota(acc.id)
7168
- }, loadingAction === `refresh:${acc.id}` ? [renderSpinner(), t("account.syncing")] : [uiIcon("refresh", 10), ` ${t("account.sync")}`]), acc.enabled && !acc.authRequired ? h("button", {
7206
+ }, loadingAction === `refresh:${acc.id}` ? [renderSpinner(), t("account.syncing")] : [uiIcon("refresh", 9), ` ${t("account.sync")}`]), acc.enabled && !acc.authRequired ? h("button", {
7169
7207
  type: "button",
7170
7208
  className: "agy-btn",
7171
7209
  style: {
7172
7210
  ...S.btnSm,
7173
- gap: "3px",
7174
- fontSize: "11px",
7175
- padding: "2px 6px",
7176
- minWidth: "58px",
7211
+ gap: "2px",
7212
+ fontSize: "10.5px",
7213
+ padding: "1px 5px",
7214
+ height: "21px",
7177
7215
  justifyContent: "center"
7178
7216
  },
7179
7217
  title: t("account.warmupTitle"),
7180
7218
  disabled: accountActionBusy(acc, "warmup"),
7181
7219
  onClick: () => void warmupAccount(acc.id)
7182
- }, loadingAction === `warmup:${acc.id}` ? [renderSpinner(), t("account.warmingUp")] : [uiIcon("flame", 10, "#f97316"), ` ${t("account.warmup")}`]) : null, acc.enabled && !isInUse ? h("button", {
7220
+ }, loadingAction === `warmup:${acc.id}` ? [renderSpinner(), t("account.warmingUp")] : [uiIcon("flame", 9, "#f97316"), ` ${t("account.warmup")}`]) : null, acc.enabled && !isInUse ? h("button", {
7183
7221
  type: "button",
7184
7222
  className: "agy-btn",
7185
7223
  style: {
7186
7224
  ...S.btnSm,
7187
- gap: "3px",
7188
- fontSize: "11px",
7189
- padding: "2px 6px"
7225
+ gap: "2px",
7226
+ fontSize: "10.5px",
7227
+ padding: "1px 5px",
7228
+ height: "21px"
7190
7229
  },
7191
7230
  title: t("account.setActive"),
7192
7231
  disabled: accountActionBusy(acc, "active"),
7193
7232
  onClick: () => void setActiveAccount(acc.id)
7194
- }, loadingAction === `active:${acc.id}` ? [renderSpinner(), t("account.settingActive")] : [uiIcon("zap", 10), ` ${t("account.setActive")}`]) : null, h("button", {
7233
+ }, loadingAction === `active:${acc.id}` ? [renderSpinner(), t("account.settingActive")] : [uiIcon("zap", 9), ` ${t("account.use")}`]) : null, h("button", {
7195
7234
  type: "button",
7196
7235
  className: "agy-btn",
7197
7236
  style: isEditingProxy ? {
7198
7237
  ...S.btnSmPrimary,
7199
- gap: "3px",
7200
- fontSize: "11px",
7201
- padding: "2px 6px"
7238
+ gap: "2px",
7239
+ fontSize: "10.5px",
7240
+ padding: "1px 5px",
7241
+ height: "21px"
7202
7242
  } : {
7203
7243
  ...S.btnSm,
7204
- gap: "3px",
7205
- fontSize: "11px",
7206
- padding: "2px 6px"
7244
+ gap: "2px",
7245
+ fontSize: "10.5px",
7246
+ padding: "1px 5px",
7247
+ height: "21px"
7207
7248
  },
7208
7249
  disabled: accountActionBusy(acc, "proxy"),
7209
7250
  onClick: () => setEditingProxyId(isEditingProxy ? null : acc.id)
7210
- }, [uiIcon("globe", 10), ` ${t("proxy.button")}`]), accounts.length > 1 ? h("button", {
7251
+ }, [uiIcon("globe", 9), ` ${t("proxy.button")}`]), accounts.length > 1 ? h("button", {
7211
7252
  type: "button",
7212
7253
  className: "agy-btn",
7213
7254
  style: {
7214
7255
  ...S.btnDanger,
7215
- padding: "2px 6px",
7216
- fontSize: "11px"
7256
+ padding: "1px 5px",
7257
+ fontSize: "10.5px",
7258
+ height: "21px"
7217
7259
  },
7218
7260
  title: t("account.removeTitle"),
7219
7261
  "aria-label": t("account.removeTitle"),
7220
7262
  disabled: accountActionBusy(acc, "remove"),
7221
7263
  onClick: () => void removeAccount(acc.id, displayAlias)
7222
- }, loadingAction === `remove:${acc.id}` ? renderSpinner() : uiIcon("trash", 11, "var(--agy-danger-text)")) : null)), h("div", {
7264
+ }, loadingAction === `remove:${acc.id}` ? renderSpinner() : uiIcon("trash", 10, "var(--agy-danger-text)")) : null)), h("div", {
7223
7265
  key: "agy-body",
7224
7266
  style: S.quotaBox
7225
7267
  }, renderQuotaBar("Gemini", "google", acc), acc.quotas.argon ? renderQuotaBar("Argon", "argon", acc) : null, h("button", {
@@ -7230,19 +7272,20 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7230
7272
  display: "flex",
7231
7273
  alignItems: "center",
7232
7274
  justifyContent: "center",
7233
- gap: "5px",
7234
- marginTop: "6px",
7235
- padding: "5px 10px",
7236
- fontSize: "11px",
7275
+ gap: "4px",
7276
+ marginTop: "3px",
7277
+ padding: "2px 8px",
7278
+ fontSize: "10.5px",
7237
7279
  fontWeight: 600,
7238
7280
  cursor: "pointer",
7239
7281
  color: isExpanded ? "var(--dsw-alias-state-business-primary, #3b82f6)" : "var(--agy-text-secondary)",
7240
- background: "var(--agy-bg-subbox)",
7241
- border: "1px dashed var(--agy-border-box)",
7242
- borderRadius: "6px"
7282
+ background: "transparent",
7283
+ border: "none",
7284
+ borderRadius: "4px",
7285
+ opacity: .85
7243
7286
  },
7244
7287
  onClick: () => toggleExpand(acc.id)
7245
- }, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 10), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers"))), isExpanded ? [
7288
+ }, uiIcon(isExpanded ? "chevronUp" : "chevronDown", 9), h("span", null, isExpanded ? t("account.collapseOthers") : t("account.expandOthers"))), isExpanded ? [
7246
7289
  renderQuotaBar("Claude", "anthropic", acc),
7247
7290
  renderQuotaBar("GPT-OSS", "openai", acc),
7248
7291
  allChildModels.length > 0 ? h("div", { style: {
@@ -7508,7 +7551,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7508
7551
  display: "flex",
7509
7552
  alignItems: "center",
7510
7553
  justifyContent: "space-between",
7511
- marginBottom: "8px",
7554
+ marginBottom: "5px",
7512
7555
  padding: "0 2px"
7513
7556
  } }, h("div", { style: {
7514
7557
  display: "flex",
@@ -7516,7 +7559,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7516
7559
  gap: "6px"
7517
7560
  } }, h("span", { style: {
7518
7561
  fontWeight: 700,
7519
- fontSize: "12.5px",
7562
+ fontSize: "12px",
7520
7563
  color: "var(--agy-text-primary)"
7521
7564
  } }, `账号池 (${accounts.length})`))), renderedAccountCards, h("div", { style: {
7522
7565
  marginTop: "16px",
@@ -7736,7 +7779,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7736
7779
  display: "flex",
7737
7780
  alignItems: "center",
7738
7781
  justifyContent: "space-between",
7739
- padding: "14px 18px",
7782
+ padding: "10px 16px",
7740
7783
  borderBottom: "1px solid var(--agy-border-card)",
7741
7784
  background: "var(--agy-bg-header)",
7742
7785
  color: "var(--agy-text-primary)"
@@ -7772,7 +7815,7 @@ body[data-ds-dark-theme] select.agy-select { color-scheme: dark; }
7772
7815
  style: {
7773
7816
  overflowY: "auto",
7774
7817
  overscrollBehavior: "contain",
7775
- padding: "18px",
7818
+ padding: "12px 14px",
7776
7819
  flex: "1",
7777
7820
  minHeight: 0,
7778
7821
  background: "var(--agy-bg-panel)"
package/dist/index.js CHANGED
@@ -1749,8 +1749,50 @@ function parseGoalRoundText(text) {
1749
1749
  };
1750
1750
  }
1751
1751
  /**
1752
+ * Harness-injected user-role source kinds. They are metadata, not instructions,
1753
+ * and must stay transparent to the trailing-span scans.
1754
+ */
1755
+ const HARNESS_USER_SOURCE_KINDS = /* @__PURE__ */ new Set([
1756
+ "time-context",
1757
+ "skill-catalog",
1758
+ "runtime-context",
1759
+ "model-selection",
1760
+ "system-reminder",
1761
+ "dsh-session-title-llm",
1762
+ "tool-goal",
1763
+ "synthetic"
1764
+ ]);
1765
+ /** Whether this user-role message was injected by the harness, not typed by a human. */
1766
+ function isHarnessInjectedMessage(m) {
1767
+ const src = m.source;
1768
+ if (!src || typeof src !== "object") return false;
1769
+ if (typeof src.kind === "string" && HARNESS_USER_SOURCE_KINDS.has(src.kind)) return true;
1770
+ return src.kind === "plugin" && src.form === "snapshot";
1771
+ }
1772
+ /**
1773
+ * A genuine human instruction (the current turn's task). Goal-round prompts
1774
+ * (`source.kind === 'goal'`) and harness metadata are not human instructions.
1775
+ */
1776
+ function isGenuineUserMessage(m) {
1777
+ if (m.role !== "user") return false;
1778
+ const src = m.source;
1779
+ if (src && typeof src === "object" && src.kind === "goal") return false;
1780
+ if (isHarnessInjectedMessage(m)) return false;
1781
+ const text = extractText$1(m);
1782
+ if (text.trim() === "") return false;
1783
+ return !isHarnessInjectedUserText(text);
1784
+ }
1785
+ /**
1752
1786
  * Detect whether the incoming request is part of a DSH <goal_round> continuation.
1753
1787
  * Extracts goalId, revision, round, and objective if available.
1788
+ *
1789
+ * The scan stops at the newest genuine human message: goal markers BEFORE it
1790
+ * belong to an earlier (possibly already completed) goal and must not leak into
1791
+ * this turn's request. Without that stop every later turn in a session that had
1792
+ * ever run a goal re-synthesized `update_goal(complete)` for the stale goal —
1793
+ * with a deterministic call id, so the transcript accumulated identical
1794
+ * `tool_call` ids and HTTP providers rejected it with
1795
+ * `400 Duplicate 'call_id'` (2026-11-07 incident).
1754
1796
  */
1755
1797
  function detectGoalContext(messages) {
1756
1798
  let goalId;
@@ -1781,6 +1823,7 @@ function detectGoalContext(messages) {
1781
1823
  if (!objective && parsed.objective) objective = parsed.objective;
1782
1824
  }
1783
1825
  }
1826
+ if (isGenuineUserMessage(m)) break;
1784
1827
  }
1785
1828
  if (isGoal) return {
1786
1829
  goalId,
@@ -1792,6 +1835,28 @@ function detectGoalContext(messages) {
1792
1835
  return null;
1793
1836
  }
1794
1837
  /**
1838
+ * Resolve the goal context that a turn may complete.
1839
+ *
1840
+ * - `live === null`: the host's goal service says there is no active, armed
1841
+ * goal — never synthesize a completion (this is what prevents stale history
1842
+ * from marking an already-completed goal again).
1843
+ * - `live === undefined`: the live goal service is unavailable; fall back to
1844
+ * history detection for that host.
1845
+ * - Otherwise the live view supplies the authoritative id/revision, and a
1846
+ * completion is only emitted for a goal round — a direct human turn must not
1847
+ * silently complete an armed goal.
1848
+ */
1849
+ function resolveGoalContext(messages, live) {
1850
+ const round = detectGoalContext(messages);
1851
+ if (live === null) return null;
1852
+ if (live === void 0) return round;
1853
+ if (round === null) return null;
1854
+ return {
1855
+ goalId: live.goalId,
1856
+ revision: live.revision
1857
+ };
1858
+ }
1859
+ /**
1795
1860
  * Detect whether DSH is in Plan Mode.
1796
1861
  * DSH plan-mode injects "You are in plan mode" into the runtime context prompt.
1797
1862
  */
@@ -1850,6 +1915,12 @@ function isPlanToolContinuation(messages) {
1850
1915
  if (typeof callId === "string" && callId.startsWith("agytc-bridge-plan-")) return true;
1851
1916
  return false;
1852
1917
  }
1918
+ let goalCallSeq = 0;
1919
+ /** Mint a unique id for one synthetic goal-completion tool call. */
1920
+ function nextGoalCallId(goalId, revision) {
1921
+ goalCallSeq += 1;
1922
+ return toToolCallId$1(`agytc-bridge-goal-${goalId}-${revision}-${Date.now().toString(36)}-${goalCallSeq.toString(36)}`);
1923
+ }
1853
1924
  /**
1854
1925
  * Build the synthetic `update_goal` tool-call chunk that marks the goal complete on DSH.
1855
1926
  */
@@ -1865,7 +1936,7 @@ function buildGoalCompleteToolCallBlock(goalContext, blockIdx) {
1865
1936
  index: blockIdx,
1866
1937
  block: {
1867
1938
  type: "tool-call",
1868
- id: toToolCallId$1(`agytc-bridge-goal-${goalId}-${revision}`),
1939
+ id: nextGoalCallId(goalId, revision),
1869
1940
  name: "update_goal",
1870
1941
  arguments: JSON.stringify({
1871
1942
  goal_id: goalId,
@@ -31337,20 +31408,8 @@ var AgyAdapter = class AgyAdapter extends LlmAdapter {
31337
31408
  };
31338
31409
  return;
31339
31410
  }
31340
- let goalContext = detectGoalContext(options.messages);
31341
- if ((!goalContext || !goalContext.goalId || goalContext.revision === void 0) && sessionKey && this.deps.sessionGoal) {
31342
- const sg = this.deps.sessionGoal(sessionKey);
31343
- if (sg) {
31344
- if (!goalContext) goalContext = {
31345
- goalId: sg.goalId,
31346
- revision: sg.revision
31347
- };
31348
- else {
31349
- if (!goalContext.goalId) goalContext.goalId = sg.goalId;
31350
- if (goalContext.revision === void 0) goalContext.revision = sg.revision;
31351
- }
31352
- }
31353
- }
31411
+ const liveGoal = sessionKey !== "" && this.deps.sessionGoal ? this.deps.sessionGoal(sessionKey) : void 0;
31412
+ const goalContext = resolveGoalContext(options.messages, liveGoal);
31354
31413
  const supportsGoalUpdate = Boolean(options.tools?.some((t) => t.name === "update_goal"));
31355
31414
  const supportsPlanExit = Boolean(options.tools?.some((t) => t.name === "exit_plan_mode")) && isPlanMode(options.messages);
31356
31415
  const continuation = detectContinuation(options.messages);
@@ -36313,6 +36372,18 @@ function resultText(result) {
36313
36372
  }
36314
36373
  }
36315
36374
  /**
36375
+ * Project one settled call out of a DSH 0.2.2 `ToolBatchResult`
36376
+ * (`{ results: [{ callId, result }] }`). A 0.2.1 single `ToolExecutionResult`
36377
+ * (no `results` array) passes through untouched, so the same bridge serves both
36378
+ * API shapes.
36379
+ */
36380
+ function settledToolResult(result, callId) {
36381
+ const results = result?.results;
36382
+ if (!Array.isArray(results) || results.length === 0) return result;
36383
+ const settled = results.find((entry) => entry?.callId === callId) ?? results[0];
36384
+ return settled?.result ?? settled;
36385
+ }
36386
+ /**
36316
36387
  * Start the loopback endpoint. Resolves once listening. The tools service
36317
36388
  * may arrive later (optional service): pass a thunk.
36318
36389
  */
@@ -36399,19 +36470,26 @@ function startMcpBridge(opts) {
36399
36470
  res.once("close", () => {
36400
36471
  if (!res.writableEnded) controller.abort();
36401
36472
  });
36473
+ const callId = "agy-mcp-" + callSeq;
36402
36474
  const isPtc = svc.schemas(agent).some((tool) => tool.name === "run_code");
36403
36475
  const result = await svc.execute({
36404
- callId: "agy-mcp-" + callSeq,
36405
- name: dshName,
36406
- arguments: parsed.arguments ?? {},
36476
+ calls: [{
36477
+ type: "tool-call",
36478
+ id: callId,
36479
+ name: dshName,
36480
+ arguments: JSON.stringify(parsed.arguments ?? {})
36481
+ }],
36407
36482
  signal: controller.signal,
36408
36483
  ...agent === void 0 ? {} : { agent },
36409
- ...isPtc ? { parent: Symbol("agy-mcp-" + callSeq) } : {}
36484
+ callId,
36485
+ name: dshName,
36486
+ arguments: parsed.arguments ?? {},
36487
+ ...isPtc ? { parent: Symbol(callId) } : {}
36410
36488
  });
36411
36489
  audit("ok caller=" + (agent === void 0 ? "none" : "agent"));
36412
36490
  sendJson(res, 200, {
36413
36491
  ok: true,
36414
- text: resultText(result)
36492
+ text: resultText(settledToolResult(result, callId))
36415
36493
  });
36416
36494
  } catch (e) {
36417
36495
  audit("failed: " + String(e).slice(0, 200));
@@ -36916,20 +36994,29 @@ function apply(ctx, entryConfig = {}) {
36916
36994
  goalId: g.id,
36917
36995
  revision: typeof g.revision === "number" ? g.revision : 1
36918
36996
  };
36997
+ return null;
36919
36998
  }
36920
36999
  } catch {}
36921
37000
  const session = (ctx.get("sessions") ?? ctx.sessions)?.get(sessionId);
36922
- const evs = session?.snapshotEvents?.() ?? session?.ownEvents?.() ?? session?.log ?? session?.events;
36923
- if (!evs) return null;
37001
+ if (!session) return void 0;
37002
+ const evs = session.snapshotEvents?.() ?? session.ownEvents?.() ?? session.log ?? session.events;
37003
+ if (!evs) return void 0;
36924
37004
  for (let i = evs.length - 1; i >= 0; i--) {
36925
37005
  const ev = evs[i];
36926
- if (ev?.type === "goal/change" && ev.data && typeof ev.data === "object") {
36927
- const d = ev.data;
36928
- if (d.operation === "clear") return null;
36929
- if (d.goal?.id) return {
37006
+ if (ev?.type !== "goal/change" || !ev.data || typeof ev.data !== "object") continue;
37007
+ const d = ev.data;
37008
+ switch (d.operation) {
37009
+ case "clear": return null;
37010
+ case "pause":
37011
+ case "block":
37012
+ case "complete": return null;
37013
+ case "create":
37014
+ case "resume": return d.goal?.id ? {
36930
37015
  goalId: d.goal.id,
36931
37016
  revision: typeof d.goal.revision === "number" ? d.goal.revision : 1
36932
- };
37017
+ } : null;
37018
+ case "edit": continue;
37019
+ default: return null;
36933
37020
  }
36934
37021
  }
36935
37022
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-agy-link",
3
- "version": "0.6.3",
3
+ "version": "0.6.5",
4
4
  "description": "Google Antigravity (agy CLI) models for DeepSeek Harness — stream Gemini/Claude/GPT-OSS subscriptions into DSH with thinking, tool activity, token usage and in-GUI Google OAuth login.",
5
5
  "type": "module",
6
6
  "license": "MIT",