bertrand 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bertrand.js +12 -3
- package/dist/dashboard/assets/{index-mg96b7q-.js → index-SB5vH7Ec.js} +2 -2
- package/dist/dashboard/index.html +1 -1
- package/dist/migrations/0004_dapper_apocalypse.sql +1 -0
- package/dist/migrations/meta/0004_snapshot.json +784 -0
- package/dist/migrations/meta/_journal.json +7 -0
- package/dist/run-screen.js +42 -5
- package/package.json +1 -1
package/dist/bertrand.js
CHANGED
|
@@ -653,6 +653,7 @@ var init_schema = __esm(() => {
|
|
|
653
653
|
enum: ["active", "waiting", "paused", "archived"]
|
|
654
654
|
}).notNull().default("paused"),
|
|
655
655
|
summary: text("summary"),
|
|
656
|
+
rating: integer("rating"),
|
|
656
657
|
pid: integer("pid"),
|
|
657
658
|
startedAt: text("started_at").notNull().default(sql`(datetime('now'))`),
|
|
658
659
|
endedAt: text("ended_at"),
|
|
@@ -3766,14 +3767,18 @@ function parseSessionName(input) {
|
|
|
3766
3767
|
throw new Error(`Session name must include at least one category: "category/session" (got "${trimmed}")`);
|
|
3767
3768
|
}
|
|
3768
3769
|
for (const segment of segments) {
|
|
3769
|
-
if (
|
|
3770
|
+
if (!SEGMENT_PATTERN.test(segment)) {
|
|
3770
3771
|
throw new Error(`Invalid segment "${segment}": must start with alphanumeric and contain only letters, digits, dots, underscores, or dashes`);
|
|
3771
3772
|
}
|
|
3772
3773
|
}
|
|
3773
|
-
const
|
|
3774
|
-
const
|
|
3774
|
+
const categoryPath = segments[0];
|
|
3775
|
+
const slug = segments.slice(1).join("/");
|
|
3775
3776
|
return { categoryPath, slug };
|
|
3776
3777
|
}
|
|
3778
|
+
var SEGMENT_PATTERN;
|
|
3779
|
+
var init_parse_session_name = __esm(() => {
|
|
3780
|
+
SEGMENT_PATTERN = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
3781
|
+
});
|
|
3777
3782
|
|
|
3778
3783
|
// src/engine/recovery.ts
|
|
3779
3784
|
function isProcessAlive2(pid) {
|
|
@@ -3820,6 +3825,7 @@ function reportFatal(err) {
|
|
|
3820
3825
|
var init_launch = __esm(() => {
|
|
3821
3826
|
init_router();
|
|
3822
3827
|
init_app();
|
|
3828
|
+
init_parse_session_name();
|
|
3823
3829
|
init_session();
|
|
3824
3830
|
init_recovery();
|
|
3825
3831
|
register("launch", async (args) => {
|
|
@@ -4908,6 +4914,7 @@ var init_log = __esm(() => {
|
|
|
4908
4914
|
init_catalog();
|
|
4909
4915
|
init_compact();
|
|
4910
4916
|
init_timing();
|
|
4917
|
+
init_parse_session_name();
|
|
4911
4918
|
init_format();
|
|
4912
4919
|
init_resolve();
|
|
4913
4920
|
init_cli_flag();
|
|
@@ -5066,6 +5073,7 @@ var init_stats2 = __esm(() => {
|
|
|
5066
5073
|
init_events();
|
|
5067
5074
|
init_timing();
|
|
5068
5075
|
init_format();
|
|
5076
|
+
init_parse_session_name();
|
|
5069
5077
|
ACTIVE_STATUSES2 = ["active", "waiting"];
|
|
5070
5078
|
register("stats", async (args) => {
|
|
5071
5079
|
const isJson = args.includes("--json");
|
|
@@ -5143,6 +5151,7 @@ var init_archive = __esm(() => {
|
|
|
5143
5151
|
init_router();
|
|
5144
5152
|
init_sessions();
|
|
5145
5153
|
init_categories();
|
|
5154
|
+
init_parse_session_name();
|
|
5146
5155
|
init_session_archive();
|
|
5147
5156
|
register("archive", async (args) => {
|
|
5148
5157
|
const isUndo = args.includes("--undo");
|
|
@@ -516,7 +516,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[jy(e),e])),Pte=new Map([["s",kn(383)],[kn(38
|
|
|
516
516
|
`,...o.current()});return/^[\t ]/.test(f)&&(f=ph(f.charCodeAt(0))+f.slice(1)),f=f?a+" "+f:a,n.options.closeAtx&&(f+=" "+a),c(),u(),f}ZF.peek=Rme;function ZF(e){return e.value||""}function Rme(){return"<"}JF.peek=_me;function JF(e,t,n,r){const i=bE(n),o=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let f=c.move("![");return f+=c.move(n.safe(e.alt,{before:f,after:"]",...c.current()})),f+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(n.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(u=n.enter("destinationRaw"),f+=c.move(n.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${o}`),f+=c.move(" "+i),f+=c.move(n.safe(e.title,{before:f,after:i,...c.current()})),f+=c.move(i),u()),f+=c.move(")"),a(),f}function _me(){return"!"}e6.peek=Tme;function e6(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const f=n.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(f+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=h,o(),i==="full"||!f||f!==p?c+=u.move(p+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function Tme(){return"!"}t6.peek=Ame;function t6(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const a=n.unsafe[o],u=n.compilePattern(a);let c;if(a.atBreak)for(;c=u.exec(r);){let f=c.index;r.charCodeAt(f)===10&&r.charCodeAt(f-1)===13&&f--,r=r.slice(0,f)+" "+r.slice(c.index+1)}}return i+r+i}function Ame(){return"`"}function n6(e,t){const n=cE(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}r6.peek=Dme;function r6(e,t,n,r){const i=bE(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,c;if(n6(e,n)){const h=n.stack;n.stack=[],u=n.enter("autolink");let p=a.move("<");return p+=a.move(n.containerPhrasing(e,{before:p,after:">",...a.current()})),p+=a.move(">"),u(),n.stack=h,p}u=n.enter("link"),c=n.enter("label");let f=a.move("[");return f+=a.move(n.containerPhrasing(e,{before:f,after:"](",...a.current()})),f+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),f+=a.move("<"),f+=a.move(n.safe(e.url,{before:f,after:">",...a.current()})),f+=a.move(">")):(c=n.enter("destinationRaw"),f+=a.move(n.safe(e.url,{before:f,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${o}`),f+=a.move(" "+i),f+=a.move(n.safe(e.title,{before:f,after:i,...a.current()})),f+=a.move(i),c()),f+=a.move(")"),u(),f}function Dme(e,t,n){return n6(e,n)?"<":"["}i6.peek=Mme;function i6(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const f=n.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(f+"]["),a();const h=n.stack;n.stack=[],a=n.enter("reference");const p=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),n.stack=h,o(),i==="full"||!f||f!==p?c+=u.move(p+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function Mme(){return"["}function vE(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Ome(e){const t=vE(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function $me(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function o6(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Pme(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?$me(n):vE(n);const u=e.ordered?a==="."?")":".":Ome(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),o6(n)===a&&h){let p=-1;for(;++p<e.children.length;){const g=e.children[p];if(g&&g.type==="listItem"&&g.children&&g.children[0]&&g.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(a=u),n.bulletCurrent=a;const f=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),f}function Nme(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Ime(e,t,n,r){const i=Nme(n);let o=n.bulletCurrent||vE(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(a-o.length)),u.shift(a);const c=n.enter("listItem"),f=n.indentLines(n.containerFlow(e,u.current()),h);return c(),f;function h(p,g,y){return g?(y?"":" ".repeat(a))+p:(y?o:o+" ".repeat(a-o.length))+p}}function jme(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const Lme=fb(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Fme(e,t,n,r){return(e.children.some(function(a){return Lme(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function zme(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}s6.peek=Bme;function s6(e,t,n,r){const i=zme(n),o=n.enter("strong"),a=n.createTracker(r),u=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:u,...a.current()}));const f=c.charCodeAt(0),h=my(r.before.charCodeAt(r.before.length-1),f,i);h.inside&&(c=ph(f)+c.slice(1));const p=c.charCodeAt(c.length-1),g=my(r.after.charCodeAt(0),p,i);g.inside&&(c=c.slice(0,-1)+ph(p));const y=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:g.outside,before:h.outside},u+c+y}function Bme(e,t,n){return n.options.strong||"*"}function Ume(e,t,n,r){return n.safe(e.value,r)}function Hme(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Gme(e,t,n){const r=(o6(n)+(n.options.ruleSpaces?" ":"")).repeat(Hme(n));return n.options.ruleSpaces?r.slice(0,-1):r}const a6={blockquote:hme,break:sO,code:vme,definition:wme,emphasis:QF,hardBreak:sO,heading:kme,html:ZF,image:JF,imageReference:e6,inlineCode:t6,link:r6,linkReference:i6,list:Pme,listItem:Ime,paragraph:jme,root:Fme,strong:s6,text:Ume,thematicBreak:Gme};function qme(){return{enter:{table:Vme,tableData:aO,tableHeader:aO,tableRow:Wme},exit:{codeText:Kme,table:Yme,tableData:nx,tableHeader:nx,tableRow:nx}}}function Vme(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function Yme(e){this.exit(e),this.data.inTable=void 0}function Wme(e){this.enter({type:"tableRow",children:[]},e)}function nx(e){this.exit(e)}function aO(e){this.enter({type:"tableCell",children:[]},e)}function Kme(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Xme));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Xme(e,t){return t==="|"?t:e}function Qme(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
517
517
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:u}};function a(y,b,v,S){return f(h(y,v,S),y.align)}function u(y,b,v,S){const x=p(y,v,S),_=f([x]);return _.slice(0,_.indexOf(`
|
|
518
518
|
`))}function c(y,b,v,S){const x=v.enter("tableCell"),_=v.enter("phrasing"),R=v.containerPhrasing(y,{...S,before:o,after:o});return _(),x(),R}function f(y,b){return fme(y,{align:b,alignDelimiters:r,padding:n,stringLength:i})}function h(y,b,v){const S=y.children;let x=-1;const _=[],R=b.enter("table");for(;++x<S.length;)_[x]=p(S[x],b,v);return R(),_}function p(y,b,v){const S=y.children;let x=-1;const _=[],R=b.enter("tableRow");for(;++x<S.length;)_[x]=c(S[x],y,b,v);return R(),_}function g(y,b,v){let S=a6.inlineCode(y,b,v);return v.stack.includes("tableCell")&&(S=S.replace(/\|/g,"\\$&")),S}}function Zme(){return{exit:{taskListCheckValueChecked:lO,taskListCheckValueUnchecked:lO,paragraph:ege}}}function Jme(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:tge}}}function lO(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function ege(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,a;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){a=u;break}}a===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function tge(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(a);let c=a6.listItem(e,t,n,{...r,...u.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),c;function f(h){return h+a}}function nge(){return[Ppe(),tme(),ome(),qme(),Zme()]}function rge(e){return{extensions:[Npe(),nme(e),sme(),Qme(e),Jme()]}}const ige={tokenize:cge,partial:!0},l6={tokenize:fge,partial:!0},u6={tokenize:dge,partial:!0},c6={tokenize:hge,partial:!0},oge={tokenize:pge,partial:!0},f6={name:"wwwAutolink",tokenize:lge,previous:h6},d6={name:"protocolAutolink",tokenize:uge,previous:p6},ls={name:"emailAutolink",tokenize:age,previous:m6},co={};function sge(){return{text:co}}let ll=48;for(;ll<123;)co[ll]=ls,ll++,ll===58?ll=65:ll===91&&(ll=97);co[43]=ls;co[45]=ls;co[46]=ls;co[95]=ls;co[72]=[ls,d6];co[104]=[ls,d6];co[87]=[ls,f6];co[119]=[ls,f6];function age(e,t,n){const r=this;let i,o;return a;function a(p){return!Kw(p)||!m6.call(r,r.previous)||xE(r.events)?n(p):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(p))}function u(p){return Kw(p)?(e.consume(p),u):p===64?(e.consume(p),c):n(p)}function c(p){return p===46?e.check(oge,h,f)(p):p===45||p===95||Qn(p)?(o=!0,e.consume(p),c):h(p)}function f(p){return e.consume(p),i=!0,c}function h(p){return o&&i&&sr(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(p)):n(p)}}function lge(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!h6.call(r,r.previous)||xE(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(ige,e.attempt(l6,e.attempt(u6,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function uge(e,t,n){const r=this;let i="",o=!1;return a;function a(p){return(p===72||p===104)&&p6.call(r,r.previous)&&!xE(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(p),e.consume(p),u):n(p)}function u(p){if(sr(p)&&i.length<5)return i+=String.fromCodePoint(p),e.consume(p),u;if(p===58){const g=i.toLowerCase();if(g==="http"||g==="https")return e.consume(p),c}return n(p)}function c(p){return p===47?(e.consume(p),o?f:(o=!0,c)):n(p)}function f(p){return p===null||dy(p)||Wt(p)||ql(p)||lb(p)?n(p):e.attempt(l6,e.attempt(u6,h),n)(p)}function h(p){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(p)}}function cge(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function fge(e,t,n){let r,i,o;return a;function a(f){return f===46||f===95?e.check(c6,c,u)(f):f===null||Wt(f)||ql(f)||f!==45&&lb(f)?c(f):(o=!0,e.consume(f),a)}function u(f){return f===95?r=!0:(i=r,r=void 0),e.consume(f),a}function c(f){return i||r||!o?n(f):t(f)}}function dge(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(c6,t,o)(a):a===null||Wt(a)||ql(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function hge(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||Wt(u)||ql(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||Wt(u)||ql(u)?t(u):r(u)}function o(u){return sr(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):sr(u)?(e.consume(u),a):n(u)}}function pge(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return Qn(o)?n(o):t(o)}}function h6(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Wt(e)}function p6(e){return!sr(e)}function m6(e){return!(e===47||Kw(e))}function Kw(e){return e===43||e===45||e===46||e===95||Qn(e)}function xE(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const mge={tokenize:Cge,partial:!0};function gge(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:xge,continuation:{tokenize:wge},exit:Sge}},text:{91:{name:"gfmFootnoteCall",tokenize:vge},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:yge,resolveTo:bge}}}}function yge(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!a||!a._balanced)return n(c);const f=Fi(r.sliceSerialize({start:a.end,end:r.now()}));return f.codePointAt(0)!==94||!o.includes(f.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function bge(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function vge(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;return u;function u(p){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),c}function c(p){return p!==94?n(p):(e.enter("gfmFootnoteCallMarker"),e.consume(p),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(p){if(o>999||p===93&&!a||p===null||p===91||Wt(p))return n(p);if(p===93){e.exit("chunkString");const g=e.exit("gfmFootnoteCallString");return i.includes(Fi(r.sliceSerialize(g)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(p)}return Wt(p)||(a=!0),o++,e.consume(p),p===92?h:f}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function xge(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=0,u;return c;function c(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):n(b)}function h(b){if(a>999||b===93&&!u||b===null||b===91||Wt(b))return n(b);if(b===93){e.exit("chunkString");const v=e.exit("gfmFootnoteDefinitionLabelString");return o=Fi(r.sliceSerialize(v)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),g}return Wt(b)||(u=!0),a++,e.consume(b),b===92?p:h}function p(b){return b===91||b===92||b===93?(e.consume(b),a++,h):h(b)}function g(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),i.includes(o)||i.push(o),_t(e,y,"gfmFootnoteDefinitionWhitespace")):n(b)}function y(b){return t(b)}}function wge(e,t,n){return e.check(qh,t,e.attempt(mge,t,n))}function Sge(e){e.exit("gfmFootnoteDefinition")}function Cge(e,t,n){const r=this;return _t(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function Ege(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let f=c;for(;f--;)if(a[f][0]==="exit"&&a[f][1].type==="strikethroughSequenceTemporary"&&a[f][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[f][1].end.offset-a[f][1].start.offset){a[c][1].type="strikethroughSequence",a[f][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[f][1].start),end:Object.assign({},a[c][1].end)},p={type:"strikethroughText",start:Object.assign({},a[f][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",h,u],["enter",a[f][1],u],["exit",a[f][1],u],["enter",p,u]],y=u.parser.constructs.insideSpan.null;y&&Wr(g,g.length,0,ub(y,a.slice(f+1,c),u)),Wr(g,g.length,0,[["exit",p,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",h,u]]),Wr(a,f-1,c-f+3,g),c=f+g.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function o(a,u,c){const f=this.previous,h=this.events;let p=0;return g;function g(b){return f===126&&h[h.length-1][1].type!=="characterEscape"?c(b):(a.enter("strikethroughSequenceTemporary"),y(b))}function y(b){const v=Zc(f);if(b===126)return p>1?c(b):(a.consume(b),p++,y);if(p<2&&!n)return c(b);const S=a.exit("strikethroughSequenceTemporary"),x=Zc(b);return S._open=!x||x===2&&!!v,S._close=!v||v===2&&!!x,u(b)}}}class kge{constructor(){this.map=[]}add(t,n,r){Rge(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function Rge(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function _ge(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Tge(){return{flow:{null:{name:"table",tokenize:Age,resolveAll:Dge}}}}function Age(e,t,n){const r=this;let i=0,o=0,a;return u;function u(j){let I=r.events.length-1;for(;I>-1;){const G=r.events[I][1].type;if(G==="lineEnding"||G==="linePrefix")I--;else break}const M=I>-1?r.events[I][1].type:null,B=M==="tableHead"||M==="tableRow"?D:c;return B===D&&r.parser.lazy[r.now().line]?n(j):B(j)}function c(j){return e.enter("tableHead"),e.enter("tableRow"),f(j)}function f(j){return j===124||(a=!0,o+=1),h(j)}function h(j){return j===null?n(j):Je(j)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y):n(j):wt(j)?_t(e,h,"whitespace")(j):(o+=1,a&&(a=!1,i+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),p(j)))}function p(j){return j===null||j===124||Wt(j)?(e.exit("data"),h(j)):(e.consume(j),j===92?g:p)}function g(j){return j===92||j===124?(e.consume(j),p):p(j)}function y(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),a=!1,wt(j)?_t(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):b(j))}function b(j){return j===45||j===58?S(j):j===124?(a=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),v):A(j)}function v(j){return wt(j)?_t(e,S,"whitespace")(j):S(j)}function S(j){return j===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),x):j===45?(o+=1,x(j)):j===null||Je(j)?T(j):A(j)}function x(j){return j===45?(e.enter("tableDelimiterFiller"),_(j)):A(j)}function _(j){return j===45?(e.consume(j),_):j===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(j))}function R(j){return wt(j)?_t(e,T,"whitespace")(j):T(j)}function T(j){return j===124?b(j):j===null||Je(j)?!a||i!==o?A(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):A(j)}function A(j){return n(j)}function D(j){return e.enter("tableRow"),O(j)}function O(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),O):j===null||Je(j)?(e.exit("tableRow"),t(j)):wt(j)?_t(e,O,"whitespace")(j):(e.enter("data"),$(j))}function $(j){return j===null||j===124||Wt(j)?(e.exit("data"),O(j)):(e.consume(j),j===92?z:$)}function z(j){return j===92||j===124?(e.consume(j),$):$(j)}}function Dge(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,f,h,p;const g=new kge;for(;++n<e.length;){const y=e[n],b=y[1];y[0]==="enter"?b.type==="tableHead"?(u=!1,c!==0&&(uO(g,t,c,f,h),h=void 0,c=0),f={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",f,t]])):b.type==="tableRow"||b.type==="tableDelimiterRow"?(r=!0,p=void 0,o=[0,0,0,0],a=[0,n+1,0,0],u&&(u=!1,h={type:"tableBody",start:Object.assign({},b.start),end:Object.assign({},b.end)},g.add(n,0,[["enter",h,t]])),i=b.type==="tableDelimiterRow"?2:h?3:1):i&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(o[1]!==0&&(a[0]=a[1],p=Km(g,t,o,i,void 0,p),o=[0,0,0,0]),a[2]=n)):b.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],p=Km(g,t,o,i,void 0,p)),o=a,a=[o[1],n,0,0])):b.type==="tableHead"?(u=!0,c=n):b.type==="tableRow"||b.type==="tableDelimiterRow"?(c=n,o[1]!==0?(a[0]=a[1],p=Km(g,t,o,i,n,p)):a[1]!==0&&(p=Km(g,t,a,i,n,p)),i=0):i&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&uO(g,t,c,f,h),g.consume(t.events),n=-1;++n<t.events.length;){const y=t.events[n];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=_ge(t.events,n))}return e}function Km(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},nc(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=nc(t.events,n[1]);if(o={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const f=nc(t.events,n[2]),h=nc(t.events,n[3]),p={type:u,start:Object.assign({},f),end:Object.assign({},h)};if(e.add(n[2],0,[["enter",p,t]]),r!==2){const g=t.events[n[2]],y=t.events[n[3]];if(g[1].end=Object.assign({},y[1].end),g[1].type="chunkText",g[1].contentType="text",n[3]>n[2]+1){const b=n[2]+1,v=n[3]-n[2]-1;e.add(b,v,[])}}e.add(n[3]+1,0,[["exit",p,t]])}return i!==void 0&&(o.end=Object.assign({},nc(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function uO(e,t,n,r,i){const o=[],a=nc(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function nc(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Mge={name:"tasklistCheck",tokenize:$ge};function Oge(){return{text:{91:Mge}}}function $ge(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return Wt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return Je(c)?t(c):wt(c)?e.check({tokenize:Pge},t,n)(c):n(c)}}function Pge(e,t,n){return _t(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Nge(e){return kF([sge(),gge(),Ege(e),Tge(),Oge()])}const Ige={};function jge(e){const t=this,n=e||Ige,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Nge(n)),o.push(nge()),a.push(rge(n))}const Lge=new Set(Object.keys(HP)),cO={js:"javascript",ts:"typescript",py:"python",sh:"bash",shell:"bash",md:"markdown"};function Fge(e){const t=/language-([\w-]+)/.exec(e??"");if(!t)return;const n=t[1].toLowerCase();if(cO[n])return cO[n];if(Lge.has(n))return n}function g6(e){var t;return C.isValidElement(e)&&((t=e.props)==null?void 0:t.type)==="checkbox"}function zge(e){return C.isValidElement(e)&&e.type===Kc}function Bge(e){return C.Children.toArray(e).some(t=>{if(!C.isValidElement(t))return!1;const n=C.Children.toArray(t.props.children);return g6(n[0])})}function Xw(e){if(e==null||typeof e=="boolean")return"";if(typeof e=="string")return e;if(typeof e=="number")return String(e);if(Array.isArray(e))return e.map(Xw).join("");if(C.isValidElement(e)){const t=e.props.children;return Xw(t)}return""}function fO(e){return C.Children.toArray(e).filter(t=>C.isValidElement(t)).map((t,n)=>{const r=C.Children.toArray(t.props.children),i=r[0];if(g6(i)){const a=!!i.props.checked,u=r.slice(1);return{value:`item-${n}`,label:E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(OL,{checked:a,disabled:!0}),E.jsx(je,{size:1,children:u})]})}}const o=r.findIndex(zge);if(o>=0){const a=r[o],u=[...r.slice(0,o),...r.slice(o+1)];return{id:`group-${n}`,category:Xw(u).trim(),items:a.props.items??[]}}return{value:`item-${n}`,label:E.jsx(je,{size:1,children:r})}})}const Uge={p:({children:e})=>E.jsx(je,{my:1,size:1,render:E.jsx("p",{}),children:e}),h1:({children:e,id:t})=>E.jsx(je,{weight:"bold",size:4,my:2,render:E.jsx("h1",{id:t}),children:e}),h2:({children:e,id:t})=>E.jsx(je,{weight:"bold",size:3,mt:2,render:E.jsx("h2",{id:t}),children:e}),h3:({children:e,id:t})=>E.jsx(je,{weight:"bold",size:1,my:1,render:E.jsx("h3",{id:t}),children:e}),h4:({children:e,id:t})=>E.jsx(je,{weight:"bold",size:1,render:E.jsx("h4",{id:t}),children:e}),h5:({children:e,id:t})=>E.jsx(je,{weight:"bold",size:0,render:E.jsx("h5",{id:t}),children:e}),h6:({children:e,id:t})=>E.jsx(je,{weight:"bold",size:-1,render:E.jsx("h6",{id:t}),children:e}),strong:({children:e})=>E.jsx(je,{weight:"bold",children:e}),em:({children:e})=>E.jsx(je,{render:E.jsx("em",{}),children:e}),del:({children:e})=>E.jsx(je,{strikethrough:!0,render:E.jsx("del",{}),children:e}),a:({children:e,href:t})=>E.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:e}),ul:({children:e})=>E.jsx(Kc,{type:Bge(e)?"none":"unordered",size:"large",items:fO(e),style:{display:"block"},my:2}),ol:({children:e})=>E.jsx(Kc,{type:"ordered",size:"large",items:fO(e),style:{display:"block"},my:2}),blockquote:({children:e})=>E.jsx("blockquote",{children:e}),hr:()=>E.jsx(gS,{}),table:({children:e})=>E.jsx(eE,{children:E.jsx(tE,{bordered:!0,children:e})}),thead:({children:e})=>E.jsx(uF,{children:e}),tbody:({children:e})=>E.jsx(rE,{children:e}),tr:({children:e})=>E.jsx(nE,{children:e}),th:({children:e})=>E.jsx(cF,{children:e}),td:({children:e})=>E.jsx(fh,{children:e}),pre:({children:e})=>E.jsx(E.Fragment,{children:e}),code:({className:e,children:t,...n})=>{const r=String(t??"");return r.includes(`
|
|
519
|
-
`)?E.jsx(mC,{code:r.replace(/\n$/,""),language:Fge(e),rows:5,defaultExpanded:!1,HeaderProps:{copyable:!0},style:{width:"100%",marginBlockEnd:"0.5rem"}}):E.jsx(aI,{...n,children:t})}},Hge=[jge],Gge=[Tpe];function qge({children:e,components:t}){return E.jsx(Ye,{gap:4,fullwidth:!0,children:E.jsx(mpe,{remarkPlugins:Hge,rehypePlugins:Gge,components:{...Uge,...t},children:e})})}const ya=C.memo(qge),y6=()=>{var i;const e=yy(),{data:t=[]}=Si(mF),n=t.find(o=>o.active),r=async o=>{if((n==null?void 0:n.slug)!==o){try{await oce(o)}catch(a){console.error("Project switch failed:",a);return}e.invalidateQueries()}};return t.length===0?null:t.length===1?E.jsxs(Xe,{ay:"center",gap:2,px:2,children:[E.jsx(je,{size:-1,shade:"muted",children:"project"}),E.jsx(je,{size:-1,weight:"bold",children:(n==null?void 0:n.name)??((i=t[0])==null?void 0:i.name)??"default"})]}):E.jsxs(nb,{children:[E.jsx(rb,{render:E.jsx(Ci,{variant:"subtle",size:"small",fullwidth:!0,children:E.jsxs(Xe,{ay:"center",ax:"space-between",gap:2,fullwidth:!0,children:[E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(je,{size:-1,shade:"muted",children:"project"}),E.jsx(je,{size:-1,weight:"bold",children:(n==null?void 0:n.name)??"—"})]}),E.jsx(xS,{size:14})]})})}),E.jsx(ah,{children:E.jsx(lh,{side:"bottom",align:"start",children:E.jsx(uh,{children:t.map(o=>E.jsx(Xc,{onClick:()=>{r(o.slug)},children:E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(je,{size:-1,weight:o.active?"bold":"normal",children:o.name}),o.active&&E.jsx(je,{size:-1,shade:"muted",children:"(active)"})]})},o.slug))})})})]})};y6.displayName="ProjectSwitcher";const wE=({children:e,...t})=>E.jsx(Ye,{"data-slot":"sidebar",render:E.jsx("nav",{}),ax:"stretch",fullwidth:!0,gap:3,p:4,...t,children:e});wE.displayName="SidebarWrapper";const Vge=["active","waiting","paused","archived"],Yge={active:"Active",waiting:"Waiting",paused:"Paused",archived:"Archived"},Wge=["today","yesterday","thisWeek","earlier"],Kge={today:"Today",yesterday:"Yesterday",thisWeek:"This week",earlier:"Earlier"},Xge=1440*60*1e3;function Qge(e,t){const n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),o=Math.floor((r.getTime()-i.getTime())/Xge);return o<=0?"today":o===1?"yesterday":o<7?"thisWeek":"earlier"}function rx(e){const t=oE(e.session.status),n=e.session.status==="archived";return{value:e.session.id,label:E.jsx(v6,{session:e}),content:E.jsxs(Xe,{gap:2,ay:"center",mt:1,mb:2,children:[E.jsx(My,{color:t}),E.jsx(x6,{session:e})]}),action:E.jsx(w6,{session:e.session,categoryPath:e.categoryPath}),"data-archived":n?"":void 0,style:n?{opacity:.4}:void 0}}function Zge(e,t){if(t==="status"){const r=new Map;for(const i of e){const o=i.session.status,a=r.get(o);a?a.push(i):r.set(o,[i])}return Vge.filter(i=>r.has(i)).map(i=>({category:Yge[i],collapsible:!0,items:r.get(i).map(rx)}))}if(t==="recent"){const r=new Date,i=new Map;for(const o of e){const a=Qge(o.session.startedAt,r),u=i.get(a);u?u.push(o):i.set(a,[o])}return Wge.filter(o=>i.has(o)).map(o=>({category:Kge[o],collapsible:!0,items:i.get(o).map(rx)}))}const n=new Map;for(const r of e){const i=r.categoryPath,o=n.get(i);o?o.push(r):n.set(i,[r])}return Array.from(n,([r,i])=>({category:r,collapsible:!0,items:i.map(rx)}))}const dO=e=>e.id??e.category??"",b6=({WrapperProps:e})=>{const[t,n]=C.useState(""),[r,i]=C.useState("group"),[o,a]=C.useState(!1),[u,c]=C.useState({}),f=C.useRef(null),{data:h=[]}=Si(dh({includeArchived:o})),p=C.useMemo(()=>{const S=t.trim().toLowerCase(),x=S?h.filter(_=>_.session.slug.toLowerCase().includes(S)||_.session.name.toLowerCase().includes(S)||_.categoryPath.toLowerCase().includes(S)):h;return Zge(x,r)},[h,t,r]),g=p.map(dO),y=g.length>0&&g.every(S=>u[S]!==!1),b=()=>{const S=!y;c(x=>{const _={...x};for(const R of g)_[R]=S;return _})},v=p.map(S=>{const x=dO(S);return{...S,open:u[x]??!0,onOpenChange:_=>c(R=>({...R,[x]:_}))}});return C.useEffect(()=>{const S=x=>{var _,R;(x.metaKey||x.ctrlKey)&&x.key==="k"&&(x.preventDefault(),(_=f.current)==null||_.focus(),(R=f.current)==null||R.select())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),E.jsxs(wE,{...e,children:[E.jsx(y6,{}),E.jsx(Xe,{ay:"center",gap:2,fullwidth:!0,children:E.jsx(II,{ref:f,placeholder:"Search for a session",before:E.jsx(XG,{}),after:E.jsx(yP,{hotkey:["meta","k"]}),size:"small",fullwidth:!0,style:{flex:1,minWidth:0},value:t,onChange:S=>n(S.target.value)})}),E.jsxs(Xe,{ay:"center",ax:"space-between",gap:2,children:[E.jsxs(VC,{size:"sm",value:[r],onValueChange:S=>{const x=S[0];x&&i(x)},children:[E.jsx(xc,{value:"group","aria-label":"Group by group",children:E.jsx($l,{trigger:E.jsx(OG,{}),children:"Group by group"})}),E.jsx(xc,{value:"status","aria-label":"Group by status",children:E.jsx($l,{trigger:E.jsx(nq,{}),children:"Group by status"})}),E.jsx(xc,{value:"recent","aria-label":"Group by recent",children:E.jsx($l,{trigger:E.jsx(Q3,{}),children:"Group by recent"})})]}),E.jsxs(Xe,{ay:"center",gap:1,children:[E.jsx(Qd,{size:"small",shape:"square",variant:"subtle",tooltip:o?"Hide archived":"Show archived",pressed:o,onPressedChange:a,icon:{unpressed:E.jsx(bG,{}),pressed:E.jsx(xG,{})}}),p.length>0&&E.jsx(Qd,{size:"small",shape:"square",variant:"subtle",tooltip:y?"Collapse all":"Expand all",pressed:!y,onPressedChange:()=>b(),icon:{unpressed:E.jsx(sG,{}),pressed:E.jsx(xS,{})}})]})]}),p.length===0?E.jsxs(je,{size:-1,shade:"muted",style:{padding:"0.5rem"},children:['No sessions match "',t,'".']}):E.jsx(Kc,{items:v,line:!0,size:"small"})]})};b6.displayName="Sidebar";const v6=({session:e})=>E.jsx(ef,{to:"/$",params:{_splat:`${e.categoryPath}/${e.session.slug}`},children:e.session.slug});v6.displayName="SessionLabel";const x6=({session:e})=>{const{data:t=[]}=Si(dh()),n=t.some(p=>p.session.status==="active"||p.session.status==="waiting"),{data:r}=Si(nce(n)),{data:i}=Si(ice),o=r==null?void 0:r[e.session.id],a=i==null?void 0:i[e.session.id],u=(o==null?void 0:o.linesAdded)??0,c=(o==null?void 0:o.linesRemoved)??0,f=(o==null?void 0:o.filesTouched)??0,h=u>0||c>0;return E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(je,{size:-1,shade:"muted",children:Bw(e.session.startedAt)}),h&&E.jsxs(Xe,{ay:"center",gap:1,children:[E.jsx(je,{size:-1,family:"mono",color:"green",children:`+${u}`}),E.jsx(je,{size:-1,family:"mono",color:"red",children:`-${c}`})]}),f>0&&E.jsxs(Xe,{ay:"center",gap:1,children:[E.jsx(e4,{size:12}),E.jsx(je,{size:-1,family:"mono",shade:"muted",children:f})]}),a&&E.jsx(G$,{TriggerProps:{openOnHover:!0},trigger:E.jsx(zG,{size:12,"aria-label":"Session recap"}),title:"Session recap",description:Bw(a.createdAt),PositionerProps:{sideOffset:8,side:"right"},PopupProps:{style:{maxWidth:420}},children:E.jsx(Ye,{my:2,children:E.jsx(ya,{children:a.recap})})})]})};x6.displayName="SessionContent";const w6=({session:e,categoryPath:t})=>{const n=gF(e),{Icon:r}=n,i=e.status==="paused",o=`${t}/${e.slug}`;return E.jsxs(nb,{children:[E.jsx(rb,{render:E.jsx(Ci,{variant:"ghost",size:"xsmall",shape:"square","aria-label":"Session actions",children:E.jsx(pG,{})})}),E.jsx(ah,{children:E.jsx(lh,{side:"bottom",align:"end",children:E.jsxs(uh,{children:[E.jsxs(Xc,{disabled:n.disabled,onClick:n.onClick,render:E.jsx(Xe,{ay:"center",gap:2}),children:[E.jsx(r,{size:14}),n.label]}),E.jsxs(Xc,{disabled:!i,onClick:()=>{navigator.clipboard.writeText(o)},render:E.jsx(Xe,{ay:"center",gap:2}),children:[E.jsx(Eh,{size:14}),"Copy session path"]})]})})})]})};w6.displayName="SessionRowActions";const S6=({children:e,...t})=>E.jsx(Xe,{"data-slot":"top-bar-wrapper",fullwidth:!0,ay:"center",p:4,gap:4,bb:1,style:{position:"sticky",top:0,backgroundColor:"var(--shade-background)",zIndex:1,...t.style},...t,children:e});S6.displayName="TopBarWrapper";const Ud="uiid-theme";function Jge(){return localStorage.getItem(Ud)??"system"}function eye(e){const t=n=>{n.key===Ud&&e()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function tye(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}function nye(){const e=C.useSyncExternalStore(eye,Jge),t=C.useCallback(n=>{n==="system"?localStorage.removeItem(Ud):localStorage.setItem(Ud,n),tye(n),window.dispatchEvent(new StorageEvent("storage",{key:Ud,newValue:n}))},[]);return{theme:e,setTheme:t}}const C6=()=>{const{theme:e,setTheme:t}=nye();return E.jsxs(VC,{value:[e],onValueChange:n=>{const r=n[0];r&&t(r)},size:"sm",children:[E.jsx(xc,{value:"light","aria-label":"Light mode",children:E.jsx(eq,{})}),E.jsx(xc,{value:"dark","aria-label":"Dark mode",children:E.jsx(VG,{})}),E.jsx(xc,{value:"system","aria-label":"System theme",children:E.jsx(GG,{})})]})};C6.displayName="ThemeToggle";const SE=({sessionCount:e})=>E.jsxs(S6,{children:[E.jsx(je,{size:2,weight:"bold",children:"bertrand"}),E.jsx(C.Activity,{mode:e?"visible":"hidden",children:E.jsxs(cn,{color:"blue",children:[e," session(s)"]})}),E.jsxs(Xe,{gap:3,ay:"center",ml:"auto",children:[E.jsxs(Xe,{gap:2,ay:"center",children:[E.jsx(ix,{to:"/",tooltip:"Session timeline",icon:E.jsx(nG,{})}),E.jsx(ix,{to:"/dev/markdown",tooltip:"Markdown viewer",icon:E.jsx(eG,{})}),E.jsx(ix,{to:"/dev/diff",tooltip:"Diff viewer",icon:E.jsx(J3,{})})]}),E.jsx(C6,{})]})]});SE.displayName="TopBar";const ix=({to:e,tooltip:t,icon:n})=>E.jsx(Ci,{render:E.jsx(ef,{to:e}),nativeButton:!1,tooltip:t,variant:"subtle",size:"small",shape:"square",children:n}),Yh=$7({component:rye});function rye(){return K7({select:t=>t.location.pathname}).startsWith("/dev/")?E.jsxs(Ye,{fullwidth:!0,style:{position:"fixed",inset:0,height:"100dvh"},children:[E.jsx(SE,{}),E.jsx(Ye,{render:E.jsx("main",{}),fullwidth:!0,style:{flex:1,overflow:"auto"},children:E.jsx(fS,{})})]}):E.jsx(iye,{})}function iye(){const{data:e=[]}=Si(dh());return E.jsxs(Ye,{fullwidth:!0,style:{position:"fixed",height:"100dvh"},children:[E.jsx(SE,{sessionCount:e.length}),E.jsxs(rF,{direction:"horizontal",children:[E.jsx(zw,{defaultSize:360,minSize:320,maxSize:540,children:E.jsx(b6,{})}),E.jsx(iF,{}),E.jsx(zw,{children:E.jsx(Ye,{render:E.jsx("main",{}),fullwidth:!0,fullheight:!0,children:E.jsx(fS,{})})})]})]})}const oye=new Set(["session.started","session.resumed","session.end"]),sye=e=>{const t=new Map;for(let r=0;r<e.length-1;r++){const i=e[r],o=e[r+1];i.event==="session.started"&&o.event==="claude.started"&&i.conversationId===o.conversationId&&t.set(r+1,{...i.meta??{},...o.meta??{}})}const n=[];for(let r=0;r<e.length;r++){const i=e[r];if(oye.has(i.event))continue;const o=t.get(r);n.push(o?{...i,meta:o}:i)}return n},aye=e=>{var r;const t=[],n=new Set;for(let i=0;i<e.length;i++){if(n.has(i))continue;const o=e[i];if(o.event==="session.waiting"){let a=i+1;const u=[];for(;a<e.length&&(e[a].event==="context.snapshot"||e[a].event==="assistant.recap");)e[a].event==="assistant.recap"&&u.push(e[a]),a++;if(a<e.length&&e[a].event==="session.answered"){for(const f of u)t.push(f);const c=(r=o.meta)==null?void 0:r.question;t.push({...e[a],meta:{...e[a].meta,question:c}});for(let f=i;f<=a;f++)n.add(f);continue}}t.push(o)}return t};function gy(e){return e.edits&&e.edits.length>0?e.edits:e.oldStr||e.newStr?[{oldStr:e.oldStr??"",newStr:e.newStr??""}]:[]}function hO(e){const t=e.meta,n=e.event==="permission.resolve"?"approved":e.event==="tool.used"?"auto":"pending";return{tool:(t==null?void 0:t.tool)??"unknown",detail:(t==null?void 0:t.detail)??"",outcome:(t==null?void 0:t.outcome)??n}}const E6={Bash:"ran",Edit:"edited",MultiEdit:"edited",Write:"wrote",Read:"read",Glob:"globbed",Grep:"grepped",WebFetch:"fetched",WebSearch:"searched",TodoWrite:"updated todos"},lye={Bash:"commands",Edit:"files",MultiEdit:"files",Write:"files",Read:"files",Glob:"patterns",Grep:"patterns",WebFetch:"urls",WebSearch:"queries"},uye=new Set(["Edit","MultiEdit","Write","Read"]);function cye(e){return e.split("/").filter(Boolean).pop()??e}function pO(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function fye(e){const t=E6[e.tool]??e.tool;return e.detail?e.tool==="Bash"?`ran \`${pO(e.detail,60)}\``:uye.has(e.tool)?`${t} ${cye(e.detail)}`:`${t} ${pO(e.detail,60)}`:t}function dye(e){const t=[];for(const[n,r]of e){const i=E6[n]??n;if(r===1)t.push(i);else{const o=lye[n]??"calls";t.push(`${i} ${r} ${o}`)}}return t.join(", ")}const mO=new Set(["permission.request","permission.resolve","tool.used"]),hye=e=>{const t=[];let n=0;for(;n<e.length;){const r=e[n];if(!mO.has(r.event)){t.push(r),n++;continue}const i=[];for(;n<e.length;){const h=e[n];if(!mO.has(h.event))break;i.push(h),n++}const o=i.filter(h=>h.event==="permission.request"||h.event==="tool.used");if(o.length===0)continue;const a=o.map(hO),u=i.some(h=>h.event==="permission.resolve"),c=new Map;for(const h of a){const p=`${h.tool}::${h.detail}`,g=c.get(p);if(g){g.count++;const y=[...gy(g),...gy(h)];y.length>0&&(g.edits=y,g.oldStr=void 0,g.newStr=void 0)}else c.set(p,{...h,count:1})}const f=[...c.values()];if(f.length<=1){const h=f[0]??hO(i[0]),p=fye(h);t.push({...i[i.length-1],event:"tool.work",summary:p,meta:{...i[i.length-1].meta,permissions:f,outcome:u?"approved":"pending"}})}else{const h=new Map;for(const v of f)h.set(v.tool,(h.get(v.tool)??0)+v.count);const p=[...h.entries()].sort((v,S)=>S[1]-v[1]),g=dye(p),y=new Date(i[0].createdAt).getTime(),b=new Date(i[i.length-1].createdAt).getTime();t.push({...i[0],event:"tool.work",summary:g,meta:{permissions:f,outcome:u?"approved":"pending"},createdAt:new Date((y+b)/2).toISOString()})}}return t},pye={Edit:"edited a file",Write:"wrote a file",MultiEdit:"edited a file"},mye=e=>{const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r.event!=="tool.applied"){t.push(r),n++;continue}const i=[];for(;n<e.length&&e[n].event==="tool.applied";)i.push(e[n]),n++;if(i.length===1){t.push(i[0]);continue}const o=[];for(const f of i){const h=f.meta,p=h==null?void 0:h.permissions;if(Array.isArray(p))for(const g of p)o.push(g)}const a=new Map;for(const f of o){const h=`${f.tool}::${f.detail}`,p=a.get(h),g=f.count??1;if(p){p.count+=g;const y=[...gy(p),...gy(f)];y.length>0&&(p.edits=y,p.oldStr=void 0,p.newStr=void 0)}else a.set(h,{...f,count:g})}const u=[...a.values()],c=i[i.length-1];t.push({...c,meta:{...c.meta,permissions:u}})}return t},gye=e=>e.map(t=>{var o;if(t.event!=="tool.applied"||t.summary)return t;const n=t.meta,r=(n==null?void 0:n.permissions)??[];if(r.length>1)return{...t,summary:`edited ${r.length} files`};const i=(o=r[0])==null?void 0:o.tool;return i?{...t,summary:pye[i]??`${i} applied`}:t}),yye=e=>{const t=new Set(["claude.started","claude.ended","claude.discarded"]);return e.map((n,r)=>{if(!t.has(n.event))return n;const i=n.meta;if(i!=null&&i.model)return n;const o=(i==null?void 0:i.claude_id)??n.conversationId;if(!o)return n;const u=n.event==="claude.started"?e.slice(r+1):e.slice(0,r).reverse();for(const c of u){if(c.event!=="context.snapshot")continue;const f=c.meta;if(((f==null?void 0:f.claude_id)??c.conversationId)!==o)continue;const p=f==null?void 0:f.model;if(p)return{...n,meta:{...i,model:p}}}return n})},bye=[sye,aye,hye,mye,gye,yye];function vye(e){return bye.reduce((t,n)=>n(t),e)}function xye(e){return e<1500?"●○○":e<5e3?"●●○":"●●●"}const wye=/<recap>[\s\S]*?<\/recap>/gi;function k6({event:e}){var a;const t=e.meta;if(e.event==="assistant.recap"){const u=(a=t==null?void 0:t.recap)==null?void 0:a.trim();return u?E.jsx(Ye,{"data-slot":"assistant-recap",py:4,children:E.jsx(qt,{children:E.jsx(ya,{children:u})})}):null}const r=((t==null?void 0:t.text)??"").replace(wye,"").trim(),i=(t==null?void 0:t.thinkingBlocks)??0,o=(t==null?void 0:t.thinkingBytes)??0;return!r&&i===0?null:E.jsxs(Ye,{"data-slot":"assistant-content",gap:2,children:[i>0&&E.jsx(cn,{color:"indigo",children:`Thought ${xye(o)}`}),r&&E.jsx(ya,{children:r})]})}k6.displayName="AssistantContent";function R6({event:e}){const t=e.meta;if(!t)return null;const n=to(t.remaining_pct),r=to(t.context_window_tokens),i=to(t.input_tokens),o=to(t.cache_read_tokens),a=to(t.cache_creation_tokens),u=ab(t.model);return r===0?null:E.jsxs(Ye,{"data-slot":"context-content",gap:3,fullwidth:!0,children:[E.jsx(XS,{value:n,size:"small",color:yF(n)}),E.jsxs(Xe,{gap:2,children:[u&&E.jsx(cn,{size:"small",children:u}),i>0&&E.jsx(cn,{size:"small",color:"orange",children:`${Jo(i)} input`}),o>0&&E.jsx(cn,{size:"small",color:"blue",children:`${Jo(o)} cache read`}),a>0&&E.jsx(cn,{size:"small",color:"indigo",children:`${Jo(a)} cache write`})]})]})}R6.displayName="ContextContent";function gO(e,t){return e==null?void 0:e.find(n=>n.question===t)}function Sye(e,t,n){const r=[...t].sort((a,u)=>u.label.length-a.label.length),i=[];let o=e;for(;o;){const a=r.find(u=>o===u.label||o.startsWith(u.label+", "));if(!a)break;if(i.push(a.label),o===a.label){o="";break}if(o=o.slice(a.label.length+2),!n)break}return{selectedLabels:i,note:o||void 0}}function _6({event:e}){const t=e.meta;if(e.event==="session.answered"){const n=t==null?void 0:t.answers;if(!n||Object.keys(n).length===0)return null;const r=t==null?void 0:t.questions,i=Object.entries(n),o=(u,c)=>{const f=gO(r,u),h=(f==null?void 0:f.multiSelect)??!1,p=(f==null?void 0:f.options)??[],{selectedLabels:g,note:y}=Sye(c,p,h),b=g.length>0,v=b?void 0:y??c,S=b?y:void 0;return E.jsxs(Ye,{gap:4,fullwidth:!0,children:[v&&E.jsxs(Ye,{"data-slot":"interaction-content-note",gap:4,m:2,fullwidth:!0,children:[E.jsx(je,{color:"yellow",weight:"bold",size:1,children:"Answered manually:"}),E.jsx(ya,{children:v})]}),!b&&!v&&E.jsx(je,{color:"red",weight:"bold",size:1,m:2,children:"Didn't answer."}),p.length>0&&E.jsx(Kc,{type:"ordered",items:p.map(x=>({value:x.label,label:E.jsx(je,{weight:"bold",color:g.includes(x.label)?"green":void 0,children:x.label}),description:x.description,disabled:!g.includes(x.label)}))}),S&&E.jsxs(Ye,{"data-slot":"interaction-content-note",gap:4,m:2,fullwidth:!0,children:[E.jsx(je,{color:"green",weight:"bold",size:1,children:"Additional notes:"}),E.jsx(ya,{children:S})]})]})};if(i.length===1){const[u,c]=i[0];return E.jsx(Ye,{"data-slot":"interaction-content",gap:2,py:4,fullwidth:!0,children:E.jsx(qt,{gap:4,fullwidth:!0,children:o(u,c)})})}const a=i.map(([u,c],f)=>{const h=gO(r,u);return{label:(h==null?void 0:h.header)??`Question ${f+1}`,value:u,render:o(u,c)}});return E.jsx(Ye,{"data-slot":"interaction-content",gap:2,py:4,fullwidth:!0,children:E.jsx(qt,{gap:4,fullwidth:!0,children:E.jsx(qC,{items:a,ContainerProps:{fullwidth:!0,mt:6}})})})}if(e.event==="user.prompt"){const n=t==null?void 0:t.prompt;return n?E.jsx(T6,{children:E.jsx(ya,{children:n})}):null}return null}_6.displayName="InteractionContent";const T6=({children:e})=>E.jsx(Ye,{"data-slot":"interaction-content",py:4,fullwidth:!0,children:E.jsx(qt,{gap:4,fullwidth:!0,children:e})});T6.displayName="CardContainer";function Cye(e){if(e)return e.slice(0,8)}function A6({event:e}){if(e.event==="claude.started")return null;const t=e.meta;if(e.event==="session.recap"){const u=t==null?void 0:t.recap;return u?E.jsx(Ye,{py:4,children:E.jsx(qt,{children:E.jsx(ya,{children:u})})}):null}const n=(t==null?void 0:t.claude_id)??e.conversationId??void 0,r=ab(t==null?void 0:t.model),i=Cye(n??void 0),o=e.event==="claude.ended"?t==null?void 0:t.exit_code:void 0,a=typeof o=="number"&&o!==0;return!r&&!i&&!a?null:E.jsxs(Xe,{gap:2,ay:"center",children:[r&&E.jsx(cn,{color:"orange",size:"small",children:r}),i&&E.jsx(cn,{color:"neutral",size:"small",children:i}),a&&E.jsx(cn,{color:"red",size:"small",children:`exit ${o}`})]})}A6.displayName="LifecycleContent";function D6({event:e}){const t=e.meta;if(!t)return null;switch(e.event){case"gh.pr.created":{const n=t.pr_title,r=t.pr_url;return E.jsxs(E.Fragment,{children:[n&&E.jsx(je,{size:1,children:n}),r&&E.jsx(je,{size:-1,family:"mono",color:"neutral",children:r})]})}case"gh.pr.merged":{const n=t.branch;return n?E.jsx(je,{size:1,family:"mono",children:n}):null}case"vercel.deploy":{const n=t.project_name;return n?E.jsx(je,{size:1,children:n}):null}default:return null}}D6.displayName="MilestoneContent";function Eye({text:e}){const[t,n]=C.useState(!1);return E.jsx(Ci,{size:"small",variant:"ghost",shape:"square",tooltip:t?"Copied!":"Copy path",disabled:t,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},children:t?E.jsx(Ch,{color:"green"}):E.jsx(Eh,{})})}function kye(e){if(e)return e.slice(0,8)}function Rye(e){if(e)return e.slice(0,7)}function M6({event:e}){const t=e.meta;if(!t)return null;const n=t.labels??[],r=t.summary,i=t.claude_id??e.conversationId??void 0,o=ab(t.model),a=t.claude_version,u=kye(i),c=t.git??void 0,f=c==null?void 0:c.branch,h=Rye(c==null?void 0:c.sha),p=!!(c!=null&&c.dirty),g=t.cwd,y=[];if(n.length>0&&y.push({field:"Labels",value:n.join(", ")}),r&&y.push({field:"Summary",value:r}),o&&y.push({field:"Model",value:E.jsx(cn,{color:"orange",size:"small",children:o})}),a&&y.push({field:"Version",value:E.jsx(cn,{color:"neutral",size:"small",children:a})}),u&&y.push({field:"Claude ID",value:E.jsx(cn,{color:"neutral",size:"small",children:u})}),f&&y.push({field:"Branch",value:E.jsxs(Xe,{gap:2,ay:"center",children:[E.jsx(cn,{color:"neutral",size:"small",children:f}),h&&E.jsx(cn,{color:"neutral",size:"small",children:h}),p&&E.jsx(cn,{color:"red",size:"small",children:"dirty"})]})}),g&&y.push({field:"CWD",value:E.jsx(je,{family:"mono",size:-1,color:"neutral",children:g})}),y.length===0)return null;const b=x=>x.field==="CWD",v=(x,_)=>b(_)?x:E.jsx(E.Fragment,{}),S={primary:[{icon:gG,tooltip:"Open in Cursor",onClick:x=>{!b(x)||!g||window.open(`cursor://file/${encodeURI(g)}`,"_blank")},wrapper:v},{icon:EG,tooltip:"Open in Finder",onClick:x=>{!b(x)||!g||fetch(sb("/api/open"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:g})})},wrapper:v},{icon:Eh,tooltip:"Copy path",wrapper:(x,_)=>b(_)&&g?E.jsx(Eye,{text:g}):E.jsx(E.Fragment,{})}]};return E.jsx(Ye,{py:4,fullwidth:!0,children:E.jsx(qt,{trimmed:!0,fullwidth:!0,children:E.jsx(eE,{children:E.jsx(tE,{children:E.jsx(rE,{children:y.map(x=>E.jsxs(nE,{children:[E.jsx(fh,{children:E.jsx(je,{weight:"bold",children:x.field})}),E.jsx(fh,{children:x.value}),E.jsx(dF,{actions:S,item:x})]},x.field))})})})})})}M6.displayName="StartedContent";class O6{diff(t,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const o=this.castInput(t,r),a=this.castInput(n,r),u=this.removeEmpty(this.tokenize(o,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(u,c,r,i)}diffWithOptionsObj(t,n,r,i){var o;const a=_=>{if(_=this.postProcess(_,r),i){setTimeout(function(){i(_)},0);return}else return _},u=n.length,c=t.length;let f=1,h=u+c;r.maxEditLength!=null&&(h=Math.min(h,r.maxEditLength));const p=(o=r.timeout)!==null&&o!==void 0?o:1/0,g=Date.now()+p,y=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(y[0],n,t,0,r);if(y[0].oldPos+1>=c&&b+1>=u)return a(this.buildValues(y[0].lastComponent,n,t));let v=-1/0,S=1/0;const x=()=>{for(let _=Math.max(v,-f);_<=Math.min(S,f);_+=2){let R;const T=y[_-1],A=y[_+1];T&&(y[_-1]=void 0);let D=!1;if(A){const $=A.oldPos-_;D=A&&0<=$&&$<u}const O=T&&T.oldPos+1<c;if(!D&&!O){y[_]=void 0;continue}if(!O||D&&T.oldPos<A.oldPos?R=this.addToPath(A,!0,!1,0,r):R=this.addToPath(T,!1,!0,1,r),b=this.extractCommon(R,n,t,_,r),R.oldPos+1>=c&&b+1>=u)return a(this.buildValues(R.lastComponent,n,t))||!0;y[_]=R,R.oldPos+1>=c&&(S=Math.min(S,_-1)),b+1>=u&&(v=Math.max(v,_+1))}f++};if(i)(function _(){setTimeout(function(){if(f>h||Date.now()>g)return i(void 0);x()||_()},0)})();else for(;f<=h&&Date.now()<=g;){const _=x();if(_)return _}}addToPath(t,n,r,i,o){const a=t.lastComponent;return a&&!o.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,i,o){const a=n.length,u=r.length;let c=t.oldPos,f=c-i,h=0;for(;f+1<a&&c+1<u&&this.equals(r[c+1],n[f+1],o);)f++,c++,h++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return h&&!o.oneChangePerToken&&(t.lastComponent={count:h,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,f}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const i=[];let o;for(;t;)i.push(t),o=t.previousComponent,delete t.previousComponent,t=o;i.reverse();const a=i.length;let u=0,c=0,f=0;for(;u<a;u++){const h=i[u];if(h.removed)h.value=this.join(r.slice(f,f+h.count)),f+=h.count;else{if(!h.added&&this.useLongestToken){let p=n.slice(c,c+h.count);p=p.map(function(g,y){const b=r[f+y];return b.length>g.length?b:g}),h.value=this.join(p)}else h.value=this.join(n.slice(c,c+h.count));c+=h.count,h.added||(f+=h.count)}}return i}}const yO="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class _ye extends O6{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${yO}]+|[^\\S\\n\\r]+|[^${yO}]`,"ug");return t.match(n)||[]}}const Tye=new _ye;function Aye(e,t,n){return Tye.diff(e,t,n)}class Dye extends O6{constructor(){super(...arguments),this.tokenize=$ye}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
519
|
+
`)?E.jsx(mC,{code:r.replace(/\n$/,""),language:Fge(e),rows:5,defaultExpanded:!1,HeaderProps:{copyable:!0},style:{width:"100%",marginBlockEnd:"0.5rem"}}):E.jsx(aI,{...n,children:t})}},Hge=[jge],Gge=[Tpe];function qge({children:e,components:t}){return E.jsx(Ye,{gap:4,fullwidth:!0,children:E.jsx(mpe,{remarkPlugins:Hge,rehypePlugins:Gge,components:{...Uge,...t},children:e})})}const ya=C.memo(qge),y6=()=>{var i;const e=yy(),{data:t=[]}=Si(mF),n=t.find(o=>o.active),r=async o=>{if((n==null?void 0:n.slug)!==o){try{await oce(o)}catch(a){console.error("Project switch failed:",a);return}e.invalidateQueries()}};return t.length===0?null:t.length===1?E.jsxs(Xe,{ay:"center",gap:2,px:2,children:[E.jsx(je,{size:-1,shade:"muted",children:"project"}),E.jsx(je,{size:-1,weight:"bold",children:(n==null?void 0:n.name)??((i=t[0])==null?void 0:i.name)??"default"})]}):E.jsxs(nb,{children:[E.jsx(rb,{render:E.jsx(Ci,{variant:"subtle",size:"small",fullwidth:!0,children:E.jsxs(Xe,{ay:"center",ax:"space-between",gap:2,fullwidth:!0,children:[E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(je,{size:-1,shade:"muted",children:"project"}),E.jsx(je,{size:-1,weight:"bold",children:(n==null?void 0:n.name)??"—"})]}),E.jsx(xS,{size:14})]})})}),E.jsx(ah,{children:E.jsx(lh,{side:"bottom",align:"start",children:E.jsx(uh,{children:t.map(o=>E.jsx(Xc,{onClick:()=>{r(o.slug)},children:E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(je,{size:-1,weight:o.active?"bold":"normal",children:o.name}),o.active&&E.jsx(je,{size:-1,shade:"muted",children:"(active)"})]})},o.slug))})})})]})};y6.displayName="ProjectSwitcher";const wE=({children:e,...t})=>E.jsx(Ye,{"data-slot":"sidebar",render:E.jsx("nav",{}),ax:"stretch",fullwidth:!0,gap:3,p:4,...t,children:e});wE.displayName="SidebarWrapper";const Vge=["active","waiting","paused","archived"],Yge={active:"Active",waiting:"Waiting",paused:"Paused",archived:"Archived"},Wge=["today","yesterday","thisWeek","earlier"],Kge={today:"Today",yesterday:"Yesterday",thisWeek:"This week",earlier:"Earlier"},Xge=1440*60*1e3;function Qge(e,t){const n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),o=Math.floor((r.getTime()-i.getTime())/Xge);return o<=0?"today":o===1?"yesterday":o<7?"thisWeek":"earlier"}function rx(e){const t=oE(e.session.status),n=e.session.status==="archived";return{value:e.session.id,label:E.jsx(v6,{session:e}),content:E.jsxs(Xe,{gap:2,ay:"center",mb:2,children:[E.jsx(My,{color:t}),E.jsx(x6,{session:e})]}),action:E.jsx(w6,{session:e.session,categoryPath:e.categoryPath}),"data-archived":n?"":void 0,style:n?{opacity:.4}:void 0}}function Zge(e,t){if(t==="status"){const r=new Map;for(const i of e){const o=i.session.status,a=r.get(o);a?a.push(i):r.set(o,[i])}return Vge.filter(i=>r.has(i)).map(i=>({category:Yge[i],collapsible:!0,items:r.get(i).map(rx)}))}if(t==="recent"){const r=new Date,i=new Map;for(const o of e){const a=Qge(o.session.startedAt,r),u=i.get(a);u?u.push(o):i.set(a,[o])}return Wge.filter(o=>i.has(o)).map(o=>({category:Kge[o],collapsible:!0,items:i.get(o).map(rx)}))}const n=new Map;for(const r of e){const i=r.categoryPath,o=n.get(i);o?o.push(r):n.set(i,[r])}return Array.from(n,([r,i])=>({category:r,collapsible:!0,items:i.map(rx)}))}const dO=e=>e.id??e.category??"",b6=({WrapperProps:e})=>{const[t,n]=C.useState(""),[r,i]=C.useState("group"),[o,a]=C.useState(!1),[u,c]=C.useState({}),f=C.useRef(null),{data:h=[]}=Si(dh({includeArchived:o})),p=C.useMemo(()=>{const S=t.trim().toLowerCase(),x=S?h.filter(_=>_.session.slug.toLowerCase().includes(S)||_.session.name.toLowerCase().includes(S)||_.categoryPath.toLowerCase().includes(S)):h;return Zge(x,r)},[h,t,r]),g=p.map(dO),y=g.length>0&&g.every(S=>u[S]!==!1),b=()=>{const S=!y;c(x=>{const _={...x};for(const R of g)_[R]=S;return _})},v=p.map(S=>{const x=dO(S);return{...S,open:u[x]??!0,onOpenChange:_=>c(R=>({...R,[x]:_}))}});return C.useEffect(()=>{const S=x=>{var _,R;(x.metaKey||x.ctrlKey)&&x.key==="k"&&(x.preventDefault(),(_=f.current)==null||_.focus(),(R=f.current)==null||R.select())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[]),E.jsxs(wE,{...e,children:[E.jsx(y6,{}),E.jsx(Xe,{ay:"center",gap:2,fullwidth:!0,children:E.jsx(II,{ref:f,placeholder:"Search for a session",before:E.jsx(XG,{}),after:E.jsx(yP,{hotkey:["meta","k"]}),size:"small",fullwidth:!0,style:{flex:1,minWidth:0},value:t,onChange:S=>n(S.target.value)})}),E.jsxs(Xe,{ay:"center",ax:"space-between",gap:2,children:[E.jsxs(VC,{size:"sm",value:[r],onValueChange:S=>{const x=S[0];x&&i(x)},children:[E.jsx(xc,{value:"group","aria-label":"Group by group",children:E.jsx($l,{trigger:E.jsx(OG,{}),children:"Group by group"})}),E.jsx(xc,{value:"status","aria-label":"Group by status",children:E.jsx($l,{trigger:E.jsx(nq,{}),children:"Group by status"})}),E.jsx(xc,{value:"recent","aria-label":"Group by recent",children:E.jsx($l,{trigger:E.jsx(Q3,{}),children:"Group by recent"})})]}),E.jsxs(Xe,{ay:"center",gap:1,children:[E.jsx(Qd,{size:"small",shape:"square",variant:"subtle",tooltip:o?"Hide archived":"Show archived",pressed:o,onPressedChange:a,icon:{unpressed:E.jsx(bG,{}),pressed:E.jsx(xG,{})}}),p.length>0&&E.jsx(Qd,{size:"small",shape:"square",variant:"subtle",tooltip:y?"Collapse all":"Expand all",pressed:!y,onPressedChange:()=>b(),icon:{unpressed:E.jsx(sG,{}),pressed:E.jsx(xS,{})}})]})]}),p.length===0?E.jsxs(je,{size:-1,shade:"muted",style:{padding:"0.5rem"},children:['No sessions match "',t,'".']}):E.jsx(Kc,{items:v,line:!0,size:"small"})]})};b6.displayName="Sidebar";const v6=({session:e})=>E.jsx(ef,{to:"/$",params:{_splat:`${e.categoryPath}/${e.session.slug}`},children:e.session.slug});v6.displayName="SessionLabel";const x6=({session:e})=>{const{data:t=[]}=Si(dh()),n=t.some(p=>p.session.status==="active"||p.session.status==="waiting"),{data:r}=Si(nce(n)),{data:i}=Si(ice),o=r==null?void 0:r[e.session.id],a=i==null?void 0:i[e.session.id],u=(o==null?void 0:o.linesAdded)??0,c=(o==null?void 0:o.linesRemoved)??0,f=(o==null?void 0:o.filesTouched)??0,h=u>0||c>0;return E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(je,{size:-1,shade:"muted",children:Bw(e.session.startedAt)}),h&&E.jsxs(Xe,{ay:"center",gap:1,children:[E.jsx(je,{size:-1,family:"mono",color:"green",children:`+${u}`}),E.jsx(je,{size:-1,family:"mono",color:"red",children:`-${c}`})]}),f>0&&E.jsxs(Xe,{ay:"center",gap:1,children:[E.jsx(e4,{size:12}),E.jsx(je,{size:-1,family:"mono",shade:"muted",children:f})]}),a&&E.jsx(G$,{TriggerProps:{openOnHover:!0},trigger:E.jsx(zG,{size:12,"aria-label":"Session recap"}),title:"Session recap",description:Bw(a.createdAt),PositionerProps:{sideOffset:8,side:"right"},PopupProps:{style:{maxWidth:420}},children:E.jsx(Ye,{my:2,children:E.jsx(ya,{children:a.recap})})}),e.session.rating!==null&&e.session.rating!==void 0&&E.jsx(je,{"aria-label":`Rated ${e.session.rating} of 5 stars`,children:[1,2,3,4,5].map(p=>p<=e.session.rating?"★":"☆").join("")})]})};x6.displayName="SessionContent";const w6=({session:e,categoryPath:t})=>{const n=gF(e),{Icon:r}=n,i=e.status==="paused",o=`${t}/${e.slug}`;return E.jsxs(nb,{children:[E.jsx(rb,{render:E.jsx(Ci,{variant:"ghost",size:"xsmall",shape:"square","aria-label":"Session actions",children:E.jsx(pG,{})})}),E.jsx(ah,{children:E.jsx(lh,{side:"bottom",align:"end",children:E.jsxs(uh,{children:[E.jsxs(Xc,{disabled:n.disabled,onClick:n.onClick,render:E.jsx(Xe,{ay:"center",gap:2}),children:[E.jsx(r,{size:14}),n.label]}),E.jsxs(Xc,{disabled:!i,onClick:()=>{navigator.clipboard.writeText(o)},render:E.jsx(Xe,{ay:"center",gap:2}),children:[E.jsx(Eh,{size:14}),"Copy session path"]})]})})})]})};w6.displayName="SessionRowActions";const S6=({children:e,...t})=>E.jsx(Xe,{"data-slot":"top-bar-wrapper",fullwidth:!0,ay:"center",p:4,gap:4,bb:1,style:{position:"sticky",top:0,backgroundColor:"var(--shade-background)",zIndex:1,...t.style},...t,children:e});S6.displayName="TopBarWrapper";const Ud="uiid-theme";function Jge(){return localStorage.getItem(Ud)??"system"}function eye(e){const t=n=>{n.key===Ud&&e()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function tye(e){e==="system"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}function nye(){const e=C.useSyncExternalStore(eye,Jge),t=C.useCallback(n=>{n==="system"?localStorage.removeItem(Ud):localStorage.setItem(Ud,n),tye(n),window.dispatchEvent(new StorageEvent("storage",{key:Ud,newValue:n}))},[]);return{theme:e,setTheme:t}}const C6=()=>{const{theme:e,setTheme:t}=nye();return E.jsxs(VC,{value:[e],onValueChange:n=>{const r=n[0];r&&t(r)},size:"sm",children:[E.jsx(xc,{value:"light","aria-label":"Light mode",children:E.jsx(eq,{})}),E.jsx(xc,{value:"dark","aria-label":"Dark mode",children:E.jsx(VG,{})}),E.jsx(xc,{value:"system","aria-label":"System theme",children:E.jsx(GG,{})})]})};C6.displayName="ThemeToggle";const SE=({sessionCount:e})=>E.jsxs(S6,{children:[E.jsx(je,{size:2,weight:"bold",children:"bertrand"}),E.jsx(C.Activity,{mode:e?"visible":"hidden",children:E.jsxs(cn,{color:"blue",children:[e," session(s)"]})}),E.jsxs(Xe,{gap:3,ay:"center",ml:"auto",children:[E.jsxs(Xe,{gap:2,ay:"center",children:[E.jsx(ix,{to:"/",tooltip:"Session timeline",icon:E.jsx(nG,{})}),E.jsx(ix,{to:"/dev/markdown",tooltip:"Markdown viewer",icon:E.jsx(eG,{})}),E.jsx(ix,{to:"/dev/diff",tooltip:"Diff viewer",icon:E.jsx(J3,{})})]}),E.jsx(C6,{})]})]});SE.displayName="TopBar";const ix=({to:e,tooltip:t,icon:n})=>E.jsx(Ci,{render:E.jsx(ef,{to:e}),nativeButton:!1,tooltip:t,variant:"subtle",size:"small",shape:"square",children:n}),Yh=$7({component:rye});function rye(){return K7({select:t=>t.location.pathname}).startsWith("/dev/")?E.jsxs(Ye,{fullwidth:!0,style:{position:"fixed",inset:0,height:"100dvh"},children:[E.jsx(SE,{}),E.jsx(Ye,{render:E.jsx("main",{}),fullwidth:!0,style:{flex:1,overflow:"auto"},children:E.jsx(fS,{})})]}):E.jsx(iye,{})}function iye(){const{data:e=[]}=Si(dh());return E.jsxs(Ye,{fullwidth:!0,style:{position:"fixed",height:"100dvh"},children:[E.jsx(SE,{sessionCount:e.length}),E.jsxs(rF,{direction:"horizontal",children:[E.jsx(zw,{defaultSize:360,minSize:320,maxSize:540,children:E.jsx(b6,{})}),E.jsx(iF,{}),E.jsx(zw,{children:E.jsx(Ye,{render:E.jsx("main",{}),fullwidth:!0,fullheight:!0,children:E.jsx(fS,{})})})]})]})}const oye=new Set(["session.started","session.resumed","session.end"]),sye=e=>{const t=new Map;for(let r=0;r<e.length-1;r++){const i=e[r],o=e[r+1];i.event==="session.started"&&o.event==="claude.started"&&i.conversationId===o.conversationId&&t.set(r+1,{...i.meta??{},...o.meta??{}})}const n=[];for(let r=0;r<e.length;r++){const i=e[r];if(oye.has(i.event))continue;const o=t.get(r);n.push(o?{...i,meta:o}:i)}return n},aye=e=>{var r;const t=[],n=new Set;for(let i=0;i<e.length;i++){if(n.has(i))continue;const o=e[i];if(o.event==="session.waiting"){let a=i+1;const u=[];for(;a<e.length&&(e[a].event==="context.snapshot"||e[a].event==="assistant.recap");)e[a].event==="assistant.recap"&&u.push(e[a]),a++;if(a<e.length&&e[a].event==="session.answered"){for(const f of u)t.push(f);const c=(r=o.meta)==null?void 0:r.question;t.push({...e[a],meta:{...e[a].meta,question:c}});for(let f=i;f<=a;f++)n.add(f);continue}}t.push(o)}return t};function gy(e){return e.edits&&e.edits.length>0?e.edits:e.oldStr||e.newStr?[{oldStr:e.oldStr??"",newStr:e.newStr??""}]:[]}function hO(e){const t=e.meta,n=e.event==="permission.resolve"?"approved":e.event==="tool.used"?"auto":"pending";return{tool:(t==null?void 0:t.tool)??"unknown",detail:(t==null?void 0:t.detail)??"",outcome:(t==null?void 0:t.outcome)??n}}const E6={Bash:"ran",Edit:"edited",MultiEdit:"edited",Write:"wrote",Read:"read",Glob:"globbed",Grep:"grepped",WebFetch:"fetched",WebSearch:"searched",TodoWrite:"updated todos"},lye={Bash:"commands",Edit:"files",MultiEdit:"files",Write:"files",Read:"files",Glob:"patterns",Grep:"patterns",WebFetch:"urls",WebSearch:"queries"},uye=new Set(["Edit","MultiEdit","Write","Read"]);function cye(e){return e.split("/").filter(Boolean).pop()??e}function pO(e,t){return e.length<=t?e:e.slice(0,t-1)+"…"}function fye(e){const t=E6[e.tool]??e.tool;return e.detail?e.tool==="Bash"?`ran \`${pO(e.detail,60)}\``:uye.has(e.tool)?`${t} ${cye(e.detail)}`:`${t} ${pO(e.detail,60)}`:t}function dye(e){const t=[];for(const[n,r]of e){const i=E6[n]??n;if(r===1)t.push(i);else{const o=lye[n]??"calls";t.push(`${i} ${r} ${o}`)}}return t.join(", ")}const mO=new Set(["permission.request","permission.resolve","tool.used"]),hye=e=>{const t=[];let n=0;for(;n<e.length;){const r=e[n];if(!mO.has(r.event)){t.push(r),n++;continue}const i=[];for(;n<e.length;){const h=e[n];if(!mO.has(h.event))break;i.push(h),n++}const o=i.filter(h=>h.event==="permission.request"||h.event==="tool.used");if(o.length===0)continue;const a=o.map(hO),u=i.some(h=>h.event==="permission.resolve"),c=new Map;for(const h of a){const p=`${h.tool}::${h.detail}`,g=c.get(p);if(g){g.count++;const y=[...gy(g),...gy(h)];y.length>0&&(g.edits=y,g.oldStr=void 0,g.newStr=void 0)}else c.set(p,{...h,count:1})}const f=[...c.values()];if(f.length<=1){const h=f[0]??hO(i[0]),p=fye(h);t.push({...i[i.length-1],event:"tool.work",summary:p,meta:{...i[i.length-1].meta,permissions:f,outcome:u?"approved":"pending"}})}else{const h=new Map;for(const v of f)h.set(v.tool,(h.get(v.tool)??0)+v.count);const p=[...h.entries()].sort((v,S)=>S[1]-v[1]),g=dye(p),y=new Date(i[0].createdAt).getTime(),b=new Date(i[i.length-1].createdAt).getTime();t.push({...i[0],event:"tool.work",summary:g,meta:{permissions:f,outcome:u?"approved":"pending"},createdAt:new Date((y+b)/2).toISOString()})}}return t},pye={Edit:"edited a file",Write:"wrote a file",MultiEdit:"edited a file"},mye=e=>{const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r.event!=="tool.applied"){t.push(r),n++;continue}const i=[];for(;n<e.length&&e[n].event==="tool.applied";)i.push(e[n]),n++;if(i.length===1){t.push(i[0]);continue}const o=[];for(const f of i){const h=f.meta,p=h==null?void 0:h.permissions;if(Array.isArray(p))for(const g of p)o.push(g)}const a=new Map;for(const f of o){const h=`${f.tool}::${f.detail}`,p=a.get(h),g=f.count??1;if(p){p.count+=g;const y=[...gy(p),...gy(f)];y.length>0&&(p.edits=y,p.oldStr=void 0,p.newStr=void 0)}else a.set(h,{...f,count:g})}const u=[...a.values()],c=i[i.length-1];t.push({...c,meta:{...c.meta,permissions:u}})}return t},gye=e=>e.map(t=>{var o;if(t.event!=="tool.applied"||t.summary)return t;const n=t.meta,r=(n==null?void 0:n.permissions)??[];if(r.length>1)return{...t,summary:`edited ${r.length} files`};const i=(o=r[0])==null?void 0:o.tool;return i?{...t,summary:pye[i]??`${i} applied`}:t}),yye=e=>{const t=new Set(["claude.started","claude.ended","claude.discarded"]);return e.map((n,r)=>{if(!t.has(n.event))return n;const i=n.meta;if(i!=null&&i.model)return n;const o=(i==null?void 0:i.claude_id)??n.conversationId;if(!o)return n;const u=n.event==="claude.started"?e.slice(r+1):e.slice(0,r).reverse();for(const c of u){if(c.event!=="context.snapshot")continue;const f=c.meta;if(((f==null?void 0:f.claude_id)??c.conversationId)!==o)continue;const p=f==null?void 0:f.model;if(p)return{...n,meta:{...i,model:p}}}return n})},bye=[sye,aye,hye,mye,gye,yye];function vye(e){return bye.reduce((t,n)=>n(t),e)}function gO(e,t){const n=e.replace(/^\/+|\/+$/g,"");return n.includes("/")?t.find(r=>`${r.categoryPath}/${r.session.slug}`===n)??null:null}function xye(e){return e<1500?"●○○":e<5e3?"●●○":"●●●"}const wye=/<recap>[\s\S]*?<\/recap>/gi;function k6({event:e}){var a;const t=e.meta;if(e.event==="assistant.recap"){const u=(a=t==null?void 0:t.recap)==null?void 0:a.trim();return u?E.jsx(Ye,{"data-slot":"assistant-recap",py:4,children:E.jsx(qt,{children:E.jsx(ya,{children:u})})}):null}const r=((t==null?void 0:t.text)??"").replace(wye,"").trim(),i=(t==null?void 0:t.thinkingBlocks)??0,o=(t==null?void 0:t.thinkingBytes)??0;return!r&&i===0?null:E.jsxs(Ye,{"data-slot":"assistant-content",gap:2,children:[i>0&&E.jsx(cn,{color:"indigo",children:`Thought ${xye(o)}`}),r&&E.jsx(ya,{children:r})]})}k6.displayName="AssistantContent";function R6({event:e}){const t=e.meta;if(!t)return null;const n=to(t.remaining_pct),r=to(t.context_window_tokens),i=to(t.input_tokens),o=to(t.cache_read_tokens),a=to(t.cache_creation_tokens),u=ab(t.model);return r===0?null:E.jsxs(Ye,{"data-slot":"context-content",gap:3,fullwidth:!0,children:[E.jsx(XS,{value:n,size:"small",color:yF(n)}),E.jsxs(Xe,{gap:2,children:[u&&E.jsx(cn,{size:"small",children:u}),i>0&&E.jsx(cn,{size:"small",color:"orange",children:`${Jo(i)} input`}),o>0&&E.jsx(cn,{size:"small",color:"blue",children:`${Jo(o)} cache read`}),a>0&&E.jsx(cn,{size:"small",color:"indigo",children:`${Jo(a)} cache write`})]})]})}R6.displayName="ContextContent";function yO(e,t){return e==null?void 0:e.find(n=>n.question===t)}function Sye(e,t,n){const r=[...t].sort((a,u)=>u.label.length-a.label.length),i=[];let o=e;for(;o;){const a=r.find(u=>o===u.label||o.startsWith(u.label+", "));if(!a)break;if(i.push(a.label),o===a.label){o="";break}if(o=o.slice(a.label.length+2),!n)break}return{selectedLabels:i,note:o||void 0}}function _6({event:e}){const t=e.meta;if(e.event==="session.answered"){const n=t==null?void 0:t.answers;if(!n||Object.keys(n).length===0)return null;const r=t==null?void 0:t.questions,i=Object.entries(n),o=(u,c)=>{const f=yO(r,u),h=(f==null?void 0:f.multiSelect)??!1,p=(f==null?void 0:f.options)??[],{selectedLabels:g,note:y}=Sye(c,p,h),b=g.length>0,v=b?void 0:y??c,S=b?y:void 0;return E.jsxs(Ye,{gap:4,fullwidth:!0,children:[v&&E.jsxs(Ye,{"data-slot":"interaction-content-note",gap:4,m:2,fullwidth:!0,children:[E.jsx(je,{color:"yellow",weight:"bold",size:1,children:"Answered manually:"}),E.jsx(ya,{children:v})]}),!b&&!v&&E.jsx(je,{color:"red",weight:"bold",size:1,m:2,children:"Didn't answer."}),p.length>0&&E.jsx(Kc,{type:"ordered",items:p.map(x=>({value:x.label,label:E.jsx(je,{weight:"bold",color:g.includes(x.label)?"green":void 0,children:x.label}),description:x.description,disabled:!g.includes(x.label)}))}),S&&E.jsxs(Ye,{"data-slot":"interaction-content-note",gap:4,m:2,fullwidth:!0,children:[E.jsx(je,{color:"green",weight:"bold",size:1,children:"Additional notes:"}),E.jsx(ya,{children:S})]})]})};if(i.length===1){const[u,c]=i[0];return E.jsx(Ye,{"data-slot":"interaction-content",gap:2,py:4,fullwidth:!0,children:E.jsx(qt,{gap:4,fullwidth:!0,children:o(u,c)})})}const a=i.map(([u,c],f)=>{const h=yO(r,u);return{label:(h==null?void 0:h.header)??`Question ${f+1}`,value:u,render:o(u,c)}});return E.jsx(Ye,{"data-slot":"interaction-content",gap:2,py:4,fullwidth:!0,children:E.jsx(qt,{gap:4,fullwidth:!0,children:E.jsx(qC,{items:a,ContainerProps:{fullwidth:!0,mt:6}})})})}if(e.event==="user.prompt"){const n=t==null?void 0:t.prompt;return n?E.jsx(T6,{children:E.jsx(ya,{children:n})}):null}return null}_6.displayName="InteractionContent";const T6=({children:e})=>E.jsx(Ye,{"data-slot":"interaction-content",py:4,fullwidth:!0,children:E.jsx(qt,{gap:4,fullwidth:!0,children:e})});T6.displayName="CardContainer";function Cye(e){if(e)return e.slice(0,8)}function A6({event:e}){if(e.event==="claude.started")return null;const t=e.meta;if(e.event==="session.recap"){const u=t==null?void 0:t.recap;return u?E.jsx(Ye,{py:4,children:E.jsx(qt,{children:E.jsx(ya,{children:u})})}):null}const n=(t==null?void 0:t.claude_id)??e.conversationId??void 0,r=ab(t==null?void 0:t.model),i=Cye(n??void 0),o=e.event==="claude.ended"?t==null?void 0:t.exit_code:void 0,a=typeof o=="number"&&o!==0;return!r&&!i&&!a?null:E.jsxs(Xe,{gap:2,ay:"center",children:[r&&E.jsx(cn,{color:"orange",size:"small",children:r}),i&&E.jsx(cn,{color:"neutral",size:"small",children:i}),a&&E.jsx(cn,{color:"red",size:"small",children:`exit ${o}`})]})}A6.displayName="LifecycleContent";function D6({event:e}){const t=e.meta;if(!t)return null;switch(e.event){case"gh.pr.created":{const n=t.pr_title,r=t.pr_url;return E.jsxs(E.Fragment,{children:[n&&E.jsx(je,{size:1,children:n}),r&&E.jsx(je,{size:-1,family:"mono",color:"neutral",children:r})]})}case"gh.pr.merged":{const n=t.branch;return n?E.jsx(je,{size:1,family:"mono",children:n}):null}case"vercel.deploy":{const n=t.project_name;return n?E.jsx(je,{size:1,children:n}):null}default:return null}}D6.displayName="MilestoneContent";function Eye({text:e}){const[t,n]=C.useState(!1);return E.jsx(Ci,{size:"small",variant:"ghost",shape:"square",tooltip:t?"Copied!":"Copy path",disabled:t,onClick:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},children:t?E.jsx(Ch,{color:"green"}):E.jsx(Eh,{})})}function kye(e){if(e)return e.slice(0,8)}function Rye(e){if(e)return e.slice(0,7)}function M6({event:e}){const t=e.meta;if(!t)return null;const n=t.labels??[],r=t.summary,i=t.claude_id??e.conversationId??void 0,o=ab(t.model),a=t.claude_version,u=kye(i),c=t.git??void 0,f=c==null?void 0:c.branch,h=Rye(c==null?void 0:c.sha),p=!!(c!=null&&c.dirty),g=t.cwd,y=[];if(n.length>0&&y.push({field:"Labels",value:n.join(", ")}),r&&y.push({field:"Summary",value:r}),o&&y.push({field:"Model",value:E.jsx(cn,{color:"orange",size:"small",children:o})}),a&&y.push({field:"Version",value:E.jsx(cn,{color:"neutral",size:"small",children:a})}),u&&y.push({field:"Claude ID",value:E.jsx(cn,{color:"neutral",size:"small",children:u})}),f&&y.push({field:"Branch",value:E.jsxs(Xe,{gap:2,ay:"center",children:[E.jsx(cn,{color:"neutral",size:"small",children:f}),h&&E.jsx(cn,{color:"neutral",size:"small",children:h}),p&&E.jsx(cn,{color:"red",size:"small",children:"dirty"})]})}),g&&y.push({field:"CWD",value:E.jsx(je,{family:"mono",size:-1,color:"neutral",children:g})}),y.length===0)return null;const b=x=>x.field==="CWD",v=(x,_)=>b(_)?x:E.jsx(E.Fragment,{}),S={primary:[{icon:gG,tooltip:"Open in Cursor",onClick:x=>{!b(x)||!g||window.open(`cursor://file/${encodeURI(g)}`,"_blank")},wrapper:v},{icon:EG,tooltip:"Open in Finder",onClick:x=>{!b(x)||!g||fetch(sb("/api/open"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:g})})},wrapper:v},{icon:Eh,tooltip:"Copy path",wrapper:(x,_)=>b(_)&&g?E.jsx(Eye,{text:g}):E.jsx(E.Fragment,{})}]};return E.jsx(Ye,{py:4,fullwidth:!0,children:E.jsx(qt,{trimmed:!0,fullwidth:!0,children:E.jsx(eE,{children:E.jsx(tE,{children:E.jsx(rE,{children:y.map(x=>E.jsxs(nE,{children:[E.jsx(fh,{children:E.jsx(je,{weight:"bold",children:x.field})}),E.jsx(fh,{children:x.value}),E.jsx(dF,{actions:S,item:x})]},x.field))})})})})})}M6.displayName="StartedContent";class O6{diff(t,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const o=this.castInput(t,r),a=this.castInput(n,r),u=this.removeEmpty(this.tokenize(o,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(u,c,r,i)}diffWithOptionsObj(t,n,r,i){var o;const a=_=>{if(_=this.postProcess(_,r),i){setTimeout(function(){i(_)},0);return}else return _},u=n.length,c=t.length;let f=1,h=u+c;r.maxEditLength!=null&&(h=Math.min(h,r.maxEditLength));const p=(o=r.timeout)!==null&&o!==void 0?o:1/0,g=Date.now()+p,y=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(y[0],n,t,0,r);if(y[0].oldPos+1>=c&&b+1>=u)return a(this.buildValues(y[0].lastComponent,n,t));let v=-1/0,S=1/0;const x=()=>{for(let _=Math.max(v,-f);_<=Math.min(S,f);_+=2){let R;const T=y[_-1],A=y[_+1];T&&(y[_-1]=void 0);let D=!1;if(A){const $=A.oldPos-_;D=A&&0<=$&&$<u}const O=T&&T.oldPos+1<c;if(!D&&!O){y[_]=void 0;continue}if(!O||D&&T.oldPos<A.oldPos?R=this.addToPath(A,!0,!1,0,r):R=this.addToPath(T,!1,!0,1,r),b=this.extractCommon(R,n,t,_,r),R.oldPos+1>=c&&b+1>=u)return a(this.buildValues(R.lastComponent,n,t))||!0;y[_]=R,R.oldPos+1>=c&&(S=Math.min(S,_-1)),b+1>=u&&(v=Math.max(v,_+1))}f++};if(i)(function _(){setTimeout(function(){if(f>h||Date.now()>g)return i(void 0);x()||_()},0)})();else for(;f<=h&&Date.now()<=g;){const _=x();if(_)return _}}addToPath(t,n,r,i,o){const a=t.lastComponent;return a&&!o.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+i,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,i,o){const a=n.length,u=r.length;let c=t.oldPos,f=c-i,h=0;for(;f+1<a&&c+1<u&&this.equals(r[c+1],n[f+1],o);)f++,c++,h++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return h&&!o.oneChangePerToken&&(t.lastComponent={count:h,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,f}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const i=[];let o;for(;t;)i.push(t),o=t.previousComponent,delete t.previousComponent,t=o;i.reverse();const a=i.length;let u=0,c=0,f=0;for(;u<a;u++){const h=i[u];if(h.removed)h.value=this.join(r.slice(f,f+h.count)),f+=h.count;else{if(!h.added&&this.useLongestToken){let p=n.slice(c,c+h.count);p=p.map(function(g,y){const b=r[f+y];return b.length>g.length?b:g}),h.value=this.join(p)}else h.value=this.join(n.slice(c,c+h.count));c+=h.count,h.added||(f+=h.count)}}return i}}const bO="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class _ye extends O6{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${bO}]+|[^\\S\\n\\r]+|[^${bO}]`,"ug");return t.match(n)||[]}}const Tye=new _ye;function Aye(e,t,n){return Tye.diff(e,t,n)}class Dye extends O6{constructor(){super(...arguments),this.tokenize=$ye}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
520
520
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
521
521
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
522
522
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
@@ -528,7 +528,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[jy(e),e])),Pte=new Map([["s",kn(383)],[kn(38
|
|
|
528
528
|
`);return[i(e),i(t)]}function Nye(e,t){const n=[],r=[],i=[];function o(h,p){const g=n.length,b=(h.endsWith(`
|
|
529
529
|
`)?h.slice(0,-1):h).split(`
|
|
530
530
|
`);for(const v of b)n.push(v),r.push(p);return{startIdx:g,lns:b}}for(let h=0;h<e.length;h++){h>0&&(n.push("…"),r.push("separator"));const{oldStr:p,newStr:g}=e[h],[y,b]=Pye(p,g),v=Oye(y,b);let S=0;for(;S<v.length;){const x=v[S];if(x.removed&&S+1<v.length&&v[S+1].added){const _=o(x.value,"remove"),R=o(v[S+1].value,"add"),T=t?Math.min(_.lns.length,R.lns.length):0;for(let A=0;A<T;A++){const D=Aye(_.lns[A],R.lns[A]);let O=0,$=0;for(const z of D){const j=z.value.length;z.added?(j>0&&i.push({start:{line:R.startIdx+A,character:$},end:{line:R.startIdx+A,character:$+j},properties:{class:"diff-word add"}}),$+=j):z.removed?(j>0&&i.push({start:{line:_.startIdx+A,character:O},end:{line:_.startIdx+A,character:O+j},properties:{class:"diff-word remove"}}),O+=j):(O+=j,$+=j)}}S+=2}else x.removed?(o(x.value,"remove"),S+=1):x.added?(o(x.value,"add"),S+=1):(o(x.value,"context"),S+=1)}}const a=[];let u=1,c=1;for(const h of r)h==="separator"?a.push({old:null,new:null}):h==="remove"?a.push({old:u++,new:null}):h==="add"?a.push({old:null,new:c++}):a.push({old:u++,new:c++});const f=Math.max(u-1,c-1,1);return{code:n.join(`
|
|
531
|
-
`),lineKinds:r,lineNums:a,decorations:i,maxLineNum:f}}function ox(e,t){e.properties||(e.properties={});const n=e.properties.class;typeof n=="string"?e.properties.class=n?`${n} ${t}`:t:Array.isArray(n)?e.properties.class=[...n,t]:e.properties.class=t}function sx(e,t){return{type:"element",tagName:"span",properties:{class:e},children:[{type:"text",value:t}]}}const Iye={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",markdown:"markdown",css:"css",html:"html",htm:"html",py:"python",sh:"bash",bash:"bash",zsh:"bash"};function jye(e,t){if(!e)return t;const n=e.split("/").pop()??e,r=n.includes(".")?n.split(".").pop().toLowerCase():"";return Iye[r]??t}function CE({edits:e,oldStr:t,newStr:n,language:r,filename:i,wordDiff:o=!1,rows:a,defaultExpanded:u}){var v;const c=e&&e.length>0?e:[{oldStr:t??"",newStr:n??""}],f=r??jye(i,"tsx"),[h,p]=C.useState(""),[g,y]=C.useState(1);C.useEffect(()=>{let S=!1;return(async()=>{const{code:x,lineKinds:_,lineNums:R,decorations:T,maxLineNum:A}=Nye(c,o);await eI(f);const O=(await pC()).codeToHtml(x,{lang:f,themes:{light:"vitesse-light",dark:"vitesse-black"},defaultColor:!1,decorations:T,transformers:[{name:"diff-block:line-marks",pre($){ox($,"has-diff")},line($,z){const j=z-1,I=_[j],M=R[j];if(I==="add"||I==="remove")ox($,`diff ${I}`);else if(I==="separator")return ox($,"diff-separator"),$;const B=I==="add"?"diff-marker add":I==="remove"?"diff-marker remove":"diff-marker",G=I==="add"?"+":I==="remove"?"-":" ",L="diff-num diff-num-old"+(M.old==null?" diff-num-blank":""),F="diff-num diff-num-new"+(M.new==null?" diff-num-blank":""),U=[sx(L,M.old!=null?String(M.old):" "),sx(F,M.new!=null?String(M.new):" "),sx(B,G)];return $.children.unshift(...U),$}}]});S||(p(O),y(String(A).length))})(),()=>{S=!0}},[c,f,o]);const b=((v=c[c.length-1])==null?void 0:v.newStr)??"";return E.jsx("div",{className:"bertrand-diff-block",style:{"--diff-num-width":`${g+2}ch`,width:"100%"},children:E.jsx(mC,{code:b,language:f,filename:i,showLineNumbers:!1,rows:a,defaultExpanded:u,HeaderProps:{copyable:!1},html:h,style:{width:"100%"}})})}CE.displayName="DiffBlock";const Lye=5;function Qw(e){return!!(e.oldStr||e.newStr||e.edits&&e.edits.length>0)}function $6({permission:e}){const t=e.edits&&e.edits.length>0?e.edits.map(n=>({oldStr:n.oldStr??"",newStr:n.newStr??""})):[{oldStr:e.oldStr??"",newStr:e.newStr??""}];return E.jsx(CE,{edits:t,filename:e.detail,rows:Lye,defaultExpanded:!1})}function Fye(e){const t=e.count>1?`${e.count}× `:"";return e.detail?`${t}${e.detail}`:`${t}${e.tool}`}function P6({permission:e}){return E.jsx(je,{size:-1,family:"mono",shade:"muted",children:Fye(e)})}function N6({event:e}){const t=e.meta;if(!(t!=null&&t.permissions))return null;const n=t.permissions;if(n.length===0)return null;if(n.length===1){const r=n[0];return r.detail?Qw(r)?E.jsx($6,{permission:r}):E.jsx(P6,{permission:r}):null}return E.jsx(zye,{permissions:n})}function zye({permissions:e}){const t=e.filter(Qw),n=e.filter(r=>!Qw(r));return E.jsxs(Ye,{"data-slot":"work-content",gap:2,fullwidth:!0,children:[t.length>0&&E.jsx(Ye,{gap:2,fullwidth:!0,children:t.map((r,i)=>E.jsx($6,{permission:r},`diff-${i}`))}),n.length>0&&E.jsx(Ye,{gap:1,fullwidth:!0,children:n.map((r,i)=>E.jsx(P6,{permission:r},`info-${i}`))})]})}N6.displayName="WorkContent";function I6({event:e}){if(e.event==="claude.started")return E.jsx(M6,{event:e});switch(uce(e.event)){case"interaction":return E.jsx(_6,{event:e});case"work":return E.jsx(N6,{event:e});case"milestone":return E.jsx(D6,{event:e});case"assistant":return E.jsx(k6,{event:e});case"context":return E.jsx(R6,{event:e});case"lifecycle":return E.jsx(A6,{event:e});default:return null}}I6.displayName="EventContent";const j6=({sessionId:e,isLive:t,...n})=>{const{data:r}=Si({...tce(e,t),enabled:!!e}),{data:i}=Si({...rce(e,t),enabled:!!e});return E.jsx(wE,{"data-slot":"secondary-sidebar",...n,p:0,minw:540,children:r&&E.jsx(L6,{stats:r,engagement:i})})};j6.displayName="SecondarySidebar";function Bye(e){return Object.entries(e).sort(([,t],[,n])=>n-t).slice(0,3).map(([t,n])=>`${t} ${n}`).join(" · ")}const L6=({stats:e,engagement:t})=>{const n=e.linesAdded>0||e.linesRemoved>0,r=e.filesTouched>0,i=n||r||e.prCount>0,o=t?Object.values(t.toolUsage).reduce((p,g)=>p+g,0):0,a=((t==null?void 0:t.contextTokens.max)??0)>0,u=(t==null?void 0:t.permissionDenials)??0,c=(t==null?void 0:t.discardRate.total)??0,f=!!t&&(o>0||a||u>0||c>0),h=[{label:"Activity",value:"activity",render:E.jsxs(vg,{children:[E.jsx(qt,{title:"Conversations",description:"Distinct conversation threads",icon:LG,action:E.jsx(zr,{value:e.conversationCount})}),E.jsx(qt,{title:"Interactions",description:"User-Claude exchanges",icon:PG,action:E.jsx(zr,{value:e.interactionCount})}),E.jsx(qt,{title:"Events",description:"Total events emitted",icon:ZH,action:E.jsx(zr,{value:e.eventCount})}),E.jsx(qt,{title:"Duration",description:"Total session time",icon:Q3,action:E.jsx(zr,{label:z1(e.durationS)})}),E.jsx(qt,{title:"Claude work",description:"Time Claude spent active",icon:fG,action:E.jsx(zr,{label:z1(e.claudeWorkS)})}),E.jsx(qt,{title:"User wait",description:"Time user spent waiting",icon:IG,action:E.jsx(zr,{label:z1(e.userWaitS)})})]})}];return i&&h.push({label:"Code",value:"code",render:E.jsxs(vg,{children:[n&&E.jsx(qt,{title:"Lines changed",description:"Across all edits",icon:J3,action:E.jsx(F6,{added:e.linesAdded,removed:e.linesRemoved})}),r&&E.jsx(qt,{title:"Files touched",description:"Distinct files edited",icon:e4,action:E.jsx(zr,{value:e.filesTouched})}),e.prCount>0&&E.jsx(qt,{title:"PRs",description:"Pull requests created",icon:TG,action:E.jsx(zr,{value:e.prCount})})]})}),f&&h.push({label:"Engagement",value:"engagement",render:E.jsxs(vg,{children:[o>0&&E.jsx(qt,{title:"Tracked tool calls",description:Bye(t.toolUsage),icon:uq,action:E.jsx(zr,{value:o})}),a&&E.jsx(qt,{title:"Context tokens",description:`avg ${Jo(t.contextTokens.avg)} · max ${Jo(t.contextTokens.max)}`,icon:RG,action:E.jsx(zr,{label:Jo(t.contextTokens.latest)})}),u>0&&E.jsx(qt,{title:"Permission denials",description:"Tool requests denied",icon:ZG,action:E.jsx(zr,{value:u})}),c>0&&E.jsx(qt,{title:"Discarded conversations",description:`${t.discardRate.discarded} of ${c}`,icon:oq,action:E.jsx(zr,{value:t.discardRate.discarded})})]})}),E.jsx(qC,{items:h,fullwidth:!0,ContainerProps:{fullwidth:!0}})};L6.displayName="SessionStats";const vg=({children:e})=>E.jsx(Ye,{"data-slot":"section-stack",ax:"stretch",pt:4,fullwidth:!0,gap:2,children:e});vg.displayName="SectionStack";const zr=e=>E.jsx(je,{"data-slot":"stat",size:3,family:"mono",weight:"bold",children:"label"in e?e.label:e.value});zr.displayName="Stat";const F6=({added:e,removed:t})=>E.jsxs(je,{"data-slot":"diff-stat",size:3,family:"mono",weight:"bold",children:[E.jsx(je,{color:"green",family:"mono",weight:"bold",children:`+${e}`})," / ",E.jsx(je,{color:"red",family:"mono",weight:"bold",children:`-${t}`})]});F6.displayName="DiffStat";const EE=({session:e,categoryPath:t,size:n="small",variant:r="subtle",shape:i="square",...o})=>{const[a,u]=C.useState(!1);if(e.status!=="paused")return null;const c=`${t}/${e.slug}`;return E.jsx(Qd,{tooltip:a?"Copied!":"Copy session path",size:n,variant:r,shape:i,pressed:a,onPressedChange:f=>{f&&(navigator.clipboard.writeText(c),u(!0),setTimeout(()=>u(!1),2e3))},icon:{unpressed:E.jsx(Eh,{}),pressed:E.jsx(Ch,{color:"green"})},onClick:f=>{f.preventDefault(),f.stopPropagation()},...o})};EE.displayName="CopyResumeButton";const z6=({session:e,...t})=>{const{categoryPath:n,session:r}=e,i=oE(r.status);return E.jsxs(Xe,{"data-slot":"session-item",ay:"center",gap:2,ml:2,...t,children:[E.jsxs(Xe,{gap:2,ay:"center",children:[E.jsx(My,{"data-slot":"session-status",color:i}),E.jsx(Ye,{gap:2,children:E.jsxs(je,{"data-slot":"session-link",render:E.jsx(ef,{to:"/$",params:{_splat:`${n}/${r.slug}`}}),weight:"bold",children:[n," / ",r.slug]})}),E.jsx(je,{"data-slot":"session-time",size:-1,shade:"muted",children:Bw(r.startedAt)})]}),E.jsx(cn,{"data-slot":"session-badge",color:i,ml:"auto",children:r.status}),E.jsx(EE,{session:r,categoryPath:n})]})};z6.displayName="SessionItem";const B6=wy("/$")({component:Uye}),U6=({href:e,children:t})=>E.jsx(ef,{to:e,children:t});function H6(e,t,n){const r=t.split("/").filter(Boolean),i=[{label:e,value:"/"}];for(let o=0;o<r.length;o++)i.push({label:r[o],value:`/${r.slice(0,o+1).join("/")}`});return n!==void 0&&i.push({label:n,value:""}),i}function bO(e,t){const n=e.lastIndexOf("/");if(n<=0)return null;const r=e.slice(0,n),i=e.slice(n+1);return i?t.find(o=>o.categoryPath===r&&o.session.slug===i)??null:null}function Uye(){const{_splat:e=""}=B6.useParams(),{data:t=[]}=Si(dh()),{data:n=[]}=Si(dh({includeArchived:!0})),r=bO(e,t)??bO(e,n);return r?E.jsx(V6,{match:r}):E.jsx(q6,{categoryPath:e,sessions:t})}function G6(){var t;const{data:e=[]}=Si(mF);return((t=e.find(n=>n.active))==null?void 0:t.name)??"bertrand"}function q6({categoryPath:e,sessions:t}){const n=G6(),r=t.filter(o=>o.categoryPath===e),i=H6(n,e);return E.jsxs(Ye,{gap:4,ax:"stretch",fullwidth:!0,children:[E.jsx(Ye,{bb:1,p:4,style:{position:"sticky",top:0,backgroundColor:"var(--shade-background)",zIndex:1},children:E.jsx(JC,{items:i,linkAs:U6})}),E.jsx(Ye,{px:8,gap:2,style:{overflow:"auto"},children:r.length>0?r.map(o=>E.jsx(z6,{session:o},o.session.id)):E.jsx(je,{shade:"muted",children:"No sessions in this category."})})]})}q6.displayName="CategoryDetail";function V6({match:e}){const t=G6(),n=e.session.id,r=e.session.status==="active"||e.session.status==="waiting",{data:i=[]}=Si(ece(n,r)),o=C.useMemo(()=>vye(i),[i]),a=C.useMemo(()=>{for(let f=i.length-1;f>=0;f--)if(i[f].event==="context.snapshot")return i[f];return null},[i]),u=C.useMemo(()=>{var f;if(e.session.status!=="waiting")return null;for(let h=i.length-1;h>=0;h--)if(i[h].event==="session.waiting"){const p=(f=i[h].meta)==null?void 0:f.question;return typeof p=="string"?p:null}return null},[i,e.session.status]),c=H6(t,e.categoryPath,e.session.name);return E.jsxs(Ye,{ax:"stretch",fullwidth:!0,style:{overflow:"hidden"},children:[E.jsxs(Xe,{bb:1,px:4,py:2,ay:"center",ax:"space-between",fullwidth:!0,children:[E.jsx(JC,{items:c,linkAs:U6}),E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(EE,{session:e.session,categoryPath:e.categoryPath}),E.jsx(Y6,{session:e.session}),E.jsx(X$,{side:"right",title:"Session stats",trigger:E.jsx(Ci,{tooltip:"Session stats",variant:"subtle",size:"small",shape:"square",children:E.jsx(WG,{})}),children:E.jsx(j6,{sessionId:n,isLive:r})})]})]}),E.jsx(Ye,{p:8,ax:"stretch",fullwidth:!0,style:{overflowY:"auto"},children:o.length>0&&E.jsx(FP,{activeIndex:o.length,items:o.map(f=>({title:yce(f),time:bce(f.createdAt),color:hce(f.event),content:E.jsx(I6,{event:f})})),ItemProps:{style:{width:"100%"}},ContentProps:{fullwidth:!0,maxw:860}})}),E.jsx(W6,{session:e.session,context:a,pendingQuestion:u})]})}V6.displayName="SessionDetail";function Y6({session:e}){const t=gF(e),{Icon:n}=t;return E.jsx(Ci,{tooltip:t.tooltip,variant:"subtle",size:"small",shape:"square",disabled:t.disabled,loading:t.loading,onClick:t.onClick,"aria-label":t.label,children:E.jsx(n,{})})}Y6.displayName="ArchiveToggle";function W6({session:e,context:t,pendingQuestion:n}){const r=oE(e.status),i=e.status==="active"||e.status==="waiting";return E.jsxs(Ye,{bt:1,p:4,gap:3,fullwidth:!0,children:[E.jsxs(Xe,{ay:"center",gap:2,fullwidth:!0,children:[E.jsx(My,{color:r,pulse:i}),E.jsx(cn,{color:r,children:e.status}),n&&E.jsx(je,{size:1,shade:"muted",children:n})]}),t&&E.jsx(K6,{event:t})]})}W6.displayName="SessionFooter";function K6({event:e}){const t=e.meta;if(!t)return null;const n=to(t.remaining_pct),r=to(t.context_window_tokens),i=to(t.input_tokens),o=to(t.cache_read_tokens),a=to(t.cache_creation_tokens),u=ab(t.model);return r===0?null:E.jsxs(E.Fragment,{children:[E.jsx(XS,{value:n,size:"small",color:yF(n)}),E.jsxs(Xe,{gap:2,children:[u&&E.jsx(cn,{size:"small",children:u}),i>0&&E.jsx(cn,{size:"small",color:"orange",children:`${Jo(i)} input`}),o>0&&E.jsx(cn,{size:"small",color:"blue",children:`${Jo(o)} cache read`}),a>0&&E.jsx(cn,{size:"small",color:"indigo",children:`${Jo(a)} cache write`})]})]})}K6.displayName="ContextStats";const Hye=wy("/")({component:()=>E.jsx("div",{style:{opacity:.5,fontSize:13},children:"Select a session"})}),Gye=`# Heading 1 — anchored
|
|
531
|
+
`),lineKinds:r,lineNums:a,decorations:i,maxLineNum:f}}function ox(e,t){e.properties||(e.properties={});const n=e.properties.class;typeof n=="string"?e.properties.class=n?`${n} ${t}`:t:Array.isArray(n)?e.properties.class=[...n,t]:e.properties.class=t}function sx(e,t){return{type:"element",tagName:"span",properties:{class:e},children:[{type:"text",value:t}]}}const Iye={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",json:"json",md:"markdown",markdown:"markdown",css:"css",html:"html",htm:"html",py:"python",sh:"bash",bash:"bash",zsh:"bash"};function jye(e,t){if(!e)return t;const n=e.split("/").pop()??e,r=n.includes(".")?n.split(".").pop().toLowerCase():"";return Iye[r]??t}function CE({edits:e,oldStr:t,newStr:n,language:r,filename:i,wordDiff:o=!1,rows:a,defaultExpanded:u}){var v;const c=e&&e.length>0?e:[{oldStr:t??"",newStr:n??""}],f=r??jye(i,"tsx"),[h,p]=C.useState(""),[g,y]=C.useState(1);C.useEffect(()=>{let S=!1;return(async()=>{const{code:x,lineKinds:_,lineNums:R,decorations:T,maxLineNum:A}=Nye(c,o);await eI(f);const O=(await pC()).codeToHtml(x,{lang:f,themes:{light:"vitesse-light",dark:"vitesse-black"},defaultColor:!1,decorations:T,transformers:[{name:"diff-block:line-marks",pre($){ox($,"has-diff")},line($,z){const j=z-1,I=_[j],M=R[j];if(I==="add"||I==="remove")ox($,`diff ${I}`);else if(I==="separator")return ox($,"diff-separator"),$;const B=I==="add"?"diff-marker add":I==="remove"?"diff-marker remove":"diff-marker",G=I==="add"?"+":I==="remove"?"-":" ",L="diff-num diff-num-old"+(M.old==null?" diff-num-blank":""),F="diff-num diff-num-new"+(M.new==null?" diff-num-blank":""),U=[sx(L,M.old!=null?String(M.old):" "),sx(F,M.new!=null?String(M.new):" "),sx(B,G)];return $.children.unshift(...U),$}}]});S||(p(O),y(String(A).length))})(),()=>{S=!0}},[c,f,o]);const b=((v=c[c.length-1])==null?void 0:v.newStr)??"";return E.jsx("div",{className:"bertrand-diff-block",style:{"--diff-num-width":`${g+2}ch`,width:"100%"},children:E.jsx(mC,{code:b,language:f,filename:i,showLineNumbers:!1,rows:a,defaultExpanded:u,HeaderProps:{copyable:!1},html:h,style:{width:"100%"}})})}CE.displayName="DiffBlock";const Lye=5;function Qw(e){return!!(e.oldStr||e.newStr||e.edits&&e.edits.length>0)}function $6({permission:e}){const t=e.edits&&e.edits.length>0?e.edits.map(n=>({oldStr:n.oldStr??"",newStr:n.newStr??""})):[{oldStr:e.oldStr??"",newStr:e.newStr??""}];return E.jsx(CE,{edits:t,filename:e.detail,rows:Lye,defaultExpanded:!1})}function Fye(e){const t=e.count>1?`${e.count}× `:"";return e.detail?`${t}${e.detail}`:`${t}${e.tool}`}function P6({permission:e}){return E.jsx(je,{size:-1,family:"mono",shade:"muted",children:Fye(e)})}function N6({event:e}){const t=e.meta;if(!(t!=null&&t.permissions))return null;const n=t.permissions;if(n.length===0)return null;if(n.length===1){const r=n[0];return r.detail?Qw(r)?E.jsx($6,{permission:r}):E.jsx(P6,{permission:r}):null}return E.jsx(zye,{permissions:n})}function zye({permissions:e}){const t=e.filter(Qw),n=e.filter(r=>!Qw(r));return E.jsxs(Ye,{"data-slot":"work-content",gap:2,fullwidth:!0,children:[t.length>0&&E.jsx(Ye,{gap:2,fullwidth:!0,children:t.map((r,i)=>E.jsx($6,{permission:r},`diff-${i}`))}),n.length>0&&E.jsx(Ye,{gap:1,fullwidth:!0,children:n.map((r,i)=>E.jsx(P6,{permission:r},`info-${i}`))})]})}N6.displayName="WorkContent";function I6({event:e}){if(e.event==="claude.started")return E.jsx(M6,{event:e});switch(uce(e.event)){case"interaction":return E.jsx(_6,{event:e});case"work":return E.jsx(N6,{event:e});case"milestone":return E.jsx(D6,{event:e});case"assistant":return E.jsx(k6,{event:e});case"context":return E.jsx(R6,{event:e});case"lifecycle":return E.jsx(A6,{event:e});default:return null}}I6.displayName="EventContent";const j6=({sessionId:e,isLive:t,...n})=>{const{data:r}=Si({...tce(e,t),enabled:!!e}),{data:i}=Si({...rce(e,t),enabled:!!e});return E.jsx(wE,{"data-slot":"secondary-sidebar",...n,p:0,minw:540,children:r&&E.jsx(L6,{stats:r,engagement:i})})};j6.displayName="SecondarySidebar";function Bye(e){return Object.entries(e).sort(([,t],[,n])=>n-t).slice(0,3).map(([t,n])=>`${t} ${n}`).join(" · ")}const L6=({stats:e,engagement:t})=>{const n=e.linesAdded>0||e.linesRemoved>0,r=e.filesTouched>0,i=n||r||e.prCount>0,o=t?Object.values(t.toolUsage).reduce((p,g)=>p+g,0):0,a=((t==null?void 0:t.contextTokens.max)??0)>0,u=(t==null?void 0:t.permissionDenials)??0,c=(t==null?void 0:t.discardRate.total)??0,f=!!t&&(o>0||a||u>0||c>0),h=[{label:"Activity",value:"activity",render:E.jsxs(vg,{children:[E.jsx(qt,{title:"Conversations",description:"Distinct conversation threads",icon:LG,action:E.jsx(zr,{value:e.conversationCount})}),E.jsx(qt,{title:"Interactions",description:"User-Claude exchanges",icon:PG,action:E.jsx(zr,{value:e.interactionCount})}),E.jsx(qt,{title:"Events",description:"Total events emitted",icon:ZH,action:E.jsx(zr,{value:e.eventCount})}),E.jsx(qt,{title:"Duration",description:"Total session time",icon:Q3,action:E.jsx(zr,{label:z1(e.durationS)})}),E.jsx(qt,{title:"Claude work",description:"Time Claude spent active",icon:fG,action:E.jsx(zr,{label:z1(e.claudeWorkS)})}),E.jsx(qt,{title:"User wait",description:"Time user spent waiting",icon:IG,action:E.jsx(zr,{label:z1(e.userWaitS)})})]})}];return i&&h.push({label:"Code",value:"code",render:E.jsxs(vg,{children:[n&&E.jsx(qt,{title:"Lines changed",description:"Across all edits",icon:J3,action:E.jsx(F6,{added:e.linesAdded,removed:e.linesRemoved})}),r&&E.jsx(qt,{title:"Files touched",description:"Distinct files edited",icon:e4,action:E.jsx(zr,{value:e.filesTouched})}),e.prCount>0&&E.jsx(qt,{title:"PRs",description:"Pull requests created",icon:TG,action:E.jsx(zr,{value:e.prCount})})]})}),f&&h.push({label:"Engagement",value:"engagement",render:E.jsxs(vg,{children:[o>0&&E.jsx(qt,{title:"Tracked tool calls",description:Bye(t.toolUsage),icon:uq,action:E.jsx(zr,{value:o})}),a&&E.jsx(qt,{title:"Context tokens",description:`avg ${Jo(t.contextTokens.avg)} · max ${Jo(t.contextTokens.max)}`,icon:RG,action:E.jsx(zr,{label:Jo(t.contextTokens.latest)})}),u>0&&E.jsx(qt,{title:"Permission denials",description:"Tool requests denied",icon:ZG,action:E.jsx(zr,{value:u})}),c>0&&E.jsx(qt,{title:"Discarded conversations",description:`${t.discardRate.discarded} of ${c}`,icon:oq,action:E.jsx(zr,{value:t.discardRate.discarded})})]})}),E.jsx(qC,{items:h,fullwidth:!0,ContainerProps:{fullwidth:!0}})};L6.displayName="SessionStats";const vg=({children:e})=>E.jsx(Ye,{"data-slot":"section-stack",ax:"stretch",pt:4,fullwidth:!0,gap:2,children:e});vg.displayName="SectionStack";const zr=e=>E.jsx(je,{"data-slot":"stat",size:3,family:"mono",weight:"bold",children:"label"in e?e.label:e.value});zr.displayName="Stat";const F6=({added:e,removed:t})=>E.jsxs(je,{"data-slot":"diff-stat",size:3,family:"mono",weight:"bold",children:[E.jsx(je,{color:"green",family:"mono",weight:"bold",children:`+${e}`})," / ",E.jsx(je,{color:"red",family:"mono",weight:"bold",children:`-${t}`})]});F6.displayName="DiffStat";const EE=({session:e,categoryPath:t,size:n="small",variant:r="subtle",shape:i="square",...o})=>{const[a,u]=C.useState(!1);if(e.status!=="paused")return null;const c=`${t}/${e.slug}`;return E.jsx(Qd,{tooltip:a?"Copied!":"Copy session path",size:n,variant:r,shape:i,pressed:a,onPressedChange:f=>{f&&(navigator.clipboard.writeText(c),u(!0),setTimeout(()=>u(!1),2e3))},icon:{unpressed:E.jsx(Eh,{}),pressed:E.jsx(Ch,{color:"green"})},onClick:f=>{f.preventDefault(),f.stopPropagation()},...o})};EE.displayName="CopyResumeButton";const z6=({session:e,...t})=>{const{categoryPath:n,session:r}=e,i=oE(r.status);return E.jsxs(Xe,{"data-slot":"session-item",ay:"center",gap:2,ml:2,...t,children:[E.jsxs(Xe,{gap:2,ay:"center",children:[E.jsx(My,{"data-slot":"session-status",color:i}),E.jsx(Ye,{gap:2,children:E.jsxs(je,{"data-slot":"session-link",render:E.jsx(ef,{to:"/$",params:{_splat:`${n}/${r.slug}`}}),weight:"bold",children:[n," / ",r.slug]})}),E.jsx(je,{"data-slot":"session-time",size:-1,shade:"muted",children:Bw(r.startedAt)})]}),E.jsx(cn,{"data-slot":"session-badge",color:i,ml:"auto",children:r.status}),E.jsx(EE,{session:r,categoryPath:n})]})};z6.displayName="SessionItem";const B6=wy("/$")({component:Uye}),U6=({href:e,children:t})=>E.jsx(ef,{to:e,children:t});function H6(e,t,n){const r=t.split("/").filter(Boolean),i=[{label:e,value:"/"}];for(let o=0;o<r.length;o++)i.push({label:r[o],value:`/${r.slice(0,o+1).join("/")}`});return n!==void 0&&i.push({label:n,value:""}),i}function Uye(){const{_splat:e=""}=B6.useParams(),{data:t=[]}=Si(dh()),{data:n=[]}=Si(dh({includeArchived:!0})),r=gO(e,t)??gO(e,n);return r?E.jsx(V6,{match:r}):E.jsx(q6,{categoryPath:e,sessions:t})}function G6(){var t;const{data:e=[]}=Si(mF);return((t=e.find(n=>n.active))==null?void 0:t.name)??"bertrand"}function q6({categoryPath:e,sessions:t}){const n=G6(),r=t.filter(o=>o.categoryPath===e),i=H6(n,e);return E.jsxs(Ye,{gap:4,ax:"stretch",fullwidth:!0,children:[E.jsx(Ye,{bb:1,p:4,style:{position:"sticky",top:0,backgroundColor:"var(--shade-background)",zIndex:1},children:E.jsx(JC,{items:i,linkAs:U6})}),E.jsx(Ye,{px:8,gap:2,style:{overflow:"auto"},children:r.length>0?r.map(o=>E.jsx(z6,{session:o},o.session.id)):E.jsx(je,{shade:"muted",children:"No sessions in this category."})})]})}q6.displayName="CategoryDetail";function V6({match:e}){const t=G6(),n=e.session.id,r=e.session.status==="active"||e.session.status==="waiting",{data:i=[]}=Si(ece(n,r)),o=C.useMemo(()=>vye(i),[i]),a=C.useMemo(()=>{for(let f=i.length-1;f>=0;f--)if(i[f].event==="context.snapshot")return i[f];return null},[i]),u=C.useMemo(()=>{var f;if(e.session.status!=="waiting")return null;for(let h=i.length-1;h>=0;h--)if(i[h].event==="session.waiting"){const p=(f=i[h].meta)==null?void 0:f.question;return typeof p=="string"?p:null}return null},[i,e.session.status]),c=H6(t,e.categoryPath,e.session.name);return E.jsxs(Ye,{ax:"stretch",fullwidth:!0,style:{overflow:"hidden"},children:[E.jsxs(Xe,{bb:1,px:4,py:2,ay:"center",ax:"space-between",fullwidth:!0,children:[E.jsx(JC,{items:c,linkAs:U6}),E.jsxs(Xe,{ay:"center",gap:2,children:[E.jsx(EE,{session:e.session,categoryPath:e.categoryPath}),E.jsx(Y6,{session:e.session}),E.jsx(X$,{side:"right",title:"Session stats",trigger:E.jsx(Ci,{tooltip:"Session stats",variant:"subtle",size:"small",shape:"square",children:E.jsx(WG,{})}),children:E.jsx(j6,{sessionId:n,isLive:r})})]})]}),E.jsx(Ye,{p:8,ax:"stretch",fullwidth:!0,style:{overflowY:"auto"},children:o.length>0&&E.jsx(FP,{activeIndex:o.length,items:o.map(f=>({title:yce(f),time:bce(f.createdAt),color:hce(f.event),content:E.jsx(I6,{event:f})})),ItemProps:{style:{width:"100%"}},ContentProps:{fullwidth:!0,maxw:860}})}),E.jsx(W6,{session:e.session,context:a,pendingQuestion:u})]})}V6.displayName="SessionDetail";function Y6({session:e}){const t=gF(e),{Icon:n}=t;return E.jsx(Ci,{tooltip:t.tooltip,variant:"subtle",size:"small",shape:"square",disabled:t.disabled,loading:t.loading,onClick:t.onClick,"aria-label":t.label,children:E.jsx(n,{})})}Y6.displayName="ArchiveToggle";function W6({session:e,context:t,pendingQuestion:n}){const r=oE(e.status),i=e.status==="active"||e.status==="waiting";return E.jsxs(Ye,{bt:1,p:4,gap:3,fullwidth:!0,children:[E.jsxs(Xe,{ay:"center",gap:2,fullwidth:!0,children:[E.jsx(My,{color:r,pulse:i}),E.jsx(cn,{color:r,children:e.status}),n&&E.jsx(je,{size:1,shade:"muted",children:n})]}),t&&E.jsx(K6,{event:t})]})}W6.displayName="SessionFooter";function K6({event:e}){const t=e.meta;if(!t)return null;const n=to(t.remaining_pct),r=to(t.context_window_tokens),i=to(t.input_tokens),o=to(t.cache_read_tokens),a=to(t.cache_creation_tokens),u=ab(t.model);return r===0?null:E.jsxs(E.Fragment,{children:[E.jsx(XS,{value:n,size:"small",color:yF(n)}),E.jsxs(Xe,{gap:2,children:[u&&E.jsx(cn,{size:"small",children:u}),i>0&&E.jsx(cn,{size:"small",color:"orange",children:`${Jo(i)} input`}),o>0&&E.jsx(cn,{size:"small",color:"blue",children:`${Jo(o)} cache read`}),a>0&&E.jsx(cn,{size:"small",color:"indigo",children:`${Jo(a)} cache write`})]})]})}K6.displayName="ContextStats";const Hye=wy("/")({component:()=>E.jsx("div",{style:{opacity:.5,fontSize:13},children:"Select a session"})}),Gye=`# Heading 1 — anchored
|
|
532
532
|
|
|
533
533
|
## Heading 2 — anchored
|
|
534
534
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
} catch (e) {}
|
|
20
20
|
})();
|
|
21
21
|
</script>
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-SB5vH7Ec.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/index-D_l3EPhC.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `sessions` ADD `rating` integer;
|
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "363ec121-452f-4b2f-9e95-a08527cacba7",
|
|
5
|
+
"prevId": "32bbd019-8c12-4e62-b339-8d3fc485a9b6",
|
|
6
|
+
"tables": {
|
|
7
|
+
"categories": {
|
|
8
|
+
"name": "categories",
|
|
9
|
+
"columns": {
|
|
10
|
+
"id": {
|
|
11
|
+
"name": "id",
|
|
12
|
+
"type": "text",
|
|
13
|
+
"primaryKey": true,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": false
|
|
16
|
+
},
|
|
17
|
+
"parent_id": {
|
|
18
|
+
"name": "parent_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": false,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"slug": {
|
|
25
|
+
"name": "slug",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true,
|
|
29
|
+
"autoincrement": false
|
|
30
|
+
},
|
|
31
|
+
"name": {
|
|
32
|
+
"name": "name",
|
|
33
|
+
"type": "text",
|
|
34
|
+
"primaryKey": false,
|
|
35
|
+
"notNull": true,
|
|
36
|
+
"autoincrement": false
|
|
37
|
+
},
|
|
38
|
+
"path": {
|
|
39
|
+
"name": "path",
|
|
40
|
+
"type": "text",
|
|
41
|
+
"primaryKey": false,
|
|
42
|
+
"notNull": true,
|
|
43
|
+
"autoincrement": false
|
|
44
|
+
},
|
|
45
|
+
"depth": {
|
|
46
|
+
"name": "depth",
|
|
47
|
+
"type": "integer",
|
|
48
|
+
"primaryKey": false,
|
|
49
|
+
"notNull": true,
|
|
50
|
+
"autoincrement": false,
|
|
51
|
+
"default": 0
|
|
52
|
+
},
|
|
53
|
+
"color": {
|
|
54
|
+
"name": "color",
|
|
55
|
+
"type": "text",
|
|
56
|
+
"primaryKey": false,
|
|
57
|
+
"notNull": false,
|
|
58
|
+
"autoincrement": false
|
|
59
|
+
},
|
|
60
|
+
"created_at": {
|
|
61
|
+
"name": "created_at",
|
|
62
|
+
"type": "text",
|
|
63
|
+
"primaryKey": false,
|
|
64
|
+
"notNull": true,
|
|
65
|
+
"autoincrement": false,
|
|
66
|
+
"default": "(datetime('now'))"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"indexes": {
|
|
70
|
+
"categories_parent_slug": {
|
|
71
|
+
"name": "categories_parent_slug",
|
|
72
|
+
"columns": [
|
|
73
|
+
"parent_id",
|
|
74
|
+
"slug"
|
|
75
|
+
],
|
|
76
|
+
"isUnique": true
|
|
77
|
+
},
|
|
78
|
+
"categories_path": {
|
|
79
|
+
"name": "categories_path",
|
|
80
|
+
"columns": [
|
|
81
|
+
"path"
|
|
82
|
+
],
|
|
83
|
+
"isUnique": false
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"foreignKeys": {
|
|
87
|
+
"categories_parent_id_categories_id_fk": {
|
|
88
|
+
"name": "categories_parent_id_categories_id_fk",
|
|
89
|
+
"tableFrom": "categories",
|
|
90
|
+
"tableTo": "categories",
|
|
91
|
+
"columnsFrom": [
|
|
92
|
+
"parent_id"
|
|
93
|
+
],
|
|
94
|
+
"columnsTo": [
|
|
95
|
+
"id"
|
|
96
|
+
],
|
|
97
|
+
"onDelete": "cascade",
|
|
98
|
+
"onUpdate": "no action"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"compositePrimaryKeys": {},
|
|
102
|
+
"uniqueConstraints": {},
|
|
103
|
+
"checkConstraints": {}
|
|
104
|
+
},
|
|
105
|
+
"conversations": {
|
|
106
|
+
"name": "conversations",
|
|
107
|
+
"columns": {
|
|
108
|
+
"id": {
|
|
109
|
+
"name": "id",
|
|
110
|
+
"type": "text",
|
|
111
|
+
"primaryKey": true,
|
|
112
|
+
"notNull": true,
|
|
113
|
+
"autoincrement": false
|
|
114
|
+
},
|
|
115
|
+
"session_id": {
|
|
116
|
+
"name": "session_id",
|
|
117
|
+
"type": "text",
|
|
118
|
+
"primaryKey": false,
|
|
119
|
+
"notNull": true,
|
|
120
|
+
"autoincrement": false
|
|
121
|
+
},
|
|
122
|
+
"started_at": {
|
|
123
|
+
"name": "started_at",
|
|
124
|
+
"type": "text",
|
|
125
|
+
"primaryKey": false,
|
|
126
|
+
"notNull": true,
|
|
127
|
+
"autoincrement": false,
|
|
128
|
+
"default": "(datetime('now'))"
|
|
129
|
+
},
|
|
130
|
+
"ended_at": {
|
|
131
|
+
"name": "ended_at",
|
|
132
|
+
"type": "text",
|
|
133
|
+
"primaryKey": false,
|
|
134
|
+
"notNull": false,
|
|
135
|
+
"autoincrement": false
|
|
136
|
+
},
|
|
137
|
+
"discarded": {
|
|
138
|
+
"name": "discarded",
|
|
139
|
+
"type": "integer",
|
|
140
|
+
"primaryKey": false,
|
|
141
|
+
"notNull": true,
|
|
142
|
+
"autoincrement": false,
|
|
143
|
+
"default": false
|
|
144
|
+
},
|
|
145
|
+
"last_question": {
|
|
146
|
+
"name": "last_question",
|
|
147
|
+
"type": "text",
|
|
148
|
+
"primaryKey": false,
|
|
149
|
+
"notNull": false,
|
|
150
|
+
"autoincrement": false
|
|
151
|
+
},
|
|
152
|
+
"event_count": {
|
|
153
|
+
"name": "event_count",
|
|
154
|
+
"type": "integer",
|
|
155
|
+
"primaryKey": false,
|
|
156
|
+
"notNull": true,
|
|
157
|
+
"autoincrement": false,
|
|
158
|
+
"default": 0
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"indexes": {
|
|
162
|
+
"conv_session": {
|
|
163
|
+
"name": "conv_session",
|
|
164
|
+
"columns": [
|
|
165
|
+
"session_id"
|
|
166
|
+
],
|
|
167
|
+
"isUnique": false
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"foreignKeys": {
|
|
171
|
+
"conversations_session_id_sessions_id_fk": {
|
|
172
|
+
"name": "conversations_session_id_sessions_id_fk",
|
|
173
|
+
"tableFrom": "conversations",
|
|
174
|
+
"tableTo": "sessions",
|
|
175
|
+
"columnsFrom": [
|
|
176
|
+
"session_id"
|
|
177
|
+
],
|
|
178
|
+
"columnsTo": [
|
|
179
|
+
"id"
|
|
180
|
+
],
|
|
181
|
+
"onDelete": "cascade",
|
|
182
|
+
"onUpdate": "no action"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"compositePrimaryKeys": {},
|
|
186
|
+
"uniqueConstraints": {},
|
|
187
|
+
"checkConstraints": {}
|
|
188
|
+
},
|
|
189
|
+
"events": {
|
|
190
|
+
"name": "events",
|
|
191
|
+
"columns": {
|
|
192
|
+
"id": {
|
|
193
|
+
"name": "id",
|
|
194
|
+
"type": "integer",
|
|
195
|
+
"primaryKey": true,
|
|
196
|
+
"notNull": true,
|
|
197
|
+
"autoincrement": true
|
|
198
|
+
},
|
|
199
|
+
"session_id": {
|
|
200
|
+
"name": "session_id",
|
|
201
|
+
"type": "text",
|
|
202
|
+
"primaryKey": false,
|
|
203
|
+
"notNull": true,
|
|
204
|
+
"autoincrement": false
|
|
205
|
+
},
|
|
206
|
+
"conversation_id": {
|
|
207
|
+
"name": "conversation_id",
|
|
208
|
+
"type": "text",
|
|
209
|
+
"primaryKey": false,
|
|
210
|
+
"notNull": false,
|
|
211
|
+
"autoincrement": false
|
|
212
|
+
},
|
|
213
|
+
"event": {
|
|
214
|
+
"name": "event",
|
|
215
|
+
"type": "text",
|
|
216
|
+
"primaryKey": false,
|
|
217
|
+
"notNull": true,
|
|
218
|
+
"autoincrement": false
|
|
219
|
+
},
|
|
220
|
+
"summary": {
|
|
221
|
+
"name": "summary",
|
|
222
|
+
"type": "text",
|
|
223
|
+
"primaryKey": false,
|
|
224
|
+
"notNull": false,
|
|
225
|
+
"autoincrement": false
|
|
226
|
+
},
|
|
227
|
+
"meta": {
|
|
228
|
+
"name": "meta",
|
|
229
|
+
"type": "text",
|
|
230
|
+
"primaryKey": false,
|
|
231
|
+
"notNull": false,
|
|
232
|
+
"autoincrement": false
|
|
233
|
+
},
|
|
234
|
+
"created_at": {
|
|
235
|
+
"name": "created_at",
|
|
236
|
+
"type": "text",
|
|
237
|
+
"primaryKey": false,
|
|
238
|
+
"notNull": true,
|
|
239
|
+
"autoincrement": false,
|
|
240
|
+
"default": "(datetime('now'))"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"indexes": {
|
|
244
|
+
"ev_session": {
|
|
245
|
+
"name": "ev_session",
|
|
246
|
+
"columns": [
|
|
247
|
+
"session_id"
|
|
248
|
+
],
|
|
249
|
+
"isUnique": false
|
|
250
|
+
},
|
|
251
|
+
"ev_session_event": {
|
|
252
|
+
"name": "ev_session_event",
|
|
253
|
+
"columns": [
|
|
254
|
+
"session_id",
|
|
255
|
+
"event"
|
|
256
|
+
],
|
|
257
|
+
"isUnique": false
|
|
258
|
+
},
|
|
259
|
+
"ev_event_created": {
|
|
260
|
+
"name": "ev_event_created",
|
|
261
|
+
"columns": [
|
|
262
|
+
"event",
|
|
263
|
+
"created_at"
|
|
264
|
+
],
|
|
265
|
+
"isUnique": false
|
|
266
|
+
},
|
|
267
|
+
"ev_conversation": {
|
|
268
|
+
"name": "ev_conversation",
|
|
269
|
+
"columns": [
|
|
270
|
+
"conversation_id"
|
|
271
|
+
],
|
|
272
|
+
"isUnique": false
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"foreignKeys": {
|
|
276
|
+
"events_session_id_sessions_id_fk": {
|
|
277
|
+
"name": "events_session_id_sessions_id_fk",
|
|
278
|
+
"tableFrom": "events",
|
|
279
|
+
"tableTo": "sessions",
|
|
280
|
+
"columnsFrom": [
|
|
281
|
+
"session_id"
|
|
282
|
+
],
|
|
283
|
+
"columnsTo": [
|
|
284
|
+
"id"
|
|
285
|
+
],
|
|
286
|
+
"onDelete": "cascade",
|
|
287
|
+
"onUpdate": "no action"
|
|
288
|
+
},
|
|
289
|
+
"events_conversation_id_conversations_id_fk": {
|
|
290
|
+
"name": "events_conversation_id_conversations_id_fk",
|
|
291
|
+
"tableFrom": "events",
|
|
292
|
+
"tableTo": "conversations",
|
|
293
|
+
"columnsFrom": [
|
|
294
|
+
"conversation_id"
|
|
295
|
+
],
|
|
296
|
+
"columnsTo": [
|
|
297
|
+
"id"
|
|
298
|
+
],
|
|
299
|
+
"onDelete": "no action",
|
|
300
|
+
"onUpdate": "no action"
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"compositePrimaryKeys": {},
|
|
304
|
+
"uniqueConstraints": {},
|
|
305
|
+
"checkConstraints": {}
|
|
306
|
+
},
|
|
307
|
+
"labels": {
|
|
308
|
+
"name": "labels",
|
|
309
|
+
"columns": {
|
|
310
|
+
"id": {
|
|
311
|
+
"name": "id",
|
|
312
|
+
"type": "text",
|
|
313
|
+
"primaryKey": true,
|
|
314
|
+
"notNull": true,
|
|
315
|
+
"autoincrement": false
|
|
316
|
+
},
|
|
317
|
+
"name": {
|
|
318
|
+
"name": "name",
|
|
319
|
+
"type": "text",
|
|
320
|
+
"primaryKey": false,
|
|
321
|
+
"notNull": true,
|
|
322
|
+
"autoincrement": false
|
|
323
|
+
},
|
|
324
|
+
"color": {
|
|
325
|
+
"name": "color",
|
|
326
|
+
"type": "text",
|
|
327
|
+
"primaryKey": false,
|
|
328
|
+
"notNull": false,
|
|
329
|
+
"autoincrement": false
|
|
330
|
+
},
|
|
331
|
+
"created_at": {
|
|
332
|
+
"name": "created_at",
|
|
333
|
+
"type": "text",
|
|
334
|
+
"primaryKey": false,
|
|
335
|
+
"notNull": true,
|
|
336
|
+
"autoincrement": false,
|
|
337
|
+
"default": "(datetime('now'))"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"indexes": {
|
|
341
|
+
"labels_name_unique": {
|
|
342
|
+
"name": "labels_name_unique",
|
|
343
|
+
"columns": [
|
|
344
|
+
"name"
|
|
345
|
+
],
|
|
346
|
+
"isUnique": true
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"foreignKeys": {},
|
|
350
|
+
"compositePrimaryKeys": {},
|
|
351
|
+
"uniqueConstraints": {},
|
|
352
|
+
"checkConstraints": {}
|
|
353
|
+
},
|
|
354
|
+
"session_labels": {
|
|
355
|
+
"name": "session_labels",
|
|
356
|
+
"columns": {
|
|
357
|
+
"session_id": {
|
|
358
|
+
"name": "session_id",
|
|
359
|
+
"type": "text",
|
|
360
|
+
"primaryKey": false,
|
|
361
|
+
"notNull": true,
|
|
362
|
+
"autoincrement": false
|
|
363
|
+
},
|
|
364
|
+
"label_id": {
|
|
365
|
+
"name": "label_id",
|
|
366
|
+
"type": "text",
|
|
367
|
+
"primaryKey": false,
|
|
368
|
+
"notNull": true,
|
|
369
|
+
"autoincrement": false
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
"indexes": {
|
|
373
|
+
"sl_pk": {
|
|
374
|
+
"name": "sl_pk",
|
|
375
|
+
"columns": [
|
|
376
|
+
"session_id",
|
|
377
|
+
"label_id"
|
|
378
|
+
],
|
|
379
|
+
"isUnique": true
|
|
380
|
+
},
|
|
381
|
+
"sl_label": {
|
|
382
|
+
"name": "sl_label",
|
|
383
|
+
"columns": [
|
|
384
|
+
"label_id"
|
|
385
|
+
],
|
|
386
|
+
"isUnique": false
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
"foreignKeys": {
|
|
390
|
+
"session_labels_session_id_sessions_id_fk": {
|
|
391
|
+
"name": "session_labels_session_id_sessions_id_fk",
|
|
392
|
+
"tableFrom": "session_labels",
|
|
393
|
+
"tableTo": "sessions",
|
|
394
|
+
"columnsFrom": [
|
|
395
|
+
"session_id"
|
|
396
|
+
],
|
|
397
|
+
"columnsTo": [
|
|
398
|
+
"id"
|
|
399
|
+
],
|
|
400
|
+
"onDelete": "cascade",
|
|
401
|
+
"onUpdate": "no action"
|
|
402
|
+
},
|
|
403
|
+
"session_labels_label_id_labels_id_fk": {
|
|
404
|
+
"name": "session_labels_label_id_labels_id_fk",
|
|
405
|
+
"tableFrom": "session_labels",
|
|
406
|
+
"tableTo": "labels",
|
|
407
|
+
"columnsFrom": [
|
|
408
|
+
"label_id"
|
|
409
|
+
],
|
|
410
|
+
"columnsTo": [
|
|
411
|
+
"id"
|
|
412
|
+
],
|
|
413
|
+
"onDelete": "cascade",
|
|
414
|
+
"onUpdate": "no action"
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
"compositePrimaryKeys": {},
|
|
418
|
+
"uniqueConstraints": {},
|
|
419
|
+
"checkConstraints": {}
|
|
420
|
+
},
|
|
421
|
+
"session_stats": {
|
|
422
|
+
"name": "session_stats",
|
|
423
|
+
"columns": {
|
|
424
|
+
"session_id": {
|
|
425
|
+
"name": "session_id",
|
|
426
|
+
"type": "text",
|
|
427
|
+
"primaryKey": true,
|
|
428
|
+
"notNull": true,
|
|
429
|
+
"autoincrement": false
|
|
430
|
+
},
|
|
431
|
+
"event_count": {
|
|
432
|
+
"name": "event_count",
|
|
433
|
+
"type": "integer",
|
|
434
|
+
"primaryKey": false,
|
|
435
|
+
"notNull": true,
|
|
436
|
+
"autoincrement": false,
|
|
437
|
+
"default": 0
|
|
438
|
+
},
|
|
439
|
+
"conversation_count": {
|
|
440
|
+
"name": "conversation_count",
|
|
441
|
+
"type": "integer",
|
|
442
|
+
"primaryKey": false,
|
|
443
|
+
"notNull": true,
|
|
444
|
+
"autoincrement": false,
|
|
445
|
+
"default": 0
|
|
446
|
+
},
|
|
447
|
+
"interaction_count": {
|
|
448
|
+
"name": "interaction_count",
|
|
449
|
+
"type": "integer",
|
|
450
|
+
"primaryKey": false,
|
|
451
|
+
"notNull": true,
|
|
452
|
+
"autoincrement": false,
|
|
453
|
+
"default": 0
|
|
454
|
+
},
|
|
455
|
+
"pr_count": {
|
|
456
|
+
"name": "pr_count",
|
|
457
|
+
"type": "integer",
|
|
458
|
+
"primaryKey": false,
|
|
459
|
+
"notNull": true,
|
|
460
|
+
"autoincrement": false,
|
|
461
|
+
"default": 0
|
|
462
|
+
},
|
|
463
|
+
"claude_work_s": {
|
|
464
|
+
"name": "claude_work_s",
|
|
465
|
+
"type": "integer",
|
|
466
|
+
"primaryKey": false,
|
|
467
|
+
"notNull": true,
|
|
468
|
+
"autoincrement": false,
|
|
469
|
+
"default": 0
|
|
470
|
+
},
|
|
471
|
+
"user_wait_s": {
|
|
472
|
+
"name": "user_wait_s",
|
|
473
|
+
"type": "integer",
|
|
474
|
+
"primaryKey": false,
|
|
475
|
+
"notNull": true,
|
|
476
|
+
"autoincrement": false,
|
|
477
|
+
"default": 0
|
|
478
|
+
},
|
|
479
|
+
"active_pct": {
|
|
480
|
+
"name": "active_pct",
|
|
481
|
+
"type": "integer",
|
|
482
|
+
"primaryKey": false,
|
|
483
|
+
"notNull": true,
|
|
484
|
+
"autoincrement": false,
|
|
485
|
+
"default": 0
|
|
486
|
+
},
|
|
487
|
+
"duration_s": {
|
|
488
|
+
"name": "duration_s",
|
|
489
|
+
"type": "integer",
|
|
490
|
+
"primaryKey": false,
|
|
491
|
+
"notNull": true,
|
|
492
|
+
"autoincrement": false,
|
|
493
|
+
"default": 0
|
|
494
|
+
},
|
|
495
|
+
"lines_added": {
|
|
496
|
+
"name": "lines_added",
|
|
497
|
+
"type": "integer",
|
|
498
|
+
"primaryKey": false,
|
|
499
|
+
"notNull": true,
|
|
500
|
+
"autoincrement": false,
|
|
501
|
+
"default": 0
|
|
502
|
+
},
|
|
503
|
+
"lines_removed": {
|
|
504
|
+
"name": "lines_removed",
|
|
505
|
+
"type": "integer",
|
|
506
|
+
"primaryKey": false,
|
|
507
|
+
"notNull": true,
|
|
508
|
+
"autoincrement": false,
|
|
509
|
+
"default": 0
|
|
510
|
+
},
|
|
511
|
+
"files_touched": {
|
|
512
|
+
"name": "files_touched",
|
|
513
|
+
"type": "integer",
|
|
514
|
+
"primaryKey": false,
|
|
515
|
+
"notNull": true,
|
|
516
|
+
"autoincrement": false,
|
|
517
|
+
"default": 0
|
|
518
|
+
},
|
|
519
|
+
"updated_at": {
|
|
520
|
+
"name": "updated_at",
|
|
521
|
+
"type": "text",
|
|
522
|
+
"primaryKey": false,
|
|
523
|
+
"notNull": true,
|
|
524
|
+
"autoincrement": false,
|
|
525
|
+
"default": "(datetime('now'))"
|
|
526
|
+
}
|
|
527
|
+
},
|
|
528
|
+
"indexes": {},
|
|
529
|
+
"foreignKeys": {
|
|
530
|
+
"session_stats_session_id_sessions_id_fk": {
|
|
531
|
+
"name": "session_stats_session_id_sessions_id_fk",
|
|
532
|
+
"tableFrom": "session_stats",
|
|
533
|
+
"tableTo": "sessions",
|
|
534
|
+
"columnsFrom": [
|
|
535
|
+
"session_id"
|
|
536
|
+
],
|
|
537
|
+
"columnsTo": [
|
|
538
|
+
"id"
|
|
539
|
+
],
|
|
540
|
+
"onDelete": "cascade",
|
|
541
|
+
"onUpdate": "no action"
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
"compositePrimaryKeys": {},
|
|
545
|
+
"uniqueConstraints": {},
|
|
546
|
+
"checkConstraints": {}
|
|
547
|
+
},
|
|
548
|
+
"sessions": {
|
|
549
|
+
"name": "sessions",
|
|
550
|
+
"columns": {
|
|
551
|
+
"id": {
|
|
552
|
+
"name": "id",
|
|
553
|
+
"type": "text",
|
|
554
|
+
"primaryKey": true,
|
|
555
|
+
"notNull": true,
|
|
556
|
+
"autoincrement": false
|
|
557
|
+
},
|
|
558
|
+
"category_id": {
|
|
559
|
+
"name": "category_id",
|
|
560
|
+
"type": "text",
|
|
561
|
+
"primaryKey": false,
|
|
562
|
+
"notNull": true,
|
|
563
|
+
"autoincrement": false
|
|
564
|
+
},
|
|
565
|
+
"slug": {
|
|
566
|
+
"name": "slug",
|
|
567
|
+
"type": "text",
|
|
568
|
+
"primaryKey": false,
|
|
569
|
+
"notNull": true,
|
|
570
|
+
"autoincrement": false
|
|
571
|
+
},
|
|
572
|
+
"name": {
|
|
573
|
+
"name": "name",
|
|
574
|
+
"type": "text",
|
|
575
|
+
"primaryKey": false,
|
|
576
|
+
"notNull": true,
|
|
577
|
+
"autoincrement": false
|
|
578
|
+
},
|
|
579
|
+
"status": {
|
|
580
|
+
"name": "status",
|
|
581
|
+
"type": "text",
|
|
582
|
+
"primaryKey": false,
|
|
583
|
+
"notNull": true,
|
|
584
|
+
"autoincrement": false,
|
|
585
|
+
"default": "'paused'"
|
|
586
|
+
},
|
|
587
|
+
"summary": {
|
|
588
|
+
"name": "summary",
|
|
589
|
+
"type": "text",
|
|
590
|
+
"primaryKey": false,
|
|
591
|
+
"notNull": false,
|
|
592
|
+
"autoincrement": false
|
|
593
|
+
},
|
|
594
|
+
"rating": {
|
|
595
|
+
"name": "rating",
|
|
596
|
+
"type": "integer",
|
|
597
|
+
"primaryKey": false,
|
|
598
|
+
"notNull": false,
|
|
599
|
+
"autoincrement": false
|
|
600
|
+
},
|
|
601
|
+
"pid": {
|
|
602
|
+
"name": "pid",
|
|
603
|
+
"type": "integer",
|
|
604
|
+
"primaryKey": false,
|
|
605
|
+
"notNull": false,
|
|
606
|
+
"autoincrement": false
|
|
607
|
+
},
|
|
608
|
+
"started_at": {
|
|
609
|
+
"name": "started_at",
|
|
610
|
+
"type": "text",
|
|
611
|
+
"primaryKey": false,
|
|
612
|
+
"notNull": true,
|
|
613
|
+
"autoincrement": false,
|
|
614
|
+
"default": "(datetime('now'))"
|
|
615
|
+
},
|
|
616
|
+
"ended_at": {
|
|
617
|
+
"name": "ended_at",
|
|
618
|
+
"type": "text",
|
|
619
|
+
"primaryKey": false,
|
|
620
|
+
"notNull": false,
|
|
621
|
+
"autoincrement": false
|
|
622
|
+
},
|
|
623
|
+
"created_at": {
|
|
624
|
+
"name": "created_at",
|
|
625
|
+
"type": "text",
|
|
626
|
+
"primaryKey": false,
|
|
627
|
+
"notNull": true,
|
|
628
|
+
"autoincrement": false,
|
|
629
|
+
"default": "(datetime('now'))"
|
|
630
|
+
},
|
|
631
|
+
"updated_at": {
|
|
632
|
+
"name": "updated_at",
|
|
633
|
+
"type": "text",
|
|
634
|
+
"primaryKey": false,
|
|
635
|
+
"notNull": true,
|
|
636
|
+
"autoincrement": false,
|
|
637
|
+
"default": "(datetime('now'))"
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
"indexes": {
|
|
641
|
+
"sessions_category_slug": {
|
|
642
|
+
"name": "sessions_category_slug",
|
|
643
|
+
"columns": [
|
|
644
|
+
"category_id",
|
|
645
|
+
"slug"
|
|
646
|
+
],
|
|
647
|
+
"isUnique": true
|
|
648
|
+
},
|
|
649
|
+
"sessions_status": {
|
|
650
|
+
"name": "sessions_status",
|
|
651
|
+
"columns": [
|
|
652
|
+
"status"
|
|
653
|
+
],
|
|
654
|
+
"isUnique": false
|
|
655
|
+
},
|
|
656
|
+
"sessions_started": {
|
|
657
|
+
"name": "sessions_started",
|
|
658
|
+
"columns": [
|
|
659
|
+
"started_at"
|
|
660
|
+
],
|
|
661
|
+
"isUnique": false
|
|
662
|
+
}
|
|
663
|
+
},
|
|
664
|
+
"foreignKeys": {
|
|
665
|
+
"sessions_category_id_categories_id_fk": {
|
|
666
|
+
"name": "sessions_category_id_categories_id_fk",
|
|
667
|
+
"tableFrom": "sessions",
|
|
668
|
+
"tableTo": "categories",
|
|
669
|
+
"columnsFrom": [
|
|
670
|
+
"category_id"
|
|
671
|
+
],
|
|
672
|
+
"columnsTo": [
|
|
673
|
+
"id"
|
|
674
|
+
],
|
|
675
|
+
"onDelete": "cascade",
|
|
676
|
+
"onUpdate": "no action"
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
"compositePrimaryKeys": {},
|
|
680
|
+
"uniqueConstraints": {},
|
|
681
|
+
"checkConstraints": {}
|
|
682
|
+
},
|
|
683
|
+
"worktree_associations": {
|
|
684
|
+
"name": "worktree_associations",
|
|
685
|
+
"columns": {
|
|
686
|
+
"id": {
|
|
687
|
+
"name": "id",
|
|
688
|
+
"type": "text",
|
|
689
|
+
"primaryKey": true,
|
|
690
|
+
"notNull": true,
|
|
691
|
+
"autoincrement": false
|
|
692
|
+
},
|
|
693
|
+
"session_id": {
|
|
694
|
+
"name": "session_id",
|
|
695
|
+
"type": "text",
|
|
696
|
+
"primaryKey": false,
|
|
697
|
+
"notNull": true,
|
|
698
|
+
"autoincrement": false
|
|
699
|
+
},
|
|
700
|
+
"branch": {
|
|
701
|
+
"name": "branch",
|
|
702
|
+
"type": "text",
|
|
703
|
+
"primaryKey": false,
|
|
704
|
+
"notNull": true,
|
|
705
|
+
"autoincrement": false
|
|
706
|
+
},
|
|
707
|
+
"worktree_path": {
|
|
708
|
+
"name": "worktree_path",
|
|
709
|
+
"type": "text",
|
|
710
|
+
"primaryKey": false,
|
|
711
|
+
"notNull": false,
|
|
712
|
+
"autoincrement": false
|
|
713
|
+
},
|
|
714
|
+
"active": {
|
|
715
|
+
"name": "active",
|
|
716
|
+
"type": "integer",
|
|
717
|
+
"primaryKey": false,
|
|
718
|
+
"notNull": true,
|
|
719
|
+
"autoincrement": false,
|
|
720
|
+
"default": true
|
|
721
|
+
},
|
|
722
|
+
"entered_at": {
|
|
723
|
+
"name": "entered_at",
|
|
724
|
+
"type": "text",
|
|
725
|
+
"primaryKey": false,
|
|
726
|
+
"notNull": true,
|
|
727
|
+
"autoincrement": false,
|
|
728
|
+
"default": "(datetime('now'))"
|
|
729
|
+
},
|
|
730
|
+
"exited_at": {
|
|
731
|
+
"name": "exited_at",
|
|
732
|
+
"type": "text",
|
|
733
|
+
"primaryKey": false,
|
|
734
|
+
"notNull": false,
|
|
735
|
+
"autoincrement": false
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
"indexes": {
|
|
739
|
+
"wt_session": {
|
|
740
|
+
"name": "wt_session",
|
|
741
|
+
"columns": [
|
|
742
|
+
"session_id"
|
|
743
|
+
],
|
|
744
|
+
"isUnique": false
|
|
745
|
+
},
|
|
746
|
+
"wt_active": {
|
|
747
|
+
"name": "wt_active",
|
|
748
|
+
"columns": [
|
|
749
|
+
"active"
|
|
750
|
+
],
|
|
751
|
+
"isUnique": false
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
"foreignKeys": {
|
|
755
|
+
"worktree_associations_session_id_sessions_id_fk": {
|
|
756
|
+
"name": "worktree_associations_session_id_sessions_id_fk",
|
|
757
|
+
"tableFrom": "worktree_associations",
|
|
758
|
+
"tableTo": "sessions",
|
|
759
|
+
"columnsFrom": [
|
|
760
|
+
"session_id"
|
|
761
|
+
],
|
|
762
|
+
"columnsTo": [
|
|
763
|
+
"id"
|
|
764
|
+
],
|
|
765
|
+
"onDelete": "cascade",
|
|
766
|
+
"onUpdate": "no action"
|
|
767
|
+
}
|
|
768
|
+
},
|
|
769
|
+
"compositePrimaryKeys": {},
|
|
770
|
+
"uniqueConstraints": {},
|
|
771
|
+
"checkConstraints": {}
|
|
772
|
+
}
|
|
773
|
+
},
|
|
774
|
+
"views": {},
|
|
775
|
+
"enums": {},
|
|
776
|
+
"_meta": {
|
|
777
|
+
"schemas": {},
|
|
778
|
+
"tables": {},
|
|
779
|
+
"columns": {}
|
|
780
|
+
},
|
|
781
|
+
"internal": {
|
|
782
|
+
"indexes": {}
|
|
783
|
+
}
|
|
784
|
+
}
|
package/dist/run-screen.js
CHANGED
|
@@ -760,6 +760,7 @@ var sessions = sqliteTable("sessions", {
|
|
|
760
760
|
enum: ["active", "waiting", "paused", "archived"]
|
|
761
761
|
}).notNull().default("paused"),
|
|
762
762
|
summary: text("summary"),
|
|
763
|
+
rating: integer("rating"),
|
|
763
764
|
pid: integer("pid"),
|
|
764
765
|
startedAt: text("started_at").notNull().default(sql`(datetime('now'))`),
|
|
765
766
|
endedAt: text("ended_at"),
|
|
@@ -899,6 +900,9 @@ function getAllSessions(opts) {
|
|
|
899
900
|
function updateSessionStatus(id, status) {
|
|
900
901
|
return getDb().update(sessions).set({ status, updatedAt: sql2`(datetime('now'))` }).where(eq(sessions.id, id)).returning().get();
|
|
901
902
|
}
|
|
903
|
+
function setSessionRating(id, rating) {
|
|
904
|
+
return getDb().update(sessions).set({ rating, updatedAt: sql2`(datetime('now'))` }).where(eq(sessions.id, id)).returning().get();
|
|
905
|
+
}
|
|
902
906
|
|
|
903
907
|
// src/lib/session-archive.ts
|
|
904
908
|
var ACTIVE_STATUSES = ["active", "waiting"];
|
|
@@ -960,6 +964,7 @@ function formatAgo(isoOrDate) {
|
|
|
960
964
|
}
|
|
961
965
|
|
|
962
966
|
// src/lib/parse-session-name.ts
|
|
967
|
+
var SEGMENT_PATTERN = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
963
968
|
function parseSessionName(input) {
|
|
964
969
|
const trimmed = input.trim().replace(/^\/+|\/+$/g, "");
|
|
965
970
|
if (!trimmed) {
|
|
@@ -970,12 +975,12 @@ function parseSessionName(input) {
|
|
|
970
975
|
throw new Error(`Session name must include at least one category: "category/session" (got "${trimmed}")`);
|
|
971
976
|
}
|
|
972
977
|
for (const segment of segments) {
|
|
973
|
-
if (
|
|
978
|
+
if (!SEGMENT_PATTERN.test(segment)) {
|
|
974
979
|
throw new Error(`Invalid segment "${segment}": must start with alphanumeric and contain only letters, digits, dots, underscores, or dashes`);
|
|
975
980
|
}
|
|
976
981
|
}
|
|
977
|
-
const
|
|
978
|
-
const
|
|
982
|
+
const categoryPath = segments[0];
|
|
983
|
+
const slug = segments.slice(1).join("/");
|
|
979
984
|
return { categoryPath, slug };
|
|
980
985
|
}
|
|
981
986
|
|
|
@@ -1333,10 +1338,19 @@ function Exit({ sessionId, onAction }) {
|
|
|
1333
1338
|
const [cursor, setCursor] = useState4(0);
|
|
1334
1339
|
const session = getSession(sessionId);
|
|
1335
1340
|
const conversations2 = session ? getConversationsBySession(session.id) : [];
|
|
1341
|
+
const [rating, setRating] = useState4(session?.rating ?? null);
|
|
1342
|
+
const persistRating = (next) => {
|
|
1343
|
+
setRating(next);
|
|
1344
|
+
setSessionRating(sessionId, next);
|
|
1345
|
+
};
|
|
1336
1346
|
useInput3((e) => {
|
|
1337
1347
|
if (e.key === "c" && e.ctrl)
|
|
1338
1348
|
exit();
|
|
1339
|
-
if (e.key
|
|
1349
|
+
if (e.key >= "1" && e.key <= "5") {
|
|
1350
|
+
persistRating(Number(e.key));
|
|
1351
|
+
} else if (e.key === "0" || e.key === "backspace") {
|
|
1352
|
+
persistRating(null);
|
|
1353
|
+
} else if (e.key === "up" || e.key === "k") {
|
|
1340
1354
|
setCursor((c) => Math.max(0, c - 1));
|
|
1341
1355
|
} else if (e.key === "down" || e.key === "j") {
|
|
1342
1356
|
setCursor((c) => Math.min(OPTIONS.length - 1, c + 1));
|
|
@@ -1400,6 +1414,29 @@ function Exit({ sessionId, onAction }) {
|
|
|
1400
1414
|
}, undefined, true, undefined, this)
|
|
1401
1415
|
]
|
|
1402
1416
|
}, undefined, true, undefined, this),
|
|
1417
|
+
/* @__PURE__ */ jsxDEV7(Box6, {
|
|
1418
|
+
flexDirection: "column",
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
1421
|
+
dim: true,
|
|
1422
|
+
children: "How effective was this session?"
|
|
1423
|
+
}, undefined, false, undefined, this),
|
|
1424
|
+
/* @__PURE__ */ jsxDEV7(Box6, {
|
|
1425
|
+
flexDirection: "row",
|
|
1426
|
+
gap: 1,
|
|
1427
|
+
children: [
|
|
1428
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
1429
|
+
color: "#FFD580",
|
|
1430
|
+
children: [1, 2, 3, 4, 5].map((n) => rating !== null && n <= rating ? "\u2605" : "\u2606").join(" ")
|
|
1431
|
+
}, undefined, false, undefined, this),
|
|
1432
|
+
/* @__PURE__ */ jsxDEV7(Text7, {
|
|
1433
|
+
dim: true,
|
|
1434
|
+
children: rating !== null ? `${rating} star${rating === 1 ? "" : "s"}` : "unrated"
|
|
1435
|
+
}, undefined, false, undefined, this)
|
|
1436
|
+
]
|
|
1437
|
+
}, undefined, true, undefined, this)
|
|
1438
|
+
]
|
|
1439
|
+
}, undefined, true, undefined, this),
|
|
1403
1440
|
/* @__PURE__ */ jsxDEV7(Box6, {
|
|
1404
1441
|
flexDirection: "column",
|
|
1405
1442
|
children: OPTIONS.map((opt, i) => /* @__PURE__ */ jsxDEV7(Box6, {
|
|
@@ -1423,7 +1460,7 @@ function Exit({ sessionId, onAction }) {
|
|
|
1423
1460
|
/* @__PURE__ */ jsxDEV7(Box6, {
|
|
1424
1461
|
children: /* @__PURE__ */ jsxDEV7(Text7, {
|
|
1425
1462
|
dim: true,
|
|
1426
|
-
children: "\u2191\u2193 navigate \xB7 enter select \xB7 q save & quit"
|
|
1463
|
+
children: "1-5 rate \xB7 0/backspace clear \xB7 \u2191\u2193 navigate \xB7 enter select \xB7 q save & quit"
|
|
1427
1464
|
}, undefined, false, undefined, this)
|
|
1428
1465
|
}, undefined, false, undefined, this)
|
|
1429
1466
|
]
|