@elinpf/dsh-ops 0.1.5

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.
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ // @elinpf/dsh-ops — deployment helper for the ops plugin suite.
3
+ //
4
+ // Usage:
5
+ // dsh-ops preset install [--agents-home <dir>] copy the ops agent preset
6
+ // dsh-ops preset remove [--agents-home <dir>] delete it
7
+ //
8
+ // The harness discovers agent presets only as directories under
9
+ // <agents-home>/.agent-presets/ — there is no package-native preset channel —
10
+ // so this helper materializes the preset shipped in this package. Discovery
11
+ // re-reads the roots on every call; a restart of the profile is still needed
12
+ // for the web surface.
13
+
14
+ import { cp, mkdir, rm, stat } from 'node:fs/promises'
15
+ import { join, resolve } from 'node:path'
16
+ import { fileURLToPath } from 'node:url'
17
+
18
+ const presetDir = fileURLToPath(new URL('../presets/ops', import.meta.url))
19
+
20
+ function parseArgs(argv) {
21
+ const [command, subcommand] = argv
22
+ const homeFlag = argv.indexOf('--agents-home')
23
+ const agentsHome = homeFlag !== -1 ? resolve(argv[homeFlag + 1]) : process.env.DSH_AGENTS_HOME ?? resolve(process.env.HOME ?? '.', '.agents')
24
+ return { command, subcommand, agentsHome }
25
+ }
26
+
27
+ async function main() {
28
+ const { command, subcommand, agentsHome } = parseArgs(process.argv.slice(2))
29
+ if (command !== 'preset') {
30
+ console.error('usage: dsh-ops preset install|remove [--agents-home <dir>]')
31
+ process.exit(2)
32
+ }
33
+ const target = join(agentsHome, '.agent-presets', 'ops')
34
+ if (subcommand === 'install') {
35
+ await rm(target, { recursive: true, force: true })
36
+ await mkdir(join(agentsHome, '.agent-presets'), { recursive: true })
37
+ await cp(presetDir, target, { recursive: true })
38
+ console.log(`dsh-ops: installed the ops agent preset at ${target}`)
39
+ console.log('dsh-ops: restart the profile for the change to take effect')
40
+ } else if (subcommand === 'remove') {
41
+ const present = await stat(target).then(() => true, () => false)
42
+ if (!present) {
43
+ console.error(`dsh-ops: no preset at ${target}`)
44
+ process.exit(1)
45
+ }
46
+ await rm(target, { recursive: true })
47
+ console.log(`dsh-ops: removed ${target}`)
48
+ console.log('dsh-ops: restart the profile for the change to take effect')
49
+ } else {
50
+ console.error('usage: dsh-ops preset install|remove [--agents-home <dir>]')
51
+ process.exit(2)
52
+ }
53
+ }
54
+
55
+ main().catch((error) => {
56
+ console.error(`dsh-ops: ${error instanceof Error ? error.message : String(error)}`)
57
+ process.exit(1)
58
+ })
@@ -0,0 +1,16 @@
1
+ # Host-plane rows for the ops suite, mounted when this bundle joins a
2
+ # profile's `dsh.profile.bundles` layer stack. Model-facing rows (tools,
3
+ # prompt content) never live here — they belong to the ops agent preset
4
+ # shipped under presets/ops/.
5
+ #
6
+ # Plugin names resolve through this package's dependencies (all granular
7
+ # @elinpf/dsh-ops-* packages), so a profile needs no other direct deps.
8
+ - insert:
9
+ - id: ops-trace-ui
10
+ name: '@elinpf/dsh-ops-trace-ui'
11
+
12
+ - id: ops-access-ui
13
+ name: '@elinpf/dsh-ops-access-ui'
14
+
15
+ - id: ops-panel
16
+ name: '@elinpf/dsh-ops-panel'
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Deployment metadata for the ops suite meta bundle. The package itself is
3
+ * never mounted as a plugin row — its `cordis.patch.yml` carries the
4
+ * host-plane rows and `presets/ops/` the agent preset; the `dsh-ops` bin
5
+ * materializes the preset into the agents home.
6
+ * @module @elinpf/dsh-ops
7
+ */
8
+ /** The preset id this bundle ships. */
9
+ export declare const PRESET_ID = "ops";
10
+ /** The granular packages this bundle deploys, in mount order. */
11
+ export declare const PACKAGES: readonly string[];
package/lib/index.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Deployment metadata for the ops suite meta bundle. The package itself is
3
+ * never mounted as a plugin row — its `cordis.patch.yml` carries the
4
+ * host-plane rows and `presets/ops/` the agent preset; the `dsh-ops` bin
5
+ * materializes the preset into the agents home.
6
+ * @module @elinpf/dsh-ops
7
+ */
8
+ /** The preset id this bundle ships. */
9
+ export const PRESET_ID = 'ops';
10
+ /** The granular packages this bundle deploys, in mount order. */
11
+ export const PACKAGES = [
12
+ '@elinpf/dsh-ops-access',
13
+ '@elinpf/dsh-ops-access-ceph',
14
+ '@elinpf/dsh-ops-access-gate',
15
+ '@elinpf/dsh-ops-access-k8s',
16
+ '@elinpf/dsh-ops-access-ssh',
17
+ '@elinpf/dsh-ops-access-ui',
18
+ '@elinpf/dsh-ops-panel',
19
+ '@elinpf/dsh-ops-prompts',
20
+ '@elinpf/dsh-ops-tool-ceph',
21
+ '@elinpf/dsh-ops-tool-environment',
22
+ '@elinpf/dsh-ops-tool-kubectl',
23
+ '@elinpf/dsh-ops-tool-ssh',
24
+ '@elinpf/dsh-ops-tool-trace',
25
+ '@elinpf/dsh-ops-trace-ui',
26
+ ];
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@elinpf/dsh-ops",
3
+ "version": "0.1.5",
4
+ "description": "Single-package deployment unit for the dsh-ops plugin suite: host-plane rows plus the ops agent preset, over the granular @elinpf/dsh-ops-* packages.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "dsh-ops": "./bin/dsh-ops.mjs"
9
+ },
10
+ "exports": {
11
+ ".": "./lib/index.js"
12
+ },
13
+ "files": [
14
+ "lib",
15
+ "bin",
16
+ "presets",
17
+ "cordis.patch.yml"
18
+ ],
19
+ "dsh": {
20
+ "bundle": {
21
+ "patch": "./cordis.patch.yml"
22
+ }
23
+ },
24
+ "dependencies": {
25
+ "@elinpf/dsh-ops-access": "^0.1.5",
26
+ "@elinpf/dsh-ops-access-ceph": "^0.1.5",
27
+ "@elinpf/dsh-ops-access-gate": "^0.1.5",
28
+ "@elinpf/dsh-ops-access-ssh": "^0.1.5",
29
+ "@elinpf/dsh-ops-access-ui": "^0.1.5",
30
+ "@elinpf/dsh-ops-panel": "^0.1.5",
31
+ "@elinpf/dsh-ops-prompts": "^0.1.5",
32
+ "@elinpf/dsh-ops-access-k8s": "^0.1.5",
33
+ "@elinpf/dsh-ops-tool-ceph": "^0.1.5",
34
+ "@elinpf/dsh-ops-tool-kubectl": "^0.1.5",
35
+ "@elinpf/dsh-ops-tool-ssh": "^0.1.5",
36
+ "@elinpf/dsh-ops-tool-environment": "^0.1.5",
37
+ "@elinpf/dsh-ops-tool-trace": "^0.1.5",
38
+ "@elinpf/dsh-ops-trace-ui": "^0.1.5"
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "^5.4.0"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc"
48
+ }
49
+ }
@@ -0,0 +1,323 @@
1
+ # The `standard` agent preset: the full coding agent, mounted once per process.
2
+ #
3
+ # This file is an AGENT-PLANE composition. The roster mounts it ONCE under a
4
+ # standing scope; every session naming it joins by scope parentage, so the
5
+ # tools and prompt sections registered here cover each joined agent while a
6
+ # session's own state stays keyed per Session/Agent inside the plugins. The
7
+ # host composition (`base.cordis.yml` + `web.cordis.yml`) keeps everything a
8
+ # preset must not own: the registries themselves, the sandbox and approval
9
+ # stack, persistence, and the model route.
10
+ #
11
+ # A service row here MUST sit inside a group carrying an `isolate` realm.
12
+ # Without one it publishes into the root realm, where it is process-global —
13
+ # another preset publishing the same name collides, and a host reader would
14
+ # resolve one preset's instance for every session; `dsh-agent-presets` rejects
15
+ # that at mount. `true` means an entry-local realm: this standing mount's own
16
+ # private instance, apart from every other preset's. (A shared label does NOT
17
+ # pool instances — `provide()` throws on the second registration under the
18
+ # same realm symbol; labels join REALMS, and are not what this file needs.)
19
+
20
+ # ── identity ────────────────────────────────────────────────────────────────
21
+
22
+ # The preset's own persona, shadowing the deployment default for this agent.
23
+ # `{{model}}` and `{{cwd}}` resolve from the agent's own route and workspace.
24
+ - id: persona
25
+ name: '@deepseek-ai/dsh-persona'
26
+ config:
27
+ text: >-
28
+ You are a coding agent powered by the {{model}} model. Your working directory is {{cwd}}.
29
+
30
+ - id: agent-instructions
31
+ name: '@deepseek-ai/dsh-agent-instructions'
32
+ config:
33
+ maxBytes: 65536
34
+
35
+ # ── shell ───────────────────────────────────────────────────────────────────
36
+
37
+ # `shell-env` stays in the HOST composition: `apps/cli/src/web.ts` injects it to
38
+ # publish `DSH_WEB_URL`/`DSH_WEB_MODE`, and a host row that injects a service is
39
+ # the criterion for host-plane ownership — injection resolves before any session
40
+ # exists, so there is no agent to key by. Behind a preset realm those variables
41
+ # never reached the model's shell at all. Both shell tools consume the host
42
+ # registry from here; their executors (`bash-sandbox`/`pwsh-sandbox`) are
43
+ # host-plane too.
44
+ - id: tool-bash
45
+ name: '@deepseek-ai/dsh-tool-bash'
46
+ disabled: !!js process.platform === 'win32'
47
+
48
+ - id: tool-pwsh
49
+ name: '@deepseek-ai/dsh-tool-pwsh'
50
+ disabled: !!js process.platform !== 'win32'
51
+
52
+ # ── filesystem ──────────────────────────────────────────────────────────────
53
+
54
+ # Both register into the host `tools` registry and provide nothing, so
55
+ # they need no realm. The `fs` service and its policy stay in the host.
56
+ - id: tool-fs
57
+ name: '@deepseek-ai/dsh-tool-fs'
58
+
59
+ - id: tool-fs-search
60
+ name: '@deepseek-ai/dsh-tool-fs-search'
61
+ config:
62
+ sampleOverCapGlobResults: false
63
+
64
+ # ── background jobs ────────────────────────────────────────────────────────
65
+
66
+ # Only the model-facing controls. The task REGISTRY stays on the host plane:
67
+ # its producers sit outside any realm this file could put it in — `tool-bash`
68
+ # above resolves it with `ctx.get`, and an entry-local realm here is invisible
69
+ # to every sibling row, so `run_in_background` would answer "background jobs
70
+ # unavailable" while these controls sat in the catalog. The registry is keyed by
71
+ # owning agent anyway, so one host instance serves every session. What a preset
72
+ # chooses is whether its agent can collect and stop background work at all.
73
+ - id: tool-jobs
74
+ name: '@deepseek-ai/dsh-tool-jobs'
75
+
76
+ # ── skills ──────────────────────────────────────────────────────────────────
77
+
78
+ # The skill REGISTRY lives in the host composition and is layered per scope:
79
+ # these rows register into THIS preset's layer of it, so they need no realm.
80
+ # `skill-filesystem` contributes local-root discovery for agents on this preset, and
81
+ # `tool-skill` gives them the catalog and loader; the merged catalog also
82
+ # carries whatever the deployment registered globally (repository plugins).
83
+ - id: skill-filesystem
84
+ name: '@deepseek-ai/dsh-skill-filesystem'
85
+
86
+ - id: tool-skill
87
+ name: '@deepseek-ai/dsh-tool-skill'
88
+
89
+ # ── goals ───────────────────────────────────────────────────────────────────
90
+
91
+ # Only the model-facing tool. The goal SERVICE, its session driver, and the
92
+ # `/goal` command stay on the host plane: the Gateway serves the goal domain as
93
+ # Remote endpoints whose receiver comes from a generated descriptor, so it
94
+ # resolves `goals` on the host and an entry-local realm here would hide it. The
95
+ # registry is keyed by session anyway, so one host instance serves every
96
+ # session. What a preset chooses is whether its agent can call the goal tool.
97
+ - id: tool-goal
98
+ name: '@deepseek-ai/dsh-tool-goal'
99
+
100
+ # ── plan mode ───────────────────────────────────────────────────────────────
101
+
102
+ # Plan state is per-agent by nature, so an entry-local realm is not a
103
+ # workaround here — it is the correct lifetime.
104
+ - id: planning
105
+ name: cordis:group
106
+ group: true
107
+ isolate:
108
+ planMode: true
109
+ config:
110
+ - id: plan-mode
111
+ name: '@deepseek-ai/dsh-plan-mode'
112
+ config:
113
+ section: |
114
+ You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
115
+
116
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
117
+
118
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use trace to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
119
+
120
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
121
+
122
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
123
+
124
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
125
+
126
+ # ── compaction ──────────────────────────────────────────────────────────────
127
+
128
+ # `compaction-basic` reads `toolResultPrune` through `ctx.get`, so the pruner must
129
+ # share this realm rather than sit outside it.
130
+ #
131
+ # `tokenMeter` is deliberately NOT in this realm: the meter stays on the HOST
132
+ # plane, and the rows here resolve that one instance. It takes no configuration,
133
+ # keys every fold by Session, and owns the context-meter projection units the
134
+ # browser reads for every session — behind a realm those units would come and go
135
+ # with whichever presets happen to be mounted. What a preset chooses is whether
136
+ # its agent compacts at all, which is `compaction-basic` below.
137
+ - id: compaction
138
+ name: cordis:group
139
+ group: true
140
+ isolate:
141
+ compaction: true
142
+ toolResultPruner: true
143
+ config:
144
+ - id: compaction-basic
145
+ name: '@deepseek-ai/dsh-compaction-basic'
146
+
147
+ - id: command-compact
148
+ name: '@deepseek-ai/dsh-command-compact'
149
+
150
+ - id: tool-result-pruner
151
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
152
+ config:
153
+ thresholdChars: 8192
154
+ headChars: 4096
155
+ tailChars: 1024
156
+
157
+ # ── delegation and workflows ────────────────────────────────────────────────
158
+
159
+ # The `subagents` registry and its spawn/fork backends live in the HOST
160
+ # composition: the registry is a process singleton whose cross-session queries
161
+ # the api-proxy serves to the browser, and a provider name may only be
162
+ # registered once. This preset contributes the delegation TOOLS, which resolve
163
+ # that host registry.
164
+ #
165
+ # `workflows` is different — nothing outside an agent reads it — so every row
166
+ # that reaches it shares one entry-local realm here, and a consumer left
167
+ # outside would resolve a host registry this preset does not populate.
168
+ #
169
+ # `tool-subagent-report` is host-plane for the same reason as the registry,
170
+ # not because a preset may not want it: it registers a CONTINUABLE SETUP on
171
+ # that singleton rather than a tool this agent calls, and the setup list is
172
+ # not scope-aware — one copy per mounted preset means every child gets
173
+ # `report` registered once per live session, which throws on the second.
174
+ - id: delegation
175
+ name: cordis:group
176
+ group: true
177
+ isolate:
178
+ workflowEngine: true
179
+ config:
180
+ - id: tool-subagent-control
181
+ name: '@deepseek-ai/dsh-tool-subagent-control'
182
+
183
+ - id: tool-subagent-list-agents
184
+ name: '@deepseek-ai/dsh-tool-subagent-control/list-agents'
185
+
186
+ - id: tool-subagent
187
+ name: '@deepseek-ai/dsh-tool-subagent'
188
+ config:
189
+ provider: spawn
190
+ toolName: subagent
191
+ backgroundMode: continuable
192
+
193
+ - id: tool-subagent-fork
194
+ name: '@deepseek-ai/dsh-tool-subagent'
195
+ config:
196
+ provider: fork
197
+ toolName: subagent_fork
198
+ backgroundMode: continuable
199
+
200
+ # Product providers are host-plane singletons. Copy this preset, then
201
+ # remove `disabled` from either ordinary tool row to expose that product
202
+ # only to agents composed from the copy.
203
+ - id: tool-subagent-codex
204
+ name: '@deepseek-ai/dsh-tool-subagent'
205
+ disabled: true
206
+ config:
207
+ provider: codex
208
+ toolName: subagent_codex
209
+ enableRunInBackground: false
210
+ maxDepth: provider-managed
211
+
212
+ - id: tool-subagent-claude-code
213
+ name: '@deepseek-ai/dsh-tool-subagent'
214
+ disabled: true
215
+ config:
216
+ provider: claude-code
217
+ toolName: subagent_claude_code
218
+ enableRunInBackground: false
219
+ maxDepth: provider-managed
220
+
221
+ - id: workflow-worker-thread
222
+ name: '@deepseek-ai/dsh-workflow-worker-thread'
223
+ config:
224
+ provider: spawn
225
+
226
+ - id: tool-workflow
227
+ name: '@deepseek-ai/dsh-tool-workflow'
228
+
229
+ - id: tool-ralph
230
+ name: '@deepseek-ai/dsh-tool-ralph'
231
+ config:
232
+ subagentProvider: spawn
233
+ maxRounds: 64
234
+
235
+ # ── remaining model-facing rows ─────────────────────────────────────────────
236
+
237
+ - id: tool-ask-user
238
+ name: '@deepseek-ai/dsh-tool-ask-user'
239
+
240
+ # ── ops prompt orchestration ───────────────────────────────────────────────
241
+
242
+ # ops-prompts provides a service (ctx.get('opsPrompts')) that ops-tool-trace
243
+ # registers methodology + reminders through. The service must sit behind
244
+ # an isolate realm so it does not leak into the root realm. ops-tool-trace
245
+ # shares the same realm to resolve opsPrompts via ctx.get.
246
+ - id: ops-orchestration
247
+ name: cordis:group
248
+ group: true
249
+ isolate:
250
+ opsPrompts: true
251
+ config:
252
+ - id: ops-prompts
253
+ name: '@elinpf/dsh-ops-prompts'
254
+
255
+ - id: tool-ops-trace
256
+ name: '@elinpf/dsh-ops-tool-trace'
257
+
258
+ # Prompt half of the environment inventory: registers the one-line
259
+ # methodology section through opsPrompts (this realm). The tool half
260
+ # sits in ops-access-registry — it needs opsAccess, not opsPrompts.
261
+ - id: tool-ops-environment-prompt
262
+ name: '@elinpf/dsh-ops-tool-environment/prompt'
263
+
264
+
265
+ # The `web` service and its search provider stay in the host composition; only
266
+ # the model-facing tool is per-session.
267
+ - id: tool-web
268
+ name: '@deepseek-ai/dsh-tool-web'
269
+ config:
270
+ fetch: false
271
+ searchTimeoutMs: 60000
272
+
273
+ # ── ops access registry ────────────────────────────────────────────────────
274
+ # NOTE: the group id must NOT equal any child id — a same-id parent/child pair
275
+ # loops cordis-plugin-loader's _disabled() parent walk forever (100% CPU hang).
276
+ - id: ops-access-registry
277
+ name: cordis:group
278
+ group: true
279
+ isolate:
280
+ opsAccess: true
281
+ opsAccessGate: true
282
+ config:
283
+ - id: ops-access
284
+ name: '@elinpf/dsh-ops-access'
285
+
286
+ - id: ops-access-k8s
287
+ name: '@elinpf/dsh-ops-access-k8s'
288
+
289
+ - id: ops-access-ceph
290
+ name: '@elinpf/dsh-ops-access-ceph'
291
+
292
+ - id: ops-access-ssh
293
+ name: '@elinpf/dsh-ops-access-ssh'
294
+
295
+ # The access gate: per-session credential brokering with human approval.
296
+ # Sits in this realm so its deferred `ctx.inject(['opsAccess'])` broker
297
+ # registration resolves THIS preset's opsAccess instance (registerAccessBroker
298
+ # uses the same deferred-mount discipline as registerAccessProvider — a static
299
+ # inject here would deadlock the loader against the ops-access definition
300
+ # row). It publishes `opsAccessGate` (the grant-ledger handle) into the same
301
+ # isolate realm — without `opsAccessGate` in the realm map above, that
302
+ # provide would land in the root realm and dsh-agent-presets rejects it as a
303
+ # process-global preset service. It also reads the host-plane `approval`
304
+ # service and registers the `request_access` tool into the host-plane `tools`
305
+ # registry (its `inject`). Without this row mounted, resolve is byte-for-byte
306
+ # the pre-gate ro behavior.
307
+ - id: ops-access-gate
308
+ name: '@elinpf/dsh-ops-access-gate'
309
+
310
+ - id: ops-tool-kubectl
311
+ name: '@elinpf/dsh-ops-tool-kubectl'
312
+
313
+ - id: ops-tool-ceph
314
+ name: '@elinpf/dsh-ops-tool-ceph'
315
+
316
+ - id: ops-tool-ssh
317
+ name: '@elinpf/dsh-ops-tool-ssh'
318
+
319
+ # Environment inventory tool: overview/show/refresh over the scanned
320
+ # cluster map. Needs THIS realm's opsAccess (resolves k8s ro profiles);
321
+ # its prompt half lives in the ops-orchestration group.
322
+ - id: ops-tool-environment
323
+ name: '@elinpf/dsh-ops-tool-environment'
@@ -0,0 +1,3 @@
1
+ name: 运维模式
2
+ description: 运维工程师专用:具备标准模式全部能力,额外提供调查树(trace)、凭证注册表(k8s/ceph/ssh)和 kubectl 工具。
3
+ order: 5