@sparkelf/dsh-knowledge-base 0.5.1 → 0.5.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.
- package/lib/client.js +613 -613
- package/lib/index.js +24 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -23847,17 +23847,30 @@ function apply(ctx, deploymentConfig) {
|
|
|
23847
23847
|
try {
|
|
23848
23848
|
const config = withStoredStorage(deploymentConfig, await readStorageSettings(deploymentConfig.mountPoint));
|
|
23849
23849
|
const requiredPermission = permissionForKbRoute(method);
|
|
23850
|
-
if (requiredPermission !== void 0 && isTeamDeployment(config))
|
|
23851
|
-
|
|
23852
|
-
|
|
23853
|
-
|
|
23854
|
-
|
|
23855
|
-
|
|
23850
|
+
if (requiredPermission !== void 0 && isTeamDeployment(config)) {
|
|
23851
|
+
let permissionContext;
|
|
23852
|
+
try {
|
|
23853
|
+
permissionContext = await Promise.race([managementHost.context().catch(() => void 0), new Promise((resolve) => setTimeout(() => {
|
|
23854
|
+
resolve(void 0);
|
|
23855
|
+
}, 750))]);
|
|
23856
|
+
} catch {
|
|
23857
|
+
permissionContext = void 0;
|
|
23858
|
+
}
|
|
23859
|
+
if (permissionContext === void 0) return writeJson(res, 503, {
|
|
23860
|
+
error: "权限上下文暂时不可用,请稍后重试",
|
|
23861
|
+
code: "permission-context-unavailable",
|
|
23862
|
+
required: requiredPermission
|
|
23863
|
+
});
|
|
23864
|
+
try {
|
|
23865
|
+
await toolDisclosure?.syncToolDisclosure(permissionContext);
|
|
23866
|
+
} catch {}
|
|
23867
|
+
const permissionKeys = permissionContext.permissions;
|
|
23868
|
+
if (Array.isArray(permissionKeys) && !hasPermission(permissionContext, requiredPermission)) return writeJson(res, 403, {
|
|
23856
23869
|
error: `缺少权限 ${requiredPermission}`,
|
|
23857
23870
|
code: "forbidden",
|
|
23858
23871
|
required: requiredPermission
|
|
23859
23872
|
});
|
|
23860
|
-
}
|
|
23873
|
+
}
|
|
23861
23874
|
switch (method) {
|
|
23862
23875
|
case "graph.canvas":
|
|
23863
23876
|
res.writeHead(200, {
|
|
@@ -25191,6 +25204,10 @@ function apply(ctx, deploymentConfig) {
|
|
|
25191
25204
|
if (!await canManageGrants(host, config)) return writeJson(res, 403, { error: "approving requires grant-management access" });
|
|
25192
25205
|
const submission = (await listPendingWrites(plan.actualRoot)).find((candidate) => candidate.name === body.name);
|
|
25193
25206
|
if (submission === void 0) return writeJson(res, 404, { error: "no such pending submission" });
|
|
25207
|
+
if (submission.userId === caller.userId) return writeJson(res, 403, {
|
|
25208
|
+
error: "a submission cannot be approved by its submitter",
|
|
25209
|
+
code: "SELF_APPROVAL_FORBIDDEN"
|
|
25210
|
+
});
|
|
25194
25211
|
const content = await readPendingContent(plan.actualRoot, body.name);
|
|
25195
25212
|
if (content === null) return writeJson(res, 404, { error: "the pending content is gone" });
|
|
25196
25213
|
const viewDir = viewPathFor({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkelf/dsh-knowledge-base",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "DataOps-backed knowledge base for DeepSeek Harness: a left-sidebar destination, Settings configuration, and index tooling over a mounted NAS view.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|