dsh-taskbridge 0.0.0-stage → 1.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 (75) hide show
  1. package/CHANGELOG.md +763 -0
  2. package/LICENSE +21 -0
  3. package/README.md +622 -3
  4. package/bin/dsh-delegate-codex-agent.js +115 -0
  5. package/bin/dsh-delegate-control.d.ts +90 -0
  6. package/bin/dsh-delegate-control.js +450 -0
  7. package/bin/dsh-delegate-mcp.d.ts +121 -0
  8. package/bin/dsh-delegate-mcp.js +273 -0
  9. package/codex/dsh-taskbridge.toml +247 -0
  10. package/cordis.patch.yml +6 -0
  11. package/docs/INTRODUCTION.md +15 -0
  12. package/docs/INTRODUCTION.zh.md +34 -0
  13. package/docs/auth-contract.md +138 -0
  14. package/docs/claude-code.md +31 -0
  15. package/docs/codex-integration.md +937 -0
  16. package/docs/contracts-stage-b.md +443 -0
  17. package/docs/conversation-placement.md +304 -0
  18. package/docs/plugin-market.md +30 -0
  19. package/docs/redaction-contract.md +127 -0
  20. package/docs/runtime-compatibility.md +223 -0
  21. package/docs/silent-wait.md +191 -0
  22. package/docs/taskbridge-upgrade.md +28 -0
  23. package/docs/taskdispatch-upgrade.md +25 -0
  24. package/docs/worker-permissions.md +347 -0
  25. package/docs/workspace-contract.md +538 -0
  26. package/icon.svg +1 -0
  27. package/lib/client.d.ts +118 -0
  28. package/lib/client.js +3232 -0
  29. package/locale/en.json +7 -0
  30. package/locale/zh.json +7 -0
  31. package/package.json +138 -4
  32. package/src/auth/fence.js +361 -0
  33. package/src/auth/grants.js +789 -0
  34. package/src/client/api.js +2322 -0
  35. package/src/client/index.jsx +2333 -0
  36. package/src/client/styles.js +251 -0
  37. package/src/codex/installer.js +3299 -0
  38. package/src/codex/seam.js +429 -0
  39. package/src/codex/toml.js +784 -0
  40. package/src/config/defaults.js +164 -0
  41. package/src/config/redact.js +184 -0
  42. package/src/config/settings.js +629 -0
  43. package/src/config/store.js +186 -0
  44. package/src/config/validate.js +763 -0
  45. package/src/credentials/seam.js +202 -0
  46. package/src/http/execution-plane.js +456 -0
  47. package/src/http/respond.js +175 -0
  48. package/src/http/user-plane.js +1122 -0
  49. package/src/index.d.ts +332 -0
  50. package/src/index.js +657 -0
  51. package/src/jobs/activity.js +1008 -0
  52. package/src/jobs/engine.js +3614 -0
  53. package/src/jobs/history.js +1467 -0
  54. package/src/jobs/title.js +17 -0
  55. package/src/mcp/server.js +1821 -0
  56. package/src/mcp/wait.js +536 -0
  57. package/src/model/connectivity.js +371 -0
  58. package/src/model/discovery.js +582 -0
  59. package/src/model/native-catalog.js +68 -0
  60. package/src/model/openai-adapter.js +671 -0
  61. package/src/model/probe.js +264 -0
  62. package/src/model/providers.js +756 -0
  63. package/src/model/routing.js +321 -0
  64. package/src/review/preset.js +868 -0
  65. package/src/review/prompts.js +126 -0
  66. package/src/review/reviewer.js +933 -0
  67. package/src/runtime/agent-runner.js +1740 -0
  68. package/src/runtime/endpoint-discovery.js +118 -0
  69. package/src/runtime/permissions.js +1429 -0
  70. package/src/runtime/sandbox.js +358 -0
  71. package/src/runtime/session-placement.js +1121 -0
  72. package/src/workspace/audit.js +775 -0
  73. package/src/workspace/locks.js +167 -0
  74. package/src/workspace/preflight.js +424 -0
  75. package/src/workspace/worktrees.js +613 -0
