@flue/client 0.0.6 → 0.0.7

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 (2) hide show
  1. package/dist/index.mjs +4 -36
  2. package/package.json +27 -27
package/dist/index.mjs CHANGED
@@ -191,12 +191,6 @@ async function runShell(command, options) {
191
191
  //#endregion
192
192
  //#region src/prompt.ts
193
193
  /**
194
- * Checks if a Valibot schema represents a plain string type.
195
- */
196
- function isStringSchema(schema) {
197
- return schema.type === "string";
198
- }
199
- /**
200
194
  * Checks if a skill name is a file path (contains '/' or ends with '.md').
201
195
  */
202
196
  function isFilePath(name) {
@@ -222,10 +216,9 @@ function buildSkillPrompt(name, args, schema) {
222
216
  isFilePath(name) ? `Read and use the .opencode/skills/${name} skill.` : `Use the ${name} skill.`
223
217
  ];
224
218
  if (args && Object.keys(args).length > 0) parts.push(`\nArguments:\n${JSON.stringify(args, null, 2)}`);
225
- if (schema) if (isStringSchema(schema)) parts.push("\nWhen complete, output your result between these exact delimiters (the result can contain any content including code blocks):", "---RESULT_START---", "Your text output here", "---RESULT_END---");
226
- else {
219
+ if (schema) {
227
220
  const { $schema: _, ...schemaWithoutMeta } = toJsonSchema(schema, { errorMode: "ignore" });
228
- parts.push("\nWhen complete, output your result between these exact delimiters as JSON conforming to this schema:", "```json", JSON.stringify(schemaWithoutMeta, null, 2), "```", "", "Format:", "---RESULT_START---", "{\"key\": \"value\"}", "---RESULT_END---");
221
+ parts.push("\nWhen complete, you MUST output your result between these exact delimiters conforming to this schema:", "```json", JSON.stringify(schemaWithoutMeta, null, 2), "```", "", "Example: (Object)", "---RESULT_START---", "{\"key\": \"value\"}", "---RESULT_END---", "", "Example: (String)", "---RESULT_START---", "Hello, world!", "---RESULT_END---");
229
222
  }
230
223
  return parts.join("\n");
231
224
  }
@@ -255,35 +248,10 @@ function extractResult(parts, schema, sessionId) {
255
248
  rawOutput: allText
256
249
  });
257
250
  }
258
- console.log(`[flue] extractResult: found result block (${resultBlock.length} chars, session: ${sessionId})`);
259
- if (schema.type === "string") {
260
- const parseResult = v.safeParse(schema, resultBlock);
261
- if (!parseResult.success) {
262
- console.error("[flue] extractResult: string validation failed", parseResult.issues);
263
- throw new SkillOutputError("Result validation failed for string schema.", {
264
- sessionId,
265
- rawOutput: resultBlock,
266
- validationErrors: parseResult.issues
267
- });
268
- }
269
- console.log(`[flue] extractResult: validated string result (${resultBlock.length} chars)`);
270
- return parseResult.output;
271
- }
272
- let parsed;
273
- try {
274
- parsed = JSON.parse(resultBlock);
275
- } catch (err) {
276
- console.error(`[flue] extractResult: JSON parse failed for block: ${resultBlock.slice(0, 200)}`);
277
- throw new SkillOutputError("Failed to parse result block as JSON.", {
278
- sessionId,
279
- rawOutput: resultBlock,
280
- validationErrors: err
281
- });
282
- }
283
- const parseResult = v.safeParse(schema, parsed);
251
+ const parseResult = v.safeParse(schema, resultBlock);
284
252
  if (!parseResult.success) {
285
253
  console.error("[flue] extractResult: schema validation failed", parseResult.issues);
286
- console.error("[flue] extractResult: parsed value was:", JSON.stringify(parsed));
254
+ console.error("[flue] extractResult: parsed value was:", JSON.stringify(resultBlock));
287
255
  throw new SkillOutputError("Result does not match the expected schema.", {
288
256
  sessionId,
289
257
  rawOutput: resultBlock,
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
1
  {
2
- "name": "@flue/client",
3
- "version": "0.0.6",
4
- "type": "module",
5
- "exports": {
6
- ".": {
7
- "types": "./dist/index.d.mts",
8
- "import": "./dist/index.mjs"
9
- }
10
- },
11
- "main": "./dist/index.mjs",
12
- "types": "./dist/index.d.mts",
13
- "files": [
14
- "dist"
15
- ],
16
- "scripts": {
17
- "build": "tsdown",
18
- "check:types": "tsc --noEmit"
19
- },
20
- "dependencies": {
21
- "@opencode-ai/sdk": "latest",
22
- "@valibot/to-json-schema": "^1.0.0",
23
- "valibot": "^1.0.0"
24
- },
25
- "devDependencies": {
26
- "tsdown": "^0.20.3"
27
- }
28
- }
2
+ "name": "@flue/client",
3
+ "version": "0.0.7",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.mts",
8
+ "import": "./dist/index.mjs"
9
+ }
10
+ },
11
+ "main": "./dist/index.mjs",
12
+ "types": "./dist/index.d.mts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "dependencies": {
17
+ "@opencode-ai/sdk": "^1.1.56",
18
+ "@valibot/to-json-schema": "^1.0.0",
19
+ "valibot": "^1.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "tsdown": "^0.20.3"
23
+ },
24
+ "scripts": {
25
+ "build": "tsdown",
26
+ "check:types": "tsc --noEmit"
27
+ }
28
+ }