@wukazis/euphony 0.1.45 → 0.1.47

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/index.html CHANGED
@@ -13,7 +13,7 @@
13
13
  <title>Euphony: Visualize Chat Data in Your Browser</title>
14
14
 
15
15
  <link rel="stylesheet" href="/global.css" />
16
- <script type="module" crossorigin src="/assets/main-CmldcHcT.js"></script>
16
+ <script type="module" crossorigin src="/assets/main-BMLAkPsC.js"></script>
17
17
  </head>
18
18
 
19
19
  <body>
@@ -1,5 +1,5 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
- import { CodexSessionSummary } from '../../types/common-types';
2
+ import { CodexSessionSummary, CodexUsageDay } from '../../types/common-types';
3
3
  import { Conversation } from '../../types/harmony-types';
4
4
  import { APIManager, BrowserAPIManager } from '../../utils/api-manager';
5
5
  import { EuphonyCodex } from '../codex/codex';
@@ -21,10 +21,13 @@ declare enum DataType {
21
21
  CONVERSATION = "conversation",
22
22
  CODEX = "codex",
23
23
  CODEX_SESSION_INDEX = "codex-session-index",
24
+ CODEX_USAGE = "codex-usage",
24
25
  JSON = "json"
25
26
  }
26
- type MenuItems = 'Load without cache' | 'Load Codex sessions' | 'Load from clipboard' | 'Load local file' | 'Editor mode' | 'Leave editor mode' | 'Filter data' | 'Preferences' | 'Code';
27
+ type MenuItems = 'Load without cache' | 'Load Codex sessions' | 'Load Claude sessions' | 'Usage' | 'Load from clipboard' | 'Load local file' | 'Editor mode' | 'Leave editor mode' | 'Filter data' | 'Preferences' | 'Code';
28
+ type CodexUsageRange = '7d' | '30d' | '1y';
27
29
  type ConversationViewerElement = EuphonyConversation | EuphonyCodex;