@@ -0,0 +1,251 @@
1
+ // dsh-delegate settings UI — stylesheet, injected once by the client entry.
2
+ //
3
+ // The page lives *inside* the native settings dialog, so it must not restyle
4
+ // anything it does not own: every rule below is scoped to `.dshdg-*` class names
5
+ // this plugin is the only producer of, and every colour/radius/font reads a
6
+ // native design token (`--dsw-*`, `--ds-*`) with a safe literal fallback. That is
7
+ // how the page follows the operator's light/dark theme and locale-specific font
8
+ // without shipping a second design system or touching the shell's CSS.
9
+ //
10
+ // Injection contract (from the native client module system,
11
+ // `@deepseek-ai/dsh-client-modules` 0.2.0-rc.2): a `<style>` element authored
12
+ // inside the bundle factory is claimed for the materializing plugin by
13
+ // `data-plugin`, and the loader removes exactly the tags carrying this plugin's
14
+ // id when the plugin is disabled. We therefore tag the element ourselves and
15
+ // also return a disposer, so HMR/unload cannot leave an orphaned sheet behind.
16
+
17
+ /** Attribute the native module system uses to attribute and clean up styles. */
18
+ export const STYLE_PLUGIN_ATTRIBUTE = 'data-plugin';
19
+
20
+ /** Plugin id used for style ownership; matches the bundle registration id. */
21
+ export const STYLE_PLUGIN_ID = 'dsh-delegate';
22
+
23
+ /** Stable element id so a second injection replaces instead of stacking. */
24
+ export const STYLE_ELEMENT_ID = 'dsh-delegate-settings';
25
+
26
+ /**
27
+ * The stylesheet text.
28
+ *
29
+ * Layout notes worth keeping: the authorization block is rendered before the
30
+ * tab bar in the DOM (not merely first visually), so reading order, keyboard
31
+ * order and screen-reader order all put authorization above the four areas. Grid
32
+ * tracks use `minmax(0, 1fr)` so a long model id or diff line cannot push the
33
+ * form wider than the settings panel.
34
+ */
35
+ export const CSS_TEXT = `
36
+ .dshdg-root {
37
+ display: flex;
38
+ flex-direction: column;
39
+ gap: 16px;
40
+ padding: 4px 2px 24px;
41
+ color: var(--dsw-alias-label-primary, #1f2329);
42
+ font-family: var(--dsw-font-family, system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif);
43
+ font-size: 13px;
44
+ line-height: 1.55;
45
+ }
46
+ .dshdg-root * { box-sizing: border-box; }
47
+ .dshdg-root h3, .dshdg-root h4 { margin: 0; font-weight: 600; }
48
+ .dshdg-root h3 { font-size: 15px; }
49
+ .dshdg-root h4 { font-size: 13px; }
50
+ .dshdg-root p { margin: 0; }
51
+ .dshdg-muted { color: var(--dsw-alias-label-secondary, #61666d); }
52
+ .dshdg-faint { color: var(--dsw-alias-label-tertiary, #8a9098); }
53
+ .dshdg-mono {
54
+ font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Consolas, monospace);
55
+ font-size: 12px;
56
+ }
57
+ .dshdg-card {
58
+ border: 1px solid var(--dsw-alias-border-l2, #e2e5e9);
59
+ border-radius: var(--dsw-radius-md, 8px);
60
+ background: var(--dsw-alias-bg-layer-3, #fff);
61
+ padding: 12px 14px;
62
+ display: flex;
63
+ flex-direction: column;
64
+ gap: 10px;
65
+ min-width: 0;
66
+ }
67
+ .dshdg-card-danger { border-color: var(--dsw-alias-label-error, #d92d20); }
68
+ .dshdg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
69
+ .dshdg-row-end { justify-content: flex-end; }
70
+ .dshdg-switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
71
+ .dshdg-switch input { width: 18px; height: 18px; margin: 0; accent-color: #087e8b; }
72
+ .dshdg-spacer { flex: 1 1 auto; }
73
+ .dshdg-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); min-width: 0; }
74
+ .dshdg-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
75
+ .dshdg-field > label { font-weight: 500; color: var(--dsw-alias-label-secondary, #61666d); font-size: 12px; }
76
+ .dshdg-hint { font-size: 12px; color: var(--dsw-alias-label-tertiary, #8a9098); }
77
+ .dshdg-root input[type="text"],
78
+ .dshdg-root input[type="password"],
79
+ .dshdg-root input[type="number"],
80
+ .dshdg-root select,
81
+ .dshdg-root textarea {
82
+ width: 100%;
83
+ padding: 5px 8px;
84
+ color: inherit;
85
+ font: inherit;
86
+ background: var(--dsw-alias-bg-base, #f7f8f9);
87
+ border: 1px solid var(--dsw-alias-border-l3, #d3d7dd);
88
+ border-radius: var(--dsw-radius-sm, 6px);
89
+ min-width: 0;
90
+ }
91
+ .dshdg-root textarea { resize: vertical; min-height: 76px; }
92
+ .dshdg-root input:focus-visible,
93
+ .dshdg-root select:focus-visible,
94
+ .dshdg-root textarea:focus-visible,
95
+ .dshdg-root button:focus-visible {
96
+ outline: var(--dsw-focus-ring-width, 2px) solid var(--dsw-focus-ring-color, #3457d5);
97
+ outline-offset: 1px;
98
+ }
99
+ .dshdg-root input:disabled, .dshdg-root select:disabled, .dshdg-root textarea:disabled {
100
+ opacity: 0.6;
101
+ cursor: not-allowed;
102
+ }
103
+ .dshdg-root button {
104
+ font: inherit;
105
+ padding: 5px 12px;
106
+ border-radius: var(--dsw-radius-sm, 6px);
107
+ border: 1px solid var(--dsw-alias-border-l3, #d3d7dd);
108
+ background: var(--dsw-alias-button-tool-bar-fill, #f2f3f5);
109
+ color: inherit;
110
+ cursor: pointer;
111
+ white-space: nowrap;
112
+ }
113
+ .dshdg-root button:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, #e9ebee); }
114
+ .dshdg-root button:disabled { opacity: 0.55; cursor: not-allowed; }
115
+ .dshdg-root button.dshdg-primary {
116
+ background: var(--dsw-alias-button-primary-fill, #3457d5);
117
+ border-color: transparent;
118
+ color: var(--dsw-alias-label-primary-foreground, #fff);
119
+ }
120
+ .dshdg-root button.dshdg-primary:hover:not(:disabled) { background: var(--dsw-alias-button-primary-hover, #2b49b8); }
121
+ .dshdg-root button.dshdg-danger { color: var(--dsw-alias-label-error, #d92d20); }
122
+ .dshdg-check { display: flex; flex-wrap: wrap; gap: 6px 12px; }
123
+ .dshdg-check label { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; }
124
+ .dshdg-check input { margin: 0; }
125
+ .dshdg-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--dsw-alias-border-l2, #e2e5e9); }
126
+ .dshdg-tab {
127
+ border: 1px solid transparent;
128
+ border-bottom: none;
129
+ border-radius: var(--dsw-radius-sm, 6px) var(--dsw-radius-sm, 6px) 0 0;
130
+ background: transparent;
131
+ padding: 6px 14px;
132
+ }
133
+ .dshdg-tab[aria-selected="true"] {
134
+ background: var(--dsw-alias-bg-layer-3, #fff);
135
+ border-color: var(--dsw-alias-border-l2, #e2e5e9);
136
+ font-weight: 600;
137
+ }
138
+ .dshdg-panel { display: flex; flex-direction: column; gap: 14px; }
139
+ .dshdg-notices { display: flex; flex-direction: column; gap: 6px; }
140
+ .dshdg-notice {
141
+ display: flex;
142
+ gap: 8px;
143
+ align-items: flex-start;
144
+ padding: 7px 10px;
145
+ border-radius: var(--dsw-radius-sm, 6px);
146
+ border: 1px solid var(--dsw-alias-border-l2, #e2e5e9);
147
+ background: var(--dsw-alias-bg-layer-4, #f7f8f9);
148
+ }
149
+ .dshdg-notice-error { border-color: var(--dsw-alias-label-error, #d92d20); }
150
+ .dshdg-notice-success { border-color: var(--dsw-alias-state-business-primary, #12b76a); }
151
+ .dshdg-notice > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
152
+ .dshdg-badge {
153
+ display: inline-block;
154
+ padding: 1px 8px;
155
+ border-radius: 999px;
156
+ border: 1px solid var(--dsw-alias-border-l3, #d3d7dd);
157
+ font-size: 11px;
158
+ white-space: nowrap;
159
+ }
160
+ .dshdg-badge-on { border-color: var(--dsw-alias-state-business-primary, #12b76a); }
161
+ .dshdg-badge-off { border-color: var(--dsw-alias-label-tertiary, #8a9098); color: var(--dsw-alias-label-secondary, #61666d); }
162
+ .dshdg-badge-warn { border-color: var(--dsw-alias-label-error, #d92d20); color: var(--dsw-alias-label-error, #d92d20); }
163
+ .dshdg-list { display: flex; flex-direction: column; gap: 8px; }
164
+ .dshdg-item {
165
+ border: 1px solid var(--dsw-alias-border-l2, #e2e5e9);
166
+ border-radius: var(--dsw-radius-sm, 6px);
167
+ padding: 10px 12px;
168
+ display: flex;
169
+ flex-direction: column;
170
+ gap: 8px;
171
+ min-width: 0;
172
+ }
173
+ .dshdg-item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
174
+ .dshdg-item-head strong { overflow-wrap: anywhere; }
175
+ .dshdg-secret-warning {
176
+ border: 1px solid var(--dsw-alias-label-error, #d92d20);
177
+ border-radius: var(--dsw-radius-sm, 6px);
178
+ padding: 10px 12px;
179
+ display: flex;
180
+ flex-direction: column;
181
+ gap: 8px;
182
+ }
183
+ .dshdg-token {
184
+ display: block;
185
+ width: 100%;
186
+ padding: 8px 10px;
187
+ border-radius: var(--dsw-radius-sm, 6px);
188
+ border: 1px dashed var(--dsw-alias-border-l3, #d3d7dd);
189
+ background: var(--dsw-alias-bg-base, #f7f8f9);
190
+ overflow-wrap: anywhere;
191
+ user-select: all;
192
+ }
193
+ .dshdg-pre {
194
+ margin: 0;
195
+ padding: 8px 10px;
196
+ max-height: 320px;
197
+ overflow: auto;
198
+ background: var(--dsw-alias-markdown-code-block, #f5f6f8);
199
+ border-radius: var(--dsw-radius-sm, 6px);
200
+ white-space: pre-wrap;
201
+ overflow-wrap: anywhere;
202
+ font-family: var(--ds-font-family-code, ui-monospace, SFMono-Regular, Consolas, monospace);
203
+ font-size: 12px;
204
+ }
205
+ .dshdg-layers { display: grid; gap: 6px; }
206
+ .dshdg-layer { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 8px; align-items: start; }
207
+ .dshdg-layer-detail { overflow-wrap: anywhere; }
208
+ .dshdg-ok { color: var(--dsw-alias-state-business-primary, #12b76a); }
209
+ .dshdg-fail { color: var(--dsw-alias-label-error, #d92d20); }
210
+ .dshdg-unknown { color: var(--dsw-alias-label-tertiary, #8a9098); }
211
+ .dshdg-table { display: grid; gap: 4px; }
212
+ .dshdg-kv { display: grid; grid-template-columns: minmax(96px, 140px) minmax(0, 1fr); gap: 4px 10px; }
213
+ .dshdg-kv dt { color: var(--dsw-alias-label-secondary, #61666d); }
214
+ .dshdg-kv dd { margin: 0; overflow-wrap: anywhere; }
215
+ @media (max-width: 560px) {
216
+ .dshdg-layer, .dshdg-kv { grid-template-columns: minmax(0, 1fr); }
217
+ }
218
+ `;
219
+
220
+ /**
221
+ * Inject the stylesheet once.
222
+ *
223
+ * @param {Document | null | undefined} doc - document to inject into; a non-browser
224
+ * or test composition passes `null` and receives a no-op disposer.
225
+ * @returns {() => void} disposer removing exactly the element this call created.
226
+ */
227
+ export function injectStyles(doc) {
228
+ const document_ = doc ?? (typeof document === 'undefined' ? null : document);
229
+ if (document_ === null || typeof document_.createElement !== 'function') return () => {};
230
+
231
+ const existing = typeof document_.getElementById === 'function'
232
+ ? document_.getElementById(STYLE_ELEMENT_ID)
233
+ : null;
234
+ if (existing !== null && existing !== undefined) {
235
+ // A previous instance of this plugin (HMR, re-enable) owns the sheet. Take it
236
+ // over instead of stacking a duplicate, and give the caller a disposer for it.
237
+ return () => {
238
+ existing.remove?.();
239
+ };
240
+ }
241
+
242
+ const element = document_.createElement('style');
243
+ element.id = STYLE_ELEMENT_ID;
244
+ element.setAttribute(STYLE_PLUGIN_ATTRIBUTE, STYLE_PLUGIN_ID);
245
+ element.textContent = CSS_TEXT;
246
+ const parent = document_.head ?? document_.documentElement ?? document_.body;
247
+ parent.appendChild(element);
248
+ return () => {
249
+ element.remove?.();
250
+ };
251
+ }