@botcord/daemon 0.2.77 → 0.2.79

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 (66) hide show
  1. package/dist/agent-discovery.d.ts +6 -0
  2. package/dist/agent-discovery.js +6 -0
  3. package/dist/attention-policy-fetcher.d.ts +14 -0
  4. package/dist/attention-policy-fetcher.js +59 -0
  5. package/dist/cloud-daemon.js +8 -0
  6. package/dist/cloud-gateway-runtime.d.ts +29 -0
  7. package/dist/cloud-gateway-runtime.js +122 -0
  8. package/dist/daemon-config-map.d.ts +6 -0
  9. package/dist/daemon-config-map.js +5 -4
  10. package/dist/daemon.d.ts +3 -0
  11. package/dist/daemon.js +32 -7
  12. package/dist/gateway/channels/botcord.js +29 -9
  13. package/dist/gateway/channels/login-session.d.ts +12 -0
  14. package/dist/gateway/channels/login-session.js +20 -2
  15. package/dist/gateway/channels/sanitize.d.ts +5 -18
  16. package/dist/gateway/channels/sanitize.js +5 -54
  17. package/dist/gateway/channels/text-split.d.ts +5 -11
  18. package/dist/gateway/channels/text-split.js +5 -31
  19. package/dist/gateway/dispatcher.d.ts +7 -1
  20. package/dist/gateway/dispatcher.js +88 -8
  21. package/dist/gateway/gateway.d.ts +16 -1
  22. package/dist/gateway/gateway.js +21 -0
  23. package/dist/gateway/policy-resolver.js +17 -9
  24. package/dist/gateway/runtimes/deepseek-tui.js +86 -19
  25. package/dist/gateway/types.d.ts +12 -57
  26. package/dist/gateway-control.js +18 -9
  27. package/dist/provision.d.ts +9 -3
  28. package/dist/provision.js +181 -9
  29. package/dist/room-recovery-context.d.ts +11 -0
  30. package/dist/room-recovery-context.js +97 -0
  31. package/dist/runtime-models.d.ts +17 -0
  32. package/dist/runtime-models.js +953 -0
  33. package/dist/runtime-route-options.d.ts +7 -0
  34. package/dist/runtime-route-options.js +45 -0
  35. package/package.json +2 -2
  36. package/src/__tests__/attention-policy-fetcher.test.ts +67 -0
  37. package/src/__tests__/cloud-gateway-runtime.test.ts +127 -0
  38. package/src/__tests__/daemon-config-map.test.ts +26 -1
  39. package/src/__tests__/gateway-control.test.ts +136 -0
  40. package/src/__tests__/policy-resolver.test.ts +20 -0
  41. package/src/__tests__/provision.test.ts +124 -0
  42. package/src/__tests__/runtime-discovery.test.ts +68 -9
  43. package/src/__tests__/runtime-models.test.ts +333 -0
  44. package/src/agent-discovery.ts +9 -0
  45. package/src/attention-policy-fetcher.ts +87 -0
  46. package/src/cloud-daemon.ts +8 -0
  47. package/src/cloud-gateway-runtime.ts +171 -0
  48. package/src/daemon-config-map.ts +17 -4
  49. package/src/daemon.ts +38 -9
  50. package/src/gateway/__tests__/botcord-channel.test.ts +97 -0
  51. package/src/gateway/__tests__/deepseek-tui-adapter.test.ts +207 -1
  52. package/src/gateway/__tests__/dispatcher.test.ts +56 -0
  53. package/src/gateway/channels/botcord.ts +32 -8
  54. package/src/gateway/channels/login-session.ts +20 -2
  55. package/src/gateway/channels/sanitize.ts +8 -66
  56. package/src/gateway/channels/text-split.ts +5 -27
  57. package/src/gateway/dispatcher.ts +123 -27
  58. package/src/gateway/gateway.ts +29 -0
  59. package/src/gateway/policy-resolver.ts +20 -9
  60. package/src/gateway/runtimes/deepseek-tui.ts +86 -19
  61. package/src/gateway/types.ts +31 -59
  62. package/src/gateway-control.ts +21 -9
  63. package/src/provision.ts +202 -11
  64. package/src/room-recovery-context.ts +131 -0
  65. package/src/runtime-models.ts +972 -0
  66. package/src/runtime-route-options.ts +52 -0
@@ -0,0 +1,52 @@
1
+ export interface RuntimeSelectionOptions {
2
+ runtimeModel?: string;
3
+ reasoningEffort?: string;
4
+ thinking?: boolean;
5
+ }
6
+
7
+ export function buildRuntimeSelectionExtraArgs(
8
+ runtime: string | undefined,
9
+ selection: RuntimeSelectionOptions,
10
+ ): string[] {
11
+ if (!runtime) return [];
12
+ const out: string[] = [];
13
+ const model = cleanString(selection.runtimeModel);
14
+ const reasoningEffort = cleanString(selection.reasoningEffort);
15
+
16
+ if (runtime === "claude-code") {
17
+ if (model) out.push("--model", model);
18
+ if (reasoningEffort) out.push("--effort", reasoningEffort);
19
+ } else if (runtime === "codex") {
20
+ if (model) out.push("--model", model);
21
+ if (reasoningEffort) {
22
+ out.push("-c", `model_reasoning_effort=${quoteCodexConfigValue(reasoningEffort)}`);
23
+ }
24
+ } else if (runtime === "deepseek-tui") {
25
+ if (model) out.push("--model", model);
26
+ if (reasoningEffort) out.push("--reasoning-effort", reasoningEffort);
27
+ } else if (runtime === "kimi-cli") {
28
+ if (model) out.push("--model", model);
29
+ if (typeof selection.thinking === "boolean") {
30
+ out.push(selection.thinking ? "--thinking" : "--no-thinking");
31
+ }
32
+ }
33
+
34
+ return out;
35
+ }
36
+
37
+ export function mergeRuntimeExtraArgs(
38
+ inherited: string[] | undefined,
39
+ selected: string[],
40
+ ): string[] | undefined {
41
+ const out = [...(inherited ?? []), ...selected];
42
+ return out.length ? out : undefined;
43
+ }
44
+
45
+ function cleanString(value: string | undefined): string | undefined {
46
+ const trimmed = value?.trim();
47
+ return trimmed ? trimmed : undefined;
48
+ }
49
+
50
+ function quoteCodexConfigValue(value: string): string {
51
+ return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
52
+ }