chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动

演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-18 13:59:25 +08:00
1 parent 60158935f4
commit 6519682885
15831 files changed
+3063428

No files matched your search

@@ -0,0 +1 @@
*.vsix
@@ -0,0 +1,3 @@
test/**
*.vsix
package-lock.json
@@ -0,0 +1,31 @@
# OpenAPI Backend Navigation (preview)
Adds **Go to Definition** (F12 / Cmd+click) and **Go to Implementation** to backend
links emitted by `@dify/openapi-content-mapper`. Hover links also work without this
extension. TypeScript 7.1 content mappers must already be enabled in the workspace.
The extension asks the active TypeScript hover provider for the resolved symbol's
backend link. It does not run exporters, parse TypeScript, or create index files.
Both `api` and `query` method properties are supported, including import aliases.
Repository type subpaths also carry backend links: registered Community models
open their Python classes, and request/response/error envelope types open the
corresponding API handler. Import aliases and type re-exports retain these links.
Try `DatasetCreatePayload` or `PostDatasetsData` in
[`examples/repository/compatibility.ts`].
Synthetic models and Enterprise snapshots without local source metadata have no
backend target.
Existing schema definitions remain available; VS Code may show multiple targets
when a file-backed contract also has a schema definition. Use Go to Implementation
to select the backend alone. Missing local backend files are skipped.
From this directory, package and install locally (no marketplace publication):
```sh
pnpm dlx @vscode/vsce package --no-dependencies --allow-missing-repository --skip-license
code --install-extension openapi-backend-navigation-0.1.0.vsix --force
```
Reload the VS Code window after installation. On `consoleClient.datasets.get`,
hover to click **Open backend implementation**, or press F12 on `get`.
[`examples/repository/compatibility.ts`]: ../examples/repository/compatibility.ts
@@ -0,0 +1,42 @@
const vscode = require('vscode')
const { backendLocations } = require('./locations.cjs')
function activate(context) {
const selector = ['typescript', 'typescriptreact', 'javascript', 'javascriptreact'].map(
(language) => ({ language, scheme: 'file' }),
)
const provider = {
async provideDefinition(document, position, token) {
// Ask TS for the resolved symbol's documentation. This also handles aliases,
// re-exports, custom client paths and query clients without parsing source text.
const hovers = await vscode.commands.executeCommand(
'vscode.executeHoverProvider',
document.uri,
position,
)
if (token.isCancellationRequested) return []
const origins = backendLocations((hovers ?? []).flatMap((hover) => hover.contents))
const definitions = []
for (const origin of origins) {
const uri = vscode.Uri.parse(origin.uri)
try {
const stat = await vscode.workspace.fs.stat(uri)
if (token.isCancellationRequested) return []
if (stat.type & vscode.FileType.File)
definitions.push(new vscode.Location(uri, new vscode.Position(origin.line - 1, 0)))
} catch {
// Imported contracts can refer to backend checkouts absent on this machine.
}
}
return definitions
},
}
context.subscriptions.push(vscode.languages.registerDefinitionProvider(selector, provider))
context.subscriptions.push(
vscode.languages.registerImplementationProvider(selector, {
provideImplementation: provider.provideDefinition,
}),
)
}
module.exports = { activate }
@@ -0,0 +1,24 @@
/** Read explicitly labeled backend links; leave other hover documentation links alone. */
function backendLocations(contents) {
const locations = new Map()
for (const content of contents) {
const markdown = typeof content === 'string' ? content : content.value
if (typeof markdown !== 'string') continue
for (const match of markdown.matchAll(
/\[Open backend implementation\]\((file:\/\/[^\s)]+)#L([1-9]\d*)\)/g,
)) {
const line = Number(match[2])
if (!Number.isSafeInteger(line)) continue
try {
const url = new URL(match[1])
if (url.protocol !== 'file:' || url.search || url.hash) continue
locations.set(`${url.href}#${line}`, { uri: url.href, line })
} catch {
// Malformed optional metadata must not interfere with normal TS navigation.
}
}
}
return [...locations.values()]
}
module.exports = { backendLocations }
@@ -0,0 +1,35 @@
{
"name": "openapi-backend-navigation",
"displayName": "OpenAPI Backend Navigation",
"version": "0.1.0",
"private": true,
"description": "Navigate typed OpenAPI client operations to their backend implementation.",
"categories": [
"Programming Languages"
],
"license": "SEE LICENSE IN ../LICENSE",
"repository": {
"type": "git",
"url": "https://github.com/langgenius/dify.git"
},
"publisher": "dify-local",
"main": "./extension.cjs",
"activationEvents": [
"onLanguage:javascript",
"onLanguage:javascriptreact",
"onLanguage:typescript",
"onLanguage:typescriptreact"
],
"preview": true,
"engines": {
"vscode": "^1.100.0"
},
"capabilities": {
"untrustedWorkspaces": {
"supported": false
},
"virtualWorkspaces": {
"supported": false
}
}
}