mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-03 15:27:56 +01:00
* feat(plan-tune): signal hints let unregistered question ids move a dimension (#3442) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs(plan-tune): document signal hints and hinted_events in the design reference (#3442) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * chore: changelog and TODOS gstack: ok 1.92.79.0 for=ship Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test: record the boundaries.ts qid-hint widening as non-behavioral (HARNESS_VERSION 6) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
27 lines
894 B
TypeScript
27 lines
894 B
TypeScript
/**
|
|
* The <gstack-qid:...> marker a skill puts in an asked question (#3442).
|
|
*
|
|
* `<gstack-qid:{id}>` names the question; an unregistered id may add a
|
|
* signal hint, `<gstack-qid:{id};signal={signal_key}>`, naming the
|
|
* SIGNAL_MAP key its answer speaks to. Ids and keys are read lowercase.
|
|
* Whether a hint is a real SIGNAL_MAP key is checked where the row is
|
|
* logged (bin/gstack-question-log), not here.
|
|
*/
|
|
export const QID_MARKER_RE = /<gstack-qid:([a-z0-9-]{1,64})(?:;signal=([a-z0-9-]{1,64}))?>/i;
|
|
|
|
export interface QidMarker {
|
|
id: string;
|
|
signal_key?: string;
|
|
stripped: string;
|
|
}
|
|
|
|
export function parseQidMarker(text: string): QidMarker | undefined {
|
|
const m = QID_MARKER_RE.exec(text);
|
|
if (!m) return undefined;
|
|
return {
|
|
id: m[1]!.toLowerCase(),
|
|
...(m[2] ? { signal_key: m[2].toLowerCase() } : {}),
|
|
stripped: text.replace(QID_MARKER_RE, '').trim(),
|
|
};
|
|
}
|