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