@ran-sh/dsh-crew 1.8.0 → 1.9.1

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 (151) hide show
  1. package/.claude-plugin/marketplace.json +16 -16
  2. package/.claude-plugin/plugin.json +14 -14
  3. package/LICENSE +21 -21
  4. package/README.de.md +359 -359
  5. package/README.es.md +359 -359
  6. package/README.fr.md +359 -359
  7. package/README.hi.md +359 -359
  8. package/README.id.md +359 -359
  9. package/README.ja.md +359 -359
  10. package/README.ko.md +359 -359
  11. package/README.md +126 -126
  12. package/README.pt.md +359 -359
  13. package/README.ru.md +359 -359
  14. package/README.th.md +359 -359
  15. package/README.tr.md +359 -359
  16. package/README.vi.md +359 -359
  17. package/README.zh-TW.md +359 -359
  18. package/README.zh.md +116 -116
  19. package/agents/ds-flash.md +24 -24
  20. package/agents/ds-pro.md +24 -24
  21. package/agents/ds-reviewer.md +23 -23
  22. package/agents/ds-worker.md +23 -23
  23. package/bin/dsh-crew.mjs +16 -16
  24. package/codex/agents/ds-flash.toml +34 -34
  25. package/codex/agents/ds-pro.toml +34 -34
  26. package/codex/agents/ds-reviewer.toml +32 -32
  27. package/codex/agents/ds-worker.toml +32 -32
  28. package/codex/prompts/dsh-config.md +19 -19
  29. package/codex/prompts/dsh-status.md +5 -5
  30. package/commands/config.md +23 -23
  31. package/commands/off.md +5 -5
  32. package/commands/on.md +5 -5
  33. package/commands/status.md +9 -9
  34. package/cordis.patch.yml +4 -4
  35. package/docs/gpt-relay-extension.md +103 -103
  36. package/docs/installation.md +138 -138
  37. package/docs/job-contracts.md +103 -103
  38. package/docs/readiness-matrix.md +85 -85
  39. package/docs/ui-surfaces.md +107 -107
  40. package/official-web-bridge/cordis.patch.yml +4 -4
  41. package/official-web-bridge/entry.mjs +1 -1
  42. package/official-web-bridge/overlay-entry.mjs +59 -59
  43. package/official-web-bridge/package.json +25 -25
  44. package/package.json +1 -1
  45. package/scripts/build-client.mjs +49 -49
  46. package/scripts/live-crew-smoke.mjs +39 -39
  47. package/scripts/live-policy-matrix.mjs +177 -177
  48. package/scripts/policy-probe.mjs +101 -101
  49. package/scripts/remove-legacy-official-bridge.ps1 +89 -89
  50. package/scripts/setup.mjs +393 -393
  51. package/scripts/smoke-real.mjs +110 -110
  52. package/scripts/smoke.mjs +78 -78
  53. package/scripts/verify-crew-ui-polish.mjs +145 -145
  54. package/scripts/verify-history-ui.mjs +97 -97
  55. package/scripts/verify-installer-fix.mjs +26 -26
  56. package/scripts/verify-npm-install.mjs +311 -311
  57. package/scripts/verify-official-bridge-e2e.mjs +192 -192
  58. package/src/adaptive-routing.mjs +260 -260
  59. package/src/client/activation-summary.tsx +64 -64
  60. package/src/client/collapsible-sections.mjs +55 -55
  61. package/src/client/history-panel.tsx +108 -108
  62. package/src/client/host-readiness.mjs +71 -71
  63. package/src/client/index.tsx +1711 -1711
  64. package/src/client/model-callability-view.mjs +17 -17
  65. package/src/client/panel-chrome.tsx +40 -40
  66. package/src/client/quick-entry.tsx +10 -10
  67. package/src/client/quick-panel.tsx +275 -275
  68. package/src/client/readiness-envelope.mjs +34 -34
  69. package/src/client/surface-detection.mjs +43 -43
  70. package/src/config-readiness.mjs +226 -226
  71. package/src/credential-reference.mjs +38 -38
  72. package/src/delivery.mjs +205 -205
  73. package/src/dsh-cli-runtime.mjs +1021 -1021
  74. package/src/dsh-cohort.mjs +20 -20
  75. package/src/extension-contract.mjs +104 -104
  76. package/src/failure-classification.mjs +201 -201
  77. package/src/history/admission-gate.mjs +67 -67
  78. package/src/history/archive-store.mjs +272 -272
  79. package/src/history/cleanup-plan.mjs +89 -89
  80. package/src/history/http.mjs +32 -32
  81. package/src/history/operation.mjs +86 -86
  82. package/src/history/runner-detach.mjs +34 -34
  83. package/src/history/runner.mjs +52 -52
  84. package/src/history/runtime.mjs +36 -36
  85. package/src/history/service.mjs +177 -177
  86. package/src/history/state.mjs +27 -27
  87. package/src/hub/entry.mjs +104 -104
  88. package/src/hub/index.mjs +2694 -2694
  89. package/src/hub-client.mjs +154 -154
  90. package/src/hub-compatibility.mjs +42 -42
  91. package/src/i18n.mjs +19 -19
  92. package/src/information-flow.mjs +67 -67
  93. package/src/install/cli.mjs +28 -28
  94. package/src/install/install-legacy.mjs +711 -711
  95. package/src/install/install.mjs +483 -483
  96. package/src/install/npx-lifecycle.mjs +3456 -3456
  97. package/src/install/official-frontend-assets.mjs +78 -78
  98. package/src/install/official-web.mjs +95 -95
  99. package/src/install/payload-content.mjs +88 -88
  100. package/src/install/windows-startup.mjs +236 -236
  101. package/src/install/windows-supervisor-adapter.mjs +443 -443
  102. package/src/install/windows-supervisor-lifecycle.mjs +782 -782
  103. package/src/install/zcode.mjs +397 -397
  104. package/src/job-contracts.mjs +255 -255
  105. package/src/local-request-guard.mjs +60 -60
  106. package/src/mcp-runtime.mjs +340 -332
  107. package/src/model-callability-contract.mjs +79 -79
  108. package/src/model-catalog.mjs +180 -180
  109. package/src/model-routing.mjs +586 -586
  110. package/src/model-schedule.mjs +207 -207
  111. package/src/official-web-bridge.mjs +447 -447
  112. package/src/policy.mjs +235 -235
  113. package/src/provider-delete-adapters.mjs +1934 -1934
  114. package/src/provider-health.mjs +130 -130
  115. package/src/provider-inventory.mjs +182 -182
  116. package/src/provider-layer-migration-adapters.mjs +759 -759
  117. package/src/provider-layer-migration.mjs +198 -198
  118. package/src/provider-lifecycle-state.mjs +103 -103
  119. package/src/provider-lifecycle.mjs +252 -252
  120. package/src/provider-profile-store.mjs +390 -390
  121. package/src/provider-settings-store.mjs +633 -633
  122. package/src/provider-store-lock.mjs +67 -67
  123. package/src/readiness-matrix.mjs +181 -181
  124. package/src/removable-waiter.mjs +29 -29
  125. package/src/role-profiles.mjs +107 -107
  126. package/src/runtime-controls.mjs +84 -84
  127. package/src/runtime-identity-contract.mjs +34 -34
  128. package/src/runtime-identity.mjs +235 -235
  129. package/src/runtime-readiness-snapshot.mjs +285 -285
  130. package/src/server.mjs +581 -581
  131. package/src/session-origins.mjs +60 -60
  132. package/src/standalone-sdk.mjs +23 -23
  133. package/src/status-shard.mjs +63 -63
  134. package/src/structured-error-code.mjs +38 -38
  135. package/src/supervisor/restart-request.mjs +256 -256
  136. package/src/workflow-runtime.mjs +739 -739
  137. package/src/workflow.mjs +155 -155
  138. package/src/workspace-audit.mjs +231 -231
  139. package/src/workspace-context.mjs +146 -146
  140. package/src/workspace-isolation.mjs +455 -401
  141. package/src/workspace-readiness.mjs +32 -32
  142. package/statusline/statusline.sh +14 -14
  143. package/statusline/worker-segment.sh +35 -35
  144. package/windows/start-dsh-crew.cmd +57 -57
  145. package/windows/start-dsh-crew.ps1 +1302 -1302
  146. package/windows/supervisor-control.ps1 +467 -467
  147. package/worker.cordis.yml +67 -67
  148. package/zcode/agents/ds-reviewer.md +31 -31
  149. package/zcode/agents/ds-worker.md +31 -31
  150. package/zcode/commands/dsh-config.md +17 -17
  151. package/zcode/commands/dsh-status.md +5 -5
