@h1r-ai/croche-cli 0.5.5 → 0.6.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/README.md +267 -148
- package/THIRD-PARTY-NOTICES +7 -8
- package/dist/bin.js +29 -25
- package/dist/chunk-66EUX7EL.js +165 -0
- package/dist/chunk-DKT5HHSB.js +532 -0
- package/dist/chunk-K3UDT4EM.js +3110 -0
- package/dist/collector-credential.d.ts +9 -0
- package/dist/config-authoring.d.ts +19 -0
- package/dist/config-bases.d.ts +17 -0
- package/dist/config-push-base-35HX67AJ.js +2254 -0
- package/dist/config-push-base.d.ts +7 -0
- package/dist/control-address.d.ts +2 -0
- package/dist/control-server.d.ts +12 -15
- package/dist/control-server.js +9 -288
- package/dist/control-v2-auth.d.ts +24 -0
- package/dist/control-v2-capture.d.ts +34 -0
- package/dist/control-v2-json.d.ts +15 -0
- package/dist/control-v2-state.d.ts +90 -0
- package/dist/credentials.d.ts +2 -2
- package/dist/debugger/public/index.html +1 -0
- package/dist/debugger/public/stage-control.js +84 -0
- package/dist/debugger/public/stage-manifest.js +45 -0
- package/dist/debugger/public/stage-model.js +103 -0
- package/dist/debugger/public/stage-targets.js +18 -0
- package/dist/debugger/public/stage.css +459 -0
- package/dist/debugger/public/stage.html +17 -0
- package/dist/debugger/public/stage.js +113 -0
- package/dist/debugger/server/collector.js +42 -26
- package/dist/debugger/server/control-bridge.js +113 -0
- package/dist/debugger/server/server.js +10 -1
- package/dist/debugger/server/viewer-security.js +12 -0
- package/dist/debugger.d.ts +16 -6
- package/dist/index.d.ts +8 -1
- package/dist/index.js +17 -321
- package/dist/json-result.d.ts +2 -0
- package/package.json +2 -1
- package/dist/config.js +0 -100
- package/dist/control-client.js +0 -65
- package/dist/core-defaults.js +0 -2
- package/dist/credentials.js +0 -136
- package/dist/debug-keys.js +0 -141
- package/dist/debugger.js +0 -469
- package/dist/help.js +0 -158
- package/dist/text-file.js +0 -15
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// J5: browser-local runner labels, not a Runtime field or a Cloud record.
|
|
2
|
+
const object = value => value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
3
|
+
const field = value => typeof value === 'string' && value.trim().length > 0 && value.length <= 256 && !/[\u0000-\u001f\u007f]/.test(value);
|
|
4
|
+
const pair = row => JSON.stringify([row.runtimeInstanceId,row.sessionId]);
|
|
5
|
+
|
|
6
|
+
export async function readStageManifestFile(file) {
|
|
7
|
+
if (file.size > 1024*1024) throw new Error('Use a manifest no larger than 1 MiB.');
|
|
8
|
+
return readStageManifest(JSON.parse(await file.text()));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function readStageManifest(raw) {
|
|
12
|
+
const value = object(raw);
|
|
13
|
+
if (value.format !== 'croche-vu-stage-v1' || !field(value.run_id) || !Array.isArray(value.rows) || value.rows.length > 200) throw new Error('Use a croche-vu-stage-v1 manifest with at most 200 rows.');
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const rows = value.rows.map(rawRow => {
|
|
16
|
+
const row = object(rawRow);
|
|
17
|
+
for (const key of ['runtimeInstanceId','sessionId','persona_name','scenario_kind','scenario_title']) if (!field(row[key])) throw new Error('A manifest row has a missing or invalid label or identity.');
|
|
18
|
+
if (!Number.isSafeInteger(row.steps_total) || row.steps_total < 1 || row.steps_total > 1000 || !Array.isArray(row.input_ids) || row.input_ids.length > row.steps_total || !row.input_ids.every(field) || new Set(row.input_ids).size !== row.input_ids.length) throw new Error('Use 1–1000 steps and unique input IDs for each row.');
|
|
19
|
+
const id = pair(row);
|
|
20
|
+
if (seen.has(id)) throw new Error('Two manifest rows name the same Runtime and session.');
|
|
21
|
+
seen.add(id);
|
|
22
|
+
return {runtimeInstanceId:row.runtimeInstanceId,sessionId:row.sessionId,persona_name:row.persona_name,scenario_kind:row.scenario_kind,scenario_title:row.scenario_title,steps_total:row.steps_total,input_ids:[...row.input_ids]};
|
|
23
|
+
});
|
|
24
|
+
return {format:value.format,run_id:value.run_id,rows};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function manifestLabels(manifest, events) {
|
|
28
|
+
const labels = new Map();
|
|
29
|
+
if (!manifest) return labels;
|
|
30
|
+
const admitted = new Map();
|
|
31
|
+
for (const raw of events) {
|
|
32
|
+
const event = object(raw);
|
|
33
|
+
if (event.type !== 'input.received') continue;
|
|
34
|
+
const id = object(object(event.data).input).id;
|
|
35
|
+
if (typeof id !== 'string') continue;
|
|
36
|
+
const key = pair(event), ids = admitted.get(key) || new Set();
|
|
37
|
+
ids.add(id); admitted.set(key,ids);
|
|
38
|
+
}
|
|
39
|
+
for (const row of manifest.rows) {
|
|
40
|
+
const key = pair(row), received = admitted.get(key);
|
|
41
|
+
const progress = row.input_ids.filter(id => received?.has(id)).length;
|
|
42
|
+
labels.set(key,`${row.persona_name} · ${row.scenario_title} · ${progress}/${row.steps_total}`);
|
|
43
|
+
}
|
|
44
|
+
return labels;
|
|
45
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const obj=v=>v&&typeof v==='object'&&!Array.isArray(v)?v:{};
|
|
2
|
+
const str=v=>typeof v==='string'?v:'';
|
|
3
|
+
const clip=v=>(typeof v==='string'?v:JSON.stringify(v)??'').slice(0,180);
|
|
4
|
+
const ownerKey=e=>[e.projectId,e.runtimeInstanceId,e.sessionId,e.agentId,e.openSequence];
|
|
5
|
+
const callKey=e=>e.callId?JSON.stringify([...ownerKey(e),e.turnId,e.callId]):null;
|
|
6
|
+
const operationKey=e=>e.operationId?JSON.stringify([...ownerKey(e),e.operationId]):null;
|
|
7
|
+
function toolLabel(data,related=[]){
|
|
8
|
+
const explicit=[str(data.tool),str(data.command)].filter(Boolean).join(' ');
|
|
9
|
+
if(explicit)return explicit;
|
|
10
|
+
const requested=related.find(event=>event.type==='tool.requested'&&inspectable(event));
|
|
11
|
+
try{
|
|
12
|
+
const args=typeof requested?.data?.arguments==='string'?JSON.parse(requested.data.arguments):obj(requested?.data?.arguments);
|
|
13
|
+
const command=str(args.command_line)||str(args.cmd);
|
|
14
|
+
// Only literal leading name tokens, never infer a command from error prose.
|
|
15
|
+
const names=command.match(/^\s*([a-zA-Z0-9_.-]+)(?:\s+([a-zA-Z0-9_.-]+))?/);
|
|
16
|
+
if(names)return names.slice(1).filter(Boolean).join(' ');
|
|
17
|
+
}catch{}
|
|
18
|
+
return str(data.name)||'tool';
|
|
19
|
+
}
|
|
20
|
+
function shortFailure(error){
|
|
21
|
+
const value=(typeof error==='string'?error:str(error?.message)||str(error?.code)).replace(/\s+/g,' ').trim().split(/\s+Usage:/)[0];
|
|
22
|
+
if(!value||value==='failed')return '';
|
|
23
|
+
return ': '+(value.length>90?value.slice(0,87)+'…':value);
|
|
24
|
+
}
|
|
25
|
+
export function inputBubbles(event){
|
|
26
|
+
const input=obj(event.data?.input),parts=Array.isArray(input.input)?input.input:[];
|
|
27
|
+
const textParts=parts.filter(part=>part.type==='text'&&typeof part.text==='string');
|
|
28
|
+
return (textParts.length?textParts:[{kind:input.kind||'user',text:str(input.text)}]).map(part=>({
|
|
29
|
+
kind:part.kind==='app_state'?'app state':['app_event','event'].includes(part.kind)?'app event':part.kind==='user'?'user':str(part.kind)||'input',
|
|
30
|
+
text:part.text,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
export function flowCost(events){
|
|
34
|
+
const calls=new Map();
|
|
35
|
+
for(const e of events)if(inspectable(e)&&['model.request','model.response'].includes(e.type)){
|
|
36
|
+
const id=operationKey(e)||e.id;if(!calls.has(id))calls.set(id,null);
|
|
37
|
+
if(e.type==='model.response'){
|
|
38
|
+
const value=e.data?.usage?.cost;
|
|
39
|
+
calls.set(id,typeof value==='number'&&Number.isFinite(value)&&value>=0?value:null);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const known=[...calls.values()].filter(value=>value!==null),sum=known.reduce((a,b)=>a+b,0);
|
|
43
|
+
return {calls:calls.size,cost:known.length&&Number.isFinite(sum)?sum:null,partial:known.length<calls.size};
|
|
44
|
+
}
|
|
45
|
+
export function inspectable(e){
|
|
46
|
+
if(e.visibility!=='runtime')return false;
|
|
47
|
+
// Runtime model diagnostics carry counts and fingerprints, never request content.
|
|
48
|
+
// Refuse the whole unexpected body-bearing diagnostic rather than rewrite its raw detail.
|
|
49
|
+
const contentKeys=new Set(['body','prompt','prompts','system','messages','sharedMessages','content','text','request','response']);
|
|
50
|
+
const hasContent=value=>value&&typeof value==='object'&&Object.entries(value).some(([key,child])=>
|
|
51
|
+
(contentKeys.has(key)&&child!==null&&typeof child==='object')||
|
|
52
|
+
(contentKeys.has(key)&&typeof child==='string')||hasContent(child));
|
|
53
|
+
return !(e.type.startsWith('model.')&&(hasContent(e.data)||
|
|
54
|
+
(Object.hasOwn(obj(e.data),'tools')&&!/^sha256:[a-f0-9]{64}$/.test(e.data.tools))));
|
|
55
|
+
}
|
|
56
|
+
export function flowRows(events,all=false){
|
|
57
|
+
const starts=new Map(),calls=new Map(),operations=new Map();
|
|
58
|
+
for(const e of events){
|
|
59
|
+
const call=callKey(e),operation=operationKey(e);
|
|
60
|
+
if(call){if(!calls.has(call))calls.set(call,[]);calls.get(call).push(e);}
|
|
61
|
+
if(operation){if(!operations.has(operation))operations.set(operation,[]);operations.get(operation).push(e);}
|
|
62
|
+
if(e.type==='tool.started'&&call)starts.set(call,e);
|
|
63
|
+
}
|
|
64
|
+
const rows=[];
|
|
65
|
+
for(const e of events){
|
|
66
|
+
if(!inspectable(e)){
|
|
67
|
+
rows.push({event:e,related:[e],direction:'Croche',title:'Detail withheld',preview:'Non-runtime visibility or unexpected model content.',category:'withheld'});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const d=obj(e.data),start=starts.get(callKey(e)),sd=obj(start?.data);
|
|
71
|
+
if(start&&['tool.completed','tool.failed'].includes(e.type))continue;
|
|
72
|
+
const operationEvents=operations.get(operationKey(e))||[e];
|
|
73
|
+
if(!all&&e.type==='model.response'&&e.operationId&&operationEvents.some(other=>other.type==='model.request'))continue;
|
|
74
|
+
let direction='Croche',title=e.type,preview='',category='diagnostic';
|
|
75
|
+
if(e.type==='input.received'){
|
|
76
|
+
const input=obj(d.input);
|
|
77
|
+
direction='App → Croche';title='Input';category='input';
|
|
78
|
+
preview=clip(input.text);
|
|
79
|
+
}else if(e.type==='model.request'){
|
|
80
|
+
direction='Croche';title=all?'LLM request':'LLM call';preview=str(d.model);category='model';
|
|
81
|
+
if(!all){const response=operationEvents.find(other=>other.type==='model.response'),usage=obj(response?.data?.usage);preview+=` · ${usage.prompt_tokens??'—'} in / ${usage.completion_tokens??'—'} out · $${usage.cost??'—'}`;}
|
|
82
|
+
}else if(e.type==='model.response'){
|
|
83
|
+
const u=obj(d.usage);direction='Model → Croche';title='LLM response';category='model';
|
|
84
|
+
preview=`${str(d.model)} · input ${u.prompt_tokens??'—'} / output ${u.completion_tokens??'—'} · $${u.cost??'—'}`;
|
|
85
|
+
}else if(e.type==='tool.started'){
|
|
86
|
+
const end=calls.get(callKey(e))?.findLast(event=>['tool.completed','tool.failed'].includes(event.type));
|
|
87
|
+
const outcome=!end?'running':end.type==='tool.failed'||end.data?.result?.ok===false?'failed':'ok';
|
|
88
|
+
direction='Croche → App';title=toolLabel(d,calls.get(callKey(e)))+' → '+outcome+(outcome==='failed'?shortFailure(end?.data?.error??end?.data?.result?.error):'');preview='';category='tool';
|
|
89
|
+
}else if(e.type==='tool.completed'){
|
|
90
|
+
direction='Croche';title=toolLabel(d,calls.get(callKey(e)))+' → '+(d.result?.ok===false?'failed'+shortFailure(d.result.error):'ok');preview='';category='tool';
|
|
91
|
+
}else if(e.type==='tool.failed'){
|
|
92
|
+
direction='Croche';title=toolLabel(start?sd:d,calls.get(callKey(e)))+' → failed'+shortFailure(d.error);category='failed';preview='';
|
|
93
|
+
}else if(e.type==='marker'){
|
|
94
|
+
direction='Croche → App';title='Marker';preview=str(d.name);category='marker';
|
|
95
|
+
}else if(e.type==='turn.completed'){
|
|
96
|
+
direction='Croche → App';title='Reply · '+str(obj(d.result).status);preview=clip(obj(d.result).text);category='reply';
|
|
97
|
+
}
|
|
98
|
+
if(!all&&category==='diagnostic')continue;
|
|
99
|
+
const related=e.callId?calls.get(callKey(e)):e.type==='model.request'&&!all?operationEvents:[e];
|
|
100
|
+
rows.push({event:e,related,direction,title,preview,category});
|
|
101
|
+
}
|
|
102
|
+
return rows;
|
|
103
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Live roster is authority for selection; captured events are never evidence of liveness.
|
|
2
|
+
const id=value=>typeof value==='string'&&/^[A-Za-z0-9_.:-]{1,200}$/.test(value);
|
|
3
|
+
export const agentKey=row=>JSON.stringify([row.agentId,row.instance,row.openSequence??null]);
|
|
4
|
+
export function liveAttachments(value){
|
|
5
|
+
if(!Array.isArray(value))throw Error('Live attachment roster unavailable.');
|
|
6
|
+
const seen=new Set();return value.filter(entry=>entry?.state==='connected').map(entry=>{
|
|
7
|
+
if(!id(entry.attachmentId)||seen.has(entry.attachmentId)||!Array.isArray(entry.agents)||!Array.isArray(entry.capabilities)||entry.capabilities.some(c=>typeof c!=='string'))throw Error('Invalid live attachment roster.');seen.add(entry.attachmentId);
|
|
8
|
+
const pairs=new Set();const agents=entry.agents.map(row=>{
|
|
9
|
+
if(!id(row?.agentId)||(row.instance!==null&&!id(row.instance))||typeof row.open!=='boolean'||(row.open&&(!id(row.runtimeInstanceId)||!Number.isSafeInteger(row.openSequence)||row.openSequence<0)))throw Error('Invalid agent roster.');
|
|
10
|
+
const pair=JSON.stringify([row.agentId,row.instance]);if(pairs.has(pair))throw Error('Ambiguous agent roster.');pairs.add(pair);return row;
|
|
11
|
+
});return {...entry,agents};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function selectedAgent(attachments,attachmentId,key){
|
|
15
|
+
const attachment=attachments.find(a=>a.attachmentId===attachmentId),row=attachment?.agents.find(row=>agentKey(row)===key);
|
|
16
|
+
if(!row?.open)return null;
|
|
17
|
+
return {attachmentId,target:{agentId:row.agentId,instance:row.instance,openSequence:row.openSequence},runtimeInstanceId:row.runtimeInstanceId,capabilities:attachment.capabilities};
|
|
18
|
+
}
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family:
|
|
3
|
+
system-ui,
|
|
4
|
+
-apple-system,
|
|
5
|
+
"Segoe UI",
|
|
6
|
+
sans-serif;
|
|
7
|
+
color-scheme: light dark;
|
|
8
|
+
--bg:#f5f7f6;
|
|
9
|
+
--panel:#fff;
|
|
10
|
+
--ink:#1e3028;
|
|
11
|
+
--muted:#5e7167;
|
|
12
|
+
--line:#dce5df;
|
|
13
|
+
--green:#27724a;
|
|
14
|
+
--blue:#3466ab;
|
|
15
|
+
--red:#a83d38;
|
|
16
|
+
background: var(--bg);
|
|
17
|
+
color: var(--ink);
|
|
18
|
+
}
|
|
19
|
+
* {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
body {
|
|
23
|
+
margin: 0;
|
|
24
|
+
}
|
|
25
|
+
button,
|
|
26
|
+
select,
|
|
27
|
+
input {
|
|
28
|
+
font: inherit;
|
|
29
|
+
}
|
|
30
|
+
button,
|
|
31
|
+
select {
|
|
32
|
+
color: inherit;
|
|
33
|
+
background: var(--panel);
|
|
34
|
+
border: 1px solid var(--line);
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
}
|
|
37
|
+
button {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
button:focus-visible,
|
|
41
|
+
select:focus-visible,
|
|
42
|
+
pre:focus-visible {
|
|
43
|
+
outline: 2px solid var(--blue);
|
|
44
|
+
outline-offset: 3px;
|
|
45
|
+
}
|
|
46
|
+
[hidden] {
|
|
47
|
+
display: none !important;
|
|
48
|
+
}
|
|
49
|
+
.top {
|
|
50
|
+
padding: 18px 24px;
|
|
51
|
+
display: flex;
|
|
52
|
+
justify-content: space-between;
|
|
53
|
+
border-bottom: 1px solid var(--line);
|
|
54
|
+
font-size: .85rem;
|
|
55
|
+
}
|
|
56
|
+
.top b {
|
|
57
|
+
font-size: 1.25rem;
|
|
58
|
+
letter-spacing: -.04em;
|
|
59
|
+
}
|
|
60
|
+
.top b span {
|
|
61
|
+
font-weight: 400;
|
|
62
|
+
color: var(--muted);
|
|
63
|
+
font-size: .9rem;
|
|
64
|
+
letter-spacing: 0;
|
|
65
|
+
}
|
|
66
|
+
#health {
|
|
67
|
+
color: var(--green);
|
|
68
|
+
}
|
|
69
|
+
main {
|
|
70
|
+
padding: 22px 24px;
|
|
71
|
+
max-width: 1800px;
|
|
72
|
+
margin: auto;
|
|
73
|
+
}
|
|
74
|
+
.heading {
|
|
75
|
+
display: flex;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 16px;
|
|
79
|
+
}
|
|
80
|
+
h1 {
|
|
81
|
+
font-size: 1.5rem;
|
|
82
|
+
letter-spacing: -.03em;
|
|
83
|
+
margin: 0 0 6px;
|
|
84
|
+
}
|
|
85
|
+
.heading p {
|
|
86
|
+
color: var(--muted);
|
|
87
|
+
font-size: .875rem;
|
|
88
|
+
margin: 0;
|
|
89
|
+
}
|
|
90
|
+
#summary {
|
|
91
|
+
font-size: .875rem;
|
|
92
|
+
font-variant-numeric: tabular-nums;
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
}
|
|
95
|
+
.toolbar {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
gap: 20px;
|
|
99
|
+
flex-wrap: wrap;
|
|
100
|
+
margin: 22px 0 16px;
|
|
101
|
+
font-size: .8rem;
|
|
102
|
+
color: var(--muted);
|
|
103
|
+
}
|
|
104
|
+
select {
|
|
105
|
+
padding: 7px 10px;
|
|
106
|
+
margin-left: 6px;
|
|
107
|
+
}
|
|
108
|
+
#provenance {
|
|
109
|
+
margin-left: auto;
|
|
110
|
+
font-size: .72rem;
|
|
111
|
+
}
|
|
112
|
+
.workbench {
|
|
113
|
+
align-items: start;
|
|
114
|
+
display: grid;
|
|
115
|
+
grid-template-columns: minmax(0, 1fr);
|
|
116
|
+
gap: 16px;
|
|
117
|
+
}
|
|
118
|
+
.workbench.inspecting {
|
|
119
|
+
grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
|
|
120
|
+
}
|
|
121
|
+
.timeline {
|
|
122
|
+
background: var(--panel);
|
|
123
|
+
border: 1px solid var(--line);
|
|
124
|
+
border-radius: 12px;
|
|
125
|
+
min-width: 0;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
}
|
|
128
|
+
#rows { max-height: calc(100dvh - 285px); overflow-y: auto; overscroll-behavior: contain; }
|
|
129
|
+
.flow-head {
|
|
130
|
+
display: grid;
|
|
131
|
+
grid-template-columns: 170px minmax(0, 1fr) 100px;
|
|
132
|
+
padding: 14px 18px;
|
|
133
|
+
color: var(--muted);
|
|
134
|
+
font-size: .7rem;
|
|
135
|
+
border-bottom: 1px solid var(--line);
|
|
136
|
+
}
|
|
137
|
+
.flow-row {
|
|
138
|
+
display: grid;
|
|
139
|
+
grid-template-columns: 170px minmax(0, 1fr) 100px;
|
|
140
|
+
align-items: center;
|
|
141
|
+
width: 100%;
|
|
142
|
+
border: 0;
|
|
143
|
+
border-bottom: 1px solid var(--line);
|
|
144
|
+
border-radius: 0;
|
|
145
|
+
text-align: left;
|
|
146
|
+
padding: 13px 18px;
|
|
147
|
+
gap: 12px;
|
|
148
|
+
min-height: 66px;
|
|
149
|
+
}
|
|
150
|
+
.flow-row:hover {
|
|
151
|
+
background: var(--bg);
|
|
152
|
+
}
|
|
153
|
+
.flow-row[aria-pressed="true"] { box-shadow: inset 3px 0 var(--blue); }
|
|
154
|
+
.toolbar select { max-width: 240px; }
|
|
155
|
+
.toolbar button { padding: 7px 10px; }
|
|
156
|
+
#label-status { font-size: .72rem; color: var(--muted); }
|
|
157
|
+
.identity {
|
|
158
|
+
display: grid;
|
|
159
|
+
gap: 5px;
|
|
160
|
+
min-width: 0;
|
|
161
|
+
}
|
|
162
|
+
.identity small {
|
|
163
|
+
font-size: .65rem;
|
|
164
|
+
font-weight: 650;
|
|
165
|
+
color: var(--muted);
|
|
166
|
+
}
|
|
167
|
+
.identity b {
|
|
168
|
+
font-size: .85rem;
|
|
169
|
+
font-weight: 650;
|
|
170
|
+
overflow-wrap: anywhere;
|
|
171
|
+
}
|
|
172
|
+
.preview {
|
|
173
|
+
font-size: .875rem;
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
text-overflow: ellipsis;
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
}
|
|
178
|
+
.flow-row time {
|
|
179
|
+
font: .65rem ui-monospace, monospace;
|
|
180
|
+
color: var(--muted);
|
|
181
|
+
text-align: right;
|
|
182
|
+
}
|
|
183
|
+
.input .identity small {
|
|
184
|
+
color: var(--blue);
|
|
185
|
+
}
|
|
186
|
+
.tool .identity small,
|
|
187
|
+
.result .identity small,
|
|
188
|
+
.reply .identity small {
|
|
189
|
+
color: var(--green);
|
|
190
|
+
}
|
|
191
|
+
.failed {
|
|
192
|
+
border-left: 3px solid var(--red);
|
|
193
|
+
}
|
|
194
|
+
.failed .identity b {
|
|
195
|
+
color: var(--red);
|
|
196
|
+
}
|
|
197
|
+
.marker .preview {
|
|
198
|
+
color: var(--green);
|
|
199
|
+
font-family: ui-monospace, monospace;
|
|
200
|
+
}
|
|
201
|
+
.marker .preview::before {
|
|
202
|
+
content: "\25cf ";
|
|
203
|
+
font-size: .6rem;
|
|
204
|
+
}
|
|
205
|
+
.model .preview {
|
|
206
|
+
font-size: .75rem;
|
|
207
|
+
color: var(--muted);
|
|
208
|
+
}
|
|
209
|
+
#inspector {
|
|
210
|
+
background: var(--panel);
|
|
211
|
+
border: 1px solid var(--line);
|
|
212
|
+
border-radius: 12px;
|
|
213
|
+
min-width: 0;
|
|
214
|
+
padding: 18px;
|
|
215
|
+
max-height: calc(100dvh - 220px);
|
|
216
|
+
overflow: auto;
|
|
217
|
+
position: sticky;
|
|
218
|
+
top: 12px;
|
|
219
|
+
}
|
|
220
|
+
.detail-heading {
|
|
221
|
+
display: flex;
|
|
222
|
+
justify-content: space-between;
|
|
223
|
+
gap: 12px;
|
|
224
|
+
align-items: flex-start;
|
|
225
|
+
}
|
|
226
|
+
.detail-heading span {
|
|
227
|
+
font-size: .65rem;
|
|
228
|
+
letter-spacing: .1em;
|
|
229
|
+
color: var(--muted);
|
|
230
|
+
}
|
|
231
|
+
.detail-heading h2 {
|
|
232
|
+
font-size: 1.1rem;
|
|
233
|
+
margin: 8px 0;
|
|
234
|
+
}
|
|
235
|
+
.detail-heading button {
|
|
236
|
+
padding: 3px 10px;
|
|
237
|
+
font-size: 1.2rem;
|
|
238
|
+
}
|
|
239
|
+
.detail-note {
|
|
240
|
+
font-size: .72rem;
|
|
241
|
+
line-height: 1.6;
|
|
242
|
+
color: var(--muted);
|
|
243
|
+
}
|
|
244
|
+
.raw-event {
|
|
245
|
+
border-top: 1px solid var(--line);
|
|
246
|
+
margin-top: 16px;
|
|
247
|
+
padding-top: 4px;
|
|
248
|
+
}
|
|
249
|
+
.raw-event h3 {
|
|
250
|
+
font-size: .75rem;
|
|
251
|
+
font-weight: 600;
|
|
252
|
+
color: var(--green);
|
|
253
|
+
}
|
|
254
|
+
pre {
|
|
255
|
+
font: .72rem/1.7 ui-monospace, monospace;
|
|
256
|
+
white-space: pre-wrap;
|
|
257
|
+
overflow-wrap: anywhere;
|
|
258
|
+
margin: 0;
|
|
259
|
+
}
|
|
260
|
+
.withheld,
|
|
261
|
+
#notice {
|
|
262
|
+
color: var(--red);
|
|
263
|
+
font-size: .8rem;
|
|
264
|
+
}
|
|
265
|
+
.empty {
|
|
266
|
+
padding: 24px;
|
|
267
|
+
color: var(--muted);
|
|
268
|
+
}
|
|
269
|
+
footer {
|
|
270
|
+
font-size: .7rem;
|
|
271
|
+
color: var(--muted);
|
|
272
|
+
margin-top: 18px;
|
|
273
|
+
line-height: 1.6;
|
|
274
|
+
}
|
|
275
|
+
@media (max-width: 1050px) {
|
|
276
|
+
main {
|
|
277
|
+
padding: 20px 16px;
|
|
278
|
+
}
|
|
279
|
+
.flow-head,
|
|
280
|
+
.flow-row {
|
|
281
|
+
grid-template-columns: 145px minmax(0, 1fr) 82px;
|
|
282
|
+
padding-left: 14px;
|
|
283
|
+
padding-right: 14px;
|
|
284
|
+
gap: 10px;
|
|
285
|
+
}
|
|
286
|
+
.workbench.inspecting .flow-head,
|
|
287
|
+
.workbench.inspecting .flow-row {
|
|
288
|
+
grid-template-columns: 130px minmax(0, 1fr);
|
|
289
|
+
}
|
|
290
|
+
.workbench.inspecting time,
|
|
291
|
+
.workbench.inspecting .flow-head span:last-child {
|
|
292
|
+
display: none;
|
|
293
|
+
}
|
|
294
|
+
.workbench.inspecting {
|
|
295
|
+
grid-template-columns: minmax(0, 1fr) 42%;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
@media (min-width: 1500px) {
|
|
299
|
+
.flow-row {
|
|
300
|
+
min-height: 74px;
|
|
301
|
+
}
|
|
302
|
+
.identity b,
|
|
303
|
+
.preview {
|
|
304
|
+
font-size: 1rem;
|
|
305
|
+
}
|
|
306
|
+
.identity small {
|
|
307
|
+
font-size: .75rem;
|
|
308
|
+
}
|
|
309
|
+
pre {
|
|
310
|
+
font-size: .85rem;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
@media (max-width: 700px) {
|
|
314
|
+
.heading {
|
|
315
|
+
align-items: flex-start;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
}
|
|
318
|
+
.toolbar {
|
|
319
|
+
gap: 12px;
|
|
320
|
+
}
|
|
321
|
+
.toolbar #provenance {
|
|
322
|
+
margin-left: 0;
|
|
323
|
+
width: 100%;
|
|
324
|
+
}
|
|
325
|
+
.flow-head,
|
|
326
|
+
.flow-row {
|
|
327
|
+
grid-template-columns: 120px minmax(0, 1fr);
|
|
328
|
+
}
|
|
329
|
+
.flow-row time,
|
|
330
|
+
.flow-head span:last-child {
|
|
331
|
+
display: none;
|
|
332
|
+
}
|
|
333
|
+
.flow-row {
|
|
334
|
+
padding: 12px 10px;
|
|
335
|
+
gap: 10px;
|
|
336
|
+
}
|
|
337
|
+
.workbench.inspecting {
|
|
338
|
+
display: block;
|
|
339
|
+
}
|
|
340
|
+
#inspector {
|
|
341
|
+
position: fixed;
|
|
342
|
+
inset: 0;
|
|
343
|
+
max-height: 100dvh;
|
|
344
|
+
border-radius: 0;
|
|
345
|
+
z-index: 2;
|
|
346
|
+
padding: 24px;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
@media (prefers-color-scheme: dark) {
|
|
350
|
+
:root {
|
|
351
|
+
--bg:#101614;
|
|
352
|
+
--panel:#18201c;
|
|
353
|
+
--ink:#eaf1ec;
|
|
354
|
+
--muted:#a2b5a8;
|
|
355
|
+
--line:#314139;
|
|
356
|
+
--green:#b2e5bf;
|
|
357
|
+
--blue:#a2c7fb;
|
|
358
|
+
--red:#ffaaa3;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
/* Conversation ownership: Croche left, App right. Details remain independent. */
|
|
362
|
+
.flow-head { display: none; }
|
|
363
|
+
#rows { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
|
|
364
|
+
#rows > * { flex-shrink: 0; }
|
|
365
|
+
.flow-row, .workbench.inspecting .flow-row {
|
|
366
|
+
display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
|
|
367
|
+
grid-template-columns: none; min-height: 0; width: fit-content; max-width: 86%;
|
|
368
|
+
border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px;
|
|
369
|
+
}
|
|
370
|
+
.flow-row.croche { margin-right: auto; background: var(--bg); }
|
|
371
|
+
.flow-row.app { margin-left: auto; background: var(--panel); }
|
|
372
|
+
.identity { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
|
|
373
|
+
.identity small { font-size: .65rem; letter-spacing: .02em; }
|
|
374
|
+
.identity b { font-size: .8rem; }
|
|
375
|
+
.preview { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; line-height: 1.65; text-overflow: clip; max-width: 100%; }
|
|
376
|
+
.flow-row time, .workbench.inspecting .flow-row time { display: block; font-size: .6rem; align-self: flex-end; }
|
|
377
|
+
.flow-row.tool, .flow-row.marker, .flow-row.model, .flow-row.diagnostic, .flow-row.withheld {
|
|
378
|
+
border-radius: 8px; padding: 8px 12px; gap: 5px;
|
|
379
|
+
}
|
|
380
|
+
.flow-row.tool .identity small, .flow-row.marker .identity small,
|
|
381
|
+
.flow-row.tool time, .flow-row.marker time { display: none; }
|
|
382
|
+
.flow-row.tool .identity b { font: .8rem ui-monospace, monospace; }
|
|
383
|
+
.flow-row.result .preview { font: .75rem/1.6 ui-monospace, monospace; }
|
|
384
|
+
.reply-group { max-width: 100%; min-width: 0; }
|
|
385
|
+
.reply-markers { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
|
|
386
|
+
.reply-markers .flow-row.marker { flex-direction: row; align-items: baseline; margin: 0; border: 0; padding: 3px 8px; }
|
|
387
|
+
.reply-markers .identity b { font-size: .65rem; font-weight: 500; }
|
|
388
|
+
.reply-markers .preview { font-size: .7rem; }
|
|
389
|
+
.app-state { display: flex; flex-direction: column; gap: 5px; font: .75rem/1.6 ui-monospace, monospace; max-width: 100%; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
|
|
390
|
+
.app-state b { font: 600 .65rem system-ui; color: var(--muted); }
|
|
391
|
+
@media (max-width: 700px) { #rows { padding: 14px; } .flow-row { max-width: 94%; } }
|
|
392
|
+
.composer { border-top: 1px solid var(--line); padding: 16px 20px; font-size: .75rem; }
|
|
393
|
+
.composer details { margin-bottom: 12px; color: var(--muted); }
|
|
394
|
+
.composer details p, #control-status { font-size: .7rem; line-height: 1.6; color: var(--muted); }
|
|
395
|
+
.composer label { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; min-width: 0; }
|
|
396
|
+
.composer input, .composer textarea { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: var(--bg); width: 100%; }
|
|
397
|
+
.composer textarea { resize: vertical; min-height: 64px; }
|
|
398
|
+
.composer button { padding: 8px 14px; }
|
|
399
|
+
.composer button:disabled { cursor: not-allowed; opacity: .5; }
|
|
400
|
+
.composer select { margin: 0; max-width: 100%; width: 100%; }
|
|
401
|
+
#input-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
|
|
402
|
+
#input-form > label:first-child { flex-basis: 100%; }
|
|
403
|
+
#input-form .input-label { flex: 1; margin-bottom: 0; }
|
|
404
|
+
#send-input { background: var(--green); color: var(--panel); border-color: var(--green); }
|
|
405
|
+
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
406
|
+
.composer { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
|
|
407
|
+
.composer details { margin: 0; }
|
|
408
|
+
.composer details[open] { flex-basis: 100%; }
|
|
409
|
+
.composer details[open] summary { margin-bottom: 10px; }
|
|
410
|
+
#input-form { flex: 1; flex-wrap: nowrap; align-items: center; gap: 8px; min-width: 0; }
|
|
411
|
+
#input-form > label:first-child { flex: 0 0 110px; }
|
|
412
|
+
#input-form label, #input-form .input-label { margin: 0; }
|
|
413
|
+
.composer textarea { min-height: 38px; max-height: 100px; }
|
|
414
|
+
#control-status { flex-basis: 100%; margin: 0; }
|
|
415
|
+
@media (max-width: 700px) {
|
|
416
|
+
#input-form { flex-basis: 100%; }
|
|
417
|
+
#input-form > label:first-child { flex-basis: 90px; }
|
|
418
|
+
}
|
|
419
|
+
.kind-icon { font-size: .85rem; line-height: 1; }
|
|
420
|
+
.flow-row.tool .identity small, .flow-row.marker .identity small { display: inline; }
|
|
421
|
+
.flow-row.tool { border-style: dashed; border-color: var(--green); border-left: 3px solid var(--green); }
|
|
422
|
+
.flow-row.failed { border-style: dashed; border-left: 3px solid var(--red); }
|
|
423
|
+
.flow-row.call-failed { border-color: var(--red); }
|
|
424
|
+
.call-failed .identity { color: var(--red); }
|
|
425
|
+
.flow-row.model { border-radius: 999px; border-style: dotted; color: var(--blue); }
|
|
426
|
+
.flow-row.reply { border-bottom-left-radius: 3px; }
|
|
427
|
+
.flow-row.input { border-bottom-right-radius: 3px; }
|
|
428
|
+
.tool-value { margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
|
|
429
|
+
.tool-value h3 { margin: 0 0 6px; font-size: .75rem; color: var(--green); }
|
|
430
|
+
.reply-group {
|
|
431
|
+
width: fit-content; max-width: 86%; border: 1px solid var(--line);
|
|
432
|
+
border-radius: 14px 14px 14px 3px; padding: 13px 16px; background: var(--bg);
|
|
433
|
+
}
|
|
434
|
+
.reply-group .flow-row.reply { max-width: 100%; border: 0; padding: 0; border-radius: 0; background: transparent; }
|
|
435
|
+
.reply-group .reply-markers { margin-bottom: 8px; }
|
|
436
|
+
.reply-group .reply-markers .flow-row.marker { background: transparent; border: 0; padding: 0 6px 0 0; border-radius: 0; }
|
|
437
|
+
.workbench.inspecting .flow-row.marker time, .workbench.inspecting .flow-row.tool time { display: none; }
|
|
438
|
+
@media (max-width: 700px) { .reply-group { max-width: 94%; } }
|
|
439
|
+
.input-group { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 0; }
|
|
440
|
+
.input-line { display: flex; align-items: center; justify-content: flex-end; gap: 8px; max-width: 86%; min-width: 0; }
|
|
441
|
+
.input-kind { flex: 0 0 auto; color: var(--muted); font-size: .65rem; white-space: nowrap; }
|
|
442
|
+
.input-line .flow-row.app { margin: 0; max-width: 100%; min-width: 0; }
|
|
443
|
+
@media (max-width: 700px) { .input-line { max-width: 100%; gap: 6px; } }
|
|
444
|
+
#rows:not(.all-events) .flow-row time { display: none; }
|
|
445
|
+
#rows:not(.all-events) .flow-row.model { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 8px; }
|
|
446
|
+
.reply-group .flow-row.reply { min-height: 32px; }
|
|
447
|
+
#rows:not(.all-events) .flow-row.model { border: 0; border-radius: 0; padding: 1px 0; background: transparent; gap: 6px; color: var(--muted); }
|
|
448
|
+
#rows:not(.all-events) .flow-row.model .preview { display: none; }
|
|
449
|
+
#rows:not(.all-events) .flow-row.model .identity small { font-size: .6rem; font-weight: 400; }
|
|
450
|
+
#rows:not(.all-events) .flow-row.model .kind-icon { font-size: .6rem; }
|
|
451
|
+
#rows:not(.all-events) .flow-row.model::after { content: ''; width: 64px; border-top: 1px solid var(--line); align-self: center; }
|
|
452
|
+
#view-settings { position: relative; margin-left: auto; }
|
|
453
|
+
#view-settings > summary { cursor: pointer; padding: 7px 10px; font-size: .75rem; }
|
|
454
|
+
.view-settings-panel { position: absolute; top: 100%; right: 0; width: min(290px,calc(100vw - 40px)); z-index: 2; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px #0001; }
|
|
455
|
+
.view-settings-panel > label { display: block; margin-bottom: 12px; }
|
|
456
|
+
.view-settings-panel button { margin: 0 6px 8px 0; }
|
|
457
|
+
.view-settings-panel p { margin: 4px 0 0; line-height: 1.6; }
|
|
458
|
+
.flow-row.tool, .workbench.inspecting .flow-row.tool { border: 1px dashed var(--green); border-left: 3px solid var(--green); border-radius: 8px; padding: 8px 12px; gap: 5px; }
|
|
459
|
+
.flow-row.call-failed, .workbench.inspecting .flow-row.call-failed { border-color: var(--red); }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Croche · App flow</title><link rel="stylesheet" href="/stage.css"><script type="module" src="/stage.js"></script></head>
|
|
2
|
+
<body><header class="top"><b>croche <span>/ debugger</span></b><span id="health">Connecting…</span></header>
|
|
3
|
+
<main><div class="heading"><div><h1>App ↔ Croche</h1><p>The conversation, with every detail a click away.</p></div><span id="summary"></span></div>
|
|
4
|
+
<div class="toolbar"><label>Runtime <select id="projects"></select></label><label>Agent <select id="sessions"></select></label><label><input id="follow" type="checkbox" checked> Follow latest</label><details id="view-settings"><summary>View settings</summary><div class="view-settings-panel"><label><input id="all" type="checkbox"> All events <span id="count"></span></label><button id="load-labels">Load runner labels</button><input id="manifest-file" type="file" accept="application/json" hidden><button id="clear-labels" hidden>Clear labels</button><p id="label-status" role="status">Runner labels are optional. Progress means captured inputs, not completed steps.</p></div></details></div>
|
|
5
|
+
<div id="notice" role="status"></div><div class="workbench"><section class="timeline" aria-label="App and Croche conversation"><div id="rows"></div>
|
|
6
|
+
<section class="composer" aria-label="Send input through public debugger control">
|
|
7
|
+
<details><summary>Attach control</summary>
|
|
8
|
+
<p>App code must opt in first. An observe token reads; a controller token can also send user text or cancel an agent. Reload/Revoke forgets this page’s grant without cancelling accepted work. Never use the runtime ingest token or collector pairing token here.</p>
|
|
9
|
+
<label>Control broker URL <input id="control-url" type="url" value="http://127.0.0.1:8791" autocomplete="off"></label>
|
|
10
|
+
<label><input id="remote-control" type="checkbox"> Remote viewer connection (explicit server opt-in required; HTTP is not encrypted)</label>
|
|
11
|
+
<label>Observe or controller token <input id="control-token" type="password" autocomplete="off"></label><button id="attach-control" type="button">Enable viewer token</button>
|
|
12
|
+
</details><button id="revoke-control" type="button" hidden>Revoke control</button>
|
|
13
|
+
<form id="input-form"><label><span class="sr-only">Input kind</span><select id="input-kind"><option value="user">User text</option><option value="app_event" disabled>App event</option><option value="app_state" disabled>App state</option></select></label>
|
|
14
|
+
<label class="input-label"><span class="sr-only">Input text</span><textarea id="input-text" rows="1" placeholder="Type input text…"></textarea></label><button id="send-input" disabled>Send</button><button id="cancel-input" type="button" disabled>Cancel agent</button></form>
|
|
15
|
+
<p id="control-status" role="status">Read-only. Attach control to send user text.</p></section></section>
|
|
16
|
+
<aside id="inspector" aria-label="Exact event detail" hidden><div class="detail-heading"><div><span>EXACT CAPTURED EVENT</span><h2 id="detail-title"></h2></div><button id="close" aria-label="Close detail">×</button></div><p class="detail-note">All stored fields. Collector credential redaction still applies. Runtime visibility only.</p><div id="tool-detail" hidden></div><div id="raw"></div></aside></div>
|
|
17
|
+
<footer id="footer">No runner required · human and virtual-user inputs use the same debugger feed.</footer></main></body></html>
|