@wukazis/euphony 0.1.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +13 -0
  3. package/README.md +266 -0
  4. package/bin/euphony.js +4 -0
  5. package/dist/apple-touch-icon.png +0 -0
  6. package/dist/assets/harmony-render-5ErAOXX9.js +3285 -0
  7. package/dist/assets/local-data-worker-CHLGzNeW.js +2 -0
  8. package/dist/assets/main-CmldcHcT.js +4047 -0
  9. package/dist/examples/euphony-convo-100.jsonl +8 -0
  10. package/dist/examples/simple-harmony-convos.jsonl +8 -0
  11. package/dist/favicon-48x48.png +0 -0
  12. package/dist/favicon.ico +0 -0
  13. package/dist/favicon.svg +3 -0
  14. package/dist/global.css +38 -0
  15. package/dist/index.html +22 -0
  16. package/dist/web-app-manifest-192x192.png +0 -0
  17. package/dist/web-app-manifest-512x512.png +0 -0
  18. package/lib/chunks/conversation.js +612 -0
  19. package/lib/chunks/css/codex.js +1 -0
  20. package/lib/chunks/css/confirm-dialog.js +1 -0
  21. package/lib/chunks/css/conversation.js +1 -0
  22. package/lib/chunks/css/floating-toolbar.js +1 -0
  23. package/lib/chunks/css/input-dialog.js +1 -0
  24. package/lib/chunks/css/json-viewer.js +1 -0
  25. package/lib/chunks/css/menu.js +1 -0
  26. package/lib/chunks/css/message-code.js +1 -0
  27. package/lib/chunks/css/message-developer-content.js +1 -0
  28. package/lib/chunks/css/message-editor-popover.js +1 -0
  29. package/lib/chunks/css/message-hidden.js +1 -0
  30. package/lib/chunks/css/message-system-content.js +1 -0
  31. package/lib/chunks/css/message-text.js +1 -0
  32. package/lib/chunks/css/message-unsupported.js +1 -0
  33. package/lib/chunks/css/pagination.js +1 -0
  34. package/lib/chunks/css/preference-window.js +1 -0
  35. package/lib/chunks/css/search-window.js +1 -0
  36. package/lib/chunks/css/toast.js +1 -0
  37. package/lib/chunks/css/token-window.js +1 -0
  38. package/lib/chunks/css-inline.js +1 -0
  39. package/lib/chunks/dompurify.js +1 -0
  40. package/lib/chunks/harmony-types.js +1 -0
  41. package/lib/chunks/icon-cross.js +1 -0
  42. package/lib/chunks/icon-play.js +1 -0
  43. package/lib/chunks/marked.js +1 -0
  44. package/lib/chunks/prismjs.js +1 -0
  45. package/lib/chunks/shoelace.js +1131 -0
  46. package/lib/chunks/third-party.js +1 -0
  47. package/lib/chunks/utils.js +16 -0
  48. package/lib/components/app/app.d.ts +192 -0
  49. package/lib/components/app/local-data-worker.d.ts +35 -0
  50. package/lib/components/app/request-worker.d.ts +45 -0
  51. package/lib/components/app/url-manager.d.ts +25 -0
  52. package/lib/components/codex/codex.d.ts +50 -0
  53. package/lib/components/codex/codex.js +36 -0
  54. package/lib/components/confirm-dialog/confirm-dialog.d.ts +42 -0
  55. package/lib/components/confirm-dialog/confirm-dialog.js +41 -0
  56. package/lib/components/conversation/conversation.d.ts +259 -0
  57. package/lib/components/conversation/conversation.js +1 -0
  58. package/lib/components/floating-toolbar/floating-toolbar.d.ts +47 -0
  59. package/lib/components/floating-toolbar/floating-toolbar.js +32 -0
  60. package/lib/components/input-dialog/input-dialog.d.ts +43 -0
  61. package/lib/components/input-dialog/input-dialog.js +51 -0
  62. package/lib/components/json-viewer/json-viewer.d.ts +33 -0
  63. package/lib/components/json-viewer/json-viewer.js +8 -0
  64. package/lib/components/menu/menu.d.ts +38 -0
  65. package/lib/components/menu/menu.js +9 -0
  66. package/lib/components/message-code/message-code.d.ts +20 -0
  67. package/lib/components/message-code/message-code.js +10 -0
  68. package/lib/components/message-developer-content/message-developer-content.d.ts +45 -0
  69. package/lib/components/message-developer-content/message-developer-content.js +72 -0
  70. package/lib/components/message-editor-popover/message-editor-popover.d.ts +36 -0
  71. package/lib/components/message-editor-popover/message-editor-popover.js +85 -0
  72. package/lib/components/message-hidden/message-hidden.d.ts +38 -0
  73. package/lib/components/message-hidden/message-hidden.js +10 -0
  74. package/lib/components/message-system-content/message-system-content.d.ts +52 -0
  75. package/lib/components/message-system-content/message-system-content.js +74 -0
  76. package/lib/components/message-text/message-text.d.ts +36 -0
  77. package/lib/components/message-text/message-text.js +14 -0
  78. package/lib/components/message-unsupported/message-unsupported.d.ts +19 -0
  79. package/lib/components/message-unsupported/message-unsupported.js +26 -0
  80. package/lib/components/pagination/pagination.d.ts +29 -0
  81. package/lib/components/pagination/pagination.js +35 -0
  82. package/lib/components/preference-window/preference-window.d.ts +107 -0
  83. package/lib/components/preference-window/preference-window.js +319 -0
  84. package/lib/components/search-window/search-window.d.ts +44 -0
  85. package/lib/components/search-window/search-window.js +71 -0
  86. package/lib/components/toast/toast.d.ts +34 -0
  87. package/lib/components/toast/toast.js +77 -0
  88. package/lib/components/token-window/token-window.d.ts +96 -0
  89. package/lib/components/token-window/token-window.js +1 -0
  90. package/lib/config/config.d.ts +273 -0
  91. package/lib/euphony.d.ts +11 -0
  92. package/lib/euphony.js +1 -0
  93. package/lib/types/common-types.d.ts +176 -0
  94. package/lib/types/harmony-types.d.ts +72 -0
  95. package/lib/utils/api-manager.d.ts +42 -0
  96. package/lib/utils/codex-session.d.ts +7 -0
  97. package/lib/utils/dompurify-configs.d.ts +2 -0
  98. package/lib/utils/harmony-render.d.ts +4 -0
  99. package/lib/utils/marked-katex-extension.d.ts +22 -0
  100. package/lib/utils/patch-preview.d.ts +2 -0
  101. package/lib/utils/utils.d.ts +80 -0
  102. package/package.json +84 -0
  103. package/server-dist/node-main.js +1273 -0
