@sparkelf/dsh-dataops-managed 0.3.28 → 0.3.30

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.
@@ -21,7 +21,11 @@ export interface DataOpsResourcesTabProps {
21
21
  };
22
22
  tab: ResourceTabRecord;
23
23
  visible?: boolean;
24
- sendReference?: (text: string, sessionId?: string) => Promise<void>;
24
+ insertResourceReference?: (resource: {
25
+ id?: unknown;
26
+ name?: unknown;
27
+ table?: unknown;
28
+ }, reference: Record<string, unknown>, sessionId?: string) => void;
25
29
  }
26
30
  /** Render the embedded DataOps resource page and translate its parent messages. */
27
- export declare function DataOpsResourcesTab({ tab, scope, sendReference }: DataOpsResourcesTabProps): import("react").JSX.Element;
31
+ export declare function DataOpsResourcesTab({ tab, scope, insertResourceReference }: DataOpsResourcesTabProps): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * DataOps resource-management transport: pending approval tasks, existing access grants,
3
+ * batch grant/revoke, and approval decisions. Disclosure is handled by tool-scope; this file
4
+ * only speaks to the existing DataOps APIs.
5
+ */
6
+ import type { ReviewApi } from './review-api.ts';
7
+ export type ResourceGrantTargetType = 'USER' | 'ROLE' | 'DEPARTMENT' | 'APPLICATION';
8
+ export type ResourceGrantPermission = 'READ' | 'WRITE' | 'MANAGE';
9
+ export type ResourceGrantType = 'REGULAR' | 'TEMPORARY';
10
+ export interface ResourceGrantInput {
11
+ targetType: ResourceGrantTargetType;
12
+ targetId: string;
13
+ permission?: ResourceGrantPermission;
14
+ grantType?: ResourceGrantType;
15
+ applicationId?: number;
16
+ }
17
+ export interface PendingTaskDecision {
18
+ taskId: number;
19
+ userTaskId: string;
20
+ decision: 'approve' | 'reject';
21
+ comment?: string;
22
+ expectedVersion?: number;
23
+ }
24
+ /** Thin typed wrapper over the existing DataOps REST endpoints. */
25
+ export declare class ResourceManagementApi {
26
+ private readonly reviewApi;
27
+ constructor(reviewApi: ReviewApi);
28
+ private call;
29
+ listPendingTasks(query?: string, limit?: number): Promise<Record<string, unknown>[]>;
30
+ listGrants(resourceId: number): Promise<Record<string, unknown>[]>;
31
+ listApplications(): Promise<Record<string, unknown>[]>;
32
+ replaceGrants(resourceId: number, grants: ResourceGrantInput[]): Promise<unknown>;
33
+ getTask(taskId: number): Promise<Record<string, unknown>>;
34
+ decideTask(decision: PendingTaskDecision): Promise<unknown>;
35
+ }
@@ -35,6 +35,7 @@ export declare class AiToolManager {
35
35
  private readonly unsubscribeExpiry;
36
36
  private disposeViewer;
37
37
  private scope;
38
+ private connectorState;
38
39
  private revision;
39
40
  private inflight;
40
41
  private disposed;
@@ -71,6 +72,21 @@ export declare class AiToolManager {
71
72
  clear(): void;
72
73
  /** Dispose every tool this manager registered and stop observing auth state. */
73
74
  dispose(): void;
75
+ /**
76
+ * Read the connector state that gates capability-owned tools.
77
+ *
78
+ * A missing or unreadable state file is not a permission decision: it means the connector has
79
+ * never been enabled in this workspace, so capability-gated tools stay unregistered.
80
+ * @returns The persisted connector state, or a disabled placeholder when it cannot be read.
81
+ */
82
+ private readConnectorState;
83
+ /**
84
+ * Re-reconcile after the connector's capability switches changed.
85
+ *
86
+ * The skill center writes the connector state; calling this keeps the registered tool set in
87
+ * step with it without waiting for the next credential or role sync.
88
+ */
89
+ refreshCapabilities(): Promise<void>;
74
90
  private loadScope;
75
91
  /** Store the scope and make the registry match it. */
76
92
  private applyScope;
@@ -63,7 +63,21 @@ export interface ToolAccessPolicy {
63
63
  readonly reviewer?: boolean;
64
64
  /** Only the DataOps 超级管理员 role sees this tool. */
65
65
  readonly superAdminOnly?: boolean;
66
+ /** Super administrators and administrators see this tool; everyone else does not. */
67
+ readonly adminOnly?: boolean;
68
+ /**
69
+ * Connector capability that must be switched on for this tool to exist at all.
70
+ *
71
+ * The connector's row in the skill center owns this bit; the manager reconciles the whole group
72
+ * when it changes, so a disabled capability removes its tools instead of leaving callable stubs
73
+ * that fail at invocation time.
74
+ */
75
+ readonly capability?: ToolCapabilityId;
76
+ /** Fallback when the connector state has no explicit boolean for that capability. */
77
+ readonly defaultEnabled?: boolean;
66
78
  }
79
+ /** Connector capability ids that gate a group of tools. */
80
+ export type ToolCapabilityId = 'resource.manage' | 'admin.manage';
67
81
  /**
68
82
  * Tool-to-capability disclosure map.
69
83
  *
@@ -126,6 +140,31 @@ export declare const AI_TOOL_ACCESS: {
126
140
  readonly permission: "data:resource:read";
127
141
  };
128
142
  readonly dataops_open_resource_tab: {};
143
+ readonly dataops_resource_pending_list: {
144
+ readonly capability: "resource.manage";
145
+ readonly adminOnly: true;
146
+ readonly defaultEnabled: true;
147
+ };
148
+ readonly dataops_resource_grant_list: {
149
+ readonly capability: "resource.manage";
150
+ readonly adminOnly: true;
151
+ readonly defaultEnabled: true;
152
+ };
153
+ readonly dataops_resource_grant_batch: {
154
+ readonly capability: "resource.manage";
155
+ readonly adminOnly: true;
156
+ readonly defaultEnabled: true;
157
+ };
158
+ readonly dataops_resource_approval_decide: {
159
+ readonly capability: "resource.manage";
160
+ readonly adminOnly: true;
161
+ readonly defaultEnabled: true;
162
+ };
163
+ readonly dataops_resource_grant_revoke: {
164
+ readonly capability: "resource.manage";
165
+ readonly adminOnly: true;
166
+ readonly defaultEnabled: true;
167
+ };
129
168
  };
130
169
  /** Every managed tool name, in the order the manager considers them. */
131
170
  export declare const AI_TOOL_NAMES: AiToolName[];
@@ -157,6 +196,10 @@ export declare const hasPermission: (scope: DataOpsScope, key: string) => boolea
157
196
  * Every check is disclosure metadata, not an execution gate: a visible tool still lets DataOps
158
197
  * answer with 403 when the underlying grant changed between a scope sync and the call.
159
198
  */
199
+ export declare function isToolCapabilityEnabled(name: AiToolName, state: {
200
+ readonly enabled: boolean;
201
+ readonly capabilities: Record<string, boolean>;
202
+ }): boolean;
160
203
  export declare function isToolVisible(name: AiToolName, scope: DataOpsScope): boolean;
161
204
  /**
162
205
  * Validate one `/api/ai/review/context` body.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkelf/dsh-dataops-managed",
3
- "version": "0.3.28",
3
+ "version": "0.3.30",
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",