poe-code 3.0.196 → 3.0.198
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/dist/cli/commands/configure.d.ts +0 -7
- package/dist/cli/commands/configure.js +11 -14
- package/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/provider.js +8 -1
- package/dist/cli/commands/provider.js.map +1 -1
- package/dist/index.js +263 -269
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js +6 -20
- package/dist/providers/claude-code.js.map +3 -3
- package/dist/providers/codex.js +6 -20
- package/dist/providers/codex.js.map +3 -3
- package/dist/providers/create-provider.js +0 -2
- package/dist/providers/create-provider.js.map +1 -1
- package/dist/providers/goose.js +14 -25
- package/dist/providers/goose.js.map +3 -3
- package/dist/providers/kimi.js +6 -20
- package/dist/providers/kimi.js.map +3 -3
- package/dist/providers/opencode.js +6 -20
- package/dist/providers/opencode.js.map +3 -3
- package/dist/providers/poe-agent.js +66 -84
- package/dist/providers/poe-agent.js.map +4 -4
- package/dist/utils/command-checks.d.ts +2 -1
- package/dist/utils/command-checks.js +3 -1
- package/dist/utils/command-checks.js.map +1 -1
- package/package.json +4 -1
- package/packages/memory/dist/cache.js +1 -1
- package/packages/memory/dist/explain.js +1 -1
- package/packages/memory/dist/index.js +18 -7
- package/packages/memory/dist/index.js.map +3 -3
- package/packages/memory/dist/query.js +1 -1
- package/packages/memory/dist/tokens.js +1 -1
- package/packages/superintendent/dist/cli.d.ts +2 -0
- package/packages/superintendent/dist/cli.js +41 -0
- package/packages/superintendent/dist/commands/builder-group.d.ts +52 -0
- package/packages/superintendent/dist/commands/builder-group.js +73 -0
- package/packages/superintendent/dist/commands/complete.d.ts +19 -0
- package/packages/superintendent/dist/commands/complete.js +54 -0
- package/packages/superintendent/dist/commands/index.d.ts +4 -0
- package/packages/superintendent/dist/commands/index.js +4 -0
- package/packages/superintendent/dist/commands/inspector-group.d.ts +115 -0
- package/packages/superintendent/dist/commands/inspector-group.js +133 -0
- package/packages/superintendent/dist/commands/install.d.ts +31 -0
- package/packages/superintendent/dist/commands/install.js +148 -0
- package/packages/superintendent/dist/commands/plan-path.d.ts +9 -0
- package/packages/superintendent/dist/commands/plan-path.js +40 -0
- package/packages/superintendent/dist/commands/poe-agent-runner.d.ts +5 -0
- package/packages/superintendent/dist/commands/poe-agent-runner.js +27 -0
- package/packages/superintendent/dist/commands/run.d.ts +86 -0
- package/packages/superintendent/dist/commands/run.js +945 -0
- package/packages/superintendent/dist/commands/superintendent-group.d.ts +325 -0
- package/packages/superintendent/dist/commands/superintendent-group.js +238 -0
- package/packages/superintendent/dist/config-scope.d.ts +8 -0
- package/packages/superintendent/dist/config-scope.js +9 -0
- package/packages/superintendent/dist/direct-execution.d.ts +1 -0
- package/packages/superintendent/dist/direct-execution.js +20 -0
- package/packages/superintendent/dist/document/parse.d.ts +59 -0
- package/packages/superintendent/dist/document/parse.js +409 -0
- package/packages/superintendent/dist/document/tasks.d.ts +12 -0
- package/packages/superintendent/dist/document/tasks.js +96 -0
- package/packages/superintendent/dist/document/write.d.ts +6 -0
- package/packages/superintendent/dist/document/write.js +156 -0
- package/packages/superintendent/dist/index.d.ts +12 -0
- package/packages/superintendent/dist/index.js +15 -0
- package/packages/superintendent/dist/mcp.d.ts +24 -0
- package/packages/superintendent/dist/mcp.js +202 -0
- package/packages/superintendent/dist/runtime/agentic-tools.d.ts +33 -0
- package/packages/superintendent/dist/runtime/agentic-tools.js +74 -0
- package/packages/superintendent/dist/runtime/loop.d.ts +88 -0
- package/packages/superintendent/dist/runtime/loop.js +446 -0
- package/packages/superintendent/dist/runtime/resolve-cwd.d.ts +2 -0
- package/packages/superintendent/dist/runtime/resolve-cwd.js +10 -0
- package/packages/superintendent/dist/runtime/run-builder.d.ts +13 -0
- package/packages/superintendent/dist/runtime/run-builder.js +102 -0
- package/packages/superintendent/dist/runtime/run-inspector.d.ts +16 -0
- package/packages/superintendent/dist/runtime/run-inspector.js +119 -0
- package/packages/superintendent/dist/runtime/run-owner-review.d.ts +18 -0
- package/packages/superintendent/dist/runtime/run-owner-review.js +208 -0
- package/packages/superintendent/dist/runtime/run-superintendent.d.ts +13 -0
- package/packages/superintendent/dist/runtime/run-superintendent.js +208 -0
- package/packages/superintendent/dist/runtime/system-prompt.d.ts +17 -0
- package/packages/superintendent/dist/runtime/system-prompt.js +54 -0
- package/packages/superintendent/dist/runtime/templates.d.ts +22 -0
- package/packages/superintendent/dist/runtime/templates.js +23 -0
- package/packages/superintendent/dist/runtime/types.d.ts +4 -0
- package/packages/superintendent/dist/runtime/types.js +1 -0
- package/packages/superintendent/dist/runtime/workflow-tool.d.ts +29 -0
- package/packages/superintendent/dist/runtime/workflow-tool.js +83 -0
- package/packages/superintendent/dist/state/machine.d.ts +14 -0
- package/packages/superintendent/dist/state/machine.js +53 -0
- package/packages/superintendent/dist/templates/SKILL_superintendent.md +193 -0
- package/packages/superintendent/dist/testing/index.d.ts +2 -0
- package/packages/superintendent/dist/testing/index.js +1 -0
- package/packages/superintendent/dist/testing/simulation.d.ts +57 -0
- package/packages/superintendent/dist/testing/simulation.js +346 -0
- package/dist/providers/tiny-http-mcp-server.d.ts +0 -22
- package/dist/providers/tiny-http-mcp-server.js +0 -1471
- package/dist/providers/tiny-http-mcp-server.js.map +0 -7
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { Volume, createFsFromVolume } from "memfs";
|
|
3
|
+
import { resolveWorkflowPath } from "@poe-code/agent-harness-tools";
|
|
4
|
+
import { isMap, parseDocument } from "yaml";
|
|
5
|
+
import { parseSuperintendentDoc, superintendentDocumentSchemaId } from "../document/parse.js";
|
|
6
|
+
import { runLoop } from "../runtime/loop.js";
|
|
7
|
+
function createSimulationFs(options) {
|
|
8
|
+
const cwd = "/repo";
|
|
9
|
+
const homeDir = "/home/test";
|
|
10
|
+
const docPath = options.docPath ?? "docs/plans/plan.md";
|
|
11
|
+
const absoluteDocPath = resolveWorkflowPath(docPath, cwd, homeDir);
|
|
12
|
+
const docContent = options.maxRounds === undefined
|
|
13
|
+
? options.docContent
|
|
14
|
+
: writeMaxRounds(absoluteDocPath, options.docContent, options.maxRounds);
|
|
15
|
+
const files = {
|
|
16
|
+
[absoluteDocPath]: docContent,
|
|
17
|
+
...Object.fromEntries(Object.entries(options.files ?? {}).map(([filePath, content]) => [
|
|
18
|
+
path.join(cwd, filePath),
|
|
19
|
+
content
|
|
20
|
+
]))
|
|
21
|
+
};
|
|
22
|
+
const volume = Volume.fromJSON(files, "/");
|
|
23
|
+
const rawFs = createFsFromVolume(volume).promises;
|
|
24
|
+
const fs = {
|
|
25
|
+
readFile: (filePath, encoding) => rawFs.readFile(filePath, encoding),
|
|
26
|
+
writeFile: async (filePath, content) => {
|
|
27
|
+
await rawFs.mkdir(path.dirname(filePath), { recursive: true });
|
|
28
|
+
await rawFs.writeFile(filePath, content, { encoding: "utf8" });
|
|
29
|
+
},
|
|
30
|
+
readdir: (filePath) => rawFs.readdir(filePath),
|
|
31
|
+
open: (filePath, flags) => rawFs.open(filePath, flags),
|
|
32
|
+
stat: async (filePath) => {
|
|
33
|
+
const stat = await rawFs.stat(filePath);
|
|
34
|
+
return {
|
|
35
|
+
isFile: () => stat.isFile(),
|
|
36
|
+
isDirectory: () => stat.isDirectory(),
|
|
37
|
+
mtimeMs: Number(stat.mtimeMs)
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
unlink: async (filePath) => {
|
|
41
|
+
await rawFs.unlink(filePath);
|
|
42
|
+
},
|
|
43
|
+
mkdir: async (filePath, mkdirOptions) => {
|
|
44
|
+
await rawFs.mkdir(filePath, mkdirOptions);
|
|
45
|
+
},
|
|
46
|
+
rmdir: async (filePath) => {
|
|
47
|
+
await rawFs.rmdir(filePath);
|
|
48
|
+
},
|
|
49
|
+
rename: async (oldPath, newPath) => {
|
|
50
|
+
await rawFs.mkdir(path.dirname(newPath), { recursive: true });
|
|
51
|
+
await rawFs.rename(oldPath, newPath);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
fs,
|
|
56
|
+
docPath,
|
|
57
|
+
absoluteDocPath,
|
|
58
|
+
cwd,
|
|
59
|
+
homeDir,
|
|
60
|
+
rawFs
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async function applyFileChanges(rawFs, cwd, changes) {
|
|
64
|
+
for (const [filePath, content] of Object.entries(changes)) {
|
|
65
|
+
await fsWriteFile(rawFs, path.join(cwd, filePath), content);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function fsWriteFile(rawFs, absolutePath, content) {
|
|
69
|
+
await rawFs.mkdir(path.dirname(absolutePath), { recursive: true });
|
|
70
|
+
await rawFs.writeFile(absolutePath, content, { encoding: "utf8" });
|
|
71
|
+
}
|
|
72
|
+
function normalizeAgentResult(output) {
|
|
73
|
+
const workflowToolCalls = output.toolCalls ?? readWorkflowToolCallsFromText(output.stdout);
|
|
74
|
+
return {
|
|
75
|
+
stdout: output.stdout,
|
|
76
|
+
stderr: output.stderr ?? "",
|
|
77
|
+
exitCode: output.exitCode ?? 0,
|
|
78
|
+
...(output.summary ? { summary: output.summary } : {}),
|
|
79
|
+
...(output.log ? { log: output.log } : {}),
|
|
80
|
+
...(output.output ? { output: output.output } : {}),
|
|
81
|
+
...(output.text ? { text: output.text } : {}),
|
|
82
|
+
...(output.transition !== undefined ? { transition: output.transition } : {}),
|
|
83
|
+
...(workflowToolCalls !== undefined ? { toolCalls: workflowToolCalls } : {}),
|
|
84
|
+
...(output.sessionResult !== undefined ? { sessionResult: output.sessionResult } : {})
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function successTurn(assertPrompt, fileChanges) {
|
|
88
|
+
return createSuccessfulTurn({
|
|
89
|
+
assertPrompt,
|
|
90
|
+
fileChanges,
|
|
91
|
+
stdout: ""
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export function failTurn(stderr, assertPrompt, fileChanges) {
|
|
95
|
+
return {
|
|
96
|
+
...(assertPrompt ? { assertPrompt } : {}),
|
|
97
|
+
...(fileChanges ? { fileChanges } : {}),
|
|
98
|
+
output: {
|
|
99
|
+
stdout: "",
|
|
100
|
+
stderr,
|
|
101
|
+
exitCode: 1
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function builderTurn(fileChanges, assertPrompt) {
|
|
106
|
+
return createSuccessfulTurn({
|
|
107
|
+
assertPrompt,
|
|
108
|
+
fileChanges,
|
|
109
|
+
stdout: ""
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
export function inspectorTurn(summary, assertPrompt) {
|
|
113
|
+
return createSuccessfulTurn({
|
|
114
|
+
assertPrompt,
|
|
115
|
+
stdout: summary
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
export function superintendentTurn(transition, fileChanges, assertPrompt) {
|
|
119
|
+
return createSuccessfulTurn({
|
|
120
|
+
assertPrompt,
|
|
121
|
+
fileChanges,
|
|
122
|
+
stdout: transition ? formatWorkflowTransition(transition) : ""
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
export function ownerApproveTurn(assertPrompt) {
|
|
126
|
+
return createSuccessfulTurn({
|
|
127
|
+
assertPrompt,
|
|
128
|
+
stdout: formatWorkflowTransition({ action: "approve_completion" })
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
export function ownerRejectTurn(feedback, assertPrompt) {
|
|
132
|
+
return createSuccessfulTurn({
|
|
133
|
+
assertPrompt,
|
|
134
|
+
stdout: formatWorkflowTransition({ action: "request_changes", feedback })
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export function createSuperintendentSimulation(options) {
|
|
138
|
+
return {
|
|
139
|
+
async run() {
|
|
140
|
+
const { fs, docPath, absoluteDocPath, cwd, homeDir, rawFs } = createSimulationFs(options);
|
|
141
|
+
const turns = [...options.turns];
|
|
142
|
+
const prompts = [];
|
|
143
|
+
const runs = [];
|
|
144
|
+
const readFile = async (filePath) => fs.readFile(path.join(cwd, filePath), "utf8");
|
|
145
|
+
const writeFile = async (filePath, content) => fsWriteFile(rawFs, path.join(cwd, filePath), content);
|
|
146
|
+
const readDoc = async () => parseSuperintendentDoc(absoluteDocPath, await fs.readFile(absoluteDocPath, "utf8"));
|
|
147
|
+
const failureContext = {
|
|
148
|
+
prompts,
|
|
149
|
+
runs,
|
|
150
|
+
fs,
|
|
151
|
+
readFile,
|
|
152
|
+
readDoc
|
|
153
|
+
};
|
|
154
|
+
try {
|
|
155
|
+
const result = await runLoop({
|
|
156
|
+
docPath,
|
|
157
|
+
cwd,
|
|
158
|
+
homeDir,
|
|
159
|
+
...(options.signal ? { signal: options.signal } : {}),
|
|
160
|
+
fs,
|
|
161
|
+
runAgent: async (input) => {
|
|
162
|
+
const turn = turns.shift();
|
|
163
|
+
if (!turn) {
|
|
164
|
+
throw new Error("Superintendent simulation ran out of turns.");
|
|
165
|
+
}
|
|
166
|
+
prompts.push(input.prompt);
|
|
167
|
+
runs.push(input);
|
|
168
|
+
if (turn.assertPrompt) {
|
|
169
|
+
await turn.assertPrompt(input.prompt, {
|
|
170
|
+
fs,
|
|
171
|
+
readFile,
|
|
172
|
+
writeFile,
|
|
173
|
+
readDoc
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (turn.fileChanges) {
|
|
177
|
+
await applyFileChanges(rawFs, cwd, turn.fileChanges);
|
|
178
|
+
}
|
|
179
|
+
return normalizeAgentResult(turn.output);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
return {
|
|
183
|
+
result,
|
|
184
|
+
...failureContext
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
throw attachSimulationContext(error, failureContext);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function createSuccessfulTurn(options) {
|
|
194
|
+
return {
|
|
195
|
+
...(options.assertPrompt ? { assertPrompt: options.assertPrompt } : {}),
|
|
196
|
+
...(options.fileChanges ? { fileChanges: options.fileChanges } : {}),
|
|
197
|
+
output: {
|
|
198
|
+
stdout: options.stdout,
|
|
199
|
+
exitCode: 0
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function formatWorkflowTransition(transition) {
|
|
204
|
+
return "workflow_transition(" + JSON.stringify(transition) + ")";
|
|
205
|
+
}
|
|
206
|
+
function readWorkflowToolCallsFromText(stdout) {
|
|
207
|
+
for (const line of splitLines(stdout)) {
|
|
208
|
+
const payload = readWorkflowTransitionTextPayload(line.trim());
|
|
209
|
+
if (payload === undefined) {
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
return [
|
|
213
|
+
{
|
|
214
|
+
name: "workflow_transition",
|
|
215
|
+
arguments: payload
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
function readWorkflowTransitionTextPayload(line) {
|
|
222
|
+
const prefix = "workflow_transition(";
|
|
223
|
+
if (line.startsWith(prefix) && line.endsWith(")")) {
|
|
224
|
+
return line.slice(prefix.length, -1).trim();
|
|
225
|
+
}
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
function attachSimulationContext(error, context) {
|
|
229
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
230
|
+
return Object.assign(normalizedError, context);
|
|
231
|
+
}
|
|
232
|
+
function splitLines(value) {
|
|
233
|
+
return value.split("\n").map((line) => (line.endsWith("\r") ? line.slice(0, -1) : line));
|
|
234
|
+
}
|
|
235
|
+
function writeMaxRounds(filePath, content, maxRounds) {
|
|
236
|
+
const parts = splitDocument(filePath, content);
|
|
237
|
+
const frontmatterDocument = parseDocument(parts.frontmatterText);
|
|
238
|
+
if (frontmatterDocument.errors.length > 0) {
|
|
239
|
+
throw new Error(filePath + ": invalid YAML frontmatter: " + frontmatterDocument.errors[0].message);
|
|
240
|
+
}
|
|
241
|
+
frontmatterDocument.set("max_rounds", maxRounds);
|
|
242
|
+
canonicalizeFrontmatter(frontmatterDocument);
|
|
243
|
+
return [
|
|
244
|
+
parts.bom,
|
|
245
|
+
"---",
|
|
246
|
+
parts.lineBreak,
|
|
247
|
+
formatFrontmatter(frontmatterDocument.toString(), parts.lineBreak),
|
|
248
|
+
parts.frontmatterSuffix,
|
|
249
|
+
parts.body
|
|
250
|
+
].join("");
|
|
251
|
+
}
|
|
252
|
+
function getTopLevelMap(frontmatterDocument) {
|
|
253
|
+
if (!frontmatterDocument.contents || !isMap(frontmatterDocument.contents)) {
|
|
254
|
+
throw new Error("Expected superintendent frontmatter to be a top-level object.");
|
|
255
|
+
}
|
|
256
|
+
return frontmatterDocument.contents;
|
|
257
|
+
}
|
|
258
|
+
function reorderTopLevelKeys(map, keys) {
|
|
259
|
+
const remaining = [...map.items];
|
|
260
|
+
const ordered = keys.flatMap((key) => {
|
|
261
|
+
const index = remaining.findIndex((item) => item.key?.toString() === key);
|
|
262
|
+
return index === -1 ? [] : remaining.splice(index, 1);
|
|
263
|
+
});
|
|
264
|
+
map.items = [...ordered, ...remaining];
|
|
265
|
+
}
|
|
266
|
+
function canonicalizeFrontmatter(frontmatterDocument) {
|
|
267
|
+
const map = getTopLevelMap(frontmatterDocument);
|
|
268
|
+
map.delete("maxExperiments");
|
|
269
|
+
map.delete("metricTimeout");
|
|
270
|
+
map.delete("planPath");
|
|
271
|
+
map.set("$schema", superintendentDocumentSchemaId);
|
|
272
|
+
map.set("kind", "superintendent");
|
|
273
|
+
map.set("version", 1);
|
|
274
|
+
reorderTopLevelKeys(map, ["$schema", "kind", "version"]);
|
|
275
|
+
}
|
|
276
|
+
function splitDocument(filePath, content) {
|
|
277
|
+
const bom = content.startsWith("\uFEFF") ? "\uFEFF" : "";
|
|
278
|
+
const normalizedContent = bom ? content.slice(1) : content;
|
|
279
|
+
const lineBreak = readOpeningLineBreak(normalizedContent);
|
|
280
|
+
if (lineBreak === undefined) {
|
|
281
|
+
throw new Error(filePath + ": expected YAML frontmatter delimited by ---");
|
|
282
|
+
}
|
|
283
|
+
const frontmatterStart = 3 + lineBreak.length;
|
|
284
|
+
const closingFenceIndex = findClosingFence(normalizedContent, frontmatterStart, filePath);
|
|
285
|
+
const frontmatterEnd = readFrontmatterEnd(normalizedContent, closingFenceIndex);
|
|
286
|
+
const bodyStart = readBodyStart(normalizedContent, closingFenceIndex + 4);
|
|
287
|
+
return {
|
|
288
|
+
bom,
|
|
289
|
+
lineBreak,
|
|
290
|
+
frontmatterText: normalizedContent.slice(frontmatterStart, frontmatterEnd),
|
|
291
|
+
frontmatterSuffix: normalizedContent.slice(frontmatterEnd, bodyStart),
|
|
292
|
+
body: normalizedContent.slice(bodyStart)
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
function readOpeningLineBreak(content) {
|
|
296
|
+
if (!content.startsWith("---")) {
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
const nextCharacter = content[3];
|
|
300
|
+
if (nextCharacter === "\n") {
|
|
301
|
+
return "\n";
|
|
302
|
+
}
|
|
303
|
+
if (nextCharacter === "\r" && content[4] === "\n") {
|
|
304
|
+
return "\r\n";
|
|
305
|
+
}
|
|
306
|
+
return nextCharacter === undefined ? "\n" : undefined;
|
|
307
|
+
}
|
|
308
|
+
function findClosingFence(content, searchFrom, filePath) {
|
|
309
|
+
let currentIndex = searchFrom - 1;
|
|
310
|
+
while (currentIndex < content.length) {
|
|
311
|
+
const candidateIndex = content.indexOf("\n---", currentIndex);
|
|
312
|
+
if (candidateIndex === -1) {
|
|
313
|
+
throw new Error(filePath + ": missing YAML frontmatter end delimiter (---)");
|
|
314
|
+
}
|
|
315
|
+
const fenceEnd = candidateIndex + 4;
|
|
316
|
+
const nextCharacter = content[fenceEnd];
|
|
317
|
+
if (nextCharacter === "\n" || nextCharacter === undefined) {
|
|
318
|
+
return candidateIndex;
|
|
319
|
+
}
|
|
320
|
+
if (nextCharacter === "\r" && content[fenceEnd + 1] === "\n") {
|
|
321
|
+
return candidateIndex;
|
|
322
|
+
}
|
|
323
|
+
currentIndex = fenceEnd;
|
|
324
|
+
}
|
|
325
|
+
throw new Error(filePath + ": missing YAML frontmatter end delimiter (---)");
|
|
326
|
+
}
|
|
327
|
+
function readBodyStart(content, bodyStart) {
|
|
328
|
+
const nextCharacter = content[bodyStart];
|
|
329
|
+
if (nextCharacter === "\n") {
|
|
330
|
+
return bodyStart + 1;
|
|
331
|
+
}
|
|
332
|
+
if (nextCharacter === "\r" && content[bodyStart + 1] === "\n") {
|
|
333
|
+
return bodyStart + 2;
|
|
334
|
+
}
|
|
335
|
+
return bodyStart;
|
|
336
|
+
}
|
|
337
|
+
function readFrontmatterEnd(content, closingFenceIndex) {
|
|
338
|
+
return content[closingFenceIndex - 1] === "\r" ? closingFenceIndex - 1 : closingFenceIndex;
|
|
339
|
+
}
|
|
340
|
+
function formatFrontmatter(serialized, lineBreak) {
|
|
341
|
+
const normalized = serialized.endsWith("\n") ? serialized.slice(0, -1) : serialized;
|
|
342
|
+
if (lineBreak === "\n") {
|
|
343
|
+
return normalized;
|
|
344
|
+
}
|
|
345
|
+
return normalized.replaceAll("\n", lineBreak);
|
|
346
|
+
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
interface TinyHttpMcpServerOauthConfig {
|
|
2
|
-
resource: string;
|
|
3
|
-
authorizationServers: string[];
|
|
4
|
-
scopesSupported: string[];
|
|
5
|
-
requiredScopes: string[];
|
|
6
|
-
bearerMethodsSupported: string[];
|
|
7
|
-
verifierModule: string;
|
|
8
|
-
verifierExport: string;
|
|
9
|
-
}
|
|
10
|
-
interface TinyHttpMcpServerConfigureContext extends Record<string, unknown> {
|
|
11
|
-
name: string;
|
|
12
|
-
version: string;
|
|
13
|
-
listen: {
|
|
14
|
-
hostname: string;
|
|
15
|
-
path: string;
|
|
16
|
-
port: number;
|
|
17
|
-
};
|
|
18
|
-
oauth: TinyHttpMcpServerOauthConfig;
|
|
19
|
-
}
|
|
20
|
-
export declare const tinyHttpMcpServerService: import("../cli/service-registry.js").ProviderService<TinyHttpMcpServerConfigureContext, TinyHttpMcpServerConfigureContext, any>;
|
|
21
|
-
export declare const provider: import("../cli/service-registry.js").ProviderService<TinyHttpMcpServerConfigureContext, TinyHttpMcpServerConfigureContext, any>;
|
|
22
|
-
export {};
|