dsh-env-manager-plugin 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.
Files changed (149) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -3
  3. package/client.js +2581 -0
  4. package/cordis.patch.yml +4 -0
  5. package/docs/00-project/current-state.md +272 -0
  6. package/docs/00-project/glossary.md +215 -0
  7. package/docs/00-project/project-brief.md +114 -0
  8. package/docs/00-project/roadmap.md +89 -0
  9. package/docs/01-architecture/DSH_Environment_Service_Memory_Skill_Brainstorm.md +493 -0
  10. package/docs/01-architecture/api-verification.md +416 -0
  11. package/docs/01-architecture/architecture-overview.md +222 -0
  12. package/docs/01-architecture/data-model.md +930 -0
  13. package/docs/01-architecture/decisions/ADR-0001-plugin-as-bundle.md +29 -0
  14. package/docs/01-architecture/decisions/ADR-0002-file-based-storage.md +25 -0
  15. package/docs/01-architecture/decisions/ADR-0003-skill-router-over-search.md +25 -0
  16. package/docs/01-architecture/decisions/ADR-0004-typescript-host-js-client.md +31 -0
  17. package/docs/01-architecture/decisions/ADR-0005-layered-rule-resolution.md +36 -0
  18. package/docs/01-architecture/decisions/ADR-0006-credentials-as-references.md +30 -0
  19. package/docs/01-architecture/decisions/ADR-0007-session-scoped-default-environment.md +28 -0
  20. package/docs/01-architecture/decisions/ADR-0008-memory-bridge-not-second-store.md +31 -0
  21. package/docs/01-architecture/decisions/ADR-0009-client-host-http-transport.md +87 -0
  22. package/docs/01-architecture/decisions/ADR-0010-environment-plane-model.md +87 -0
  23. package/docs/01-architecture/decisions/ADR-0011-k8s-node-execution-model.md +92 -0
  24. package/docs/01-architecture/design.md +666 -0
  25. package/docs/01-architecture/detailed-design.md +961 -0
  26. package/docs/01-architecture/implementation-plan.md +323 -0
  27. package/docs/01-architecture/module-boundaries.md +306 -0
  28. package/docs/01-architecture/security-model.md +227 -0
  29. package/docs/01-architecture/storage-contract.md +224 -0
  30. package/docs/01-architecture/tool-contract.md +438 -0
  31. package/docs/01-architecture/ui-design.md +587 -0
  32. package/docs/02-harness/agent-behavior.md +36 -0
  33. package/docs/02-harness/change-snapshot-policy.md +29 -0
  34. package/docs/02-harness/client-ui-integration.md +110 -0
  35. package/docs/02-harness/context-policy.md +43 -0
  36. package/docs/02-harness/harness-standard.md +91 -0
  37. package/docs/02-harness/task-execution-policy.md +26 -0
  38. package/docs/02-harness/verification-policy.md +97 -0
  39. package/docs/03-openspec/archive-rule.md +25 -0
  40. package/docs/03-openspec/bugfix-rule.md +30 -0
  41. package/docs/03-openspec/design-rule.md +33 -0
  42. package/docs/03-openspec/openspec-usage-guide.md +31 -0
  43. package/docs/03-openspec/proposal-rule.md +70 -0
  44. package/docs/03-openspec/spec-rule.md +33 -0
  45. package/docs/03-openspec/tasks-rule.md +31 -0
  46. package/docs/04-development/coding-style.md +67 -0
  47. package/docs/04-development/dependency-policy.md +43 -0
  48. package/docs/04-development/development-guide.md +85 -0
  49. package/docs/04-development/directory-convention.md +105 -0
  50. package/docs/04-development/local-run-guide.md +61 -0
  51. package/docs/04-development/testing-guide.md +102 -0
  52. package/docs/05-domain/deployment-template.md +76 -0
  53. package/docs/05-domain/environment-template.md +165 -0
  54. package/docs/05-domain/operation-binding-template.md +55 -0
  55. package/docs/05-domain/operation-record-template.md +55 -0
  56. package/docs/05-domain/prompt-template.md +90 -0
  57. package/docs/05-domain/rule-template.md +73 -0
  58. package/docs/05-domain/service-template.md +39 -0
  59. package/docs/06-operations/deployment-guide.md +54 -0
  60. package/docs/06-operations/release.md +198 -0
  61. package/docs/06-operations/security-policy.md +53 -0
  62. package/docs/06-operations/troubleshooting.md +141 -0
  63. package/docs/07-templates/adr-template.md +21 -0
  64. package/docs/07-templates/bugfix-template.md +11 -0
  65. package/docs/07-templates/case-template.md +15 -0
  66. package/docs/07-templates/design-template.md +29 -0
  67. package/docs/07-templates/proposal-template.md +19 -0
  68. package/docs/07-templates/spec-template.md +15 -0
  69. package/docs/07-templates/tasks-template.md +12 -0
  70. package/docs/99-archive/README.md +13 -0
  71. package/docs/README.md +142 -0
  72. package/icon.svg +4 -0
  73. package/index.js +31 -0
  74. package/lib/app/app.d.ts +67 -0
  75. package/lib/app/app.js +494 -0
  76. package/lib/app/app.js.map +1 -0
  77. package/lib/config.d.ts +55 -0
  78. package/lib/config.js +42 -0
  79. package/lib/config.js.map +1 -0
  80. package/lib/domain/constants.d.ts +21 -0
  81. package/lib/domain/constants.js +59 -0
  82. package/lib/domain/constants.js.map +1 -0
  83. package/lib/domain/errors.d.ts +20 -0
  84. package/lib/domain/errors.js +22 -0
  85. package/lib/domain/errors.js.map +1 -0
  86. package/lib/domain/schemas.d.ts +28 -0
  87. package/lib/domain/schemas.js +445 -0
  88. package/lib/domain/schemas.js.map +1 -0
  89. package/lib/domain/types.d.ts +412 -0
  90. package/lib/domain/types.js +2 -0
  91. package/lib/domain/types.js.map +1 -0
  92. package/lib/index.d.ts +18 -0
  93. package/lib/index.js +89 -0
  94. package/lib/index.js.map +1 -0
  95. package/lib/logger.d.ts +8 -0
  96. package/lib/logger.js +13 -0
  97. package/lib/logger.js.map +1 -0
  98. package/lib/memory/bridge.d.ts +18 -0
  99. package/lib/memory/bridge.js +13 -0
  100. package/lib/memory/bridge.js.map +1 -0
  101. package/lib/registry/integrity.d.ts +10 -0
  102. package/lib/registry/integrity.js +204 -0
  103. package/lib/registry/integrity.js.map +1 -0
  104. package/lib/registry/registry.d.ts +14 -0
  105. package/lib/registry/registry.js +182 -0
  106. package/lib/registry/registry.js.map +1 -0
  107. package/lib/resolver/merge.d.ts +23 -0
  108. package/lib/resolver/merge.js +90 -0
  109. package/lib/resolver/merge.js.map +1 -0
  110. package/lib/resolver/resolve.d.ts +18 -0
  111. package/lib/resolver/resolve.js +288 -0
  112. package/lib/resolver/resolve.js.map +1 -0
  113. package/lib/resolver/template.d.ts +10 -0
  114. package/lib/resolver/template.js +42 -0
  115. package/lib/resolver/template.js.map +1 -0
  116. package/lib/router/params.d.ts +3 -0
  117. package/lib/router/params.js +83 -0
  118. package/lib/router/params.js.map +1 -0
  119. package/lib/router/router.d.ts +11 -0
  120. package/lib/router/router.js +204 -0
  121. package/lib/router/router.js.map +1 -0
  122. package/lib/session/session.d.ts +16 -0
  123. package/lib/session/session.js +64 -0
  124. package/lib/session/session.js.map +1 -0
  125. package/lib/skill.d.ts +17 -0
  126. package/lib/skill.js +56 -0
  127. package/lib/skill.js.map +1 -0
  128. package/lib/storage/atomic.d.ts +10 -0
  129. package/lib/storage/atomic.js +107 -0
  130. package/lib/storage/atomic.js.map +1 -0
  131. package/lib/storage/paths.d.ts +10 -0
  132. package/lib/storage/paths.js +50 -0
  133. package/lib/storage/paths.js.map +1 -0
  134. package/lib/storage/records.d.ts +16 -0
  135. package/lib/storage/records.js +112 -0
  136. package/lib/storage/records.js.map +1 -0
  137. package/lib/storage/sessions.d.ts +17 -0
  138. package/lib/storage/sessions.js +65 -0
  139. package/lib/storage/sessions.js.map +1 -0
  140. package/lib/tools/tools.d.ts +14 -0
  141. package/lib/tools/tools.js +472 -0
  142. package/lib/tools/tools.js.map +1 -0
  143. package/lib/transport/http.d.ts +3 -0
  144. package/lib/transport/http.js +217 -0
  145. package/lib/transport/http.js.map +1 -0
  146. package/locale/en.json +6 -0
  147. package/locale/zh.json +6 -0
  148. package/package.json +101 -6
  149. package/scripts/repair-profile.mjs +141 -0
