genshin-mods 0.0.0-stage → 4.1.0

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 (55) hide show
  1. package/.claude-plugin/plugin.json +12 -0
  2. package/LICENSE +201 -0
  3. package/README.md +83 -2
  4. package/hooks/hooks.json +1 -0
  5. package/package.json +40 -4
  6. package/src/models/AgentLaunch.ts +6 -0
  7. package/src/models/DelegationCall.ts +8 -0
  8. package/src/models/DelegationStep.ts +7 -0
  9. package/src/models/ResinFigure.ts +5 -0
  10. package/src/models/TaskCall.ts +14 -0
  11. package/src/models/TaskTool.ts +5 -0
  12. package/src/models/UsageWindow.ts +10 -0
  13. package/src/models/WardAnswer.ts +8 -0
  14. package/src/register.ts +23 -0
  15. package/src/services/InitialState.ts +16 -0
  16. package/src/services/ModDescriptionMap.ts +13 -0
  17. package/src/services/band/getCommissionSummary.ts +21 -0
  18. package/src/services/band/registerBand.ts +215 -0
  19. package/src/services/commission/foldTaskCall.ts +26 -0
  20. package/src/services/commission/registerCommission.ts +48 -0
  21. package/src/services/constants.ts +71 -0
  22. package/src/services/delegation/checkIsLookupCommand.ts +11 -0
  23. package/src/services/delegation/getCallStep.ts +16 -0
  24. package/src/services/delegation/getLaunchRefusal.ts +8 -0
  25. package/src/services/delegation/getNextStreak.ts +8 -0
  26. package/src/services/delegation/getNudge.ts +5 -0
  27. package/src/services/delegation/registerDelegation.ts +46 -0
  28. package/src/services/diskScan/getDiskScanRefusal.ts +85 -0
  29. package/src/services/diskScan/registerDiskScan.ts +17 -0
  30. package/src/services/registerLifecycle.ts +226 -0
  31. package/src/services/resin/RateLimitKindUsageWindowMap.ts +27 -0
  32. package/src/services/resin/formatResetsAt.ts +3 -0
  33. package/src/services/resin/getCacheRemainingMs.ts +4 -0
  34. package/src/services/resin/getCacheWarningDelayMs.ts +7 -0
  35. package/src/services/resin/getReserveSummary.ts +8 -0
  36. package/src/services/resin/getReserveWindow.ts +32 -0
  37. package/src/services/resin/getResinFigures.ts +44 -0
  38. package/src/services/resin/registerReserveGate.ts +27 -0
  39. package/src/services/resin/reserveText.ts +9 -0
  40. package/src/services/shell/getShellRefusal.ts +85 -0
  41. package/src/services/shell/joinDirectory.ts +17 -0
  42. package/src/services/veil/registerVeil.ts +32 -0
  43. package/src/services/veil/veilText.ts +25 -0
  44. package/src/services/veil/veilValue.ts +11 -0
  45. package/src/services/ward/getCheckoutPeer.ts +21 -0
  46. package/src/services/ward/getCollidingRecord.ts +11 -0
  47. package/src/services/ward/getParentFolder.ts +5 -0
  48. package/src/services/ward/getRecordsPath.ts +3 -0
  49. package/src/services/ward/getRecordsWithEdit.ts +15 -0
  50. package/src/services/ward/getWholeIndexRefusal.ts +127 -0
  51. package/src/services/ward/parseRecords.ts +5 -0
  52. package/src/services/ward/registerWard.ts +79 -0
  53. package/src/services/ward/registerWholeIndex.ts +59 -0
  54. package/src/services/waypoints/parseWaypoints.ts +12 -0
  55. package/types/index.d.ts +57 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