@@ -1,107 +1,107 @@
1
- // Versioned, narrow Worker/Reviewer profiles. Profiles configure one DSH
2
- // delegation; they are not general Agent personas and never contain prompts or
3
- // credentials.
4
-
5
- import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
6
- import { dirname, join } from 'node:path';
7
- import { homedir } from 'node:os';
8
-
9
- export const ROLE_PROFILE_SCHEMA_VERSION = 1;
10
- export const DEFAULT_ROLE_PROFILES = Object.freeze({
11
- 'worker-default': Object.freeze({
12
- role: 'worker', routing: 'auto', isolation: 'worktree', fallback: true,
13
- timeout_seconds: 1800, review_strictness: 'standard',
14
- }),
15
- 'reviewer-default': Object.freeze({
16
- role: 'reviewer', routing: 'stable', isolation: 'readonly', fallback: false,
17
- timeout_seconds: 1800, review_strictness: 'strict',
18
- }),
19
- });
20
-
21
- const ID = /^[a-z0-9][a-z0-9._-]{0,63}$/;
22
- const ROLES = new Set(['worker', 'reviewer']);
23
- const ROUTING = new Set(['auto', 'priority', 'stable']);
24
- const ISOLATION = new Set(['worktree', 'readonly', 'shared']);
25
- const STRICTNESS = new Set(['standard', 'strict']);
26
-
27
- function normalizeProfile(id, raw) {
28
- if (!ID.test(id) || !raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
29
- if (!ROLES.has(raw.role)) return null;
30
- const base = DEFAULT_ROLE_PROFILES[`${raw.role}-default`];
31
- const routing = raw.routing ?? base.routing;
32
- const isolation = raw.isolation ?? base.isolation;
33
- const reviewStrictness = raw.review_strictness ?? base.review_strictness;
34
- const timeout = raw.timeout_seconds ?? base.timeout_seconds;
35
- if (!ROUTING.has(routing) || !ISOLATION.has(isolation) || !STRICTNESS.has(reviewStrictness)) return null;
36
- if (!Number.isInteger(timeout) || timeout < 1 || timeout > 7200) return null;
37
- if (raw.fallback !== undefined && typeof raw.fallback !== 'boolean') return null;
38
- return {
39
- role: raw.role,
40
- routing,
41
- isolation,
42
- fallback: raw.fallback ?? base.fallback,
43
- timeout_seconds: timeout,
44
- review_strictness: reviewStrictness,
45
- };
46
- }
47
-
48
- export function roleProfilesFile({ home = homedir() } = {}) {
49
- return join(home, '.config', 'dsh-crew', 'profiles.json');
50
- }
51
-
52
- export function loadRoleProfiles({ home = homedir(), file = roleProfilesFile({ home }) } = {}) {
53
- if (!existsSync(file)) {
54
- return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: true, source: 'defaults', profiles: { ...DEFAULT_ROLE_PROFILES }, errors: [] };
55
- }
56
- let raw;
57
- try { raw = JSON.parse(readFileSync(file, 'utf8')); } catch {
58
- return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: false, source: 'file', profiles: { ...DEFAULT_ROLE_PROFILES }, errors: [{ code: 'PROFILE_FILE_INVALID' }] };
59
- }
60
- return parseRoleProfiles(raw);
61
- }
62
-
63
- function parseRoleProfiles(raw) {
64
- const errors = [];
65
- const profiles = { ...DEFAULT_ROLE_PROFILES };
66
- if (raw?.schema_version !== ROLE_PROFILE_SCHEMA_VERSION || !raw.profiles || typeof raw.profiles !== 'object' || Array.isArray(raw.profiles)) {
67
- return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: false, source: 'file', profiles, errors: [{ code: 'PROFILE_FILE_INVALID' }] };
68
- }
69
- for (const [id, value] of Object.entries(raw.profiles)) {
70
- if (id in DEFAULT_ROLE_PROFILES) {
71
- const normalized = normalizeProfile(id, value);
72
- if (!normalized || JSON.stringify(normalized) !== JSON.stringify(DEFAULT_ROLE_PROFILES[id])) {
73
- errors.push({ code: 'PROFILE_DEFAULT_RESERVED', profile_id: id });
74
- }
75
- continue;
76
- }
77
- const profile = normalizeProfile(id, value);
78
- if (!profile) errors.push({ code: 'PROFILE_INVALID', profile_id: ID.test(id) ? id : '<invalid>' });
79
- else profiles[id] = profile;
80
- }
81
- return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: errors.length === 0, source: 'file', profiles, errors: errors.slice(0, 32) };
82
- }
83
-
84
- export function saveRoleProfiles(document, { home = homedir(), file = roleProfilesFile({ home }) } = {}) {
85
- const parsed = parseRoleProfiles(document);
86
- if (!parsed.ok) return parsed;
87
- const custom = Object.fromEntries(Object.entries(parsed.profiles).filter(([id]) => !(id in DEFAULT_ROLE_PROFILES)));
88
- const payload = { schema_version: ROLE_PROFILE_SCHEMA_VERSION, profiles: custom };
89
- mkdirSync(dirname(file), { recursive: true });
90
- const temp = `${file}.tmp-${process.pid}-${Date.now()}`;
91
- try {
92
- writeFileSync(temp, `${JSON.stringify(payload, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
93
- renameSync(temp, file);
94
- } catch (error) {
95
- rmSync(temp, { force: true });
96
- return { ...parsed, ok: false, errors: [{ code: 'PROFILE_FILE_WRITE_FAILED' }], error_code: 'PROFILE_FILE_WRITE_FAILED' };
97
- }
98
- return { ...parsed, source: 'file' };
99
- }
100
-
101
- export function resolveRoleProfile(registry, profileId, role = 'worker') {
102
- const id = profileId ?? `${role}-default`;
103
- const profile = registry?.profiles?.[id];
104
- if (!profile) return { ok: false, code: 'PROFILE_NOT_FOUND', profile_id: id };
105
- if (profile.role !== role) return { ok: false, code: 'PROFILE_ROLE_MISMATCH', profile_id: id, expected_role: role };
106
- return { ok: true, profile_id: id, profile: { ...profile } };
107
- }
1
+ // Versioned, narrow Worker/Reviewer profiles. Profiles configure one DSH
2
+ // delegation; they are not general Agent personas and never contain prompts or
3
+ // credentials.
4
+
5
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
6
+ import { dirname, join } from 'node:path';
7
+ import { homedir } from 'node:os';
8
+
9
+ export const ROLE_PROFILE_SCHEMA_VERSION = 1;
10
+ export const DEFAULT_ROLE_PROFILES = Object.freeze({
11
+ 'worker-default': Object.freeze({
12
+ role: 'worker', routing: 'auto', isolation: 'worktree', fallback: true,
13
+ timeout_seconds: 1800, review_strictness: 'standard',
14
+ }),
15
+ 'reviewer-default': Object.freeze({
16
+ role: 'reviewer', routing: 'stable', isolation: 'readonly', fallback: false,
17
+ timeout_seconds: 1800, review_strictness: 'strict',
18
+ }),
19
+ });
20
+
21
+ const ID = /^[a-z0-9][a-z0-9._-]{0,63}$/;
22
+ const ROLES = new Set(['worker', 'reviewer']);
23
+ const ROUTING = new Set(['auto', 'priority', 'stable']);
24
+ const ISOLATION = new Set(['worktree', 'readonly', 'shared']);
25
+ const STRICTNESS = new Set(['standard', 'strict']);
26
+
27
+ function normalizeProfile(id, raw) {
28
+ if (!ID.test(id) || !raw || typeof raw !== 'object' || Array.isArray(raw)) return null;
29
+ if (!ROLES.has(raw.role)) return null;
30
+ const base = DEFAULT_ROLE_PROFILES[`${raw.role}-default`];
31
+ const routing = raw.routing ?? base.routing;
32
+ const isolation = raw.isolation ?? base.isolation;
33
+ const reviewStrictness = raw.review_strictness ?? base.review_strictness;
34
+ const timeout = raw.timeout_seconds ?? base.timeout_seconds;
35
+ if (!ROUTING.has(routing) || !ISOLATION.has(isolation) || !STRICTNESS.has(reviewStrictness)) return null;
36
+ if (!Number.isInteger(timeout) || timeout < 1 || timeout > 7200) return null;
37
+ if (raw.fallback !== undefined && typeof raw.fallback !== 'boolean') return null;
38
+ return {
39
+ role: raw.role,
40
+ routing,
41
+ isolation,
42
+ fallback: raw.fallback ?? base.fallback,
43
+ timeout_seconds: timeout,
44
+ review_strictness: reviewStrictness,
45
+ };
46
+ }
47
+
48
+ export function roleProfilesFile({ home = homedir() } = {}) {
49
+ return join(home, '.config', 'dsh-crew', 'profiles.json');
50
+ }
51
+
52
+ export function loadRoleProfiles({ home = homedir(), file = roleProfilesFile({ home }) } = {}) {
53
+ if (!existsSync(file)) {
54
+ return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: true, source: 'defaults', profiles: { ...DEFAULT_ROLE_PROFILES }, errors: [] };
55
+ }
56
+ let raw;
57
+ try { raw = JSON.parse(readFileSync(file, 'utf8')); } catch {
58
+ return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: false, source: 'file', profiles: { ...DEFAULT_ROLE_PROFILES }, errors: [{ code: 'PROFILE_FILE_INVALID' }] };
59
+ }
60
+ return parseRoleProfiles(raw);
61
+ }
62
+
63
+ function parseRoleProfiles(raw) {
64
+ const errors = [];
65
+ const profiles = { ...DEFAULT_ROLE_PROFILES };
66
+ if (raw?.schema_version !== ROLE_PROFILE_SCHEMA_VERSION || !raw.profiles || typeof raw.profiles !== 'object' || Array.isArray(raw.profiles)) {
67
+ return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: false, source: 'file', profiles, errors: [{ code: 'PROFILE_FILE_INVALID' }] };
68
+ }
69
+ for (const [id, value] of Object.entries(raw.profiles)) {
70
+ if (id in DEFAULT_ROLE_PROFILES) {
71
+ const normalized = normalizeProfile(id, value);
72
+ if (!normalized || JSON.stringify(normalized) !== JSON.stringify(DEFAULT_ROLE_PROFILES[id])) {
73
+ errors.push({ code: 'PROFILE_DEFAULT_RESERVED', profile_id: id });
74
+ }
75
+ continue;
76
+ }
77
+ const profile = normalizeProfile(id, value);
78
+ if (!profile) errors.push({ code: 'PROFILE_INVALID', profile_id: ID.test(id) ? id : '<invalid>' });
79
+ else profiles[id] = profile;
80
+ }
81
+ return { schema_version: ROLE_PROFILE_SCHEMA_VERSION, ok: errors.length === 0, source: 'file', profiles, errors: errors.slice(0, 32) };
82
+ }
83
+
84
+ export function saveRoleProfiles(document, { home = homedir(), file = roleProfilesFile({ home }) } = {}) {
85
+ const parsed = parseRoleProfiles(document);
86
+ if (!parsed.ok) return parsed;
87
+ const custom = Object.fromEntries(Object.entries(parsed.profiles).filter(([id]) => !(id in DEFAULT_ROLE_PROFILES)));
88
+ const payload = { schema_version: ROLE_PROFILE_SCHEMA_VERSION, profiles: custom };
89
+ mkdirSync(dirname(file), { recursive: true });
90
+ const temp = `${file}.tmp-${process.pid}-${Date.now()}`;
91
+ try {
92
+ writeFileSync(temp, `${JSON.stringify(payload, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
93
+ renameSync(temp, file);
94
+ } catch (error) {
95
+ rmSync(temp, { force: true });
96
+ return { ...parsed, ok: false, errors: [{ code: 'PROFILE_FILE_WRITE_FAILED' }], error_code: 'PROFILE_FILE_WRITE_FAILED' };
97
+ }
98
+ return { ...parsed, source: 'file' };
99
+ }
100
+
101
+ export function resolveRoleProfile(registry, profileId, role = 'worker') {
102
+ const id = profileId ?? `${role}-default`;
103
+ const profile = registry?.profiles?.[id];
104
+ if (!profile) return { ok: false, code: 'PROFILE_NOT_FOUND', profile_id: id };
105
+ if (profile.role !== role) return { ok: false, code: 'PROFILE_ROLE_MISMATCH', profile_id: id, expected_role: role };
106
+ return { ok: true, profile_id: id, profile: { ...profile } };
107
+ }
@@ -1,84 +1,84 @@
1
- // Runtime control activation contract.
2
- //
3
- // This is deliberately data, not UI prose. MCP diagnostics and the Settings
4
- // surface consume the same boundary definitions so users are never told two
5
- // different stories about when a config change takes effect.
6
-
7
- export const ACTIVATION_BOUNDARY = Object.freeze({
8
- LIVE: 'live',
9
- NEXT_WORKFLOW: 'next-workflow',
10
- NEXT_SESSION: 'next-session',
11
- RESTART_REQUIRED: 'restart-required',
12
- });
13
-
14
- const N = ACTIVATION_BOUNDARY.NEXT_WORKFLOW;
15
- const S = ACTIVATION_BOUNDARY.NEXT_SESSION;
16
- const L = ACTIVATION_BOUNDARY.LIVE;
17
- const R = ACTIVATION_BOUNDARY.RESTART_REQUIRED;
18
-
19
- /**
20
- * `global` describes a write made through persisted Settings/config.
21
- * `session` describes an explicit dsh_worker_config override in the already
22
- * running MCP process. `session: null` means the setting is not a session
23
- * override surface.
24
- */
25
- export const RUNTIME_SETTING_ACTIVATION = Object.freeze({
26
- max_parallel: Object.freeze({ global: L, session: null, note: 'Admission limit refreshes before new workflow starts and when slots release; lowering never cancels active work.' }),
27
-
28
- subagents_enabled: Object.freeze({ global: N, session: N }),
29
- collaboration_mode: Object.freeze({ global: N, session: N }),
30
- main_agent_mode: Object.freeze({ global: N, session: N }),
31
- flash_state: Object.freeze({ global: N, session: N }),
32
- pro_state: Object.freeze({ global: N, session: N }),
33
- worker_state: Object.freeze({ global: N, session: N }),
34
- review_state: Object.freeze({ global: N, session: N }),
35
- auto_review: Object.freeze({ global: N, session: N }),
36
- pro_reviews_flash: Object.freeze({ global: N, session: N }),
37
- worker_provider_mode: Object.freeze({ global: N, session: null }),
38
- flash_model_priority: Object.freeze({ global: N, session: null }),
39
- flash_model_fallback: Object.freeze({ global: N, session: null }),
40
- pro_model_priority: Object.freeze({ global: N, session: null }),
41
- pro_model_fallback: Object.freeze({ global: N, session: null }),
42
- adaptive_routing: Object.freeze({ global: N, session: null, note: 'Opt-in provider health ordering is read for the next Hub model selection; existing explicit priorities remain authoritative.' }),
43
- isolation: Object.freeze({ global: N, session: null }),
44
-
45
- // These values are copied into the MCP session defaults at process startup.
46
- // dsh_worker_config can override them for subsequent workflows in that same
47
- // session, but persisted global edits require a new MCP session to inherit.
48
- default_tier: Object.freeze({ global: S, session: N }),
49
- default_effort: Object.freeze({ global: S, session: N }),
50
- mode: Object.freeze({ global: S, session: N }),
51
- default_timeout_seconds: Object.freeze({ global: S, session: N }),
52
- escalate_on_failure: Object.freeze({ global: S, session: N }),
53
- preset_flash: Object.freeze({ global: S, session: N }),
54
- preset_pro: Object.freeze({ global: S, session: N }),
55
-
56
- // hub-client freezes its base URL at module initialization.
57
- hub_url: Object.freeze({ global: R, session: null }),
58
- });
59
-
60
- export function activationForSetting(key) {
61
- const entry = RUNTIME_SETTING_ACTIVATION[key];
62
- return entry ? { ...entry } : null;
63
- }
64
-
65
- export function runtimeActivationMetadata() {
66
- return Object.fromEntries(
67
- Object.entries(RUNTIME_SETTING_ACTIVATION).map(([key, value]) => [key, { ...value }]),
68
- );
69
- }
70
-
71
- export function summarizeActivationBoundaries(metadata = RUNTIME_SETTING_ACTIVATION) {
72
- const out = {
73
- live: [],
74
- 'next-workflow': [],
75
- 'next-session': [],
76
- 'restart-required': [],
77
- };
78
- for (const [key, entry] of Object.entries(metadata)) {
79
- const boundary = entry?.global;
80
- if (out[boundary]) out[boundary].push(key);
81
- }
82
- for (const values of Object.values(out)) values.sort();
83
- return out;
84
- }
1
+ // Runtime control activation contract.
2
+ //
3
+ // This is deliberately data, not UI prose. MCP diagnostics and the Settings
4
+ // surface consume the same boundary definitions so users are never told two
5
+ // different stories about when a config change takes effect.
6
+
7
+ export const ACTIVATION_BOUNDARY = Object.freeze({
8
+ LIVE: 'live',
9
+ NEXT_WORKFLOW: 'next-workflow',
10
+ NEXT_SESSION: 'next-session',
11
+ RESTART_REQUIRED: 'restart-required',
12
+ });
13
+
14
+ const N = ACTIVATION_BOUNDARY.NEXT_WORKFLOW;
15
+ const S = ACTIVATION_BOUNDARY.NEXT_SESSION;
16
+ const L = ACTIVATION_BOUNDARY.LIVE;
17
+ const R = ACTIVATION_BOUNDARY.RESTART_REQUIRED;
18
+
19
+ /**
20
+ * `global` describes a write made through persisted Settings/config.
21
+ * `session` describes an explicit dsh_worker_config override in the already
22
+ * running MCP process. `session: null` means the setting is not a session
23
+ * override surface.
24
+ */
25
+ export const RUNTIME_SETTING_ACTIVATION = Object.freeze({
26
+ max_parallel: Object.freeze({ global: L, session: null, note: 'Admission limit refreshes before new workflow starts and when slots release; lowering never cancels active work.' }),
27
+
28
+ subagents_enabled: Object.freeze({ global: N, session: N }),
29
+ collaboration_mode: Object.freeze({ global: N, session: N }),
30
+ main_agent_mode: Object.freeze({ global: N, session: N }),
31
+ flash_state: Object.freeze({ global: N, session: N }),
32
+ pro_state: Object.freeze({ global: N, session: N }),
33
+ worker_state: Object.freeze({ global: N, session: N }),
34
+ review_state: Object.freeze({ global: N, session: N }),
35
+ auto_review: Object.freeze({ global: N, session: N }),
36
+ pro_reviews_flash: Object.freeze({ global: N, session: N }),
37
+ worker_provider_mode: Object.freeze({ global: N, session: null }),
38
+ flash_model_priority: Object.freeze({ global: N, session: null }),
39
+ flash_model_fallback: Object.freeze({ global: N, session: null }),
40
+ pro_model_priority: Object.freeze({ global: N, session: null }),
41
+ pro_model_fallback: Object.freeze({ global: N, session: null }),
42
+ adaptive_routing: Object.freeze({ global: N, session: null, note: 'Opt-in provider health ordering is read for the next Hub model selection; existing explicit priorities remain authoritative.' }),
43
+ isolation: Object.freeze({ global: N, session: null }),
44
+
45
+ // These values are copied into the MCP session defaults at process startup.
46
+ // dsh_worker_config can override them for subsequent workflows in that same
47
+ // session, but persisted global edits require a new MCP session to inherit.
48
+ default_tier: Object.freeze({ global: S, session: N }),
49
+ default_effort: Object.freeze({ global: S, session: N }),
50
+ mode: Object.freeze({ global: S, session: N }),
51
+ default_timeout_seconds: Object.freeze({ global: S, session: N }),
52
+ escalate_on_failure: Object.freeze({ global: S, session: N }),
53
+ preset_flash: Object.freeze({ global: S, session: N }),
54
+ preset_pro: Object.freeze({ global: S, session: N }),
55
+
56
+ // hub-client freezes its base URL at module initialization.
57
+ hub_url: Object.freeze({ global: R, session: null }),
58
+ });
59
+
60
+ export function activationForSetting(key) {
61
+ const entry = RUNTIME_SETTING_ACTIVATION[key];
62
+ return entry ? { ...entry } : null;
63
+ }
64
+
65
+ export function runtimeActivationMetadata() {
66
+ return Object.fromEntries(
67
+ Object.entries(RUNTIME_SETTING_ACTIVATION).map(([key, value]) => [key, { ...value }]),
68
+ );
69
+ }
70
+
71
+ export function summarizeActivationBoundaries(metadata = RUNTIME_SETTING_ACTIVATION) {
72
+ const out = {
73
+ live: [],
74
+ 'next-workflow': [],
75
+ 'next-session': [],
76
+ 'restart-required': [],
77
+ };
78
+ for (const [key, entry] of Object.entries(metadata)) {
79
+ const boundary = entry?.global;
80
+ if (out[boundary]) out[boundary].push(key);
81
+ }
82
+ for (const values of Object.values(out)) values.sort();
83
+ return out;
84
+ }
@@ -1,34 +1,34 @@
1
- // Browser-safe runtime identity primitives shared by the Hub, extension
2
- // contract and client. Do not coerce missing values: an incomplete identity
3
- // is never evidence of the native 3210 Crew runtime.
4
-
5
- export const PRODUCTION_EXECUTION_PLANE = 'hub-3210';
6
- export const PRODUCTION_PROFILE = 'dsh-crew';
7
- export const PRODUCTION_LISTEN_PORT = 3210;
8
-
9
- function nonEmpty(value) {
10
- return typeof value === 'string' && value.trim().length > 0;
11
- }
12
-
13
- export function isCompleteRuntimeIdentity(identity) {
14
- return Boolean(identity && typeof identity === 'object'
15
- && nonEmpty(identity.execution_plane)
16
- && nonEmpty(identity.profile)
17
- && Number.isInteger(identity.listen_port) && identity.listen_port > 0
18
- && nonEmpty(identity.runtime_id));
19
- }
20
-
21
- export function sameCompleteRuntimeIdentity(left, right) {
22
- return isCompleteRuntimeIdentity(left) && isCompleteRuntimeIdentity(right)
23
- && left.execution_plane === right.execution_plane
24
- && left.profile === right.profile
25
- && left.listen_port === right.listen_port
26
- && left.runtime_id === right.runtime_id;
27
- }
28
-
29
- export function isExactNativeCrewIdentity(identity) {
30
- return isCompleteRuntimeIdentity(identity)
31
- && identity.execution_plane === PRODUCTION_EXECUTION_PLANE
32
- && identity.profile === PRODUCTION_PROFILE
33
- && identity.listen_port === PRODUCTION_LISTEN_PORT;
34
- }
1
+ // Browser-safe runtime identity primitives shared by the Hub, extension
2
+ // contract and client. Do not coerce missing values: an incomplete identity
3
+ // is never evidence of the native 3210 Crew runtime.
4
+
5
+ export const PRODUCTION_EXECUTION_PLANE = 'hub-3210';
6
+ export const PRODUCTION_PROFILE = 'dsh-crew';
7
+ export const PRODUCTION_LISTEN_PORT = 3210;
8
+
9
+ function nonEmpty(value) {
10
+ return typeof value === 'string' && value.trim().length > 0;
11
+ }
12
+
13
+ export function isCompleteRuntimeIdentity(identity) {
14
+ return Boolean(identity && typeof identity === 'object'
15
+ && nonEmpty(identity.execution_plane)
16
+ && nonEmpty(identity.profile)
17
+ && Number.isInteger(identity.listen_port) && identity.listen_port > 0
18
+ && nonEmpty(identity.runtime_id));
19
+ }
20
+
21
+ export function sameCompleteRuntimeIdentity(left, right) {
22
+ return isCompleteRuntimeIdentity(left) && isCompleteRuntimeIdentity(right)
23
+ && left.execution_plane === right.execution_plane
24
+ && left.profile === right.profile
25
+ && left.listen_port === right.listen_port
26
+ && left.runtime_id === right.runtime_id;
27
+ }
28
+
29
+ export function isExactNativeCrewIdentity(identity) {
30
+ return isCompleteRuntimeIdentity(identity)
31
+ && identity.execution_plane === PRODUCTION_EXECUTION_PLANE
32
+ && identity.profile === PRODUCTION_PROFILE
33
+ && identity.listen_port === PRODUCTION_LISTEN_PORT;
34
+ }