@huaweidevtools/aishell-dsh-deploy 0.0.36 → 0.0.38

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,21 @@ 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 the deployment declares
60
+ `startupPosture: read_write` in its profile patch, or a running process overrides
61
+ it with `POST api/aishell/permission/default`. Each Session is pinned to the
62
+ posture in force when it starts, so a posture change reaches the next
63
+ conversation to begin and leaves one already running as it is.
64
+
65
+ `startupPosture` is a deployment statement, read at every start. The route's
66
+ override is a running decision and ends with the process. A permanent change
67
+ belongs in the patch, which is version-controlled and reviewed with the
68
+ profile.
57
69
 
58
70
  It is enforced in two places, because the tools reach the cloud two ways:
59
71
 
@@ -61,13 +73,23 @@ It is enforced in two places, because the tools reach the cloud two ways:
61
73
  `openapi_request`'s arbitrary method and URL are covered without each tool
62
74
  having to remember to ask. `GET` and `HEAD` are queries; anything else is
63
75
  looked up in a table of known read operations, and an unknown one is denied.
76
+ The funnel learns which Session it is gating from the call that is awaiting
77
+ it (`src/permission/call-context.ts`), so no helper between a tool and the
78
+ client has to pass one along.
64
79
  - **The tool registry.** `terraform_apply` and `terraform_destroy` never touch
65
80
  the HTTP client, so they are refused by name.
66
81
 
67
82
  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.
83
+ nothing in the model's context can change it. While a Session is read-only, its
84
+ model gets a prompt context explaining the posture, so it works as a reviewer —
85
+ producing the plan and the exact commands — rather than stopping early.
86
+
87
+ | Route | Body | Answers |
88
+ |---|---|---|
89
+ | `GET api/aishell/permission?session=<id>` | — | that Session's mode |
90
+ | `POST api/aishell/permission` | `{ session, mode }` | the applied change |
91
+ | `GET api/aishell/permission/default` | — | the posture new Sessions start in |
92
+ | `POST api/aishell/permission/default` | `{ mode }` | the posture it replaced |
71
93
 
72
94
  ## Config
73
95
 
@@ -75,6 +97,7 @@ plan and the exact commands — rather than stopping early.
75
97
  |---|---|---|---|
76
98
  | `defaultRegion` | `string?` | unset | A fallback for a plan that names no region, and the `HW_REGION_NAME` terraform runs under. Unset means each resource's provider block decides. |
77
99
  | `toolCallTimeoutMs` | `number?` | 10 minutes | Per-call budget. A real `terraform_apply` runs for minutes, so the default is above that rather than the seconds a lookup tool would want. |
100
+ | `startupPosture` | `read_only` \| `read_write` | `read_only` | What new Sessions start in. Read-only unless the deployment says otherwise, because a conversation may look at the account before anyone has decided it may change it. |
78
101
 
79
102
  There is no built-in region. A region belongs to each resource, read from the
80
103
  provider block its plan names, so a deployment-wide default would have to be
@@ -141,7 +164,8 @@ src/
141
164
  credentials.ts store read + account identity
142
165
  permission.ts the wire vocabulary the browser sends
143
166
  permission/
144
- mode.ts the switch
167
+ mode.ts the switch, one mode per Session
168
+ call-context.ts the Session a call belongs to, for the funnel
145
169
  gate.ts enforcement
146
170
  registry.ts the query table
147
171
  permission-route.ts the Host route the chip calls
@@ -160,7 +184,7 @@ src/
160
184
  rating-map.ts terraform type → BSS service + spec/capacity attributes
161
185
  bss.ts the rating inquiry, including its usage-unit self-correction
162
186
  tools/pricing.ts plan → quote → cost.json
163
- tools/ the 18 tools
187
+ tools/ one module per registered tool
164
188
  existing.ts cloud resources the design reuses
165
189
  gates/ pre-run safety gates (design, cost, credential, env)
166
190
  schemas/ the cost schema
package/cordis.patch.yml CHANGED
@@ -10,6 +10,12 @@
10
10
  # two never disagree.
11
11
  # - `toolCallTimeoutMs` is 10 minutes: terraform_apply of a real network takes
12
12
  # minutes, and a shorter budget reports a timeout on work still in progress.
13
+ # - `startupPosture` is `read_only`: a new Session may look at the account
14
+ # before anyone has decided it may change it. Set it to `read_write` in a
15
+ # deployment where every new conversation is expected to make changes.
16
+ # It decides what every Session begins with — a new one, or one the host
17
+ # restores at start — so changing it changes what a reopened conversation
18
+ # starts in. Within one run, a Session keeps the answer it was given.
13
19
  #
14
20
  # The credential store is the shared `aishell-dsh` one, read per call.
15
21
  #