dsh-git-worktree 0.9.2 → 0.9.3
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.
- package/CHANGELOG.md +405 -386
- package/LICENSE +21 -21
- package/NOTICE +16 -14
- package/README.en.md +169 -169
- package/README.md +169 -169
- package/cordis.patch.yml +11 -11
- package/docs/i18n.md +63 -63
- package/lib/adapters/initial-commit.js +3 -3
- package/lib/client/actions.d.ts +21 -3
- package/lib/client/actions.js +23 -3
- package/lib/client/actions.js.map +1 -1
- package/lib/client/console-remote/index.js +36 -8
- package/lib/client/console-remote/index.js.map +1 -1
- package/lib/client/index.js +1 -0
- package/lib/client/index.js.map +1 -1
- package/lib/client/pre-session/controller.d.ts +1 -1
- package/lib/client/pre-session/controller.js +33 -18
- package/lib/client/pre-session/controller.js.map +1 -1
- package/lib/client/review-console/recovery-continuation.d.ts +1 -1
- package/lib/client/review-console/recovery-continuation.js +9 -4
- package/lib/client/review-console/recovery-continuation.js.map +1 -1
- package/lib/client/review-console/review-console.styles.js +190 -190
- package/lib/client/styles.js +146 -140
- package/lib/client/styles.js.map +1 -1
- package/lib/client/target-console/target-console.styles.js +155 -155
- package/lib/client/workspace-sidebar/index.d.ts +11 -2
- package/lib/client/workspace-sidebar/index.js +50 -8
- package/lib/client/workspace-sidebar/index.js.map +1 -1
- package/lib/client.js +7624 -161
- package/lib/console-contract.d.ts +2 -0
- package/lib/console-contract.js.map +1 -1
- package/lib/console-host/service.js +4 -2
- package/lib/console-host/service.js.map +1 -1
- package/lib/console-remote/descriptors.js +8 -3
- package/lib/console-remote/descriptors.js.map +1 -1
- package/lib/console-remote/schemas.js +1 -0
- package/lib/console-remote/schemas.js.map +1 -1
- package/lib/host-compat.d.ts +4 -0
- package/lib/host-compat.js +23 -0
- package/lib/host-compat.js.map +1 -0
- package/lib/i18n/client-messages.d.ts +4 -0
- package/lib/i18n/client-messages.js +4 -0
- package/lib/i18n/client-messages.js.map +1 -1
- package/lib/workspace-provider-lifecycle.d.ts +2 -1
- package/lib/workspace-provider-lifecycle.js +6 -1
- package/lib/workspace-provider-lifecycle.js.map +1 -1
- package/package.json +151 -149
- package/scripts/check-publish.mjs +238 -238
- package/scripts/check-workspace-sidebar-version.mjs +18 -14
- package/scripts/clean-lib.mjs +7 -7
- package/scripts/dev-dsh-lib.mjs +547 -509
- package/scripts/dev-dsh.mjs +98 -95
- package/scripts/dsh-source-runner.mjs +20 -14
- package/scripts/workspace-sidebar-upstream-alpha.mjs +102 -0
- package/scripts/workspace-sidebar-upstream-next.mjs +134 -0
- package/scripts/workspace-sidebar-upstream.d.mts +8 -8
- package/scripts/workspace-sidebar-upstream.mjs +162 -162
package/scripts/dev-dsh.mjs
CHANGED
|
@@ -1,95 +1,98 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
discoverHarnessRoot,
|
|
10
|
-
ensureDevFixture,
|
|
11
|
-
installLocalSnapshot,
|
|
12
|
-
parseDevDshArgs,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
pnpm run dev:dsh
|
|
31
|
-
pnpm run dev:dsh:
|
|
32
|
-
pnpm run dev:dsh:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
published to npm or pushed to Git. Nearby Harness source checkouts
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Without --repo, a marker-protected disposable Git repository
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
console.log(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
console.log(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { dirname } from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
import {
|
|
6
|
+
createDefaultOptions,
|
|
7
|
+
createDshLaunch,
|
|
8
|
+
devCacheRoot,
|
|
9
|
+
discoverHarnessRoot,
|
|
10
|
+
ensureDevFixture,
|
|
11
|
+
installLocalSnapshot,
|
|
12
|
+
parseDevDshArgs,
|
|
13
|
+
prepareIsolatedWorkspacePatch,
|
|
14
|
+
removeLocalSnapshot,
|
|
15
|
+
runProcess,
|
|
16
|
+
smokeLocalSnapshot,
|
|
17
|
+
} from './dev-dsh-lib.mjs'
|
|
18
|
+
|
|
19
|
+
const projectRoot = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
20
|
+
const cacheRoot = devCacheRoot()
|
|
21
|
+
const defaults = {
|
|
22
|
+
...createDefaultOptions(projectRoot, cacheRoot, Boolean(process.env.DSH_HOME)),
|
|
23
|
+
harnessRoot: discoverHarnessRoot(projectRoot),
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function printUsage() {
|
|
27
|
+
console.log(`dsh-git-worktree local development
|
|
28
|
+
|
|
29
|
+
Usage:
|
|
30
|
+
pnpm run dev:dsh -- [--profile web] [--repo <git-root>] [--port 3081] [--harness <path>]
|
|
31
|
+
pnpm run dev:dsh:install -- [--profile web] [--harness <path>]
|
|
32
|
+
pnpm run dev:dsh:smoke -- [--profile web] [--harness <path>]
|
|
33
|
+
pnpm run dev:dsh:remove -- [--profile web] [--harness <path>]
|
|
34
|
+
|
|
35
|
+
Nothing is published to npm or pushed to Git. Nearby Harness source checkouts
|
|
36
|
+
are scanned; use DSH_HARNESS_ROOT or --harness for a specific checkout. Install
|
|
37
|
+
and build that source checkout first. The source's own pnpm version is selected
|
|
38
|
+
automatically. Set DSH_HOME to a fresh temporary directory to isolate the web
|
|
39
|
+
Profile, archive, and default Workspace; this also patches the Host's Documents
|
|
40
|
+
root to that home. Without --repo, a marker-protected disposable Git repository
|
|
41
|
+
is created at:
|
|
42
|
+
${defaults.repo}
|
|
43
|
+
`)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
48
|
+
printUsage()
|
|
49
|
+
process.exitCode = 0
|
|
50
|
+
} else {
|
|
51
|
+
const options = parseDevDshArgs(process.argv.slice(2), defaults)
|
|
52
|
+
const runtime = {
|
|
53
|
+
projectRoot,
|
|
54
|
+
profile: options.profile,
|
|
55
|
+
harnessRoot: options.harnessRoot,
|
|
56
|
+
}
|
|
57
|
+
if (options.mode === 'install') {
|
|
58
|
+
const installed = installLocalSnapshot({
|
|
59
|
+
...runtime,
|
|
60
|
+
cacheRoot,
|
|
61
|
+
})
|
|
62
|
+
console.log(`\nLocal snapshot installed in profile "${options.profile}".`)
|
|
63
|
+
console.log(`Archive retained for profile reproducibility: ${installed.archivePath}`)
|
|
64
|
+
} else if (options.mode === 'smoke') {
|
|
65
|
+
smokeLocalSnapshot(runtime)
|
|
66
|
+
console.log(`Profile "${options.profile}" composes dsh-git-worktree.`)
|
|
67
|
+
} else if (options.mode === 'remove') {
|
|
68
|
+
removeLocalSnapshot({ ...runtime, cacheRoot })
|
|
69
|
+
console.log(`Removed dsh-git-worktree from profile "${options.profile}" and cleared local archives.`)
|
|
70
|
+
} else {
|
|
71
|
+
const installed = installLocalSnapshot({
|
|
72
|
+
...runtime,
|
|
73
|
+
cacheRoot,
|
|
74
|
+
})
|
|
75
|
+
const fixture = ensureDevFixture(options.repo, { explicit: options.repoExplicit })
|
|
76
|
+
console.log(`\nLocal snapshot: ${installed.archivePath}`)
|
|
77
|
+
console.log(`${fixture.created ? 'Created' : 'Using'} test repository: ${fixture.path}`)
|
|
78
|
+
const launch = createDshLaunch({
|
|
79
|
+
projectRoot,
|
|
80
|
+
harnessRoot: options.harnessRoot,
|
|
81
|
+
workspaceRoot: fixture.path,
|
|
82
|
+
profile: options.profile,
|
|
83
|
+
port: options.port,
|
|
84
|
+
...(process.env.DSH_HOME ? { isolationPatchPath: prepareIsolatedWorkspacePatch(cacheRoot) } : {}),
|
|
85
|
+
})
|
|
86
|
+
console.log(`Starting DSH at http://127.0.0.1:${options.port}`)
|
|
87
|
+
console.log(launch.source
|
|
88
|
+
? `Using Harness source checkout: ${options.harnessRoot}`
|
|
89
|
+
: 'Using the installed dsh executable.')
|
|
90
|
+
if (process.env.DSH_HOME) console.log(`Isolated default Workspace patch: ${launch.args[launch.args.indexOf('--patch') + 1]}`)
|
|
91
|
+
console.log('Press Ctrl+C to stop. No npm/GitHub publication is performed.\n')
|
|
92
|
+
runProcess(launch.command, launch.args, { cwd: launch.cwd })
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(`dev:dsh failed: ${error instanceof Error ? error.message : String(error)}`)
|
|
97
|
+
process.exitCode = 1
|
|
98
|
+
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { pathToFileURL } from 'node:url'
|
|
4
|
-
|
|
5
|
-
const [workspaceRoot, cliEntry, ...args] = process.argv.slice(2)
|
|
6
|
-
if (!workspaceRoot || !cliEntry) {
|
|
7
|
-
throw new Error('dsh-source-runner requires <workspaceRoot> <cliEntry> [...args].')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// pnpm resolves tsx and the Harness workspace before this point. Switch only
|
|
11
|
-
// the application cwd so newly created DSH Sessions use the intended fixture.
|
|
12
|
-
process.chdir(workspaceRoot)
|
|
13
|
-
process.argv = [process.execPath, cliEntry, ...args]
|
|
14
|
-
await import(pathToFileURL(cliEntry).href)
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { pathToFileURL } from 'node:url'
|
|
4
|
+
|
|
5
|
+
const [workspaceRoot, cliEntry, ...args] = process.argv.slice(2)
|
|
6
|
+
if (!workspaceRoot || !cliEntry) {
|
|
7
|
+
throw new Error('dsh-source-runner requires <workspaceRoot> <cliEntry> [...args].')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// pnpm resolves tsx and the Harness workspace before this point. Switch only
|
|
11
|
+
// the application cwd so newly created DSH Sessions use the intended fixture.
|
|
12
|
+
process.chdir(workspaceRoot)
|
|
13
|
+
process.argv = [process.execPath, cliEntry, ...args]
|
|
14
|
+
const cli = await import(pathToFileURL(cliEntry).href)
|
|
15
|
+
// Recent Harness CLIs guard their entry with import.meta.main; importing the
|
|
16
|
+
// module from this cwd-preserving runner does not make it the Node main module.
|
|
17
|
+
if (typeof cli.runCli !== 'function') {
|
|
18
|
+
throw new Error('Harness source CLI must export runCli() for the development runner.')
|
|
19
|
+
}
|
|
20
|
+
await cli.runCli()
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
import { materializeWorkspaceFactory } from './workspace-sidebar-upstream-next.mjs'
|
|
5
|
+
|
|
6
|
+
export const ALPHA_WORKSPACE_VERSION = '0.1.6-alpha.2'
|
|
7
|
+
export const ALPHA_WORKSPACE_SHA256 = 'cec5cdfc90b0732356b678e84ee00949d26b8c1b70d4dd5fcc20660d7267e448'
|
|
8
|
+
export const ALPHA_WORKSPACE_VIRTUAL_ID = 'virtual:dsh-official-workspace-client-alpha'
|
|
9
|
+
export const RESOLVED_ALPHA_WORKSPACE_VIRTUAL_ID = `\0${ALPHA_WORKSPACE_VIRTUAL_ID}`
|
|
10
|
+
|
|
11
|
+
export function readAlphaWorkspaceClient() {
|
|
12
|
+
const require = createRequire(import.meta.url)
|
|
13
|
+
const packageName = '@deepseek-ai/dsh-client-ui-workspace-alpha'
|
|
14
|
+
const packageJson = JSON.parse(readFileSync(require.resolve(`${packageName}/package.json`), 'utf8'))
|
|
15
|
+
if (packageJson.name !== '@deepseek-ai/dsh-client-ui-workspace' || packageJson.version !== ALPHA_WORKSPACE_VERSION) {
|
|
16
|
+
throw new Error(`Unsupported official Workspace source ${packageJson.name}@${packageJson.version}`)
|
|
17
|
+
}
|
|
18
|
+
const source = readFileSync(require.resolve(`${packageName}/client`), 'utf8')
|
|
19
|
+
const hash = createHash('sha256').update(source).digest('hex')
|
|
20
|
+
if (hash !== ALPHA_WORKSPACE_SHA256) throw new Error(`Official Workspace Client hash drifted: ${hash}`)
|
|
21
|
+
return source
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function once(source, needle, replacement, label) {
|
|
25
|
+
const at = source.indexOf(needle)
|
|
26
|
+
if (at < 0 || at !== source.lastIndexOf(needle)) {
|
|
27
|
+
throw new Error(`Cannot derive official Workspace ${ALPHA_WORKSPACE_VERSION} ${label}: expected one source seam`)
|
|
28
|
+
}
|
|
29
|
+
return source.slice(0, at) + replacement + source.slice(at + needle.length)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Keep the official alpha Client while disabling unsafe managed-owner row mutations. */
|
|
33
|
+
export function decorateAlphaWorkspaceClient(source) {
|
|
34
|
+
let derived = source
|
|
35
|
+
const replace = (needle, replacement, label) => { derived = once(derived, needle, replacement, label) }
|
|
36
|
+
replace(
|
|
37
|
+
'\t\t\t\tgroups.push(buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members));',
|
|
38
|
+
'\t\t\t\tconst group = buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members);\n\t\t\t\tif (workspace.__dshGitWorktreeProtected === true) group.__dshGitWorktreeProtected = true;\n\t\t\t\tgroups.push(group);',
|
|
39
|
+
'protected workspace group',
|
|
40
|
+
)
|
|
41
|
+
replace(
|
|
42
|
+
'\t\t\t\t\tlabel: g.label,\n\t\t\t\t\tsessionCount: g.sessions.length,',
|
|
43
|
+
'\t\t\t\t\tlabel: g.label,\n\t\t\t\t\t...g.__dshGitWorktreeProtected === true ? { __dshGitWorktreeProtected: true } : {},\n\t\t\t\t\tsessionCount: g.sessions.length,',
|
|
44
|
+
'protected workspace row',
|
|
45
|
+
)
|
|
46
|
+
replace(
|
|
47
|
+
'\t\t\tasync forkSession(sessionId) {\n\t\t\t\tconst navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);',
|
|
48
|
+
'\t\t\tasync forkSession(sessionId) {\n\t\t\t\tif (this.ctx.get("__dshGitWorktreeManagedGuard").blockSession(sessionId)) throw new Error("managed Session must be changed through its Worktree owner");\n\t\t\t\tconst navigation = AbortSignal.any([this.ctx.layout.beginNavigation(), this.lifetime.signal]);',
|
|
49
|
+
'managed Session fork',
|
|
50
|
+
)
|
|
51
|
+
replace(
|
|
52
|
+
'\t\t\tasync archiveSession(sessionId) {\n\t\t\t\tawait this.workspaces.archiveSession(sessionId);',
|
|
53
|
+
'\t\t\tasync archiveSession(sessionId) {\n\t\t\t\tif (this.ctx.get("__dshGitWorktreeManagedGuard").blockSession(sessionId)) throw new Error("managed Session must be changed through its Worktree owner");\n\t\t\t\tawait this.workspaces.archiveSession(sessionId);',
|
|
54
|
+
'managed Session archive',
|
|
55
|
+
)
|
|
56
|
+
replace(
|
|
57
|
+
'\t\t\t\tconst target = workspaceId ?? currentWorkspaceId ?? recent;\n\t\t\t\tif (target === void 0) {',
|
|
58
|
+
'\t\t\t\tconst target = workspaceId ?? currentWorkspaceId ?? recent;\n\t\t\t\tif (target !== void 0 && this.ctx.get("__dshGitWorktreeManagedGuard").blockWorkspace(target)) return;\n\t\t\t\tif (target === void 0) {',
|
|
59
|
+
'managed Workspace new Session shortcut',
|
|
60
|
+
)
|
|
61
|
+
replace(
|
|
62
|
+
'\t\t\t\trenameSession: async (sessionId, title) => {\n\t\t\t\t\tconst result = await sessions.using(',
|
|
63
|
+
'\t\t\t\trenameSession: async (sessionId, title) => {\n\t\t\t\t\tif (ctx.get("__dshGitWorktreeManagedGuard").blockSession(sessionId)) throw new Error("managed Session must be changed through its Worktree owner");\n\t\t\t\t\tconst result = await sessions.using(',
|
|
64
|
+
'managed Session rename',
|
|
65
|
+
)
|
|
66
|
+
replace(
|
|
67
|
+
'\t\t\t\tupdatedAt: s.updatedAt,\n\t\t\t\t...pendingInteraction === void 0 ? {} : { pendingInteraction }',
|
|
68
|
+
'\t\t\t\tupdatedAt: s.updatedAt,\n\t\t\t\t__dshGitWorktree: s.__dshGitWorktree,\n\t\t\t\t...pendingInteraction === void 0 ? {} : { pendingInteraction }',
|
|
69
|
+
'managed Session metadata',
|
|
70
|
+
)
|
|
71
|
+
replace(
|
|
72
|
+
'\t\tfunction ProjectRowItem({ group, containsCurrentDescendant = false, onToggle, onCreate, actions, drag, home, t }) {\n\t\t\tconst row = group;',
|
|
73
|
+
'\t\tfunction ProjectRowItem({ group, containsCurrentDescendant = false, onToggle, onCreate, actions, drag, home, t }) {\n\t\t\tconst row = group;\n\t\t\tconst protectedManagedWorkspace = row.__dshGitWorktreeProtected === true;',
|
|
74
|
+
'managed Workspace row guard',
|
|
75
|
+
)
|
|
76
|
+
replace('\t\t\t\tdraggable: drag !== void 0,', '\t\t\t\tdraggable: drag !== void 0 && !protectedManagedWorkspace,', 'managed Workspace drag')
|
|
77
|
+
replace('\t\t\t\tonDragStart: drag === void 0 ? void 0 : (e) => {', '\t\t\t\tonDragStart: protectedManagedWorkspace || drag === void 0 ? void 0 : (e) => {', 'managed Workspace drag start')
|
|
78
|
+
replace('\t\t\t\t\t\tchildren: [actions !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {', '\t\t\t\t\t\tchildren: [!protectedManagedWorkspace && actions !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {', 'managed Workspace menu')
|
|
79
|
+
replace('\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)("button", {\n\t\t\t\t\t\t\ttype: "button",\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.iconButton,\n\t\t\t\t\t\t\t"aria-label": t("actions.newSession.aria", { name: label }),', '\t\t\t\t\t\t}), !protectedManagedWorkspace && (0, react_jsx_runtime.jsx)("button", {\n\t\t\t\t\t\t\ttype: "button",\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.iconButton,\n\t\t\t\t\t\t\t"aria-label": t("actions.newSession.aria", { name: label }),', 'managed Workspace new Session')
|
|
80
|
+
replace(
|
|
81
|
+
'\t\tfunction SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, onReveal, drag, flat = false, t }) {\n\t\t\tconst row = node;',
|
|
82
|
+
'\t\tfunction SessionNodeItem({ node, currentId, now, onOpen, onRename, onFork, onArchive, onReveal, drag, flat = false, t }) {\n\t\t\tconst row = node;\n\t\t\tconst protectedManagedSession = node.__dshGitWorktree?.kind === "managed-worktree";',
|
|
83
|
+
'managed Session row guard',
|
|
84
|
+
)
|
|
85
|
+
replace('\t\t\tconst draggable = drag !== void 0 && !row.blank;', '\t\t\tconst draggable = drag !== void 0 && !row.blank && !protectedManagedSession;', 'managed Session drag')
|
|
86
|
+
replace('\t\t\t\t\t\t!row.blank && (0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.rowActions,', '\t\t\t\t\t\t!row.blank && !protectedManagedSession && (0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.rowActions,', 'managed Session actions')
|
|
87
|
+
replace(
|
|
88
|
+
'\t\t\t\t\t\t(0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tref: titleRef,\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.title,',
|
|
89
|
+
'\t\t\t\t\t\tprotectedManagedSession && (0, react_jsx_runtime.jsx)("span", { title: node.__dshGitWorktree.label, "aria-label": node.__dshGitWorktree.label, style: { flexShrink: 0, display: "inline-flex" }, children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutline16, {}) }),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tref: titleRef,\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.title,',
|
|
90
|
+
'managed Session branch decoration',
|
|
91
|
+
)
|
|
92
|
+
replace(
|
|
93
|
+
'\t\t\t\t\t\t\tchildren: title\n\t\t\t\t\t\t}),\n\t\t\t\t\t\trow.hasActiveSchedule && (0, react_jsx_runtime.jsx)(ActiveScheduleIndicator, { t }),',
|
|
94
|
+
'\t\t\t\t\t\t\tchildren: title\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tprotectedManagedSession && (0, react_jsx_runtime.jsx)("span", { className: "dsh-git-worktree-sidebar-badge", "data-worktree-state": node.__dshGitWorktree.state, children: node.__dshGitWorktree.label }),\n\t\t\t\t\t\trow.hasActiveSchedule && (0, react_jsx_runtime.jsx)(ActiveScheduleIndicator, { t }),',
|
|
95
|
+
'managed Session status badge',
|
|
96
|
+
)
|
|
97
|
+
return derived
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function materializeAlphaWorkspaceClientModule() {
|
|
101
|
+
return materializeWorkspaceFactory(decorateAlphaWorkspaceClient(readAlphaWorkspaceClient()))
|
|
102
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
import { readFileSync } from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
|
|
5
|
+
export const NEXT_WORKSPACE_VERSION = '0.1.7-rc.2'
|
|
6
|
+
export const NEXT_WORKSPACE_SHA256 = '854722447794b79607651e6c75d0652db1aba376324f468ab8cd6ecdfe7d177f'
|
|
7
|
+
export const NEXT_WORKSPACE_VIRTUAL_ID = 'virtual:dsh-official-workspace-client-next'
|
|
8
|
+
export const RESOLVED_NEXT_WORKSPACE_VIRTUAL_ID = `\0${NEXT_WORKSPACE_VIRTUAL_ID}`
|
|
9
|
+
|
|
10
|
+
export function readNextWorkspaceClient() {
|
|
11
|
+
const require = createRequire(import.meta.url)
|
|
12
|
+
const packageName = '@deepseek-ai/dsh-client-ui-workspace-next'
|
|
13
|
+
const packageJson = JSON.parse(readFileSync(require.resolve(`${packageName}/package.json`), 'utf8'))
|
|
14
|
+
if (packageJson.name !== '@deepseek-ai/dsh-client-ui-workspace' || packageJson.version !== NEXT_WORKSPACE_VERSION) {
|
|
15
|
+
throw new Error(`Unsupported official Workspace source ${packageJson.name}@${packageJson.version}`)
|
|
16
|
+
}
|
|
17
|
+
const source = readFileSync(require.resolve(`${packageName}/client`), 'utf8')
|
|
18
|
+
const hash = createHash('sha256').update(source).digest('hex')
|
|
19
|
+
if (hash !== NEXT_WORKSPACE_SHA256) throw new Error(`Official Workspace Client hash drifted: ${hash}`)
|
|
20
|
+
return source
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function once(source, needle, replacement, label) {
|
|
24
|
+
const start = source.indexOf(needle)
|
|
25
|
+
if (start < 0 || start !== source.lastIndexOf(needle)) {
|
|
26
|
+
throw new Error(`Cannot derive official Workspace ${NEXT_WORKSPACE_VERSION} ${label}: expected one source seam`)
|
|
27
|
+
}
|
|
28
|
+
return source.slice(0, start) + replacement + source.slice(start + needle.length)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Keep the official Client's tree and behavior, changing only managed-owner presentation/controls. */
|
|
32
|
+
export function decorateNextWorkspaceClient(source) {
|
|
33
|
+
let derived = source
|
|
34
|
+
const replace = (needle, replacement, label) => { derived = once(derived, needle, replacement, label) }
|
|
35
|
+
replace(
|
|
36
|
+
'\t\t\t\tgroups.push(buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members));',
|
|
37
|
+
'\t\t\t\tconst group = buildGroup(workspace.workspaceId, workspace.workspaceId, workspace.path, Date.parse(workspace.createdAt), workspace.title, members);\n\t\t\t\tif (workspace.__dshGitWorktreeProtected === true) group.__dshGitWorktreeProtected = true;\n\t\t\t\tgroups.push(group);',
|
|
38
|
+
'protected workspace group',
|
|
39
|
+
)
|
|
40
|
+
replace(
|
|
41
|
+
'\t\t\t\t\tlabel: g.label,\n\t\t\t\t\tsessionCount: g.sessions.length,',
|
|
42
|
+
'\t\t\t\t\tlabel: g.label,\n\t\t\t\t\t...g.__dshGitWorktreeProtected === true ? { __dshGitWorktreeProtected: true } : {},\n\t\t\t\t\tsessionCount: g.sessions.length,',
|
|
43
|
+
'protected workspace row',
|
|
44
|
+
)
|
|
45
|
+
replace(
|
|
46
|
+
'\t\t\tasync forkSession(sessionId) {\n\t\t\t\tawait this.sessions.fork({',
|
|
47
|
+
'\t\t\tasync forkSession(sessionId) {\n\t\t\t\tif (this.ctx.get("__dshGitWorktreeManagedGuard").blockSession(sessionId)) throw new Error("managed Session must be changed through its Worktree owner");\n\t\t\t\tawait this.sessions.fork({',
|
|
48
|
+
'managed Session fork from official menu and shortcuts',
|
|
49
|
+
)
|
|
50
|
+
replace(
|
|
51
|
+
'\t\t\tasync archiveSession(sessionId, options = {}) {\n\t\t\t\tawait this.workspaces.archiveSession(sessionId, options);',
|
|
52
|
+
'\t\t\tasync archiveSession(sessionId, options = {}) {\n\t\t\t\tif (this.ctx.get("__dshGitWorktreeManagedGuard").blockSession(sessionId)) throw new Error("managed Session must be changed through its Worktree owner");\n\t\t\t\tawait this.workspaces.archiveSession(sessionId, options);',
|
|
53
|
+
'managed Session archive from official menu and shortcuts',
|
|
54
|
+
)
|
|
55
|
+
replace(
|
|
56
|
+
'\t\t\t\tconst target = workspaceId ?? currentWorkspaceId ?? recent;\n\t\t\t\tif (target === void 0) {',
|
|
57
|
+
'\t\t\t\tconst target = workspaceId ?? currentWorkspaceId ?? recent;\n\t\t\t\tif (target !== void 0 && this.ctx.get("__dshGitWorktreeManagedGuard").blockWorkspace(target)) return;\n\t\t\t\tif (target === void 0) {',
|
|
58
|
+
'managed Workspace new Session shortcut',
|
|
59
|
+
)
|
|
60
|
+
replace(
|
|
61
|
+
'\t\t\tconst renameSession = async (sessionId, title) => {\n\t\t\t\tconst result = await sessions.using(',
|
|
62
|
+
'\t\t\tconst renameSession = async (sessionId, title) => {\n\t\t\t\tif (ctx.get("__dshGitWorktreeManagedGuard").blockSession(sessionId)) throw new Error("managed Session must be changed through its Worktree owner");\n\t\t\t\tconst result = await sessions.using(',
|
|
63
|
+
'managed Session rename dialog',
|
|
64
|
+
)
|
|
65
|
+
replace(
|
|
66
|
+
'\t\t\t\tupdatedAt: s.updatedAt,\n\t\t\t\t...pendingInteraction === void 0 ? {} : { pendingInteraction }',
|
|
67
|
+
'\t\t\t\tupdatedAt: s.updatedAt,\n\t\t\t\t__dshGitWorktree: s.__dshGitWorktree,\n\t\t\t\t...pendingInteraction === void 0 ? {} : { pendingInteraction }',
|
|
68
|
+
'managed Session metadata',
|
|
69
|
+
)
|
|
70
|
+
replace(
|
|
71
|
+
'\t\tfunction ProjectRowItem({ group, containsCurrentDescendant = false, onToggle, onCreate, actions, drag, home, newShortcut, t }) {\n\t\t\tconst row = group;',
|
|
72
|
+
'\t\tfunction ProjectRowItem({ group, containsCurrentDescendant = false, onToggle, onCreate, actions, drag, home, newShortcut, t }) {\n\t\t\tconst row = group;\n\t\t\tconst protectedManagedWorkspace = row.__dshGitWorktreeProtected === true;',
|
|
73
|
+
'managed Workspace row guard',
|
|
74
|
+
)
|
|
75
|
+
replace('\t\t\t\tdraggable: drag !== void 0,', '\t\t\t\tdraggable: drag !== void 0 && !protectedManagedWorkspace,', 'managed Workspace drag')
|
|
76
|
+
replace('\t\t\t\tonDragStart: drag === void 0 ? void 0 : (e) => {', '\t\t\t\tonDragStart: protectedManagedWorkspace || drag === void 0 ? void 0 : (e) => {', 'managed Workspace drag start')
|
|
77
|
+
replace('\t\t\t\t\t\tchildren: [actions !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {', '\t\t\t\t\t\tchildren: [!protectedManagedWorkspace && actions !== void 0 && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {', 'managed Workspace menu')
|
|
78
|
+
replace('\t\t\t\t\t\t}), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {\n\t\t\t\t\t\t\tlabel: t("actions.newSession"),', '\t\t\t\t\t\t}), !protectedManagedWorkspace && (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {\n\t\t\t\t\t\t\tlabel: t("actions.newSession"),', 'managed Workspace new Session')
|
|
79
|
+
replace(
|
|
80
|
+
'\t\tfunction SessionNodeItem({ node, currentId, now, onOpen, onRenameRequest, renderSlot, onReveal, drag, t }) {\n\t\t\tconst row = node;',
|
|
81
|
+
'\t\tfunction SessionNodeItem({ node, currentId, now, onOpen, onRenameRequest, renderSlot, onReveal, drag, t }) {\n\t\t\tconst row = node;\n\t\t\tconst protectedManagedSession = node.__dshGitWorktree?.kind === "managed-worktree";',
|
|
82
|
+
'managed Session row guard',
|
|
83
|
+
)
|
|
84
|
+
replace('\t\t\tconst draggable = drag !== void 0 && !row.blank && !row.archived;', '\t\t\tconst draggable = drag !== void 0 && !row.blank && !row.archived && !protectedManagedSession;', 'managed Session drag')
|
|
85
|
+
replace('\t\t\t\t\t\t\tonDoubleClick: row.blank ? void 0 : (e) => {', '\t\t\t\t\t\t\tonDoubleClick: row.blank || protectedManagedSession ? void 0 : (e) => {', 'managed Session rename')
|
|
86
|
+
// Keep the official hover container: the guarded Slot seats render only pin
|
|
87
|
+
// for managed Sessions, while ordinary Sessions retain every official action.
|
|
88
|
+
replace(
|
|
89
|
+
'\t\t\t\t\t\t(0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tref: titleRef,\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.title,',
|
|
90
|
+
'\t\t\t\t\t\tprotectedManagedSession && (0, react_jsx_runtime.jsx)("span", { title: node.__dshGitWorktree.label, "aria-label": node.__dshGitWorktree.label, style: { flexShrink: 0, display: "inline-flex" }, children: (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconBranchOutlineRegular, { size: 16 }) }),\n\t\t\t\t\t\t(0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tref: titleRef,\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.title,',
|
|
91
|
+
'managed Session branch decoration',
|
|
92
|
+
)
|
|
93
|
+
replace(
|
|
94
|
+
'\t\t\t\t\t\t\tchildren: title\n\t\t\t\t\t\t}),\n\t\t\t\t\t\t!row.blank && (0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.time,',
|
|
95
|
+
'\t\t\t\t\t\t\tchildren: title\n\t\t\t\t\t\t}),\n\t\t\t\t\t\tprotectedManagedSession && (0, react_jsx_runtime.jsx)("span", { className: "dsh-git-worktree-sidebar-badge", "data-worktree-state": node.__dshGitWorktree.state, children: node.__dshGitWorktree.label }),\n\t\t\t\t\t\t!row.blank && (0, react_jsx_runtime.jsx)("span", {\n\t\t\t\t\t\t\tclassName: Rows_module_css_default.time,',
|
|
96
|
+
'managed Session status badge',
|
|
97
|
+
)
|
|
98
|
+
return derived
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function materializeNextWorkspaceClientModule() {
|
|
102
|
+
return materializeWorkspaceFactory(decorateNextWorkspaceClient(readNextWorkspaceClient()))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Load one pinned official Client factory without registering its upstream ModuleLoader row. */
|
|
106
|
+
export function materializeWorkspaceFactory(source) {
|
|
107
|
+
const token = 'factory: (require) => {'
|
|
108
|
+
const start = source.indexOf(token)
|
|
109
|
+
const end = source.lastIndexOf('\n\t}\n});')
|
|
110
|
+
if (start < 0 || end < 0 || end <= start) throw new Error('Cannot extract official Workspace Client factory')
|
|
111
|
+
const body = source.slice(start + token.length, end)
|
|
112
|
+
return `
|
|
113
|
+
import * as cordis from '@deepseek-ai/cordis'
|
|
114
|
+
import * as store from '@deepseek-ai/dsh-client-store'
|
|
115
|
+
import * as jsxRuntime from 'react/jsx-runtime'
|
|
116
|
+
import * as react from 'react'
|
|
117
|
+
import * as primitives from '@deepseek-ai/dsh-client-ui-primitives'
|
|
118
|
+
const modules = {
|
|
119
|
+
'@deepseek-ai/cordis': cordis,
|
|
120
|
+
'@deepseek-ai/dsh-client-store': store,
|
|
121
|
+
'react/jsx-runtime': jsxRuntime,
|
|
122
|
+
'react': react,
|
|
123
|
+
'@deepseek-ai/dsh-client-ui-primitives': primitives,
|
|
124
|
+
}
|
|
125
|
+
const official = ((require) => {${body}
|
|
126
|
+
})(specifier => {
|
|
127
|
+
const value = modules[specifier]
|
|
128
|
+
if (value === undefined) throw new Error('Unsupported official Workspace Client require: ' + specifier)
|
|
129
|
+
return value
|
|
130
|
+
})
|
|
131
|
+
export const apply = official.apply
|
|
132
|
+
export const inject = official.inject
|
|
133
|
+
`
|
|
134
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export const WORKSPACE_UI_VERSION: string
|
|
2
|
-
export const WORKSPACE_LOCALE_VERSION: string
|
|
3
|
-
export const WORKSPACE_CLIENT_SHA256: string
|
|
4
|
-
export const OFFICIAL_WORKSPACE_VIRTUAL_ID: string
|
|
5
|
-
export const RESOLVED_OFFICIAL_WORKSPACE_VIRTUAL_ID: string
|
|
6
|
-
export function readOfficialWorkspaceClient(): { source: string; clientPath: string }
|
|
7
|
-
export function decorateOfficialWorkspaceClient(source: string): string
|
|
8
|
-
export function materializeOfficialWorkspaceClientModule(): string
|
|
1
|
+
export const WORKSPACE_UI_VERSION: string
|
|
2
|
+
export const WORKSPACE_LOCALE_VERSION: string
|
|
3
|
+
export const WORKSPACE_CLIENT_SHA256: string
|
|
4
|
+
export const OFFICIAL_WORKSPACE_VIRTUAL_ID: string
|
|
5
|
+
export const RESOLVED_OFFICIAL_WORKSPACE_VIRTUAL_ID: string
|
|
6
|
+
export function readOfficialWorkspaceClient(): { source: string; clientPath: string }
|
|
7
|
+
export function decorateOfficialWorkspaceClient(source: string): string
|
|
8
|
+
export function materializeOfficialWorkspaceClientModule(): string
|