@sanqianx/claude-ai-workbench 0.13.2 → 0.13.4

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 -201
  2. package/README.md +156 -156
  3. package/apps/agent-terminal/app.css +652 -613
  4. package/apps/agent-terminal/app.js +143 -67
  5. package/apps/agent-terminal/conversation-composer.js +44 -0
  6. package/apps/agent-terminal/index.html +172 -170
  7. package/apps/agent-terminal/panel-host-proof.html +152 -152
  8. package/apps/agent-terminal/panel-proof-content.html +41 -41
  9. package/apps/agent-terminal/right-workspace-dock.css +189 -159
  10. package/apps/agent-terminal/right-workspace-dock.js +652 -521
  11. package/apps/agent-terminal/user-question-card.js +68 -0
  12. package/apps/ai-profile-settings-host/index.html +25 -25
  13. package/apps/ai-profile-settings-host/page.css +1 -1
  14. package/apps/ai-profile-settings-host/page.js +113 -113
  15. package/apps/minimal-test-host/README.md +15 -15
  16. package/apps/minimal-test-host/host.css +2 -2
  17. package/apps/minimal-test-host/host.js +35 -35
  18. package/apps/minimal-test-host/index.html +58 -58
  19. package/apps/minimal-test-host/optional-mock/fault-injection.js +15 -15
  20. package/docs/sdk/FILE_LAYOUT.md +31 -31
  21. package/docs/sdk/INTEGRATION.md +126 -126
  22. package/docs/sdk/README.md +21 -21
  23. package/docs/sdk/SESSION_EVENTS.md +15 -13
  24. package/docs/sdk/openapi.yaml +16 -1
  25. package/package.json +1 -1
  26. package/packages/client/README.md +29 -29
  27. package/packages/client/index.d.ts +122 -122
  28. package/packages/client/index.js +260 -260
  29. package/packages/client/package.json +2 -2
  30. package/packages/contracts/README.md +9 -9
  31. package/packages/contracts/index.d.ts +519 -517
  32. package/packages/contracts/index.js +312 -312
  33. package/packages/contracts/package.json +1 -1
  34. package/packages/core/README.md +8 -8
  35. package/packages/core/index.d.ts +76 -76
  36. package/packages/core/index.js +222 -222
  37. package/packages/core/package.json +2 -2
  38. package/packages/server/README.md +17 -17
  39. package/packages/server/bin/agent-terminal-server.js +42 -42
  40. package/packages/server/bin/claude-workbench.js +225 -225
  41. package/packages/server/index.d.ts +171 -171
  42. package/packages/server/index.js +230 -230
  43. package/packages/server/lib/agent-discovery.js +133 -133
  44. package/packages/server/lib/agent-registry.js +143 -143
  45. package/packages/server/lib/agent-spawn-env.js +17 -17
  46. package/packages/server/lib/attachment-store.js +78 -78
  47. package/packages/server/lib/bridges/app-server-bridge.js +373 -373
  48. package/packages/server/lib/bridges/opencode-server-bridge.js +506 -506
  49. package/packages/server/lib/capture-settings-store.js +35 -35
  50. package/packages/server/lib/claude-history-recovery.js +87 -87
  51. package/packages/server/lib/cli-session-recovery.js +28 -28
  52. package/packages/server/lib/context-resolver.js +55 -55
  53. package/packages/server/lib/conversation-capture.js +51 -51
  54. package/packages/server/lib/delegation-phase-store.js +357 -357
  55. package/packages/server/lib/delegation-store.js +474 -468
  56. package/packages/server/lib/diagnostics.js +32 -32
  57. package/packages/server/lib/drivers/cli-json-runner.js +974 -974
  58. package/packages/server/lib/drivers/codex-driver.js +1461 -1442
  59. package/packages/server/lib/drivers/opencode-driver.js +1554 -1554
  60. package/packages/server/lib/drivers/zcode-driver.js +1250 -1250
  61. package/packages/server/lib/drivers/zcode-profile-runtime.js +71 -71
  62. package/packages/server/lib/event-stream.js +138 -138
  63. package/packages/server/lib/folder-picker.js +623 -623
  64. package/packages/server/lib/http-handler.js +339 -339
  65. package/packages/server/lib/json-file.js +26 -26
  66. package/packages/server/lib/knowledge-context.js +33 -33
  67. package/packages/server/lib/model-detection.js +295 -295
  68. package/packages/server/lib/parent-context.js +44 -0
  69. package/packages/server/lib/profile-store.js +283 -283
  70. package/packages/server/lib/project-store.js +102 -102
  71. package/packages/server/lib/runtime-loader.js +120 -120
  72. package/packages/server/lib/session-archive-store.js +53 -53
  73. package/packages/server/lib/session-history.js +612 -612
  74. package/packages/server/lib/system-doctor.js +125 -125
  75. package/packages/server/lib/ui-preferences-store.js +48 -48
  76. package/packages/server/lib/user-questions.js +67 -0
  77. package/packages/server/lib/workbench-service.js +1696 -1675
  78. package/packages/server/package.json +2 -2
  79. package/packages/ui/README.md +30 -30
  80. package/packages/ui/ai-profile-settings.d.ts +45 -45
  81. package/packages/ui/ai-profile-settings.js +283 -283
  82. package/packages/ui/claude-terminal.d.ts +31 -31
  83. package/packages/ui/claude-terminal.js +343 -343
  84. package/packages/ui/index.d.ts +18 -18
  85. package/packages/ui/index.js +51 -51
  86. package/packages/ui/package.json +2 -2
  87. package/packages/ui/theme.css +13 -13
  88. package/src/assets/claude-prompts.json +21 -21
  89. package/src/backend/http/ai-profile-routes.js +61 -61
  90. package/src/backend/http/claude-routes.js +170 -170
  91. package/src/backend/http/node-helpers.js +45 -45
  92. package/src/backend/index.js +21 -21
  93. package/src/backend/lib/ai-adapter.js +144 -144
  94. package/src/backend/lib/ai-profile-store.js +259 -259
  95. package/src/backend/lib/ai-vendor-presets.js +83 -83
  96. package/src/backend/lib/ai-workspace.js +140 -140
  97. package/src/backend/lib/automation-config.js +253 -253
  98. package/src/backend/lib/claude-cli-runner.js +2408 -2392
  99. package/src/backend/lib/data-dir.js +169 -169
  100. package/src/backend/lib/llm-client.js +176 -176
  101. package/src/backend/lib/model-context-windows.js +82 -82
  102. package/src/backend/lib/native-task-control.js +217 -217
  103. package/src/backend/lib/native-task-history-index.js +475 -475
  104. package/src/backend/lib/native-task-history-reader.js +526 -526
  105. package/src/backend/lib/native-task-messages.js +457 -457
  106. package/src/backend/lib/native-task-registry.js +325 -325
  107. package/src/backend/lib/native-task-runtime.js +242 -242
  108. package/src/backend/lib/native-task-trace.js +440 -440
  109. package/src/backend/lib/native-task-transcript.js +393 -393
  110. package/src/backend/lib/prompt-registry.js +166 -166
  111. package/src/backend/lib/runtime-config.js +121 -121
  112. package/src/backend/lib/sdk-session-stream.js +143 -143
  113. package/src/backend/lib/sdk-turn-stream.js +16 -16
  114. package/src/backend/lib/store-scope.js +131 -131
  115. package/src/backend/lib/task-identity.js +104 -104
  116. package/src/backend/lib/task-state-projection.js +58 -58
  117. package/src/index.js +7 -7
  118. package/src/sdk-wave-a.ts +1 -1
  119. package/src/sdk-wave-b.ts +1 -1
  120. package/src/sdk-wave-c.ts +1 -1
  121. package/src/sdk-wave-d.ts +1 -1
  122. package/src/sdk-wave-e.ts +1 -1
