@vibe-hero/server 0.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.
- package/LICENSE +190 -0
- package/README.md +151 -0
- package/dist/catalog/bundled/claude-code/.gitkeep +0 -0
- package/dist/catalog/bundled/claude-code/context-management.yaml +302 -0
- package/dist/catalog/bundled/claude-code/planning.yaml +313 -0
- package/dist/catalog/bundled/claude-code/subagents.yaml +357 -0
- package/dist/catalog/bundled/general/.gitkeep +0 -0
- package/dist/catalog/bundled/general/_placeholder.yaml +39 -0
- package/dist/catalog/bundled/general/task-decomposition.yaml +390 -0
- package/dist/catalog/bundled/index.d.ts +39 -0
- package/dist/catalog/bundled/index.d.ts.map +1 -0
- package/dist/catalog/bundled/index.js +41 -0
- package/dist/catalog/bundled/index.js.map +1 -0
- package/dist/catalog/fetcher.d.ts +201 -0
- package/dist/catalog/fetcher.d.ts.map +1 -0
- package/dist/catalog/fetcher.js +452 -0
- package/dist/catalog/fetcher.js.map +1 -0
- package/dist/catalog/loader.d.ts +165 -0
- package/dist/catalog/loader.d.ts.map +1 -0
- package/dist/catalog/loader.js +241 -0
- package/dist/catalog/loader.js.map +1 -0
- package/dist/catalog/resolve.d.ts +85 -0
- package/dist/catalog/resolve.d.ts.map +1 -0
- package/dist/catalog/resolve.js +103 -0
- package/dist/catalog/resolve.js.map +1 -0
- package/dist/cli/getOffer.d.ts +38 -0
- package/dist/cli/getOffer.d.ts.map +1 -0
- package/dist/cli/getOffer.js +150 -0
- package/dist/cli/getOffer.js.map +1 -0
- package/dist/cli/index.d.ts +46 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +88 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config.d.ts +34 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -0
- package/dist/engine/elo.d.ts +76 -0
- package/dist/engine/elo.d.ts.map +1 -0
- package/dist/engine/elo.js +79 -0
- package/dist/engine/elo.js.map +1 -0
- package/dist/engine/graduation.d.ts +108 -0
- package/dist/engine/graduation.d.ts.map +1 -0
- package/dist/engine/graduation.js +161 -0
- package/dist/engine/graduation.js.map +1 -0
- package/dist/engine/lapse.d.ts +80 -0
- package/dist/engine/lapse.d.ts.map +1 -0
- package/dist/engine/lapse.js +125 -0
- package/dist/engine/lapse.js.map +1 -0
- package/dist/engine/selection.d.ts +84 -0
- package/dist/engine/selection.d.ts.map +1 -0
- package/dist/engine/selection.js +119 -0
- package/dist/engine/selection.js.map +1 -0
- package/dist/grading/deterministic.d.ts +102 -0
- package/dist/grading/deterministic.d.ts.map +1 -0
- package/dist/grading/deterministic.js +118 -0
- package/dist/grading/deterministic.js.map +1 -0
- package/dist/grading/freeform.d.ts +64 -0
- package/dist/grading/freeform.d.ts.map +1 -0
- package/dist/grading/freeform.js +85 -0
- package/dist/grading/freeform.js.map +1 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/observation/hookEvents.d.ts +113 -0
- package/dist/observation/hookEvents.d.ts.map +1 -0
- package/dist/observation/hookEvents.js +170 -0
- package/dist/observation/hookEvents.js.map +1 -0
- package/dist/observation/offers.d.ts +215 -0
- package/dist/observation/offers.d.ts.map +1 -0
- package/dist/observation/offers.js +327 -0
- package/dist/observation/offers.js.map +1 -0
- package/dist/observation/source.d.ts +133 -0
- package/dist/observation/source.d.ts.map +1 -0
- package/dist/observation/source.js +105 -0
- package/dist/observation/source.js.map +1 -0
- package/dist/profile/migrate.d.ts +122 -0
- package/dist/profile/migrate.d.ts.map +1 -0
- package/dist/profile/migrate.js +147 -0
- package/dist/profile/migrate.js.map +1 -0
- package/dist/profile/store.d.ts +84 -0
- package/dist/profile/store.d.ts.map +1 -0
- package/dist/profile/store.js +267 -0
- package/dist/profile/store.js.map +1 -0
- package/dist/schemas/common.d.ts +95 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +106 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/content.d.ts +828 -0
- package/dist/schemas/content.d.ts.map +1 -0
- package/dist/schemas/content.js +219 -0
- package/dist/schemas/content.js.map +1 -0
- package/dist/schemas/profile.d.ts +599 -0
- package/dist/schemas/profile.d.ts.map +1 -0
- package/dist/schemas/profile.js +177 -0
- package/dist/schemas/profile.js.map +1 -0
- package/dist/schemas/tools.d.ts +1581 -0
- package/dist/schemas/tools.d.ts.map +1 -0
- package/dist/schemas/tools.js +286 -0
- package/dist/schemas/tools.js.map +1 -0
- package/dist/tools/config.d.ts +51 -0
- package/dist/tools/config.d.ts.map +1 -0
- package/dist/tools/config.js +104 -0
- package/dist/tools/config.js.map +1 -0
- package/dist/tools/gate.d.ts +50 -0
- package/dist/tools/gate.d.ts.map +1 -0
- package/dist/tools/gate.js +67 -0
- package/dist/tools/gate.js.map +1 -0
- package/dist/tools/guidance.d.ts +36 -0
- package/dist/tools/guidance.d.ts.map +1 -0
- package/dist/tools/guidance.js +117 -0
- package/dist/tools/guidance.js.map +1 -0
- package/dist/tools/listTopics.d.ts +55 -0
- package/dist/tools/listTopics.d.ts.map +1 -0
- package/dist/tools/listTopics.js +78 -0
- package/dist/tools/listTopics.js.map +1 -0
- package/dist/tools/offers.d.ts +60 -0
- package/dist/tools/offers.d.ts.map +1 -0
- package/dist/tools/offers.js +152 -0
- package/dist/tools/offers.js.map +1 -0
- package/dist/tools/placeholders.d.ts +27 -0
- package/dist/tools/placeholders.d.ts.map +1 -0
- package/dist/tools/placeholders.js +49 -0
- package/dist/tools/placeholders.js.map +1 -0
- package/dist/tools/recordObservation.d.ts +52 -0
- package/dist/tools/recordObservation.d.ts.map +1 -0
- package/dist/tools/recordObservation.js +87 -0
- package/dist/tools/recordObservation.js.map +1 -0
- package/dist/tools/startQuiz.d.ts +82 -0
- package/dist/tools/startQuiz.d.ts.map +1 -0
- package/dist/tools/startQuiz.js +180 -0
- package/dist/tools/startQuiz.js.map +1 -0
- package/dist/tools/status.d.ts +59 -0
- package/dist/tools/status.d.ts.map +1 -0
- package/dist/tools/status.js +133 -0
- package/dist/tools/status.js.map +1 -0
- package/dist/tools/submitAnswer.d.ts +156 -0
- package/dist/tools/submitAnswer.d.ts.map +1 -0
- package/dist/tools/submitAnswer.js +402 -0
- package/dist/tools/submitAnswer.js.map +1 -0
- package/dist/tools/types.d.ts +82 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +48 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/us2/standing.d.ts +111 -0
- package/dist/tools/us2/standing.d.ts.map +1 -0
- package/dist/tools/us2/standing.js +143 -0
- package/dist/tools/us2/standing.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/schemas/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAI9B,CAAC;AACH,wCAAwC;AACxC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAchE,8BAA8B;AAC9B,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,8CAA8C;AAC9C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,+BAA+B;AAC/B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOhC,CAAC;AACH,MAAM,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IAE3C,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file MCP tool input/output schemas.
|
|
3
|
+
*
|
|
4
|
+
* One input + output schema per MCP tool. All inputs/outputs are Zod-validated
|
|
5
|
+
* both directions. Every tool (except get_config/save_config) may instead
|
|
6
|
+
* return the {@link SetupRequiredSchema} gate sentinel when `profile.config` is
|
|
7
|
+
* absent (FR-032).
|
|
8
|
+
*
|
|
9
|
+
* Source of truth: specs/001-vibe-hero-mvp/contracts/mcp-tools.md.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import { AbilityKeySchema, TierSchema, ToolIdSchema, QuestionTypeSchema, GradeSchema, } from "./common.js";
|
|
13
|
+
import { ChoiceSchema, RubricCriterionSchema } from "./content.js";
|
|
14
|
+
import { ConfigSchema } from "./profile.js";
|
|
15
|
+
/**
|
|
16
|
+
* The setup gate sentinel. Returned by any gated tool when `profile.config` is
|
|
17
|
+
* absent (FR-032). Tool result schemas that can be gated are unioned with this.
|
|
18
|
+
*/
|
|
19
|
+
export const SetupRequiredSchema = z.object({
|
|
20
|
+
status: z.literal("SETUP_REQUIRED"),
|
|
21
|
+
message: z.string().min(1),
|
|
22
|
+
setupSkill: z.string().min(1),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Wrap a tool result schema so it can also be the gate sentinel. Discriminated
|
|
26
|
+
* on `status` is not possible for arbitrary object results, so this is a plain
|
|
27
|
+
* union; callers narrow on the `status === "SETUP_REQUIRED"` field.
|
|
28
|
+
*/
|
|
29
|
+
const gated = (result) => z.union([SetupRequiredSchema, result]);
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// get_status
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/** Input for `get_status`. */
|
|
34
|
+
export const GetStatusInputSchema = z.object({
|
|
35
|
+
tool: ToolIdSchema.optional(),
|
|
36
|
+
});
|
|
37
|
+
/** Per-topic standing row in `get_status`. */
|
|
38
|
+
export const StatusTopicSchema = z.object({
|
|
39
|
+
key: AbilityKeySchema,
|
|
40
|
+
title: z.string(),
|
|
41
|
+
tier: z.union([TierSchema, z.literal(0)]),
|
|
42
|
+
status: z.enum(["current", "due_for_review", "not_started"]),
|
|
43
|
+
ability: z.number(),
|
|
44
|
+
});
|
|
45
|
+
/** Result for `get_status`. */
|
|
46
|
+
export const GetStatusResultSchema = z.object({
|
|
47
|
+
tool: ToolIdSchema,
|
|
48
|
+
topics: z.array(StatusTopicSchema),
|
|
49
|
+
dueForReview: z.array(z.string()),
|
|
50
|
+
suggestions: z.array(z.object({ key: AbilityKeySchema, reason: z.string() })),
|
|
51
|
+
});
|
|
52
|
+
/** Output for `get_status` (may be gated). */
|
|
53
|
+
export const GetStatusOutputSchema = gated(GetStatusResultSchema);
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// list_topics
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
/** Input for `list_topics`. */
|
|
58
|
+
export const ListTopicsInputSchema = z.object({
|
|
59
|
+
tool: ToolIdSchema.optional(),
|
|
60
|
+
class: z.enum(["general", "tool"]).optional(),
|
|
61
|
+
});
|
|
62
|
+
/** One topic row in `list_topics`. */
|
|
63
|
+
export const ListTopicsRowSchema = z.object({
|
|
64
|
+
key: AbilityKeySchema,
|
|
65
|
+
id: z.string(),
|
|
66
|
+
class: z.enum(["general", "tool"]),
|
|
67
|
+
title: z.string(),
|
|
68
|
+
tiers: z.array(TierSchema),
|
|
69
|
+
itemCount: z.number().int().nonnegative(),
|
|
70
|
+
});
|
|
71
|
+
/** Result for `list_topics`. */
|
|
72
|
+
export const ListTopicsResultSchema = z.object({
|
|
73
|
+
topics: z.array(ListTopicsRowSchema),
|
|
74
|
+
catalogVersion: z.string(),
|
|
75
|
+
});
|
|
76
|
+
/** Output for `list_topics` (may be gated). */
|
|
77
|
+
export const ListTopicsOutputSchema = gated(ListTopicsResultSchema);
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// get_guidance
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
/** Input for `get_guidance`. No `key` ⇒ pick weakest/stale for `tool`. */
|
|
82
|
+
export const GetGuidanceInputSchema = z.object({
|
|
83
|
+
key: AbilityKeySchema.optional(),
|
|
84
|
+
tool: ToolIdSchema.optional(),
|
|
85
|
+
});
|
|
86
|
+
/** Result for `get_guidance`. */
|
|
87
|
+
export const GetGuidanceResultSchema = z.object({
|
|
88
|
+
key: AbilityKeySchema,
|
|
89
|
+
title: z.string(),
|
|
90
|
+
currentTier: z.union([TierSchema, z.literal(0)]),
|
|
91
|
+
guidance: z.string(),
|
|
92
|
+
nextStep: z.object({
|
|
93
|
+
action: z.enum(["quiz", "read"]),
|
|
94
|
+
detail: z.string(),
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
/** Output for `get_guidance` (may be gated). */
|
|
98
|
+
export const GetGuidanceOutputSchema = gated(GetGuidanceResultSchema);
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// start_quiz
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
/**
|
|
103
|
+
* Input for `start_quiz`.
|
|
104
|
+
*
|
|
105
|
+
* `allowFreeForm` is the graceful-degradation switch (FR-014, T049): when the
|
|
106
|
+
* host agent cannot judge a free-form answer (no judging capability), the caller
|
|
107
|
+
* passes `false` and the selection EXCLUDES `free_form` items, preferring
|
|
108
|
+
* deterministic ones so the quiz still completes rather than serving an
|
|
109
|
+
* unjudgeable item. It defaults to `true` (free-form judging is available).
|
|
110
|
+
*/
|
|
111
|
+
export const StartQuizInputSchema = z.object({
|
|
112
|
+
key: AbilityKeySchema,
|
|
113
|
+
length: z.union([z.literal(3), z.literal(4), z.literal(5)]).optional(),
|
|
114
|
+
allowFreeForm: z.boolean().optional(),
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* An item as presented to the host agent. Deterministic items omit answer keys
|
|
118
|
+
* and rubric/referenceAnswer; `free_form` items include `rubric.criteria` (with
|
|
119
|
+
* ids) AND `referenceAnswer` so the host agent can judge.
|
|
120
|
+
*/
|
|
121
|
+
export const PresentedItemSchema = z.object({
|
|
122
|
+
itemId: z.string(),
|
|
123
|
+
tier: TierSchema,
|
|
124
|
+
type: QuestionTypeSchema,
|
|
125
|
+
prompt: z.string(),
|
|
126
|
+
choices: z.array(ChoiceSchema).optional(),
|
|
127
|
+
rubric: z.object({ criteria: z.array(RubricCriterionSchema) }).optional(),
|
|
128
|
+
referenceAnswer: z.string().optional(),
|
|
129
|
+
});
|
|
130
|
+
/** Result for `start_quiz`. */
|
|
131
|
+
export const StartQuizResultSchema = z.object({
|
|
132
|
+
quizId: z.string(),
|
|
133
|
+
items: z.array(PresentedItemSchema),
|
|
134
|
+
});
|
|
135
|
+
/** Output for `start_quiz` (may be gated). */
|
|
136
|
+
export const StartQuizOutputSchema = gated(StartQuizResultSchema);
|
|
137
|
+
// ---------------------------------------------------------------------------
|
|
138
|
+
// submit_answer
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
/** Deterministic answer payload (multiple_choice / short_answer). */
|
|
141
|
+
export const SubmitAnswerDeterministicInputSchema = z.object({
|
|
142
|
+
quizId: z.string(),
|
|
143
|
+
itemId: z.string(),
|
|
144
|
+
answer: z.object({
|
|
145
|
+
choiceId: z.string().optional(),
|
|
146
|
+
text: z.string().optional(),
|
|
147
|
+
}),
|
|
148
|
+
});
|
|
149
|
+
/**
|
|
150
|
+
* Free-form per-criterion verdict from the host agent. A single-boolean verdict
|
|
151
|
+
* is rejected as non-conformant (anti-gaming, critique E2): each criterion id
|
|
152
|
+
* must carry its own `met` + `justification`. The MCP computes the score.
|
|
153
|
+
*/
|
|
154
|
+
export const FreeFormVerdictSchema = z.object({
|
|
155
|
+
criteria: z
|
|
156
|
+
.array(z.object({
|
|
157
|
+
id: z.string().min(1),
|
|
158
|
+
met: z.boolean(),
|
|
159
|
+
justification: z.string().min(1),
|
|
160
|
+
}))
|
|
161
|
+
.min(1),
|
|
162
|
+
});
|
|
163
|
+
/** Free-form answer payload (host-agent verdict). */
|
|
164
|
+
export const SubmitAnswerFreeFormInputSchema = z.object({
|
|
165
|
+
quizId: z.string(),
|
|
166
|
+
itemId: z.string(),
|
|
167
|
+
verdict: FreeFormVerdictSchema,
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* Input for `submit_answer`: either a deterministic answer or a free-form
|
|
171
|
+
* verdict. Discriminated structurally (presence of `answer` vs. `verdict`).
|
|
172
|
+
*/
|
|
173
|
+
export const SubmitAnswerInputSchema = z.union([
|
|
174
|
+
SubmitAnswerDeterministicInputSchema,
|
|
175
|
+
SubmitAnswerFreeFormInputSchema,
|
|
176
|
+
]);
|
|
177
|
+
/** Result for `submit_answer`. */
|
|
178
|
+
export const SubmitAnswerResultSchema = z.object({
|
|
179
|
+
grade: GradeSchema,
|
|
180
|
+
score: z.number().min(0).max(1),
|
|
181
|
+
correctAnswer: z.string().optional(),
|
|
182
|
+
guidance: z.string(),
|
|
183
|
+
ability: z.object({ before: z.number(), after: z.number() }),
|
|
184
|
+
graduation: z
|
|
185
|
+
.object({
|
|
186
|
+
changed: z.boolean(),
|
|
187
|
+
tier: TierSchema.optional(),
|
|
188
|
+
status: z.string().optional(),
|
|
189
|
+
reason: z.string().optional(),
|
|
190
|
+
})
|
|
191
|
+
.optional(),
|
|
192
|
+
});
|
|
193
|
+
/** Output for `submit_answer` (may be gated). */
|
|
194
|
+
export const SubmitAnswerOutputSchema = gated(SubmitAnswerResultSchema);
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
// save_config (not gated — clears the gate)
|
|
197
|
+
// ---------------------------------------------------------------------------
|
|
198
|
+
/** Input for `save_config`. */
|
|
199
|
+
export const SaveConfigInputSchema = z.object({
|
|
200
|
+
toolsLearning: z.array(ToolIdSchema),
|
|
201
|
+
offerCadence: z.enum(["off", "per_session", "per_topic"]),
|
|
202
|
+
proactiveOffers: z.boolean(),
|
|
203
|
+
quizLength: z.union([z.literal(3), z.literal(4), z.literal(5)]).optional(),
|
|
204
|
+
});
|
|
205
|
+
/** Result/output for `save_config` (never gated). */
|
|
206
|
+
export const SaveConfigResultSchema = z.object({
|
|
207
|
+
ok: z.literal(true),
|
|
208
|
+
config: ConfigSchema,
|
|
209
|
+
});
|
|
210
|
+
export const SaveConfigOutputSchema = SaveConfigResultSchema;
|
|
211
|
+
// ---------------------------------------------------------------------------
|
|
212
|
+
// get_config (not gated — reports gate state)
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
/** Input for `get_config`. */
|
|
215
|
+
export const GetConfigInputSchema = z.object({});
|
|
216
|
+
/** Result/output for `get_config` (never gated). */
|
|
217
|
+
export const GetConfigResultSchema = z.object({
|
|
218
|
+
configured: z.boolean(),
|
|
219
|
+
config: ConfigSchema.optional(),
|
|
220
|
+
});
|
|
221
|
+
export const GetConfigOutputSchema = GetConfigResultSchema;
|
|
222
|
+
// ---------------------------------------------------------------------------
|
|
223
|
+
// record_observation (trigger-only; never scores)
|
|
224
|
+
// ---------------------------------------------------------------------------
|
|
225
|
+
/** Input for `record_observation`. */
|
|
226
|
+
export const RecordObservationInputSchema = z.object({
|
|
227
|
+
tool: ToolIdSchema,
|
|
228
|
+
signals: z.array(z.object({
|
|
229
|
+
toolName: z.string().optional(),
|
|
230
|
+
mcpTool: z.string().optional(),
|
|
231
|
+
success: z.boolean().optional(),
|
|
232
|
+
toolUseId: z.string().optional(),
|
|
233
|
+
})),
|
|
234
|
+
sessionId: z.string(),
|
|
235
|
+
});
|
|
236
|
+
/** One offer candidate from `record_observation`. */
|
|
237
|
+
export const OfferCandidateSchema = z.object({
|
|
238
|
+
key: AbilityKeySchema,
|
|
239
|
+
title: z.string(),
|
|
240
|
+
reason: z.string(),
|
|
241
|
+
});
|
|
242
|
+
/** Result for `record_observation`. */
|
|
243
|
+
export const RecordObservationResultSchema = z.object({
|
|
244
|
+
offerCandidates: z.array(OfferCandidateSchema),
|
|
245
|
+
});
|
|
246
|
+
/** Output for `record_observation` (may be gated). */
|
|
247
|
+
export const RecordObservationOutputSchema = gated(RecordObservationResultSchema);
|
|
248
|
+
// ---------------------------------------------------------------------------
|
|
249
|
+
// get_offer
|
|
250
|
+
// ---------------------------------------------------------------------------
|
|
251
|
+
/** Input for `get_offer`. */
|
|
252
|
+
export const GetOfferInputSchema = z.object({
|
|
253
|
+
sessionId: z.string(),
|
|
254
|
+
tool: ToolIdSchema,
|
|
255
|
+
});
|
|
256
|
+
/** Result for `get_offer`. */
|
|
257
|
+
export const GetOfferResultSchema = z.object({
|
|
258
|
+
offer: z
|
|
259
|
+
.object({
|
|
260
|
+
key: AbilityKeySchema,
|
|
261
|
+
title: z.string(),
|
|
262
|
+
prompt: z.string(),
|
|
263
|
+
})
|
|
264
|
+
.optional(),
|
|
265
|
+
suppressed: z
|
|
266
|
+
.enum(["cadence", "declined", "offers_off", "no_candidate"])
|
|
267
|
+
.optional(),
|
|
268
|
+
});
|
|
269
|
+
/** Output for `get_offer` (may be gated). */
|
|
270
|
+
export const GetOfferOutputSchema = gated(GetOfferResultSchema);
|
|
271
|
+
// ---------------------------------------------------------------------------
|
|
272
|
+
// record_offer_response
|
|
273
|
+
// ---------------------------------------------------------------------------
|
|
274
|
+
/** Input for `record_offer_response`. */
|
|
275
|
+
export const RecordOfferResponseInputSchema = z.object({
|
|
276
|
+
sessionId: z.string(),
|
|
277
|
+
key: AbilityKeySchema,
|
|
278
|
+
response: z.enum(["accept", "decline", "defer"]),
|
|
279
|
+
});
|
|
280
|
+
/** Result for `record_offer_response`. */
|
|
281
|
+
export const RecordOfferResponseResultSchema = z.object({
|
|
282
|
+
ok: z.literal(true),
|
|
283
|
+
});
|
|
284
|
+
/** Output for `record_offer_response` (may be gated). */
|
|
285
|
+
export const RecordOfferResponseOutputSchema = gated(RecordOfferResponseResultSchema);
|
|
286
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/schemas/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC9B,CAAC,CAAC;AAIH;;;;GAIG;AACH,MAAM,KAAK,GAAG,CAAyB,MAAS,EAAE,EAAE,CAClD,CAAC,CAAC,KAAK,CAAC,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,CAAC;AAEzC,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,8BAA8B;AAC9B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,YAAY,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAGH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,gBAAgB;IACrB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAA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MAAM,CAAC;IACrD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,GAAG,EAAE,gBAAgB;IACrB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;CACjD,CAAC,CAAC;AAKH,0CAA0C;AAC1C,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CACpB,CAAC,CAAC;AAKH,yDAAyD;AACzD,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAClD,+BAA+B,CAChC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Real `save_config` / `get_config` tool modules (T022, US-0).
|
|
3
|
+
*
|
|
4
|
+
* These two tools own the first-run setup gate's lifecycle: `save_config` writes
|
|
5
|
+
* the `config` block that clears the gate (FR-031/032) and `get_config` reports
|
|
6
|
+
* gate state. Both are exempt from {@link withSetupGate} (see
|
|
7
|
+
* {@link EXEMPT_TOOLS}) — gating them would deadlock setup.
|
|
8
|
+
*
|
|
9
|
+
* Clock note: the engine stays pure, but these tools live in the IO/tool layer,
|
|
10
|
+
* so they MAY read the wall clock to stamp `createdAt`/`updatedAt`
|
|
11
|
+
* (`new Date().toISOString()`). The store's atomic read-modify-write
|
|
12
|
+
* ({@link updateProfile}) is reused so a re-config never races a concurrent
|
|
13
|
+
* writer, and only the `config` field is replaced — abilities, graduations,
|
|
14
|
+
* review schedule, quiz history, and offer state are preserved (FR-033).
|
|
15
|
+
*
|
|
16
|
+
* Each tool is exposed as a factory closing over an optional `dirOverride`
|
|
17
|
+
* (the store's test seam): the registry uses the default instances (env /
|
|
18
|
+
* `~/.vibe-hero`), and tests build dir-scoped instances against a temp home.
|
|
19
|
+
*
|
|
20
|
+
* Source of truth: specs/001-vibe-hero-mvp/contracts/mcp-tools.md
|
|
21
|
+
* (`save_config` / `get_config`), spec.md FR-031 / FR-032 / FR-033.
|
|
22
|
+
*/
|
|
23
|
+
import { type AnyToolModule } from "./types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Build the `save_config` tool module (US-0, FR-031/033).
|
|
26
|
+
*
|
|
27
|
+
* Validates input, then atomically replaces only the profile's `config` block
|
|
28
|
+
* via {@link updateProfile}. Because every other field is spread through
|
|
29
|
+
* untouched, re-running setup updates preferences without losing learning
|
|
30
|
+
* progress (FR-033). Returns `{ ok: true, config }` with the persisted config.
|
|
31
|
+
*
|
|
32
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
33
|
+
* @returns The erased registry entry for `save_config`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const makeSaveConfigTool: (dirOverride?: string) => AnyToolModule;
|
|
36
|
+
/**
|
|
37
|
+
* Build the `get_config` tool module (US-0).
|
|
38
|
+
*
|
|
39
|
+
* Reads the profile (never throws — a missing/corrupt profile degrades to an
|
|
40
|
+
* unconfigured one) and reports whether `config` is present, echoing it when so.
|
|
41
|
+
* Skills/hooks use this to know the gate state without triggering it.
|
|
42
|
+
*
|
|
43
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
44
|
+
* @returns The erased registry entry for `get_config`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const makeGetConfigTool: (dirOverride?: string) => AnyToolModule;
|
|
47
|
+
/** Default `save_config` module (env / `~/.vibe-hero`), used by the registry. */
|
|
48
|
+
export declare const saveConfigTool: AnyToolModule;
|
|
49
|
+
/** Default `get_config` module (env / `~/.vibe-hero`), used by the registry. */
|
|
50
|
+
export declare const getConfigTool: AnyToolModule;
|
|
51
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/tools/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAWH,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AA+B5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,cAAc,MAAM,KAAG,aAsBtD,CAAC;AAEL;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,cAAc,MAAM,KAAG,aAYrD,CAAC;AAEL,iFAAiF;AACjF,eAAO,MAAM,cAAc,EAAE,aAAoC,CAAC;AAElE,gFAAgF;AAChF,eAAO,MAAM,aAAa,EAAE,aAAmC,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Real `save_config` / `get_config` tool modules (T022, US-0).
|
|
3
|
+
*
|
|
4
|
+
* These two tools own the first-run setup gate's lifecycle: `save_config` writes
|
|
5
|
+
* the `config` block that clears the gate (FR-031/032) and `get_config` reports
|
|
6
|
+
* gate state. Both are exempt from {@link withSetupGate} (see
|
|
7
|
+
* {@link EXEMPT_TOOLS}) — gating them would deadlock setup.
|
|
8
|
+
*
|
|
9
|
+
* Clock note: the engine stays pure, but these tools live in the IO/tool layer,
|
|
10
|
+
* so they MAY read the wall clock to stamp `createdAt`/`updatedAt`
|
|
11
|
+
* (`new Date().toISOString()`). The store's atomic read-modify-write
|
|
12
|
+
* ({@link updateProfile}) is reused so a re-config never races a concurrent
|
|
13
|
+
* writer, and only the `config` field is replaced — abilities, graduations,
|
|
14
|
+
* review schedule, quiz history, and offer state are preserved (FR-033).
|
|
15
|
+
*
|
|
16
|
+
* Each tool is exposed as a factory closing over an optional `dirOverride`
|
|
17
|
+
* (the store's test seam): the registry uses the default instances (env /
|
|
18
|
+
* `~/.vibe-hero`), and tests build dir-scoped instances against a temp home.
|
|
19
|
+
*
|
|
20
|
+
* Source of truth: specs/001-vibe-hero-mvp/contracts/mcp-tools.md
|
|
21
|
+
* (`save_config` / `get_config`), spec.md FR-031 / FR-032 / FR-033.
|
|
22
|
+
*/
|
|
23
|
+
import { loadProfile, updateProfile } from "../profile/store.js";
|
|
24
|
+
import { ConfigSchema } from "../schemas/profile.js";
|
|
25
|
+
import { GetConfigInputSchema, SaveConfigInputSchema, } from "../schemas/tools.js";
|
|
26
|
+
import { defineTool } from "./types.js";
|
|
27
|
+
/**
|
|
28
|
+
* Normalize validated `save_config` input into a persisted {@link Config},
|
|
29
|
+
* preserving `createdAt` from any existing config and stamping `updatedAt`
|
|
30
|
+
* (and a first-write `createdAt`) to `now`.
|
|
31
|
+
*
|
|
32
|
+
* `quizLength` is optional on input; {@link ConfigSchema} supplies its default
|
|
33
|
+
* (4) when absent. Parsing through `ConfigSchema` guarantees the result matches
|
|
34
|
+
* the persisted contract before it ever reaches the store.
|
|
35
|
+
*
|
|
36
|
+
* @param input - Validated `save_config` input.
|
|
37
|
+
* @param existing - The current config, if the profile is already configured.
|
|
38
|
+
* @param now - ISO-8601 timestamp for `updatedAt` (and `createdAt` on first save).
|
|
39
|
+
* @returns A schema-valid {@link Config} ready to persist.
|
|
40
|
+
*/
|
|
41
|
+
const normalizeConfig = (input, existing, now) => ConfigSchema.parse({
|
|
42
|
+
toolsLearning: input.toolsLearning,
|
|
43
|
+
offerCadence: input.offerCadence,
|
|
44
|
+
proactiveOffers: input.proactiveOffers,
|
|
45
|
+
// Omit when absent so ConfigSchema applies its default (4); otherwise honor it.
|
|
46
|
+
...(input.quizLength !== undefined ? { quizLength: input.quizLength } : {}),
|
|
47
|
+
createdAt: existing?.createdAt ?? now,
|
|
48
|
+
updatedAt: now,
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Build the `save_config` tool module (US-0, FR-031/033).
|
|
52
|
+
*
|
|
53
|
+
* Validates input, then atomically replaces only the profile's `config` block
|
|
54
|
+
* via {@link updateProfile}. Because every other field is spread through
|
|
55
|
+
* untouched, re-running setup updates preferences without losing learning
|
|
56
|
+
* progress (FR-033). Returns `{ ok: true, config }` with the persisted config.
|
|
57
|
+
*
|
|
58
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
59
|
+
* @returns The erased registry entry for `save_config`.
|
|
60
|
+
*/
|
|
61
|
+
export const makeSaveConfigTool = (dirOverride) => defineTool({
|
|
62
|
+
name: "save_config",
|
|
63
|
+
description: "Persist setup configuration and clear the setup gate. Re-callable to update preferences.",
|
|
64
|
+
inputSchema: SaveConfigInputSchema,
|
|
65
|
+
handler: async (input) => {
|
|
66
|
+
const now = new Date().toISOString();
|
|
67
|
+
const next = await updateProfile((current) => ({
|
|
68
|
+
...current,
|
|
69
|
+
config: normalizeConfig(input, current.config, now),
|
|
70
|
+
}), dirOverride);
|
|
71
|
+
// `config` is always present here (we just wrote it); assert for the type.
|
|
72
|
+
const config = next.config;
|
|
73
|
+
if (config === undefined) {
|
|
74
|
+
throw new Error("save_config: profile.config missing after write");
|
|
75
|
+
}
|
|
76
|
+
return { ok: true, config };
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* Build the `get_config` tool module (US-0).
|
|
81
|
+
*
|
|
82
|
+
* Reads the profile (never throws — a missing/corrupt profile degrades to an
|
|
83
|
+
* unconfigured one) and reports whether `config` is present, echoing it when so.
|
|
84
|
+
* Skills/hooks use this to know the gate state without triggering it.
|
|
85
|
+
*
|
|
86
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
87
|
+
* @returns The erased registry entry for `get_config`.
|
|
88
|
+
*/
|
|
89
|
+
export const makeGetConfigTool = (dirOverride) => defineTool({
|
|
90
|
+
name: "get_config",
|
|
91
|
+
description: "Read the current configuration (or report its absence / gate state).",
|
|
92
|
+
inputSchema: GetConfigInputSchema,
|
|
93
|
+
handler: async () => {
|
|
94
|
+
const profile = await loadProfile(dirOverride);
|
|
95
|
+
return profile.config === undefined
|
|
96
|
+
? { configured: false }
|
|
97
|
+
: { configured: true, config: profile.config };
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
/** Default `save_config` module (env / `~/.vibe-hero`), used by the registry. */
|
|
101
|
+
export const saveConfigTool = makeSaveConfigTool();
|
|
102
|
+
/** Default `get_config` module (env / `~/.vibe-hero`), used by the registry. */
|
|
103
|
+
export const getConfigTool = makeGetConfigTool();
|
|
104
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/tools/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,YAAY,EAA6B,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAItB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAe,GAAG,CACtB,KAAsB,EACtB,QAA4B,EAC5B,GAAW,EACH,EAAE,CACV,YAAY,CAAC,KAAK,CAAC;IACjB,aAAa,EAAE,KAAK,CAAC,aAAa;IAClC,YAAY,EAAE,KAAK,CAAC,YAAY;IAChC,eAAe,EAAE,KAAK,CAAC,eAAe;IACtC,gFAAgF;IAChF,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,SAAS,EAAE,QAAQ,EAAE,SAAS,IAAI,GAAG;IACrC,SAAS,EAAE,GAAG;CACf,CAAC,CAAC;AAEL;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,WAAoB,EAAiB,EAAE,CACxE,UAAU,CAAC;IACT,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,0FAA0F;IAC5F,WAAW,EAAE,qBAAqB;IAClC,OAAO,EAAE,KAAK,EAAE,KAAK,EAA6B,EAAE;QAClD,MAAM,GAAG,GAAG,IAA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
+
*
|
|
4
|
+
* Every vibe-hero tool except `get_config` / `save_config` is gated behind
|
|
5
|
+
* first-run setup: until the learner profile has a `config` block, a gated tool
|
|
6
|
+
* returns the {@link SETUP_REQUIRED_RESULT} sentinel instead of running its
|
|
7
|
+
* handler (FR-032). This scopes the gate to vibe-hero's own actions only — it
|
|
8
|
+
* never blocks the host agent's normal work (FR-028).
|
|
9
|
+
*
|
|
10
|
+
* The two exempt tools are exactly the ones the setup skill needs to *clear* the
|
|
11
|
+
* gate (`save_config`) and to *inspect* gate state (`get_config`); gating those
|
|
12
|
+
* would deadlock setup.
|
|
13
|
+
*
|
|
14
|
+
* Source of truth: specs/001-vibe-hero-mvp/contracts/mcp-tools.md (SETUP_REQUIRED
|
|
15
|
+
* sentinel), spec.md FR-028 / FR-032.
|
|
16
|
+
*/
|
|
17
|
+
import type { SetupRequired } from "../schemas/tools.js";
|
|
18
|
+
import type { ToolHandler } from "./types.js";
|
|
19
|
+
/**
|
|
20
|
+
* Tools that bypass the setup gate. `get_config` reports gate state and
|
|
21
|
+
* `save_config` writes the `config` that clears the gate, so both must run
|
|
22
|
+
* before setup completes. Every other tool is gated.
|
|
23
|
+
*/
|
|
24
|
+
export declare const EXEMPT_TOOLS: ReadonlySet<string>;
|
|
25
|
+
/** Is `toolName` allowed to run while the profile is unconfigured? */
|
|
26
|
+
export declare const isExempt: (toolName: string) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The canonical SETUP_REQUIRED sentinel returned by gated tools when
|
|
29
|
+
* `profile.config` is absent. Validated against {@link SetupRequiredSchema} at
|
|
30
|
+
* module load so the shape can never drift from the contract.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SETUP_REQUIRED_RESULT: SetupRequired;
|
|
33
|
+
/**
|
|
34
|
+
* Wrap a tool handler with the first-run setup gate (FR-032).
|
|
35
|
+
*
|
|
36
|
+
* Before invoking `handler`, the wrapper loads the profile. If the tool is not
|
|
37
|
+
* exempt ({@link EXEMPT_TOOLS}) and `profile.config` is absent, it short-circuits
|
|
38
|
+
* with {@link SETUP_REQUIRED_RESULT} and the handler never runs. Otherwise the
|
|
39
|
+
* handler runs normally.
|
|
40
|
+
*
|
|
41
|
+
* `loadProfile` never throws (a missing/corrupt profile degrades to an empty,
|
|
42
|
+
* unconfigured profile), so an unconfigured first run reliably gates.
|
|
43
|
+
*
|
|
44
|
+
* @param toolName - The tool's registered name (used for the exempt check).
|
|
45
|
+
* @param handler - The wrapped tool handler.
|
|
46
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
47
|
+
* @returns A handler that enforces the gate before delegating.
|
|
48
|
+
*/
|
|
49
|
+
export declare const withSetupGate: <Args>(toolName: string, handler: ToolHandler<Args>, dirOverride?: string) => ToolHandler<Args>;
|
|
50
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/tools/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,YAAY,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAG3C,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,QAAQ,GAAI,UAAU,MAAM,KAAG,OAAqC,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAIlC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,IAAI,EAChC,UAAU,MAAM,EAChB,SAAS,WAAW,CAAC,IAAI,CAAC,EAC1B,cAAc,MAAM,KACnB,WAAW,CAAC,IAAI,CAUlB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Setup-gate wrapper for MCP tool handlers (T021).
|
|
3
|
+
*
|
|
4
|
+
* Every vibe-hero tool except `get_config` / `save_config` is gated behind
|
|
5
|
+
* first-run setup: until the learner profile has a `config` block, a gated tool
|
|
6
|
+
* returns the {@link SETUP_REQUIRED_RESULT} sentinel instead of running its
|
|
7
|
+
* handler (FR-032). This scopes the gate to vibe-hero's own actions only — it
|
|
8
|
+
* never blocks the host agent's normal work (FR-028).
|
|
9
|
+
*
|
|
10
|
+
* The two exempt tools are exactly the ones the setup skill needs to *clear* the
|
|
11
|
+
* gate (`save_config`) and to *inspect* gate state (`get_config`); gating those
|
|
12
|
+
* would deadlock setup.
|
|
13
|
+
*
|
|
14
|
+
* Source of truth: specs/001-vibe-hero-mvp/contracts/mcp-tools.md (SETUP_REQUIRED
|
|
15
|
+
* sentinel), spec.md FR-028 / FR-032.
|
|
16
|
+
*/
|
|
17
|
+
import { SetupRequiredSchema } from "../schemas/tools.js";
|
|
18
|
+
import { loadProfile } from "../profile/store.js";
|
|
19
|
+
/**
|
|
20
|
+
* Tools that bypass the setup gate. `get_config` reports gate state and
|
|
21
|
+
* `save_config` writes the `config` that clears the gate, so both must run
|
|
22
|
+
* before setup completes. Every other tool is gated.
|
|
23
|
+
*/
|
|
24
|
+
export const EXEMPT_TOOLS = new Set([
|
|
25
|
+
"get_config",
|
|
26
|
+
"save_config",
|
|
27
|
+
]);
|
|
28
|
+
/** Is `toolName` allowed to run while the profile is unconfigured? */
|
|
29
|
+
export const isExempt = (toolName) => EXEMPT_TOOLS.has(toolName);
|
|
30
|
+
/**
|
|
31
|
+
* The canonical SETUP_REQUIRED sentinel returned by gated tools when
|
|
32
|
+
* `profile.config` is absent. Validated against {@link SetupRequiredSchema} at
|
|
33
|
+
* module load so the shape can never drift from the contract.
|
|
34
|
+
*/
|
|
35
|
+
export const SETUP_REQUIRED_RESULT = SetupRequiredSchema.parse({
|
|
36
|
+
status: "SETUP_REQUIRED",
|
|
37
|
+
message: "Run vibe-hero setup first.",
|
|
38
|
+
setupSkill: "vibe-hero-setup",
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Wrap a tool handler with the first-run setup gate (FR-032).
|
|
42
|
+
*
|
|
43
|
+
* Before invoking `handler`, the wrapper loads the profile. If the tool is not
|
|
44
|
+
* exempt ({@link EXEMPT_TOOLS}) and `profile.config` is absent, it short-circuits
|
|
45
|
+
* with {@link SETUP_REQUIRED_RESULT} and the handler never runs. Otherwise the
|
|
46
|
+
* handler runs normally.
|
|
47
|
+
*
|
|
48
|
+
* `loadProfile` never throws (a missing/corrupt profile degrades to an empty,
|
|
49
|
+
* unconfigured profile), so an unconfigured first run reliably gates.
|
|
50
|
+
*
|
|
51
|
+
* @param toolName - The tool's registered name (used for the exempt check).
|
|
52
|
+
* @param handler - The wrapped tool handler.
|
|
53
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
54
|
+
* @returns A handler that enforces the gate before delegating.
|
|
55
|
+
*/
|
|
56
|
+
export const withSetupGate = (toolName, handler, dirOverride) => {
|
|
57
|
+
return async (args) => {
|
|
58
|
+
if (!isExempt(toolName)) {
|
|
59
|
+
const profile = await loadProfile(dirOverride);
|
|
60
|
+
if (profile.config === undefined) {
|
|
61
|
+
return SETUP_REQUIRED_RESULT;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return handler(args);
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/tools/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAwB,IAAI,GAAG,CAAC;IACvD,YAAY;IACZ,aAAa;CACd,CAAC,CAAC;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAW,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAElF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAkB,mBAAmB,CAAC,KAAK,CAAC;IAC5E,MAAM,EAAE,gBAAgB;IACxB,OAAO,EAAE,4BAA4B;IACrC,UAAU,EAAE,iBAAiB;CAC9B,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,QAAgB,EAChB,OAA0B,EAC1B,WAAoB,EACD,EAAE;IACrB,OAAO,KAAK,EAAE,IAAU,EAAuB,EAAE;QAC/C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxB,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;YAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO,qBAAqB,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Real `get_guidance` tool module (T027, US-2).
|
|
3
|
+
*
|
|
4
|
+
* Returns teaching guidance plus a concrete next step for a topic. Given a `key`
|
|
5
|
+
* it guides on that exact `(topic × class)`; with NO `key` it auto-selects the
|
|
6
|
+
* learner's weakest/stale in-scope topic (the same weakness ranking
|
|
7
|
+
* `get_status` uses for `suggestions`) so "what should I learn next?" resolves
|
|
8
|
+
* without the user naming a topic.
|
|
9
|
+
*
|
|
10
|
+
* Guidance text is pulled from the topic's authored content: the `guidance` of
|
|
11
|
+
* an item at — or, failing that, nearest above — the learner's current tier,
|
|
12
|
+
* falling back to the topic `summary` when the topic has no items. The next step
|
|
13
|
+
* is a `quiz` when the topic has gradeable items (the practice path, FR-021),
|
|
14
|
+
* else a `read` nudge toward the summary.
|
|
15
|
+
*
|
|
16
|
+
* Telemetry-free (SC-011): everything is derived from the bundled catalog + the
|
|
17
|
+
* profile's `abilities`/`graduations`; no observation/offer state is read.
|
|
18
|
+
* Gated (FR-032) — `index.ts` returns SETUP_REQUIRED before the handler runs
|
|
19
|
+
* when unconfigured, so `config.toolsLearning` is available for the default tool.
|
|
20
|
+
*
|
|
21
|
+
* Exposed as a `dirOverride`-closing factory mirroring `config.ts`.
|
|
22
|
+
*
|
|
23
|
+
* Source of truth: specs/001-vibe-hero-mvp/contracts/mcp-tools.md
|
|
24
|
+
* (`get_guidance`), spec.md US-2 / FR-021 / SC-011.
|
|
25
|
+
*/
|
|
26
|
+
import { type AnyToolModule } from "./types.js";
|
|
27
|
+
/**
|
|
28
|
+
* Build the `get_guidance` tool module (US-2).
|
|
29
|
+
*
|
|
30
|
+
* @param dirOverride - Profile-directory override (test seam); see `profileDir`.
|
|
31
|
+
* @returns The erased registry entry for `get_guidance`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const makeGetGuidanceTool: (dirOverride?: string) => AnyToolModule;
|
|
34
|
+
/** Default `get_guidance` module (env / `~/.vibe-hero`), used by the registry. */
|
|
35
|
+
export declare const getGuidanceTool: AnyToolModule;
|
|
36
|
+
//# sourceMappingURL=guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guidance.d.ts","sourceRoot":"","sources":["../../src/tools/guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAiBH,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAuG5D;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,cAAc,MAAM,KAAG,aAYvD,CAAC;AAEL,kFAAkF;AAClF,eAAO,MAAM,eAAe,EAAE,aAAqC,CAAC"}
|