@huaweidevtools/aishell-dsh-deploy 0.0.35 → 0.0.37

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
@@ -30,8 +30,8 @@ from calling someone else's tool.
30
30
  ```
31
31
  apply()
32
32
  → opens one credentials store (the aishell-dsh-plugins keyring this whole set shares)
33
- → registers the 18 tools on ctx.tools
34
- → registers one Host route for the permission switch
33
+ → registers its tools on ctx.tools
34
+ → registers the Host routes for the permission switch and its posture
35
35
  ```
36
36
 
37
37
  A tool call runs in this process. There is no child process, no transport, and
@@ -51,9 +51,15 @@ to reload and nothing to restart.
51
51
 
52
52
  ## Read-only mode
53
53
 
54
- The switch is process state, read and written directly by
54
+ The switch belongs to one Session, read and written directly by
55
55
  `api/aishell/permission`. A switch takes effect before the next tool call
56
- starts, not after the one already running.
56
+ starts, not after the one already running. Two conversations open in one window
57
+ are two decisions: granting write access in one does not widen the other.
58
+
59
+ Every Session starts in the posture — read-only unless a deployment set
60
+ `POST api/aishell/permission/default`. Each Session is pinned to the posture in
61
+ force when it was created, so that setting decides what the next conversation
62
+ starts in and leaves existing ones as they are.
57
63
 
58
64
  It is enforced in two places, because the tools reach the cloud two ways:
59
65
 
@@ -61,13 +67,23 @@ It is enforced in two places, because the tools reach the cloud two ways:
61
67
  `openapi_request`'s arbitrary method and URL are covered without each tool
62
68
  having to remember to ask. `GET` and `HEAD` are queries; anything else is
63
69
  looked up in a table of known read operations, and an unknown one is denied.
70
+ The funnel learns which Session it is gating from the call that is awaiting
71
+ it (`src/permission/call-context.ts`), so no helper between a tool and the
72
+ client has to pass one along.
64
73
  - **The tool registry.** `terraform_apply` and `terraform_destroy` never touch
65
74
  the HTTP client, so they are refused by name.
66
75
 
67
76
  The mode is out-of-band: it appears in no tool description, no tool result, and
68
- nothing in the model's context can change it. While read-only, the model gets a
69
- prompt context explaining the posture, so it works as a reviewer — producing the
70
- plan and the exact commands — rather than stopping early.
77
+ nothing in the model's context can change it. While a Session is read-only, its
78
+ model gets a prompt context explaining the posture, so it works as a reviewer —
79
+ producing the plan and the exact commands — rather than stopping early.
80
+
81
+ | Route | Body | Answers |
82
+ |---|---|---|
83
+ | `GET api/aishell/permission?session=<id>` | — | that Session's mode |
84
+ | `POST api/aishell/permission` | `{ session, mode }` | the applied change |
85
+ | `GET api/aishell/permission/default` | — | the posture new Sessions start in |
86
+ | `POST api/aishell/permission/default` | `{ mode }` | the posture it replaced |
71
87
 
72
88
  ## Config
73
89
 
@@ -141,7 +157,8 @@ src/
141
157
  credentials.ts store read + account identity
142
158
  permission.ts the wire vocabulary the browser sends
143
159
  permission/
144
- mode.ts the switch
160
+ mode.ts the switch, one mode per Session
161
+ call-context.ts the Session a call belongs to, for the funnel
145
162
  gate.ts enforcement
146
163
  registry.ts the query table
147
164
  permission-route.ts the Host route the chip calls
@@ -160,7 +177,7 @@ src/
160
177
  rating-map.ts terraform type → BSS service + spec/capacity attributes
161
178
  bss.ts the rating inquiry, including its usage-unit self-correction
162
179
  tools/pricing.ts plan → quote → cost.json
163
- tools/ the 18 tools
180
+ tools/ one module per registered tool
164
181
  existing.ts cloud resources the design reuses
165
182
  gates/ pre-run safety gates (design, cost, credential, env)
166
183
  schemas/ the cost schema