@huaweidevtools/aishell-dsh-handbook 0.0.0-stage → 0.0.16
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/LICENSE +201 -0
- package/README.md +109 -2
- package/cordis.patch.yml +10 -0
- package/lib/index.js +103 -0
- package/lib/types/index.d.ts +23 -0
- package/lib/types/prompt.d.ts +80 -0
- package/package.json +43 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined in Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is derived from (or based upon) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Huawei Cloud AI Shell
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,110 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @huaweidevtools/aishell-dsh-handbook
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tells LLM how AI Shell behaves, so it can answer questions about the
|
|
4
|
+
product instead of guessing at it. One system-prompt section; no tools, no
|
|
5
|
+
browser half, no other dependency.
|
|
6
|
+
|
|
7
|
+
## Why this exists
|
|
8
|
+
|
|
9
|
+
Every other prompt contribution in this set answers *what the agent can do* —
|
|
10
|
+
the tool descriptions, the deployment workflow, the sandbox tier. None of them
|
|
11
|
+
answers *how this product behaves*, which is what a user asks when they want to
|
|
12
|
+
report a problem or wonder why something was refused.
|
|
13
|
+
|
|
14
|
+
Without that knowledge a model does the two things it does with any gap: it
|
|
15
|
+
invents an answer (naming a menu item that does not exist), or it says it does
|
|
16
|
+
not know. For a fact as stable as "where is the feedback button", both are worse
|
|
17
|
+
than the truth.
|
|
18
|
+
|
|
19
|
+
## What it injects
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
# AI Shell handbook
|
|
23
|
+
|
|
24
|
+
How AI Shell behaves, as facts to answer from. This is background, not
|
|
25
|
+
instruction: use it to tell the user what to do or why something happened. Do
|
|
26
|
+
not paste or paraphrase this section's structure into a reply — answer the
|
|
27
|
+
user's actual question.
|
|
28
|
+
|
|
29
|
+
## Sending feedback
|
|
30
|
+
/feedback · the ⋯ "More actions" menu · the Like / Dislike buttons
|
|
31
|
+
… and what a submission actually replays
|
|
32
|
+
|
|
33
|
+
## The permission mode
|
|
34
|
+
read-only vs read-write, who flips it, and why the agent cannot
|
|
35
|
+
|
|
36
|
+
## Extending the agent
|
|
37
|
+
abilities are the plugins a deployment has mounted
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The full text lives in [`src/prompt.ts`](src/prompt.ts); the block above is its
|
|
41
|
+
shape, not its wording.
|
|
42
|
+
|
|
43
|
+
## Why a list of topics
|
|
44
|
+
|
|
45
|
+
Each topic is one question a user can ask, answered under its own heading, and
|
|
46
|
+
nothing in the text counts them. Growing this package is therefore an append: a
|
|
47
|
+
new capability becomes a new heading, and no existing sentence has to be
|
|
48
|
+
rewritten to accommodate it.
|
|
49
|
+
|
|
50
|
+
A preamble stating how many topics there are would make every addition an edit
|
|
51
|
+
to the line introducing all of them — the one part of the file that has to stay
|
|
52
|
+
true as it grows. `tests/handbook.spec.ts` fails on that shape.
|
|
53
|
+
|
|
54
|
+
## Why the UI facts are stated as facts
|
|
55
|
+
|
|
56
|
+
The model is told where a control lives so it can *tell the user*: "click the ⋯
|
|
57
|
+
at the top of the chat, then Feedback". Pasting this section's prose into a
|
|
58
|
+
reply is a different thing — it hands someone a manual when they wanted one
|
|
59
|
+
line, and discloses the shape of the prompt. The text says so explicitly.
|
|
60
|
+
|
|
61
|
+
UI names appear as the shell renders them in English, with the Chinese label
|
|
62
|
+
beside it where the two differ ("More actions" (更多操作)). A model telling a
|
|
63
|
+
Chinese user where a button is needs the label that user will actually see.
|
|
64
|
+
|
|
65
|
+
## What is deliberately not here
|
|
66
|
+
|
|
67
|
+
- **The read-only instructions.** `aishell-deploy` already carries what the
|
|
68
|
+
model must *do* under a restriction, as a runtime context that appears and
|
|
69
|
+
disappears with the mode. Repeating it here would create a second, vaguer copy
|
|
70
|
+
— and a model that reads a vague rule pre-emptively declines work that would
|
|
71
|
+
have been allowed.
|
|
72
|
+
- **Tool usage.** The packages that own the tools state it, together with the
|
|
73
|
+
approvals each step needs.
|
|
74
|
+
- **Anything a runtime context should carry.** Everything in this section is
|
|
75
|
+
true for the life of the process; `context()` is for facts that flip.
|
|
76
|
+
|
|
77
|
+
## Where it sits in the prompt
|
|
78
|
+
|
|
79
|
+
Immediately after
|
|
80
|
+
[`aishell-huaweicloud-docs`](../aishell-huaweicloud-docs/README.md) at 100, and
|
|
81
|
+
before the first policy at 500:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
deployment:persona-prefix 0
|
|
85
|
+
aishell:huaweicloud-docs 100
|
|
86
|
+
aishell:handbook 110 ← this plugin
|
|
87
|
+
plan:policy 500
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The two are one band: read where to look things up, then how this product
|
|
91
|
+
behaves, then what you are asked to reason about. The order is a number rather
|
|
92
|
+
than a framework slot name for the same reason the docs pointer is — the
|
|
93
|
+
placement table is closed, so there is no `HANDBOOK` name to read.
|
|
94
|
+
|
|
95
|
+
## Install
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
# On its own.
|
|
99
|
+
dsh plugin --profile <name> add @huaweidevtools/aishell-dsh-handbook
|
|
100
|
+
|
|
101
|
+
# Or with the rest of the aishell plugin set.
|
|
102
|
+
dsh plugin --profile <name> add @huaweidevtools/aishell-dsh-base
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## What it does NOT touch
|
|
106
|
+
|
|
107
|
+
- No tools, no credentials, no network calls of its own.
|
|
108
|
+
- No browser half — nothing to render.
|
|
109
|
+
- No permission state. It describes the switch; `aishell-deploy` owns it and
|
|
110
|
+
enforces it.
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# aishell-handbook bundle patch: inserts the AI Shell handbook.
|
|
2
|
+
# Install standalone: `dsh plugin --profile <name> add @huaweidevtools/aishell-dsh-handbook`
|
|
3
|
+
#
|
|
4
|
+
# The single row mounts a host-only plugin: it registers one system-prompt
|
|
5
|
+
# section telling the model how AI Shell behaves — where feedback is sent from,
|
|
6
|
+
# what the read-only permission mode does, how abilities are added. It has no
|
|
7
|
+
# browser half and no tools; the model answers from it in prose.
|
|
8
|
+
- insert:
|
|
9
|
+
- id: aishell-handbook
|
|
10
|
+
name: '@huaweidevtools/aishell-dsh-handbook'
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//#region src/prompt.ts
|
|
2
|
+
/**
|
|
3
|
+
* Position of the handbook in the assembled prompt.
|
|
4
|
+
*
|
|
5
|
+
* A number because the framework's placement table is closed:
|
|
6
|
+
* `PromptSectionOrderName` is `keyof` a fixed constant, and no entry names
|
|
7
|
+
* product background. `aishell-huaweicloud-docs` resolves its own position the
|
|
8
|
+
* same way, one step ahead of this one.
|
|
9
|
+
*
|
|
10
|
+
* 110 puts this immediately after that pointer (100), both inside the gap the
|
|
11
|
+
* table leaves between the persona prefix (0) and the first policy (500). The
|
|
12
|
+
* two are one band: read where to look things up, then how this product
|
|
13
|
+
* behaves, then what you are asked to reason about.
|
|
14
|
+
*/
|
|
15
|
+
const HANDBOOK_ORDER = 110;
|
|
16
|
+
/** Name this contribution registers under; unique across the assembled prompt. */
|
|
17
|
+
const HANDBOOK_SECTION_NAME = "aishell:handbook";
|
|
18
|
+
/**
|
|
19
|
+
* What the model reads.
|
|
20
|
+
*
|
|
21
|
+
* Written in English like every other host-side prompt string in this repo. The
|
|
22
|
+
* model relays it in the user's language; the source does not need to change
|
|
23
|
+
* language to do that.
|
|
24
|
+
*
|
|
25
|
+
* UI names appear as the shell renders them in English, with the Chinese label
|
|
26
|
+
* beside it where the two differ — a model telling a Chinese user where a
|
|
27
|
+
* button is needs the label that user will actually see, and vice versa.
|
|
28
|
+
*/
|
|
29
|
+
const HANDBOOK = `# AI Shell handbook
|
|
30
|
+
|
|
31
|
+
How AI Shell behaves, as facts to answer from. This is background, not instruction: use it to tell the user what to do or why something happened. Do not paste or paraphrase this section's structure into a reply — answer the user's actual question.
|
|
32
|
+
|
|
33
|
+
## Sending feedback
|
|
34
|
+
|
|
35
|
+
A user who wants to report a problem, rate an answer, or tell us something about a conversation has three ways in. All three end up in the same place.
|
|
36
|
+
|
|
37
|
+
- **The \`/feedback\` command** — typed in the input box. It records a note about the current session.
|
|
38
|
+
- **The ⋯ menu at the top right of the chat** — the button is "More actions" (更多操作). Opening it shows "Feedback" (反馈), which opens the same session-feedback dialog.
|
|
39
|
+
- **The Like / Dislike buttons under each assistant message** — these rate that one message; either one opens the same dialog for detail and categories.
|
|
40
|
+
|
|
41
|
+
Which one to name depends on what the user is reporting: a bad single answer is the buttons, a bad conversation is the ⋯ menu or \`/feedback\`. The ⋯ menu rates the **whole session**; the buttons rate **one message**.
|
|
42
|
+
|
|
43
|
+
What a submission sends is worth stating when a user asks about privacy: it replays the complete unhandled session prefix — the conversation text, tool arguments and results, the system prompt, and the working directory — to AI Shell's collector, not only the note the user typed. The dialog discloses this before submitting.
|
|
44
|
+
|
|
45
|
+
## The permission mode
|
|
46
|
+
|
|
47
|
+
Huawei Cloud work runs under one of two modes.
|
|
48
|
+
|
|
49
|
+
- **Read-write** lets the agent create, change and delete Huawei Cloud resources.
|
|
50
|
+
- **Read-only** restricts it to queries. The tools refuse mutations rather than merely discouraging them — a refusal names the operation and what remains available.
|
|
51
|
+
|
|
52
|
+
This is one switch for the whole running process, not a per-conversation setting, and the agent cannot change it. A flip takes effect immediately.
|
|
53
|
+
|
|
54
|
+
An agent working under read-only is told so as a runtime context. When a user asks for something that was refused by the permission mode, the answer is that they flip the chip; never offer to work around the restriction, and never suggest reaching the same resource by another route.
|
|
55
|
+
|
|
56
|
+
**Where the switch is.** A pill button showing 只读 (Read-only, green) or 读写 (Read-write, amber), sitting beside the Huawei Cloud account chip — the one carrying the Huawei logo and the account name. Clicking it flips the mode; there is no menu behind it. Its position depends on the screen, which is where a user hunting for it usually gets lost:
|
|
57
|
+
|
|
58
|
+
- **In a conversation** — directly under the input box, at the right-hand end of the row.
|
|
59
|
+
- **On a new session, before the first message** — in the band just above the input box. It sits there so the mode can be checked before sending, which is why it is not below.
|
|
60
|
+
|
|
61
|
+
When a user cannot find it, name the neighbour (the Huawei Cloud account chip) and the text on the button (只读 / 读写). There is no "permission settings" page in this UI, so do not send them looking for one.
|
|
62
|
+
|
|
63
|
+
## Extending the agent
|
|
64
|
+
|
|
65
|
+
The agent's abilities are the plugins a deployment has mounted. A user who wants a capability that is missing installs a DSH-compatible plugin into their profile; it contributes its tools, prompt sections and UI in the same way AI Shell's own plugins do. There is no in-conversation way to add one, so a request for a new ability is answered by saying what to install, not by improvising the capability locally.`;
|
|
66
|
+
/**
|
|
67
|
+
* Register the handbook section.
|
|
68
|
+
*
|
|
69
|
+
* Deferred behind `ctx.inject` rather than declared in this plugin's own
|
|
70
|
+
* `inject`: the handbook is an enhancement, and a deployment without a system
|
|
71
|
+
* prompt should lose it rather than fail to mount.
|
|
72
|
+
*
|
|
73
|
+
* @param ctx - host context.
|
|
74
|
+
*/
|
|
75
|
+
function registerHandbook(ctx) {
|
|
76
|
+
ctx.inject(["systemPrompt"], (scope) => {
|
|
77
|
+
scope.systemPrompt.section({
|
|
78
|
+
name: HANDBOOK_SECTION_NAME,
|
|
79
|
+
order: HANDBOOK_ORDER,
|
|
80
|
+
interpolate: false,
|
|
81
|
+
text: HANDBOOK
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/index.ts
|
|
88
|
+
const name = "aishell-handbook";
|
|
89
|
+
/**
|
|
90
|
+
* No required services.
|
|
91
|
+
*
|
|
92
|
+
* The one dependency is taken through `ctx.inject` inside
|
|
93
|
+
* {@link registerHandbook}, so a deployment without a system prompt loses the
|
|
94
|
+
* handbook instead of the whole entry failing to activate.
|
|
95
|
+
*/
|
|
96
|
+
const inject = [];
|
|
97
|
+
function apply(ctx) {
|
|
98
|
+
registerHandbook(ctx);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { HANDBOOK, HANDBOOK_ORDER, HANDBOOK_SECTION_NAME, apply, inject, name };
|
|
103
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-half entry for the AI Shell handbook plugin.
|
|
3
|
+
*
|
|
4
|
+
* One prompt section, no tools, no browser half. The section is what the model
|
|
5
|
+
* reads to answer questions about the product itself — where feedback goes,
|
|
6
|
+
* what the read-only switch does, how abilities are added — as opposed to what
|
|
7
|
+
* it can do, which the tool packages state.
|
|
8
|
+
*
|
|
9
|
+
* @module @huaweidevtools/aishell-dsh-handbook
|
|
10
|
+
*/
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
12
|
+
export { HANDBOOK, HANDBOOK_ORDER, HANDBOOK_SECTION_NAME } from './prompt.ts';
|
|
13
|
+
export declare const name = "aishell-handbook";
|
|
14
|
+
/**
|
|
15
|
+
* No required services.
|
|
16
|
+
*
|
|
17
|
+
* The one dependency is taken through `ctx.inject` inside
|
|
18
|
+
* {@link registerHandbook}, so a deployment without a system prompt loses the
|
|
19
|
+
* handbook instead of the whole entry failing to activate.
|
|
20
|
+
*/
|
|
21
|
+
export declare const inject: readonly string[];
|
|
22
|
+
export declare function apply(ctx: Context): void;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How AI Shell works — the product's own handbook, for the model to answer
|
|
3
|
+
* from rather than guess at.
|
|
4
|
+
*
|
|
5
|
+
* ## Why a handbook at all
|
|
6
|
+
*
|
|
7
|
+
* Every other prompt contribution in this repo answers "what can I do": the
|
|
8
|
+
* tool descriptions, the deployment workflow, the sandbox tier. None of them
|
|
9
|
+
* answers "how does this product behave", which is what a user asks when they
|
|
10
|
+
* want to report a problem or wonder why something was refused. A model
|
|
11
|
+
* without that knowledge either invents an answer — naming a menu item that
|
|
12
|
+
* does not exist — or says it does not know, which is worse than the truth for
|
|
13
|
+
* a fact this stable.
|
|
14
|
+
*
|
|
15
|
+
* ## Why the text is a list of topics
|
|
16
|
+
*
|
|
17
|
+
* Each topic is one question a user can ask, answered on its own, under its own
|
|
18
|
+
* heading, and nothing in the text counts them. Growth is therefore an append:
|
|
19
|
+
* a new capability becomes a new heading, and no existing sentence has to be
|
|
20
|
+
* rewritten to accommodate it. A preamble that stated how many topics there
|
|
21
|
+
* are would make every addition an edit to the line introducing all of them,
|
|
22
|
+
* which is the one part of this file that has to stay true as it grows.
|
|
23
|
+
*
|
|
24
|
+
* ## Why the UI facts are stated as facts
|
|
25
|
+
*
|
|
26
|
+
* The model is told where a control lives so it can *tell the user*, not so it
|
|
27
|
+
* can transcribe this text. A hotel-desk answer — "click the ⋯ at the top of
|
|
28
|
+
* the chat, then Feedback" — is useful; pasting this section's prose into a
|
|
29
|
+
* reply is not, and would leak the handbook's shape to someone who only wanted
|
|
30
|
+
* to file a complaint. The section says so explicitly.
|
|
31
|
+
*
|
|
32
|
+
* ## Why a section and not a runtime context
|
|
33
|
+
*
|
|
34
|
+
* Everything here is true for the life of the process: which channels carry
|
|
35
|
+
* feedback, where the mode switch lives. `context()` exists for facts that flip
|
|
36
|
+
* — the read-only policy uses it for exactly that reason — and a constant
|
|
37
|
+
* belongs in a section, where it costs nothing to re-render.
|
|
38
|
+
*
|
|
39
|
+
* @module @huaweidevtools/aishell-dsh-handbook/prompt
|
|
40
|
+
*/
|
|
41
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
42
|
+
/**
|
|
43
|
+
* Position of the handbook in the assembled prompt.
|
|
44
|
+
*
|
|
45
|
+
* A number because the framework's placement table is closed:
|
|
46
|
+
* `PromptSectionOrderName` is `keyof` a fixed constant, and no entry names
|
|
47
|
+
* product background. `aishell-huaweicloud-docs` resolves its own position the
|
|
48
|
+
* same way, one step ahead of this one.
|
|
49
|
+
*
|
|
50
|
+
* 110 puts this immediately after that pointer (100), both inside the gap the
|
|
51
|
+
* table leaves between the persona prefix (0) and the first policy (500). The
|
|
52
|
+
* two are one band: read where to look things up, then how this product
|
|
53
|
+
* behaves, then what you are asked to reason about.
|
|
54
|
+
*/
|
|
55
|
+
export declare const HANDBOOK_ORDER = 110;
|
|
56
|
+
/** Name this contribution registers under; unique across the assembled prompt. */
|
|
57
|
+
export declare const HANDBOOK_SECTION_NAME = "aishell:handbook";
|
|
58
|
+
/**
|
|
59
|
+
* What the model reads.
|
|
60
|
+
*
|
|
61
|
+
* Written in English like every other host-side prompt string in this repo. The
|
|
62
|
+
* model relays it in the user's language; the source does not need to change
|
|
63
|
+
* language to do that.
|
|
64
|
+
*
|
|
65
|
+
* UI names appear as the shell renders them in English, with the Chinese label
|
|
66
|
+
* beside it where the two differ — a model telling a Chinese user where a
|
|
67
|
+
* button is needs the label that user will actually see, and vice versa.
|
|
68
|
+
*/
|
|
69
|
+
export declare const HANDBOOK = "# AI Shell handbook\n\nHow AI Shell behaves, as facts to answer from. This is background, not instruction: use it to tell the user what to do or why something happened. Do not paste or paraphrase this section's structure into a reply \u2014 answer the user's actual question.\n\n## Sending feedback\n\nA user who wants to report a problem, rate an answer, or tell us something about a conversation has three ways in. All three end up in the same place.\n\n- **The `/feedback` command** \u2014 typed in the input box. It records a note about the current session.\n- **The \u22EF menu at the top right of the chat** \u2014 the button is \"More actions\" (\u66F4\u591A\u64CD\u4F5C). Opening it shows \"Feedback\" (\u53CD\u9988), which opens the same session-feedback dialog.\n- **The Like / Dislike buttons under each assistant message** \u2014 these rate that one message; either one opens the same dialog for detail and categories.\n\nWhich one to name depends on what the user is reporting: a bad single answer is the buttons, a bad conversation is the \u22EF menu or `/feedback`. The \u22EF menu rates the **whole session**; the buttons rate **one message**.\n\nWhat a submission sends is worth stating when a user asks about privacy: it replays the complete unhandled session prefix \u2014 the conversation text, tool arguments and results, the system prompt, and the working directory \u2014 to AI Shell's collector, not only the note the user typed. The dialog discloses this before submitting.\n\n## The permission mode\n\nHuawei Cloud work runs under one of two modes.\n\n- **Read-write** lets the agent create, change and delete Huawei Cloud resources.\n- **Read-only** restricts it to queries. The tools refuse mutations rather than merely discouraging them \u2014 a refusal names the operation and what remains available.\n\nThis is one switch for the whole running process, not a per-conversation setting, and the agent cannot change it. A flip takes effect immediately.\n\nAn agent working under read-only is told so as a runtime context. When a user asks for something that was refused by the permission mode, the answer is that they flip the chip; never offer to work around the restriction, and never suggest reaching the same resource by another route.\n\n**Where the switch is.** A pill button showing \u53EA\u8BFB (Read-only, green) or \u8BFB\u5199 (Read-write, amber), sitting beside the Huawei Cloud account chip \u2014 the one carrying the Huawei logo and the account name. Clicking it flips the mode; there is no menu behind it. Its position depends on the screen, which is where a user hunting for it usually gets lost:\n\n- **In a conversation** \u2014 directly under the input box, at the right-hand end of the row.\n- **On a new session, before the first message** \u2014 in the band just above the input box. It sits there so the mode can be checked before sending, which is why it is not below.\n\nWhen a user cannot find it, name the neighbour (the Huawei Cloud account chip) and the text on the button (\u53EA\u8BFB / \u8BFB\u5199). There is no \"permission settings\" page in this UI, so do not send them looking for one.\n\n## Extending the agent\n\nThe agent's abilities are the plugins a deployment has mounted. A user who wants a capability that is missing installs a DSH-compatible plugin into their profile; it contributes its tools, prompt sections and UI in the same way AI Shell's own plugins do. There is no in-conversation way to add one, so a request for a new ability is answered by saying what to install, not by improvising the capability locally.";
|
|
70
|
+
/**
|
|
71
|
+
* Register the handbook section.
|
|
72
|
+
*
|
|
73
|
+
* Deferred behind `ctx.inject` rather than declared in this plugin's own
|
|
74
|
+
* `inject`: the handbook is an enhancement, and a deployment without a system
|
|
75
|
+
* prompt should lose it rather than fail to mount.
|
|
76
|
+
*
|
|
77
|
+
* @param ctx - host context.
|
|
78
|
+
*/
|
|
79
|
+
export declare function registerHandbook(ctx: Context): void;
|
|
80
|
+
//# sourceMappingURL=prompt.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaweidevtools/aishell-dsh-handbook",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Tells LLM how AI Shell works — where feedback goes, what the read-only switch means, how to extend the harness",
|
|
4
|
+
"version": "0.0.16",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/yusheng-g/aishell-dsh-plugins.git",
|
|
11
|
+
"directory": "packages/aishell-handbook"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"lib/index.js",
|
|
24
|
+
"lib/types/**/*.d.ts",
|
|
25
|
+
"cordis.patch.yml"
|
|
26
|
+
],
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
30
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
34
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
35
|
+
"tsdown": "^0.10.0",
|
|
36
|
+
"typescript": "^5.7.0"
|
|
37
|
+
},
|
|
38
|
+
"dsh": {
|
|
39
|
+
"bundle": {
|
|
40
|
+
"patch": "./cordis.patch.yml"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build:bundle": "tsdown"
|
|
45
|
+
}
|
|
6
46
|
}
|