dsh-env-manager-plugin 0.1.0 → 0.1.2

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 (81) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +274 -250
  3. package/client.js +2581 -2581
  4. package/cordis.patch.yml +4 -4
  5. package/docs/00-project/current-state.md +32 -6
  6. package/docs/00-project/glossary.md +215 -215
  7. package/docs/00-project/project-brief.md +114 -114
  8. package/docs/00-project/roadmap.md +89 -89
  9. package/docs/01-architecture/DSH_Environment_Service_Memory_Skill_Brainstorm.md +493 -493
  10. package/docs/01-architecture/api-verification.md +416 -416
  11. package/docs/01-architecture/architecture-overview.md +222 -222
  12. package/docs/01-architecture/data-model.md +930 -930
  13. package/docs/01-architecture/decisions/ADR-0001-plugin-as-bundle.md +29 -29
  14. package/docs/01-architecture/decisions/ADR-0002-file-based-storage.md +25 -25
  15. package/docs/01-architecture/decisions/ADR-0003-skill-router-over-search.md +25 -25
  16. package/docs/01-architecture/decisions/ADR-0004-typescript-host-js-client.md +31 -31
  17. package/docs/01-architecture/decisions/ADR-0005-layered-rule-resolution.md +36 -36
  18. package/docs/01-architecture/decisions/ADR-0006-credentials-as-references.md +30 -30
  19. package/docs/01-architecture/decisions/ADR-0007-session-scoped-default-environment.md +28 -28
  20. package/docs/01-architecture/decisions/ADR-0008-memory-bridge-not-second-store.md +31 -31
  21. package/docs/01-architecture/decisions/ADR-0009-client-host-http-transport.md +87 -87
  22. package/docs/01-architecture/decisions/ADR-0010-environment-plane-model.md +87 -87
  23. package/docs/01-architecture/decisions/ADR-0011-k8s-node-execution-model.md +92 -92
  24. package/docs/01-architecture/design.md +666 -666
  25. package/docs/01-architecture/detailed-design.md +961 -961
  26. package/docs/01-architecture/implementation-plan.md +323 -323
  27. package/docs/01-architecture/module-boundaries.md +306 -306
  28. package/docs/01-architecture/security-model.md +227 -227
  29. package/docs/01-architecture/storage-contract.md +224 -224
  30. package/docs/01-architecture/tool-contract.md +438 -438
  31. package/docs/01-architecture/ui-design.md +587 -587
  32. package/docs/02-harness/agent-behavior.md +36 -36
  33. package/docs/02-harness/change-snapshot-policy.md +29 -29
  34. package/docs/02-harness/client-ui-integration.md +110 -110
  35. package/docs/02-harness/context-policy.md +43 -43
  36. package/docs/02-harness/harness-standard.md +91 -91
  37. package/docs/02-harness/task-execution-policy.md +26 -26
  38. package/docs/02-harness/verification-policy.md +97 -97
  39. package/docs/03-openspec/archive-rule.md +25 -25
  40. package/docs/03-openspec/bugfix-rule.md +30 -30
  41. package/docs/03-openspec/design-rule.md +33 -33
  42. package/docs/03-openspec/openspec-usage-guide.md +31 -31
  43. package/docs/03-openspec/proposal-rule.md +70 -70
  44. package/docs/03-openspec/spec-rule.md +33 -33
  45. package/docs/03-openspec/tasks-rule.md +31 -31
  46. package/docs/04-development/coding-style.md +67 -67
  47. package/docs/04-development/dependency-policy.md +43 -43
  48. package/docs/04-development/development-guide.md +85 -85
  49. package/docs/04-development/directory-convention.md +105 -105
  50. package/docs/04-development/local-run-guide.md +61 -55
  51. package/docs/04-development/testing-guide.md +102 -102
  52. package/docs/05-domain/deployment-template.md +76 -76
  53. package/docs/05-domain/environment-template.md +165 -165
  54. package/docs/05-domain/operation-binding-template.md +55 -55
  55. package/docs/05-domain/operation-record-template.md +55 -55
  56. package/docs/05-domain/prompt-template.md +90 -90
  57. package/docs/05-domain/rule-template.md +73 -73
  58. package/docs/05-domain/service-template.md +39 -39
  59. package/docs/06-operations/deployment-guide.md +54 -54
  60. package/docs/06-operations/release.md +198 -188
  61. package/docs/06-operations/security-policy.md +53 -53
  62. package/docs/06-operations/troubleshooting.md +141 -91
  63. package/docs/07-templates/adr-template.md +21 -21
  64. package/docs/07-templates/bugfix-template.md +11 -11
  65. package/docs/07-templates/case-template.md +15 -15
  66. package/docs/07-templates/design-template.md +29 -29
  67. package/docs/07-templates/proposal-template.md +19 -19
  68. package/docs/07-templates/spec-template.md +15 -15
  69. package/docs/07-templates/tasks-template.md +12 -12
  70. package/docs/99-archive/README.md +13 -13
  71. package/docs/README.md +142 -142
  72. package/icon.svg +4 -4
  73. package/index.js +31 -8
  74. package/lib/app/app.d.ts +1 -1
  75. package/lib/app/app.js +4 -1
  76. package/lib/app/app.js.map +1 -1
  77. package/lib/skill.js +37 -37
  78. package/locale/en.json +6 -6
  79. package/locale/zh.json +6 -6
  80. package/package.json +101 -99
  81. package/scripts/repair-profile.mjs +141 -0
