anentrypoint-design 0.0.80 → 0.0.82
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/app-shell.css +13 -0
- package/dist/247420.app.js +4 -4
- package/dist/247420.css +13 -0
- package/dist/247420.js +24 -24
- package/package.json +1 -1
- package/src/components/freddie/pages-config-edit.js +98 -0
- package/src/components/freddie/pages-config.js +1 -20
- package/src/components/freddie.js +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anentrypoint-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
4
4
|
"description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/247420.js",
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as webjsx from '../../../vendor/webjsx/index.js';
|
|
2
|
+
import { Panel, Hero, Kpi, Form, Table } from '../content.js';
|
|
3
|
+
import { Chip } from '../shell.js';
|
|
4
|
+
import { renderConfigSections } from './helpers.js';
|
|
5
|
+
const h = webjsx.createElement;
|
|
6
|
+
|
|
7
|
+
const KNOWN_FIELDS = [
|
|
8
|
+
{ key: 'display.skin', label: 'skin', kind: 'skin' },
|
|
9
|
+
{ key: 'display.tool_progress_command', label: 'tool progress command', kind: 'bool' },
|
|
10
|
+
{ key: 'display.background_process_notifications', label: 'bg notifications', kind: 'enum', options: ['all','errors','none'] },
|
|
11
|
+
{ key: 'agent.provider', label: 'agent provider', kind: 'string' },
|
|
12
|
+
{ key: 'agent.model', label: 'agent model', kind: 'string' },
|
|
13
|
+
{ key: 'agent.max_iterations', label: 'max iterations', kind: 'number' },
|
|
14
|
+
{ key: 'agent.fallback_model', label: 'fallback model', kind: 'string', nullable: true },
|
|
15
|
+
{ key: 'agent.save_trajectories', label: 'save trajectories', kind: 'bool' },
|
|
16
|
+
{ key: 'agent.model_preference', label: 'model preference (json array)', kind: 'json' },
|
|
17
|
+
{ key: 'memory.provider', label: 'memory provider', kind: 'string', nullable: true },
|
|
18
|
+
{ key: 'gateway.timeout', label: 'gateway timeout (s)', kind: 'number' },
|
|
19
|
+
{ key: 'terminal.cwd', label: 'terminal cwd', kind: 'string', nullable: true },
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
function getDot(o, p) { return p.split('.').reduce((c, k) => (c && k in c) ? c[k] : undefined, o); }
|
|
23
|
+
|
|
24
|
+
function commit(h0, key, value) {
|
|
25
|
+
const prev = window.__fd_cfg_status = window.__fd_cfg_status || {};
|
|
26
|
+
prev[key] = 'saving…';
|
|
27
|
+
Promise.resolve(h0.pi.config.saveValue(key, value))
|
|
28
|
+
.then(() => { prev[key] = 'saved ✓'; rerender(); setTimeout(() => { delete prev[key]; rerender(); }, 1500); })
|
|
29
|
+
.catch(e => { prev[key] = 'err: ' + (e.message || e); rerender(); });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function rerender() { if (typeof window.__fd_nav === 'function') window.__fd_nav('config'); }
|
|
33
|
+
|
|
34
|
+
function editor(field, cur, defVal, h0, skins) {
|
|
35
|
+
const status = (window.__fd_cfg_status || {})[field.key];
|
|
36
|
+
let control;
|
|
37
|
+
if (field.kind === 'skin') {
|
|
38
|
+
const list = skins.length ? skins : ['default'];
|
|
39
|
+
control = h('select', { onchange: ev => commit(h0, field.key, ev.target.value) },
|
|
40
|
+
...list.map(s => h('option', { value: s, selected: s === cur ? 'true' : null }, s)));
|
|
41
|
+
} else if (field.kind === 'bool') {
|
|
42
|
+
control = h('select', { onchange: ev => commit(h0, field.key, ev.target.value === 'true') },
|
|
43
|
+
h('option', { value: 'false', selected: !cur ? 'true' : null }, 'false'),
|
|
44
|
+
h('option', { value: 'true', selected: cur ? 'true' : null }, 'true'));
|
|
45
|
+
} else if (field.kind === 'enum') {
|
|
46
|
+
control = h('select', { onchange: ev => commit(h0, field.key, ev.target.value) },
|
|
47
|
+
...field.options.map(o => h('option', { value: o, selected: o === cur ? 'true' : null }, o)));
|
|
48
|
+
} else if (field.kind === 'number') {
|
|
49
|
+
control = h('input', { type: 'number', value: cur == null ? '' : String(cur),
|
|
50
|
+
onchange: ev => commit(h0, field.key, ev.target.value === '' ? null : Number(ev.target.value)) });
|
|
51
|
+
} else if (field.kind === 'json') {
|
|
52
|
+
const text = cur == null ? '[]' : JSON.stringify(cur);
|
|
53
|
+
control = h('input', { type: 'text', value: text, placeholder: '[] or [{"provider":"…"}]',
|
|
54
|
+
onchange: ev => { try { commit(h0, field.key, JSON.parse(ev.target.value || 'null')); } catch (e) { (window.__fd_cfg_status = window.__fd_cfg_status || {})[field.key] = 'invalid json'; rerender(); } } });
|
|
55
|
+
} else {
|
|
56
|
+
control = h('input', { type: 'text', value: cur == null ? '' : String(cur), placeholder: field.nullable ? '(empty = unset)' : '',
|
|
57
|
+
onchange: ev => commit(h0, field.key, ev.target.value === '' && field.nullable ? null : ev.target.value) });
|
|
58
|
+
}
|
|
59
|
+
const isDefault = JSON.stringify(cur) === JSON.stringify(defVal);
|
|
60
|
+
const meta = h('span', { class: 'fd-cfg-meta' },
|
|
61
|
+
status ? Chip({ tone: status.startsWith('err') || status === 'invalid json' ? 'miss' : status === 'saved ✓' ? 'ok' : 'warn', children: status }) : null,
|
|
62
|
+
!isDefault && defVal !== undefined ? h('span', { class: 'fd-muted', title: 'default: ' + JSON.stringify(defVal) }, ' default: ' + (defVal === '' ? '""' : JSON.stringify(defVal))) : null);
|
|
63
|
+
return h('div', { class: 'fd-cfg-row', key: field.key },
|
|
64
|
+
h('label', { class: 'fd-cfg-label' }, field.label, h('code', { class: 'fd-cfg-key' }, field.key)),
|
|
65
|
+
h('div', { class: 'fd-cfg-control' }, control, meta));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function config(h0) {
|
|
69
|
+
const cfg = typeof h0.pi.config?.load === 'function' ? await h0.pi.config.load() : {};
|
|
70
|
+
const defaults = await fetch('/api/config/defaults').then(r => r.json()).catch(() => ({}));
|
|
71
|
+
const skins = await fetch('/api/skins').then(r => r.json()).catch(() => ['default']);
|
|
72
|
+
const commands = typeof h0.pi.cli?.values === 'function' ? [...h0.pi.cli.values()] : [];
|
|
73
|
+
const settingsPanel = Panel({ title: 'settings', count: KNOWN_FIELDS.length,
|
|
74
|
+
children: KNOWN_FIELDS.map(f => editor(f, getDot(cfg, f.key), getDot(defaults, f.key), h0, skins)) });
|
|
75
|
+
const rawForm = Panel({ title: 'set arbitrary key (power-user)', children: Form({ fields: [
|
|
76
|
+
{ name: 'key', placeholder: 'dotted.key', required: true },
|
|
77
|
+
{ name: 'value', placeholder: 'value (json or string)', required: true }
|
|
78
|
+
], submit: 'save', onSubmit: async ev => {
|
|
79
|
+
let v = ev.target.elements.value.value;
|
|
80
|
+
try { v = JSON.parse(v); } catch {}
|
|
81
|
+
await h0.pi.config.saveValue(ev.target.elements.key.value, v);
|
|
82
|
+
rerender();
|
|
83
|
+
} }) });
|
|
84
|
+
const allRaw = h('details', { class: 'fd-cfg-details' },
|
|
85
|
+
h('summary', {}, 'all config (read-only)'),
|
|
86
|
+
...renderConfigSections(cfg));
|
|
87
|
+
const cmds = h('details', { class: 'fd-cfg-details' },
|
|
88
|
+
h('summary', {}, 'commands · ' + commands.length),
|
|
89
|
+
Table({ headers: ['name','description'], rows: commands.map(c => [c.name, c.description||'']) }));
|
|
90
|
+
return [
|
|
91
|
+
Hero({ title: 'config', body: 'inline editors for known keys. raw setter is the fallback.', accent: 'v'+(cfg._config_version||0) }),
|
|
92
|
+
Kpi({ items: [[KNOWN_FIELDS.length,'editable'],[commands.length,'commands'],[cfg._config_version||0,'version'],[skins.length,'skins']] }),
|
|
93
|
+
settingsPanel,
|
|
94
|
+
rawForm,
|
|
95
|
+
allRaw,
|
|
96
|
+
cmds,
|
|
97
|
+
];
|
|
98
|
+
}
|
|
@@ -2,7 +2,7 @@ import * as webjsx from '../../../vendor/webjsx/index.js';
|
|
|
2
2
|
import { Panel, Row, Hero, Receipt, Kpi, Table, Form } from '../content.js';
|
|
3
3
|
import { Chip } from '../shell.js';
|
|
4
4
|
import { EmptyState } from '../files.js';
|
|
5
|
-
import { skillLabel
|
|
5
|
+
import { skillLabel } from './helpers.js';
|
|
6
6
|
const h = webjsx.createElement;
|
|
7
7
|
|
|
8
8
|
export async function models(h0) {
|
|
@@ -79,25 +79,6 @@ export async function skills(h0) {
|
|
|
79
79
|
].filter(Boolean);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
export async function config(h0) {
|
|
83
|
-
const cfg = typeof h0.pi.config?.load === 'function' ? await h0.pi.config.load() : {};
|
|
84
|
-
const commands = typeof h0.pi.cli?.values === 'function' ? [...h0.pi.cli.values()] : [];
|
|
85
|
-
return [
|
|
86
|
-
Hero({ title: 'config', body: 'live ~/.freddie/config.yaml. dotted keys, json or string values.', accent: 'v'+(cfg._config_version||0) }),
|
|
87
|
-
Kpi({ items: [[commands.length,'commands'],[cfg._config_version||0,'config version']] }),
|
|
88
|
-
Panel({ title: 'set config value', children: Form({ fields: [
|
|
89
|
-
{ name: 'key', placeholder: 'dotted.key', required: true },
|
|
90
|
-
{ name: 'value', placeholder: 'value (json or string)', required: true }
|
|
91
|
-
], submit: 'save', onSubmit: async ev => {
|
|
92
|
-
let v = ev.target.elements.value.value;
|
|
93
|
-
try { v = JSON.parse(v); } catch {}
|
|
94
|
-
await h0.pi.config.saveValue(ev.target.elements.key.value, v);
|
|
95
|
-
} }) }),
|
|
96
|
-
Panel({ title: 'commands', count: commands.length, children: Table({ headers: ['name','description'], rows: commands.map(c => [c.name, c.description||'']) }) }),
|
|
97
|
-
...renderConfigSections(cfg)
|
|
98
|
-
];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
82
|
export async function env(h0) {
|
|
102
83
|
const list = typeof h0.pi.env?.list === 'function' ? h0.pi.env.list() : [];
|
|
103
84
|
const setCount = list.filter(k => k.set).length;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { skillLabel, getRecentPaths, saveRecentPath, renderChatMessages } from './freddie/helpers.js';
|
|
2
2
|
export { home, sessions, projects, agents, analytics } from './freddie/pages-core.js';
|
|
3
3
|
export { chat } from './freddie/pages-chat.js';
|
|
4
|
-
export { models, cron, skills,
|
|
4
|
+
export { models, cron, skills, env, tools, batch, gateway } from './freddie/pages-config.js';
|
|
5
|
+
export { config } from './freddie/pages-config-edit.js';
|
|
5
6
|
|
|
6
7
|
import { home, sessions, projects, agents, analytics } from './freddie/pages-core.js';
|
|
7
8
|
import { chat } from './freddie/pages-chat.js';
|
|
8
|
-
import { models, cron, skills,
|
|
9
|
+
import { models, cron, skills, env, tools, batch, gateway } from './freddie/pages-config.js';
|
|
10
|
+
import { config } from './freddie/pages-config-edit.js';
|
|
9
11
|
export const FREDDIE_PAGES = { home, chat, sessions, projects, agents, analytics, models, cron, skills, config, env, tools, batch, gateway };
|