opencode-sat 0.0.15 → 0.0.16-next.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/dist/sat.d.ts.map +1 -1
- package/dist/sat.js +16 -25
- package/dist/sat.js.map +1 -1
- package/dist/src/append.d.ts +12 -9
- package/dist/src/append.d.ts.map +1 -1
- package/dist/src/append.js +32 -37
- package/dist/src/append.js.map +1 -1
- package/dist/src/format-prompt.d.ts.map +1 -1
- package/dist/src/format-prompt.js +39 -30
- package/dist/src/format-prompt.js.map +1 -1
- package/dist/src/format.d.ts +16 -0
- package/dist/src/format.d.ts.map +1 -0
- package/dist/src/format.js +30 -0
- package/dist/src/format.js.map +1 -0
- package/dist/src/process.d.ts +7 -9
- package/dist/src/process.d.ts.map +1 -1
- package/dist/src/process.js +8 -30
- package/dist/src/process.js.map +1 -1
- package/dist/src/tools.d.ts +24 -15
- package/dist/src/tools.d.ts.map +1 -1
- package/dist/src/tools.js +135 -159
- package/dist/src/tools.js.map +1 -1
- package/dist/src/utils/compare.d.ts.map +1 -1
- package/dist/src/utils/compare.js +4 -2
- package/dist/src/utils/compare.js.map +1 -1
- package/dist/src/utils/validate.d.ts.map +1 -1
- package/dist/src/utils/validate.js +4 -2
- package/dist/src/utils/validate.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/opencode/notify.d.ts +0 -10
- package/dist/src/opencode/notify.d.ts.map +0 -1
- package/dist/src/opencode/notify.js +0 -14
- package/dist/src/opencode/notify.js.map +0 -1
- package/dist/src/process-prompt.d.ts +0 -21
- package/dist/src/process-prompt.d.ts.map +0 -1
- package/dist/src/process-prompt.js +0 -20
- package/dist/src/process-prompt.js.map +0 -1
- package/dist/src/prompt-prompt.d.ts +0 -3
- package/dist/src/prompt-prompt.d.ts.map +0 -1
- package/dist/src/prompt-prompt.js +0 -27
- package/dist/src/prompt-prompt.js.map +0 -1
- package/dist/src/prompt.d.ts +0 -7
- package/dist/src/prompt.d.ts.map +0 -1
- package/dist/src/prompt.js +0 -71
- package/dist/src/prompt.js.map +0 -1
- package/dist/src/session.d.ts +0 -23
- package/dist/src/session.d.ts.map +0 -1
- package/dist/src/session.js +0 -116
- package/dist/src/session.js.map +0 -1
- package/dist/src/utils/extractLlmError.d.ts +0 -13
- package/dist/src/utils/extractLlmError.d.ts.map +0 -1
- package/dist/src/utils/extractLlmError.js +0 -12
- package/dist/src/utils/extractLlmError.js.map +0 -1
- package/dist/src/utils/stripCodeFences.d.ts +0 -2
- package/dist/src/utils/stripCodeFences.d.ts.map +0 -1
- package/dist/src/utils/stripCodeFences.js +0 -9
- package/dist/src/utils/stripCodeFences.js.map +0 -1
package/dist/src/prompt.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type FormatMode = 'verbose' | 'balanced' | 'concise';
|
|
2
|
-
export declare const FORMAT_MODES: FormatMode[];
|
|
3
|
-
export declare const isFormatMode: (v: unknown) => v is FormatMode;
|
|
4
|
-
export declare const buildParsePrompt: (input: string) => string;
|
|
5
|
-
export declare const buildFormatPrompt: (parsedRulesJson: string, mode?: FormatMode) => string;
|
|
6
|
-
export declare const buildRetryPrompt: (errorMessage: string) => string;
|
|
7
|
-
//# sourceMappingURL=prompt.d.ts.map
|
package/dist/src/prompt.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;AAE3D,eAAO,MAAM,YAAY,EAAE,UAAU,EAAuC,CAAA;AAE5E,eAAO,MAAM,YAAY,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,UACkB,CAAA;AAEjE,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,MAchD,CAAA;AAoDD,eAAO,MAAM,iBAAiB,GAAI,iBAAiB,MAAM,EAAE,OAAM,UAAuB,KAAG,MAG1F,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,cAAc,MAAM,KAAG,MAEvD,CAAA"}
|
package/dist/src/prompt.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { parseSchemaExample } from './rule-schema';
|
|
2
|
-
export const FORMAT_MODES = ['verbose', 'balanced', 'concise'];
|
|
3
|
-
export const isFormatMode = (v) => typeof v === 'string' && FORMAT_MODES.includes(v);
|
|
4
|
-
export const buildParsePrompt = (input) => {
|
|
5
|
-
const instructions = [
|
|
6
|
-
'Always respond with raw JSON text only.',
|
|
7
|
-
'Never use tools.',
|
|
8
|
-
'Never call functions.',
|
|
9
|
-
'',
|
|
10
|
-
'Parse the instructions below into structured rules.',
|
|
11
|
-
'Each rule has: strength (deontic modality), action (verb), target (object), context (optional scope), reason (justification).',
|
|
12
|
-
'',
|
|
13
|
-
'Return JSON matching this schema:',
|
|
14
|
-
parseSchemaExample,
|
|
15
|
-
].join('\n');
|
|
16
|
-
return [instructions, 'Instructions to parse:', input].join('\n\n');
|
|
17
|
-
};
|
|
18
|
-
const verboseInstructions = [
|
|
19
|
-
'Always respond with raw JSON text only.',
|
|
20
|
-
'Never use tools.',
|
|
21
|
-
'Never call functions.',
|
|
22
|
-
'',
|
|
23
|
-
'Convert the parsed rules below into human-readable rules.',
|
|
24
|
-
'Always include both a Rule line and a Reason line for every rule.',
|
|
25
|
-
'',
|
|
26
|
-
'Rule: <clear, actionable statement>',
|
|
27
|
-
'Reason: <justification>',
|
|
28
|
-
'',
|
|
29
|
-
'Return JSON matching this schema:',
|
|
30
|
-
'{"rules": ["Rule: ...\\nReason: ...", "Rule: ...\\nReason: ..."]}',
|
|
31
|
-
];
|
|
32
|
-
const balancedInstructions = [
|
|
33
|
-
'Always respond with raw JSON text only.',
|
|
34
|
-
'Never use tools.',
|
|
35
|
-
'Never call functions.',
|
|
36
|
-
'',
|
|
37
|
-
'Convert the parsed rules below into human-readable rules.',
|
|
38
|
-
'Include a Reason line only when the rule is non-obvious or counterintuitive.',
|
|
39
|
-
'Omit the Reason line when the rule is self-explanatory.',
|
|
40
|
-
'',
|
|
41
|
-
'Rule: <clear, actionable statement>',
|
|
42
|
-
'Reason: <justification> (only if needed)',
|
|
43
|
-
'',
|
|
44
|
-
'Return JSON matching this schema:',
|
|
45
|
-
'{"rules": ["Rule: ...\\nReason: ...", "Rule: ..."]}',
|
|
46
|
-
];
|
|
47
|
-
const conciseInstructions = [
|
|
48
|
-
'Always respond with raw JSON text only.',
|
|
49
|
-
'Never use tools.',
|
|
50
|
-
'Never call functions.',
|
|
51
|
-
'',
|
|
52
|
-
'Convert the parsed rules below into concise directives.',
|
|
53
|
-
'Never include reasons.',
|
|
54
|
-
'Each rule is a single line starting with "- ".',
|
|
55
|
-
'',
|
|
56
|
-
'Return JSON matching this schema:',
|
|
57
|
-
'{"rules": ["- ...", "- ..."]}',
|
|
58
|
-
];
|
|
59
|
-
const formatInstructions = {
|
|
60
|
-
verbose: verboseInstructions,
|
|
61
|
-
balanced: balancedInstructions,
|
|
62
|
-
concise: conciseInstructions,
|
|
63
|
-
};
|
|
64
|
-
export const buildFormatPrompt = (parsedRulesJson, mode = 'balanced') => {
|
|
65
|
-
const instructions = formatInstructions[mode].join('\n');
|
|
66
|
-
return [instructions, 'Parsed rules to convert:', parsedRulesJson].join('\n\n');
|
|
67
|
-
};
|
|
68
|
-
export const buildRetryPrompt = (errorMessage) => {
|
|
69
|
-
return 'Invalid response: ' + errorMessage + '\n\nAlways respond with raw JSON text only. Never use tools. Never wrap in code fences.';
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=prompt.js.map
|
package/dist/src/prompt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAIlD,MAAM,CAAC,MAAM,YAAY,GAAiB,CAAC,SAAS,EA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AO,EAAE,mBAAmB;CAC7B,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,eAAuB,EAAE,OAAmB,UAAU,EAAU,EAAE;IAClG,MAAM,YAAY,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACxD,OAAO,CAAC,YAAY,EAAE,0BAA0B,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACjF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAU,EAAE;IAC/D,OAAO,oBAAoB,GAAG,YAAY,GAAG,yFAAyF,CAAA;AACxI,CAAC,CAAA"}
|
package/dist/src/session.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
-
import type { z } from 'zod';
|
|
3
|
-
import type { Result } from './utils/safe';
|
|
4
|
-
export type PromptModel = {
|
|
5
|
-
providerID: string;
|
|
6
|
-
modelID: string;
|
|
7
|
-
};
|
|
8
|
-
type Part = {
|
|
9
|
-
type: string;
|
|
10
|
-
text?: string;
|
|
11
|
-
};
|
|
12
|
-
export declare const extractText: (parts: Part[]) => string;
|
|
13
|
-
export declare const detectModel: (client: PluginInput["client"], sessionId: string) => Promise<PromptModel | null>;
|
|
14
|
-
type PromptWithRetryOptions<T> = {
|
|
15
|
-
client: PluginInput['client'];
|
|
16
|
-
sessionId: string;
|
|
17
|
-
initialPrompt: string;
|
|
18
|
-
schema: z.ZodType<T>;
|
|
19
|
-
model: PromptModel;
|
|
20
|
-
};
|
|
21
|
-
export declare const promptWithRetry: <T>(options: PromptWithRetryOptions<T>) => Promise<Result<T>>;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAG5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAW1C,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAGD,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAgBD,eAAO,MAAM,WAAW,GAAI,OAAO,IAAI,EAAE,KAAG,MAK3C,CAAA;AAGD,eAAO,MAAM,WAAW,GAAU,QAAQ,WAAW,CAAC,QAAQ,CAAC,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CA2B9G,CAAA;AAED,KAAK,sBAAsB,CAAC,CAAC,IAAI;IAC/B,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACpB,KAAK,EAAE,WAAW,CAAA;CACnB,CAAA;AAGD,eAAO,MAAM,eAAe,GAAU,CAAC,EAAE,SAAS,sBAAsB,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CA0E9F,CAAA"}
|
package/dist/src/session.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { buildRetryPrompt } from './prompt';
|
|
2
|
-
import { extractLlmError } from './utils/extractLlmError';
|
|
3
|
-
import { stripCodeFences } from './utils/stripCodeFences';
|
|
4
|
-
import { formatValidationError, validateJson } from './utils/validate';
|
|
5
|
-
const MAX_RETRIES = 3;
|
|
6
|
-
// deny all tools in internal sessions so the LLM can only respond with text
|
|
7
|
-
const DENIED_TOOLS = {
|
|
8
|
-
'*': false,
|
|
9
|
-
};
|
|
10
|
-
// runtime type guards for untyped SDK responses
|
|
11
|
-
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
12
|
-
const isPart = (v) => isRecord(v) && typeof v.type === 'string';
|
|
13
|
-
const isPartArray = (v) => Array.isArray(v) && v.every(isPart);
|
|
14
|
-
const isMessageInfo = (v) => isRecord(v) && typeof v.role === 'string';
|
|
15
|
-
const isMessageEntry = (v) => isRecord(v) && isMessageInfo(v.info) && isPartArray(v.parts);
|
|
16
|
-
const isMessageEntryArray = (v) => Array.isArray(v) && v.every(isMessageEntry);
|
|
17
|
-
// extract text content from response parts
|
|
18
|
-
export const extractText = (parts) => {
|
|
19
|
-
return parts
|
|
20
|
-
.filter((p) => p.type === 'text' && p.text)
|
|
21
|
-
.map((p) => p.text || '')
|
|
22
|
-
.join('');
|
|
23
|
-
};
|
|
24
|
-
// detect model from the calling session's most recent assistant message
|
|
25
|
-
export const detectModel = async (client, sessionId) => {
|
|
26
|
-
const messagesResult = await client.session.messages({ path: { id: sessionId } });
|
|
27
|
-
if (!messagesResult.data) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
const messages = messagesResult.data;
|
|
31
|
-
if (!isMessageEntryArray(messages)) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
35
|
-
const message = messages[i];
|
|
36
|
-
if (!message) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
const info = message.info;
|
|
40
|
-
if (info.role === 'assistant' && info.providerID && info.modelID) {
|
|
41
|
-
return {
|
|
42
|
-
providerID: info.providerID,
|
|
43
|
-
modelID: info.modelID,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
};
|
|
49
|
-
// prompt the LLM and validate the response, retrying on failure
|
|
50
|
-
export const promptWithRetry = async (options) => {
|
|
51
|
-
let prompt = options.initialPrompt;
|
|
52
|
-
let lastError = '';
|
|
53
|
-
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
54
|
-
const response = await options.client.session.prompt({
|
|
55
|
-
path: { id: options.sessionId },
|
|
56
|
-
body: {
|
|
57
|
-
parts: [{ type: 'text', text: prompt }],
|
|
58
|
-
tools: DENIED_TOOLS,
|
|
59
|
-
model: options.model,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
// no response data means a transport/API failure, not retryable
|
|
63
|
-
if (!response.data) {
|
|
64
|
-
return {
|
|
65
|
-
data: null,
|
|
66
|
-
error: 'No response from LLM (attempt ' + (attempt + 1) + ')',
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const info = response.data.info;
|
|
70
|
-
if (!isMessageInfo(info)) {
|
|
71
|
-
return {
|
|
72
|
-
data: null,
|
|
73
|
-
error: 'Unexpected response shape: missing info (attempt ' + (attempt + 1) + ')',
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
const llmError = extractLlmError(info);
|
|
77
|
-
if (llmError) {
|
|
78
|
-
return {
|
|
79
|
-
data: null,
|
|
80
|
-
error: llmError,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const parts = response.data.parts;
|
|
84
|
-
if (!isPartArray(parts)) {
|
|
85
|
-
return {
|
|
86
|
-
data: null,
|
|
87
|
-
error: 'Unexpected response shape: missing parts (attempt ' + (attempt + 1) + ')',
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// empty text is a model issue, retryable
|
|
91
|
-
const text = extractText(parts);
|
|
92
|
-
if (!text) {
|
|
93
|
-
lastError = 'Empty response';
|
|
94
|
-
prompt = buildRetryPrompt('Empty response. Return valid JSON.');
|
|
95
|
-
continue;
|
|
96
|
-
}
|
|
97
|
-
// validate against schema
|
|
98
|
-
const cleaned = stripCodeFences(text);
|
|
99
|
-
const validation = validateJson(cleaned, options.schema);
|
|
100
|
-
if (validation.error) {
|
|
101
|
-
const errorMsg = formatValidationError(validation);
|
|
102
|
-
lastError = errorMsg + ' | raw: ' + cleaned.slice(0, 200);
|
|
103
|
-
prompt = buildRetryPrompt(errorMsg);
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
data: validation.data,
|
|
108
|
-
error: null,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
data: null,
|
|
113
|
-
error: 'Failed after ' + MAX_RETRIES + ' attempts. Last error: ' + lastError,
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
//# sourceMappingURL=session.js.map
|
package/dist/src/session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAoB,MAAM,yBAAyB,CAAA;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEtE,MAAM,WAAW,GAAG,CAAC,CAAA;AAErB,4EAA4E;AAC5E,MAAM,YAAY,GAA4B;IAC5C,GAAG,EAAE,KAAK;CACX,CAAA;AAkBD,gDAAgD;AAChD,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AACvH,MAAM,MAAM,GAAG,CAAC,CAAU,EAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAA;AACnF,MAAM,WAAW,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,KAAK,CAAC,OAAO,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;YACrB,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAA;YAClD,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;YACzD,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;YACnC,SAAQ;QACV,CAAC;QAED,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,KAAK,EAAE,IAAI;SACZ,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,eAAe,GAAG,WAAW,GAAG,yBAAyB,GAAG,SAAS;KAC7E,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type MessageInfo = {
|
|
2
|
-
role: string;
|
|
3
|
-
providerID?: string;
|
|
4
|
-
modelID?: string;
|
|
5
|
-
error?: {
|
|
6
|
-
name?: string;
|
|
7
|
-
data?: {
|
|
8
|
-
message?: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare const extractLlmError: (info: MessageInfo) => string | null;
|
|
13
|
-
//# sourceMappingURL=extractLlmError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractLlmError.d.ts","sourceRoot":"","sources":["../../../src/utils/extractLlmError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,IAAI,CAAC,EAAE;YACL,OAAO,CAAC,EAAE,MAAM,CAAA;SACjB,CAAA;KACF,CAAA;CACF,CAAA;AAGD,eAAO,MAAM,eAAe,GAAI,MAAM,WAAW,KAAG,MAAM,GAAG,IAW5D,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// extract error message from LLM response info
|
|
2
|
-
export const extractLlmError = (info) => {
|
|
3
|
-
if (!info.error) {
|
|
4
|
-
return null;
|
|
5
|
-
}
|
|
6
|
-
const err = info.error;
|
|
7
|
-
if (err.data && err.data.message) {
|
|
8
|
-
return err.data.message;
|
|
9
|
-
}
|
|
10
|
-
return err.name || 'Unknown LLM error';
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=extractLlmError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractLlmError.js","sourceRoot":"","sources":["../../../src/utils/extractLlmError.ts"],"names":[],"mappings":"AAYA,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAiB,EAAiB,EAAE;IAClE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAA;IACtB,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAA;IACzB,CAAC;IAED,OAAO,GAAG,CAAC,IAAI,IAAI,mBAAmB,CAAA;AACxC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripCodeFences.d.ts","sourceRoot":"","sources":["../../../src/utils/stripCodeFences.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAK9C,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// strip markdown code fences from LLM response text
|
|
2
|
-
// handles fences at line start or preceded by text on the same line
|
|
3
|
-
export const stripCodeFences = (text) => {
|
|
4
|
-
return text
|
|
5
|
-
.replace(/^.*```(?:json)?\s*\n?/m, '')
|
|
6
|
-
.replace(/\n?```\s*$/m, '')
|
|
7
|
-
.trim();
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=stripCodeFences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripCodeFences.js","sourceRoot":"","sources":["../../../src/utils/stripCodeFences.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAY,EAAU,EAAE;IACtD,OAAO,IAAI;SACR,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC;SACrC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;SAC1B,IAAI,EAAE,CAAA;AACX,CAAC,CAAA"}
|