@songsid/agend 2.4.0-beta.16 → 2.4.0-beta.17

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 (112) hide show
  1. package/dist/auth-api.js +2 -0
  2. package/dist/auth-api.js.map +1 -1
  3. package/dist/backend/claude-code.d.ts +10 -1
  4. package/dist/backend/claude-code.js +1 -0
  5. package/dist/backend/claude-code.js.map +1 -1
  6. package/dist/backend/types.d.ts +6 -0
  7. package/dist/backend/types.js.map +1 -1
  8. package/dist/build-provenance.json +1 -1
  9. package/dist/claude-credential-launch.d.ts +1 -0
  10. package/dist/claude-credential-launch.js +13 -2
  11. package/dist/claude-credential-launch.js.map +1 -1
  12. package/dist/claude-credential-vault.d.ts +7 -1
  13. package/dist/claude-credential-vault.js +26 -1
  14. package/dist/claude-credential-vault.js.map +1 -1
  15. package/dist/claude-request-observation.d.ts +7 -0
  16. package/dist/claude-request-observation.js +26 -0
  17. package/dist/claude-request-observation.js.map +1 -0
  18. package/dist/cli-audited.js +8 -6
  19. package/dist/cli-audited.js.map +1 -1
  20. package/dist/daemon.js +6 -0
  21. package/dist/daemon.js.map +1 -1
  22. package/dist/fleet-manager.d.ts +14 -0
  23. package/dist/fleet-manager.js +128 -3
  24. package/dist/fleet-manager.js.map +1 -1
  25. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +9 -3
  26. package/dist/host-monitoring-config.d.ts +2 -1
  27. package/dist/host-monitoring-config.js +8 -3
  28. package/dist/host-monitoring-config.js.map +1 -1
  29. package/dist/host-monitoring-history-files.d.ts +2 -0
  30. package/dist/host-monitoring-history-files.js +16 -0
  31. package/dist/host-monitoring-history-files.js.map +1 -0
  32. package/dist/host-monitoring-history-policy.d.ts +55 -0
  33. package/dist/host-monitoring-history-policy.js +93 -0
  34. package/dist/host-monitoring-history-policy.js.map +1 -0
  35. package/dist/host-monitoring-history-store.d.ts +52 -0
  36. package/dist/host-monitoring-history-store.js +176 -0
  37. package/dist/host-monitoring-history-store.js.map +1 -0
  38. package/dist/host-monitoring-history-worker.d.ts +1 -0
  39. package/dist/host-monitoring-history-worker.js +50 -0
  40. package/dist/host-monitoring-history-worker.js.map +1 -0
  41. package/dist/host-monitoring-history.d.ts +71 -0
  42. package/dist/host-monitoring-history.js +265 -0
  43. package/dist/host-monitoring-history.js.map +1 -0
  44. package/dist/host-monitoring-platform.d.ts +73 -0
  45. package/dist/host-monitoring-platform.js +273 -0
  46. package/dist/host-monitoring-platform.js.map +1 -0
  47. package/dist/host-monitoring-runtime.d.ts +34 -0
  48. package/dist/host-monitoring-runtime.js +80 -0
  49. package/dist/host-monitoring-runtime.js.map +1 -0
  50. package/dist/host-monitoring-settings-store.d.ts +5 -0
  51. package/dist/host-monitoring-settings-store.js +49 -0
  52. package/dist/host-monitoring-settings-store.js.map +1 -0
  53. package/dist/host-monitoring.d.ts +106 -0
  54. package/dist/host-monitoring.js +157 -0
  55. package/dist/host-monitoring.js.map +1 -0
  56. package/dist/public-web-gateway.js +4 -0
  57. package/dist/public-web-gateway.js.map +1 -1
  58. package/dist/runtime-cli-install.js +17 -16
  59. package/dist/runtime-cli-install.js.map +1 -1
  60. package/dist/settings-api.d.ts +3 -0
  61. package/dist/settings-api.js +14 -7
  62. package/dist/settings-api.js.map +1 -1
  63. package/dist/settings-baseline.d.ts +1 -0
  64. package/dist/settings-baseline.js +5 -4
  65. package/dist/settings-baseline.js.map +1 -1
  66. package/dist/settings-change.js +8 -0
  67. package/dist/settings-change.js.map +1 -1
  68. package/dist/settings-effect.d.ts +2 -0
  69. package/dist/settings-effect.js +5 -3
  70. package/dist/settings-effect.js.map +1 -1
  71. package/dist/transcript-monitor.d.ts +1 -0
  72. package/dist/transcript-monitor.js +18 -0
  73. package/dist/transcript-monitor.js.map +1 -1
  74. package/dist/ui/accounts-view.js +7 -5
  75. package/dist/ui/claude-credentials.js +12 -1
  76. package/dist/ui/fleet-office-pack.js +2 -2
  77. package/dist/ui/fleet-office-play.js +142 -3
  78. package/dist/ui/fleet-office-skin.js +67 -2
  79. package/dist/ui/fleet-office-store.js +41 -0
  80. package/dist/ui/fleet-office-zones.js +15 -8
  81. package/dist/ui/fleet-office.js +126 -21
  82. package/dist/ui/host-health-model.js +42 -0
  83. package/dist/ui/host-health.js +74 -0
  84. package/dist/ui/panel-chat.js +99 -43
  85. package/dist/ui/panel-fleet.js +24 -11
  86. package/dist/ui/panel-hub.js +5 -1
  87. package/dist/ui/panel-settings.js +3 -3
  88. package/dist/ui/search-dialog.js +8 -1
  89. package/dist/ui/settings-capabilities.js +2 -0
  90. package/dist/ui/settings-host-monitoring.js +31 -13
  91. package/dist/ui/settings-registry.js +4 -1
  92. package/dist/ui/shared/accounts.css +8 -4
  93. package/dist/ui/shared/agent-sheet.js +5 -2
  94. package/dist/ui/shared/app-route.js +1 -1
  95. package/dist/ui/shared/app.css +37 -0
  96. package/dist/ui/shared/app.js +1 -0
  97. package/dist/ui/shared/chat-strings.js +2 -2
  98. package/dist/ui/shared/chat-thread.js +42 -10
  99. package/dist/ui/shared/instance-nav.js +47 -5
  100. package/dist/ui/shared/jump-idle.js +36 -0
  101. package/dist/ui/shared/theme.js +6 -2
  102. package/dist/ui/shared/ui-menu.js +17 -11
  103. package/dist/web-api.d.ts +2 -0
  104. package/dist/web-api.js +54 -0
  105. package/dist/web-api.js.map +1 -1
  106. package/dist/web-chat-history.d.ts +7 -1
  107. package/dist/web-chat-history.js +19 -3
  108. package/dist/web-chat-history.js.map +1 -1
  109. package/dist/web-shell-routes.d.ts +1 -1
  110. package/dist/web-shell-routes.js +1 -1
  111. package/dist/web-shell-routes.js.map +1 -1
  112. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { parseClaudeRequestObservation } from "./claude-request-observation.js";
