@sparkelf/dsh-dataops-managed 0.3.19 → 0.3.21
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 +3974 -255
- package/lib/client.js.map +1 -1
- package/lib/index.js +1415 -24
- package/lib/types/auth-state.d.ts +37 -0
- package/lib/types/client/NotificationBell.d.ts +19 -0
- package/lib/types/client/PermissionCenterIcon.d.ts +9 -0
- package/lib/types/client/PermissionCenterSection.d.ts +15 -0
- package/lib/types/client/ReloginPrompt.d.ts +29 -0
- package/lib/types/client/ReviewSettingsCard.d.ts +12 -0
- package/lib/types/client/SkillPlazaSection.d.ts +3 -5
- package/lib/types/client/WanxiangBrand.d.ts +7 -1
- package/lib/types/client/WorkspaceUpgradePrompt.d.ts +21 -0
- package/lib/types/client/combobox.d.ts +17 -0
- package/lib/types/client/index.d.ts +17 -2
- package/lib/types/client/locales.d.ts +103 -0
- package/lib/types/client/review-client.d.ts +155 -0
- package/lib/types/client/review-demo.d.ts +13 -0
- package/lib/types/client/review-notification-store.d.ts +23 -0
- package/lib/types/client/review-types.d.ts +114 -0
- package/lib/types/client/settings-gate.d.ts +21 -0
- package/lib/types/client/skill-plaza-client.d.ts +21 -0
- package/lib/types/client/workspace-upgrade-client.d.ts +29 -0
- package/lib/types/index.d.ts +36 -0
- package/lib/types/review-api.d.ts +32 -0
- package/lib/types/skill-plaza.d.ts +31 -0
- package/lib/types/tools.d.ts +21 -0
- package/lib/types/workspace-upgrade-state.d.ts +66 -0
- package/lib/types/workspace-upgrade.d.ts +83 -0
- package/package.json +2 -1
- package/skills/dataops-query/i18n/zh.json +10 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the managed DataOps settings section may be registered at all.
|
|
3
|
+
*
|
|
4
|
+
* Registration is the gate, not a CSS class: an ordinary user's profile should not contain a
|
|
5
|
+
* section whose controls they may not use. The identity record is presentation-only and arrives
|
|
6
|
+
* from the portal after the iframe loads, so the registration follows it instead of reading it
|
|
7
|
+
* once at startup. Authorization still lives in DataOps; this only keeps a forbidden panel out of
|
|
8
|
+
* the interface.
|
|
9
|
+
*/
|
|
10
|
+
/** Read the current role label without trusting any other field. */
|
|
11
|
+
export declare function currentManagedSettingsRole(): string | null;
|
|
12
|
+
/** Whether the current identity may see the managed DataOps settings section. */
|
|
13
|
+
export declare function canSeeManagedSettings(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Observe identity changes.
|
|
16
|
+
*
|
|
17
|
+
* The account plugin keeps one store on `window`; subscribing to its listener set catches the
|
|
18
|
+
* in-page update even before the portal's DOM event. The event is kept as a second signal because
|
|
19
|
+
* a future portal may publish the event without touching the store this plugin reads.
|
|
20
|
+
*/
|
|
21
|
+
export declare function subscribeManagedSettingsVisibility(listener: () => void): () => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Same-origin skill plaza calls from the DataOps skill center section. */
|
|
2
|
+
import type { ReviewStatus, ResourceVisibility } from './review-types.ts';
|
|
2
3
|
/** Route the plugin's Host half serves for the plaza. */
|
|
3
4
|
export declare const SKILL_PLAZA_PATH = "/integrations/dataops/skill-plaza";
|
|
4
5
|
/** One plaza entry as the section reads it. */
|
|
@@ -10,11 +11,29 @@ export interface PlazaSkill {
|
|
|
10
11
|
tags: string[];
|
|
11
12
|
sharedByMe: boolean;
|
|
12
13
|
updatedAt: string;
|
|
14
|
+
reviewStatus: ReviewStatus;
|
|
15
|
+
visibility: ResourceVisibility;
|
|
16
|
+
departmentCode?: string | null;
|
|
17
|
+
departmentName?: string;
|
|
18
|
+
departmentPath?: readonly {
|
|
19
|
+
code: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}[];
|
|
22
|
+
ownerName?: string;
|
|
23
|
+
riskReport?: import('./review-types.ts').RiskReport | null;
|
|
24
|
+
reviewNote?: string | null;
|
|
25
|
+
submittedAt?: string;
|
|
13
26
|
}
|
|
14
27
|
/** The plaza listing and the tags in use. */
|
|
15
28
|
export interface PlazaListing {
|
|
16
29
|
skills: PlazaSkill[];
|
|
17
30
|
tags: string[];
|
|
31
|
+
counts?: {
|
|
32
|
+
pending: number;
|
|
33
|
+
approved: number;
|
|
34
|
+
rejected: number;
|
|
35
|
+
total: number;
|
|
36
|
+
};
|
|
18
37
|
}
|
|
19
38
|
/**
|
|
20
39
|
* Read the plaza.
|
|
@@ -24,6 +43,8 @@ export interface PlazaListing {
|
|
|
24
43
|
export declare function fetchPlaza(filter?: {
|
|
25
44
|
tag?: string;
|
|
26
45
|
query?: string;
|
|
46
|
+
status?: string;
|
|
47
|
+
scope?: string;
|
|
27
48
|
}): Promise<PlazaListing | null>;
|
|
28
49
|
/**
|
|
29
50
|
* Change the plaza.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Same-origin calls for the workspace image upgrade banner. */
|
|
2
|
+
/** Route the plugin's Host half serves for upgrade detection and start. */
|
|
3
|
+
export declare const WORKSPACE_UPGRADE_PATH = "/integrations/dataops/workspace-upgrade";
|
|
4
|
+
/** A DSH session that will receive "继续" after the restart. */
|
|
5
|
+
export interface WorkspaceUpgradeSession {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}
|
|
10
|
+
/** The status the DSH page reads before offering an upgrade. */
|
|
11
|
+
export interface WorkspaceUpgradeStatus {
|
|
12
|
+
imageStatus: 'CURRENT' | 'UPDATE_AVAILABLE' | 'NOT_RUNNING' | 'UNKNOWN';
|
|
13
|
+
configuredImage: string;
|
|
14
|
+
activeSessions: WorkspaceUpgradeSession[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Read the workspace upgrade preview.
|
|
18
|
+
* @returns the status, or null when the Host route is not ready or not connected.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchWorkspaceUpgrade(): Promise<WorkspaceUpgradeStatus | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Ask the Host to snapshot sessions and recreate the workspace container.
|
|
23
|
+
* @returns the accepted hand-off summary.
|
|
24
|
+
*/
|
|
25
|
+
export declare function requestWorkspaceUpgrade(): Promise<{
|
|
26
|
+
accepted: boolean;
|
|
27
|
+
upgradeId: string;
|
|
28
|
+
sessions: number;
|
|
29
|
+
}>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** DataOps-managed JWT intake and credential-backed MCP composition. */
|
|
2
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
3
|
import type { Context } from '@deepseek-ai/cordis';
|
|
4
|
+
import { credentialRef } from '@deepseek-ai/dsh-credentials';
|
|
3
5
|
import z from '@deepseek-ai/schemastery';
|
|
4
6
|
import { ModelSync } from './model-sync.ts';
|
|
5
7
|
import { SettingsSync, type SectionSyncState } from './settings-sync.ts';
|
|
@@ -16,10 +18,26 @@ export declare const MANAGED_PLUGIN_ID = "dataops-managed";
|
|
|
16
18
|
export declare const MODEL_SYNC_PATH = "/integrations/dataops/model-sync";
|
|
17
19
|
/** Same-origin route the skill center uses to read and change plaza sharing. */
|
|
18
20
|
export declare const SKILL_PLAZA_PATH = "/integrations/dataops/skill-plaza";
|
|
21
|
+
/** Caller role and review capability. */
|
|
22
|
+
export declare const REVIEW_CONTEXT_PATH = "/integrations/dataops/review-context";
|
|
23
|
+
/** Notification inbox and read receipts. */
|
|
24
|
+
export declare const REVIEW_NOTIFICATIONS_PATH = "/integrations/dataops/review-notifications";
|
|
25
|
+
/** AI scan and the administrator's decision. */
|
|
26
|
+
export declare const REVIEW_ACTION_PATH = "/integrations/dataops/review";
|
|
27
|
+
/** Permission-centre reads and writes. */
|
|
28
|
+
export declare const RBAC_PATH = "/integrations/dataops/rbac";
|
|
29
|
+
/** The three plaza-review switches. */
|
|
30
|
+
export declare const REVIEW_SETTINGS_PATH = "/integrations/dataops/review-settings";
|
|
31
|
+
/** Department CRUD bridge (task-67). */
|
|
32
|
+
export declare const DEPARTMENTS_PATH = "/integrations/dataops/departments";
|
|
19
33
|
/** Same-origin route the Settings panel uses to read and change this workspace's limits. */
|
|
20
34
|
export declare const WORKSPACE_LIMITS_PATH = "/integrations/dataops/workspace-limits";
|
|
21
35
|
/** Same-origin route the Settings panel uses to read and change the tool-call timeout. */
|
|
22
36
|
export declare const TOOL_TIMEOUT_PATH = "/integrations/dataops/tool-timeout";
|
|
37
|
+
/** Same-origin route reporting what the last DataOps answer said about the credential. */
|
|
38
|
+
export declare const AUTH_STATE_PATH = "/integrations/dataops/auth-state";
|
|
39
|
+
/** Same-origin route the DSH page uses to detect and start a workspace image upgrade. */
|
|
40
|
+
export declare const WORKSPACE_UPGRADE_PATH = "/integrations/dataops/workspace-upgrade";
|
|
23
41
|
/** The ends a tool-call timeout may take, in whole seconds. */
|
|
24
42
|
export declare const TOOL_TIMEOUT_MIN_SECONDS = 1;
|
|
25
43
|
export declare const TOOL_TIMEOUT_MAX_SECONDS = 3600;
|
|
@@ -103,6 +121,24 @@ export interface ModelSyncState {
|
|
|
103
121
|
export declare const DEFAULT_TOOL_CALL_TIMEOUT_MS = 300000;
|
|
104
122
|
/** Schemastery parser for managed DataOps configuration. */
|
|
105
123
|
export declare const Config: z<Config>;
|
|
124
|
+
/**
|
|
125
|
+
* Adopt the JWT the browser gateway attached to one request.
|
|
126
|
+
*
|
|
127
|
+
* Every browser request reaches this workspace through the DataOps gateway, which resolves the
|
|
128
|
+
* caller's session and forwards a fresh `authorization: Bearer <jwt>` — so the current credential
|
|
129
|
+
* arrives continuously, without any push, handshake or refresh protocol. The routes below are
|
|
130
|
+
* the only place this plugin can see that header, and reading it here is what keeps the stored
|
|
131
|
+
* credential from going stale: the value in it was captured once, while the caller's session is
|
|
132
|
+
* renewed by DataOps for as long as they stay signed in.
|
|
133
|
+
*
|
|
134
|
+
* A request without the header is normal rather than an error (same-origin fetches from inside
|
|
135
|
+
* the workspace do carry it, but a probe or a health check may not), so this only ever improves
|
|
136
|
+
* the stored value and never rejects the request.
|
|
137
|
+
*
|
|
138
|
+
* @param request - the incoming request, whose headers the gateway filled in.
|
|
139
|
+
* @returns once the credential has been updated, or immediately when there is nothing to adopt.
|
|
140
|
+
*/
|
|
141
|
+
export declare function adoptRequestJwt(ctx: Context, accessRef: ReturnType<typeof credentialRef>, request: IncomingMessage): Promise<void>;
|
|
106
142
|
/**
|
|
107
143
|
* Accept the current DataOps JWT and expose DataOps MCP tools through its credential.
|
|
108
144
|
* @param ctx - DSH Host context with credentials, Web routes, and tools.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The DataOps review, notification, permission and settings API.
|
|
3
|
+
*
|
|
4
|
+
* One transport for the four new surfaces keeps the JWT handling, 401 observation and error
|
|
5
|
+
* mapping identical; the browser routes only translate same-origin actions into these calls.
|
|
6
|
+
*/
|
|
7
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
8
|
+
/** Configuration shared with the skill plaza: where DataOps is and which credential holds its JWT. */
|
|
9
|
+
export interface ReviewApiConfig {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
credentialRef: string;
|
|
12
|
+
}
|
|
13
|
+
/** One upstream answer, status included so a 404/503 can reach the browser unchanged. */
|
|
14
|
+
export interface ReviewApiResult {
|
|
15
|
+
status: number;
|
|
16
|
+
body: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Cookie-free same-origin bridge to the review endpoints. */
|
|
19
|
+
export declare class ReviewApi {
|
|
20
|
+
private readonly ctx;
|
|
21
|
+
private readonly config;
|
|
22
|
+
constructor(ctx: Context, config: ReviewApiConfig);
|
|
23
|
+
private apiBase;
|
|
24
|
+
private token;
|
|
25
|
+
/**
|
|
26
|
+
* Call one DataOps endpoint with the workspace JWT.
|
|
27
|
+
* @param path - API path below the DataOps origin.
|
|
28
|
+
* @param init - Method, body and extra headers.
|
|
29
|
+
* @returns The upstream status and parsed body; 503 when this workspace has no session.
|
|
30
|
+
*/
|
|
31
|
+
request(path: string, init?: RequestInit): Promise<ReviewApiResult>;
|
|
32
|
+
}
|
|
@@ -11,6 +11,18 @@ export interface PlazaSkill {
|
|
|
11
11
|
/** Whether the current user shared this entry. */
|
|
12
12
|
sharedByMe: boolean;
|
|
13
13
|
updatedAt: string;
|
|
14
|
+
reviewStatus: 'pending' | 'approved' | 'rejected';
|
|
15
|
+
visibility: 'global' | 'department' | 'private';
|
|
16
|
+
departmentCode?: string | null;
|
|
17
|
+
departmentName?: string;
|
|
18
|
+
departmentPath?: {
|
|
19
|
+
code: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}[];
|
|
22
|
+
ownerName?: string;
|
|
23
|
+
riskReport?: unknown;
|
|
24
|
+
reviewNote?: string | null;
|
|
25
|
+
submittedAt?: string;
|
|
14
26
|
}
|
|
15
27
|
/** A skill the local workspace holds, offered by name for sharing. */
|
|
16
28
|
export interface LocalSkillCandidate {
|
|
@@ -74,7 +86,26 @@ export declare class SkillPlaza {
|
|
|
74
86
|
list(options?: {
|
|
75
87
|
tag?: string;
|
|
76
88
|
query?: string;
|
|
89
|
+
status?: string;
|
|
90
|
+
scope?: string;
|
|
91
|
+
departmentCode?: string;
|
|
77
92
|
}): Promise<PlazaSkill[]>;
|
|
93
|
+
/** List with the server's tab counts, which the plaza shows without re-counting a page. */
|
|
94
|
+
listPage(options?: {
|
|
95
|
+
tag?: string;
|
|
96
|
+
query?: string;
|
|
97
|
+
status?: string;
|
|
98
|
+
scope?: string;
|
|
99
|
+
departmentCode?: string;
|
|
100
|
+
}): Promise<{
|
|
101
|
+
skills: PlazaSkill[];
|
|
102
|
+
counts?: {
|
|
103
|
+
pending: number;
|
|
104
|
+
approved: number;
|
|
105
|
+
rejected: number;
|
|
106
|
+
total: number;
|
|
107
|
+
};
|
|
108
|
+
}>;
|
|
78
109
|
/**
|
|
79
110
|
* Every tag in use, so the browser offers existing labels.
|
|
80
111
|
* @returns Distinct tags.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model tools for the skill centre and the shared review queues.
|
|
3
|
+
*
|
|
4
|
+
* Every tool reads the caller's DataOps role from `/api/ai/review/context` and asks DataOps on
|
|
5
|
+
* every call; the Host never caches an authorization decision. Mutations require user approval
|
|
6
|
+
* and write an audit line. Secret material is never a parameter and never a return value: the
|
|
7
|
+
* API only sees the workspace JWT that the credential service already holds.
|
|
8
|
+
*
|
|
9
|
+
* The skill plaza is the catalogue. `scope=mine` exposes the caller's pending/rejected rows,
|
|
10
|
+
* the public list exposes what the caller may install, and the admin list (administrators only)
|
|
11
|
+
* exposes disabled entries. Installation, sharing and deletion are deliberately three different
|
|
12
|
+
* actions: uninstall removes only the caller's installation, unshare unpublishes the shared entry
|
|
13
|
+
* (with an unpublished notification), and delete permanently removes the entry after a second
|
|
14
|
+
* confirmation, with its own deleted notification and audit trail.
|
|
15
|
+
*
|
|
16
|
+
* @module tools
|
|
17
|
+
*/
|
|
18
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
19
|
+
import type { ReviewApi } from './review-api.ts';
|
|
20
|
+
/** Register the skill-centre and review tools. */
|
|
21
|
+
export declare function registerAiManagementTools(ctx: Context, reviewApi: ReviewApi): () => void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent hand-off record for one workspace image upgrade.
|
|
3
|
+
*
|
|
4
|
+
* The DSH companion and the workspace container share the same named volume at
|
|
5
|
+
* `/workspace`; a JSON file there survives the container recreate that applies a new
|
|
6
|
+
* image. The record is deliberately small: only sessions that were running when the
|
|
7
|
+
* user confirmed the upgrade, so recovery cannot send "继续" to unrelated history.
|
|
8
|
+
*
|
|
9
|
+
* @module workspace-upgrade-state
|
|
10
|
+
*/
|
|
11
|
+
/** Format version of the persisted hand-off record. */
|
|
12
|
+
export declare const WORKSPACE_UPGRADE_STATE_VERSION = 1;
|
|
13
|
+
/** One DSH session that was running when the upgrade was confirmed. */
|
|
14
|
+
export interface WorkspaceUpgradeSession {
|
|
15
|
+
/** DSH session id, the id `agents.get` and `agents.resume` accept. */
|
|
16
|
+
sessionId: string;
|
|
17
|
+
/** Optional human-readable title captured for diagnostics. */
|
|
18
|
+
title?: string;
|
|
19
|
+
/** Optional workspace directory captured for diagnostics. */
|
|
20
|
+
cwd?: string;
|
|
21
|
+
}
|
|
22
|
+
/** The JSON document written before the container is recreated. */
|
|
23
|
+
export interface WorkspaceUpgradeState {
|
|
24
|
+
version: typeof WORKSPACE_UPGRADE_STATE_VERSION;
|
|
25
|
+
upgradeId: string;
|
|
26
|
+
targetImage: string;
|
|
27
|
+
sessions: WorkspaceUpgradeSession[];
|
|
28
|
+
createdAt: string;
|
|
29
|
+
}
|
|
30
|
+
/** Directory used by this plugin below the DSH home. */
|
|
31
|
+
export declare const WORKSPACE_UPGRADE_STATE_DIR = "dataops-managed";
|
|
32
|
+
/** Name of the hand-off file. */
|
|
33
|
+
export declare const WORKSPACE_UPGRADE_STATE_FILE = "workspace-upgrade.json";
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the persistent DSH home used by this workspace.
|
|
36
|
+
*
|
|
37
|
+
* The companion currently starts with `DSH_HOME=/workspace/.dataops/dsh`; the fallback
|
|
38
|
+
* keeps tests and a manually launched host deterministic without reaching outside the
|
|
39
|
+
* mounted workspace.
|
|
40
|
+
* @param dshHome - override for tests.
|
|
41
|
+
* @returns the state directory path.
|
|
42
|
+
*/
|
|
43
|
+
export declare function workspaceUpgradeStatePath(dshHome?: string): string;
|
|
44
|
+
/** Validate a parsed state document. */
|
|
45
|
+
export declare function asWorkspaceUpgradeState(value: unknown): WorkspaceUpgradeState | null;
|
|
46
|
+
/**
|
|
47
|
+
* Read the pending hand-off record.
|
|
48
|
+
* @param file - state file path.
|
|
49
|
+
* @returns the record, or null when none exists or it cannot be parsed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function readWorkspaceUpgradeState(file?: string): Promise<WorkspaceUpgradeState | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Persist the hand-off record atomically.
|
|
54
|
+
*
|
|
55
|
+
* A partially written JSON file would be indistinguishable from "no upgrade pending",
|
|
56
|
+
* which would silently skip recovery. The temporary file is renamed into place only
|
|
57
|
+
* after the content is complete.
|
|
58
|
+
* @param state - record to persist.
|
|
59
|
+
* @param file - state file path.
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeWorkspaceUpgradeState(state: WorkspaceUpgradeState, file?: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Remove the hand-off record after recovery has been attempted.
|
|
64
|
+
* @param file - state file path.
|
|
65
|
+
*/
|
|
66
|
+
export declare function clearWorkspaceUpgradeState(file?: string): Promise<void>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace image upgrade orchestration.
|
|
3
|
+
*
|
|
4
|
+
* DataOps owns the Docker image comparison and the container restart. This plugin owns
|
|
5
|
+
* the two facts DSH alone can know: which sessions are running right now, and how to
|
|
6
|
+
* bring those sessions back after the container has been recreated. A small JSON file
|
|
7
|
+
* on the shared workspace volume carries that hand-off across the restart.
|
|
8
|
+
*
|
|
9
|
+
* @module workspace-upgrade
|
|
10
|
+
*/
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
+
import { type WorkspaceUpgradeSession, type WorkspaceUpgradeState } from './workspace-upgrade-state.ts';
|
|
13
|
+
/** Configuration needed to talk to DataOps. */
|
|
14
|
+
export interface WorkspaceUpgradeConfig {
|
|
15
|
+
/** DataOps API origin reachable from the DSH Host. */
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
/** Credential reference holding the current DataOps JWT. */
|
|
18
|
+
credentialRef: string;
|
|
19
|
+
}
|
|
20
|
+
/** The subset of the DataOps restart-preview response this plugin uses. */
|
|
21
|
+
export interface WorkspaceUpgradePreview {
|
|
22
|
+
imageStatus: 'CURRENT' | 'UPDATE_AVAILABLE' | 'NOT_RUNNING' | 'UNKNOWN';
|
|
23
|
+
configuredImage: string;
|
|
24
|
+
activeSessions: WorkspaceUpgradeSession[];
|
|
25
|
+
}
|
|
26
|
+
/** A refusal or transport failure from the DataOps API. */
|
|
27
|
+
export declare class WorkspaceUpgradeError extends Error {
|
|
28
|
+
/** HTTP status, or 502 when DataOps could not be reached. */
|
|
29
|
+
readonly status: number;
|
|
30
|
+
constructor(
|
|
31
|
+
/** HTTP status, or 502 when DataOps could not be reached. */
|
|
32
|
+
status: number, message: string);
|
|
33
|
+
}
|
|
34
|
+
/** Owns DataOps preview/restart calls and the DSH session hand-off. */
|
|
35
|
+
export declare class WorkspaceUpgrade {
|
|
36
|
+
private readonly ctx;
|
|
37
|
+
private readonly config;
|
|
38
|
+
readonly statePath: string;
|
|
39
|
+
constructor(ctx: Context, config: WorkspaceUpgradeConfig, statePath?: string);
|
|
40
|
+
/** Resolve the injected DSH agents service, if the profile provides one. */
|
|
41
|
+
private agents;
|
|
42
|
+
/** Read the current DataOps credential. */
|
|
43
|
+
private token;
|
|
44
|
+
/** DataOps origin used by this workspace. */
|
|
45
|
+
private apiBase;
|
|
46
|
+
/** Call one DataOps API path with the workspace JWT. */
|
|
47
|
+
private request;
|
|
48
|
+
/** Read the DataOps restart preview plus this host's running-session snapshot. */
|
|
49
|
+
preview(): Promise<WorkspaceUpgradePreview>;
|
|
50
|
+
/** Snapshot sessions that are executing a turn right now. */
|
|
51
|
+
private runningSessions;
|
|
52
|
+
/** Restart DataOps' workspace container; force is required when sessions are snapshot. */
|
|
53
|
+
private restart;
|
|
54
|
+
/**
|
|
55
|
+
* Persist the running-session snapshot and ask DataOps to recreate the container.
|
|
56
|
+
* @returns the accepted hand-off record.
|
|
57
|
+
*/
|
|
58
|
+
upgrade(): Promise<WorkspaceUpgradeState>;
|
|
59
|
+
/**
|
|
60
|
+
* Resume every snapshotted session and send one "继续".
|
|
61
|
+
*
|
|
62
|
+
* The method deliberately does not wait for an answer: the user's workspace should
|
|
63
|
+
* become usable immediately, and an in-flight tool call cannot be replayed safely.
|
|
64
|
+
* `recoverWorkspaceUpgradeAfterBoot` removes the hand-off file after this attempt.
|
|
65
|
+
*/
|
|
66
|
+
recover(): Promise<{
|
|
67
|
+
recovered: number;
|
|
68
|
+
skipped: number;
|
|
69
|
+
}>;
|
|
70
|
+
/** Remove the hand-off record once recovery has been attempted. */
|
|
71
|
+
clearRecoveryState(): Promise<void>;
|
|
72
|
+
/** Find a live session or resume it from persisted state. */
|
|
73
|
+
private ensureAgent;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Run recovery after the DSH host and its session persistence have had time to boot.
|
|
77
|
+
*
|
|
78
|
+
* `apply()` runs before a persisted session necessarily has its live agent; resuming
|
|
79
|
+
* eagerly can race that boot. A short bounded retry is enough, and a failed attempt
|
|
80
|
+
* still removes the hand-off file so the next page load cannot send "继续" forever.
|
|
81
|
+
* @param upgrade - upgrade service.
|
|
82
|
+
*/
|
|
83
|
+
export declare function recoverWorkspaceUpgradeAfterBoot(upgrade: WorkspaceUpgrade): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkelf/dsh-dataops-managed",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "DataOps JWT intake and credential-backed MCP tools for managed DeepSeek Harness workspaces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"lib/types/**/*.d.ts",
|
|
41
41
|
"cordis.patch.yml",
|
|
42
42
|
"skills/dataops-query/SKILL.md",
|
|
43
|
+
"skills/dataops-query/i18n/zh.json",
|
|
43
44
|
"README.md",
|
|
44
45
|
"LICENSE"
|
|
45
46
|
],
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_meta": {
|
|
3
|
+
"sourceHash": "37ae0b8aeb21d1e6bcc0b4b81d33b56280161fa5",
|
|
4
|
+
"model": "deepseek-v4.1-flash",
|
|
5
|
+
"translatedAt": "2026-10-18T03:56:00.000Z"
|
|
6
|
+
},
|
|
7
|
+
"title": "智能问数",
|
|
8
|
+
"description": "用户问数、取数、查数据、要报表时使用。包含选表策略(优先总表;有地域区分时先大后小)、取数前与用户确认资源清单、以及超时时主动分批次。",
|
|
9
|
+
"summary": "规定从业务系统取数的完整流程:如何挑选数据表与接口、取数前如何与用户确认资源清单、字段不足时如何下探分表,以及查询超时时如何主动分批次执行。"
|
|
10
|
+
}
|