+ "name": "genshin-mods",
4
+ "displayName": "Genshin Mods",
5
+ "description": "Six Claude Code mods: five under one band above the prompt, waypoints (the next steps, one press each), resin (cache, context, limits and cost, with warm, compact and a one-click handoff), veil (recording mode), commission (a goal's task list and clock) and ward (a question before editing a file another session just changed), and a delegation guard that nudges a run of lookups toward a haiku agent.",
6
+ "author": { "name": "Esposter", "url": "https://github.com/Esposter" },
7
+ "homepage": "https://esposter.com/docs/infra/claude-interface/genshin-mods",
8
+ "repository": "https://github.com/Esposter/Esposter",
9
+ "license": "Apache-2.0",
10
+ "keywords": ["cache", "collision", "genshin", "handoff", "mods", "recording", "tasks"],
11
+ "types": "./types/index.d.ts"
12
+ }
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 by 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 based on (or derived from) 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 2020-present Jimmy Chen
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 implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,84 @@
1
- # Temporary Holding Version
1
+ # genshin-mods
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![Apache-2.0 licensed][badge-license]][url-license]
4
+ [![NPM version][badge-npm-version]][url-npm]
5
+ [![NPM downloads][badge-npm-downloads]][url-npm]
6
+ [![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
7
+
8
+ A Claude Code plugin of mods: five drawn as one band above the prompt, in the session character's colour (the next steps one press away, what the session is spending with a one-press handoff, recording mode, a goal's task list and clock, and a question before editing a file another session just changed), a delegation guard that refuses any subagent not on haiku and nudges a run of lookups toward a haiku agent, a disk-scan guard that refuses a Bash scan from a root or a home folder, and a whole-index guard that refuses a git command over the whole index while another session shares the checkout.
9
+
10
+ - **Waypoints** — after each answered turn, up to three next steps the session suggests, each a button that sends it as the next prompt.
11
+ - **Resin** — the prompt cache's time left, the context window, the five-hour and weekly limits and the cost so far, with **Warm**, **Compact** and **Handoff**, a toast before the cache goes cold, and a usage reserve past four-fifths of a limit window, or past half of one spent ahead of an even pace, that has the session clean up on cheap agents, then wind down, until the window resets, refusing a workflow at launch meanwhile.
12
+ - **Veil** — recording mode: emails, amounts, phone numbers and secrets shown as placeholders while the model still reads the real values.
13
+ - **Commission** — a goal meter over the session's task list: the goal, tasks done, the share complete and the minutes since it started.
14
+ - **Ward** — before an edit to a file another session changed in the last half hour, a question: proceed, move to a worktree, or cancel.
15
+ - **Delegation guard** — every subagent launch not on haiku refused, a fork included, and after every third lookup in a row with no decision between them, a note on that call's result that the chain goes to a haiku agent as one bounded question.
16
+ - **Disk-scan guard** — a Bash `find`, `du`, `grep -r` or `ls -R` that starts at `/`, a drive, `~` or a home folder is refused, with the known place to look for the file.
17
+ - **Pulse** — keeps the machine watcher running from any session with the plugin, so its heartbeat and the machine's state keep being written.
18
+ - **Whole-index guard** — while another session edits this checkout, a Bash `git add .`, `git add -A`, `git reset` with no path, `git stash`, `git checkout .` or `git clean` is refused, with the path-scoped form to use instead.
19
+
20
+ ## Table of Contents
21
+
22
+ - 🚀 [Getting Started](#getting-started)
23
+ - 📖 [Documentation](#documentation)
24
+ - ⚖️ [License](#license)
25
+
26
+ ---
27
+
28
+ ## <a name="getting-started">🚀 Getting Started</a>
29
+
30
+ This repository is a Claude Code plugin marketplace named `esposter`:
31
+
32
+ ```bash
33
+ claude plugin marketplace add Esposter/Esposter
34
+ claude plugin install genshin-mods@esposter
35
+ ```
36
+
37
+ A clone of this repository needs neither command: `.agents/settings.json` enables the plugin at project scope once you trust the repository. With [`genshin-persona`](https://github.com/Esposter/Esposter/tree/main/packages/genshin-persona) installed beside it, the band takes the session character's colour; without it, the game's interface gold.
38
+
39
+ Developing the plugin from a checkout loads the directory itself, with the installed copy disabled so only one of them answers:
40
+
41
+ ```bash
42
+ claude plugin disable genshin-mods@esposter
43
+ claude --plugin-dir packages/genshin-mods
44
+ ```
45
+
46
+ ## <a name="documentation">📖 Documentation</a>
47
+
48
+ We highly recommend you take a look at the [documentation](https://esposter.com/docs/infra/claude-interface/genshin-mods) to level up.
49
+
50
+ ### Command reference
51
+
52
+ Each mod is switched by its own slash command; bare, it flips, and the choice is kept across sessions:
53
+
54
+ | Command | What it does |
55
+ | :------------------------ | :------------------------------------------------------------------------------------------------------------------------------ |
56
+ | `/waypoints [on \| off]` | Suggests the next steps after each answered turn, or stops |
57
+ | `/resin [on \| off]` | Shows the cache, context, limits and cost row and its warning toast |
58
+ | `/veil [on \| off]` | Turns recording mode on or off; off by default |
59
+ | `/commission [on \| off]` | Shows the goal meter while a turn works through a task list |
60
+ | `/pulse [on \| off]` | Keeps the machine watcher running, or stops |
61
+ | `/ward [on \| off]` | Asks before an edit to a file another session just changed, and refuses a whole-index git command while one shares the checkout |
62
+
63
+ With the band focused (a click or `ctrl+x tab`), `w`, `c` and `h` warm, compact and hand off, `1` to `3` send a waypoint and `g` opens or closes the whole task list.
64
+
65
+ ### Commands
66
+
67
+ Run from `packages/genshin-mods/`:
68
+
69
+ ```bash
70
+ pnpm test # vitest watch mode (coverage is run from the repo root)
71
+ pnpm validate # claude plugin validate: the engine's own reading of the hooks module
72
+ pnpm lint:fix # auto-fix lint
73
+ ```
74
+
75
+ ## <a name="license">⚖️ License</a>
76
+
77
+ This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
78
+
79
+ [badge-license]: https://img.shields.io/github/license/Esposter/Esposter.svg?color=blue
80
+ [url-license]: https://github.com/Esposter/Esposter/blob/main/LICENSE
81
+ [badge-npm-version]: https://img.shields.io/npm/v/genshin-mods/latest?color=brightgreen
82
+ [url-npm]: https://www.npmjs.com/package/genshin-mods/v/latest
83
+ [badge-npm-unpacked-size]: https://img.shields.io/npm/unpacked-size/genshin-mods/latest?label=npm
84
+ [badge-npm-downloads]: https://img.shields.io/npm/dm/genshin-mods.svg
@@ -0,0 +1 @@
1
+ { "modules": ["../src/register.ts"] }
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "genshin-mods",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "4.1.0",
4
+ "description": "A Claude Code plugin of mods: five under one band above the prompt (the next steps, the cache and usage with a one-click handoff, recording mode, a goal's task list and a question before editing a file another session just changed) a delegation guard that nudges a run of lookups toward a haiku agent, a disk-scan guard that refuses a Bash scan from a root or a home folder, and a whole-index guard that refuses a git command over the whole index while another session shares the checkout.",
5
+ "keywords": [
6
+ "claude-code",
7
+ "claude-code-plugin",
8
+ "genshin",
9
+ "mods"
10
+ ],
11
+ "homepage": "https://esposter.com/docs/infra/claude-interface/genshin-mods",
12
+ "bugs": {
13
+ "url": "https://github.com/Esposter/Esposter/issues"
14
+ },
15
+ "license": "Apache-2.0",
16
+ "author": "Jimmy Chen",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Esposter/Esposter.git"
20
+ },
21
+ "files": [
22
+ ".claude-plugin",
23
+ "hooks",
24
+ "src",
25
+ "types",
26
+ "!**/*.test.ts",
27
+ "!.claude-plugin/types"
28
+ ],
29
+ "type": "module",
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "scripts": {
34
+ "format": "oxfmt",
35
+ "format:check": "oxfmt --check",
36
+ "lint": "eslint .",
37
+ "lint:fix": "eslint --fix .",
38
+ "test": "vitest",
39
+ "validate": "claude plugin validate ."
40
+ },
41
+ "gitHead": "68de4c22fa7591bf6f6cc0fab2c9a906d8c4d71a"
42
+ }
@@ -0,0 +1,6 @@
1
+ // The part of an agent launch the delegation guard reads: the model it runs on and the type that may be a fork, which
2
+ // Inherits the parent's model whatever it names
3
+ export interface AgentLaunch {
4
+ model?: string;
5
+ subagent_type?: string;
6
+ }
@@ -0,0 +1,8 @@
1
+ // The part of a tool call the lookup count reads: the tool, a shell command with its background flag, and the agent
2
+ // A subagent's call names
3
+ export interface DelegationCall {
4
+ agentId?: string;
5
+ command?: string;
6
+ run_in_background?: boolean;
7
+ tool: string;
8
+ }
@@ -0,0 +1,7 @@
1
+ // What one tool call does to the count of lookups in a row: a lookup adds one, a reset clears it, and a call that
2
+ // Neither is, or a subagent's, leaves it as it was
3
+ export enum DelegationStep {
4
+ Lookup = "Lookup",
5
+ Neutral = "Neutral",
6
+ Reset = "Reset",
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface ResinFigure {
2
+ isWarning: boolean;
3
+ label: string;
4
+ text: string;
5
+ }
@@ -0,0 +1,14 @@
1
+ import type { CommissionTask } from "../../types";
2
+ import type { TaskTool } from "./TaskTool";
3
+
4
+ // One task tool call with what its result says, in the shapes the engine's own tools declare
5
+ export type TaskCall =
6
+ | {
7
+ id: string;
8
+ // oxlint-disable-next-line literal-union/no-string-literal-union -- The engine's own TaskUpdate statuses
9
+ status?: "deleted" | CommissionTask["status"];
10
+ subject?: string;
11
+ tool: TaskTool.TaskUpdate;
12
+ }
13
+ | { id: string; subject: string; tool: TaskTool.TaskCreate }
14
+ | { todos: { content: string; status: CommissionTask["status"] }[]; tool: TaskTool.TodoWrite };
@@ -0,0 +1,5 @@
1
+ export enum TaskTool {
2
+ TaskCreate = "TaskCreate",
3
+ TaskUpdate = "TaskUpdate",
4
+ TodoWrite = "TodoWrite",
5
+ }
@@ -0,0 +1,10 @@
1
+ export interface UsageWindow {
2
+ // The window's length, which its reset time is counted back from
3
+ durationMs: number;
4
+ // The usage line the window's maintenance tier starts at
5
+ maintenancePercentage: number;
6
+ // The window's name as the reserve's note spells it
7
+ name: string;
8
+ // The usage line the window's wind-down starts at
9
+ windDownPercentage: number;
10
+ }
@@ -0,0 +1,8 @@
1
+ export enum WardAnswer {
2
+ Cancel = "Cancel",
3
+ Proceed = "Proceed",
4
+ Worktree = "Move to a worktree",
5
+ }
6
+
7
+ // In the order the question offers them
8
+ export const WardAnswers: readonly WardAnswer[] = [WardAnswer.Proceed, WardAnswer.Worktree, WardAnswer.Cancel];
@@ -0,0 +1,23 @@
1
+ import type { Register } from "claude-code";
2
+
3
+ import { registerBand } from "./services/band/registerBand";
4
+ import { registerCommission } from "./services/commission/registerCommission";
5
+ import { registerDelegation } from "./services/delegation/registerDelegation";
6
+ import { registerDiskScan } from "./services/diskScan/registerDiskScan";
7
+ import { registerLifecycle } from "./services/registerLifecycle";
8
+ import { registerReserveGate } from "./services/resin/registerReserveGate";
9
+ import { registerVeil } from "./services/veil/registerVeil";
10
+ import { registerWard } from "./services/ward/registerWard";
11
+ import { registerWholeIndex } from "./services/ward/registerWholeIndex";
12
+
13
+ export const register: Register = (on) => {
14
+ registerBand(on);
15
+ registerCommission(on);
16
+ registerDelegation(on);
17
+ registerDiskScan(on);
18
+ registerLifecycle(on);
19
+ registerReserveGate(on);
20
+ registerVeil(on);
21
+ registerWard(on);
22
+ registerWholeIndex(on);
23
+ };
@@ -0,0 +1,16 @@
1
+ import type { PluginState } from "claude-code";
2
+
3
+ // Every state value's initial, read by each file's atoms: the engine traces a state reference only to an atom made in
4
+ // The file that uses it, so each file makes its own and this is the one place their initials are written
5
+ export const InitialState: PluginState["genshin-mods"] = {
6
+ commission: { goal: "", openedAt: 0, tasks: [] },
7
+ enabledMods: { commission: true, pulse: true, resin: true, veil: false, ward: true, waypoints: true },
8
+ isCommissionExpanded: false,
9
+ isHandingOff: false,
10
+ lastCacheRequestAt: 0,
11
+ lastPrompt: "",
12
+ lookupStreak: 0,
13
+ now: 0,
14
+ reserveWindow: { isAheadOfPace: false, isWindDown: false, name: "", percentage: 0, resetsAt: "" },
15
+ waypoints: [],
16
+ };
@@ -0,0 +1,13 @@
1
+ import type { EnabledMods } from "../../types";
2
+
3
+ // Each mod's command, `/<name> [on|off]`, as the menu describes it
4
+ export const ModDescriptionMap: Record<keyof EnabledMods, string> = {
5
+ commission: "Show a goal's task list, how far it is and how long it has run.",
6
+ pulse: "Keep the machine watcher running.",
7
+ resin: "Show the cache, context, limits and cost, with warm, compact and handoff.",
8
+ veil: "Recording mode: show emails, amounts, phone numbers and secrets as placeholders.",
9
+ ward: "Ask before editing a file another session changed in the last half hour, and refuse a whole-index git command while one shares the checkout.",
10
+ waypoints: "Suggest the next steps after each answer, one press each.",
11
+ };
12
+
13
+ export const ModNames = Object.keys(ModDescriptionMap) as (keyof EnabledMods)[];
@@ -0,0 +1,21 @@
1
+ import type { Commission } from "../../../types";
2
+
3
+ import { MINUTE_FORMATTER } from "../constants";
4
+
5
+ const PERCENT_FORMATTER = new Intl.NumberFormat("en", { style: "percent" });
6
+
7
+ // `goal · 3 of 4 · 75% · 12m`, the clock counting whole minutes from the commission's opening
8
+ export const getCommissionSummary = ({ goal, openedAt, tasks }: Commission, now: number): string => {
9
+ const done = tasks.filter(({ status }) => status === "completed").length;
10
+ const elapsedMinutes = Math.floor(
11
+ Temporal.Duration.from({ milliseconds: Math.max(0, now - openedAt) }).total("minutes"),
12
+ );
13
+ return [
14
+ goal,
15
+ `${done} of ${tasks.length}`,
16
+ PERCENT_FORMATTER.format(done / tasks.length),
17
+ MINUTE_FORMATTER.format(elapsedMinutes),
18
+ ]
19
+ .filter(Boolean)
20
+ .join(" · ");
21
+ };