30
+ export declare const isCodexUsageRange: (value: string) => value is CodexUsageRange;
28
31
  /**
29
32
  * App element.
30
33
  *
@@ -35,12 +38,17 @@ export declare class EuphonyApp extends LitElement {
35
38
  JSONData: Record<string, unknown>[];
36
39
  codexSessionData: unknown[][];
37
40
  codexSessionSummaries: CodexSessionSummary[];
41
+ codexUsageDays: CodexUsageDay[];
42
+ codexUsageChartDays: CodexUsageDay[];
43
+ codexUsageRange: CodexUsageRange;
38
44
  dataType: DataType;
39
45
  isLoadingData: boolean;
40
46
  curPage: number;
41
47
  globalIsShowingMetadata: boolean;
42
48
  globalShouldRenderMarkdown: boolean;
43
49
  jmespathQuery: string;
50
+ codexSearchQuery: string;
51
+ codexSearchInputValue: string;
44
52
  focusModeAuthor: string[];
45
53
  focusModeRecipient: string[];
46
54
  focusModeContentType: string[];
@@ -114,6 +122,8 @@ export declare class EuphonyApp extends LitElement {
114
122
  selectAllButtonClicked(): void;
115
123
  updatePageNumber(newPageNumber: number, scrollToTop: boolean): Promise<void>;
116
124
  loadCodexSessionsClicked(): Promise<void>;
125
+ loadClaudeSessionsClicked(): Promise<void>;
126
+ loadCodexUsageClicked(): Promise<void>;
117
127
  openCodexSessionSummary(summary: CodexSessionSummary): Promise<void>;
118
128
  pageClicked(e: CustomEvent<number>): void;
119
129
  itemsPerPageChanged(e: CustomEvent<number>): void;
@@ -133,6 +143,10 @@ export declare class EuphonyApp extends LitElement {
133
143
  preferenceWindowTranslateAllClicked(): void;
134
144
  preferenceWindowFocusModeSettingsChanged(e: CustomEvent<FocusModeSettings>): void;
135
145
  searchWindowQuerySubmitted(e: CustomEvent<string>): Promise<void>;
146
+ codexSessionSearchInputChanged(e: Event): void;
147
+ codexSessionSearchSubmitted(e: Event): Promise<void>;
148
+ clearCodexSessionSearch(): Promise<void>;
149
+ codexUsageRangeChanged(e: Event): Promise<void>;
136
150
  /**
137
151
  * Show the token window when user clicks on the harmony render button
138
152
  * @param e CustomEvent<string> - The custom event containing the conversation string
@@ -165,21 +179,27 @@ export declare class EuphonyApp extends LitElement {
165
179
  loadDataFromFile: (sourceFile: File) => Promise<void>;
166
180
  localDataWorkerMessageHandler(e: MessageEvent<LocalDataWorkerMessage>): void;
167
181
  localFileInputChanged(e: Event): void;
168
- loadData: ({ blobURL, offset, limit, showSuccessToast, noCache, jmespathQuery }: {
182
+ loadData: ({ blobURL, offset, limit, showSuccessToast, noCache, jmespathQuery, codexSearchQuery, codexUsageRange }: {
169
183
  blobURL: string;
170
184
  offset: number;
171
185
  limit: number;
172
186
  showSuccessToast?: boolean;
173
187
  noCache?: boolean;
174
188
  jmespathQuery?: string;
189
+ codexSearchQuery?: string;
190
+ codexUsageRange?: CodexUsageRange;
175
191
  }) => Promise<{
176
192
  isLoadDataSuccessful: boolean;
177
193
  loadDataMessage: string;
178
194
  loadedURL: string;
179
195
  }>;
180
- resetFilter: (filter: "jmespath" | "concept") => Promise<void>;
196
+ resetFilter: (filter: "jmespath" | "codexSearch" | "concept") => Promise<void>;
181
197
  resetHash: () => void;
182
198
  buildEuphonyStyle(styleConfig: Record<string, string>): string;
199
+ getCodexUsageBucketKey(date: Date, range: CodexUsageRange): string;
200
+ getCodexUsageBucketLabel(bucketKey: string, range?: CodexUsageRange): string;
201
+ buildCodexUsageChartDays(): CodexUsageDay[];
202
+ renderCodexUsageChart(): import('lit').TemplateResult<1>;
183
203
  getConversationViewerElements(): ConversationViewerElement[];
184
204
  render(): import('lit').TemplateResult<1>;
185
205
  static styles: import('lit').CSSResult[];
@@ -1,6 +1,6 @@
1
- import{v as t,i as e,n as o,r as n,e as s,a,b as i,o as r,w as l}from"../../chunks/third-party.js";import{R as p}from"../../chunks/harmony-types.js";import"../../chunks/conversation.js";import{c as d}from"../../chunks/css/codex.js";import"../message-code/message-code.js";import"../message-developer-content/message-developer-content.js";import"../message-system-content/message-system-content.js";import"../message-text/message-text.js";import"../message-unsupported/message-unsupported.js";import"../../chunks/utils.js";const u={"purple-700":"hsl(282, 67.88%, 37.84%)","blue-700":"hsl(209, 78.72%, 46.08%)","green-700":"hsl(122, 43.43%, 38.82%)","gray-700":"hsl(0, 0.0%, 38.04%)"},c={colors:u},m=new Set(["session_meta","response_item","event_msg","turn_context","compacted"]),y=new Set(["message","function_call","function_call_output","custom_tool_call","custom_tool_call_output","reasoning"]),h=new Set(["user_message","agent_message","agent_reasoning","context_compacted","turn_aborted","token_count"]),g=t=>"object"==typeof t&&null!==t,b=t=>{try{return JSON.parse(t)}catch{return null}},f=t=>{const e=[];for(const o of t){if("string"==typeof o){const t=b(o);g(t)&&e.push(t);continue}g(o)&&e.push(o)}return e},v=t=>{if("string"!=typeof t.type)return!1;if(m.has(t.type)){if("response_item"===t.type){const e=t.payload&&"string"==typeof t.payload.type?t.payload.type:null;return!e||y.has(e)}if("event_msg"===t.type){const e=t.payload&&"string"==typeof t.payload.type?t.payload.type:null;return!e||h.has(e)}return!0}return t.type.startsWith("response_")||t.type.startsWith("event_")},_=t=>{if(!Array.isArray(t)||0===t.length)return!1;const e=f(t).filter(v);return!(0===e.length||e.length/t.length<.6)&&(!!e.some(t=>"session_meta"===t.type)||e.filter(t=>m.has(t.type??"")).length/e.length>=.6)},$=t=>{if(!t)return null;const e=Date.parse(t);return Number.isNaN(e)?null:e/1e3},w=t=>{try{const e=JSON.parse(JSON.stringify(t));return e.payload&&"encrypted_content"in e.payload&&(e.payload.encrypted_content="[omitted]"),e}catch{return t}},x=t=>JSON.stringify(t,null,2),S=t=>"string"==typeof t||"number"==typeof t||"boolean"==typeof t?String(t):null,B=t=>{if("string"==typeof t)return t;if(Array.isArray(t))return t.map(t=>B(t)).filter(t=>""!==t).join("\n");if(g(t))for(const e of["text","content","value"])if(e in t)return B(t[e]);return""},C=t=>g(t)&&"text"in t?B(t.text).trim():B(t).trim(),M=t=>{const e=b(t);return null===e?t:x(e)},k=t=>{if(g(t)&&"string"==typeof t.cmd)return t.cmd;if("string"!=typeof t)return null;const e=b(t);return null===e?t:g(e)&&"string"==typeof e.cmd?e.cmd:null},A=t=>{switch(t){case"assistant":return p.Assistant;case"user":return p.User;case"system":default:return p.System;case"tool":return p.Tool;case"developer":return p.Developer}},T=({id:t,role:e,text:o,timestamp:n,metadata:s,name:a,recipient:i,channel:r})=>({id:t,role:e,name:a,content:[{text:o}],create_time:n??void 0,metadata:s,recipient:i,channel:r}),j=({id:t,instructions:e,timestamp:o,metadata:n,name:s,recipient:a,channel:i})=>({id:t,role:p.Developer,name:s,content:[{instructions:e}],create_time:o??void 0,metadata:n,recipient:a,channel:i}),D=({id:t,role:e,code:o,language:n,timestamp:s,metadata:a,name:i,recipient:r,channel:l})=>({id:t,role:e,name:i,content:[{content_type:"code",text:o,language:n}],create_time:s??void 0,metadata:a,recipient:r,channel:l}),N=t=>{if(!_(t))return null;const e=f(t).filter(v),o=[],n=new Map,s=e.some(t=>"response_item"===t.type&&g(t.payload)&&"message"===t.payload.type&&"user"===t.payload.role),a=e.some(t=>"response_item"===t.type&&g(t.payload)&&"message"===t.payload.type&&"assistant"===t.payload.role),i=e.some(t=>"response_item"===t.type&&g(t.payload)&&"reasoning"===t.payload.type);let r=0,l=0,d=0,u=0;const m=e.find(t=>"session_meta"===t.type),y=m?.payload??{},h=e.find(t=>"turn_context"===t.type)?.payload??{},b=y.id??`codex-session-${Date.now()}`,B="string"==typeof h.model?h.model:null,N="string"==typeof y.cli_version?y.cli_version:null,W="string"==typeof y.timestamp?y.timestamp:null,L=C(y.base_instructions),R=["Codex session"],E=S(y.id);E&&R.push(`id: ${E}`),W&&R.push(`started: ${W}`);const O=S(y.cwd);O&&R.push(`cwd: ${O}`);const I=S(y.originator);if(I&&R.push(`originator: ${I}`),N&&R.push(`cli_version: ${N}`),B&&R.push(`model: ${B}`),y.git&&g(y.git)){const t=y.git,e=S(t.branch)??"unknown",o=S(t.commit_hash)??"unknown";("unknown"!==e||"unknown"!==o)&&R.push(`git: ${e}@${o}`)}if(R.length>1){const t=m??{type:"session_meta",payload:y};o.push(T({id:`${b}-summary`,role:p.System,text:R.join("\n"),timestamp:$(m?.timestamp),metadata:{codex_event_type:"session_meta",codex_event:w(t)},name:"codex"})),r+=1}L&&(o.push(j({id:`${b}-base-instructions`,instructions:L,timestamp:$(m?.timestamp),metadata:{codex_event_type:"session_meta",codex_source:"session_meta.base_instructions.text",codex_event:w(m??{type:"session_meta",payload:y})}})),r+=1);for(const[t,c]of e.entries()){const e=c.type??"unknown",m=c.payload??{},y=$(c.timestamp),h={codex_event_type:e,codex_payload_type:m.type??null,codex_event:w(c),codex_function_name:"string"==typeof m.name?m.name:null};if("response_item"===e){const e=m.type??"unknown";if("message"===e){const e=(Array.isArray(m.content)?m.content:[]).map(t=>"string"==typeof t.text?t.text:"string"==typeof t.type?`[${t.type}]`:"").filter(Boolean);o.push(T({id:`${b}-message-${t}`,role:A(m.role),text:e.length>0?e.join("\n"):"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if("reasoning"===e){const e=(Array.isArray(m.summary)?m.summary:[]).map(t=>"string"==typeof t.text?t.text:"").filter(Boolean).join("\n");e&&(o.push(T({id:`${b}-reasoning-${t}`,role:p.Assistant,text:e,timestamp:y,metadata:h,channel:"analysis"})),u+=1);continue}if("function_call"===e){const e=m.name??"tool",s=m.call_id??`${b}-call-${t}`;n.set(s,e);const a="exec_command"===e?k(m.arguments):null;null!==a?o.push(D({id:`${b}-call-${s}`,role:p.Tool,code:a,language:"bash",timestamp:y,metadata:h,name:e,recipient:e,channel:"call"})):o.push(D({id:`${b}-call-${s}`,role:p.Tool,code:x(m),language:"json",timestamp:y,metadata:h,name:e,recipient:e,channel:"call"})),l+=1;continue}if("custom_tool_call"===e){const s=m.name??"tool",a=m.call_id??`${b}-call-${t}`;if(n.set(a,s),"string"==typeof m.input&&m.input.includes("\n")){o.push(D({id:`${b}-call-${a}`,role:p.Tool,code:`tool: ${s}\ncall_id: ${a}\n\n${m.input}`,language:"text",timestamp:y,metadata:h,name:s,recipient:s,channel:"call"})),l+=1;continue}const i={type:e,name:s,call_id:a};void 0!==m.input&&(i.input=m.input),m.status&&(i.status=m.status),o.push(D({id:`${b}-call-${a}`,role:p.Tool,code:x(i),language:"json",timestamp:y,metadata:h,name:s,recipient:s,channel:"call"})),l+=1;continue}if("function_call_output"===e||"custom_tool_call_output"===e){const e=m.call_id??`${b}-call-${t}`,s=m.name??n.get(e)??"tool",a="string"==typeof m.output?M(m.output):void 0!==m.output?x(m.output):"[empty output]";o.push(D({id:`${b}-output-${e}`,role:p.Tool,code:a,language:"text",timestamp:y,metadata:h,name:s,recipient:s,channel:"output"})),d+=1;continue}o.push(D({id:`${b}-response-${t}`,role:p.System,code:x({type:e,...m}),language:"json",timestamp:y,metadata:h,name:"codex",channel:"response"}));continue}if("event_msg"===e){const e=m.type??"unknown";if(!s&&"user_message"===e){o.push(T({id:`${b}-user-${t}`,role:p.User,text:"string"==typeof m.message?m.message:"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if(!a&&"agent_message"===e){o.push(T({id:`${b}-assistant-${t}`,role:p.Assistant,text:"string"==typeof m.message?m.message:"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if(!i&&"agent_reasoning"===e){o.push(T({id:`${b}-reasoning-${t}`,role:p.Assistant,text:"string"==typeof m.text?m.text:"[empty reasoning]",timestamp:y,metadata:h,channel:"analysis"})),u+=1;continue}"context_compacted"===e&&(o.push(T({id:`${b}-compacted-${t}`,role:p.System,text:"Context compacted",timestamp:y,metadata:h,name:"codex"})),r+=1)}}const P=e.length>0?$(e[0].timestamp):null,J=[];return b&&J.push(["Session",b.slice(0,8),b,c.colors["blue-700"]]),B&&J.push(["Model",B,"From turn_context",c.colors["purple-700"]]),N&&J.push(["CLI",N,"Codex CLI version",c.colors["gray-700"]]),J.push(["Events",String(e.length),"JSONL event count",c.colors["green-700"]]),{conversation:{id:b,create_time:P??Date.now()/1e3,messages:o,metadata:{codex_session_meta:y,codex_turn_context:h,codex_event_counts:{events:e.length,messages:r,tool_calls:l,tool_outputs:d,reasoning:u},"euphony-custom-labels":J}},customLabels:J}};var W=Object.defineProperty,L=Object.getOwnPropertyDescriptor,R=(t,e,o,n)=>{for(var s,a=n>1?void 0:n?L(e,o):e,i=t.length-1;i>=0;i--)(s=t[i])&&(a=(n?s(e,o,a):s(a))||a);return n&&a&&W(e,o,a),a};let E=class extends a{constructor(){super(...arguments),this.sessionString="",this.sessionData=null,this.sharingURL=null,this.conversationLabel="Session",this.conversationMaxWidth=null,this.conversationStyle="",this.previewMode=!1,this.shouldRenderMarkdown=!1,this.isShowingMetadata=!1,this.focusModeAuthor=[],this.focusModeRecipient=[],this.focusModeContentType=[],this.disableMarkdownButton=!1,this.disableTranslationButton=!1,this.disableShareButton=!1,this.disableMetadataButton=!1,this.disableMessageMetadata=!1,this.disableConversationName=!1,this.disablePreferenceButton=!1,this.disableImagePreviewWindow=!1,this.disableTokenWindow=!1,this.disableEditingModeSaveButton=!1,this.disableConversationIDCopyButton=!1,this.disableDownloadConvoButtonTooltip="",this.disableCopyConvoButtonTooltip="",this.theme="light",this.conversation=null,this.parseError=null}parseSessionString(t){const e=t.split("\n").map(t=>t.trim()).filter(t=>""!==t),o=[];for(const t of e)try{o.push(JSON.parse(t))}catch{}return o}refreshConversationFromSession(){const t=Array.isArray(this.sessionData)&&this.sessionData.length>0?this.sessionData??[]:""!==this.sessionString?this.parseSessionString(this.sessionString):[],e=N(t);if(!e)return this.conversation=null,void(this.parseError=0===t.length?"No Codex session data found.":"Unsupported or malformed Codex session JSONL.");this.conversation=e.conversation,this.parseError=null}willUpdate(t){(t.has("sessionString")||t.has("sessionData"))&&this.refreshConversationFromSession()}render(){if(!this.conversation)return i`
1
+ import{v as t,i as e,n,r as o,e as s,a,b as i,o as r,w as l}from"../../chunks/third-party.js";import{R as p}from"../../chunks/harmony-types.js";import"../../chunks/conversation.js";import{c as u}from"../../chunks/css/codex.js";import"../message-code/message-code.js";import"../message-developer-content/message-developer-content.js";import"../message-system-content/message-system-content.js";import"../message-text/message-text.js";import"../message-unsupported/message-unsupported.js";import"../../chunks/utils.js";const c={"purple-700":"hsl(282, 67.88%, 37.84%)","blue-700":"hsl(209, 78.72%, 46.08%)","teal-700":"hsl(173, 100.0%, 23.73%)","green-700":"hsl(122, 43.43%, 38.82%)","orange-700":"hsl(30, 100.0%, 48.04%)","gray-700":"hsl(0, 0.0%, 38.04%)"},d={colors:c},m=new Set(["session_meta","response_item","event_msg","turn_context","compacted"]),y=new Set(["message","function_call","function_call_output","custom_tool_call","custom_tool_call_output","reasoning"]),h=new Set(["user_message","agent_message","agent_reasoning","context_compacted","turn_aborted","token_count"]),g=new Set(["user","assistant","system","summary","permission-mode","file-history-snapshot","last-prompt","ai-title"]),f=t=>"object"==typeof t&&null!==t,_=t=>{try{return JSON.parse(t)}catch{return null}},b=t=>{const e=[];for(const n of t){if("string"==typeof n){const t=_(n);f(t)&&e.push(t);continue}f(n)&&e.push(n)}return e},v=t=>{const e=[];for(const n of t){if("string"==typeof n){const t=_(n);f(t)&&e.push(t);continue}f(n)&&e.push(n)}return e},$=t=>{if("string"!=typeof t.type)return!1;if(m.has(t.type)){if("response_item"===t.type){const e=t.payload&&"string"==typeof t.payload.type?t.payload.type:null;return!e||y.has(e)}if("event_msg"===t.type){const e=t.payload&&"string"==typeof t.payload.type?t.payload.type:null;return!e||h.has(e)}return!0}return t.type.startsWith("response_")||t.type.startsWith("event_")},w=t=>!("string"!=typeof t.type||!g.has(t.type))&&("user"===t.type||"assistant"===t.type?f(t.message):"string"==typeof t.sessionId||f(t.snapshot)),x=t=>{if(!Array.isArray(t)||0===t.length)return!1;const e=b(t).filter($);return!(0===e.length||e.length/t.length<.6)&&(!!e.some(t=>"session_meta"===t.type)||e.filter(t=>m.has(t.type??"")).length/e.length>=.6)},S=t=>{if(!Array.isArray(t)||0===t.length)return!1;const e=v(t).filter(w);return 0!==e.length&&0!==e.filter(t=>"user"===t.type||"assistant"===t.type).length&&e.length/t.length>=.4},k=t=>x(t)||S(t),B=t=>{if(!t)return null;const e=Date.parse(t);return Number.isNaN(e)?null:e/1e3},C=t=>{try{const e=JSON.parse(JSON.stringify(t));return e.payload&&"encrypted_content"in e.payload&&(e.payload.encrypted_content="[omitted]"),e}catch{return t}},M=(t,e=2e3)=>t.length<=e?t:`${t.slice(0,e).trimEnd()}... [truncated]`,A=t=>{try{const e=JSON.parse(JSON.stringify(t)),n=e.message?.content;if("string"==typeof n)e.message&&(e.message.content=M(n));else if(Array.isArray(n)){if(!e.message)return e;e.message.content=n.map(t=>{if(!f(t))return t;const e={...t};"string"==typeof e.signature&&(e.signature="[omitted]");for(const t of["text","thinking","content"])"string"==typeof e[t]&&(e[t]=M(e[t]));return e})}return e}catch{return t}},T=t=>JSON.stringify(t,null,2),j=t=>"string"==typeof t||"number"==typeof t||"boolean"==typeof t?String(t):null,N=t=>{if("string"==typeof t)return t;if(Array.isArray(t))return t.map(t=>N(t)).filter(t=>""!==t).join("\n");if(f(t))for(const e of["text","content","value"])if(e in t)return N(t[e]);return""},D=t=>{if("string"==typeof t)return t;if(Array.isArray(t))return t.map(t=>D(t)).filter(t=>""!==t).join("\n");if(f(t))for(const e of["text","thinking","content"])if(e in t)return D(t[e]);return""},L=t=>f(t)&&"text"in t?N(t.text).trim():N(t).trim(),I=t=>{const e=_(t);return null===e?t:T(e)},W=t=>{if(f(t)&&"string"==typeof t.cmd)return t.cmd;if("string"!=typeof t)return null;const e=_(t);return null===e?t:f(e)&&"string"==typeof e.cmd?e.cmd:null},O=t=>f(t)&&"string"==typeof t.command?t.command:null,E=t=>{switch(t){case"assistant":return p.Assistant;case"user":return p.User;case"system":default:return p.System;case"tool":return p.Tool;case"developer":return p.Developer}},R=({id:t,role:e,text:n,timestamp:o,metadata:s,name:a,recipient:i,channel:r})=>({id:t,role:e,name:a,content:[{text:n}],create_time:o??void 0,metadata:s,recipient:i,channel:r}),J=({id:t,instructions:e,timestamp:n,metadata:o,name:s,recipient:a,channel:i})=>({id:t,role:p.Developer,name:s,content:[{instructions:e}],create_time:n??void 0,metadata:o,recipient:a,channel:i}),P=({id:t,role:e,code:n,language:o,timestamp:s,metadata:a,name:i,recipient:r,channel:l})=>({id:t,role:e,name:i,content:[{content_type:"code",text:n,language:o}],create_time:s??void 0,metadata:a,recipient:r,channel:l}),U=t=>{if(!x(t))return null;const e=b(t).filter($),n=[],o=new Map,s=e.some(t=>"response_item"===t.type&&f(t.payload)&&"message"===t.payload.type&&"user"===t.payload.role),a=e.some(t=>"response_item"===t.type&&f(t.payload)&&"message"===t.payload.type&&"assistant"===t.payload.role),i=e.some(t=>"response_item"===t.type&&f(t.payload)&&"reasoning"===t.payload.type);let r=0,l=0,u=0,c=0;const m=e.find(t=>"session_meta"===t.type),y=m?.payload??{},h=e.find(t=>"turn_context"===t.type)?.payload??{},g=y.id??`codex-session-${Date.now()}`,_="string"==typeof h.model?h.model:null,v="string"==typeof y.cli_version?y.cli_version:null,w="string"==typeof y.timestamp?y.timestamp:null,S=L(y.base_instructions),k=["Codex session"],M=j(y.id);M&&k.push(`id: ${M}`),w&&k.push(`started: ${w}`);const A=j(y.cwd);A&&k.push(`cwd: ${A}`);const N=j(y.originator);if(N&&k.push(`originator: ${N}`),v&&k.push(`cli_version: ${v}`),_&&k.push(`model: ${_}`),y.git&&f(y.git)){const t=y.git,e=j(t.branch)??"unknown",n=j(t.commit_hash)??"unknown";("unknown"!==e||"unknown"!==n)&&k.push(`git: ${e}@${n}`)}if(k.length>1){const t=m??{type:"session_meta",payload:y};n.push(R({id:`${g}-summary`,role:p.System,text:k.join("\n"),timestamp:B(m?.timestamp),metadata:{codex_event_type:"session_meta",codex_event:C(t)},name:"codex"})),r+=1}S&&(n.push(J({id:`${g}-base-instructions`,instructions:S,timestamp:B(m?.timestamp),metadata:{codex_event_type:"session_meta",codex_source:"session_meta.base_instructions.text",codex_event:C(m??{type:"session_meta",payload:y})}})),r+=1);for(const[t,d]of e.entries()){const e=d.type??"unknown",m=d.payload??{},y=B(d.timestamp),h={codex_event_type:e,codex_payload_type:m.type??null,codex_event:C(d),codex_function_name:"string"==typeof m.name?m.name:null};if("response_item"===e){const e=m.type??"unknown";if("message"===e){const e=(Array.isArray(m.content)?m.content:[]).map(t=>"string"==typeof t.text?t.text:"string"==typeof t.type?`[${t.type}]`:"").filter(Boolean);n.push(R({id:`${g}-message-${t}`,role:E(m.role),text:e.length>0?e.join("\n"):"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if("reasoning"===e){const e=(Array.isArray(m.summary)?m.summary:[]).map(t=>"string"==typeof t.text?t.text:"").filter(Boolean).join("\n");e&&(n.push(R({id:`${g}-reasoning-${t}`,role:p.Assistant,text:e,timestamp:y,metadata:h,channel:"analysis"})),c+=1);continue}if("function_call"===e){const e=m.name??"tool",s=m.call_id??`${g}-call-${t}`;o.set(s,e);const a="exec_command"===e?W(m.arguments):null;null!==a?n.push(P({id:`${g}-call-${s}`,role:p.Tool,code:a,language:"bash",timestamp:y,metadata:h,name:e,recipient:e,channel:"call"})):n.push(P({id:`${g}-call-${s}`,role:p.Tool,code:T(m),language:"json",timestamp:y,metadata:h,name:e,recipient:e,channel:"call"})),l+=1;continue}if("custom_tool_call"===e){const s=m.name??"tool",a=m.call_id??`${g}-call-${t}`;if(o.set(a,s),"string"==typeof m.input&&m.input.includes("\n")){n.push(P({id:`${g}-call-${a}`,role:p.Tool,code:`tool: ${s}\ncall_id: ${a}\n\n${m.input}`,language:"text",timestamp:y,metadata:h,name:s,recipient:s,channel:"call"})),l+=1;continue}const i={type:e,name:s,call_id:a};void 0!==m.input&&(i.input=m.input),m.status&&(i.status=m.status),n.push(P({id:`${g}-call-${a}`,role:p.Tool,code:T(i),language:"json",timestamp:y,metadata:h,name:s,recipient:s,channel:"call"})),l+=1;continue}if("function_call_output"===e||"custom_tool_call_output"===e){const e=m.call_id??`${g}-call-${t}`,s=m.name??o.get(e)??"tool",a="string"==typeof m.output?I(m.output):void 0!==m.output?T(m.output):"[empty output]";n.push(P({id:`${g}-output-${e}`,role:p.Tool,code:a,language:"text",timestamp:y,metadata:h,name:s,recipient:s,channel:"output"})),u+=1;continue}n.push(P({id:`${g}-response-${t}`,role:p.System,code:T({type:e,...m}),language:"json",timestamp:y,metadata:h,name:"codex",channel:"response"}));continue}if("event_msg"===e){const e=m.type??"unknown";if(!s&&"user_message"===e){n.push(R({id:`${g}-user-${t}`,role:p.User,text:"string"==typeof m.message?m.message:"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if(!a&&"agent_message"===e){n.push(R({id:`${g}-assistant-${t}`,role:p.Assistant,text:"string"==typeof m.message?m.message:"[empty message]",timestamp:y,metadata:h})),r+=1;continue}if(!i&&"agent_reasoning"===e){n.push(R({id:`${g}-reasoning-${t}`,role:p.Assistant,text:"string"==typeof m.text?m.text:"[empty reasoning]",timestamp:y,metadata:h,channel:"analysis"})),c+=1;continue}"context_compacted"===e&&(n.push(R({id:`${g}-compacted-${t}`,role:p.System,text:"Context compacted",timestamp:y,metadata:h,name:"codex"})),r+=1)}}const D=e.length>0?B(e[0].timestamp):null,O=[];return g&&O.push(["Session",g.slice(0,8),g,d.colors["blue-700"]]),_&&O.push(["Model",_,"From turn_context",d.colors["purple-700"]]),v&&O.push(["CLI",v,"Codex CLI version",d.colors["gray-700"]]),O.push(["Events",String(e.length),"JSONL event count",d.colors["green-700"]]),{conversation:{id:g,create_time:D??Date.now()/1e3,messages:n,metadata:{codex_session_meta:y,codex_turn_context:h,codex_event_counts:{events:e.length,messages:r,tool_calls:l,tool_outputs:u,reasoning:c},"euphony-custom-labels":O}},customLabels:O}},F=t=>{if(!S(t))return null;const e=v(t).filter(w),n=[],o=new Map,s=new Set;let a=0,i=0,r=0,l=0;const u=e.find(t=>"string"==typeof t.sessionId)?.sessionId??`claude-session-${Date.now()}`,c=e.length>0?B(e[0].timestamp):null,m=e.find(t=>"user"===t.type||"assistant"===t.type),y=e.find(t=>"string"==typeof t.timestamp)?.timestamp??(f(m?.snapshot)&&"string"==typeof m?.snapshot.timestamp?m.snapshot.timestamp:null),h=e.map(t=>f(t.message)&&"string"==typeof t.message.model?t.message.model:null).find(t=>null!==t),g=e.find(t=>"string"==typeof t.version)?.version,_=e.find(t=>"string"==typeof t.cwd)?.cwd,b=e.find(t=>"string"==typeof t.entrypoint)?.entrypoint,$=e.find(t=>"string"==typeof t.gitBranch)?.gitBranch,x=e.find(t=>"ai-title"===t.type&&"string"==typeof t.aiTitle)?.aiTitle,k={input_tokens:0,cached_input_tokens:0,output_tokens:0,reasoning_output_tokens:0,total_tokens:0};for(const t of e){if("assistant"!==t.type||!f(t.message))continue;const e=t.message.usage;if(!f(e))continue;const n=j(t.message.id)??j(t.requestId)??j(t.uuid);if(n&&s.has(n))continue;n&&s.add(n);const o=Number(e.input_tokens)||0,a=Number(e.cache_creation_input_tokens)||0,i=Number(e.cache_read_input_tokens)||0,r=Number(e.output_tokens)||0;k.input_tokens+=o,k.cached_input_tokens+=a+i,k.output_tokens+=r,k.total_tokens+=o+a+i+r}const C=["Claude session"];C.push(`id: ${u}`),y&&C.push(`started: ${y}`),_&&C.push(`cwd: ${_}`),b&&C.push(`entrypoint: ${b}`),g&&C.push(`version: ${g}`),h&&C.push(`model: ${h}`),$&&C.push(`git: ${$}`),x&&C.push(`title: ${x}`),n.push(R({id:`${u}-summary`,role:p.System,text:C.join("\n"),timestamp:B(y??void 0),metadata:{claude_session_id:u,claude_source:"summary"},name:"claude"})),a+=1;for(const[t,s]of e.entries()){if("user"!==s.type&&"assistant"!==s.type||s.isMeta||!f(s.message))continue;const e=s.message,c="string"==typeof e.role?E(e.role):E(s.type),d=B(s.timestamp),m=j(s.uuid)??`${u}-${t}`,y={claude_event_type:s.type,claude_uuid:s.uuid??null,claude_request_id:s.requestId??null,claude_session_id:s.sessionId??u,claude_event:A(s)},h=e.content,g="string"==typeof h?[{type:"text",text:h}]:Array.isArray(h)?h.filter(f):[];for(const[t,e]of g.entries()){const s=e.type??"unknown",u=j(e.id)??`${m}-${t}`;if("text"===s){const o="string"==typeof e.text?e.text:"";if(0===o.trim().length)continue;n.push(R({id:`${m}-text-${t}`,role:c,text:o,timestamp:d,metadata:y})),a+=1;continue}if("thinking"===s){const o="string"==typeof e.thinking?e.thinking:"";if(0===o.trim().length)continue;n.push(R({id:`${m}-thinking-${t}`,role:p.Assistant,text:o,timestamp:d,metadata:y,channel:"analysis"})),l+=1;continue}if("tool_use"===s){const a="string"==typeof e.name?e.name:"tool";o.set(u,a);const r="Bash"===a?O(e.input):null,l=r??T({type:s,name:a,id:u,input:e.input});n.push(P({id:`${m}-tool-call-${t}`,role:p.Tool,code:l,language:null===r?"json":"bash",timestamp:d,metadata:{...y,claude_tool_name:a,claude_tool_id:u},name:a,recipient:a,channel:"call"})),i+=1;continue}if("tool_result"===s){const s="string"==typeof e.tool_use_id?e.tool_use_id:`${m}-${t}`,a=o.get(s)??"tool_result",i=D(e.content);n.push(P({id:`${m}-tool-output-${t}`,role:p.Tool,code:i||"[empty output]",language:"text",timestamp:d,metadata:{...y,claude_tool_name:a,claude_tool_id:s,claude_tool_error:!0===e.is_error},name:a,recipient:a,channel:"output"})),r+=1;continue}n.push(P({id:`${m}-content-${t}`,role:c===p.Assistant?p.Assistant:p.System,code:T(e),language:"json",timestamp:d,metadata:y,name:"claude"})),a+=1}}const M=[];return M.push(["Session",u.slice(0,8),u,d.colors["orange-700"]]),h&&M.push(["Model",h,"Claude model",d.colors["purple-700"]]),g&&M.push(["CLI",g,"Claude Code version",d.colors["gray-700"]]),M.push(["Events",String(e.length),"JSONL event count",d.colors["green-700"]]),k.total_tokens>0&&M.push(["Tokens",String(k.total_tokens),"Summed unique Claude assistant usage",d.colors["teal-700"]]),{conversation:{id:u,create_time:c??Date.now()/1e3,messages:n,metadata:{claude_session:{id:u,cwd:_??null,entrypoint:b??null,version:g??null,model:h??null,title:x??null},claude_event_counts:{events:e.length,messages:a,tool_calls:i,tool_outputs:r,reasoning:l},claude_token_usage:k.total_tokens>0?k:null,"euphony-custom-labels":M}},customLabels:M}},q=t=>U(t)??F(t);var z=Object.defineProperty,G=Object.getOwnPropertyDescriptor,H=(t,e,n,o)=>{for(var s,a=o>1?void 0:o?G(e,n):e,i=t.length-1;i>=0;i--)(s=t[i])&&(a=(o?s(e,n,a):s(a))||a);return o&&a&&z(e,n,a),a};let K=class extends a{constructor(){super(...arguments),this.sessionString="",this.sessionData=null,this.sharingURL=null,this.conversationLabel="Session",this.conversationMaxWidth=null,this.conversationStyle="",this.previewMode=!1,this.shouldRenderMarkdown=!1,this.isShowingMetadata=!1,this.focusModeAuthor=[],this.focusModeRecipient=[],this.focusModeContentType=[],this.disableMarkdownButton=!1,this.disableTranslationButton=!1,this.disableShareButton=!1,this.disableMetadataButton=!1,this.disableMessageMetadata=!1,this.disableConversationName=!1,this.disablePreferenceButton=!1,this.disableImagePreviewWindow=!1,this.disableTokenWindow=!1,this.disableEditingModeSaveButton=!1,this.disableConversationIDCopyButton=!1,this.disableDownloadConvoButtonTooltip="",this.disableCopyConvoButtonTooltip="",this.theme="light",this.conversation=null,this.parseError=null}parseSessionString(t){const e=t.split("\n").map(t=>t.trim()).filter(t=>""!==t),n=[];for(const t of e)try{n.push(JSON.parse(t))}catch{}return n}refreshConversationFromSession(){const t=Array.isArray(this.sessionData)&&this.sessionData.length>0?this.sessionData??[]:""!==this.sessionString?this.parseSessionString(this.sessionString):[],e=q(t);if(!e)return this.conversation=null,void(this.parseError=0===t.length?"No local agent session data found.":"Unsupported or malformed local agent session JSONL.");this.conversation=e.conversation,this.parseError=null}willUpdate(t){(t.has("sessionString")||t.has("sessionData"))&&this.refreshConversationFromSession()}render(){if(!this.conversation)return i`
2
2
  <div class="empty-state">
3
- ${this.parseError??"No Codex session to display."}
3
+ ${this.parseError??"No local agent session to display."}
4
4
  </div>
5
5
  `;const t=this.previewMode&&0===this.focusModeAuthor.length?["user","assistant"]:this.focusModeAuthor;return i`
6
6
  <div class="codex-wrapper">
@@ -31,6 +31,6 @@ import{v as t,i as e,n as o,r as n,e as s,a,b as i,o as r,w as l}from"../../chun
31
31
  style=${this.conversationStyle}
32
32
  ></euphony-conversation>
33
33
  </div>
34
- `}preferenceWindowMessageLabelChanged(t){this.conversationComponent?.preferenceWindowMessageLabelChanged(t)}preferenceWindowFocusModeSettingsChanged(t){this.conversationComponent?.preferenceWindowFocusModeSettingsChanged(t)}expandBlockContents(){this.conversationComponent?.expandBlockContents()}collapseBlockContents(){this.conversationComponent?.collapseBlockContents()}translationButtonClicked(){this.conversationComponent?.translationButtonClicked()}};E.styles=[e`
35
- ${t(d)}
36
- `],R([o({type:String,attribute:"session-string"})],E.prototype,"sessionString",2),R([o({attribute:!1})],E.prototype,"sessionData",2),R([o({type:String,attribute:"sharing-url"})],E.prototype,"sharingURL",2),R([o({type:String,attribute:"conversation-label"})],E.prototype,"conversationLabel",2),R([o({type:String,attribute:"conversation-max-width"})],E.prototype,"conversationMaxWidth",2),R([o({type:String,attribute:"conversation-style"})],E.prototype,"conversationStyle",2),R([o({type:Boolean,attribute:"preview-mode"})],E.prototype,"previewMode",2),R([o({type:Boolean,attribute:"should-render-markdown"})],E.prototype,"shouldRenderMarkdown",2),R([o({type:Boolean,attribute:"is-showing-metadata"})],E.prototype,"isShowingMetadata",2),R([o({type:Array,attribute:"focus-mode-author"})],E.prototype,"focusModeAuthor",2),R([o({type:Array,attribute:"focus-mode-recipient"})],E.prototype,"focusModeRecipient",2),R([o({type:Array,attribute:"focus-mode-content-type"})],E.prototype,"focusModeContentType",2),R([o({type:Boolean,attribute:"disable-markdown-button"})],E.prototype,"disableMarkdownButton",2),R([o({type:Boolean,attribute:"disable-translation-button"})],E.prototype,"disableTranslationButton",2),R([o({type:Boolean,attribute:"disable-share-button"})],E.prototype,"disableShareButton",2),R([o({type:Boolean,attribute:"disable-metadata-button"})],E.prototype,"disableMetadataButton",2),R([o({type:Boolean,attribute:"disable-message-metadata"})],E.prototype,"disableMessageMetadata",2),R([o({type:Boolean,attribute:"disable-conversation-name"})],E.prototype,"disableConversationName",2),R([o({type:Boolean,attribute:"disable-preference-button"})],E.prototype,"disablePreferenceButton",2),R([o({type:Boolean,attribute:"disable-image-preview-window"})],E.prototype,"disableImagePreviewWindow",2),R([o({type:Boolean,attribute:"disable-token-window"})],E.prototype,"disableTokenWindow",2),R([o({type:Boolean,attribute:"disable-editing-mode-save-button"})],E.prototype,"disableEditingModeSaveButton",2),R([o({type:Boolean,attribute:"disable-conversation-id-copy-button"})],E.prototype,"disableConversationIDCopyButton",2),R([o({type:String,attribute:"disable-download-convo-button-tooltip"})],E.prototype,"disableDownloadConvoButtonTooltip",2),R([o({type:String,attribute:"disable-copy-convo-button-tooltip"})],E.prototype,"disableCopyConvoButtonTooltip",2),R([o({type:String,attribute:"theme"})],E.prototype,"theme",2),R([n()],E.prototype,"conversation",2),R([n()],E.prototype,"parseError",2),R([s("euphony-conversation")],E.prototype,"conversationComponent",2),E=R([l("euphony-codex")],E);export{E as EuphonyCodex,_ as i,N as p};
34
+ `}preferenceWindowMessageLabelChanged(t){this.conversationComponent?.preferenceWindowMessageLabelChanged(t)}preferenceWindowFocusModeSettingsChanged(t){this.conversationComponent?.preferenceWindowFocusModeSettingsChanged(t)}expandBlockContents(){this.conversationComponent?.expandBlockContents()}collapseBlockContents(){this.conversationComponent?.collapseBlockContents()}translationButtonClicked(){this.conversationComponent?.translationButtonClicked()}};K.styles=[e`
35
+ ${t(u)}
36
+ `],H([n({type:String,attribute:"session-string"})],K.prototype,"sessionString",2),H([n({attribute:!1})],K.prototype,"sessionData",2),H([n({type:String,attribute:"sharing-url"})],K.prototype,"sharingURL",2),H([n({type:String,attribute:"conversation-label"})],K.prototype,"conversationLabel",2),H([n({type:String,attribute:"conversation-max-width"})],K.prototype,"conversationMaxWidth",2),H([n({type:String,attribute:"conversation-style"})],K.prototype,"conversationStyle",2),H([n({type:Boolean,attribute:"preview-mode"})],K.prototype,"previewMode",2),H([n({type:Boolean,attribute:"should-render-markdown"})],K.prototype,"shouldRenderMarkdown",2),H([n({type:Boolean,attribute:"is-showing-metadata"})],K.prototype,"isShowingMetadata",2),H([n({type:Array,attribute:"focus-mode-author"})],K.prototype,"focusModeAuthor",2),H([n({type:Array,attribute:"focus-mode-recipient"})],K.prototype,"focusModeRecipient",2),H([n({type:Array,attribute:"focus-mode-content-type"})],K.prototype,"focusModeContentType",2),H([n({type:Boolean,attribute:"disable-markdown-button"})],K.prototype,"disableMarkdownButton",2),H([n({type:Boolean,attribute:"disable-translation-button"})],K.prototype,"disableTranslationButton",2),H([n({type:Boolean,attribute:"disable-share-button"})],K.prototype,"disableShareButton",2),H([n({type:Boolean,attribute:"disable-metadata-button"})],K.prototype,"disableMetadataButton",2),H([n({type:Boolean,attribute:"disable-message-metadata"})],K.prototype,"disableMessageMetadata",2),H([n({type:Boolean,attribute:"disable-conversation-name"})],K.prototype,"disableConversationName",2),H([n({type:Boolean,attribute:"disable-preference-button"})],K.prototype,"disablePreferenceButton",2),H([n({type:Boolean,attribute:"disable-image-preview-window"})],K.prototype,"disableImagePreviewWindow",2),H([n({type:Boolean,attribute:"disable-token-window"})],K.prototype,"disableTokenWindow",2),H([n({type:Boolean,attribute:"disable-editing-mode-save-button"})],K.prototype,"disableEditingModeSaveButton",2),H([n({type:Boolean,attribute:"disable-conversation-id-copy-button"})],K.prototype,"disableConversationIDCopyButton",2),H([n({type:String,attribute:"disable-download-convo-button-tooltip"})],K.prototype,"disableDownloadConvoButtonTooltip",2),H([n({type:String,attribute:"disable-copy-convo-button-tooltip"})],K.prototype,"disableCopyConvoButtonTooltip",2),H([n({type:String,attribute:"theme"})],K.prototype,"theme",2),H([o()],K.prototype,"conversation",2),H([o()],K.prototype,"parseError",2),H([s("euphony-conversation")],K.prototype,"conversationComponent",2),K=H([l("euphony-codex")],K);export{K as EuphonyCodex,S as a,x as b,F as c,U as d,k as i,q as p};
package/lib/euphony.js CHANGED
@@ -1 +1 @@
1
- import{EuphonyCodex as s,i as e,p as a}from"./components/codex/codex.js";import{E as o,p as t}from"./chunks/conversation.js";import{EuphonyMessageCode as n}from"./components/message-code/message-code.js";import{EuphonyMessageDeveloperContent as p}from"./components/message-developer-content/message-developer-content.js";import{EuphonyMessageSystemContent as r}from"./components/message-system-content/message-system-content.js";import{EuphonyMessageText as m}from"./components/message-text/message-text.js";import{EuphonyMessageUnsupported as g}from"./components/message-unsupported/message-unsupported.js";import{E as u,b as i,R as d,a as y,g as c,t as C}from"./chunks/harmony-types.js";import{E,f as h,h as l,i as M,j as x,a as S,c as T,g as f,e as j,d as v,s as k,b,u as O}from"./chunks/utils.js";export{u as EUPHONY_MESSAGE_CONTENT_TYPES,s as EuphonyCodex,o as EuphonyConversation,E as EuphonyLitElementWithBlockContents,n as EuphonyMessageCode,p as EuphonyMessageDeveloperContent,r as EuphonyMessageSystemContent,m as EuphonyMessageText,g as EuphonyMessageUnsupported,i as RealAuthor,d as Role,h as arrayToTable,l as blobToBase64,M as createBase64DataURL,x as digestMessage,y as getContentFromContentOrString,c as getContentTypeFromContent,S as getCustomLabelsFromMagicMetadata,T as getDeferredPromise,f as getMarkdownTemplate,e as isCodexSessionJSONL,a as parseCodexSession,t as parseConversationJSONString,j as sharedCollapseBlockContents,v as sharedExpandBlockContents,k as styleToString,C as tryGetContentTypeFromContent,b as updateFloatPosition,O as updatePopperOverlay};
1
+ import{EuphonyCodex as s,i as e,a,b as o,p as t,c as n,d as p}from"./components/codex/codex.js";import{E as r,p as m}from"./chunks/conversation.js";import{EuphonyMessageCode as g}from"./components/message-code/message-code.js";import{EuphonyMessageDeveloperContent as i}from"./components/message-developer-content/message-developer-content.js";import{EuphonyMessageSystemContent as u}from"./components/message-system-content/message-system-content.js";import{EuphonyMessageText as d}from"./components/message-text/message-text.js";import{EuphonyMessageUnsupported as y}from"./components/message-unsupported/message-unsupported.js";import{E as C,b as c,R as E,a as h,g as l,t as S}from"./chunks/harmony-types.js";import{E as M,f as x,h as T,i as f,j,a as v,c as O,g as k,e as N,d as b,s as L,b as B,u as F}from"./chunks/utils.js";export{C as EUPHONY_MESSAGE_CONTENT_TYPES,s as EuphonyCodex,r as EuphonyConversation,M as EuphonyLitElementWithBlockContents,g as EuphonyMessageCode,i as EuphonyMessageDeveloperContent,u as EuphonyMessageSystemContent,d as EuphonyMessageText,y as EuphonyMessageUnsupported,c as RealAuthor,E as Role,x as arrayToTable,T as blobToBase64,f as createBase64DataURL,j as digestMessage,h as getContentFromContentOrString,l as getContentTypeFromContent,v as getCustomLabelsFromMagicMetadata,O as getDeferredPromise,k as getMarkdownTemplate,e as isAgentSessionJSONL,a as isClaudeSessionJSONL,o as isCodexSessionJSONL,t as parseAgentSession,n as parseClaudeSession,p as parseCodexSession,m as parseConversationJSONString,N as sharedCollapseBlockContents,b as sharedExpandBlockContents,L as styleToString,S as tryGetContentTypeFromContent,B as updateFloatPosition,F as updatePopperOverlay};
@@ -49,10 +49,23 @@ export interface CodexSessionSummary {
49
49
  timestamp: string | null;
50
50
  age_seconds: number | null;
51
51
  event_count: number;
52
+ token_usage: CodexTokenUsage | null;
53
+ usage_timestamp: string | null;
54
+ }
55
+ export interface CodexTokenUsage {
56
+ input_tokens: number;
57
+ cached_input_tokens: number;
58
+ output_tokens: number;
59
+ reasoning_output_tokens: number;
60
+ total_tokens: number;
61
+ }
62
+ export interface CodexUsageDay extends CodexTokenUsage {
63
+ date: string;
64
+ session_count: number;
52
65
  }
53
66
  export interface BlobJSONLPayload {
54
67
  total: number;
55
- data: string[] | Conversation[] | Record<string, unknown>[] | unknown[][] | CodexSessionSummary[];
68
+ data: string[] | Conversation[] | Record<string, unknown>[] | unknown[][] | CodexSessionSummary[] | CodexUsageDay[];
56
69
  isFiltered: boolean;
57
70
  matchedCount: number;
58
71
  resolvedURL: string;
@@ -61,7 +74,7 @@ export interface BlobJSONLResponse {
61
74
  offset: number;
62
75
  limit: number;
63
76
  total: number;
64
- data: string[] | Conversation[] | Record<string, Conversation | string>[] | unknown[][] | CodexSessionSummary[];
77
+ data: string[] | Conversation[] | Record<string, Conversation | string>[] | unknown[][] | CodexSessionSummary[] | CodexUsageDay[];
65
78
  isFiltered: boolean;
66
79
  matchedCount: number;
67
80
  resolvedURL: string;
@@ -5,23 +5,27 @@ export declare const extractConversationFromJSONL: (data: unknown[]) => Conversa
5
5
  export declare class APIManager {
6
6
  apiBaseURL: string;
7
7
  constructor(apiBaseURL: string);
8
- getJSONL: ({ blobURL, offset, limit, noCache, jmespathQuery }: {
8
+ getJSONL: ({ blobURL, offset, limit, noCache, jmespathQuery, codexSearchQuery, codexUsageRange }: {
9
9
  blobURL: string;
10
10
  offset: number;
11
11
  limit: number;
12
12
  noCache: boolean;
13
13
  jmespathQuery: string;
14
+ codexSearchQuery?: string;
15
+ codexUsageRange?: string;
14
16
  }) => Promise<BlobJSONLPayload>;
15
17
  refreshRendererList: () => Promise<string[]>;
16
18
  harmonyRender: (conversation: string, renderer: string) => Promise<HarmonyRenderResponse>;
17
19
  }
18
20
  export declare class BrowserAPIManager {
19
- getJSONL: ({ blobURL, offset, limit, noCache, jmespathQuery }: {
21
+ getJSONL: ({ blobURL, offset, limit, noCache, jmespathQuery, codexSearchQuery, codexUsageRange }: {
20
22
  blobURL: string;
21
23
  offset: number;
22
24
  limit: number;
23
25
  noCache: boolean;
24
26
  jmespathQuery: string;
27
+ codexSearchQuery?: string;
28
+ codexUsageRange?: string;
25
29
  }) => Promise<BlobJSONLPayload>;
26
30
  validateOpenAIAPIKey(apiKey: string): Promise<boolean>;
27
31
  /**
@@ -4,4 +4,8 @@ export interface CodexSessionParseResult {
4
4
  customLabels: string[][];
5
5
  }
6
6
  export declare const isCodexSessionJSONL: (raw: unknown[]) => boolean;
7
+ export declare const isClaudeSessionJSONL: (raw: unknown[]) => boolean;
8
+ export declare const isAgentSessionJSONL: (raw: unknown[]) => boolean;
7
9
  export declare const parseCodexSession: (raw: unknown[]) => CodexSessionParseResult | null;
10
+ export declare const parseClaudeSession: (raw: unknown[]) => CodexSessionParseResult | null;
11
+ export declare const parseAgentSession: (raw: unknown[]) => CodexSessionParseResult | null;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wukazis/euphony",
3
3
  "private": false,
4
- "version": "0.1.45",
4
+ "version": "0.1.47",
5
5
  "type": "module",
6
6
  "types": "./lib/euphony.d.ts",
7
7
  "exports": {