@chatpanel/events 0.450.0 → 0.450.1
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/meeting-followup.js +22 -19
- package/package.json +1 -1
package/meeting-followup.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import{defineSchema as
|
|
2
|
-
A: ${
|
|
1
|
+
import{defineSchema as b,describeSchema as x,parseStructured as E}from"./structured.js";const f=Object.freeze(["none","add_section","replace_section"]),w=b({name:"meeting_followup",purpose:"the answer to a question about a meeting, and the change to its notes when one was asked for",fields:{reply:{type:"string",required:!0,max:2e3,multiline:!0,describe:"what to say back to the person: the answer, or one line saying what was changed in the notes"},edit:{type:"enum",values:f,required:!0,describe:"add_section or replace_section ONLY when the person asked to add to, change, update or fix the notes; none for a question"},heading:{type:"string",max:80,describe:"the section heading to add or replace, short; empty when edit is none"},body:{type:"string",max:4e3,multiline:!0,describe:"the section content in markdown (bullets welcome), without the heading; empty when edit is none"}}}),O=4,_=2e4,k=8e3;function N({transcript:i="",notes:e="",history:o=[],question:r=""}={}){const n=(Array.isArray(o)?o:[]).slice(-O).map(s=>`Q: ${s.question}
|
|
2
|
+
A: ${s.reply}`).join(`
|
|
3
3
|
|
|
4
|
-
`),
|
|
4
|
+
`),t=["You help with one meeting: you answer questions about it and keep its notes up to date.","Answer from the transcript and the notes. When they do not say, say so rather than guess.","When the person asks to add something to the notes, change, update or fix them, put it in a section: add_section with a new heading, or replace_section with the heading of the section to rewrite. The section body holds the content, in markdown.","When the person only asks a question, edit is none.",x(w)].join(`
|
|
5
5
|
`),d=[`TRANSCRIPT:
|
|
6
|
-
${String(
|
|
7
|
-
${String(e||"(none yet)").slice(0,k)}`,
|
|
8
|
-
${
|
|
6
|
+
${String(i).slice(-_)}`,`NOTES:
|
|
7
|
+
${String(e||"(none yet)").slice(0,k)}`,n?`EARLIER QUESTIONS:
|
|
8
|
+
${n}`:"",`THE PERSON NOW SAYS: ${r}`].filter(Boolean).join(`
|
|
9
9
|
|
|
10
|
-
`);return{system:
|
|
11
|
-
`)
|
|
10
|
+
`);return{system:t,user:d,maxTokens:1200}}function R(i){const e=E(i,w);if(!e||typeof e.reply!="string")return{reply:String(i||"").trim(),edit:"none",heading:"",body:""};const o=f.includes(e.edit)?e.edit:"none",r=String(e.heading||"").replace(/^#+\s*/,"").trim();let n=String(e.body||"").trim();const t=n.split(`
|
|
11
|
+
`)[0].replace(/^[#*\s]+|[*:\s]+$/g,"");return r&&l(t)===l(r)&&(n=n.split(`
|
|
12
|
+
`).slice(1).join(`
|
|
13
|
+
`).trim()),o!=="none"&&(!r||!n)?{reply:e.reply.trim(),edit:"none",heading:"",body:""}:{reply:e.reply.trim(),edit:o,heading:r,body:n}}const S=/^(#{1,6})\s+(.+?)\s*#*\s*$/,l=i=>String(i||"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim();function A(i="",{edit:e="none",heading:o="",body:r=""}={}){const n=String(i||"");if(e==="none"||!o||!r)return n;const t=n.split(`
|
|
14
|
+
`),d=l(o);let s=-1,h=2;for(let a=0;a<t.length;a++){const c=S.exec(t[a]);if(c&&l(c[2])===d){s=a,h=c[1].length;break}}const u=String(r).trim();if(s<0)return`${n.trimEnd()}${n.trim()?`
|
|
12
15
|
|
|
13
|
-
`:""}## ${
|
|
16
|
+
`:""}## ${o}
|
|
14
17
|
|
|
15
|
-
${
|
|
16
|
-
`;let
|
|
17
|
-
`).trim():""
|
|
18
|
+
${u}
|
|
19
|
+
`;let p=t.length;for(let a=s+1;a<t.length;a++){const c=S.exec(t[a]);if(c&&c[1].length<=h){p=a;break}}const m=e==="add_section"?t.slice(s+1,p).join(`
|
|
20
|
+
`).trim():"",$=`${t[s]}
|
|
18
21
|
|
|
19
|
-
${
|
|
22
|
+
${m?`${m}
|
|
20
23
|
|
|
21
|
-
`:""}${
|
|
22
|
-
`,
|
|
23
|
-
`),
|
|
24
|
-
`);return`${
|
|
25
|
-
`:""}${
|
|
26
|
-
${
|
|
24
|
+
`:""}${u}
|
|
25
|
+
`,g=t.slice(0,s).join(`
|
|
26
|
+
`),y=t.slice(p).join(`
|
|
27
|
+
`);return`${g}${g?`
|
|
28
|
+
`:""}${$}${y?`
|
|
29
|
+
${y}`:""}`}function L({question:i="",result:e={},at:o=0}={}){return{at:Number(o)||0,question:String(i).trim(),reply:String(e.reply||"").trim(),...e.edit&&e.edit!=="none"?{edit:e.edit,heading:e.heading}:{}}}export{f as FOLLOWUP_EDITS,O as FOLLOWUP_HISTORY,w as MEETING_FOLLOWUP_SCHEMA,A as applyNotesEdit,L as followupEntry,N as followupPrompt,R as followupResult};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/events",
|
|
3
|
-
"version": "0.450.
|
|
3
|
+
"version": "0.450.1",
|
|
4
4
|
"description": "The canonical ChatPanel event-log and capability contracts — typed durable facts, clock-free deterministic linearization, schema upcasting, and the invariants the replay harness asserts. Pure, dependency-free ESM shared by the ChatPanel extension, gateway and bridge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|