tinywebui 0.1.4 → 0.1.5
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 +20 -13
- package/bin/tinywebui.js +69 -53
- package/package.json +25 -8
- package/public/app.js +40 -34
- package/public/chat/composer.js +1 -1
- package/public/chat/sidebar.js +8 -5
- package/public/index.html +88 -53
- package/public/panels/admin.js +40 -1
- package/public/panels/model-editor.js +336 -0
- package/public/panels/panels.js +37 -12
- package/public/panels/settings-home.js +125 -0
- package/public/panels/settings.js +124 -36
- package/public/shared/attachment_note.js +7 -1
- package/public/shared/events.js +1 -0
- package/public/shared/features.js +1 -0
- package/public/shared/origins.js +1 -0
- package/public/shared/usage.js +16 -1
- package/public/styles.css +84 -21
- package/src/access/auth.js +155 -155
- package/src/access/auth_gate.js +39 -38
- package/src/access/email.js +17 -0
- package/src/access/policy.js +123 -136
- package/src/audit.js +1 -1
- package/src/automations/automation.js +135 -123
- package/src/automations/scheduler.js +138 -127
- package/src/chat/compact.js +149 -156
- package/src/chat/llm.js +380 -382
- package/src/chat/runs.js +162 -151
- package/src/chat/tool_executor.js +229 -218
- package/src/cli.js +535 -433
- package/src/config/approval.js +35 -29
- package/src/config/config.js +546 -454
- package/src/config/data_dir.js +24 -0
- package/src/config/models.js +191 -115
- package/src/config/refs.js +32 -0
- package/src/config/secrets.js +153 -0
- package/src/files/documents.js +57 -68
- package/src/files/images.js +30 -31
- package/src/harness/agent.js +60 -60
- package/src/harness/attribution.js +66 -58
- package/src/harness/checkpoint.js +67 -62
- package/src/harness/history.js +28 -23
- package/src/harness/prompt.js +40 -57
- package/src/harness/provider.js +284 -283
- package/src/harness/types.js +1 -0
- package/src/http.js +90 -72
- package/src/log.js +11 -12
- package/src/mcp.js +398 -374
- package/src/retrieval/embedding.js +228 -240
- package/src/retrieval/retrieval.js +182 -173
- package/src/routes/admin.js +178 -138
- package/src/routes/auth.js +184 -111
- package/src/routes/automations.js +99 -82
- package/src/routes/chats.js +240 -218
- package/src/routes/documents.js +130 -120
- package/src/routes/library.js +43 -46
- package/src/routes/mcp.js +49 -49
- package/src/routes/settings.js +127 -122
- package/src/routes/types.js +1 -0
- package/src/server.js +426 -415
- package/src/store/automations.js +106 -106
- package/src/store/chats.js +217 -242
- package/src/store/documents.js +181 -185
- package/src/store/embeddings.js +52 -54
- package/src/store/index.js +95 -49
- package/src/store/messages.js +55 -80
- package/src/store/schema.js +128 -107
- package/src/store/scope.js +18 -17
- package/src/store/search.js +25 -27
- package/src/store/turns.js +53 -53
- package/src/store/usage.js +343 -269
- package/src/store/users.js +162 -87
- package/src/store/wire.js +50 -41
- package/src/tools/ask_tool.js +68 -68
- package/src/tools/chat_search_tool.js +38 -44
- package/src/tools/context_tool.js +131 -138
- package/src/tools/document_tool.js +73 -78
- package/src/tools/mcp_tool.js +274 -232
- package/src/tools/task_tool.js +53 -50
- package/src/tools/types.js +1 -0
- package/public/panels/connectors.js +0 -184
- package/src/set-password.js +0 -43
package/src/config/approval.js
CHANGED
|
@@ -21,41 +21,47 @@
|
|
|
21
21
|
* `autoApproveTools` never does.
|
|
22
22
|
*/
|
|
23
23
|
export const APPROVAL_MODES = ['writes', 'all', 'off'];
|
|
24
|
-
|
|
25
24
|
/** 'ask' or 'auto' for one concrete call. */
|
|
26
25
|
export function approvalFor(cfg, hub, name, args) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
// The harness's own tools are part of the harness, not third-party code:
|
|
27
|
+
// they never ask, whatever the mode or overrides say. Approval is for MCP.
|
|
28
|
+
if (hub?.isLocal?.(name)) {
|
|
29
|
+
if (!hub.isGated?.(name, args))
|
|
30
|
+
return 'auto';
|
|
31
|
+
// manage_mcp can add a server that runs a command on this machine, so it
|
|
32
|
+
// asks even when the mode is 'off'. Only an explicit per-tool "auto" skips it.
|
|
33
|
+
return (cfg.autoApproveTools || []).includes(name) ? 'auto' : 'ask';
|
|
34
|
+
}
|
|
35
|
+
if ((cfg.confirmTools || []).includes(name))
|
|
36
|
+
return 'ask';
|
|
37
|
+
if ((cfg.autoApproveTools || []).includes(name))
|
|
38
|
+
return 'auto';
|
|
39
|
+
// Missing means off, not the config default: a caller that builds its own
|
|
40
|
+
// cfg (tests, evals) has no one to ask and must not stall waiting for one.
|
|
41
|
+
const mode = cfg.toolApproval || 'off';
|
|
42
|
+
if (mode === 'off')
|
|
43
|
+
return 'auto';
|
|
44
|
+
if (mode === 'all')
|
|
45
|
+
return 'ask';
|
|
46
|
+
return hub?.isReadOnly?.(name, args) ? 'auto' : 'ask';
|
|
43
47
|
}
|
|
44
|
-
|
|
45
48
|
/** The per-tool override the settings panel shows: 'ask', 'auto' or 'default'. */
|
|
46
49
|
export function overrideFor(cfg, name) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
if ((cfg.confirmTools || []).includes(name))
|
|
51
|
+
return 'ask';
|
|
52
|
+
if ((cfg.autoApproveTools || []).includes(name))
|
|
53
|
+
return 'auto';
|
|
54
|
+
return 'default';
|
|
50
55
|
}
|
|
51
|
-
|
|
52
56
|
/** The config patch that sets one tool's override. */
|
|
53
57
|
export function setOverride(cfg, name, policy) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const confirm = new Set(cfg.confirmTools || []);
|
|
59
|
+
const auto = new Set(cfg.autoApproveTools || []);
|
|
60
|
+
confirm.delete(name);
|
|
61
|
+
auto.delete(name);
|
|
62
|
+
if (policy === 'ask')
|
|
63
|
+
confirm.add(name);
|
|
64
|
+
if (policy === 'auto')
|
|
65
|
+
auto.add(name);
|
|
66
|
+
return { confirmTools: [...confirm], autoApproveTools: [...auto] };
|
|
61
67
|
}
|