@@ -0,0 +1,141 @@
1
+ # Troubleshooting
2
+
3
+ ## Install fails with "Cannot find module .../lib/index.js"
4
+
5
+ This means DSH found the bundle but the Host build output was absent or incomplete.
6
+
7
+ 1. Prefer the published package: `plugin_manager` → `install_bundle` with
8
+ `dsh-env-manager-plugin@0.1.1`. The npm tarball includes `lib/`.
9
+ 2. If installing a local checkout, use the current `main`; `lib/` is committed there on
10
+ purpose. Older clones did not include it.
11
+ 3. If the checkout is older or `lib/` was deleted, run `npm install && npm run build`
12
+ in the repository, then reinstall the bundle.
13
+ 4. Do not copy only `index.js` into a profile; the bundle needs `lib/`, `client.js`,
14
+ `cordis.patch.yml` and the locale files together.
15
+
16
+ `index.js` now reports this condition with a dedicated message instead of a bare
17
+ `ERR_MODULE_NOT_FOUND`.
18
+
19
+ ## DSH does not start: duplicate bundle registration
20
+
21
+ The plugin must appear **once** in the profile. A failed manual install often leaves both
22
+ an old `dsh-env-manager` entry and a new `dsh-env-manager-plugin` entry, which inserts the
23
+ same loader row twice.
24
+
25
+ For the affected profile, stop DSH, back up both files, and inspect:
26
+
27
+ ```powershell
28
+ $p = Join-Path $HOME '.dsh\profiles\<profile>'
29
+ Get-Content -Raw (Join-Path $p 'package.json')
30
+ Get-ChildItem (Join-Path $p 'node_modules') | Where-Object Name -match 'env-manager'
31
+ ```
32
+
33
+ In `package.json`:
34
+
35
+ - keep `dsh-env-manager-plugin` exactly once in `dependencies`;
36
+ - keep `dsh-env-manager-plugin` exactly once in `dsh.profile.bundles`;
37
+ - remove the legacy `dsh-env-manager` dependency and bundle entry;
38
+ - do not add a second bundle entry by hand.
39
+
40
+ Then remove any stale `node_modules/dsh-env-manager` link and reinstall through
41
+ `plugin_manager`. Do not copy files into the profile as a workaround.
42
+
43
+ From a checkout you can run the repair helper before restarting:
44
+
45
+ ```powershell
46
+ node scripts/repair-profile.mjs --profile <profile>
47
+ node scripts/repair-profile.mjs --profile <profile> --fix
48
+ ```
49
+
50
+ The helper edits only `package.json` (with a timestamped backup); it never deletes
51
+ registry data. It lives in the repository and in `dsh-env-manager-plugin@0.1.1`+.
52
+
53
+ ## Plugin is not visible after install
54
+
55
+ 1. Ask `plugin_manager` for `action: list_bundles` — confirm the bundle is listed.
56
+ 2. Check the activation result for `failed` / `overridden` / `restart-required`.
57
+ 3. Restart DSH.
58
+
59
+ ## Host build fails
60
+
61
+ 1. Run `npm run build` and read the first error, not the count.
62
+ 2. Confirm `tsconfig.json` exists and `outDir` is `lib`.
63
+ 3. Check that `index.js` re-exports `./lib/index.js` and the file exists.
64
+
65
+ ## Tools are not registered
66
+
67
+ 1. Confirm the bundle is active.
68
+ 2. Check Host logs for an exception in `apply`.
69
+ 3. Call `env_list`: an empty list is correct on a fresh install; an unknown tool means registration failed.
70
+ 4. Reinstall after every Host rebuild; Host code changes need a fresh module generation.
71
+
72
+ ## Client panel does not appear
73
+
74
+ 1. Verify `client.js` is listed in `files` and exported as `./client`.
75
+ 2. Check the browser console for module-loader errors.
76
+ 3. Verify the slot id and name match a live slot.
77
+ 4. Reinstall the bundle after editing `client.js`.
78
+
79
+ ## Registry loads with warnings
80
+
81
+ Warnings are expected when a file is invalid. They name the file and the field.
82
+
83
+ 1. Fix the YAML or the field.
84
+ 2. Run `env_validate` again.
85
+ 3. Invalid files are never deleted automatically, so the data is still on disk.
86
+
87
+ ## `env_resolve` returns `RULE_UNDEFINED_VARIABLE`
88
+
89
+ 1. The message names the field and the missing variable.
90
+ 2. Check that the variable exists in a referenced rule profile or in an environment/deployment override.
91
+ 3. Remember that only the deployment's runtime fields are in scope.
92
+
93
+ ## `RULE_CYCLE`
94
+
95
+ Two or more fields reference each other. Break the cycle in the rule profile; the message contains the cycle path.
96
+
97
+ ## `RULE_PATH_TRAVERSAL`
98
+
99
+ A resolved path contains a `..` segment. Fix the template; traversal is rejected by design.
100
+
101
+ ## `DEPLOYMENT_AMBIGUOUS`
102
+
103
+ The service has several bindings in the environment. Pass `deploymentId` explicitly.
104
+
105
+ ## `BINDING_CONFLICT`
106
+
107
+ Two enabled bindings match at the same level. Disable one, narrow one, or merge them. The plugin will not choose for you.
108
+
109
+ ## `SKILL_UNAVAILABLE`
110
+
111
+ The bound Skill is not registered, or its source/provider does not match. Install or correct the Skill; do not add a fallback binding that changes the environment silently.
112
+
113
+ ## `POLICY_DENIED`
114
+
115
+ Either the environment is production and the binding does not allow it, or an approval was denied. Fix the policy deliberately, not by flipping flags in a hurry.
116
+
117
+ ## Session default is not remembered
118
+
119
+ If the tool reports `persisted: false`, the state file could not be written. Check `dataDir` permissions and the `sessions/` directory. The value is kept in a process-local cache, so it still works for this process but is lost on restart.
120
+
121
+ ## Panel says "Cannot reach the Host"
122
+
123
+ 1. Confirm the bundle is active and the Host is running.
124
+ 2. Reload the page; the panel uses a same-origin `POST /env-manager/api`.
125
+ 3. In the browser console, a 403 means the request header or origin check failed — this is the transport control, not a bug.
126
+ 4. A 404 means the route was not registered; reinstall the bundle after a Host rebuild.
127
+
128
+ ## Panel write is denied for a production record
129
+
130
+ `writePolicy.allowUiProductionWrites` defaults to `false`. Edit the YAML through the Agent (`env_save`, with approval) or change the policy deliberately.
131
+
132
+ ## Panel shows "Unknown" skill availability
133
+
134
+ The Skill catalog was absent or incomplete when the operation was resolved. Check that the Skill registry is available; the router never assumes a missing catalog means "available".
135
+
136
+ ## Storage errors
137
+
138
+ 1. Verify write permission on `dataDir`.
139
+ 2. Check that `dataDir` is not inside a read-only workspace.
140
+ 3. Confirm the file name matches the record `id`.
141
+ 4. Check `schemaVersion`; V1 only reads `1`.
@@ -0,0 +1,21 @@
1
+ # ADR-{NNNN}: Title
2
+
3
+ ## Status
4
+
5
+ Proposed / Accepted / Superseded
6
+
7
+ ## Context
8
+
9
+ What is the issue that we're seeing that is motivating this decision?
10
+
11
+ ## Decision
12
+
13
+ What is the change that we're proposing or have accepted?
14
+
15
+ ## Consequences
16
+
17
+ What becomes easier or more difficult to do because of this change?
18
+
19
+ ## Alternatives Considered
20
+
21
+ What other approaches were considered and why were they rejected?
@@ -0,0 +1,11 @@
1
+ # Bugfix: {Name}
2
+
3
+ ## Symptom
4
+
5
+ ## Root Cause
6
+
7
+ ## Fix
8
+
9
+ ## Regression Test
10
+
11
+ ## Verification
@@ -0,0 +1,15 @@
1
+ # Case: {Name}
2
+
3
+ ## Environment
4
+
5
+ ## Service
6
+
7
+ ## Operation
8
+
9
+ ## Expected Behavior
10
+
11
+ ## Actual Behavior
12
+
13
+ ## Resolution
14
+
15
+ ## Lessons Learned
@@ -0,0 +1,29 @@
1
+ # Design: {Name}
2
+
3
+ ## Overview
4
+
5
+ What is being designed and why.
6
+
7
+ ## Data Flow
8
+
9
+ Step-by-step flow.
10
+
11
+ ## Module Allocation
12
+
13
+ Which modules are involved and what each owns.
14
+
15
+ ## Schema Changes
16
+
17
+ New or changed YAML/JSON schemas.
18
+
19
+ ## Security Considerations
20
+
21
+ Credential handling, approval policies, production access.
22
+
23
+ ## Error Handling
24
+
25
+ Expected failure modes and responses.
26
+
27
+ ## Verification Plan
28
+
29
+ Tests and manual checks.
@@ -0,0 +1,19 @@
1
+ # Proposal: {Name}
2
+
3
+ ## Problem
4
+
5
+ ## Goal
6
+
7
+ ## Scope
8
+
9
+ ## Out of Scope
10
+
11
+ ## Affected Modules
12
+
13
+ ## Storage Impact
14
+
15
+ ## Constraints
16
+
17
+ ## Risks
18
+
19
+ ## Verification
@@ -0,0 +1,15 @@
1
+ # Spec: {Name}
2
+
3
+ ## Objectives
4
+
5
+ ## Functional Requirements
6
+
7
+ ## Non-functional Requirements
8
+
9
+ ## Interface Definitions
10
+
11
+ ## Data Definitions
12
+
13
+ ## Acceptance Criteria
14
+
15
+ ## Open Questions
@@ -0,0 +1,12 @@
1
+ # Tasks: {Name}
2
+
3
+ - [ ] Task 1
4
+ - Files:
5
+ - Behavior:
6
+ - Tests:
7
+ - Verification:
8
+ - [ ] Task 2
9
+ - Files:
10
+ - Behavior:
11
+ - Tests:
12
+ - Verification:
@@ -0,0 +1,13 @@
1
+ # Archive
2
+
3
+ This directory contains obsolete or historical documents.
4
+
5
+ Do not rely on archived documents for current decisions.
6
+
7
+ ## Naming
8
+
9
+ Prefix files with date:
10
+
11
+ ```text
12
+ docs/99-archive/YYYY-MM-DD-title.md
13
+ ```
package/docs/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # DSH Environment Manager Docs
2
+
3
+ This directory is the **project-level Harness Context Hub** for the DSH Environment Manager plugin.
4
+
5
+ It is used by humans and AI agents to understand project state, architecture, constraints, development standards, and operational procedures.
6
+
7
+ ## Reading Policy
8
+
9
+ Do not read every document blindly. Read documents based on task type.
10
+
11
+ ### Required for Every Non-trivial Change
12
+
13
+ 1. `AGENTS.md` at the repository root
14
+ 2. `docs/00-project/project-brief.md`
15
+ 3. `docs/00-project/current-state.md`
16
+ 4. `docs/02-harness/harness-standard.md`
17
+ 5. `docs/04-development/development-guide.md`
18
+
19
+ ### Architecture or Schema Changes
20
+
21
+ Also read:
22
+
23
+ 1. `docs/01-architecture/design.md`
24
+ 2. `docs/01-architecture/data-model.md`
25
+ 3. `docs/01-architecture/detailed-design.md`
26
+ 4. `docs/01-architecture/module-boundaries.md`
27
+ 5. `docs/01-architecture/storage-contract.md`
28
+
29
+ ### Environment Model Questions
30
+
31
+ Also read:
32
+
33
+ 1. `docs/01-architecture/decisions/ADR-0010-environment-plane-model.md`
34
+ 2. `docs/01-architecture/decisions/ADR-0011-k8s-node-execution-model.md`
35
+ 3. `docs/01-architecture/data-model.md` §3
36
+ 4. `docs/01-architecture/ui-design.md` §6.3
37
+
38
+ ### Runtime API Questions
39
+
40
+ Also read:
41
+
42
+ 1. `docs/01-architecture/api-verification.md`
43
+ 2. `docs/01-architecture/decisions/ADR-0009-client-host-http-transport.md`
44
+
45
+ ### Implementation Work
46
+
47
+ Also read:
48
+
49
+ 1. `docs/01-architecture/implementation-plan.md`
50
+ 2. `docs/01-architecture/ui-design.md` (Client changes only)
51
+ 3. `docs/02-harness/client-ui-integration.md` (sidebar/main slot changes only)
52
+
53
+ ### Tool Surface Changes
54
+
55
+ Also read:
56
+
57
+ 1. `docs/01-architecture/tool-contract.md`
58
+ 2. `docs/01-architecture/data-model.md`
59
+ 3. `docs/01-architecture/detailed-design.md` §11
60
+
61
+ ### Resolver / Rule Work
62
+
63
+ Also read:
64
+
65
+ 1. `docs/01-architecture/design.md` §6
66
+ 2. `docs/05-domain/rule-template.md`
67
+ 3. `docs/01-architecture/decisions/ADR-0005-layered-rule-resolution.md`
68
+
69
+ ### Router / Skill Binding Work
70
+
71
+ Also read:
72
+
73
+ 1. `docs/01-architecture/design.md` §7
74
+ 2. `docs/05-domain/operation-binding-template.md`
75
+ 3. `docs/01-architecture/decisions/ADR-0003-skill-router-over-search.md`
76
+
77
+ ### Security-Sensitive Work
78
+
79
+ Also read:
80
+
81
+ 1. `docs/01-architecture/security-model.md`
82
+ 2. `docs/06-operations/security-policy.md`
83
+
84
+ ### Deployment / Operations Work
85
+
86
+ Also read:
87
+
88
+ 1. `docs/06-operations/deployment-guide.md`
89
+ 2. `docs/06-operations/release.md`
90
+ 3. `docs/06-operations/security-policy.md`
91
+ 4. `docs/06-operations/troubleshooting.md`
92
+
93
+ ### OpenSpec Work
94
+
95
+ Also read:
96
+
97
+ 1. `docs/03-openspec/proposal-rule.md`
98
+ 2. `docs/03-openspec/design-rule.md`
99
+ 3. `docs/03-openspec/spec-rule.md`
100
+ 4. `docs/03-openspec/tasks-rule.md`
101
+
102
+ ## Hard Rules
103
+
104
+ - Durable registry data is YAML files under the plugin data directory.
105
+ - Registry data is never committed to Git.
106
+ - Credentials are references only; values never appear in registry files or tool output.
107
+ - Rule templates use interpolation only; no code execution.
108
+ - Production write operations and production-affecting management writes require approval.
109
+ - Conflicts, missing Skills and broken references fail loudly; nothing is chosen silently.
110
+ - Every completed change updates `docs/00-project/current-state.md`.
111
+
112
+ ## Directory Map
113
+
114
+ ```text
115
+ docs/
116
+ ├── 00-project/ # brief, current state, glossary, roadmap
117
+ ├── 01-architecture/ # design, data model, tools, storage, security, ADRs
118
+ ├── 02-harness/ # AI-assisted development harness standards
119
+ ├── 03-openspec/ # proposal/design/spec/tasks rules
120
+ ├── 04-development/ # coding, testing, local run, dependency rules
121
+ ├── 05-domain/ # environment/service/deployment/rule/binding templates
122
+ ├── 06-operations/ # deployment, release, security, troubleshooting
123
+ ├── 07-templates/ # reusable artifact templates
124
+ └── 99-archive/ # obsolete or historical docs
125
+ ```
126
+
127
+ ### Architecture Index
128
+
129
+ | Document | Purpose |
130
+ |---|---|
131
+ | `architecture-overview.md` | layers, components, request flows |
132
+ | `design.md` | V1 scope, algorithms, acceptance criteria |
133
+ | `detailed-design.md` | module contracts, algorithms, tool/HTTP specs, tests |
134
+ | `data-model.md` | record schemas and result types |
135
+ | `tool-contract.md` | model-facing tool inputs, outputs, errors |
136
+ | `storage-contract.md` | files, atomicity, sessions, migration |
137
+ | `module-boundaries.md` | module ownership and dependencies |
138
+ | `ui-design.md` | panels, transport, states, i18n, QA checklist |
139
+ | `security-model.md` | credential, policy and redaction controls |
140
+ | `api-verification.md` | verified DSH runtime facts and open probes |
141
+ | `implementation-plan.md` | ordered tasks, acceptance, cut line |
142
+ | `decisions/ADR-*.md` | accepted decisions (ADR-0009 = UI transport, ADR-0010 = environment/plane model, ADR-0011 = K8s node/access model) |
package/icon.svg ADDED
@@ -0,0 +1,4 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
2
+ <circle cx="32" cy="32" r="28" fill="#0ea5e9"/>
3
+ <path d="M22 20h20v8H22zm0 14h20v8H22z" fill="#ffffff"/>
4
+ </svg>
package/index.js ADDED
@@ -0,0 +1,31 @@
1
+ /**
2
+ * DSH Environment Manager - Host entry point.
3
+ *
4
+ * The implementation lives in `lib/` (compiled from `src/`); this shim keeps the
5
+ * bundle entry stable across builds. `lib/` is committed so a checkout, git
6
+ * install or npm tarball all have the same executable entry.
7
+ */
8
+
9
+ let implementation
10
+
11
+ try {
12
+ implementation = await import('./lib/index.js')
13
+ } catch (error) {
14
+ const missingLib =
15
+ error &&
16
+ error.code === 'ERR_MODULE_NOT_FOUND' &&
17
+ /lib[\\/]index\.js/.test(String(error.message))
18
+
19
+ if (missingLib) {
20
+ throw new Error(
21
+ '[dsh-env-manager-plugin] Missing build output: lib/index.js. ' +
22
+ 'Install the published `dsh-env-manager-plugin` package, or run ' +
23
+ '`npm install && npm run build` in the plugin checkout before installing it.',
24
+ { cause: error },
25
+ )
26
+ }
27
+
28
+ throw error
29
+ }
30
+
31
+ export const { name, inject, Config, apply } = implementation
@@ -0,0 +1,67 @@
1
+ import type { Actor, CredentialDirectory, Diagnostic, FindResult, GetResult, ListResult, MetaResult, OperationResolution, RecordKind, RemoveOptions, RemoveResult, ResolveRequest, RouteRequest, SaveOptions, SaveResult, ServiceContext, SessionContext, SkillDirectory, ValidationReport } from '../domain/types.js';
2
+ import type { Logger } from '../logger.js';
3
+ export declare const VERSION = "0.1.0";
4
+ export interface AppOptions {
5
+ dataDir: string;
6
+ maxRecords: number;
7
+ writePolicy: {
8
+ allowUiProductionWrites: boolean;
9
+ };
10
+ skills: SkillDirectory | null;
11
+ credentials: CredentialDirectory | null;
12
+ logger: Logger;
13
+ defaults?: {
14
+ environmentId?: string;
15
+ };
16
+ }
17
+ export interface SaveContext {
18
+ actor?: Actor;
19
+ }
20
+ export interface GetContextOptions {
21
+ actor?: Actor;
22
+ }
23
+ export interface ResolveOutcome {
24
+ context: ServiceContext;
25
+ warnings: Diagnostic[];
26
+ }
27
+ export declare class App {
28
+ private readonly options;
29
+ private readonly loader;
30
+ private readonly sessions;
31
+ constructor(options: AppOptions);
32
+ get dataDir(): string;
33
+ init(): Promise<void>;
34
+ private snapshot;
35
+ private counts;
36
+ private warnings;
37
+ meta(): Promise<MetaResult>;
38
+ list(kind: RecordKind): Promise<ListResult>;
39
+ get(kind: RecordKind, id: string): Promise<GetResult>;
40
+ find(query: string): Promise<FindResult>;
41
+ saveYaml(kind: RecordKind, yaml: string, options?: SaveOptions & SaveContext): Promise<SaveResult>;
42
+ save(kind: RecordKind, raw: unknown, options?: SaveOptions & SaveContext): Promise<SaveResult>;
43
+ remove(kind: RecordKind, id: string, actor: Actor, options?: RemoveOptions): Promise<RemoveResult>;
44
+ validate(): Promise<ValidationReport>;
45
+ /**
46
+ * Store one SSH/web credential in the DSH credential service and return only
47
+ * its reference. Registry YAML must never contain the value itself.
48
+ */
49
+ setCredential(ref: string, value: string): Promise<{
50
+ ref: string;
51
+ configured: boolean;
52
+ }>;
53
+ /** Remove a credential owned by this plugin; other namespaces are rejected. */
54
+ unsetCredential(ref: string): Promise<{
55
+ ref: string;
56
+ removed: true;
57
+ }>;
58
+ resolve(request: ResolveRequest): Promise<ResolveOutcome>;
59
+ route(request: RouteRequest): Promise<OperationResolution>;
60
+ getContext(sessionId: string): Promise<SessionContext>;
61
+ setContext(sessionId: string, environmentId: string | null): Promise<SessionContext>;
62
+ needsProductionApproval(kind: RecordKind, raw: unknown): Promise<boolean>;
63
+ private mapFor;
64
+ private selectDeployment;
65
+ private isProductionRecord;
66
+ private describeCredentials;
67
+ }