@dsh-prism/dsh-orchestrator 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <img src="icon.svg" width="256" height="256" alt="dsh-orchestrator icon">
4
+
5
+ # dsh-orchestrator
6
+
7
+ **Give Prism separate models for talking to users, planning their requests and executing each step.**
8
+
9
+ English | [简体中文](README.zh_CN.md)
10
+
11
+ </div>
12
+
13
+ ## Set up Prism
14
+
15
+ Use Node.js 24.9 or later, npm, Git and credentials with read access to the five private plugin repositories. The checkout script places matching plugins and launcher files in a local `runtime/` directory. Run subsequent installation, configuration and launch commands there. The public guide is available without signing in. To use the example models, configure your DeepSeek credentials in DSH or set the `DEEPSEEK_API_KEY` environment variable. [Installation guide](https://prism.dsh-plug.in/)
16
+
17
+ ```sh
18
+ git clone https://github.com/dsh-plugins/dsh-prism.git
19
+ cd dsh-prism
20
+ node scripts/checkout.mjs
21
+ cd runtime
22
+ npm ci
23
+ npm run build
24
+ npm start
25
+ ```
26
+
27
+ ## Set up the model roster
28
+
29
+ In `runtime/`, copy the Prism example to `prism.config.json`. Under `orchestrator.models`, list the models available to each layer. Give every model an `id` recognized by its DSH provider and a `description` that explains when to choose it. For example, a quick search model and a cross-file analysis model give the planner two distinct choices.
30
+
31
+ | Layer | Who chooses the model | What it can do |
32
+ | --- | --- | --- |
33
+ | L1 · conversation | The user, in Web or IM | Query project metadata, contact planners, check progress and send visible replies. |
34
+ | L2 · planning | L1, when assigning a project | Break a task into steps, choose execution models and report to L1. |
35
+ | L3 · execution | L2, for each step | Use the granted tools in the planner’s project and return results. |
36
+
37
+ Set `orchestrator.defaultProjectId` and optionally `defaultL1Model`. Use `prompt` on individual models to supply role guidance. The default `append` mode adds it to the system prompt. Set `promptMode` to `replace` to provide the full system prompt. After restarting, open the model selector and check that the description and L1 choices match your configuration.
38
+
39
+ ```sh
40
+ npm start -- prism.config.json --host 127.0.0.1 --port 3080 --no-open
41
+ ```
42
+
43
+ [Prism documentation](https://prism.dsh-plug.in/) · [Technical reference](docs/TECH.md)
@@ -0,0 +1,43 @@
1
+ <div align="center">
2
+
3
+ <img src="icon.svg" width="256" height="256" alt="dsh-orchestrator 图标">
4
+
5
+ # dsh-orchestrator
6
+
7
+ **为棱镜分别配置面向用户、规划任务和执行步骤的模型。**
8
+
9
+ [English](README.md) | 简体中文
10
+
11
+ </div>
12
+
13
+ ## 接入棱镜
14
+
15
+ 需要 Node.js 24.9 或更高版本、npm、Git,以及对五个私有插件仓库的 Git 读取权限。检出脚本把匹配的插件和启动文件放入本机的 `runtime/` 目录,后续安装、配置和运行命令均在该目录执行。公开使用指南可直接阅读。需要调用示例模型时,请先在 DSH 凭据存储中配置 DeepSeek 凭据,或设置环境变量 `DEEPSEEK_API_KEY`。[安装指南](https://prism.dsh-plug.in/zh/)
16
+
17
+ ```sh
18
+ git clone https://github.com/dsh-plugins/dsh-prism.git
19
+ cd dsh-prism
20
+ node scripts/checkout.mjs
21
+ cd runtime
22
+ npm ci
23
+ npm run build
24
+ npm start
25
+ ```
26
+
27
+ ## 配置可选模型
28
+
29
+ 在 `runtime/` 中把示例配置复制为 `prism.config.json`,在 `orchestrator.models` 下分别列出各层可用模型。为每个模型填写 DSH 提供方可识别的 `id`,并用 `description` 说明适用场景。例如,为执行层提供一个适合快速检索的模型和一个擅长跨文件分析的模型,便于规划代理按步骤选择。
30
+
31
+ | 层级 | 谁选择模型 | 主要能力 |
32
+ | --- | --- | --- |
33
+ | L1 · 交互 | 用户在 Web 或 IM 中选择 | 查询项目元数据、联系规划代理、检查进度并主动向用户发信。 |
34
+ | L2 · 规划 | L1 派发项目任务时选择 | 拆分步骤、选择执行模型并向 L1 汇报。 |
35
+ | L3 · 执行 | L2 为每个步骤选择 | 在规划代理的项目中使用获准工具,返回执行结果。 |
36
+
37
+ 设置 `orchestrator.defaultProjectId`,还可设置 `defaultL1Model`。每个模型可用 `prompt` 配置角色指令。默认的 `append` 模式将内容附加到系统提示词,将 `promptMode` 设为 `replace` 则提供完整系统提示词。重启后打开模型选择器,检查显示的 L1 模型与介绍是否与配置相符。
38
+
39
+ ```sh
40
+ npm start -- prism.config.json --host 127.0.0.1 --port 3080 --no-open
41
+ ```
42
+
43
+ [棱镜使用指南](https://prism.dsh-plug.in/zh/) · [技术参考](docs/TECH.md)
@@ -0,0 +1,33 @@
1
+ - insert:
2
+ - id: prism-preset-l1
3
+ name: '@deepseek-ai/dsh-agent-preset'
4
+ config:
5
+ id: prism-l1
6
+ name: Prism L1
7
+ plugins: []
8
+ - id: prism-preset-l2
9
+ name: '@deepseek-ai/dsh-agent-preset'
10
+ config:
11
+ id: prism-l2
12
+ name: Prism L2
13
+ plugins: []
14
+ - id: prism-preset-l3
15
+ name: '@deepseek-ai/dsh-agent-preset'
16
+ config:
17
+ id: prism-l3
18
+ name: Prism L3
19
+ plugins:
20
+ - id: prism-fs
21
+ name: '@deepseek-ai/dsh-tool-fs'
22
+ config:
23
+ applyPatch: true
24
+ - id: prism-search
25
+ name: '@deepseek-ai/dsh-tool-fs-search'
26
+ config:
27
+ sampleOverCapGlobResults: false
28
+ - id: prism-bash
29
+ name: '@deepseek-ai/dsh-tool-bash'
30
+ - id: dsh-orchestrator
31
+ name: '@dsh-prism/dsh-orchestrator'
32
+ config:
33
+ useHostModel: true
@@ -0,0 +1,95 @@
1
+ export type Layer = 'L1' | 'L2' | 'L3';
2
+ export interface ModelConfig {
3
+ id: string;
4
+ provider?: string;
5
+ description: string;
6
+ prompt?: string;
7
+ promptMode?: 'append' | 'replace';
8
+ }
9
+ interface ProjectPolicy {
10
+ defaultProjectId?: string;
11
+ executionTools?: string[];
12
+ }
13
+ export interface HostModelConfig extends ProjectPolicy {
14
+ useHostModel: true;
15
+ }
16
+ export interface OrchestratorConfig extends ProjectPolicy {
17
+ useHostModel?: false;
18
+ defaultL1Model?: string;
19
+ models: Record<Layer, ModelConfig[]>;
20
+ }
21
+ export interface ProjectMetadata {
22
+ id: string;
23
+ description: string;
24
+ stack: string[];
25
+ nodeId: string;
26
+ gitRemote?: string;
27
+ permissions: string[];
28
+ }
29
+ export interface RegistryPort {
30
+ query(owner: string, search?: string): ProjectMetadata[];
31
+ resolve(owner: string, projectId: string): ProjectMetadata & {
32
+ workspace: string;
33
+ };
34
+ }
35
+ export interface WorkspaceTarget {
36
+ projectId: string;
37
+ nodeId: string;
38
+ cwd: string;
39
+ }
40
+ export interface TurnSpec {
41
+ bindingId: string;
42
+ owner: string;
43
+ parentBindingId?: string;
44
+ layer: Layer;
45
+ model: ModelConfig;
46
+ workspace: WorkspaceTarget;
47
+ /** Native DSH tools only; orchestration capabilities are supplied separately. */
48
+ allowedTools: string[];
49
+ /** L2 may further delegate only these native capabilities to L3. */
50
+ delegationCeiling?: string[];
51
+ systemPrompt: string;
52
+ }
53
+ export interface ToolDefinition {
54
+ name: string;
55
+ description: string;
56
+ parameters: Record<string, unknown>;
57
+ }
58
+ export interface AgentTools {
59
+ definitions: ToolDefinition[];
60
+ invoke(name: string, args: unknown): Promise<unknown>;
61
+ }
62
+ export interface TraceEntry {
63
+ role: string;
64
+ text: string;
65
+ at?: string;
66
+ }
67
+ export interface SessionRunner {
68
+ run(spec: TurnSpec, text: string, tools: AgentTools, signal?: AbortSignal, onReady?: (sessionId: string) => void): Promise<void>;
69
+ transcript(spec: TurnSpec): Promise<TraceEntry[]>;
70
+ }
71
+ export interface PublicMessage {
72
+ id: string;
73
+ role: 'user' | 'assistant';
74
+ delivery?: 'pending' | 'processed' | 'failed';
75
+ deliveryError?: 'no_response';
76
+ text: string;
77
+ at: string;
78
+ }
79
+ export interface TaskCard {
80
+ id: string;
81
+ title: string;
82
+ status: 'queued' | 'running' | 'completed' | 'failed';
83
+ at: string;
84
+ parentId?: string;
85
+ }
86
+ export interface ConversationView {
87
+ modelId: string;
88
+ models: {
89
+ id: string;
90
+ description: string;
91
+ }[];
92
+ messages: PublicMessage[];
93
+ tasks: TaskCard[];
94
+ }
95
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/core.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ import type { ConversationView, HostModelConfig, ModelConfig, OrchestratorConfig, RegistryPort, SessionRunner, TraceEntry, TurnSpec } from './contracts.js';
2
+ export type * from './contracts.js';
3
+ export declare class PrismError extends Error {
4
+ readonly code: 'INVALID_INPUT' | 'NOT_FOUND' | 'NO_PROJECT';
5
+ constructor(code: 'INVALID_INPUT' | 'NOT_FOUND' | 'NO_PROJECT', message: string);
6
+ }
7
+ export declare class Orchestrator {
8
+ private readonly registry;
9
+ private readonly runner;
10
+ private readonly store;
11
+ private readonly config;
12
+ private readonly readHostModel?;
13
+ private readonly active;
14
+ private readonly watchers;
15
+ private stopping;
16
+ constructor(config: OrchestratorConfig | HostModelConfig, registry: RegistryPort, runner: SessionRunner, stateDirectory: string, hostModel?: () => ModelConfig);
17
+ private currentConfig;
18
+ start(): Promise<void>;
19
+ private defaultModel;
20
+ private newRoot;
21
+ private newConversation;
22
+ private refreshRoot;
23
+ private change;
24
+ private snapshot;
25
+ view(owner: string): Promise<ConversationView>;
26
+ message(owner: string, text: string, requestId?: string): Promise<ConversationView>;
27
+ selectModel(owner: string, modelId: string): Promise<ConversationView>;
28
+ trace(owner: string, taskId: string): Promise<TraceEntry[]>;
29
+ subscribe(owner: string, listener: (view: ConversationView) => void): () => void;
30
+ private publish;
31
+ private ceiling;
32
+ /** At the mesh boundary reconstruct all security-sensitive fields from worker-local configuration. */
33
+ authorizeRemote(spec: TurnSpec): TurnSpec;
34
+ private spec;
35
+ private wake;
36
+ private consume;
37
+ private settle;
38
+ private finishReplies;
39
+ private finalizationText;
40
+ private settleTask;
41
+ private invoke;
42
+ private dispatch;
43
+ /** Wait for all in-process work, including events enqueued by completing agents. */
44
+ whenIdle(): Promise<void>;
45
+ /** Stop claiming new turns; committed outstanding messages remain available on restart. */
46
+ close(): Promise<void>;
47
+ }