@adamchanadam/agent-handoff-kit 0.4.2 → 0.4.4
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/LICENSE +21 -21
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/bin/agent-handoff-kit.mjs +7146 -7047
- package/bin/commands.mjs +134 -134
- package/bin/handoff-read.mjs +88 -88
- package/bin/installed-file-contract.mjs +154 -90
- package/bin/migration-baselines/official-origin-catalog.json +534 -1
- package/bin/official-origin-catalog.mjs +294 -294
- package/bin/progress/ICON-LICENSE.txt +21 -21
- package/bin/progress/assets.mjs +6 -6
- package/bin/progress/dashboard.mjs +134 -134
- package/bin/progress/icons.svg +36 -36
- package/bin/progress/index.html +31 -31
- package/bin/progress/launch.mjs +40 -40
- package/bin/progress/open.mjs +43 -43
- package/bin/progress/project-version.mjs +121 -121
- package/bin/progress/projection.mjs +144 -144
- package/bin/progress/renderer.js +152 -152
- package/bin/progress/server.mjs +78 -78
- package/bin/progress/styles.css +31 -31
- package/bin/prompt-mirror-core.mjs +84 -84
- package/bin/upgrade-inventory.mjs +243 -243
- package/bin/user-rules-router.mjs +4 -4
- package/docs/commands.md +2 -2
- package/docs/progress.md +73 -73
- package/package.json +22 -22
- package/packs/agent-governance.md +120 -120
- package/packs/closeout.md +91 -91
- package/packs/coding.md +28 -28
- package/packs/integrations.md +19 -19
- package/packs/knowledge.md +3 -3
- package/packs/onboarding.md +45 -45
- package/packs/research.md +30 -30
- package/packs/safety.md +2 -2
- package/runtime-core/AGENTS.core.md +161 -161
- package/runtime-core/CLAUDE.md +13 -13
- package/runtime-core/DOC_SYNC_REGISTRY.md +24 -24
- package/runtime-core/GEMINI.md +17 -17
- package/runtime-core/PROJECT_DECISIONS.md +43 -43
- package/runtime-core/PROJECT_INDEX.md +16 -16
- package/runtime-core/RULE_PACKS.md +1 -1
- package/runtime-core/SESSION_HANDOFF.md +180 -180
- package/runtime-core/SESSION_LOG.md +37 -37
- package/runtime-core/START_NEXT_SESSION_PROMPT.txt +1 -1
- package/runtime-core/USER_RULES_ENTRY.md +5 -5
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
// Deterministic, read-only dashboard. Existing Markdown remains authoritative.
|
|
2
|
-
import {openSync,closeSync,readSync,fstatSync,statSync,realpathSync,existsSync} from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import {createHash} from 'node:crypto';
|
|
5
|
-
import {readBounded,signature,markdown,safe,logEntry} from './projection.mjs';
|
|
6
|
-
import {parseProjectIndexTemplateVersion} from './project-version.mjs';
|
|
7
|
-
|
|
8
|
-
export const DASH_LIMITS=Object.freeze({document:1024*1024,metadata:512*1024,items:128,documents:160,historyBytes:256*1024,historyFiles:4,historyPage:20,entryBytes:64*1024,cursors:32});
|
|
9
|
-
const digest=s=>createHash('sha256').update(s).digest('hex');
|
|
10
|
-
const states=new Set(['planned','active','waiting','review','done','paused','dropped']);
|
|
11
|
-
const clean=s=>safe(String(s||'').replace(/\*\*/g,'').replace(/^\s*[-*]\s+/,'').trim());
|
|
12
|
-
const placeholder=s=>!s||s==='TBD'||/^<.*>$/.test(s)||s==='—'||s==='-';
|
|
13
|
-
const lines=s=>s.replace(/^\uFEFF/,'').split(/\r?\n/);
|
|
14
|
-
const key=s=>clean(s).toLowerCase();
|
|
15
|
-
const known=[
|
|
16
|
-
['handoff','dev/SESSION_HANDOFF.md','handoff','current'],['log','dev/SESSION_LOG.md','log','history'],
|
|
17
|
-
['archive','dev/SESSION_LOG_archive/INDEX.md','archive','history'],['index','dev/PROJECT_INDEX.md','index','reference'],
|
|
18
|
-
['rules','AGENTS.md','rules','rules'],['packs','dev/RULE_PACKS.md','packs','rules'],
|
|
19
|
-
['decisions','dev/PROJECT_DECISIONS.md','decisions','reference'],['sync','dev/DOC_SYNC_REGISTRY.md','sync','reference']
|
|
20
|
-
];
|
|
21
|
-
function section(text,title){return markdown(text).sections.find(s=>key(s.title)===title.toLowerCase());}
|
|
22
|
-
function table(section){
|
|
23
|
-
if(!section)return[];let headers=null,out=[];
|
|
24
|
-
for(const r of section.rows){if(!r.text.trim().startsWith('|'))continue;const cells=r.text.trim().replace(/^\||\|$/g,'').split(/(?<!\\)\|/).map(x=>clean(x.replace(/\\\|/g,'|')));
|
|
25
|
-
if(cells.every(x=>/^:?-+:?$/.test(x)))continue;
|
|
26
|
-
if(!headers){headers=cells.map(key);continue;}
|
|
27
|
-
out.push({...Object.fromEntries(headers.map((h,i)=>[h,cells[i]||''])),line:r.line});
|
|
28
|
-
}return out;
|
|
29
|
-
}
|
|
30
|
-
function fields(s){const out={};for(const r of s?.rows||[]){const m=clean(r.text).match(/^([^::]+)[::]\s*(.*)$/);if(m&&!placeholder(m[2]))out[key(m[1])]=m[2];}return out;}
|
|
31
|
-
function relativeFile(value){
|
|
32
|
-
const s=String(value||'').replace(/`/g,'').split('#')[0];
|
|
33
|
-
if(!s||s.includes('\\')||s.includes('\0')||path.isAbsolute(s)||/^[a-z]+:/i.test(s)||s.split('/').some(x=>!x||x==='.'||x==='..'||x.startsWith('.'))||/(?:^|\/)(?:node_modules|governance_migrations)(?:\/|$)/i.test(s)||/(?:credential|secret|\.env|private.key)/i.test(s))return null;
|
|
34
|
-
return s;
|
|
35
|
-
}
|
|
36
|
-
function checked(root,file){const rel=relativeFile(file);if(!rel)throw Error('boundary');const real=realpathSync(path.join(root,rel)),r=path.relative(root,real);if(r.startsWith('..')||path.isAbsolute(r))throw Error('boundary');if(!statSync(real).isFile())throw Error('not_file');return real;}
|
|
37
|
-
|
|
38
|
-
export function parseWork(text){
|
|
39
|
-
const sections=markdown(text).sections.filter(s=>key(s.title)==='work items');if(sections.length>1)throw Error('work_format');
|
|
40
|
-
const s=sections[0];if(!s)return {items:[],recorded:false};
|
|
41
|
-
if(!s.rows.some(r=>/^\|\s*ID\s*\|\s*Title\s*\|\s*Status\s*\|\s*Parent\s*\|\s*Summary\s*\|\s*Source\s*\|/i.test(r.text.trim())))throw Error('work_format');
|
|
42
|
-
const rows=table(s).filter(r=>!placeholder(r.id));if(rows.length>DASH_LIMITS.items)throw Error('work_capacity');
|
|
43
|
-
const ids=new Set();const items=rows.map(r=>{
|
|
44
|
-
if(!/^[a-z0-9][a-z0-9_-]{0,63}$/i.test(r.id)||ids.has(r.id)||!states.has(r.status)||placeholder(r.title))throw Error('work_format');ids.add(r.id);
|
|
45
|
-
const source=placeholder(r.source)?null:relativeFile(r.source);if(!placeholder(r.source)&&!source)throw Error('work_source');
|
|
46
|
-
return {id:r.id,title:r.title,titleZh:r['title zh-hant']||null,status:r.status,parent:placeholder(r.parent)?null:r.parent,summary:r.summary||'',summaryZh:r['summary zh-hant']||null,artifact:source,source:{file:'dev/SESSION_HANDOFF.md',line:r.line}};
|
|
47
|
-
});
|
|
48
|
-
for(const item of items){let at=item,seen=new Set();while(at.parent){if(seen.has(at.id))throw Error('work_cycle');seen.add(at.id);at=items.find(x=>x.id===at.parent);if(!at)throw Error('work_parent');}}
|
|
49
|
-
return {items,recorded:true};
|
|
50
|
-
}
|
|
51
|
-
export function parseProfile(text){const f=fields(section(text,'Project'));return {name:f.name||null,nameZh:f['name zh-hant']||null,goal:f.goal||null,goalZh:f['goal zh-hant']||null};}
|
|
52
|
-
|
|
53
|
-
function logEntries(text,file,startLine=1){
|
|
54
|
-
return markdown(text).sections.map(s=>logEntry(s,file,startLine)).filter(Boolean);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export function createDashboard(root,source){
|
|
58
|
-
root=realpathSync(root);const cache=new Map(),cursors=new Map(),watched=new Map();let acceptedIndex=null,projectKitVersion=null,historyRevision=0,revision=0,work={items:[],recorded:false},profile={},docs=[],links=[],errors={},last='';
|
|
59
|
-
function read(file,limit=DASH_LIMITS.metadata){const sig=signature(root,file),old=cache.get(file);if(old?.sig===sig)return old;try{const r=readBounded(root,file,limit);const v={...r,sig};cache.set(file,v);return v;}catch(e){const v={sig,error:e.message,previous:old?.error?old.previous:old};cache.set(file,v);return v;}}
|
|
60
|
-
function refresh(){if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))return false;
|
|
61
|
-
errors={};const h=source?.state?{text:source.state.acceptedHandoff,error:source.state.errors.handoff||(!source.state.acceptedHandoff?'unavailable':null)}:read('dev/SESSION_HANDOFF.md',DASH_LIMITS.document);let i=read('dev/PROJECT_INDEX.md');
|
|
62
|
-
projectKitVersion=i.error?null:parseProjectIndexTemplateVersion(i.text);
|
|
63
|
-
if(!h.error){try{work=parseWork(h.text);}catch(e){errors.work=e.message;}}else errors.work=h.error;
|
|
64
|
-
if(!i.error){try{const next=parseProfile(i.text);const block=section(i.text,'Project');if((profile.name||profile.goal)&&!block||block&&!block.rows.some(r=>/^(?:-\s*)?Name:\s*\S/.test(r.text)))throw Error('index_format');profile=next;acceptedIndex=i;}catch{errors.index='format';i=acceptedIndex||{error:'format'};}}else{if(i.sig!=='missing'||acceptedIndex)errors.index=i.error;if(acceptedIndex)i=acceptedIndex;}
|
|
65
|
-
const all=known.map(([id,file,role,group])=>({id,file,role,group,title:null,registered:true}));
|
|
66
|
-
if(!i.error){for(const r of table(section(i.text,'Directory Map'))){const file=relativeFile(r.path);if(file&&!all.some(x=>x.file===file)&&/\.(md|txt|html|pdf|csv|json)$/i.test(file))all.push({id:digest(file).slice(0,16),file,role:'document',group:'reference',title:r.role||file,registered:true,source:{file:'dev/PROJECT_INDEX.md',line:r.line}});}}
|
|
67
|
-
for(const item of work.items)if(item.artifact&&!all.some(x=>x.file===item.artifact))all.push({id:digest(item.artifact).slice(0,16),file:item.artifact,role:'artifact',group:'results',title:item.title,titleZh:item.titleZh,registered:true,source:item.source});
|
|
68
|
-
if(all.length>DASH_LIMITS.documents)errors.documents='capacity';
|
|
69
|
-
docs=all.slice(0,DASH_LIMITS.documents).map(d=>{try{const st=statSync(checked(root,d.file));return {...d,available:true,updated:new Date(st.mtimeMs).toISOString(),bytes:st.size};}catch{return {...d,available:false};}});
|
|
70
|
-
links=[['index','handoff','routes'],['rules','handoff','governs'],['packs','rules','routes'],['log','archive','archives']].filter(([a,b])=>docs.some(x=>x.id===a&&x.available)&&docs.some(x=>x.id===b&&x.available)).map(([from,to,type])=>({from,to,type,basis:'kit-contract'}));
|
|
71
|
-
// Project-specific links must be explicit, never inferred from prose or filenames.
|
|
72
|
-
if(!i.error)for(const r of table(section(i.text,'Document Relations'))){const a=docs.find(x=>x.file===relativeFile(r.from)),b=docs.find(x=>x.file===relativeFile(r.to));if(a&&b&&['references','routes','mirrors','checks'].includes(r.relation))links.push({from:a.id,to:b.id,type:r.relation,basis:'dev/PROJECT_INDEX.md',line:r.line});}
|
|
73
|
-
for(const file of ['dev/SESSION_LOG.md','dev/SESSION_LOG_archive/INDEX.md',...watched.keys()]){const sig=signature(root,file);if(watched.has(file)&&watched.get(file)!==sig)historyRevision++;watched.set(file,sig);}
|
|
74
|
-
const value=JSON.stringify({work,profile,projectKitVersion,docs,links,errors,historyRevision});if(value===last)return false;last=value;revision++;return true;
|
|
75
|
-
}
|
|
76
|
-
function snapshot(){return{revision,historyRevision,work,profile,projectKitVersion,documents:docs,links,errors,limits:DASH_LIMITS};}
|
|
77
|
-
function document(id){if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))throw Error('upgrade');const doc=docs.find(x=>x.id===id);if(!doc)throw Error('unknown_document');checked(root,doc.file);if(!/\.(md|txt|csv|json)$/i.test(doc.file))return{...doc,text:null,reason:'preview_unavailable'};const r=readBounded(root,doc.file,DASH_LIMITS.document);return{...doc,text:safe(r.text),updated:r.mtime,hash:r.hash};}
|
|
78
|
-
function history({from='',to='',search='',work:workId='',cursor=''}={}){
|
|
79
|
-
if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))throw Error('upgrade');
|
|
80
|
-
for(const d of [from,to])if(d&&(!/^\d{4}-\d{2}-\d{2}$/.test(d)||Number.isNaN(Date.parse(d))||new Date(d+'T00:00:00Z').toISOString().slice(0,10)!==d))throw Error('date');if(from&&to&&from>to)throw Error('date');if(search.length>100||workId.length>64)throw Error('query');
|
|
81
|
-
const query={from,to,search,workId},q=digest(JSON.stringify(query));let job;
|
|
82
|
-
if(cursor){job=cursors.get(cursor);if(!job||job.q!==q||Date.now()-job.created>15*60_000)throw Error('expired');cursors.delete(cursor);for(const [file,sig]of Object.entries(job.signatures))if(signature(root,file)!==sig)throw Error('history_changed');}
|
|
83
|
-
else{
|
|
84
|
-
const files=['dev/SESSION_LOG.md'],warnings=[];const idx=read('dev/SESSION_LOG_archive/INDEX.md');
|
|
85
|
-
if(!idx.error){const block=section(idx.text,'Batch 清單')||section(idx.text,'Batches')||markdown(idx.text).sections.find(s=>s.rows.some(x=>/\|.*(?:File path|Path).*\|/i.test(x.text)));const rows=table(block);
|
|
86
|
-
if(!block||!block.rows.some(r=>/\|.*Date range.*\|.*(?:File path|Path).*\|/i.test(r.text)))warnings.push('archive_index');
|
|
87
|
-
for(const r of rows){const file=String(r['file path']||r.path||'').replace(/`/g,'');const rel=relativeFile('dev/SESSION_LOG_archive/'+file);if(!rel||!/^archive_[\w.-]+\.md$/.test(file)){warnings.push('archive_index');continue;}
|
|
88
|
-
const dates=String(r['date range']||'').match(/\d{4}-\d{2}-\d{2}/g);if(!dates||dates.length!==2||dates[0]>dates[1]||dates.some(d=>Number.isNaN(Date.parse(d))||new Date(d+'T00:00:00Z').toISOString().slice(0,10)!==d)){warnings.push('archive_range');files.push(rel);continue;}
|
|
89
|
-
if((!from||dates[1]>=from)&&(!to||dates[0]<=to))files.push(rel);
|
|
90
|
-
}
|
|
91
|
-
}else if(idx.sig!=='missing')warnings.push('archive_index');
|
|
92
|
-
else if(existsSync(path.join(root,'dev/SESSION_LOG_archive')))warnings.push('archive_index');
|
|
93
|
-
job={q,query,files:[...new Set(files)],index:0,offset:0,line:1,buffer:'',entry:'',entryLine:1,fence:null,seen:{},queue:[],warnings:[...new Set(warnings)],created:Date.now(),signatures:{'dev/SESSION_LOG_archive/INDEX.md':signature(root,'dev/SESSION_LOG_archive/INDEX.md')},bytes:0};
|
|
94
|
-
}
|
|
95
|
-
// Bound every request independently of total history. Resume byte offsets using an opaque cursor.
|
|
96
|
-
let budget=DASH_LIMITS.historyBytes,fileBudget=DASH_LIMITS.historyFiles;
|
|
97
|
-
const emit=(text,file,line)=>{try{if(text.includes('<!-- ack:log-entry:start -->')&&!text.includes('<!-- ack:log-entry:end -->'))job.warnings.push('incomplete_entry');for(const item of logEntries(text,file,line)){
|
|
98
|
-
if(from&&item.date<from||to&&item.date>to||workId&&item.work!==workId||search&&!`${item.title}\n${item.body}`.toLocaleLowerCase().includes(search.toLocaleLowerCase()))continue;
|
|
99
|
-
if(job.seen[item.id]){if(job.seen[item.id]!==item.fingerprint)job.warnings.push('event_conflict');continue;}job.seen[item.id]=item.fingerprint;job.queue.push(item);
|
|
100
|
-
}}catch{job.warnings.push('incomplete_entry');}};
|
|
101
|
-
while(job.queue.length<DASH_LIMITS.historyPage&&job.index<job.files.length&&budget>0&&fileBudget>0){
|
|
102
|
-
const file=job.files[job.index];let fd;
|
|
103
|
-
try{
|
|
104
|
-
const real=checked(root,file),sig=signature(root,file);if(job.signatures[file]&&job.signatures[file]!==sig)throw Error('history_changed');job.signatures[file]=sig;
|
|
105
|
-
if(watched.size>=130&&!watched.has(file)){const victim=[...watched.keys()].find(x=>x.includes('/archive_'));if(victim)watched.delete(victim);}watched.set(file,sig);
|
|
106
|
-
fd=openSync(real,'r');const st=fstatSync(fd);if(st.size<job.offset)throw Error('history_changed');
|
|
107
|
-
const len=Math.min(32768,budget,st.size-job.offset),buf=Buffer.alloc(len);const n=readSync(fd,buf,0,len,job.offset);job.offset+=n;budget-=n;job.bytes+=n;
|
|
108
|
-
// Buffer bytes between chunks so a multi-byte UTF-8 character is never split.
|
|
109
|
-
const pending=Buffer.concat([Buffer.from(job.buffer,'base64'),buf.subarray(0,n)]);const end=job.offset===st.size?pending.length:pending.lastIndexOf(10)+1;
|
|
110
|
-
job.buffer=pending.subarray(end).toString('base64');if(pending.length>DASH_LIMITS.entryBytes&&end===0)throw Error('entry_capacity');
|
|
111
|
-
const text=new TextDecoder('utf-8',{fatal:true}).decode(pending.subarray(0,end));
|
|
112
|
-
for(const raw of text?text.split('\n').slice(0,text.endsWith('\n')?-1:undefined):[]){
|
|
113
|
-
const line=raw.replace(/\r$/,'');let visible=line;
|
|
114
|
-
if(!job.fence&&!/^\s*<!-- ack:log-entry:(?:start|end) -->\s*$/.test(line)){if(job.inComment){const end=visible.indexOf('-->');if(end<0)visible='';else{visible=visible.slice(end+3);job.inComment=false;}}while(visible.includes('<!--')){const start=visible.indexOf('<!--'),end=visible.indexOf('-->',start+4);if(end<0){visible=visible.slice(0,start);job.inComment=true;break;}visible=visible.slice(0,start)+visible.slice(end+3);}}
|
|
115
|
-
const f=visible.match(/^\s*(`{3,}|~{3,})(.*)$/);if(f){if(!job.fence)job.fence=f[1];else if(job.fence[0]===f[1][0]&&f[1].length>=job.fence.length&&!f[2].trim())job.fence=null;}
|
|
116
|
-
if(!job.fence&&!job.inComment&&/^\s*<!-- ack:log-entry:start -->\s*$/.test(line)){if(job.entry)emit(job.entry,file,job.entryLine);job.entry='';job.marked=true;job.line++;continue;}
|
|
117
|
-
const heading=!job.fence&&/^## \d{4}-\d{2}-\d{2}\s*[—–-]/.test(visible);
|
|
118
|
-
if(heading){if(job.entry)emit(job.entry,file,job.entryLine);job.entry=(job.marked?'<!-- ack:log-entry:start -->\n':'')+line+'\n';job.entryLine=job.line-(job.marked?1:0);job.marked=false;}
|
|
119
|
-
else if(job.entry)job.entry+=line+'\n';
|
|
120
|
-
if(Buffer.byteLength(job.entry)>DASH_LIMITS.entryBytes){job.entry='';job.warnings.push('entry_capacity');}job.line++;
|
|
121
|
-
}
|
|
122
|
-
if(signature(root,file)!==sig||fstatSync(fd).mtimeMs!==st.mtimeMs)throw Error('history_changed');
|
|
123
|
-
if(job.offset===st.size){if(job.entry)emit(job.entry,file,job.entryLine);if(job.marked||job.fence||job.inComment)job.warnings.push('incomplete_entry');job.index++;job.offset=0;job.line=1;job.entry='';job.buffer='';job.fence=null;job.marked=false;job.inComment=false;fileBudget--;}
|
|
124
|
-
}catch(e){if(e.message==='history_changed')throw e;job.warnings.push(e.message==='boundary'?'boundary':'history_unreadable');job.index++;job.offset=0;job.line=1;job.entry='';job.buffer='';job.fence=null;job.marked=false;fileBudget--;}
|
|
125
|
-
finally{if(fd!==undefined)closeSync(fd);}
|
|
126
|
-
}
|
|
127
|
-
job.queue.sort((a,b)=>b.date.localeCompare(a.date));const items=job.queue.splice(0,DASH_LIMITS.historyPage);const complete=job.index>=job.files.length&&!job.queue.length;
|
|
128
|
-
// Cap remembered deduplication identities; explicit coverage warning instead of silent unbounded growth.
|
|
129
|
-
if(Object.keys(job.seen).length>10000){job.warnings.push('history_capacity');job.index=job.files.length;job.queue=[];}
|
|
130
|
-
let next=null;if(!complete&&Object.keys(job.seen).length<=10000){next=digest(q+Date.now()+Math.random());job.created=Date.now();if(cursors.size>=DASH_LIMITS.cursors)cursors.delete(cursors.keys().next().value);cursors.set(next,job);}
|
|
131
|
-
return{items,next,complete:complete&&!job.warnings.length,warnings:[...new Set(job.warnings)],bytesRead:DASH_LIMITS.historyBytes-budget,filesChecked:job.index,totalFiles:job.files.length,range:{from,to},revision};
|
|
132
|
-
}
|
|
133
|
-
return{refresh,snapshot,document,history};
|
|
134
|
-
}
|
|
1
|
+
// Deterministic, read-only dashboard. Existing Markdown remains authoritative.
|
|
2
|
+
import {openSync,closeSync,readSync,fstatSync,statSync,realpathSync,existsSync} from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {createHash} from 'node:crypto';
|
|
5
|
+
import {readBounded,signature,markdown,safe,logEntry} from './projection.mjs';
|
|
6
|
+
import {parseProjectIndexTemplateVersion} from './project-version.mjs';
|
|
7
|
+
|
|
8
|
+
export const DASH_LIMITS=Object.freeze({document:1024*1024,metadata:512*1024,items:128,documents:160,historyBytes:256*1024,historyFiles:4,historyPage:20,entryBytes:64*1024,cursors:32});
|
|
9
|
+
const digest=s=>createHash('sha256').update(s).digest('hex');
|
|
10
|
+
const states=new Set(['planned','active','waiting','review','done','paused','dropped']);
|
|
11
|
+
const clean=s=>safe(String(s||'').replace(/\*\*/g,'').replace(/^\s*[-*]\s+/,'').trim());
|
|
12
|
+
const placeholder=s=>!s||s==='TBD'||/^<.*>$/.test(s)||s==='—'||s==='-';
|
|
13
|
+
const lines=s=>s.replace(/^\uFEFF/,'').split(/\r?\n/);
|
|
14
|
+
const key=s=>clean(s).toLowerCase();
|
|
15
|
+
const known=[
|
|
16
|
+
['handoff','dev/SESSION_HANDOFF.md','handoff','current'],['log','dev/SESSION_LOG.md','log','history'],
|
|
17
|
+
['archive','dev/SESSION_LOG_archive/INDEX.md','archive','history'],['index','dev/PROJECT_INDEX.md','index','reference'],
|
|
18
|
+
['rules','AGENTS.md','rules','rules'],['packs','dev/RULE_PACKS.md','packs','rules'],
|
|
19
|
+
['decisions','dev/PROJECT_DECISIONS.md','decisions','reference'],['sync','dev/DOC_SYNC_REGISTRY.md','sync','reference']
|
|
20
|
+
];
|
|
21
|
+
function section(text,title){return markdown(text).sections.find(s=>key(s.title)===title.toLowerCase());}
|
|
22
|
+
function table(section){
|
|
23
|
+
if(!section)return[];let headers=null,out=[];
|
|
24
|
+
for(const r of section.rows){if(!r.text.trim().startsWith('|'))continue;const cells=r.text.trim().replace(/^\||\|$/g,'').split(/(?<!\\)\|/).map(x=>clean(x.replace(/\\\|/g,'|')));
|
|
25
|
+
if(cells.every(x=>/^:?-+:?$/.test(x)))continue;
|
|
26
|
+
if(!headers){headers=cells.map(key);continue;}
|
|
27
|
+
out.push({...Object.fromEntries(headers.map((h,i)=>[h,cells[i]||''])),line:r.line});
|
|
28
|
+
}return out;
|
|
29
|
+
}
|
|
30
|
+
function fields(s){const out={};for(const r of s?.rows||[]){const m=clean(r.text).match(/^([^::]+)[::]\s*(.*)$/);if(m&&!placeholder(m[2]))out[key(m[1])]=m[2];}return out;}
|
|
31
|
+
function relativeFile(value){
|
|
32
|
+
const s=String(value||'').replace(/`/g,'').split('#')[0];
|
|
33
|
+
if(!s||s.includes('\\')||s.includes('\0')||path.isAbsolute(s)||/^[a-z]+:/i.test(s)||s.split('/').some(x=>!x||x==='.'||x==='..'||x.startsWith('.'))||/(?:^|\/)(?:node_modules|governance_migrations)(?:\/|$)/i.test(s)||/(?:credential|secret|\.env|private.key)/i.test(s))return null;
|
|
34
|
+
return s;
|
|
35
|
+
}
|
|
36
|
+
function checked(root,file){const rel=relativeFile(file);if(!rel)throw Error('boundary');const real=realpathSync(path.join(root,rel)),r=path.relative(root,real);if(r.startsWith('..')||path.isAbsolute(r))throw Error('boundary');if(!statSync(real).isFile())throw Error('not_file');return real;}
|
|
37
|
+
|
|
38
|
+
export function parseWork(text){
|
|
39
|
+
const sections=markdown(text).sections.filter(s=>key(s.title)==='work items');if(sections.length>1)throw Error('work_format');
|
|
40
|
+
const s=sections[0];if(!s)return {items:[],recorded:false};
|
|
41
|
+
if(!s.rows.some(r=>/^\|\s*ID\s*\|\s*Title\s*\|\s*Status\s*\|\s*Parent\s*\|\s*Summary\s*\|\s*Source\s*\|/i.test(r.text.trim())))throw Error('work_format');
|
|
42
|
+
const rows=table(s).filter(r=>!placeholder(r.id));if(rows.length>DASH_LIMITS.items)throw Error('work_capacity');
|
|
43
|
+
const ids=new Set();const items=rows.map(r=>{
|
|
44
|
+
if(!/^[a-z0-9][a-z0-9_-]{0,63}$/i.test(r.id)||ids.has(r.id)||!states.has(r.status)||placeholder(r.title))throw Error('work_format');ids.add(r.id);
|
|
45
|
+
const source=placeholder(r.source)?null:relativeFile(r.source);if(!placeholder(r.source)&&!source)throw Error('work_source');
|
|
46
|
+
return {id:r.id,title:r.title,titleZh:r['title zh-hant']||null,status:r.status,parent:placeholder(r.parent)?null:r.parent,summary:r.summary||'',summaryZh:r['summary zh-hant']||null,artifact:source,source:{file:'dev/SESSION_HANDOFF.md',line:r.line}};
|
|
47
|
+
});
|
|
48
|
+
for(const item of items){let at=item,seen=new Set();while(at.parent){if(seen.has(at.id))throw Error('work_cycle');seen.add(at.id);at=items.find(x=>x.id===at.parent);if(!at)throw Error('work_parent');}}
|
|
49
|
+
return {items,recorded:true};
|
|
50
|
+
}
|
|
51
|
+
export function parseProfile(text){const f=fields(section(text,'Project'));return {name:f.name||null,nameZh:f['name zh-hant']||null,goal:f.goal||null,goalZh:f['goal zh-hant']||null};}
|
|
52
|
+
|
|
53
|
+
function logEntries(text,file,startLine=1){
|
|
54
|
+
return markdown(text).sections.map(s=>logEntry(s,file,startLine)).filter(Boolean);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function createDashboard(root,source){
|
|
58
|
+
root=realpathSync(root);const cache=new Map(),cursors=new Map(),watched=new Map();let acceptedIndex=null,projectKitVersion=null,historyRevision=0,revision=0,work={items:[],recorded:false},profile={},docs=[],links=[],errors={},last='';
|
|
59
|
+
function read(file,limit=DASH_LIMITS.metadata){const sig=signature(root,file),old=cache.get(file);if(old?.sig===sig)return old;try{const r=readBounded(root,file,limit);const v={...r,sig};cache.set(file,v);return v;}catch(e){const v={sig,error:e.message,previous:old?.error?old.previous:old};cache.set(file,v);return v;}}
|
|
60
|
+
function refresh(){if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))return false;
|
|
61
|
+
errors={};const h=source?.state?{text:source.state.acceptedHandoff,error:source.state.errors.handoff||(!source.state.acceptedHandoff?'unavailable':null)}:read('dev/SESSION_HANDOFF.md',DASH_LIMITS.document);let i=read('dev/PROJECT_INDEX.md');
|
|
62
|
+
projectKitVersion=i.error?null:parseProjectIndexTemplateVersion(i.text);
|
|
63
|
+
if(!h.error){try{work=parseWork(h.text);}catch(e){errors.work=e.message;}}else errors.work=h.error;
|
|
64
|
+
if(!i.error){try{const next=parseProfile(i.text);const block=section(i.text,'Project');if((profile.name||profile.goal)&&!block||block&&!block.rows.some(r=>/^(?:-\s*)?Name:\s*\S/.test(r.text)))throw Error('index_format');profile=next;acceptedIndex=i;}catch{errors.index='format';i=acceptedIndex||{error:'format'};}}else{if(i.sig!=='missing'||acceptedIndex)errors.index=i.error;if(acceptedIndex)i=acceptedIndex;}
|
|
65
|
+
const all=known.map(([id,file,role,group])=>({id,file,role,group,title:null,registered:true}));
|
|
66
|
+
if(!i.error){for(const r of table(section(i.text,'Directory Map'))){const file=relativeFile(r.path);if(file&&!all.some(x=>x.file===file)&&/\.(md|txt|html|pdf|csv|json)$/i.test(file))all.push({id:digest(file).slice(0,16),file,role:'document',group:'reference',title:r.role||file,registered:true,source:{file:'dev/PROJECT_INDEX.md',line:r.line}});}}
|
|
67
|
+
for(const item of work.items)if(item.artifact&&!all.some(x=>x.file===item.artifact))all.push({id:digest(item.artifact).slice(0,16),file:item.artifact,role:'artifact',group:'results',title:item.title,titleZh:item.titleZh,registered:true,source:item.source});
|
|
68
|
+
if(all.length>DASH_LIMITS.documents)errors.documents='capacity';
|
|
69
|
+
docs=all.slice(0,DASH_LIMITS.documents).map(d=>{try{const st=statSync(checked(root,d.file));return {...d,available:true,updated:new Date(st.mtimeMs).toISOString(),bytes:st.size};}catch{return {...d,available:false};}});
|
|
70
|
+
links=[['index','handoff','routes'],['rules','handoff','governs'],['packs','rules','routes'],['log','archive','archives']].filter(([a,b])=>docs.some(x=>x.id===a&&x.available)&&docs.some(x=>x.id===b&&x.available)).map(([from,to,type])=>({from,to,type,basis:'kit-contract'}));
|
|
71
|
+
// Project-specific links must be explicit, never inferred from prose or filenames.
|
|
72
|
+
if(!i.error)for(const r of table(section(i.text,'Document Relations'))){const a=docs.find(x=>x.file===relativeFile(r.from)),b=docs.find(x=>x.file===relativeFile(r.to));if(a&&b&&['references','routes','mirrors','checks'].includes(r.relation))links.push({from:a.id,to:b.id,type:r.relation,basis:'dev/PROJECT_INDEX.md',line:r.line});}
|
|
73
|
+
for(const file of ['dev/SESSION_LOG.md','dev/SESSION_LOG_archive/INDEX.md',...watched.keys()]){const sig=signature(root,file);if(watched.has(file)&&watched.get(file)!==sig)historyRevision++;watched.set(file,sig);}
|
|
74
|
+
const value=JSON.stringify({work,profile,projectKitVersion,docs,links,errors,historyRevision});if(value===last)return false;last=value;revision++;return true;
|
|
75
|
+
}
|
|
76
|
+
function snapshot(){return{revision,historyRevision,work,profile,projectKitVersion,documents:docs,links,errors,limits:DASH_LIMITS};}
|
|
77
|
+
function document(id){if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))throw Error('upgrade');const doc=docs.find(x=>x.id===id);if(!doc)throw Error('unknown_document');checked(root,doc.file);if(!/\.(md|txt|csv|json)$/i.test(doc.file))return{...doc,text:null,reason:'preview_unavailable'};const r=readBounded(root,doc.file,DASH_LIMITS.document);return{...doc,text:safe(r.text),updated:r.mtime,hash:r.hash};}
|
|
78
|
+
function history({from='',to='',search='',work:workId='',cursor=''}={}){
|
|
79
|
+
if(existsSync(path.join(root,'dev/governance_migrations/.upgrade.lock')))throw Error('upgrade');
|
|
80
|
+
for(const d of [from,to])if(d&&(!/^\d{4}-\d{2}-\d{2}$/.test(d)||Number.isNaN(Date.parse(d))||new Date(d+'T00:00:00Z').toISOString().slice(0,10)!==d))throw Error('date');if(from&&to&&from>to)throw Error('date');if(search.length>100||workId.length>64)throw Error('query');
|
|
81
|
+
const query={from,to,search,workId},q=digest(JSON.stringify(query));let job;
|
|
82
|
+
if(cursor){job=cursors.get(cursor);if(!job||job.q!==q||Date.now()-job.created>15*60_000)throw Error('expired');cursors.delete(cursor);for(const [file,sig]of Object.entries(job.signatures))if(signature(root,file)!==sig)throw Error('history_changed');}
|
|
83
|
+
else{
|
|
84
|
+
const files=['dev/SESSION_LOG.md'],warnings=[];const idx=read('dev/SESSION_LOG_archive/INDEX.md');
|
|
85
|
+
if(!idx.error){const block=section(idx.text,'Batch 清單')||section(idx.text,'Batches')||markdown(idx.text).sections.find(s=>s.rows.some(x=>/\|.*(?:File path|Path).*\|/i.test(x.text)));const rows=table(block);
|
|
86
|
+
if(!block||!block.rows.some(r=>/\|.*Date range.*\|.*(?:File path|Path).*\|/i.test(r.text)))warnings.push('archive_index');
|
|
87
|
+
for(const r of rows){const file=String(r['file path']||r.path||'').replace(/`/g,'');const rel=relativeFile('dev/SESSION_LOG_archive/'+file);if(!rel||!/^archive_[\w.-]+\.md$/.test(file)){warnings.push('archive_index');continue;}
|
|
88
|
+
const dates=String(r['date range']||'').match(/\d{4}-\d{2}-\d{2}/g);if(!dates||dates.length!==2||dates[0]>dates[1]||dates.some(d=>Number.isNaN(Date.parse(d))||new Date(d+'T00:00:00Z').toISOString().slice(0,10)!==d)){warnings.push('archive_range');files.push(rel);continue;}
|
|
89
|
+
if((!from||dates[1]>=from)&&(!to||dates[0]<=to))files.push(rel);
|
|
90
|
+
}
|
|
91
|
+
}else if(idx.sig!=='missing')warnings.push('archive_index');
|
|
92
|
+
else if(existsSync(path.join(root,'dev/SESSION_LOG_archive')))warnings.push('archive_index');
|
|
93
|
+
job={q,query,files:[...new Set(files)],index:0,offset:0,line:1,buffer:'',entry:'',entryLine:1,fence:null,seen:{},queue:[],warnings:[...new Set(warnings)],created:Date.now(),signatures:{'dev/SESSION_LOG_archive/INDEX.md':signature(root,'dev/SESSION_LOG_archive/INDEX.md')},bytes:0};
|
|
94
|
+
}
|
|
95
|
+
// Bound every request independently of total history. Resume byte offsets using an opaque cursor.
|
|
96
|
+
let budget=DASH_LIMITS.historyBytes,fileBudget=DASH_LIMITS.historyFiles;
|
|
97
|
+
const emit=(text,file,line)=>{try{if(text.includes('<!-- ack:log-entry:start -->')&&!text.includes('<!-- ack:log-entry:end -->'))job.warnings.push('incomplete_entry');for(const item of logEntries(text,file,line)){
|
|
98
|
+
if(from&&item.date<from||to&&item.date>to||workId&&item.work!==workId||search&&!`${item.title}\n${item.body}`.toLocaleLowerCase().includes(search.toLocaleLowerCase()))continue;
|
|
99
|
+
if(job.seen[item.id]){if(job.seen[item.id]!==item.fingerprint)job.warnings.push('event_conflict');continue;}job.seen[item.id]=item.fingerprint;job.queue.push(item);
|
|
100
|
+
}}catch{job.warnings.push('incomplete_entry');}};
|
|
101
|
+
while(job.queue.length<DASH_LIMITS.historyPage&&job.index<job.files.length&&budget>0&&fileBudget>0){
|
|
102
|
+
const file=job.files[job.index];let fd;
|
|
103
|
+
try{
|
|
104
|
+
const real=checked(root,file),sig=signature(root,file);if(job.signatures[file]&&job.signatures[file]!==sig)throw Error('history_changed');job.signatures[file]=sig;
|
|
105
|
+
if(watched.size>=130&&!watched.has(file)){const victim=[...watched.keys()].find(x=>x.includes('/archive_'));if(victim)watched.delete(victim);}watched.set(file,sig);
|
|
106
|
+
fd=openSync(real,'r');const st=fstatSync(fd);if(st.size<job.offset)throw Error('history_changed');
|
|
107
|
+
const len=Math.min(32768,budget,st.size-job.offset),buf=Buffer.alloc(len);const n=readSync(fd,buf,0,len,job.offset);job.offset+=n;budget-=n;job.bytes+=n;
|
|
108
|
+
// Buffer bytes between chunks so a multi-byte UTF-8 character is never split.
|
|
109
|
+
const pending=Buffer.concat([Buffer.from(job.buffer,'base64'),buf.subarray(0,n)]);const end=job.offset===st.size?pending.length:pending.lastIndexOf(10)+1;
|
|
110
|
+
job.buffer=pending.subarray(end).toString('base64');if(pending.length>DASH_LIMITS.entryBytes&&end===0)throw Error('entry_capacity');
|
|
111
|
+
const text=new TextDecoder('utf-8',{fatal:true}).decode(pending.subarray(0,end));
|
|
112
|
+
for(const raw of text?text.split('\n').slice(0,text.endsWith('\n')?-1:undefined):[]){
|
|
113
|
+
const line=raw.replace(/\r$/,'');let visible=line;
|
|
114
|
+
if(!job.fence&&!/^\s*<!-- ack:log-entry:(?:start|end) -->\s*$/.test(line)){if(job.inComment){const end=visible.indexOf('-->');if(end<0)visible='';else{visible=visible.slice(end+3);job.inComment=false;}}while(visible.includes('<!--')){const start=visible.indexOf('<!--'),end=visible.indexOf('-->',start+4);if(end<0){visible=visible.slice(0,start);job.inComment=true;break;}visible=visible.slice(0,start)+visible.slice(end+3);}}
|
|
115
|
+
const f=visible.match(/^\s*(`{3,}|~{3,})(.*)$/);if(f){if(!job.fence)job.fence=f[1];else if(job.fence[0]===f[1][0]&&f[1].length>=job.fence.length&&!f[2].trim())job.fence=null;}
|
|
116
|
+
if(!job.fence&&!job.inComment&&/^\s*<!-- ack:log-entry:start -->\s*$/.test(line)){if(job.entry)emit(job.entry,file,job.entryLine);job.entry='';job.marked=true;job.line++;continue;}
|
|
117
|
+
const heading=!job.fence&&/^## \d{4}-\d{2}-\d{2}\s*[—–-]/.test(visible);
|
|
118
|
+
if(heading){if(job.entry)emit(job.entry,file,job.entryLine);job.entry=(job.marked?'<!-- ack:log-entry:start -->\n':'')+line+'\n';job.entryLine=job.line-(job.marked?1:0);job.marked=false;}
|
|
119
|
+
else if(job.entry)job.entry+=line+'\n';
|
|
120
|
+
if(Buffer.byteLength(job.entry)>DASH_LIMITS.entryBytes){job.entry='';job.warnings.push('entry_capacity');}job.line++;
|
|
121
|
+
}
|
|
122
|
+
if(signature(root,file)!==sig||fstatSync(fd).mtimeMs!==st.mtimeMs)throw Error('history_changed');
|
|
123
|
+
if(job.offset===st.size){if(job.entry)emit(job.entry,file,job.entryLine);if(job.marked||job.fence||job.inComment)job.warnings.push('incomplete_entry');job.index++;job.offset=0;job.line=1;job.entry='';job.buffer='';job.fence=null;job.marked=false;job.inComment=false;fileBudget--;}
|
|
124
|
+
}catch(e){if(e.message==='history_changed')throw e;job.warnings.push(e.message==='boundary'?'boundary':'history_unreadable');job.index++;job.offset=0;job.line=1;job.entry='';job.buffer='';job.fence=null;job.marked=false;fileBudget--;}
|
|
125
|
+
finally{if(fd!==undefined)closeSync(fd);}
|
|
126
|
+
}
|
|
127
|
+
job.queue.sort((a,b)=>b.date.localeCompare(a.date));const items=job.queue.splice(0,DASH_LIMITS.historyPage);const complete=job.index>=job.files.length&&!job.queue.length;
|
|
128
|
+
// Cap remembered deduplication identities; explicit coverage warning instead of silent unbounded growth.
|
|
129
|
+
if(Object.keys(job.seen).length>10000){job.warnings.push('history_capacity');job.index=job.files.length;job.queue=[];}
|
|
130
|
+
let next=null;if(!complete&&Object.keys(job.seen).length<=10000){next=digest(q+Date.now()+Math.random());job.created=Date.now();if(cursors.size>=DASH_LIMITS.cursors)cursors.delete(cursors.keys().next().value);cursors.set(next,job);}
|
|
131
|
+
return{items,next,complete:complete&&!job.warnings.length,warnings:[...new Set(job.warnings)],bytesRead:DASH_LIMITS.historyBytes-budget,filesChecked:job.index,totalFiles:job.files.length,range:{from,to},revision};
|
|
132
|
+
}
|
|
133
|
+
return{refresh,snapshot,document,history};
|
|
134
|
+
}
|
package/bin/progress/icons.svg
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg"><symbol id="document" viewBox="0 0 24 24">
|
|
2
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"/>
|
|
3
|
-
</symbol>
|
|
4
|
-
<symbol id="clock" viewBox="0 0 24 24">
|
|
5
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
|
|
6
|
-
</symbol>
|
|
7
|
-
<symbol id="check" viewBox="0 0 24 24">
|
|
8
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 0 1-1.043 3.296 3.745 3.745 0 0 1-3.296 1.043A3.745 3.745 0 0 1 12 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 0 1-3.296-1.043 3.745 3.745 0 0 1-1.043-3.296A3.745 3.745 0 0 1 3 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 0 1 1.043-3.296 3.746 3.746 0 0 1 3.296-1.043A3.746 3.746 0 0 1 12 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 0 1 3.296 1.043 3.746 3.746 0 0 1 1.043 3.296A3.745 3.745 0 0 1 21 12Z"/>
|
|
9
|
-
</symbol>
|
|
10
|
-
<symbol id="search" viewBox="0 0 24 24">
|
|
11
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/>
|
|
12
|
-
</symbol>
|
|
13
|
-
<symbol id="close" viewBox="0 0 24 24">
|
|
14
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
15
|
-
</symbol>
|
|
16
|
-
<symbol id="arrow" viewBox="0 0 24 24">
|
|
17
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"/>
|
|
18
|
-
</symbol>
|
|
19
|
-
<symbol id="grid" viewBox="0 0 24 24">
|
|
20
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"/>
|
|
21
|
-
</symbol>
|
|
22
|
-
<symbol id="archive" viewBox="0 0 24 24">
|
|
23
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"/>
|
|
24
|
-
</symbol>
|
|
25
|
-
<symbol id="map" viewBox="0 0 24 24">
|
|
26
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z"/>
|
|
27
|
-
</symbol>
|
|
28
|
-
<symbol id="calendar" viewBox="0 0 24 24">
|
|
29
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"/>
|
|
30
|
-
</symbol>
|
|
31
|
-
<symbol id="link" viewBox="0 0 24 24">
|
|
32
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"/>
|
|
33
|
-
</symbol>
|
|
34
|
-
<symbol id="copy" viewBox="0 0 24 24">
|
|
35
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"/>
|
|
36
|
-
</symbol></svg>
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg"><symbol id="document" viewBox="0 0 24 24">
|
|
2
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"/>
|
|
3
|
+
</symbol>
|
|
4
|
+
<symbol id="clock" viewBox="0 0 24 24">
|
|
5
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/>
|
|
6
|
+
</symbol>
|
|
7
|
+
<symbol id="check" viewBox="0 0 24 24">
|
|
8
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75 11.25 15 15 9.75M21 12c0 1.268-.63 2.39-1.593 3.068a3.745 3.745 0 0 1-1.043 3.296 3.745 3.745 0 0 1-3.296 1.043A3.745 3.745 0 0 1 12 21c-1.268 0-2.39-.63-3.068-1.593a3.746 3.746 0 0 1-3.296-1.043 3.745 3.745 0 0 1-1.043-3.296A3.745 3.745 0 0 1 3 12c0-1.268.63-2.39 1.593-3.068a3.745 3.745 0 0 1 1.043-3.296 3.746 3.746 0 0 1 3.296-1.043A3.746 3.746 0 0 1 12 3c1.268 0 2.39.63 3.068 1.593a3.746 3.746 0 0 1 3.296 1.043 3.746 3.746 0 0 1 1.043 3.296A3.745 3.745 0 0 1 21 12Z"/>
|
|
9
|
+
</symbol>
|
|
10
|
+
<symbol id="search" viewBox="0 0 24 24">
|
|
11
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"/>
|
|
12
|
+
</symbol>
|
|
13
|
+
<symbol id="close" viewBox="0 0 24 24">
|
|
14
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"/>
|
|
15
|
+
</symbol>
|
|
16
|
+
<symbol id="arrow" viewBox="0 0 24 24">
|
|
17
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"/>
|
|
18
|
+
</symbol>
|
|
19
|
+
<symbol id="grid" viewBox="0 0 24 24">
|
|
20
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25A2.25 2.25 0 0 1 13.5 18v-2.25Z"/>
|
|
21
|
+
</symbol>
|
|
22
|
+
<symbol id="archive" viewBox="0 0 24 24">
|
|
23
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"/>
|
|
24
|
+
</symbol>
|
|
25
|
+
<symbol id="map" viewBox="0 0 24 24">
|
|
26
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z"/>
|
|
27
|
+
</symbol>
|
|
28
|
+
<symbol id="calendar" viewBox="0 0 24 24">
|
|
29
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"/>
|
|
30
|
+
</symbol>
|
|
31
|
+
<symbol id="link" viewBox="0 0 24 24">
|
|
32
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 0 1 1.242 7.244l-4.5 4.5a4.5 4.5 0 0 1-6.364-6.364l1.757-1.757m13.35-.622 1.757-1.757a4.5 4.5 0 0 0-6.364-6.364l-4.5 4.5a4.5 4.5 0 0 0 1.242 7.244"/>
|
|
33
|
+
</symbol>
|
|
34
|
+
<symbol id="copy" viewBox="0 0 24 24">
|
|
35
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"/>
|
|
36
|
+
</symbol></svg>
|
package/bin/progress/index.html
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="zh-Hant">
|
|
3
|
-
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>專案總覽 · Agent Handoff Kit</title><link rel="icon" href="agent-handoff-kit-logo2-256.png"><link rel="stylesheet" href="styles.css"><script src="renderer.js" defer></script></head>
|
|
4
|
-
<body>
|
|
5
|
-
<a class="skip" href="#main" data-i18n="skip">跳到內容</a>
|
|
6
|
-
<header class="brandbar"><a class="brand" href="#overview"><img src="agent-handoff-kit-logo2-256.png" alt="" width="48" height="48"><span class="brand-label"><span>Agent Handoff Kit</span><small id="kit-version" class="kit-version"></small></span></a><nav aria-label="主要頁面 / Main navigation"><a href="#overview" data-view="overview" data-i18n="overview">總覽</a><a href="#history" data-view="history" data-i18n="history">歷程</a><a href="#documents" data-view="documents" data-i18n="documents">文件地圖</a></nav><div class="tools"><span id="sync" role="status"></span><select id="language" aria-label="介面語言 / Interface language"><option value="zh-Hant">繁中</option><option value="en">English</option></select></div></header>
|
|
7
|
-
<main id="main">
|
|
8
|
-
<p id="warning" class="warning" hidden role="status"></p>
|
|
9
|
-
<section id="overview-view" class="view" aria-labelledby="project-title">
|
|
10
|
-
<header class="project"><div class="project-copy"><p class="eyebrow" data-i18n="project">專案工作總覽</p><h1 id="project-title"></h1></div><img class="project-art" src="dashboard-hero.png" width="1536" height="1024" alt="" decoding="async"><div class="project-meta"><button id="freshness" class="quiet" data-action="sources"></button><button id="recorded-current" class="recorded-current quiet" data-document="handoff"></button></div></header>
|
|
11
|
-
<p id="empty" class="empty" hidden data-i18n="empty"></p>
|
|
12
|
-
<section class="journey" aria-labelledby="journey-title"><h2 id="journey-title" class="journey-label" data-i18n="workstreams">工作主線</h2><p id="work-scope" class="scope-note" hidden></p><div id="work-route" class="work-route"></div><button id="more-work" class="text-link" hidden data-action="all-work"></button><div id="focus" class="focus-panel"></div></section>
|
|
13
|
-
<div class="overview-grid">
|
|
14
|
-
<section class="panel recent-panel"><header class="section-heading"><h2><svg aria-hidden="true"><use href="icons.svg#clock"></use></svg><span data-i18n="recent">最近變更</span></h2><a href="#history" class="text-link" data-i18n="viewHistory">查看歷程</a></header><div id="recent-list" class="recent-list"></div></section>
|
|
15
|
-
<section class="panel outstanding-panel"><header class="section-heading"><h2><svg aria-hidden="true"><use href="icons.svg#check"></use></svg><span data-i18n="outstanding">待辦事項</span></h2><button data-action="all-work" class="text-link" data-i18n="allWork">全部工作</button></header><div class="pending-columns"><div id="pending-list"></div><div class="results"><h3 data-i18n="results">成果與參考</h3><div id="result-list"></div></div></div></section>
|
|
16
|
-
</div>
|
|
17
|
-
<section class="document-strip panel"><div class="strip-intro"><h2 data-i18n="documentRelations">文件關係</h2><p data-i18n="documentIntro">從目前交接,找回紀錄與依據。</p></div><div id="document-strip"></div><a href="#documents" class="text-link" data-i18n="viewMap">查看地圖</a></section>
|
|
18
|
-
</section>
|
|
19
|
-
<section id="history-view" class="view" hidden aria-labelledby="history-title"><header class="view-header"><div><p class="eyebrow" id="history-project"></p><h1 id="history-title" data-i18n="projectHistory">專案歷程</h1><p data-i18n="historyIntro">找回每次改變與交接的脈絡。</p></div></header>
|
|
20
|
-
<form id="history-filter" class="filterbar"><div class="segmented"><button type="button" data-days="7" data-i18n="last7">近7日</button><button type="button" data-days="30" data-i18n="last30">近30日</button><button type="button" data-days="all" data-i18n="allDates">全部日期</button></div><label><span data-i18n="from">由</span><input id="from" type="date"></label><label><span data-i18n="to">至</span><input id="to" type="date"></label><label><select id="history-work" aria-label="工作線 / Workstream"></select></label><label class="search-label"><svg aria-hidden="true"><use href="icons.svg#search"></use></svg><input id="search" type="search" maxlength="100" data-placeholder="search" aria-label="查找紀錄 / Search records"></label><button class="primary" type="submit" data-i18n="apply">查看</button></form>
|
|
21
|
-
<p class="scope-note" data-i18n="dateBoundary">日期只篩選歷程,目前未完事項不受影響。</p><div id="history-status" class="scope-note" role="status"></div><div id="history-list" class="timeline"></div><button id="history-more" class="secondary" hidden data-i18n="loadMore">載入更多紀錄</button>
|
|
22
|
-
</section>
|
|
23
|
-
<section id="documents-view" class="view" hidden aria-labelledby="documents-title"><header class="view-header"><div><p class="eyebrow" id="documents-project"></p><h1 id="documents-title" data-i18n="documentsHeading">文件各司其職</h1><p data-i18n="documentsIntro">點選文件,查看用途、來源與相關紀錄。</p></div><div class="segmented"><button id="map-mode" aria-pressed="true" data-i18n="map">地圖</button><button id="list-mode" aria-pressed="false" data-i18n="list">清單</button></div></header><p id="document-status" class="scope-note"></p><div id="document-map" class="document-map"></div><div id="map-detail" class="map-detail panel"></div><div id="document-list" class="document-list" hidden></div><p class="scope-note" data-i18n="mapBoundary">連線表示已記錄的文件角色或關係;不代表已驗收。</p></section>
|
|
24
|
-
<footer>
|
|
25
|
-
<div class="footer-note"><p data-i18n="boundary">依已保存紀錄更新;未保存的工作不會出現在這裏。</p><button class="quiet" data-action="sources" data-i18n="sources">資料依據</button></div>
|
|
26
|
-
<div class="footer-credit"><div class="creator"><span data-i18n="creatorRole">作者|AI 生活策展人</span><strong>Adam Chan</strong></div><div class="creator-links" role="group" aria-label="作者與專案 / Creator and project"><a class="creator-link" href="https://www.facebook.com/chan.adam" target="_blank" rel="noopener noreferrer">Facebook</a><a class="creator-link" href="https://github.com/Adamchanadam/agent-handoff-kit" target="_blank" rel="noopener noreferrer">Agent Handoff Kit · GitHub</a></div></div>
|
|
27
|
-
</footer>
|
|
28
|
-
<noscript><p class="warning">請啟用 JavaScript 以讀取紀錄。 / Please enable JavaScript to load records.</p></noscript>
|
|
29
|
-
</main>
|
|
30
|
-
<dialog id="drawer" aria-labelledby="drawer-title"><header><div><p id="drawer-kicker" class="eyebrow"></p><h2 id="drawer-title"></h2></div><button id="close" class="icon-button" aria-label="關閉 / Close"><svg aria-hidden="true"><use href="icons.svg#close"></use></svg></button></header><div id="drawer-content"></div></dialog><div id="announcement" class="sr-only" role="status" aria-live="polite"></div>
|
|
31
|
-
</body></html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-Hant">
|
|
3
|
+
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>專案總覽 · Agent Handoff Kit</title><link rel="icon" href="agent-handoff-kit-logo2-256.png"><link rel="stylesheet" href="styles.css"><script src="renderer.js" defer></script></head>
|
|
4
|
+
<body>
|
|
5
|
+
<a class="skip" href="#main" data-i18n="skip">跳到內容</a>
|
|
6
|
+
<header class="brandbar"><a class="brand" href="#overview"><img src="agent-handoff-kit-logo2-256.png" alt="" width="48" height="48"><span class="brand-label"><span>Agent Handoff Kit</span><small id="kit-version" class="kit-version"></small></span></a><nav aria-label="主要頁面 / Main navigation"><a href="#overview" data-view="overview" data-i18n="overview">總覽</a><a href="#history" data-view="history" data-i18n="history">歷程</a><a href="#documents" data-view="documents" data-i18n="documents">文件地圖</a></nav><div class="tools"><span id="sync" role="status"></span><select id="language" aria-label="介面語言 / Interface language"><option value="zh-Hant">繁中</option><option value="en">English</option></select></div></header>
|
|
7
|
+
<main id="main">
|
|
8
|
+
<p id="warning" class="warning" hidden role="status"></p>
|
|
9
|
+
<section id="overview-view" class="view" aria-labelledby="project-title">
|
|
10
|
+
<header class="project"><div class="project-copy"><p class="eyebrow" data-i18n="project">專案工作總覽</p><h1 id="project-title"></h1></div><img class="project-art" src="dashboard-hero.png" width="1536" height="1024" alt="" decoding="async"><div class="project-meta"><button id="freshness" class="quiet" data-action="sources"></button><button id="recorded-current" class="recorded-current quiet" data-document="handoff"></button></div></header>
|
|
11
|
+
<p id="empty" class="empty" hidden data-i18n="empty"></p>
|
|
12
|
+
<section class="journey" aria-labelledby="journey-title"><h2 id="journey-title" class="journey-label" data-i18n="workstreams">工作主線</h2><p id="work-scope" class="scope-note" hidden></p><div id="work-route" class="work-route"></div><button id="more-work" class="text-link" hidden data-action="all-work"></button><div id="focus" class="focus-panel"></div></section>
|
|
13
|
+
<div class="overview-grid">
|
|
14
|
+
<section class="panel recent-panel"><header class="section-heading"><h2><svg aria-hidden="true"><use href="icons.svg#clock"></use></svg><span data-i18n="recent">最近變更</span></h2><a href="#history" class="text-link" data-i18n="viewHistory">查看歷程</a></header><div id="recent-list" class="recent-list"></div></section>
|
|
15
|
+
<section class="panel outstanding-panel"><header class="section-heading"><h2><svg aria-hidden="true"><use href="icons.svg#check"></use></svg><span data-i18n="outstanding">待辦事項</span></h2><button data-action="all-work" class="text-link" data-i18n="allWork">全部工作</button></header><div class="pending-columns"><div id="pending-list"></div><div class="results"><h3 data-i18n="results">成果與參考</h3><div id="result-list"></div></div></div></section>
|
|
16
|
+
</div>
|
|
17
|
+
<section class="document-strip panel"><div class="strip-intro"><h2 data-i18n="documentRelations">文件關係</h2><p data-i18n="documentIntro">從目前交接,找回紀錄與依據。</p></div><div id="document-strip"></div><a href="#documents" class="text-link" data-i18n="viewMap">查看地圖</a></section>
|
|
18
|
+
</section>
|
|
19
|
+
<section id="history-view" class="view" hidden aria-labelledby="history-title"><header class="view-header"><div><p class="eyebrow" id="history-project"></p><h1 id="history-title" data-i18n="projectHistory">專案歷程</h1><p data-i18n="historyIntro">找回每次改變與交接的脈絡。</p></div></header>
|
|
20
|
+
<form id="history-filter" class="filterbar"><div class="segmented"><button type="button" data-days="7" data-i18n="last7">近7日</button><button type="button" data-days="30" data-i18n="last30">近30日</button><button type="button" data-days="all" data-i18n="allDates">全部日期</button></div><label><span data-i18n="from">由</span><input id="from" type="date"></label><label><span data-i18n="to">至</span><input id="to" type="date"></label><label><select id="history-work" aria-label="工作線 / Workstream"></select></label><label class="search-label"><svg aria-hidden="true"><use href="icons.svg#search"></use></svg><input id="search" type="search" maxlength="100" data-placeholder="search" aria-label="查找紀錄 / Search records"></label><button class="primary" type="submit" data-i18n="apply">查看</button></form>
|
|
21
|
+
<p class="scope-note" data-i18n="dateBoundary">日期只篩選歷程,目前未完事項不受影響。</p><div id="history-status" class="scope-note" role="status"></div><div id="history-list" class="timeline"></div><button id="history-more" class="secondary" hidden data-i18n="loadMore">載入更多紀錄</button>
|
|
22
|
+
</section>
|
|
23
|
+
<section id="documents-view" class="view" hidden aria-labelledby="documents-title"><header class="view-header"><div><p class="eyebrow" id="documents-project"></p><h1 id="documents-title" data-i18n="documentsHeading">文件各司其職</h1><p data-i18n="documentsIntro">點選文件,查看用途、來源與相關紀錄。</p></div><div class="segmented"><button id="map-mode" aria-pressed="true" data-i18n="map">地圖</button><button id="list-mode" aria-pressed="false" data-i18n="list">清單</button></div></header><p id="document-status" class="scope-note"></p><div id="document-map" class="document-map"></div><div id="map-detail" class="map-detail panel"></div><div id="document-list" class="document-list" hidden></div><p class="scope-note" data-i18n="mapBoundary">連線表示已記錄的文件角色或關係;不代表已驗收。</p></section>
|
|
24
|
+
<footer>
|
|
25
|
+
<div class="footer-note"><p data-i18n="boundary">依已保存紀錄更新;未保存的工作不會出現在這裏。</p><button class="quiet" data-action="sources" data-i18n="sources">資料依據</button></div>
|
|
26
|
+
<div class="footer-credit"><div class="creator"><span data-i18n="creatorRole">作者|AI 生活策展人</span><strong>Adam Chan</strong></div><div class="creator-links" role="group" aria-label="作者與專案 / Creator and project"><a class="creator-link" href="https://www.facebook.com/chan.adam" target="_blank" rel="noopener noreferrer">Facebook</a><a class="creator-link" href="https://github.com/Adamchanadam/agent-handoff-kit" target="_blank" rel="noopener noreferrer">Agent Handoff Kit · GitHub</a></div></div>
|
|
27
|
+
</footer>
|
|
28
|
+
<noscript><p class="warning">請啟用 JavaScript 以讀取紀錄。 / Please enable JavaScript to load records.</p></noscript>
|
|
29
|
+
</main>
|
|
30
|
+
<dialog id="drawer" aria-labelledby="drawer-title"><header><div><p id="drawer-kicker" class="eyebrow"></p><h2 id="drawer-title"></h2></div><button id="close" class="icon-button" aria-label="關閉 / Close"><svg aria-hidden="true"><use href="icons.svg#close"></use></svg></button></header><div id="drawer-content"></div></dialog><div id="announcement" class="sr-only" role="status" aria-live="polite"></div>
|
|
31
|
+
</body></html>
|
package/bin/progress/launch.mjs
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// The installed progress entry has no npm, network acquisition or write step.
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import {fileURLToPath} from 'node:url';
|
|
6
|
-
|
|
7
|
-
try {
|
|
8
|
-
const args=process.argv.slice(2),options={port:0,openBrowser:true};let serve=false,version;
|
|
9
|
-
const seen=new Set();
|
|
10
|
-
for(let i=0;i<args.length;i++){
|
|
11
|
-
const arg=args[i];if(seen.has(arg))throw Error('Duplicate progress option');seen.add(arg);
|
|
12
|
-
if(arg==='--no-open')options.openBrowser=false;
|
|
13
|
-
else if(arg==='--serve')serve=true;
|
|
14
|
-
else if(['--root','--port','--version'].includes(arg)){
|
|
15
|
-
const value=args[++i];if(!value||value.startsWith('--'))throw Error('Missing progress option value');
|
|
16
|
-
if(arg==='--root')options.root=path.resolve(value);
|
|
17
|
-
if(arg==='--port'){if(!/^\d{1,5}$/.test(value)||Number(value)>65535)throw Error('Invalid progress port');options.port=Number(value);}
|
|
18
|
-
if(arg==='--version'){if(!/^\d+\.\d+\.\d+$/.test(value))throw Error('Invalid progress version');version=value;}
|
|
19
|
-
}else throw Error('Unknown progress option');
|
|
20
|
-
}
|
|
21
|
-
if(!options.root)throw Error('Select the project with --root');
|
|
22
|
-
const root=options.root;
|
|
23
|
-
if(path.relative(fs.realpathSync(root),root)!=='')throw Error('Linked project root is not supported');
|
|
24
|
-
for(const rel of ['dev','dev/governance_migrations','dev/governance_migrations/.upgrade.lock']){
|
|
25
|
-
const target=path.join(root,rel);let st;try{st=fs.lstatSync(target);}catch(e){if(e.code==='ENOENT')continue;throw e;}
|
|
26
|
-
if(st.isSymbolicLink())throw Error('Linked project state is not supported');
|
|
27
|
-
if(rel.endsWith('.upgrade.lock'))throw Error('Upgrade lock exists; finish upgrade recovery before opening progress');
|
|
28
|
-
if(!st.isDirectory())throw Error('Invalid project state directory');
|
|
29
|
-
}
|
|
30
|
-
const directory=path.dirname(fileURLToPath(import.meta.url));
|
|
31
|
-
if(path.relative(fs.realpathSync(directory),directory)!=='')throw Error('Linked progress program is not supported');
|
|
32
|
-
for(const name of ['assets','open','server','projection','dashboard','project-version','launch']){
|
|
33
|
-
const st=fs.lstatSync(path.join(directory,name+'.mjs'));if(st.isSymbolicLink()||!st.isFile())throw Error('Progress program is incomplete or linked');
|
|
34
|
-
}
|
|
35
|
-
const assets=await import('./assets.mjs');
|
|
36
|
-
if(assets.installed&&path.relative(root,path.resolve(directory,'../..'))!=='')throw Error('Progress entry belongs to a different project');
|
|
37
|
-
options.version=version??assets.runtimeVersion;
|
|
38
|
-
if(serve){const {startProgress}=await import('./server.mjs');await startProgress(options);}
|
|
39
|
-
else{const {openProgress}=await import('./open.mjs');const result=await openProgress(options);console.log(JSON.stringify(result));}
|
|
40
|
-
}catch(e){console.error('Progress could not open: '+e.message);process.exitCode=1;}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The installed progress entry has no npm, network acquisition or write step.
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import {fileURLToPath} from 'node:url';
|
|
6
|
+
|
|
7
|
+
try {
|
|
8
|
+
const args=process.argv.slice(2),options={port:0,openBrowser:true};let serve=false,version;
|
|
9
|
+
const seen=new Set();
|
|
10
|
+
for(let i=0;i<args.length;i++){
|
|
11
|
+
const arg=args[i];if(seen.has(arg))throw Error('Duplicate progress option');seen.add(arg);
|
|
12
|
+
if(arg==='--no-open')options.openBrowser=false;
|
|
13
|
+
else if(arg==='--serve')serve=true;
|
|
14
|
+
else if(['--root','--port','--version'].includes(arg)){
|
|
15
|
+
const value=args[++i];if(!value||value.startsWith('--'))throw Error('Missing progress option value');
|
|
16
|
+
if(arg==='--root')options.root=path.resolve(value);
|
|
17
|
+
if(arg==='--port'){if(!/^\d{1,5}$/.test(value)||Number(value)>65535)throw Error('Invalid progress port');options.port=Number(value);}
|
|
18
|
+
if(arg==='--version'){if(!/^\d+\.\d+\.\d+$/.test(value))throw Error('Invalid progress version');version=value;}
|
|
19
|
+
}else throw Error('Unknown progress option');
|
|
20
|
+
}
|
|
21
|
+
if(!options.root)throw Error('Select the project with --root');
|
|
22
|
+
const root=options.root;
|
|
23
|
+
if(path.relative(fs.realpathSync(root),root)!=='')throw Error('Linked project root is not supported');
|
|
24
|
+
for(const rel of ['dev','dev/governance_migrations','dev/governance_migrations/.upgrade.lock']){
|
|
25
|
+
const target=path.join(root,rel);let st;try{st=fs.lstatSync(target);}catch(e){if(e.code==='ENOENT')continue;throw e;}
|
|
26
|
+
if(st.isSymbolicLink())throw Error('Linked project state is not supported');
|
|
27
|
+
if(rel.endsWith('.upgrade.lock'))throw Error('Upgrade lock exists; finish upgrade recovery before opening progress');
|
|
28
|
+
if(!st.isDirectory())throw Error('Invalid project state directory');
|
|
29
|
+
}
|
|
30
|
+
const directory=path.dirname(fileURLToPath(import.meta.url));
|
|
31
|
+
if(path.relative(fs.realpathSync(directory),directory)!=='')throw Error('Linked progress program is not supported');
|
|
32
|
+
for(const name of ['assets','open','server','projection','dashboard','project-version','launch']){
|
|
33
|
+
const st=fs.lstatSync(path.join(directory,name+'.mjs'));if(st.isSymbolicLink()||!st.isFile())throw Error('Progress program is incomplete or linked');
|
|
34
|
+
}
|
|
35
|
+
const assets=await import('./assets.mjs');
|
|
36
|
+
if(assets.installed&&path.relative(root,path.resolve(directory,'../..'))!=='')throw Error('Progress entry belongs to a different project');
|
|
37
|
+
options.version=version??assets.runtimeVersion;
|
|
38
|
+
if(serve){const {startProgress}=await import('./server.mjs');await startProgress(options);}
|
|
39
|
+
else{const {openProgress}=await import('./open.mjs');const result=await openProgress(options);console.log(JSON.stringify(result));}
|
|
40
|
+
}catch(e){console.error('Progress could not open: '+e.message);process.exitCode=1;}
|