@@ -1,90 +1,90 @@
1
- # Prompt Template
2
-
3
- Templates for presenting tool results to an Agent. Keep them compact; do not dump the whole registry.
4
-
5
- ## Service Context
6
-
7
- ```markdown
8
- # Service Context
9
-
10
- Environment: {environmentId} ({environmentName}, {environmentCategory})
11
- Service: {serviceId} ({serviceName})
12
- Deployment: {deploymentId} ({runtimeMode})
13
- Status: {status}
14
-
15
- ## Source
16
-
17
- - Git: {source.gitUrl} ({source.defaultBranch})
18
- - Module: {source.modulePath}
19
- - Artifact: {artifact.name} ({artifact.path})
20
-
21
- ## Location
22
-
23
- {locationSummary}
24
-
25
- ## Log source
26
-
27
- {logSourceSummary}
28
-
29
- ## Resolved paths
30
-
31
- | Field | Value | Defined by | Inputs |
32
- |---|---|---|---|
33
- {pathRows}
34
-
35
- ## Class location
36
-
37
- {classLocationSummary}
38
-
39
- ## Credentials
40
-
41
- - {ref} — configured: {configured} (source: {source})
42
-
43
- ## Diagnostics
44
-
45
- {diagnostics}
46
- ```
47
-
48
- Rules:
49
-
50
- - Mark derived values as derived; do not imply they exist.
51
- - Show provenance for every path, because that is how users debug overrides.
52
- - Never include credential values.
53
-
54
- ## Operation Resolution
55
-
56
- ```markdown
57
- # Operation Resolution
58
-
59
- Operation: {operation}
60
- Context: {environmentId} / {serviceId} / {deploymentId}
61
- Binding: {matchedBindingId} (level: {matchLevel})
62
- Skill: {skill.name} (available: {skill.available})
63
- Policy: requiresApproval={policy.requiresApproval}, allowProduction={policy.allowProduction}
64
-
65
- ## Parameters
66
-
67
- - {key}: {value}
68
-
69
- ## Diagnostics
70
-
71
- {diagnostics}
72
- ```
73
-
74
- Rules:
75
-
76
- - If the result is a conflict, list every candidate binding and its level.
77
- - If the Skill is unavailable, state why and do not suggest an alternative Skill.
78
- - Never present a routing result as permission to execute.
79
-
80
- ## Environment Summary
81
-
82
- ```markdown
83
- # Environments
84
-
85
- | Environment | Category | Hosts | Clusters | Services |
86
- |---|---|---|---|---|
87
- {rows}
88
- ```
89
-
90
- Keep list output under 50 rows; point the reader at `env_get` for detail.
1
+ # Prompt Template
2
+
3
+ Templates for presenting tool results to an Agent. Keep them compact; do not dump the whole registry.
4
+
5
+ ## Service Context
6
+
7
+ ```markdown
8
+ # Service Context
9
+
10
+ Environment: {environmentId} ({environmentName}, {environmentCategory})
11
+ Service: {serviceId} ({serviceName})
12
+ Deployment: {deploymentId} ({runtimeMode})
13
+ Status: {status}
14
+
15
+ ## Source
16
+
17
+ - Git: {source.gitUrl} ({source.defaultBranch})
18
+ - Module: {source.modulePath}
19
+ - Artifact: {artifact.name} ({artifact.path})
20
+
21
+ ## Location
22
+
23
+ {locationSummary}
24
+
25
+ ## Log source
26
+
27
+ {logSourceSummary}
28
+
29
+ ## Resolved paths
30
+
31
+ | Field | Value | Defined by | Inputs |
32
+ |---|---|---|---|
33
+ {pathRows}
34
+
35
+ ## Class location
36
+
37
+ {classLocationSummary}
38
+
39
+ ## Credentials
40
+
41
+ - {ref} — configured: {configured} (source: {source})
42
+
43
+ ## Diagnostics
44
+
45
+ {diagnostics}
46
+ ```
47
+
48
+ Rules:
49
+
50
+ - Mark derived values as derived; do not imply they exist.
51
+ - Show provenance for every path, because that is how users debug overrides.
52
+ - Never include credential values.
53
+
54
+ ## Operation Resolution
55
+
56
+ ```markdown
57
+ # Operation Resolution
58
+
59
+ Operation: {operation}
60
+ Context: {environmentId} / {serviceId} / {deploymentId}
61
+ Binding: {matchedBindingId} (level: {matchLevel})
62
+ Skill: {skill.name} (available: {skill.available})
63
+ Policy: requiresApproval={policy.requiresApproval}, allowProduction={policy.allowProduction}
64
+
65
+ ## Parameters
66
+
67
+ - {key}: {value}
68
+
69
+ ## Diagnostics
70
+
71
+ {diagnostics}
72
+ ```
73
+
74
+ Rules:
75
+
76
+ - If the result is a conflict, list every candidate binding and its level.
77
+ - If the Skill is unavailable, state why and do not suggest an alternative Skill.
78
+ - Never present a routing result as permission to execute.
79
+
80
+ ## Environment Summary
81
+
82
+ ```markdown
83
+ # Environments
84
+
85
+ | Environment | Category | Hosts | Clusters | Services |
86
+ |---|---|---|---|---|
87
+ {rows}
88
+ ```
89
+
90
+ Keep list output under 50 rows; point the reader at `env_get` for detail.
@@ -1,73 +1,73 @@
1
- # Rule Profile Template
2
-
3
- Copy into `<dataDir>/rules/<id>.yaml`.
4
-
5
- ```yaml
6
- id: java-common
7
- schemaVersion: 1
8
- description: Common Java service paths, log sources and class locations
9
-
10
- variables:
11
- installRoot: /opt/company/services
12
- timezone: Asia/Shanghai
13
-
14
- paths:
15
- serviceHome: ${installRoot}/${service.id}
16
- jar: ${paths.serviceHome}/lib/${service.artifact.name}
17
- logDir: ${paths.serviceHome}/logs
18
- applicationLog: ${paths.logDir}/${service.id}.log
19
- configDir: ${paths.serviceHome}/config
20
-
21
- logSources:
22
- native:
23
- kind: file
24
- path: ${paths.applicationLog}
25
- docker:
26
- kind: container-stdout
27
- container: ${deployment.location.containerName}
28
- kubernetes:
29
- kind: pod-logs
30
- namespace: ${deployment.location.namespace}
31
- workload: ${deployment.location.workload.name}
32
-
33
- classLocations:
34
- native:
35
- kind: deployed-dir
36
- path: ${paths.serviceHome}/classes
37
- kubernetes:
38
- kind: jar-entry
39
- path: ${paths.jar}
40
- entryPrefix: com/company/aico
41
-
42
- createdAt: 2026-11-01T03:00:00.000Z
43
- updatedAt: 2026-11-01T03:00:00.000Z
44
- ```
45
-
46
- ## Template syntax
47
-
48
- Allowed:
49
-
50
- ```text
51
- ${installRoot}
52
- ${paths.serviceHome}
53
- ${service.id}
54
- ${deployment.location.namespace}
55
- ```
56
-
57
- Forbidden:
58
-
59
- - function calls, arithmetic, conditionals
60
- - environment variable access
61
- - shell or command substitution
62
- - JavaScript
63
-
64
- ## Notes
65
-
66
- - A path may reference another path; cycles are errors.
67
- - Undefined references are errors, not empty strings.
68
- - The only valid form is `${identifier(.identifier)*}`, capped at 2048 characters;
69
- anything else (missing brace, operators, spaces) is `RULE_TEMPLATE_INVALID`.
70
- - Resolved paths containing `..` are rejected.
71
- - `classLocations` distinguishes build output, deployed directories and jar entries.
72
- - Only the deployment's `runtimeMode` entry is resolved by `env_resolve`.
73
- - Overrides: environment `ruleOverrides`, then deployment `variables` and `ruleOverrides`.
1
+ # Rule Profile Template
2
+
3
+ Copy into `<dataDir>/rules/<id>.yaml`.
4
+
5
+ ```yaml
6
+ id: java-common
7
+ schemaVersion: 1
8
+ description: Common Java service paths, log sources and class locations
9
+
10
+ variables:
11
+ installRoot: /opt/company/services
12
+ timezone: Asia/Shanghai
13
+
14
+ paths:
15
+ serviceHome: ${installRoot}/${service.id}
16
+ jar: ${paths.serviceHome}/lib/${service.artifact.name}
17
+ logDir: ${paths.serviceHome}/logs
18
+ applicationLog: ${paths.logDir}/${service.id}.log
19
+ configDir: ${paths.serviceHome}/config
20
+
21
+ logSources:
22
+ native:
23
+ kind: file
24
+ path: ${paths.applicationLog}
25
+ docker:
26
+ kind: container-stdout
27
+ container: ${deployment.location.containerName}
28
+ kubernetes:
29
+ kind: pod-logs
30
+ namespace: ${deployment.location.namespace}
31
+ workload: ${deployment.location.workload.name}
32
+
33
+ classLocations:
34
+ native:
35
+ kind: deployed-dir
36
+ path: ${paths.serviceHome}/classes
37
+ kubernetes:
38
+ kind: jar-entry
39
+ path: ${paths.jar}
40
+ entryPrefix: com/company/aico
41
+
42
+ createdAt: 2026-11-01T03:00:00.000Z
43
+ updatedAt: 2026-11-01T03:00:00.000Z
44
+ ```
45
+
46
+ ## Template syntax
47
+
48
+ Allowed:
49
+
50
+ ```text
51
+ ${installRoot}
52
+ ${paths.serviceHome}
53
+ ${service.id}
54
+ ${deployment.location.namespace}
55
+ ```
56
+
57
+ Forbidden:
58
+
59
+ - function calls, arithmetic, conditionals
60
+ - environment variable access
61
+ - shell or command substitution
62
+ - JavaScript
63
+
64
+ ## Notes
65
+
66
+ - A path may reference another path; cycles are errors.
67
+ - Undefined references are errors, not empty strings.
68
+ - The only valid form is `${identifier(.identifier)*}`, capped at 2048 characters;
69
+ anything else (missing brace, operators, spaces) is `RULE_TEMPLATE_INVALID`.
70
+ - Resolved paths containing `..` are rejected.
71
+ - `classLocations` distinguishes build output, deployed directories and jar entries.
72
+ - Only the deployment's `runtimeMode` entry is resolved by `env_resolve`.
73
+ - Overrides: environment `ruleOverrides`, then deployment `variables` and `ruleOverrides`.
@@ -1,39 +1,39 @@
1
- # Service Template
2
-
3
- Copy into `<dataDir>/services/<id>.yaml` and replace the example values.
4
-
5
- ```yaml
6
- id: aicoservice
7
- schemaVersion: 1
8
- name: Aico Service
9
- aliases: [aicoservice]
10
- category: backend
11
- description: Core AI coordination service
12
-
13
- git:
14
- url: https://git.example.internal/team/aicoservice.git
15
- defaultBranch: main
16
- modulePath: / # monorepo subpath, omit when not needed
17
-
18
- build:
19
- tool: maven # maven | gradle | npm | custom
20
- command: mvn -DskipTests package
21
-
22
- artifact:
23
- name: aicoservice.jar
24
- path: ${paths.serviceHome}/lib/${service.artifact.name}
25
-
26
- deployModes: [native, docker, kubernetes]
27
- ruleProfileRefs: [java-common, company-default] # order matters; later wins
28
-
29
- createdAt: 2026-11-01T03:00:00.000Z
30
- updatedAt: 2026-11-01T03:00:00.000Z
31
- ```
32
-
33
- ## Notes
34
-
35
- - Services are environment-independent. Placement belongs in a deployment binding.
36
- - `ruleProfileRefs` are applied in order; when two profiles define the same field, the later one wins.
37
- - `deployModes` must include every runtime mode used by its deployment bindings.
38
- - `artifact.name` is commonly interpolated by rule profiles as `${service.artifact.name}`.
39
- - No credentials here. A service-level credential is not modelled in V1.
1
+ # Service Template
2
+
3
+ Copy into `<dataDir>/services/<id>.yaml` and replace the example values.
4
+
5
+ ```yaml
6
+ id: aicoservice
7
+ schemaVersion: 1
8
+ name: Aico Service
9
+ aliases: [aicoservice]
10
+ category: backend
11
+ description: Core AI coordination service
12
+
13
+ git:
14
+ url: https://git.example.internal/team/aicoservice.git
15
+ defaultBranch: main
16
+ modulePath: / # monorepo subpath, omit when not needed
17
+
18
+ build:
19
+ tool: maven # maven | gradle | npm | custom
20
+ command: mvn -DskipTests package
21
+
22
+ artifact:
23
+ name: aicoservice.jar
24
+ path: ${paths.serviceHome}/lib/${service.artifact.name}
25
+
26
+ deployModes: [native, docker, kubernetes]
27
+ ruleProfileRefs: [java-common, company-default] # order matters; later wins
28
+
29
+ createdAt: 2026-11-01T03:00:00.000Z
30
+ updatedAt: 2026-11-01T03:00:00.000Z
31
+ ```
32
+
33
+ ## Notes
34
+
35
+ - Services are environment-independent. Placement belongs in a deployment binding.
36
+ - `ruleProfileRefs` are applied in order; when two profiles define the same field, the later one wins.
37
+ - `deployModes` must include every runtime mode used by its deployment bindings.
38
+ - `artifact.name` is commonly interpolated by rule profiles as `${service.artifact.name}`.
39
+ - No credentials here. A service-level credential is not modelled in V1.
@@ -1,54 +1,54 @@
1
- # Deployment Guide
2
-
3
- ## Install as a Local Bundle
4
-
5
- In a DSH session, call the `plugin_manager` tool:
6
-
7
- ```text
8
- action: install_bundle
9
- target: <absolute path to this repository>
10
- ```
11
-
12
- Restart DSH if needed.
13
-
14
- ## Verify
15
-
16
- 1. Ask `plugin_manager` for `action: list_bundles` and confirm the bundle appears.
17
- 2. Confirm it is active, not `overridden` or `restart-required`.
18
- 3. Call `env_list` from the Agent; a fresh install returns an empty list.
19
- 4. Open the **Environment Manager** entry in the sidebar and confirm the Overview
20
- counts render.
21
- 5. Optional transport check:
22
-
23
- ```bash
24
- curl -s -X POST http://127.0.0.1:<port>/env-manager/api \
25
- -H 'content-type: application/json' \
26
- -H 'x-env-manager-request: 1' \
27
- -d '{"op":"meta"}'
28
- ```
29
-
30
- Without the header the route returns 403; that is the expected control.
31
-
32
- ## Upgrade
33
-
34
- 1. Pull the latest changes.
35
- 2. `npm install && npm run build`.
36
- 3. Reinstall the bundle with `plugin_manager`.
37
- 4. Restart DSH so the Host module generation is fresh.
38
- 5. Run `env_validate` and review diagnostics.
39
-
40
- Registry data is untouched by an upgrade. A `schemaVersion` change requires a migration; V1 has none.
41
-
42
- ## Remove
43
-
44
- Call `plugin_manager` with `action: remove_bundle` and `target: dsh-env-manager-plugin`.
45
-
46
- Registry data under `dataDir` is not deleted. Back it up if you may reinstall later.
47
-
48
- ## Rollback
49
-
50
- 1. Reinstall the previous checkout.
51
- 2. Restart DSH.
52
- 3. Restore `dataDir` from the backup if the previous version wrote incompatible records.
53
-
54
- V1 accepts only `schemaVersion: 1`; records written by an unknown version are skipped with a warning rather than corrupted.
1
+ # Deployment Guide
2
+
3
+ ## Install as a Local Bundle
4
+
5
+ In a DSH session, call the `plugin_manager` tool:
6
+
7
+ ```text
8
+ action: install_bundle
9
+ target: <absolute path to this repository>
10
+ ```
11
+
12
+ Restart DSH if needed.
13
+
14
+ ## Verify
15
+
16
+ 1. Ask `plugin_manager` for `action: list_bundles` and confirm the bundle appears.
17
+ 2. Confirm it is active, not `overridden` or `restart-required`.
18
+ 3. Call `env_list` from the Agent; a fresh install returns an empty list.
19
+ 4. Open the **Environment Manager** entry in the sidebar and confirm the Overview
20
+ counts render.
21
+ 5. Optional transport check:
22
+
23
+ ```bash
24
+ curl -s -X POST http://127.0.0.1:<port>/env-manager/api \
25
+ -H 'content-type: application/json' \
26
+ -H 'x-env-manager-request: 1' \
27
+ -d '{"op":"meta"}'
28
+ ```
29
+
30
+ Without the header the route returns 403; that is the expected control.
31
+
32
+ ## Upgrade
33
+
34
+ 1. Pull the latest changes.
35
+ 2. `npm install && npm run build`.
36
+ 3. Reinstall the bundle with `plugin_manager`.
37
+ 4. Restart DSH so the Host module generation is fresh.
38
+ 5. Run `env_validate` and review diagnostics.
39
+
40
+ Registry data is untouched by an upgrade. A `schemaVersion` change requires a migration; V1 has none.
41
+
42
+ ## Remove
43
+
44
+ Call `plugin_manager` with `action: remove_bundle` and `target: dsh-env-manager-plugin`.
45
+
46
+ Registry data under `dataDir` is not deleted. Back it up if you may reinstall later.
47
+
48
+ ## Rollback
49
+
50
+ 1. Reinstall the previous checkout.
51
+ 2. Restart DSH.
52
+ 3. Restore `dataDir` from the backup if the previous version wrote incompatible records.
53
+
54
+ V1 accepts only `schemaVersion: 1`; records written by an unknown version are skipped with a warning rather than corrupted.