ds-bot-dual-surface 0.0.0-stage → 0.3.2

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 (122) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +262 -3
  3. package/client.js +30079 -0
  4. package/cordis.patch.yml +26 -0
  5. package/index.js +94 -0
  6. package/office.js +8908 -0
  7. package/package.json +80 -6
  8. package/src/host/agents.js +129 -0
  9. package/src/host/approvals.js +116 -0
  10. package/src/host/avatar-library.js +131 -0
  11. package/src/host/avatar.js +107 -0
  12. package/src/host/browser/gate.js +3 -0
  13. package/src/host/browser/loop.js +95 -0
  14. package/src/host/browser/mount.js +177 -0
  15. package/src/host/browser/refs.js +151 -0
  16. package/src/host/browser/script-child.js +136 -0
  17. package/src/host/browser/script-runner.js +77 -0
  18. package/src/host/browser/script.js +39 -0
  19. package/src/host/browser/session-model.js +205 -0
  20. package/src/host/browser/session.js +757 -0
  21. package/src/host/browser/task.js +64 -0
  22. package/src/host/browser-plugins.js +174 -0
  23. package/src/host/browser.js +287 -0
  24. package/src/host/btw.js +372 -0
  25. package/src/host/capabilities.js +545 -0
  26. package/src/host/channel.js +773 -0
  27. package/src/host/chat-index.js +293 -0
  28. package/src/host/computer/catalog.js +91 -0
  29. package/src/host/computer/index.js +1272 -0
  30. package/src/host/computer/leases.js +71 -0
  31. package/src/host/computer/mac-helper.js +68 -0
  32. package/src/host/connectors/catalog.js +96 -0
  33. package/src/host/connectors/gateway.js +264 -0
  34. package/src/host/connectors/index.js +863 -0
  35. package/src/host/connectors/mail/index.js +613 -0
  36. package/src/host/connectors/mail/presets.js +23 -0
  37. package/src/host/connectors/mail/transport.js +306 -0
  38. package/src/host/connectors/oauth.js +191 -0
  39. package/src/host/constants.js +101 -0
  40. package/src/host/delivery.js +175 -0
  41. package/src/host/diagnostics.js +257 -0
  42. package/src/host/dsh-update.js +172 -0
  43. package/src/host/feed.js +122 -0
  44. package/src/host/files.js +27 -0
  45. package/src/host/folders.js +230 -0
  46. package/src/host/goal-skills.js +48 -0
  47. package/src/host/goals.js +812 -0
  48. package/src/host/group-log.js +72 -0
  49. package/src/host/groups.js +1613 -0
  50. package/src/host/handoffs.js +436 -0
  51. package/src/host/home-lock.js +98 -0
  52. package/src/host/im/format.js +190 -0
  53. package/src/host/im/index.js +943 -0
  54. package/src/host/im/platforms/dingtalk.js +249 -0
  55. package/src/host/im/platforms/discord.js +234 -0
  56. package/src/host/im/platforms/feishu.js +400 -0
  57. package/src/host/im/platforms/index.js +12 -0
  58. package/src/host/im/platforms/qq.js +251 -0
  59. package/src/host/im/platforms/retry.js +13 -0
  60. package/src/host/im/platforms/slack.js +210 -0
  61. package/src/host/im/platforms/telegram.js +256 -0
  62. package/src/host/im/platforms/wecom.js +240 -0
  63. package/src/host/im/platforms/weixin.js +364 -0
  64. package/src/host/images.js +227 -0
  65. package/src/host/learning.js +799 -0
  66. package/src/host/legacy.mjs +4 -0
  67. package/src/host/links.js +39 -0
  68. package/src/host/local-agents/acp.js +282 -0
  69. package/src/host/local-agents/adapter.js +650 -0
  70. package/src/host/local-agents/claude.js +251 -0
  71. package/src/host/local-agents/codex.js +219 -0
  72. package/src/host/local-agents/discover.js +166 -0
  73. package/src/host/local-agents/engines.js +91 -0
  74. package/src/host/local-agents/index.js +273 -0
  75. package/src/host/local-agents/jsonrpc.js +114 -0
  76. package/src/host/local-agents/mcp.js +141 -0
  77. package/src/host/memory-copy.js +179 -0
  78. package/src/host/memory-entries.js +298 -0
  79. package/src/host/memory-pending.js +95 -0
  80. package/src/host/memory-review.js +406 -0
  81. package/src/host/memory-search.js +29 -0
  82. package/src/host/memory-tidy.js +264 -0
  83. package/src/host/memory.js +1743 -0
  84. package/src/host/models.js +330 -0
  85. package/src/host/office-skills.js +78 -0
  86. package/src/host/parts.js +1765 -0
  87. package/src/host/permissions.js +117 -0
  88. package/src/host/privacy.js +368 -0
  89. package/src/host/prompt.js +73 -0
  90. package/src/host/providers.js +351 -0
  91. package/src/host/requests.js +141 -0
  92. package/src/host/resume.js +467 -0
  93. package/src/host/roster.js +949 -0
  94. package/src/host/schedules.js +248 -0
  95. package/src/host/secrets.js +586 -0
  96. package/src/host/side.js +406 -0
  97. package/src/host/skills/goal-grill/SKILL.md +37 -0
  98. package/src/host/steer.js +265 -0
  99. package/src/host/steward.js +165 -0
  100. package/src/host/store.js +631 -0
  101. package/src/host/text.js +49 -0
  102. package/src/host/thinking.js +55 -0
  103. package/src/host/time-context.js +46 -0
  104. package/src/host/tools.js +1235 -0
  105. package/src/host/turns.js +1242 -0
  106. package/src/host/update.js +318 -0
  107. package/src/host/usage.js +653 -0
  108. package/src/office/check.js +329 -0
  109. package/src/office/cli.js +193 -0
  110. package/src/office/docx.js +648 -0
  111. package/src/office/package.js +238 -0
  112. package/src/office/png.js +183 -0
  113. package/src/office/pptx.js +410 -0
  114. package/src/office/skills/office/SKILL.md +18 -0
  115. package/src/office/skills/office-tools/SKILL.md +41 -0
  116. package/src/office/xlsx.js +134 -0
  117. package/src/office/xml.js +128 -0
  118. package/src/office/zip.js +146 -0
  119. package/src/shared/group-replies.js +69 -0
  120. package/src/shared/im-platforms.js +86 -0
  121. package/src/shared/mentions.js +72 -0
  122. package/web-search.js +775 -0