1
2
  import { claudeTranscriptRecord, claudeTranscriptLongHead } from "./transcript-records.js";
2
3
  import { readStartupTailRecords } from "./log-steps.js";
3
4
  import { parseClaudeModelRecord } from "./claude-model-observation.js";
@@ -397,6 +398,8 @@ export class TranscriptMonitor extends EventEmitter {
397
398
  this.emit("context_reset");
398
399
  }
399
400
  this.processModelEntry(entry);
401
+ if (!history)
402
+ this.processCredentialEntry(entry);
400
403
  claudeTranscriptRecord(entry, (...event) => {
401
404
  // A copied record with no timestamp cannot prove that its file activity belongs to this launch.
402
405
  if (event[0] === "workspace_follow" && this.historyBefore > 0 && !Number.isFinite(at))
@@ -409,6 +412,21 @@ export class TranscriptMonitor extends EventEmitter {
409
412
  this.emit(event[0], ...event.slice(1));
410
413
  });
411
414
  }
415
+ processCredentialEntry(entry) {
416
+ const record = parseClaudeRequestObservation(entry), launch = this.modelLaunch?.();
417
+ if (!record || !launch || record.at < launch.startedAt || record.at <= this.modelResetAt || record.at > Date.now())
418
+ return;
419
+ try {
420
+ const path = join(this.instanceDir, "statusline.json");
421
+ if (statSync(path).size > 65536)
422
+ return;
423
+ const hook = JSON.parse(readFileSync(path, "utf8"));
424
+ if (hook._agendLaunchId !== launch.id || hook.session_id !== record.sessionId || typeof hook.transcript_path !== "string" || basename(hook.transcript_path) !== record.sessionId + ".jsonl" || /[\\/]subagents[\\/]/.test(hook.transcript_path) || this.transcriptPath !== null && this.transcriptPath !== hook.transcript_path)
425
+ return;
426
+ this.emit("claude_request", record, launch.id);
427
+ }
428
+ catch { /* No owned session proof, no credential promotion. */ }
429
+ }
412
430
  processModelEntry(entry) {
413
431
  // Independent of text/tool parsing: main-thread metadata only, under this launch's inherited hook marker.
414
432
  const observation = parseClaudeModelRecord(entry);
@@ -1 +1 @@
1
- {"version":3,"file":"transcript-monitor.js","sourceRoot":"","sources":["../src/transcript-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAA0B,MAAM,+BAA+B,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAA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B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,8EAA8E;QAC9E,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,GAAG,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACvF,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,wGAAwG;QACxG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;CACF"}
@@ -21,7 +21,7 @@ import { CompactMeter } from "/assets/usage-meter.js"; // #3321: the Usage pan
21
21
  import { CliProductMark, cliLabel } from "./cli-picker.js";
22
22
  import { identityText } from "./account-identity.js";
23
23
  import { UsageBlock } from "./usage-pool.js"; // AGEND-113: every pool and window an account reports, as the server sends them
24
- import { credentialText, removeClaudeCredential } from "./claude-credentials.js";
24
+ import { credentialText, credentialRequestState, credentialStatusText, credentialVerificationTime, credentialRequestHint, removeClaudeCredential } from "./claude-credentials.js";
25
25
  import { openSignIn, refreshSignIn, signInStore } from "./backend-signin.js";
26
26
  import { capsOf } from "./cli-caps.js";
27
27
  import { toast } from "/assets/ui-toast.js";
@@ -73,7 +73,7 @@ register("accounts", {
73
73
  usedPopTitle: "Agents using this account — choose one to open its settings",
74
74
  },
75
75
  "zh-TW": {
76
- title: "帳號", hint: "這台 AgEnD 主機與已配對電腦上各 CLI 的連接:預設連接與具名帳號(憑證設定檔)、誰在使用,以及每週用量。",
76
+ title: "帳號", hint: "這台 AgEnD 主機與已配對電腦上各 CLI 的連接:預設連接與具名帳號、誰在使用,以及每週用量。",
77
77
  loading: "正在讀取帳號…", failed: "無法讀取帳號。", empty: "這台主機上沒有安裝或被 Agent 使用的 CLI。",
78
78
  def: "預設連接", profile: "帳號「{0}」", state_usable: "已連接", state_not_signed_in: "尚未連接", state_reconnect: "需要重新連接", state_unknown: "未確認",
79
79
  state_not_installed: "未安裝", state_too_old: "版本太舊",
@@ -413,25 +413,27 @@ function Row({ cli, row, onMove, onRemove, onSignIn = openSignIn, onSignOut, ope
413
413
  return html`<div class="s-row s-account-row" data-account=${row.profile || "default"}>
414
414
  <div class="s-account-title-bar">
415
415
  <div class="s-account-title-left"><strong>${rowName(row)}</strong>
416
- <span class=${`tag s-auth-state is-${row.state || "unknown"}`}>${managed?(row.credential?.kind?credentialText("notChecked"):tx("state_not_signed_in")):installingNow ? hostInstallText(installRun.mode === "update" ? "updating" : "installing") : tx(row.reconnect ? "state_reconnect" : `state_${row.state || "unknown"}`)}</span>
416
+ <span class=${`tag s-auth-state is-${managed?(credentialRequestState(row.credential)==="verified"?"usable":credentialRequestState(row.credential)==="needs-replacement"?"not_signed_in":"unknown"):row.state || "unknown"}`}>${managed?(row.credential?.kind?credentialStatusText(row.credential):tx("state_not_signed_in")):installingNow ? hostInstallText(installRun.mode === "update" ? "updating" : "installing") : tx(row.reconnect ? "state_reconnect" : `state_${row.state || "unknown"}`)}</span>
417
417
  ${row.usedBy.fleetDefault && cli.profiles ? html`<span class="tag s-account-default-tag">${machine ? tx("machineDefaultTag") : tx("fleetDefaultTag")}</span>` : null}</div>
418
418
  ${readOnly ? null : html`<span class="s-actions">
419
419
  ${canInstall ? html`<${InstallButton} backend=${row.backend} blocked=${running} />` : null}
420
420
  ${row.signIn && typeof onSignIn === "function" ? html`<button type="button" class=${row.state === "not_signed_in" ? "btn btn-sm btn-primary" : "btn btn-sm"} disabled=${running} onClick=${() => onSignIn({ backend: row.backend, ...(row.profile ? { profile: row.profile } : {}), ...(machine ? { machine } : {}),...(managed?{method:row.credential?.kind==="setup-token"?"oauth":"api"}:{}) })}>${row.credential?.kind?credentialText("replace"):row.state === "usable" ? tx("signInAgain") : tx("signIn")}</button>` : null}
421
421
  ${!machine && cli.profiles && row.state !== "not_signed_in" && row.state !== "not_installed" && typeof onMove === "function" ? html`<button type="button" class="btn btn-sm" onClick=${() => onMove(row)}>${tx("moveHere")}</button>` : null}
422
422
  ${canSignOut && !machine && !row.profile && row.signIn ? html`<button type="button" class="btn btn-sm s-account-switch" disabled=${running} onClick=${() => onSignOut(row, "switch")}>${manageWords.switchAccount()}</button>` : null}
423
- ${managed&&row.credential?.kind?html`<button type="button" class="btn btn-sm btn-ghost danger" disabled=${running} onClick=${()=>removeClaudeCredential(row.profile)}>${credentialText("remove")}</button>`:null}
423
+ ${managed&&row.credential?.kind?html`<button type="button" class="btn btn-sm danger" disabled=${running} onClick=${()=>removeClaudeCredential(row.profile)}>${credentialText("remove")}</button>`:null}
424
424
  ${canSignOut ? html`<button type="button" class="btn btn-sm btn-ghost s-account-signout" disabled=${running} onClick=${() => onSignOut(row, "signout")}>${manageWords.signOut()}</button>` : null}
425
- ${manageable && row.profile && typeof onRemove === "function" ? html`<button type="button" class="btn btn-sm btn-ghost danger s-account-remove" onClick=${() => onRemove(row)}>${manageWords.remove()}</button>` : null}
425
+ ${manageable && row.profile && typeof onRemove === "function" ? html`<button type="button" class="btn btn-sm danger s-account-remove" onClick=${() => onRemove(row)}>${manageWords.remove()}</button>` : null}
426
426
  </span>`}
427
427
  </div>
428
428
  <div class="s-account-meta-bar">
429
429
  ${managed?html`<span class="tag">${row.credential?.kind?credentialText(row.credential.kind==="setup-token"?"tokenTag":"apiTag"):tx("state_not_signed_in")}</span>`:null}
430
+ ${managed&&credentialVerificationTime(row.credential)?html`<small data-credential-verified-at>${credentialVerificationTime(row.credential)}</small>`:null}
430
431
  ${who ? html`<span class="tag s-account-identity">${who}</span>` : null}
431
432
  <${UsedBy} row=${row} label=${usedText(row)} openAgent=${openAgent} />
432
433
  ${machine ? html`<small class="s-account-usage is-none" title=${tx("machineNoUsageHint")}>${tx("machineNoUsage")}</small>` : null}
433
434
  </div>
434
435
  ${managed?html`<p class="note">${credentialText("usage")}</p>`:null}
436
+ ${managed&&credentialRequestHint(row.credential)?html`<p class="note" data-credential-request-hint>${credentialRequestHint(row.credential)}</p>`:null}
435
437
  ${usageGroups.length ? html`<${UsageBlock} groups=${usageGroups} stale=${row.usageStale === true} staleInfo=${row.usageStaleInfo} tagOf=${usageTag} label=${tx("usageLabel")} staleText=${tx("winStale")} />` : null}
436
438
  ${why ? html`<p class="note s-account-why">${why}</p>` : null}
437
439
  ${canInstall && !installRun ? html`<p class="note s-account-why">${hostInstallText("notInstalled")}</p>` : null}
@@ -22,6 +22,7 @@ register("claudeCredentials", {
22
22
  usage: "No subscription meters for pasted credentials. Local usage, when available, is an estimate.",
23
23
  replace: "Replace credential", replacement: "Replacement keeps this account’s name and assignments. A confirmation lists the agents that must restart. If format or storage checks fail, the earlier credential stays unchanged.",
24
24
  remove: "Remove saved credential", removeTitle: "Remove this credential?", removeHint: "The account and conversation stay. Move or stop its agents first. This removes only AgEnD’s copy; revoke the credential at Anthropic to invalidate it elsewhere.",
25
+ verified: "Verified", verifiedAt: "Verified at {0}", needsReplacement: "Needs replacement", requestUnknown: "Unknown · request not confirmed", authHint: "The last request was refused (401/403). Replace the saved credential, then continue normal work.", requestUnknownHint: "The last request could not be confirmed. A connection error does not mean the credential is invalid.",
25
26
  tokenTag: "Subscription token", apiTag: "API key · pay as you go", notChecked: "Saved · not verified", restriction: "Open this computer’s local dashboard to paste, replace or remove a credential. Public links are refused, even for a verified administrator."
26
27
  },
27
28
  "zh-TW": {
@@ -37,6 +38,7 @@ register("claudeCredentials", {
37
38
  usage: "貼上的憑證不顯示訂閱額度表;若有本機用量紀錄,會標明是估計值。",
38
39
  replace: "替換憑證", replacement: "替換後保留帳號名稱與 Agent 指派。確認畫面會列出需要重新啟動的 Agent;新憑證若未通過儲存檢查,原憑證保持不變。",
39
40
  remove: "移除儲存的憑證", removeTitle: "移除這組憑證?", removeHint: "保留帳號與對話。請先移走或停止使用它的 Agent。這只會移除 AgEnD 的副本;如要讓其他地方也無法使用,請到 Anthropic 撤銷憑證。",
41
+ verified: "已驗證", verifiedAt: "驗證時間:{0}", needsReplacement: "需要替換憑證", requestUnknown: "未知・尚未確認請求", authHint: "上次請求被拒絕,錯誤碼:401/403。請替換儲存的憑證,再繼續原本的工作。", requestUnknownHint: "無法確認上次請求。連線錯誤不代表憑證失效。",
40
42
  tokenTag: "訂閱 token", apiTag: "API key · 按量付費", notChecked: "已儲存 · 尚未驗證", restriction: "請在這台電腦的本機儀表板貼上、替換或移除憑證。公開連結一律拒絕,即使已驗證的管理員也一樣。"
41
43
  }
42
44
  });
@@ -45,7 +47,16 @@ register("claudeCredentialErrors", {
45
47
  en:{local:"Open the local dashboard on the AgEnD computer and verify your administrator session, then try again. Public links cannot manage saved credentials.",inUse:"This account is in use. Wait for its agents to finish, or stop paused sessions, then try again. No credential was changed.",conflict:"This account changed in another session. Reload its connection details and try again.",invalid:"Enter a single-line credential between 16 and 16,384 bytes.",failed:"The credential could not be saved. The previous credential is unchanged; retry from the local dashboard.",read:"Could not read this account’s connection details.",retry:"Retry",restart:"Agents using this account; running agents restart only when idle:",stop:"Agents using this account; running agents stop only when idle:",pending:"Saved, but these agents still need a restart from their page:",confirm:"Save and restart idle agents",removed:"Saved credential removed. The account and conversation remain.",managedPolicy:"Organization-managed Claude settings are not supported."},
46
48
  "zh-TW":{local:"請在執行 AgEnD 的電腦開啟本機儀表板、驗證管理員身分後再試。公開連結不能管理保存的憑證。",inUse:"這個帳號正在使用中。請等 Agent 完成工作,或先停止暫停的工作階段後再試;憑證尚未變更。",conflict:"其他工作階段已變更這個帳號。請重新讀取連接資訊後再試。",invalid:"請輸入單行憑證,長度須為 16 至 16,384 位元組。",failed:"無法儲存憑證。原憑證保持不變,請從本機儀表板重試。",read:"無法讀取這個帳號的連接資訊。",retry:"重試",restart:"使用這個帳號的 Agent;執行中的 Agent 只會在空閒時重啟:",stop:"使用這個帳號的 Agent;執行中的 Agent 只會在空閒時停止:",pending:"已儲存,以下 Agent 仍需從各自的頁面重新啟動:",confirm:"儲存並重啟空閒的 Agent",removed:"已移除保存的憑證,帳號與對話仍保留。",managedPolicy:"不支援由組織管理的 Claude 設定。"}
47
49
  });
48
- export const credentialText=key=>t("claudeCredentials."+key);
50
+ export const credentialText=(key,...args)=>t("claudeCredentials."+key,...args);
51
+ export function credentialRequestState(metadata){
52
+ if(!metadata?.kind)return "not-connected";
53
+ if(metadata.state==="verified")return typeof metadata.verifiedAt==="string"&&Number.isFinite(Date.parse(metadata.verifiedAt))?"verified":"unknown";
54
+ return ["needs-replacement","unknown"].includes(metadata.state)?metadata.state:"saved-unverified";
55
+ }
56
+ export function credentialStatusText(metadata){const state=credentialRequestState(metadata);return credentialText(state==="verified"?"verified":state==="needs-replacement"?"needsReplacement":state==="unknown"?"requestUnknown":"notChecked");}
57
+ export function credentialVerificationTime(metadata){return credentialRequestState(metadata)==="verified"?credentialText("verifiedAt",new Intl.DateTimeFormat(lang()==="zh-TW"?"zh-TW":"en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(metadata.verifiedAt))):null;}
58
+ export function credentialRequestHint(metadata){const state=credentialRequestState(metadata);return state==="needs-replacement"?credentialText("authHint"):state==="unknown"?credentialText("requestUnknownHint"):null;}
59
+
49
60
  const e=key=>t("claudeCredentialErrors."+key);
50
61
  export const credentialError=code=>{const key=String(code||"").replace(/-/g,"_");return e(["credential_local_verified_required","credential_session_changed","unauthorized","forbidden"].includes(key)?"local":key==="credential_in_use"?"inUse":key==="credential_conflict"?"conflict":key==="credential_invalid"||key==="credential_body_bound"?"invalid":"failed");};
51
62
  export function credentialHelpUrl(method){return "https://songsid.github.io/AgEnD/"+(lang()==="zh-TW"?"zh-tw/":"")+"docs/claude-credentials/#"+method;}
@@ -182,8 +182,8 @@ export const PACK_STATES = ["needs", "crashed", "stuck", "working", "idle", "pau
182
182
  /** M-3293 (#4119): what a bubbles table may name — the states, and the Office's two reactions (a pat, a feed). */
183
183
  export const BUBBLE_KEYS = [...PACK_STATES, "pat", "feed"];
184
184
  const POSES = ["working", "idle", "paused", "needs", "walk", "walkDown", "walkUp", "walkSide"], PROPS = ["task", "send", "report", "broadcast"];
185
- /** A character set's strips: its poses, optional eat pose (M-3432 #4255), and what its people send (#2562). */
186
- const SET_STRIPS = [...POSES, "eat", "prop"];
185
+ /** A character set's strips: its poses, optional eat (M-3432 #4255) and dragged (M-3445 #4267) poses, and what its people send (#2562). */
186
+ const SET_STRIPS = [...POSES, "eat", "dragged", "prop"];
187
187
  /** A furniture item's walking strips (#2596): a character set's walking poses. */
188
188
  const WALKS = ["walk", "walkDown", "walkUp", "walkSide"];
189
189
  const BUILT_IN = new Set(["pixel", "studio"]);
@@ -7,10 +7,9 @@
7
7
  //
8
8
  // Who may play: a single zones office on the dashboard itself (not All offices, not a share link's page, not while Edit
9
9
  // layout is open), with the viewer's "Drag and pat" on (per device, on by default) — and never with reduced motion.
10
- import { LOGICAL, SNACK_LIMITS, stripDurationMs } from "./fleet-office-pack.js";
10
+ import { LOGICAL, SNACK_LIMITS, own, stripDurationMs } from "./fleet-office-pack.js";
11
11
  import { nameHash } from "./fleet-office-model.js";
12
- import { routeStaysInArea } from "./fleet-office-zones.js";
13
- import { WALK } from "./fleet-office-zones.js";
12
+ import { routeStaysInArea, WALK } from "./fleet-office-zones.js";
14
13
 
15
14
  /**
16
15
  * LONG_MS: a touch held this long without moving picks a person up (a finger that moves first pans, as before); SLOP:
@@ -273,10 +272,150 @@ export function createSnacks() {
273
272
  for (const s of scatter.values()) if (t >= s.t0 && t < s.until) return true;
274
273
  return false;
275
274
  },
275
+ /** M-3445: stop a picked-up character's active snack race/eating so dragging takes clean priority. */
276
+ cancel(name) {
277
+ if (!name) return;
278
+ eating.delete(name);
279
+ scatter.delete(name);
280
+ for (const p of placed) p.racers = p.racers.filter((n) => n !== name);
281
+ },
276
282
  clear() { placed = []; eating.clear(); scatter.clear(); },
277
283
  };
278
284
  }
279
285
 
286
+ /** M-3445 (#4266): logical hit radius for dropping a dragged character onto another seat in their area. */
287
+ export const SEAT_DRAG = { DROP_RADIUS: 36 };
288
+
289
+ /** M-3445 (#4266): whether `name` is allowed by #2691 reservation rules to sit on `seat`. */
290
+ export function canSitOnSeat(seat, name) {
291
+ if (!seat || !name) return false;
292
+ return !seat.for || seat.for.includes(name) || seat.lend === true;
293
+ }
294
+
295
+ /**
296
+ * M-3445 (#4266): every seat in `name`'s current area that `name` can legally be dropped onto without
297
+ * violating #2691 seat reservations (owners keep priority over borrowers; an owner with a free/own reserved
298
+ * seat chooses among their reserved seats). Returns [{ area, slot, x, y, current, occupant }].
299
+ */
300
+ export function seatDropTargets(pack, desks, name) {
301
+ if (!pack || !pack.areas || !Array.isArray(desks) || !name) return [];
302
+ const d = desks.find((x) => x && x.node && x.node.name === name);
303
+ if (!d) return [];
304
+ const area = own(pack.areas, d.area);
305
+ if (!area || !Array.isArray(area.seats) || !area.seats.length) return [];
306
+ const occBySlot = new Map();
307
+ for (const other of desks) {
308
+ if (!other || !other.node || other.node.name === name || other.area !== d.area || other.slot < 0) continue;
309
+ occBySlot.set(other.slot, other.node.name);
310
+ }
311
+ const mine = (s, who) => !!s.for && s.for.includes(who);
312
+ const ownedSlots = [];
313
+ for (let i = 0; i < area.seats.length; i++) if (mine(area.seats[i], name)) ownedSlots.push(i);
314
+ const hasOwnClaim = ownedSlots.some((i) => {
315
+ if (i === d.slot) return true;
316
+ const occ = occBySlot.get(i);
317
+ return !occ || !mine(area.seats[i], occ);
318
+ });
319
+ const out = [];
320
+ for (let i = 0; i < area.seats.length; i++) {
321
+ const s = area.seats[i], occ = occBySlot.get(i) || null;
322
+ if (hasOwnClaim) {
323
+ if (!mine(s, name)) continue;
324
+ if (occ && mine(s, occ)) {
325
+ const oldSeat = d.slot >= 0 ? area.seats[d.slot] : null;
326
+ if (!oldSeat || !mine(oldSeat, occ)) continue;
327
+ }
328
+ } else {
329
+ if (!canSitOnSeat(s, name)) continue;
330
+ if (occ && mine(s, occ)) continue;
331
+ }
332
+ out.push({ area: d.area, slot: i, x: s.x, y: s.y, current: i === d.slot, occupant: occ });
333
+ }
334
+ return out;
335
+ }
336
+
337
+ /** M-3445 (#4266): nearest legal seat in `name`'s current area within `radius` of logical point `at`, or null. */
338
+ export function findSeatDropTarget(pack, desks, name, at, radius = SEAT_DRAG.DROP_RADIUS) {
339
+ if (!at || !Number.isFinite(at.x) || !Number.isFinite(at.y)) return null;
340
+ let best = null, bestDist = radius;
341
+ for (const cand of seatDropTargets(pack, desks, name)) {
342
+ const dist = Math.hypot(at.x - cand.x, at.y - cand.y);
343
+ if (dist <= bestDist && (!best || dist < bestDist || cand.slot < best.slot)) {
344
+ best = cand;
345
+ bestDist = dist;
346
+ }
347
+ }
348
+ return best;
349
+ }
350
+
351
+ /**
352
+ * M-3445 (#4266): apply dropping `name` onto `target` seat in their area.
353
+ * Updates live `seats` map and per-office `prefs` ({ [name]: { [area]: slot } }), swapping cleanly when the
354
+ * target is occupied and the vacated seat is legal for the previous occupant, and clearing stale prefs for
355
+ * taken slots so other agents returning to the area later do not collide.
356
+ */
357
+ export function applySeatDrop({ pack, desks, seats, prefs, name, target }) {
358
+ const nextSeats = new Map(seats || []);
359
+ const nextPrefs = {};
360
+ for (const [k, v] of Object.entries(prefs || {})) {
361
+ if (v && typeof v === "object" && !Array.isArray(v)) nextPrefs[k] = { ...v };
362
+ }
363
+ const clearSlotPref = (areaName, slot, keepName) => {
364
+ for (const [who, byArea] of Object.entries(nextPrefs)) {
365
+ if (who === keepName || !byArea) continue;
366
+ if (own(byArea, areaName) === slot) {
367
+ delete byArea[areaName];
368
+ if (!Object.keys(byArea).length) delete nextPrefs[who];
369
+ }
370
+ }
371
+ };
372
+ const d = Array.isArray(desks) ? desks.find((x) => x && x.node && x.node.name === name) : null;
373
+ const area = pack && pack.areas ? own(pack.areas, target.area) : null;
374
+ nextSeats.set(name, { area: target.area, slot: target.slot, x: target.x, y: target.y });
375
+ nextPrefs[name] = { ...(nextPrefs[name] || {}), [target.area]: target.slot };
376
+ clearSlotPref(target.area, target.slot, name);
377
+ let swapped = null;
378
+ const occ = target.occupant;
379
+ if (occ && occ !== name) {
380
+ const oldSlot = d && d.area === target.area && d.slot >= 0 ? d.slot : -1;
381
+ const oldSeat = oldSlot >= 0 && area && area.seats ? area.seats[oldSlot] : null;
382
+ if (oldSeat && canSitOnSeat(oldSeat, occ)) {
383
+ nextSeats.set(occ, { area: target.area, slot: oldSlot, x: oldSeat.x, y: oldSeat.y });
384
+ nextPrefs[occ] = { ...(nextPrefs[occ] || {}), [target.area]: oldSlot };
385
+ clearSlotPref(target.area, oldSlot, occ);
386
+ swapped = { name: occ, slot: oldSlot, seat: { x: oldSeat.x, y: oldSeat.y } };
387
+ } else {
388
+ nextSeats.delete(occ);
389
+ if (nextPrefs[occ]) {
390
+ delete nextPrefs[occ][target.area];
391
+ if (!Object.keys(nextPrefs[occ]).length) delete nextPrefs[occ];
392
+ }
393
+ }
394
+ }
395
+ return { seats: nextSeats, prefs: nextPrefs, swapped };
396
+ }
397
+
398
+ /**
399
+ * M-3445 (#4266): when `stayInArea` is enabled and a dragged character is dropped on empty floor (not on a seat),
400
+ * ensure they land at a point whose walk back to `seat` stays inside `area` (clamping to the area rect, or
401
+ * returning straight to `seat` if no in-area route exists).
402
+ */
403
+ export function clampDropForArea(at, seat, graph, area) {
404
+ if (!seat) return at;
405
+ if (!at || !graph || !graph.areas) return seat;
406
+ const a = own(graph.areas, area);
407
+ if (!a || !a.rect) return seat;
408
+ const r = a.rect;
409
+ const inArea = (p) => p.x >= r.x && p.x <= r.x + r.w && p.y >= r.y && p.y <= r.y + r.h;
410
+ if (inArea(at) && routeStaysInArea(at, seat, graph, area, null)) return at;
411
+ const pad = Math.min(4, r.w / 2, r.h / 2);
412
+ const clamped = {
413
+ x: Math.max(r.x + pad, Math.min(r.x + r.w - pad, at.x)),
414
+ y: Math.max(r.y + pad, Math.min(r.y + r.h - pad, at.y)),
415
+ };
416
+ return routeStaysInArea(clamped, seat, graph, area, null) ? clamped : { x: seat.x, y: seat.y };
417
+ }
418
+
280
419
  /**
281
420
  * M-3432 (#4255): owned snack-drag lifecycle controller.
282
421
  * Manages the four global pointer/key listeners with a single cancellation handle and generation fence so
@@ -154,6 +154,12 @@ function drawDeskBack(ctx, d, look) {
154
154
  ctx.restore();
155
155
  }
156
156
 
157
+ /** M-3445 (#4267): default lifted/dangling motion when a character is dragged without a custom `dragged` strip (zero sway when ms <= 0). */
158
+ export function draggedMotion(ms) {
159
+ if (!(ms > 0)) return { lift: 10, tilt: 0 };
160
+ return { lift: 10 + Math.sin(ms * 0.011) * 1.5, tilt: Math.sin(ms * 0.009) * 0.14 };
161
+ }
162
+
157
163
  function drawCharacter(ctx, d, look, ms, env) {
158
164
  if (look.pose === "away") return;
159
165
  const h = nameHash(look.name), skin = SKIN_TONES[h % SKIN_TONES.length], hair = HAIR[(h >>> 3) % HAIR.length];
@@ -168,6 +174,31 @@ function drawCharacter(ctx, d, look, ms, env) {
168
174
  art(ctx, d, 2.6, 4.6, 0.7, 0.5, "rgba(255, 120, 120, 0.45)", dy); art(ctx, d, 6.7, 4.6, 0.7, 0.5, "rgba(255, 120, 120, 0.45)", dy);
169
175
  };
170
176
  const body = (dy) => { art(ctx, d, 1, 6, 8, 5, coat, dy); art(ctx, d, 4, 6, 2, 2, shirt, dy); };
177
+ if (look.pose === "dragged") {
178
+ // M-3445 (#4267): lifted off the ground shadow, swaying gently with flailing arms and kicking legs (still when ms <= 0).
179
+ const sx = d.seat ? d.seat.x : d.x + CX, sy = d.seat ? d.seat.y : d.y + 53;
180
+ ctx.save();
181
+ ctx.fillStyle = "rgba(0, 0, 0, 0.22)";
182
+ ctx.beginPath(); ctx.ellipse(sx, sy, 12, 4.5, 0, 0, Math.PI * 2); ctx.fill();
183
+ ctx.restore();
184
+ const { lift, tilt } = draggedMotion(ms);
185
+ const px0 = d.x + CX, py0 = d.y + TOP + 4 - lift;
186
+ ctx.translate(px0, py0);
187
+ if (tilt) ctx.rotate(tilt);
188
+ ctx.translate(-px0, -py0 - lift);
189
+ head(0, false); body(0);
190
+ // Surprised tiny "o" mouth & arms raised/flailing alternately.
191
+ art(ctx, d, 4.6, 4.7, 0.8, 0.7, eye);
192
+ const alt = ms > 0 && (f % 2 === 1);
193
+ art(ctx, d, 0, alt ? 4.5 : 6, 1, 3, coat); art(ctx, d, -0.4, alt ? 3.8 : 5.3, 1.2, 1, skin);
194
+ art(ctx, d, 9, alt ? 6 : 4.5, 1, 3, coat); art(ctx, d, 9.2, alt ? 5.3 : 3.8, 1.2, 1, skin);
195
+ // Dangling kicking legs.
196
+ const legs = "#3a3f4b";
197
+ art(ctx, d, alt ? 2.1 : 2.7, 11, 2, alt ? 2.2 : 1.7, legs);
198
+ art(ctx, d, alt ? 5.3 : 5.9, 11, 2, alt ? 1.7 : 2.2, legs);
199
+ ctx.restore();
200
+ return;
201
+ }
171
202
  if (look.pose === "working") {
172
203
  head(0, false); body(0);
173
204
  // Typing: the hands take turns on the keyboard; the screen's lines change.
@@ -268,7 +299,7 @@ function drawProp(ctx, it, ms, env) {
268
299
  }
269
300
 
270
301
  /** Frames per pose and the loop's speed (the built-in strips). */
271
- export const FRAMES = { working: 4, idle: 4, paused: 3, needs: 2, walk: 2 };
302
+ export const FRAMES = { working: 4, idle: 4, paused: 3, needs: 2, walk: 2, dragged: 4 };
272
303
  export const FPS = 4;
273
304
 
274
305
  const BUBBLE_FONT = "600 11px system-ui, sans-serif";
@@ -549,8 +580,19 @@ export function spriteSkin(pack, images, base = pixelSkin) {
549
580
  const st = own(setOf({ name }) || {}, "eat") || own(own(pack.characters, "default") || {}, "eat") || null;
550
581
  return st && ready(st) ? st : null;
551
582
  };
583
+ /** M-3445 (#4267): dragged strip for `name` (their set's `dragged`, else `default.dragged`, else null). */
584
+ const draggedStripOf = (name) => {
585
+ const st = own(setOf({ name }) || {}, "dragged") || own(own(pack.characters, "default") || {}, "dragged") || null;
586
+ return st && ready(st) ? st : null;
587
+ };
552
588
  /** The strip a look shows (its pose; walking, by its heading), when all its pictures are loaded. */
553
589
  const shown = (look, walking = look.pose === "walk") => {
590
+ if (!walking && look.pose === "dragged") {
591
+ const dragSt = draggedStripOf(look.name);
592
+ if (dragSt) return { strip: dragSt, mirror: false, customDragged: true };
593
+ const fallback = poseStrip(setOf(look), look.basePose || "idle", look.heading);
594
+ return fallback && ready(fallback.strip) ? { ...fallback, customDragged: false } : null;
595
+ }
554
596
  if (!walking && look.pose === "eat") {
555
597
  const eatSt = eatStripOf(look.name);
556
598
  if (eatSt) return { strip: eatSt, mirror: false };
@@ -614,12 +656,35 @@ export function spriteSkin(pack, images, base = pixelSkin) {
614
656
  ctx.save();
615
657
  if (look.dim) ctx.globalAlpha = 0.35;
616
658
  const cms = ps ? clipMs(env, `c:${look.name || (d && d.key) || ""}`, ps.strip, ms) : ms;
617
- const done = !!ps && strip(ctx, ps.strip, cms, d.seat.x, d.seat.y, null, ps.mirror);
659
+ let done = false;
660
+ if (ps && look.pose === "dragged") {
661
+ // M-3445 (#4267): ground shadow under feet; custom `dragged` strip plays as authored, otherwise built-in lifted dangle.
662
+ ctx.save();
663
+ ctx.fillStyle = "rgba(0, 0, 0, 0.22)";
664
+ ctx.beginPath(); ctx.ellipse(d.seat.x, d.seat.y, Math.max(10, Math.round(ps.strip.dw * 0.24)), 4.5, 0, 0, Math.PI * 2); ctx.fill();
665
+ ctx.restore();
666
+ if (ps.customDragged) {
667
+ done = strip(ctx, ps.strip, cms, d.seat.x, d.seat.y, null, ps.mirror);
668
+ } else {
669
+ const { lift, tilt } = draggedMotion(ms);
670
+ const b = stripBox(ps.strip, d.seat.x, d.seat.y);
671
+ const px0 = d.seat.x, py0 = b.y + Math.min(10, b.h * 0.22) - lift;
672
+ ctx.translate(px0, py0);
673
+ if (tilt) ctx.rotate(tilt);
674
+ ctx.scale(0.96, 1.04);
675
+ ctx.translate(-px0, -py0 - lift);
676
+ done = strip(ctx, ps.strip, cms, d.seat.x, d.seat.y, null, ps.mirror);
677
+ }
678
+ } else {
679
+ done = !!ps && strip(ctx, ps.strip, cms, d.seat.x, d.seat.y, null, ps.mirror);
680
+ }
618
681
  ctx.restore();
619
682
  if (!done) base.drawCharacter(ctx, d, look.pose === "eat" ? { ...look, pose: look.basePose || "idle" } : look, ms, env);
620
683
  },
621
684
  /** M-3432 (#4255): character's eating strip (set.eat → default.eat → null) when loaded. */
622
685
  eatStrip: eatStripOf,
686
+ /** M-3445 (#4267): character's dragged strip (set.dragged → default.dragged → null) when loaded. */
687
+ draggedStrip: draggedStripOf,
623
688
  /** M-3432 (#4255): draw a snack strip (placed on floor or eat overlay) at logical (x, y). */
624
689
  drawSnack(ctx, st, ms, x, y, env, clipKey = null) {
625
690
  if (!st || !ready(st)) return false;
@@ -39,6 +39,30 @@ const CAROUSEL_KEY = "agend_org_office_carousel";
39
39
  const VIEW_KEY = "agend_org_office_view", VIEWS_MAX = 32;
40
40
  /** #2540: { "<office>@<style>": "cover" } — the offices whose fit fills the panel (the rest: "contain"), the last VIEWS_MAX. */
41
41
  const FIT_KEY = "agend_org_office_fit";
42
+ /** M-3445 (#4266): { "<office>@<style>": { "<name>": { "<area>": slot } } } — per-device seat choices from dragging an agent onto another seat. */
43
+ const SEATS_KEY = "agend_org_office_seats", SEATS_MAX = 32, SEAT_AGENTS_MAX = 500, SEAT_AREAS_MAX = 32, SEAT_SLOT_MAX = 64;
44
+ const UNSAFE_KEY = new Set(["__proto__", "constructor", "prototype"]);
45
+ const safeKey = (k, max = 200) => typeof k === "string" && k.length > 0 && k.length <= max && !UNSAFE_KEY.has(k);
46
+ /** M-3445 (#4266): validate a per-office seat preference map ({ [name]: { [area]: slot } }). */
47
+ export function seatPrefsOk(raw) {
48
+ const out = {};
49
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return out;
50
+ let agents = 0;
51
+ for (const [name, areas] of Object.entries(raw)) {
52
+ if (agents >= SEAT_AGENTS_MAX) break;
53
+ if (!safeKey(name, 200) || !areas || typeof areas !== "object" || Array.isArray(areas)) continue;
54
+ const clean = {};
55
+ let count = 0;
56
+ for (const [area, slot] of Object.entries(areas)) {
57
+ if (count >= SEAT_AREAS_MAX) break;
58
+ if (!safeKey(area, 64) || !Number.isInteger(slot) || slot < 0 || slot >= SEAT_SLOT_MAX) continue;
59
+ clean[area] = slot;
60
+ count++;
61
+ }
62
+ if (count > 0) { out[name] = clean; agents++; }
63
+ }
64
+ return out;
65
+ }
42
66
  const PACK_ID = /^[A-Za-z0-9_-]{1,40}$/;
43
67
  /** #2692: GET /ui/office-pack-changes, checked: { approval, agents: [names], pending: [views], log: [entries] } (anything odd dropped). */
44
68
  export function packChangesOk(d) {
@@ -271,5 +295,22 @@ export function createOfficeStore({ fetch: get = globalThis.fetch, storage } = {
271
295
  const next = Object.entries(m).filter(([k2, v]) => k2 !== key && v === "cover").slice(-(VIEWS_MAX - 1));
272
296
  write(FIT_KEY, JSON.stringify(Object.fromEntries(fitModeOk(mode) === "cover" ? [...next, [key, "cover"]] : next)));
273
297
  },
298
+ /** M-3445 (#4266): per-device seat choices for `key` (`<office>@<style>`): { [name]: { [area]: slot } }. */
299
+ seats: (key) => {
300
+ if (!safeKey(key, 100)) return {};
301
+ try {
302
+ const m = JSON.parse(read(SEATS_KEY) || "{}");
303
+ return m && typeof m === "object" && !Array.isArray(m) && Object.prototype.hasOwnProperty.call(m, key) ? seatPrefsOk(m[key]) : {};
304
+ } catch { return {}; }
305
+ },
306
+ /** M-3445 (#4266): save per-device seat choices for `key`, LRU-capped at SEATS_MAX offices. */
307
+ saveSeats: (key, prefs) => {
308
+ if (!safeKey(key, 100)) return;
309
+ let m = {};
310
+ try { const o = JSON.parse(read(SEATS_KEY) || "{}"); if (o && typeof o === "object" && !Array.isArray(o)) m = o; } catch { m = {}; }
311
+ const clean = seatPrefsOk(prefs);
312
+ const next = Object.entries(m).filter(([k2, v]) => k2 !== key && safeKey(k2, 100) && v && typeof v === "object" && !Array.isArray(v)).slice(-(SEATS_MAX - 1));
313
+ write(SEATS_KEY, JSON.stringify(Object.fromEntries(Object.keys(clean).length ? [...next, [key, clean]] : next)));
314
+ },
274
315
  };
275
316
  }
@@ -50,9 +50,16 @@ export function overflowSpots(area, need = 0) {
50
50
  * `lend` (one no owner of it took). A reserved seat not lent, none of whose owners wants the area, is unavailable:
51
51
  * the area's overflow spots and `over` count without it. Seats without `for` work as before.
52
52
  */
53
- export function assignSeats(pack, wants, prev = new Map()) {
53
+ export function assignSeats(pack, wants, prev = new Map(), seatPrefs = null) {
54
54
  const seats = new Map(), crowd = new Map(), taken = new Map(), spill = new Map(), demand = new Map(), wanting = new Map();
55
55
  const areaOf = (a) => own(pack.areas, a);
56
+ const prefOf = (name, area) => {
57
+ const p = prev.get(name);
58
+ if (p && p.area === area) return p;
59
+ const byArea = seatPrefs && own(seatPrefs, name);
60
+ const slot = byArea && own(byArea, area);
61
+ return Number.isInteger(slot) && slot >= 0 ? { area, slot } : null;
62
+ };
56
63
  for (const w of wants) {
57
64
  demand.set(w.area, (demand.get(w.area) || 0) + 1);
58
65
  if (!wanting.has(w.area)) wanting.set(w.area, new Set());
@@ -70,9 +77,9 @@ export function assignSeats(pack, wants, prev = new Map()) {
70
77
  const usedIn = (area) => { if (!taken.has(area)) taken.set(area, new Set()); return taken.get(area); };
71
78
  const give = (name, area, slot) => { const p = pos(area, slot); usedIn(area).add(slot); seats.set(name, { area, slot, x: p.x, y: p.y }); };
72
79
  const free = (w) => !seats.has(w.name) && !!areaOf(w.area);
73
- // Owners first: their own seat from last time, then their first free one.
80
+ // Owners first: their own seat from last time (or saved seat pref), then their first free one.
74
81
  for (const w of wants) {
75
- const p = prev.get(w.name), s = p && p.area === w.area && p.slot >= 0 && areaOf(w.area) ? areaOf(w.area).seats[p.slot] : null;
82
+ const p = prefOf(w.name, w.area), s = p && p.slot >= 0 && areaOf(w.area) ? areaOf(w.area).seats[p.slot] : null;
76
83
  if (s && mine(s, w.name) && !usedIn(w.area).has(p.slot)) give(w.name, w.area, p.slot);
77
84
  }
78
85
  for (const w of wants) {
@@ -81,8 +88,8 @@ export function assignSeats(pack, wants, prev = new Map()) {
81
88
  if (slot >= 0) give(w.name, w.area, slot);
82
89
  }
83
90
  for (const w of wants) {
84
- const p = prev.get(w.name);
85
- if (!free(w) || !p || p.area !== w.area || !pos(w.area, p.slot) || usedIn(w.area).has(p.slot)) continue;
91
+ const p = prefOf(w.name, w.area);
92
+ if (!free(w) || !p || !pos(w.area, p.slot) || usedIn(w.area).has(p.slot)) continue;
86
93
  const s = p.slot >= 0 ? areaOf(w.area).seats[p.slot] : null;
87
94
  if (s && s.for && !lent(s)) continue; // reserved for someone else (theirs would be taken above)
88
95
  give(w.name, w.area, p.slot);
@@ -106,11 +113,11 @@ export function assignSeats(pack, wants, prev = new Map()) {
106
113
  * the desks layout (rooms → desks with a seat), in logical units, plus `mode: "zones"`, the pack's areas and graph (and
107
114
  * its `straight`, #2634, and `idleVisits`, #3685), the seats given (`seats`, the next call's `prev`), `crowd` and `over` (the areas over capacity).
108
115
  */
109
- export function zonesLayout(pack, nodes, prev = new Map(), { night = false } = {}) {
116
+ export function zonesLayout(pack, nodes, prev = new Map(), { night = false, seatPrefs = null } = {}) {
110
117
  // At night (#2568) the idle go to bed: the area asleep people go to while it has a free seat; the rest doze where they are.
111
118
  const bed = zoneOf(pack, "paused"), bedSeats = own(pack.areas, bed)?.seats || [], sleepers = new Set(), inBed = new Set();
112
119
  const wantsOf = (beds) => nodes.filter((n) => n.state !== "missing").map((n) => ({ name: n.name, area: beds.has(n.name) ? bed : zoneOf(pack, n.state) }));
113
- let placed = assignSeats(pack, wantsOf(inBed), prev);
120
+ let placed = assignSeats(pack, wantsOf(inBed), prev, seatPrefs);
114
121
  if (night) {
115
122
  // #2691 review: who goes to bed is decided by the seat assignment itself (assignSeats' reservation rules), one
116
123
  // sleeper at a time — whoever has a bed of their own there first, then the rest in the fleet's order. A sleeper
@@ -122,7 +129,7 @@ export function zonesLayout(pack, nodes, prev = new Map(), { night = false } = {
122
129
  const hasBed = (n) => bedSeats.some((s) => s.for && s.for.includes(n.name));
123
130
  for (const n of idle) sleepers.add(n.name);
124
131
  for (const n of [...idle.filter(hasBed), ...idle.filter((n) => !hasBed(n))]) {
125
- const trial = assignSeats(pack, wantsOf(new Set([...inBed, n.name])), prev), s = trial.seats.get(n.name);
132
+ const trial = assignSeats(pack, wantsOf(new Set([...inBed, n.name])), prev, seatPrefs), s = trial.seats.get(n.name);
126
133
  if (!s || s.area !== bed || s.slot < 0) {
127
134
  if (!hasBed(n)) break; // no bed free for anyone without one: none for the rest either
128
135
  continue;