mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 00:02:29 +00:00
* fix(agent-hooks): route reminted pane keys to canonical identity (STA-3993) Spawn was stripping $$<base32>:L$$ ORCA_PANE_KEY values (and the launch token) instead of rewriting them to the metadata-proven tab:leaf key, so OMP hooks never entered last-status.json and sleeping rows stayed working. Alias that exact remint form onto the canonical pane so later posts still route, and keep unmatched tokens from stamping another pane. * fix(agent-hooks): keep reminted pane-key aliases first-pane-wins Remint tokens have no embedded tab identity, so a later spawn that reused the same $$ token with a different tab/leaf was overwriting the alias and routing leftover hook posts onto the new pane. Refuse destination changes for that form while still allowing same-pane pty id updates. * fix(agent-hooks): keep pane alias limit import valid after refactor * fix(agent-hooks): bound pane alias destination keys * fix(ssh): keep pane identity env stripped when hooks disabled --------- Co-authored-by: Merge Sim <sim@local>
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { MAX_PANE_KEY_LEN } from './agent-hook-listener/listener-limits'
|
|
import { parseLegacyNumericPaneKey, parsePaneKey } from './stable-pane-id'
|
|
|
|
// Why: remint mints an opaque `$$<base32>:L$$` token (same secret-class wrapping as
|
|
// launch tokens). The hook pipeline only accepts `${tabId}:${leafUuid}`, so this
|
|
// exact form is the physical key we may alias — never an arbitrary string.
|
|
const OPAQUE_REMINTED_PANE_KEY_RE = /^\$\$[A-Za-z2-7]{8,64}:L\$\$$/
|
|
|
|
export function isOpaqueRemintedPaneKey(value: string): boolean {
|
|
return value.length <= MAX_PANE_KEY_LEN && OPAQUE_REMINTED_PANE_KEY_RE.test(value)
|
|
}
|
|
|
|
export function canRegisterPaneKeyAlias(fromPaneKey: string, toPaneKey: string): boolean {
|
|
if (
|
|
fromPaneKey.length === 0 ||
|
|
fromPaneKey.length > MAX_PANE_KEY_LEN ||
|
|
toPaneKey.length === 0 ||
|
|
toPaneKey.length > MAX_PANE_KEY_LEN
|
|
) {
|
|
return false
|
|
}
|
|
const stable = parsePaneKey(toPaneKey)
|
|
if (!stable) {
|
|
return false
|
|
}
|
|
const legacy = parseLegacyNumericPaneKey(fromPaneKey)
|
|
if (legacy) {
|
|
return legacy.tabId === stable.tabId
|
|
}
|
|
return isOpaqueRemintedPaneKey(fromPaneKey)
|
|
}
|