@@ -0,0 +1,26 @@
1
+ # Mounts the Bot team host plugin; the browser half is discovered through the
2
+ # package's dsh.client manifest and ./client export.
3
+ - insert:
4
+ - id: bot
5
+ name: ds-bot-dual-surface
6
+ # Web search with the current conversation route's own key, else a keyless
7
+ # results-page fallback (see README "Web search").
8
+ - id: web-search-auto
9
+ name: ds-bot-dual-surface/web-search
10
+
11
+ # A config override replaces the whole entry config, so fetchProvider is
12
+ # restated. A profile patch that names another searchProvider (exa, perplexity,
13
+ # deepseek-official) wins over this one. Turning off web-search-auto alone
14
+ # leaves this row on "auto", and every web_search then fails; the profile must
15
+ # name another searchProvider too (see README "Web search").
16
+ - id: web
17
+ config:
18
+ searchProvider: auto
19
+ fetchProvider: http
20
+
21
+ # Fork choice: DSH's own settings shell stays mounted, so the native surface keeps its
22
+ # own Settings dialog (ui-settings-general). DS Bot's settings shell now mounts only
23
+ # inside the Bot surface (src/client/index.js, installShell) and takes the seat there;
24
+ # the seat has one owner, so whichever shell is mounted owns the dialog.
25
+ # Turning this row off (disabled: true) restores the upstream behaviour: DS Bot's shell
26
+ # holds the seat in both surfaces.
package/index.js ADDED
@@ -0,0 +1,94 @@
1
+ // DS Bot: a team of long-lived Bots on top of ordinary dsh root Sessions.
2
+ // Every Bot is one root Session; the roster, rooms, and the bot-to-bot exchange log live
3
+ // in one JSON file under DSH_HOME so they survive restarts without new Session event types.
4
+ import { join } from 'node:path'
5
+ import * as diagnostics from './src/host/diagnostics.js'
6
+ import * as store from './src/host/store.js'
7
+ import * as models from './src/host/models.js'
8
+ import * as providers from './src/host/providers.js'
9
+ import * as permissions from './src/host/permissions.js'
10
+ import * as turns from './src/host/turns.js'
11
+ import * as steer from './src/host/steer.js'
12
+ import * as handoffs from './src/host/handoffs.js'
13
+ import * as requests from './src/host/requests.js'
14
+ import * as delivery from './src/host/delivery.js'
15
+ import * as roster from './src/host/roster.js'
16
+ import * as folders from './src/host/folders.js'
17
+ import * as privacy from './src/host/privacy.js'
18
+ import * as agents from './src/host/agents.js'
19
+ import * as prompt from './src/host/prompt.js'
20
+ import * as timeContext from './src/host/time-context.js'
21
+ import * as tools from './src/host/tools.js'
22
+ import * as chatIndex from './src/host/chat-index.js'
23
+ import * as groups from './src/host/groups.js'
24
+ import * as groupLog from './src/host/group-log.js'
25
+ import * as goals from './src/host/goals.js'
26
+ import * as approvals from './src/host/approvals.js'
27
+ import * as resume from './src/host/resume.js'
28
+ import * as memory from './src/host/memory.js'
29
+ import * as parts from './src/host/parts.js'
30
+ import * as images from './src/host/images.js'
31
+ import * as avatarLibrary from './src/host/avatar-library.js'
32
+ import * as browser from './src/host/browser.js'
33
+ import * as browserPlugins from './src/host/browser-plugins.js'
34
+ import * as computer from './src/host/computer/index.js'
35
+ import * as secrets from './src/host/secrets.js'
36
+ import * as connectors from './src/host/connectors/index.js'
37
+ import * as capabilities from './src/host/capabilities.js'
38
+ import * as learning from './src/host/learning.js'
39
+ import * as schedules from './src/host/schedules.js'
40
+ import * as usage from './src/host/usage.js'
41
+ import * as update from './src/host/update.js'
42
+ import * as dshUpdate from './src/host/dsh-update.js'
43
+ import * as thinking from './src/host/thinking.js'
44
+ import * as channel from './src/host/channel.js'
45
+ import * as feed from './src/host/feed.js'
46
+ import * as im from './src/host/im/index.js'
47
+ import * as officeSkills from './src/host/office-skills.js'
48
+ import * as goalSkills from './src/host/goal-skills.js'
49
+ import * as localAgents from './src/host/local-agents/index.js'
50
+
51
+ export { COLORS } from './src/host/constants.js'
52
+
53
+ export const name = 'ds-bot-dual-surface'
54
+ export const inject = ['llm', 'tools', 'systemPrompt', 'sessionController', 'sessions', 'sessionTitle', 'workspaceRegistry', 'connection']
55
+
56
+ // Each module's install(rt) registers its listeners, tools, and effects, and puts on `rt`
57
+ // the functions other modules call; they call them through `rt` at run time, never during
58
+ // install. Listeners run and tools are listed in registration order, so this order holds:
59
+ // usage meters model requests after every listener that rewrites them. privacy checks a
60
+ // call before the hooks of tools do, so a closed call never reaches a card they show.
61
+ const MODULES = [diagnostics, store, models, providers, permissions, turns, steer, handoffs, requests, delivery, roster, folders, privacy, agents, prompt, timeContext, tools, chatIndex, groups, groupLog, goals, approvals, resume, memory, parts, images, avatarLibrary, secrets, connectors, capabilities, learning, schedules, browser, browserPlugins, computer, usage, update, dshUpdate, thinking, feed, im, channel, officeSkills, goalSkills, localAgents]
62
+
63
+ export function apply(ctx, config = {}) {
64
+ createRuntime(ctx, config)
65
+ }
66
+
67
+ export function createRuntime(ctx, config = {}) {
68
+ const dshHome = folders.dshHomeOf(process.env.DSH_HOME)
69
+ const home = config.home ?? join(dshHome, 'bot')
70
+ const rt = {
71
+ ctx,
72
+ config,
73
+ dshHome,
74
+ home,
75
+ statePath: join(home, 'state.json'),
76
+ // The Bot-only tools each module defines; tools.js registers them in each
77
+ // Bot Session's own scope, never globally (see shareBotTools).
78
+ teamTools: [],
79
+ defaults: {
80
+ mainName: config.mainName ?? 'Chief',
81
+ mainRole: config.mainRole ?? 'Chief of Staff',
82
+ },
83
+ }
84
+ for (const module of MODULES) module.install(rt)
85
+ // A live Agent can be scoped before the last module has added its tools (the memory
86
+ // module starts a load during install): complete the scope now that every tool is in.
87
+ rt.syncScopedTools?.()
88
+ // dsh can load this plugin again in place, its files replaced while it runs: dsh
89
+ // keeps the turns and child agents it had, while this runtime starts with empty
90
+ // maps. Adopt them now, so Stop, the group view and a late child settle still see
91
+ // the work. A fresh start has nothing to adopt.
92
+ void rt.adoptLiveWork?.().catch(error => rt.warn?.('ds-bot: adopting the work still running failed: %s', error))
93
+ return rt
94
+ }