@@ -1,83 +1,83 @@
1
- // Built-in vendor presets for common Anthropic-compatible providers.
2
- // baseUrl and model names verified against each vendor's public docs (2026-06).
3
- // When a user picks one of these vendor names in the profile form, all fields
4
- // below are auto-filled — they only need to supply an API key.
5
- //
6
- // baseUrl MUST be the /anthropic-compatible endpoint, not the OpenAI-compatible
7
- // one, because the runner speaks the Anthropic Messages API. Wrong path → 404.
8
- const AI_VENDOR_PRESETS = [
9
- {
10
- id: 'anthropic',
11
- name: 'Anthropic Claude',
12
- baseUrl: 'https://api.anthropic.com',
13
- mainModel: 'claude-sonnet-4-5',
14
- thinkingModel: 'claude-opus-4-7',
15
- haikuModel: 'claude-haiku-4-5',
16
- sonnetModel: 'claude-sonnet-4-5',
17
- opusModel: 'claude-opus-4-7',
18
- contextWindow: 200000,
19
- website: 'https://www.anthropic.com',
20
- },
21
- {
22
- id: 'minimax',
23
- name: 'MiniMax',
24
- // Domestic (China) endpoint. minimax.io is the overseas domain with a
25
- // separate account system — API keys are NOT interchangeable. Domestic
26
- // users register at minimaxi.com, so we default to that.
27
- baseUrl: 'https://api.minimaxi.com/anthropic',
28
- mainModel: 'MiniMax-M3',
29
- thinkingModel: 'MiniMax-M3',
30
- haikuModel: 'MiniMax-M3',
31
- sonnetModel: 'MiniMax-M3',
32
- opusModel: 'MiniMax-M3',
33
- contextWindow: 1048576,
34
- website: 'https://platform.minimaxi.com',
35
- },
36
- {
37
- id: 'zhipu',
38
- name: '智谱 GLM',
39
- // Anthropic-compatible endpoint, not the OpenAI-style /api/paas/v4.
40
- baseUrl: 'https://open.bigmodel.cn/api/anthropic',
41
- mainModel: 'glm-4.6',
42
- thinkingModel: 'glm-4.6',
43
- haikuModel: 'glm-4.5-air',
44
- sonnetModel: 'glm-4.6',
45
- opusModel: 'glm-4.6',
46
- contextWindow: 1048576,
47
- website: 'https://open.bigmodel.cn',
48
- },
49
- {
50
- id: 'deepseek',
51
- name: 'DeepSeek',
52
- // Anthropic-compatible endpoint at /anthropic, not the bare domain.
53
- baseUrl: 'https://api.deepseek.com/anthropic',
54
- mainModel: 'deepseek-chat',
55
- thinkingModel: 'deepseek-reasoner',
56
- haikuModel: 'deepseek-chat',
57
- sonnetModel: 'deepseek-chat',
58
- opusModel: 'deepseek-reasoner',
59
- contextWindow: 128000,
60
- website: 'https://platform.deepseek.com',
61
- },
62
- ];
63
-
64
- function listVendorPresetNames() {
65
- return AI_VENDOR_PRESETS.map(v => v.name);
66
- }
67
-
68
- // Match by name (case-insensitive) or id (case-insensitive). Returns the
69
- // preset object or null. Custom vendor names that don't match return null —
70
- // the caller then leaves the user-typed value alone.
71
- function findVendorPresetByName(name) {
72
- const norm = String(name || '').trim().toLowerCase();
73
- if (!norm) return null;
74
- return AI_VENDOR_PRESETS.find(v =>
75
- v.name.toLowerCase() === norm || v.id.toLowerCase() === norm
76
- ) || null;
77
- }
78
-
79
- module.exports = {
80
- AI_VENDOR_PRESETS,
81
- listVendorPresetNames,
82
- findVendorPresetByName,
83
- };
1
+ // Built-in vendor presets for common Anthropic-compatible providers.
2
+ // baseUrl and model names verified against each vendor's public docs (2026-06).
3
+ // When a user picks one of these vendor names in the profile form, all fields
4
+ // below are auto-filled — they only need to supply an API key.
5
+ //
6
+ // baseUrl MUST be the /anthropic-compatible endpoint, not the OpenAI-compatible
7
+ // one, because the runner speaks the Anthropic Messages API. Wrong path → 404.
8
+ const AI_VENDOR_PRESETS = [
9
+ {
10
+ id: 'anthropic',
11
+ name: 'Anthropic Claude',
12
+ baseUrl: 'https://api.anthropic.com',
13
+ mainModel: 'claude-sonnet-4-5',
14
+ thinkingModel: 'claude-opus-4-7',
15
+ haikuModel: 'claude-haiku-4-5',
16
+ sonnetModel: 'claude-sonnet-4-5',
17
+ opusModel: 'claude-opus-4-7',
18
+ contextWindow: 200000,
19
+ website: 'https://www.anthropic.com',
20
+ },
21
+ {
22
+ id: 'minimax',
23
+ name: 'MiniMax',
24
+ // Domestic (China) endpoint. minimax.io is the overseas domain with a
25
+ // separate account system — API keys are NOT interchangeable. Domestic
26
+ // users register at minimaxi.com, so we default to that.
27
+ baseUrl: 'https://api.minimaxi.com/anthropic',
28
+ mainModel: 'MiniMax-M3',
29
+ thinkingModel: 'MiniMax-M3',
30
+ haikuModel: 'MiniMax-M3',
31
+ sonnetModel: 'MiniMax-M3',
32
+ opusModel: 'MiniMax-M3',
33
+ contextWindow: 1048576,
34
+ website: 'https://platform.minimaxi.com',
35
+ },
36
+ {
37
+ id: 'zhipu',
38
+ name: '智谱 GLM',
39
+ // Anthropic-compatible endpoint, not the OpenAI-style /api/paas/v4.
40
+ baseUrl: 'https://open.bigmodel.cn/api/anthropic',
41
+ mainModel: 'glm-4.6',
42
+ thinkingModel: 'glm-4.6',
43
+ haikuModel: 'glm-4.5-air',
44
+ sonnetModel: 'glm-4.6',
45
+ opusModel: 'glm-4.6',
46
+ contextWindow: 1048576,
47
+ website: 'https://open.bigmodel.cn',
48
+ },
49
+ {
50
+ id: 'deepseek',
51
+ name: 'DeepSeek',
52
+ // Anthropic-compatible endpoint at /anthropic, not the bare domain.
53
+ baseUrl: 'https://api.deepseek.com/anthropic',
54
+ mainModel: 'deepseek-chat',
55
+ thinkingModel: 'deepseek-reasoner',
56
+ haikuModel: 'deepseek-chat',
57
+ sonnetModel: 'deepseek-chat',
58
+ opusModel: 'deepseek-reasoner',
59
+ contextWindow: 128000,
60
+ website: 'https://platform.deepseek.com',
61
+ },
62
+ ];
63
+
64
+ function listVendorPresetNames() {
65
+ return AI_VENDOR_PRESETS.map(v => v.name);
66
+ }
67
+
68
+ // Match by name (case-insensitive) or id (case-insensitive). Returns the
69
+ // preset object or null. Custom vendor names that don't match return null —
70
+ // the caller then leaves the user-typed value alone.
71
+ function findVendorPresetByName(name) {
72
+ const norm = String(name || '').trim().toLowerCase();
73
+ if (!norm) return null;
74
+ return AI_VENDOR_PRESETS.find(v =>
75
+ v.name.toLowerCase() === norm || v.id.toLowerCase() === norm
76
+ ) || null;
77
+ }
78
+
79
+ module.exports = {
80
+ AI_VENDOR_PRESETS,
81
+ listVendorPresetNames,
82
+ findVendorPresetByName,
83
+ };
@@ -1,140 +1,140 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { getDataDir } = require('./data-dir');
4
- const { getWorkbenchConfig } = require('./runtime-config');
5
-
6
- const SITE_ROOT = path.resolve(__dirname, '..');
7
-
8
- function appRoot() {
9
- return getDataDir();
10
- }
11
-
12
- function aiRoot() {
13
- const cfg = getWorkbenchConfig();
14
- return path.join(appRoot(), cfg.aiRootDirName || '_ai');
15
- }
16
-
17
- function standardSubdirs() {
18
- const cfg = getWorkbenchConfig();
19
- const dirs = Array.isArray(cfg.standardSubdirs) && cfg.standardSubdirs.length
20
- ? cfg.standardSubdirs.slice()
21
- : ['drafts', 'runs', 'context-packs', 'backups'];
22
- if (cfg.sessionDirName && !dirs.includes(cfg.sessionDirName)) dirs.push(cfg.sessionDirName);
23
- return dirs;
24
- }
25
-
26
- function safeSlug(slug) {
27
- return typeof slug === 'string' && /^[a-z0-9][a-z0-9-]{0,40}$/.test(slug);
28
- }
29
-
30
- function projectAIPath(slug) {
31
- if (!safeSlug(slug)) throw new Error(`invalid slug for AI workspace: ${slug}`);
32
- return path.join(aiRoot(), slug);
33
- }
34
-
35
- function ensureProjectAIPath(slug) {
36
- const root = projectAIPath(slug);
37
- for (const sub of standardSubdirs()) {
38
- fs.mkdirSync(path.join(root, sub), { recursive: true });
39
- }
40
- return root;
41
- }
42
-
43
- function legacyAIPath(kbPath) {
44
- return path.join(kbPath, '_ai');
45
- }
46
-
47
- function copyDir(src, dest) {
48
- fs.mkdirSync(dest, { recursive: true });
49
- for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
50
- const from = path.join(src, entry.name);
51
- const to = path.join(dest, entry.name);
52
- if (entry.isDirectory()) copyDir(from, to);
53
- else if (entry.isFile()) fs.copyFileSync(from, to);
54
- }
55
- }
56
-
57
- function migrateAIWorkspace({ slug, kbPath, preserveOriginal = true }) {
58
- const legacy = legacyAIPath(kbPath);
59
- const target = ensureProjectAIPath(slug);
60
- const result = {
61
- ok: true,
62
- slug,
63
- legacyPath: legacy,
64
- targetPath: target,
65
- copied: false,
66
- preservedOriginal: preserveOriginal,
67
- };
68
- if (!fs.existsSync(legacy)) return result;
69
- copyDir(legacy, target);
70
- result.copied = true;
71
- if (!preserveOriginal) {
72
- fs.rmSync(legacy, { recursive: true, force: true });
73
- result.preservedOriginal = false;
74
- }
75
- return result;
76
- }
77
-
78
- function runPath(slug, runId) {
79
- return path.join(projectAIPath(slug), 'runs', `${runId}.json`);
80
- }
81
-
82
- function draftDir(slug, runId) {
83
- return path.join(projectAIPath(slug), 'drafts', runId);
84
- }
85
-
86
- function contextPackDir(slug, runId) {
87
- return path.join(projectAIPath(slug), 'context-packs', runId);
88
- }
89
-
90
- function findExistingRunPath({ slug, kbPath, runId }) {
91
- const primary = path.join(projectAIPath(slug), 'runs', `${runId}.json`);
92
- return primary;
93
- }
94
-
95
- function findExistingDraftDir({ slug, kbPath, runId }) {
96
- const primary = path.join(projectAIPath(slug), 'drafts', runId);
97
- return primary;
98
- }
99
-
100
- function listProjectDirs(projectSlug = null, projects = null) {
101
- if (projectSlug) return [projectAIPath(projectSlug)];
102
- const dirs = [];
103
- const root = aiRoot();
104
- if (fs.existsSync(root)) {
105
- for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
106
- if (entry.isDirectory() && safeSlug(entry.name)) dirs.push(path.join(root, entry.name));
107
- }
108
- }
109
- if (projects) {
110
- for (const [slug] of Object.entries(projects)) {
111
- if (safeSlug(slug)) dirs.push(projectAIPath(slug));
112
- }
113
- }
114
- return [...new Set(dirs.map(d => path.resolve(d)))];
115
- }
116
-
117
- const exported = {
118
- SITE_ROOT,
119
- appRoot,
120
- aiRoot,
121
- standardSubdirs,
122
- projectAIPath,
123
- ensureProjectAIPath,
124
- legacyAIPath,
125
- migrateAIWorkspace,
126
- runPath,
127
- draftDir,
128
- contextPackDir,
129
- findExistingRunPath,
130
- findExistingDraftDir,
131
- listProjectDirs,
132
- };
133
-
134
- Object.defineProperties(exported, {
135
- APP_ROOT: { enumerable: true, get: appRoot },
136
- AI_ROOT: { enumerable: true, get: aiRoot },
137
- STANDARD_SUBDIRS: { enumerable: true, get: standardSubdirs },
138
- });
139
-
140
- module.exports = exported;
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { getDataDir } = require('./data-dir');
4
+ const { getWorkbenchConfig } = require('./runtime-config');
5
+
6
+ const SITE_ROOT = path.resolve(__dirname, '..');
7
+
8
+ function appRoot() {
9
+ return getDataDir();
10
+ }
11
+
12
+ function aiRoot() {
13
+ const cfg = getWorkbenchConfig();
14
+ return path.join(appRoot(), cfg.aiRootDirName || '_ai');
15
+ }
16
+
17
+ function standardSubdirs() {
18
+ const cfg = getWorkbenchConfig();
19
+ const dirs = Array.isArray(cfg.standardSubdirs) && cfg.standardSubdirs.length
20
+ ? cfg.standardSubdirs.slice()
21
+ : ['drafts', 'runs', 'context-packs', 'backups'];
22
+ if (cfg.sessionDirName && !dirs.includes(cfg.sessionDirName)) dirs.push(cfg.sessionDirName);
23
+ return dirs;
24
+ }
25
+
26
+ function safeSlug(slug) {
27
+ return typeof slug === 'string' && /^[a-z0-9][a-z0-9-]{0,40}$/.test(slug);
28
+ }
29
+
30
+ function projectAIPath(slug) {
31
+ if (!safeSlug(slug)) throw new Error(`invalid slug for AI workspace: ${slug}`);
32
+ return path.join(aiRoot(), slug);
33
+ }
34
+
35
+ function ensureProjectAIPath(slug) {
36
+ const root = projectAIPath(slug);
37
+ for (const sub of standardSubdirs()) {
38
+ fs.mkdirSync(path.join(root, sub), { recursive: true });
39
+ }
40
+ return root;
41
+ }
42
+
43
+ function legacyAIPath(kbPath) {
44
+ return path.join(kbPath, '_ai');
45
+ }
46
+
47
+ function copyDir(src, dest) {
48
+ fs.mkdirSync(dest, { recursive: true });
49
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
50
+ const from = path.join(src, entry.name);
51
+ const to = path.join(dest, entry.name);
52
+ if (entry.isDirectory()) copyDir(from, to);
53
+ else if (entry.isFile()) fs.copyFileSync(from, to);
54
+ }
55
+ }
56
+
57
+ function migrateAIWorkspace({ slug, kbPath, preserveOriginal = true }) {
58
+ const legacy = legacyAIPath(kbPath);
59
+ const target = ensureProjectAIPath(slug);
60
+ const result = {
61
+ ok: true,
62
+ slug,
63
+ legacyPath: legacy,
64
+ targetPath: target,
65
+ copied: false,
66
+ preservedOriginal: preserveOriginal,
67
+ };
68
+ if (!fs.existsSync(legacy)) return result;
69
+ copyDir(legacy, target);
70
+ result.copied = true;
71
+ if (!preserveOriginal) {
72
+ fs.rmSync(legacy, { recursive: true, force: true });
73
+ result.preservedOriginal = false;
74
+ }
75
+ return result;
76
+ }
77
+
78
+ function runPath(slug, runId) {
79
+ return path.join(projectAIPath(slug), 'runs', `${runId}.json`);
80
+ }
81
+
82
+ function draftDir(slug, runId) {
83
+ return path.join(projectAIPath(slug), 'drafts', runId);
84
+ }
85
+
86
+ function contextPackDir(slug, runId) {
87
+ return path.join(projectAIPath(slug), 'context-packs', runId);
88
+ }
89
+
90
+ function findExistingRunPath({ slug, kbPath, runId }) {
91
+ const primary = path.join(projectAIPath(slug), 'runs', `${runId}.json`);
92
+ return primary;
93
+ }
94
+
95
+ function findExistingDraftDir({ slug, kbPath, runId }) {
96
+ const primary = path.join(projectAIPath(slug), 'drafts', runId);
97
+ return primary;
98
+ }
99
+
100
+ function listProjectDirs(projectSlug = null, projects = null) {
101
+ if (projectSlug) return [projectAIPath(projectSlug)];
102
+ const dirs = [];
103
+ const root = aiRoot();
104
+ if (fs.existsSync(root)) {
105
+ for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
106
+ if (entry.isDirectory() && safeSlug(entry.name)) dirs.push(path.join(root, entry.name));
107
+ }
108
+ }
109
+ if (projects) {
110
+ for (const [slug] of Object.entries(projects)) {
111
+ if (safeSlug(slug)) dirs.push(projectAIPath(slug));
112
+ }
113
+ }
114
+ return [...new Set(dirs.map(d => path.resolve(d)))];
115
+ }
116
+
117
+ const exported = {
118
+ SITE_ROOT,
119
+ appRoot,
120
+ aiRoot,
121
+ standardSubdirs,
122
+ projectAIPath,
123
+ ensureProjectAIPath,
124
+ legacyAIPath,
125
+ migrateAIWorkspace,
126
+ runPath,
127
+ draftDir,
128
+ contextPackDir,
129
+ findExistingRunPath,
130
+ findExistingDraftDir,
131
+ listProjectDirs,
132
+ };
133
+
134
+ Object.defineProperties(exported, {
135
+ APP_ROOT: { enumerable: true, get: appRoot },
136
+ AI_ROOT: { enumerable: true, get: aiRoot },
137
+ STANDARD_SUBDIRS: { enumerable: true, get: standardSubdirs },
138
+ });
139
+
140
+ module.exports = exported;