@@ -0,0 +1,2 @@
1
+ (function(){"use strict";const l=new Set(["session_meta","response_item","event_msg","turn_context","compacted"]),u=new Set(["message","function_call","function_call_output","custom_tool_call","custom_tool_call_output","reasoning"]),p=new Set(["user_message","agent_message","agent_reasoning","context_compacted","turn_aborted","token_count"]),f=e=>typeof e=="object"&&e!==null,y=e=>{try{return JSON.parse(e)}catch{return null}},d=e=>{const t=[];for(const s of e){if(typeof s=="string"){const r=y(s);f(r)&&t.push(r);continue}f(s)&&t.push(s)}return t},m=e=>{if(typeof e.type!="string")return!1;if(l.has(e.type)){if(e.type==="response_item"){const t=e.payload&&typeof e.payload.type=="string"?e.payload.type:null;return t?u.has(t):!0}if(e.type==="event_msg"){const t=e.payload&&typeof e.payload.type=="string"?e.payload.type:null;return t?p.has(t):!0}return!0}return e.type.startsWith("response_")||e.type.startsWith("event_")},g=e=>{if(!Array.isArray(e)||e.length===0)return!1;const t=d(e).filter(m);return t.length===0||t.length/e.length<.6?!1:t.some(r=>r.type==="session_meta")?!0:t.filter(r=>l.has(r.type??"")).length/t.length>=.6},c=e=>typeof e!="object"||e===null?!1:"messages"in e&&Array.isArray(e.messages),_=e=>{let t=null;if(e.length>0&&typeof e[0]=="object"&&!c(e[0])&&(t=e),e.length>0&&typeof e[0]=="string"){let s=!1;try{const r=JSON.parse(e[0]);c(r)&&(s=!0)}catch{s=!0}if(!s){t=[];for(const r of e){const o=JSON.parse(r);t.push(o)}}}if(t!==null){let s=null,r=!1;for(const o in t[0])if(typeof t[0][o]=="string")try{const n=JSON.parse(t[0][o]);if(c(n)){s=o,r=!0;break}}catch{continue}else if(c(t[0][o])){s=o;break}if(s!==null){const o=[];for(const n of t){const a=r?JSON.parse(n[s]):n[s];a.metadata??={};for(const i in n)i!==s&&(a.metadata[`euphonyTransformed-${i}`]=n[i]);o.push(a)}return o}}return null},h=e=>{const t=[];for(const[s,r]of e.entries())if(typeof r=="string"){const o=JSON.parse(r);let n=r;o.conversation_id!==void 0&&o.id===void 0&&(o.id=o.conversation_id,n=JSON.stringify(o)),e[s]=n,t.push(Array.isArray(o.messages))}else{const o=r;o.conversation_id!==void 0&&o.id===void 0&&(o.id=o.conversation_id),e[s]=o,t.push(Array.isArray(o.messages))}return t.every(Boolean)},S=e=>{const t=[];try{const s=JSON.parse(e);return t.push(s),t}catch{for(const r of e.split(`
2
+ `))try{t.push(JSON.parse(r))}catch{}}return t},N=e=>{let t=S(e);if(t.length===0)throw new Error("Failed to read any JSON or JSONL data.");if(g(t))return{dataType:"codex",codexSessionData:t};const s=_(t);if(s&&(t=s),!h(t))return{dataType:"json",jsonData:t};const r=[];for(const o of t)typeof o=="string"?r.push(JSON.parse(o)):r.push(o);return{dataType:"conversation",conversationData:r}};self.onmessage=async e=>{if(e.data.command!=="startParseData"){console.error("Worker: unknown message",e.data.command);return}const{requestID:t,sourceName:s,sourceText:r,sourceFile:o}=e.data.payload;try{const n=r??await o?.text();if(n===void 0)throw new Error("No source text or file was provided.");const a=N(n),i={command:"finishParseData",payload:{requestID:t,sourceName:s,...a}};postMessage(i)}catch(n){const a={command:"error",payload:{requestID:t,sourceName:s,message:n instanceof Error?n.message:String(n)}};postMessage(a)}}})();