@openbkn/dsh-business-context 0.1.5-rc.1
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/LICENSE +201 -0
- package/README.md +42 -0
- package/README.zh.md +42 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +7553 -0
- package/lib/index.js +1788 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +624 -0
- package/lib/typert.remote-client.d.ts +40 -0
- package/lib/typert.remote-client.js +435 -0
- package/lib/types/auth.d.ts +42 -0
- package/lib/types/business-context-service.d.ts +126 -0
- package/lib/types/business-graph-model.d.ts +34 -0
- package/lib/types/business-network-catalog.d.ts +8 -0
- package/lib/types/client/BoundNetworkBadge.d.ts +37 -0
- package/lib/types/client/OpenBknContextToolView.d.ts +4 -0
- package/lib/types/client/OpenBknEntry.d.ts +9 -0
- package/lib/types/client/OpenBknOverlay.d.ts +16 -0
- package/lib/types/client/ProvenanceOverlay.d.ts +33 -0
- package/lib/types/client/SuggestionDock.d.ts +12 -0
- package/lib/types/client/TurnProvenanceActions.d.ts +13 -0
- package/lib/types/client/index.d.ts +11 -0
- package/lib/types/client/network-directory.d.ts +13 -0
- package/lib/types/client/openbkn-ui-controller.d.ts +51 -0
- package/lib/types/client/suggestion-dock-controller.d.ts +22 -0
- package/lib/types/client/turn-provenance-controller.d.ts +14 -0
- package/lib/types/config.d.ts +30 -0
- package/lib/types/dsh-session-binding.d.ts +26 -0
- package/lib/types/dsh-session-provenance.d.ts +27 -0
- package/lib/types/index.d.ts +33 -0
- package/lib/types/interaction-references.d.ts +15 -0
- package/lib/types/managed-session-policy.d.ts +18 -0
- package/lib/types/native-mcp-provenance.d.ts +17 -0
- package/lib/types/network-capability-profile.d.ts +26 -0
- package/lib/types/openbkn-cli-subprocess.d.ts +50 -0
- package/lib/types/openbkn-mcp-manager.d.ts +32 -0
- package/lib/types/platform-reader.d.ts +51 -0
- package/lib/types/provenance-handle.d.ts +5 -0
- package/lib/types/provenance-view.d.ts +11 -0
- package/lib/types/scoped-business-context.d.ts +10 -0
- package/lib/types/session-binding.d.ts +35 -0
- package/lib/types/suggested-prompts.d.ts +3 -0
- package/lib/types/turn-provenance.d.ts +25 -0
- package/lib/types/types.d.ts +111 -0
- package/lib/types/workspace-binding-registry.d.ts +40 -0
- package/package.json +131 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ProvenanceBusinessElement, ProvenanceBusinessOperation, ProvenanceContextRelation } from './types.js';
|
|
2
|
+
export interface BusinessGraphNode {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly element: ProvenanceBusinessElement;
|
|
5
|
+
readonly operation: ProvenanceBusinessOperation;
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
|
+
}
|
|
9
|
+
export interface BusinessGraphEdge {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly sourceKey: string;
|
|
13
|
+
readonly targetKey: string;
|
|
14
|
+
readonly source: BusinessGraphNode;
|
|
15
|
+
readonly target: BusinessGraphNode;
|
|
16
|
+
}
|
|
17
|
+
export interface BusinessGraphModel {
|
|
18
|
+
readonly nodes: readonly BusinessGraphNode[];
|
|
19
|
+
readonly edges: readonly BusinessGraphEdge[];
|
|
20
|
+
/** Formal relations whose endpoints were not disclosed as resolved objects. */
|
|
21
|
+
readonly unresolvedRelations: readonly ProvenanceContextRelation[];
|
|
22
|
+
readonly width: number;
|
|
23
|
+
readonly height: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds a deterministic display model from the Enterprise projection only.
|
|
27
|
+
* Missing relation endpoints stay unresolved; the client never invents nodes.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildBusinessGraphModel(operations: readonly ProvenanceBusinessOperation[], relations: readonly ProvenanceContextRelation[]): BusinessGraphModel;
|
|
30
|
+
export declare const businessGraphGeometry: {
|
|
31
|
+
readonly nodeWidth: 180;
|
|
32
|
+
readonly nodeHeight: 86;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=business-graph-model.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BusinessNetworkSummary } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Convert one platform response into the bounded data shape consumed by the
|
|
4
|
+
* network selector. The platform remains the authorization authority; this
|
|
5
|
+
* function only removes unneeded fields and rejects malformed rows.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseVisibleBusinessNetworks(value: unknown): readonly BusinessNetworkSummary[];
|
|
8
|
+
//# sourceMappingURL=business-network-catalog.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { BusinessNetworkBinding } from '../types.ts';
|
|
3
|
+
export interface BoundNetworkBadgeInjected {
|
|
4
|
+
hooks: {
|
|
5
|
+
binding: BoundNetworkController;
|
|
6
|
+
};
|
|
7
|
+
load(): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export type BoundNetworkBadgeProps = PropsRuntime<'conversation.session.header.actions'> & InjectFace<BoundNetworkBadgeInjected>;
|
|
10
|
+
/** Read-only session-header label; changing networks requires a new DSH session. */
|
|
11
|
+
export declare function BoundNetworkBadge({ useBinding, load }: BoundNetworkBadgeProps): import("react").JSX.Element | null;
|
|
12
|
+
export type BoundNetworkBadgeState = {
|
|
13
|
+
readonly kind: 'idle';
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'bound';
|
|
16
|
+
readonly binding: BusinessNetworkBinding;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'absent';
|
|
19
|
+
};
|
|
20
|
+
/** One Session's safe binding read, expressed in DSH's HostObservable currency. */
|
|
21
|
+
export declare class BoundNetworkController {
|
|
22
|
+
private readonly read;
|
|
23
|
+
/** Retry delay for "agent not live yet" reads; injectable for deterministic tests. */
|
|
24
|
+
private readonly retryDelayMs;
|
|
25
|
+
private readonly maxRetries;
|
|
26
|
+
private state;
|
|
27
|
+
private readonly listeners;
|
|
28
|
+
private retries;
|
|
29
|
+
constructor(read: () => Promise<BusinessNetworkBinding | undefined>,
|
|
30
|
+
/** Retry delay for "agent not live yet" reads; injectable for deterministic tests. */
|
|
31
|
+
retryDelayMs?: number, maxRetries?: number);
|
|
32
|
+
getSnapshot(): BoundNetworkBadgeState;
|
|
33
|
+
subscribe(listener: () => void): () => void;
|
|
34
|
+
load(): Promise<void>;
|
|
35
|
+
private publish;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=BoundNetworkBadge.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ToolCallViewProps } from '@deepseek-ai/dsh-client-ui-tool/client';
|
|
2
|
+
/** Safe replacement for the generic raw-output row of the fixed OpenBKN context tool. */
|
|
3
|
+
export declare function OpenBknContextToolView({ block }: ToolCallViewProps): import("react").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=OpenBknContextToolView.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SessionId } from '@deepseek-ai/dsh-api-remotes/client';
|
|
2
|
+
import type { InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
3
|
+
export interface OpenBknEntryInjected {
|
|
4
|
+
open(sessionId?: SessionId): void;
|
|
5
|
+
}
|
|
6
|
+
export type OpenBknEntryProps = PropsRuntime<'sidebar.footer.action'> & InjectFace<OpenBknEntryInjected>;
|
|
7
|
+
/** Additive sidebar-footer entry; the native DSH sidebar continues to own its shell. */
|
|
8
|
+
export declare function OpenBknEntry({ wide, useSessions, open }: OpenBknEntryProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=OpenBknEntry.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { OpenBknUiController } from './openbkn-ui-controller.ts';
|
|
3
|
+
export interface OpenBknOverlayInjected {
|
|
4
|
+
hooks: {
|
|
5
|
+
ui: OpenBknUiController;
|
|
6
|
+
};
|
|
7
|
+
close(): void;
|
|
8
|
+
refresh(): Promise<void>;
|
|
9
|
+
beginLogin(): Promise<void>;
|
|
10
|
+
configureToken(token: string): Promise<void>;
|
|
11
|
+
openNetwork(networkId: string, mode: 'continue' | 'new' | 'create-workspace'): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export type OpenBknOverlayProps = PropsRuntime<'shell.overlay'> & InjectFace<OpenBknOverlayInjected>;
|
|
14
|
+
/** Frame-wide, additive OpenBKN control plane. It is intentionally outside DSH chat scroll containers. */
|
|
15
|
+
export declare function OpenBknOverlay({ useUi, close, refresh, beginLogin, configureToken, openNetwork }: OpenBknOverlayProps): import("react").JSX.Element | null;
|
|
16
|
+
//# sourceMappingURL=OpenBknOverlay.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HostObservable, InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { ProvenanceHandle, ProvenanceView } from '../types.ts';
|
|
3
|
+
export interface ProvenanceOverlayState {
|
|
4
|
+
readonly sessionId?: string;
|
|
5
|
+
readonly messageId?: string;
|
|
6
|
+
readonly handle?: ProvenanceHandle;
|
|
7
|
+
}
|
|
8
|
+
interface FocusTarget {
|
|
9
|
+
focus(): void;
|
|
10
|
+
}
|
|
11
|
+
/** Global overlay state remains outside the transcript and its native scroll container. */
|
|
12
|
+
export declare class ProvenanceOverlayController implements HostObservable<ProvenanceOverlayState> {
|
|
13
|
+
private state;
|
|
14
|
+
private readonly listeners;
|
|
15
|
+
private restoreFocus;
|
|
16
|
+
getSnapshot: () => ProvenanceOverlayState;
|
|
17
|
+
subscribe: (listener: () => void) => (() => void);
|
|
18
|
+
open(sessionId: string, messageId: string, handle: ProvenanceHandle, restoreFocus?: FocusTarget): void;
|
|
19
|
+
close(): void;
|
|
20
|
+
private publish;
|
|
21
|
+
}
|
|
22
|
+
export interface ProvenanceOverlayInjected {
|
|
23
|
+
hooks: {
|
|
24
|
+
provenanceOverlay: ProvenanceOverlayController;
|
|
25
|
+
};
|
|
26
|
+
load(sessionId: string, messageId: string): Promise<ProvenanceView | undefined>;
|
|
27
|
+
close(): void;
|
|
28
|
+
}
|
|
29
|
+
export type ProvenanceOverlayProps = PropsRuntime<'shell.overlay'> & InjectFace<ProvenanceOverlayInjected>;
|
|
30
|
+
/** Provenance detail lives in an additive shell overlay, never inline in DSH chat. */
|
|
31
|
+
export declare function ProvenanceOverlay({ useProvenanceOverlay, load, close }: ProvenanceOverlayProps): import("react").JSX.Element | null;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=ProvenanceOverlay.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HostObservable, InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
export interface SuggestionDockInjected {
|
|
3
|
+
hooks: {
|
|
4
|
+
suggestions: HostObservable<readonly string[]>;
|
|
5
|
+
};
|
|
6
|
+
load(): Promise<void>;
|
|
7
|
+
setDraft(prompt: string): void;
|
|
8
|
+
}
|
|
9
|
+
export type SuggestionDockProps = PropsRuntime<'conversation.input.dock'> & InjectFace<SuggestionDockInjected>;
|
|
10
|
+
/** One bound-network empty-session entry; clicking only fills DSH's native draft. */
|
|
11
|
+
export declare function SuggestionDock({ useSuggestions, load, setDraft }: SuggestionDockProps): import("react").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=SuggestionDock.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HostObservable, InjectFace, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { ProvenanceHandle } from '../types.ts';
|
|
3
|
+
export interface TurnProvenanceActionsInjected {
|
|
4
|
+
hooks: {
|
|
5
|
+
provenance: HostObservable<ReadonlyMap<string, ProvenanceHandle>>;
|
|
6
|
+
};
|
|
7
|
+
load(messageId: string): Promise<void>;
|
|
8
|
+
open(messageId: string, handle: ProvenanceHandle, restoreFocus: HTMLElement): void;
|
|
9
|
+
}
|
|
10
|
+
export type TurnProvenanceActionsProps = PropsRuntime<'conversation.chat.assistant-actions'> & InjectFace<TurnProvenanceActionsInjected>;
|
|
11
|
+
/** One compact, native action-row entry for a finalized message with real OpenBKN provenance. */
|
|
12
|
+
export declare function TurnProvenanceActions({ messageId, useProvenance, load, open }: TurnProvenanceActionsProps): import("react").JSX.Element | null;
|
|
13
|
+
//# sourceMappingURL=TurnProvenanceActions.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** Browser-side Cordis identity. */
|
|
3
|
+
export declare const name = "openbkn-business-context-client";
|
|
4
|
+
/**
|
|
5
|
+
* Reserves an additive browser entry without taking ownership of any DSH
|
|
6
|
+
* shell, conversation, composer, or scrolling surface.
|
|
7
|
+
*/
|
|
8
|
+
export declare const inject: string[];
|
|
9
|
+
/** Mount the generated Remote boundary before registering additive DSH UI slots. */
|
|
10
|
+
export declare function apply(ctx: Context): Promise<() => Promise<void>>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BusinessNetworkSummary } from '../types.ts';
|
|
2
|
+
export declare const INITIAL_NETWORK_DIRECTORY_LIMIT = 20;
|
|
3
|
+
export interface NetworkDirectorySelection {
|
|
4
|
+
readonly networks: readonly BusinessNetworkSummary[];
|
|
5
|
+
readonly total: number;
|
|
6
|
+
readonly hasMore: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Pure browser-side presentation over the already-authorized catalogue. It
|
|
10
|
+
* neither broadens visibility nor changes the stable Host catalogue itself.
|
|
11
|
+
*/
|
|
12
|
+
export declare function selectNetworkDirectory(networks: readonly BusinessNetworkSummary[], query: string, limit?: number): NetworkDirectorySelection;
|
|
13
|
+
//# sourceMappingURL=network-directory.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AuthSnapshot, BusinessNetworkBinding, BusinessNetworkSummary } from '../types.ts';
|
|
2
|
+
/** Minimal browser-safe port over the generated OpenBKN Remote contract. */
|
|
3
|
+
export interface OpenBknUiPort {
|
|
4
|
+
status(signal?: AbortSignal): Promise<AuthSnapshot>;
|
|
5
|
+
beginLogin(signal?: AbortSignal): Promise<readonly BusinessNetworkSummary[]>;
|
|
6
|
+
configureToken(token: string, signal?: AbortSignal): Promise<readonly BusinessNetworkSummary[]>;
|
|
7
|
+
listNetworks(signal?: AbortSignal): Promise<readonly BusinessNetworkSummary[]>;
|
|
8
|
+
bindNetworkWorkspace(networkId: string, workspacePath: string, signal?: AbortSignal): Promise<BusinessNetworkSummary>;
|
|
9
|
+
bindNetwork(sessionId: string, networkId: string, signal?: AbortSignal): Promise<BusinessNetworkBinding>;
|
|
10
|
+
}
|
|
11
|
+
export type NetworkSessionMode = 'continue' | 'new' | 'create-workspace';
|
|
12
|
+
export type OpenNetworkSession = (network: BusinessNetworkSummary, mode: NetworkSessionMode) => Promise<string>;
|
|
13
|
+
export type OpenBknOverlayPhase = 'idle' | 'loading' | 'authentication-required' | 'ready' | 'binding' | 'error';
|
|
14
|
+
/** Render state for the additive OpenBKN overlay; credentials never enter it. */
|
|
15
|
+
export interface OpenBknOverlayState {
|
|
16
|
+
readonly open: boolean;
|
|
17
|
+
readonly phase: OpenBknOverlayPhase;
|
|
18
|
+
readonly auth?: AuthSnapshot;
|
|
19
|
+
readonly networks: readonly BusinessNetworkSummary[];
|
|
20
|
+
readonly message?: string;
|
|
21
|
+
}
|
|
22
|
+
type Listener = () => void;
|
|
23
|
+
/**
|
|
24
|
+
* Keeps Remote calls and their transient UI state outside React components.
|
|
25
|
+
* The controller intentionally knows only a selected session ID and safe
|
|
26
|
+
* catalogue summaries; Host code remains authoritative for authentication,
|
|
27
|
+
* visibility and durable binding.
|
|
28
|
+
*/
|
|
29
|
+
export declare class OpenBknUiController {
|
|
30
|
+
private readonly port;
|
|
31
|
+
private readonly openNetworkSession;
|
|
32
|
+
private readonly refreshBoundSession?;
|
|
33
|
+
private state;
|
|
34
|
+
private readonly listeners;
|
|
35
|
+
constructor(port: OpenBknUiPort, openNetworkSession: OpenNetworkSession, refreshBoundSession?: ((sessionId: string) => void) | undefined);
|
|
36
|
+
snapshot(): OpenBknOverlayState;
|
|
37
|
+
/** Slot-renderer observable contract; kept alongside `snapshot()` for tests and callers. */
|
|
38
|
+
getSnapshot(): OpenBknOverlayState;
|
|
39
|
+
subscribe(listener: Listener): () => void;
|
|
40
|
+
open(): void;
|
|
41
|
+
close(): void;
|
|
42
|
+
refresh(signal?: AbortSignal): Promise<void>;
|
|
43
|
+
/** Save and test a token without retaining it in controller state. */
|
|
44
|
+
configureToken(token: string): Promise<void>;
|
|
45
|
+
/** Run the Host-only OpenBKN CLI login, then present its verified catalogue. */
|
|
46
|
+
beginLogin(signal?: AbortSignal): Promise<void>;
|
|
47
|
+
openNetwork(networkId: string, mode: NetworkSessionMode, signal?: AbortSignal): Promise<void>;
|
|
48
|
+
private publish;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=openbkn-ui-controller.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
/** Per-session, browser-local cache of the Host-resolved empty-session entry. */
|
|
3
|
+
export declare class SuggestionDockController implements HostObservable<readonly string[]> {
|
|
4
|
+
private readonly read;
|
|
5
|
+
private prompts;
|
|
6
|
+
private readonly listeners;
|
|
7
|
+
private revision;
|
|
8
|
+
constructor(read: () => Promise<readonly string[]>);
|
|
9
|
+
getSnapshot: () => readonly string[];
|
|
10
|
+
subscribe: (listener: () => void) => (() => void);
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
/** Hide the entry as soon as the native DSH turn starts. */
|
|
13
|
+
beginTurn(): void;
|
|
14
|
+
/** Reload after a session binding is established. */
|
|
15
|
+
refresh(): Promise<void>;
|
|
16
|
+
private publish;
|
|
17
|
+
}
|
|
18
|
+
/** The entry is relevant only before the first native DSH turn. */
|
|
19
|
+
export declare function synchronizeSuggestionDockForEvents(controller: Pick<SuggestionDockController, 'beginTurn' | 'refresh'>, events: readonly {
|
|
20
|
+
readonly type: string;
|
|
21
|
+
}[]): void;
|
|
22
|
+
//# sourceMappingURL=suggestion-dock-controller.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HostObservable } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import type { ProvenanceHandle } from '../types.ts';
|
|
3
|
+
/** Browser-local cache of the Host-committed provenance for finalized assistant messages. */
|
|
4
|
+
export declare class TurnProvenanceController implements HostObservable<ReadonlyMap<string, ProvenanceHandle>> {
|
|
5
|
+
private readonly read;
|
|
6
|
+
private view;
|
|
7
|
+
private readonly listeners;
|
|
8
|
+
constructor(read: (messageId: string) => Promise<ProvenanceHandle | undefined>);
|
|
9
|
+
getSnapshot: () => ReadonlyMap<string, ProvenanceHandle>;
|
|
10
|
+
subscribe: (listener: () => void) => (() => void);
|
|
11
|
+
/** Read once per mounted message; a transient failure never erases a committed handle. */
|
|
12
|
+
load(messageId: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=turn-provenance-controller.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Schema from '@deepseek-ai/schemastery';
|
|
2
|
+
/** Deployment settings that are safe to keep in a DSH configuration patch. */
|
|
3
|
+
export interface Config {
|
|
4
|
+
/** OpenBKN platform base URL; credentials stay exclusively in DSH credentials. */
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
/** Optional Context Loader MCP endpoint; defaults to the standard platform route. */
|
|
7
|
+
mcpUrl?: string;
|
|
8
|
+
/** Optional OpenBKN business domain used to constrain platform requests. */
|
|
9
|
+
businessDomain?: string;
|
|
10
|
+
/** Absolute path to the OpenBKN CLI used only for the Host login/token handshake. */
|
|
11
|
+
cliPath: string;
|
|
12
|
+
/** Upper bound for one OpenBKN request. */
|
|
13
|
+
requestTimeoutMs: number;
|
|
14
|
+
/** Maximum result payload admitted into DSH context. */
|
|
15
|
+
maxResultBytes: number;
|
|
16
|
+
/** Maximum business-context graph node count rendered for one turn. */
|
|
17
|
+
maxGraphNodes: number;
|
|
18
|
+
/** Maximum business-context graph edge count rendered for one turn. */
|
|
19
|
+
maxGraphEdges: number;
|
|
20
|
+
/**
|
|
21
|
+
* Explicit opt-in only; disabled by default for local production use.
|
|
22
|
+
* Allows plaintext http to non-loopback hosts — it does NOT relax TLS
|
|
23
|
+
* certificate validation (self-signed certs are handled by the Node trust
|
|
24
|
+
* store, e.g. NODE_EXTRA_CA_CERTS, not by this switch).
|
|
25
|
+
*/
|
|
26
|
+
allowInsecureTls: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** Runtime schema and conservative defaults for the host plugin row. */
|
|
29
|
+
export declare const Config: Schema<Config>;
|
|
30
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SessionEventMap } from '@deepseek-ai/dsh-session/types';
|
|
2
|
+
import { BUSINESS_NETWORK_BOUND_EVENT, type BindBusinessNetworkResult, type BusinessNetworkBinding, type SessionEventLike } from './session-binding.js';
|
|
3
|
+
declare module '@deepseek-ai/dsh-session/types' {
|
|
4
|
+
interface SessionEventMap {
|
|
5
|
+
/** Immutable OpenBKN business-network identity selected for this DSH session. */
|
|
6
|
+
'openbkn/business-network-bound': BusinessNetworkBinding;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/** The small real-DSH Session capability surface needed for durable binding. */
|
|
10
|
+
export interface DshSessionLog {
|
|
11
|
+
snapshotEvents(): readonly SessionEventLike[];
|
|
12
|
+
}
|
|
13
|
+
/** DSH Session capability surface needed when a new binding is persisted. */
|
|
14
|
+
export interface DshSessionBindingLog extends DshSessionLog {
|
|
15
|
+
append(type: typeof BUSINESS_NETWORK_BOUND_EVENT, data: SessionEventMap[typeof BUSINESS_NETWORK_BOUND_EVENT], options?: {
|
|
16
|
+
readonly ignorable?: true;
|
|
17
|
+
}): void;
|
|
18
|
+
}
|
|
19
|
+
/** Recover the binding directly from DSH's append-only session log. */
|
|
20
|
+
export declare function readDshSessionBusinessNetwork(session: DshSessionLog): BusinessNetworkBinding | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Persist the selected business network as the one DSH session event. No
|
|
23
|
+
* side-store is created; reselecting the same network is idempotent.
|
|
24
|
+
*/
|
|
25
|
+
export declare function bindDshSessionBusinessNetwork(session: DshSessionBindingLog, requested: BusinessNetworkBinding): BindBusinessNetworkResult;
|
|
26
|
+
//# sourceMappingURL=dsh-session-binding.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SessionEventMap } from '@deepseek-ai/dsh-session/types';
|
|
2
|
+
import { TURN_PROVENANCE_EVENT, type TurnProvenanceEvent } from './turn-provenance.js';
|
|
3
|
+
import type { ProvenanceHandle } from './types.js';
|
|
4
|
+
declare module '@deepseek-ai/dsh-session/types' {
|
|
5
|
+
interface SessionEventMap {
|
|
6
|
+
/** Immutable OpenBKN references for one finalized assistant message. */
|
|
7
|
+
'openbkn/turn-provenance': TurnProvenanceEvent['data'];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Minimal real-DSH session surface required to read assistant-turn provenance. */
|
|
11
|
+
export interface DshSessionProvenanceLog {
|
|
12
|
+
snapshotEvents(): readonly {
|
|
13
|
+
readonly type: string;
|
|
14
|
+
readonly data: unknown;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
17
|
+
/** Real-DSH session surface used when a completed turn is committed. */
|
|
18
|
+
export interface DshSessionProvenanceWriter extends DshSessionProvenanceLog {
|
|
19
|
+
append(type: typeof TURN_PROVENANCE_EVENT, data: SessionEventMap[typeof TURN_PROVENANCE_EVENT], options?: {
|
|
20
|
+
readonly ignorable?: true;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
/** Read one message's committed provenance directly from the append-only DSH log. */
|
|
24
|
+
export declare function readDshSessionTurnProvenance(session: DshSessionProvenanceLog, messageId: string): ProvenanceHandle | undefined;
|
|
25
|
+
/** Append a completed-turn handle once; identical retries are intentionally idempotent. */
|
|
26
|
+
export declare function appendDshSessionTurnProvenance(session: DshSessionProvenanceWriter, messageId: string, handle: ProvenanceHandle): void;
|
|
27
|
+
//# sourceMappingURL=dsh-session-provenance.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { Config as ConfigSchema, type Config as PluginConfig } from './config.js';
|
|
3
|
+
export { ConfigSchema as Config };
|
|
4
|
+
export type { PluginConfig };
|
|
5
|
+
export { AuthCoordinator, OpenBknCliError } from './auth.js';
|
|
6
|
+
export type { AuthSnapshot, CliResult, OpenBknCli } from './auth.js';
|
|
7
|
+
export { BUSINESS_NETWORK_BOUND_EVENT, bindBusinessNetwork, BusinessNetworkBindingConflictError, readBusinessNetworkBinding, } from './session-binding.js';
|
|
8
|
+
export type { BindBusinessNetworkResult, BusinessNetworkBinding, BusinessNetworkBoundEvent, SessionEventLike, } from './session-binding.js';
|
|
9
|
+
export { bindDshSessionBusinessNetwork, readDshSessionBusinessNetwork } from './dsh-session-binding.js';
|
|
10
|
+
export type { DshSessionBindingLog, DshSessionLog } from './dsh-session-binding.js';
|
|
11
|
+
export { appendDshSessionTurnProvenance, readDshSessionTurnProvenance } from './dsh-session-provenance.js';
|
|
12
|
+
export type { DshSessionProvenanceLog, DshSessionProvenanceWriter } from './dsh-session-provenance.js';
|
|
13
|
+
export { TURN_PROVENANCE_EVENT, TurnProvenanceConflictError, appendTurnProvenance, readTurnProvenance } from './turn-provenance.js';
|
|
14
|
+
export type { TurnProvenanceEvent } from './turn-provenance.js';
|
|
15
|
+
export { normalizeProvenanceHandle } from './provenance-handle.js';
|
|
16
|
+
export type { ProvenanceHandle } from './types.js';
|
|
17
|
+
export { emptyBusinessSessionPrompt } from './suggested-prompts.js';
|
|
18
|
+
export { buildManagedSessionPolicy, OPENBKN_DSH_INTERACTION_AGENT_NAME } from './managed-session-policy.js';
|
|
19
|
+
export type { ManagedSessionPolicy } from './managed-session-policy.js';
|
|
20
|
+
export { buildNetworkCapabilityProfile } from './network-capability-profile.js';
|
|
21
|
+
export type { NetworkCapabilityProfile } from './network-capability-profile.js';
|
|
22
|
+
export { OpenBknPlatformReader, PlatformReaderError } from './platform-reader.js';
|
|
23
|
+
export type { PlatformFetch, PlatformReaderConfig, PlatformReaderErrorCode } from './platform-reader.js';
|
|
24
|
+
export { OpenBknBusinessContextService } from './business-context-service.js';
|
|
25
|
+
export { OpenBknWorkspaceBindingRegistry, workspaceBindingKey, workspaceBindingRecord } from './workspace-binding-registry.js';
|
|
26
|
+
export type { WorkspaceBindingRecord } from './workspace-binding-registry.js';
|
|
27
|
+
export { mountBoundBusinessNetworkTool } from './scoped-business-context.js';
|
|
28
|
+
/** Cordis identity used by the bundle's Host row. */
|
|
29
|
+
export declare const name = "openbkn-business-context";
|
|
30
|
+
export declare const inject: string[];
|
|
31
|
+
/** Register the host service; it contributes no model-visible tool globally. */
|
|
32
|
+
export declare function apply(ctx: Context, config: PluginConfig): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Minimal identifiers explicitly disclosed by an OpenBKN interaction response. */
|
|
2
|
+
export interface InteractionReferences {
|
|
3
|
+
readonly interactionId: string;
|
|
4
|
+
/** Operation ids are for execution presentation only; they are never request or Trace ids. */
|
|
5
|
+
readonly operationIds: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Recover only identifiers that the platform response explicitly labels.
|
|
9
|
+
*
|
|
10
|
+
* In particular, this deliberately does not inspect nested operation payloads:
|
|
11
|
+
* old POC responses may contain arbitrary MCP output, while a future platform
|
|
12
|
+
* contract can add request, Trace, and receipt ids to the provenance handle.
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractInteractionReferences(value: unknown): InteractionReferences | undefined;
|
|
15
|
+
//# sourceMappingURL=interaction-references.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NetworkCapabilityProfile } from './network-capability-profile.js';
|
|
2
|
+
import type { BusinessNetworkBinding } from './types.js';
|
|
3
|
+
export interface ManagedSessionPolicy {
|
|
4
|
+
readonly governance: string;
|
|
5
|
+
readonly capabilities: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Stable lifecycle identity written by OpenBKN Trace for this plugin surface.
|
|
9
|
+
* It is not a user, workspace, model, or knowledge-network identifier.
|
|
10
|
+
*/
|
|
11
|
+
export declare const OPENBKN_DSH_INTERACTION_AGENT_NAME = "bkn-agent-dsh-business-context";
|
|
12
|
+
/**
|
|
13
|
+
* Produce the two scoped system-prompt sections for one bound network. The
|
|
14
|
+
* fixed section renders the Host-verified identity as quoted data; the optional
|
|
15
|
+
* profile remains a projection rather than a copy of platform metadata.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildManagedSessionPolicy(binding: BusinessNetworkBinding, profile?: NetworkCapabilityProfile): ManagedSessionPolicy;
|
|
18
|
+
//# sourceMappingURL=managed-session-policy.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ProvenanceHandle } from './types.js';
|
|
2
|
+
interface EventLike {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly data: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface NativeMcpTurnProvenance {
|
|
7
|
+
readonly messageId: string;
|
|
8
|
+
readonly handle: ProvenanceHandle;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Recover provenance only from a completed interaction explicitly returned by
|
|
12
|
+
* the OpenBKN MCP finish call in the same DSH turn. No model text, tool args,
|
|
13
|
+
* or unrelated MCP output participates in this association.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findCompletedNativeMcpProvenance(events: readonly EventLike[], turn: number): NativeMcpTurnProvenance | undefined;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=native-mcp-provenance.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BusinessNetworkBinding } from './types.js';
|
|
2
|
+
export interface NetworkCapabilityProfile {
|
|
3
|
+
readonly schemaVersion: 1;
|
|
4
|
+
readonly profileVersion: string;
|
|
5
|
+
readonly knowledgeNetworkId: string;
|
|
6
|
+
readonly conceptGroups: readonly NamedCapability[];
|
|
7
|
+
readonly objectTypes: readonly NamedCapability[];
|
|
8
|
+
readonly relationTypes: readonly RelationCapability[];
|
|
9
|
+
readonly actionTypes: readonly NamedCapability[];
|
|
10
|
+
}
|
|
11
|
+
export interface NamedCapability {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface RelationCapability {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly sourceObjectTypeId: string;
|
|
18
|
+
readonly targetObjectTypeId: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Project the platform summary into the small, non-instructional index the
|
|
22
|
+
* managed-session policy may expose to an Agent. The original platform payload
|
|
23
|
+
* is deliberately not retained.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildNetworkCapabilityProfile(binding: BusinessNetworkBinding, payload: unknown): NetworkCapabilityProfile;
|
|
26
|
+
//# sourceMappingURL=network-capability-profile.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CliResult, OpenBknCli } from './auth.js';
|
|
2
|
+
/** Structural subset of DSH subprocess used for the fixed OpenBKN CLI contract. */
|
|
3
|
+
export interface CliSubprocess {
|
|
4
|
+
spawn(spec: {
|
|
5
|
+
readonly argv: readonly string[];
|
|
6
|
+
readonly cwd: string;
|
|
7
|
+
readonly stdio: {
|
|
8
|
+
readonly stdin: {
|
|
9
|
+
readonly data: string;
|
|
10
|
+
};
|
|
11
|
+
readonly stdout: {
|
|
12
|
+
readonly maxBytes: number;
|
|
13
|
+
};
|
|
14
|
+
readonly stderr: {
|
|
15
|
+
readonly maxBytes: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly graceMs: number;
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}): {
|
|
21
|
+
readonly done: Promise<{
|
|
22
|
+
readonly exitCode: number | null;
|
|
23
|
+
}>;
|
|
24
|
+
readonly collected: {
|
|
25
|
+
readonly stdout?: {
|
|
26
|
+
readFrom(fromByte: number): {
|
|
27
|
+
readonly text: string;
|
|
28
|
+
readonly lossy: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
readonly stderr?: {
|
|
32
|
+
readFrom(fromByte: number): {
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly lossy: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** DSH-managed invocation of the OpenBKN CLI with a fixed authentication contract. */
|
|
41
|
+
export declare class OpenBknCliSubprocess implements OpenBknCli {
|
|
42
|
+
private readonly subprocess;
|
|
43
|
+
private readonly cwd;
|
|
44
|
+
private readonly cliPath;
|
|
45
|
+
private readonly baseUrl;
|
|
46
|
+
constructor(subprocess: CliSubprocess, cwd: string, baseUrl: string, cliPath?: string);
|
|
47
|
+
run(args: readonly string[], signal?: AbortSignal): Promise<CliResult>;
|
|
48
|
+
private resolveArgv;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=openbkn-cli-subprocess.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Config } from './config.js';
|
|
3
|
+
export declare const OPENBKN_MCP_TOKEN_REF = "OPENBKN_MCP_TOKEN";
|
|
4
|
+
/**
|
|
5
|
+
* Mounts the standard DSH MCP client once the user has stored an OpenBKN
|
|
6
|
+
* token. It resolves the credential immediately before mounting, and passes it
|
|
7
|
+
* only to the in-memory standard MCP client configuration. An explicitly configured client with the same public tool
|
|
8
|
+
* namespace is treated as the deployment-owned instance.
|
|
9
|
+
*/
|
|
10
|
+
export declare class OpenBknMcpManager {
|
|
11
|
+
private readonly ctx;
|
|
12
|
+
private readonly config;
|
|
13
|
+
private readonly resolveToken;
|
|
14
|
+
private starting;
|
|
15
|
+
private fiber;
|
|
16
|
+
constructor(ctx: Context, config: Config, resolveToken: () => Promise<string | undefined>);
|
|
17
|
+
private reloading;
|
|
18
|
+
ensure(): Promise<void>;
|
|
19
|
+
private ensureMounted;
|
|
20
|
+
/** Reconnect the client after DSH rotates the managed credential. */
|
|
21
|
+
refresh(): Promise<void>;
|
|
22
|
+
private start;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the stable Context Loader endpoint from the deployment platform URL.
|
|
26
|
+
* An explicitly configured mcpUrl gets the same scheme fence as the control
|
|
27
|
+
* plane plus an origin fence: the Bearer token mounted on this client may
|
|
28
|
+
* only ever be sent to the configured platform (or an explicitly allowed
|
|
29
|
+
* plaintext loopback), never to an arbitrary host.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveMcpUrl(config: Pick<Config, 'baseUrl' | 'mcpUrl' | 'allowInsecureTls'>): string;
|
|
32
|
+
//# sourceMappingURL=openbkn-mcp-manager.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { JsonValue } from '@deepseek-ai/dsh-util-values';
|
|
2
|
+
import type { BusinessNetworkBinding } from './session-binding.js';
|
|
3
|
+
export type PlatformReaderErrorCode = 'AUTHENTICATION_REQUIRED' | 'LICENSE_REQUIRED' | 'PLATFORM_MISMATCH' | 'PLATFORM_UNAVAILABLE' | 'REQUEST_ABORTED' | 'OUTPUT_OVERFLOW' | 'INVALID_RESPONSE';
|
|
4
|
+
/** A bounded Host-side error. It never includes platform response bodies. */
|
|
5
|
+
export declare class PlatformReaderError extends Error {
|
|
6
|
+
readonly code: PlatformReaderErrorCode;
|
|
7
|
+
constructor(code: PlatformReaderErrorCode, message: string, options?: ErrorOptions);
|
|
8
|
+
}
|
|
9
|
+
export interface PlatformReaderConfig {
|
|
10
|
+
readonly baseUrl: string;
|
|
11
|
+
readonly requestTimeoutMs: number;
|
|
12
|
+
/** Maximum projected payload sent from Host to the DSH browser. */
|
|
13
|
+
readonly maxResultBytes: number;
|
|
14
|
+
readonly allowInsecureTls: boolean;
|
|
15
|
+
/** Business domain header sent on platform requests; defaults to the platform default `bd_public`. */
|
|
16
|
+
readonly businessDomain?: string;
|
|
17
|
+
readonly resolveToken?: () => Promise<string | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export type PlatformFetch = (input: URL, init: RequestInit) => Promise<Response>;
|
|
20
|
+
/**
|
|
21
|
+
* A fixed-route Host reader for plugin control-plane data. It is deliberately
|
|
22
|
+
* separate from the model path: agents use Context Loader MCP; this reader
|
|
23
|
+
* only obtains the catalog, schema profile, and safe Trace projections.
|
|
24
|
+
*/
|
|
25
|
+
export declare class OpenBknPlatformReader {
|
|
26
|
+
private readonly config;
|
|
27
|
+
private readonly fetcher;
|
|
28
|
+
constructor(config: PlatformReaderConfig, fetcher?: PlatformFetch);
|
|
29
|
+
listKnowledgeNetworks(signal: AbortSignal, _cwd?: string): Promise<JsonValue>;
|
|
30
|
+
getKnowledgeNetworkDetail(binding: BusinessNetworkBinding, signal: AbortSignal, _cwd?: string): Promise<JsonValue>;
|
|
31
|
+
getInteractionOperations(interactionId: string, signal: AbortSignal, _cwd?: string): Promise<JsonValue>;
|
|
32
|
+
getInteractionBusinessGraph(interactionId: string, signal: AbortSignal, _cwd?: string): Promise<JsonValue>;
|
|
33
|
+
/** Resolve the deployment's license edition so license-gated failures can explain themselves. */
|
|
34
|
+
getLicenseEdition(signal: AbortSignal): Promise<{
|
|
35
|
+
edition?: string;
|
|
36
|
+
licensed?: boolean;
|
|
37
|
+
} | undefined>;
|
|
38
|
+
private get;
|
|
39
|
+
private post;
|
|
40
|
+
private request;
|
|
41
|
+
private admit;
|
|
42
|
+
}
|
|
43
|
+
/** Hosts for which plaintext http is tolerated regardless of the insecure switch. */
|
|
44
|
+
export declare function isLoopbackHost(hostname: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Scheme fence shared by every outbound OpenBKN path so the Bearer token can
|
|
47
|
+
* never be configured onto a plaintext or unexpected endpoint: https is
|
|
48
|
+
* required outside loopback unless plaintext was explicitly allowed.
|
|
49
|
+
*/
|
|
50
|
+
export declare function assertHttpsEndpoint(url: URL, allowPlaintext: boolean): void;
|
|
51
|
+
//# sourceMappingURL=platform-reader.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProvenanceHandle } from './types.js';
|
|
2
|
+
export type { ProvenanceHandle } from './types.js';
|
|
3
|
+
/** Validate untrusted platform metadata before it becomes a Client-visible provenance reference. */
|
|
4
|
+
export declare function normalizeProvenanceHandle(value: unknown): ProvenanceHandle;
|
|
5
|
+
//# sourceMappingURL=provenance-handle.d.ts.map
|