@agi-cli/sdk 0.1.161 → 0.1.163
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/package.json
CHANGED
|
@@ -44,7 +44,9 @@ export class TerminalManager {
|
|
|
44
44
|
cwd: options.cwd,
|
|
45
45
|
env: {
|
|
46
46
|
...process.env,
|
|
47
|
+
TERM: 'xterm-256color',
|
|
47
48
|
PATH: getAugmentedPath(),
|
|
49
|
+
PROMPT_EOL_MARK: '',
|
|
48
50
|
} as Record<string, string>,
|
|
49
51
|
};
|
|
50
52
|
|
|
@@ -56,16 +58,6 @@ export class TerminalManager {
|
|
|
56
58
|
|
|
57
59
|
const terminal = new Terminal(id, pty, options);
|
|
58
60
|
|
|
59
|
-
if (options.command.includes('zsh')) {
|
|
60
|
-
setTimeout(() => {
|
|
61
|
-
pty.write(' unsetopt prompt_sp 2>/dev/null\r');
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
pty.write(' clear\r');
|
|
64
|
-
terminal.clearBuffer();
|
|
65
|
-
}, 200);
|
|
66
|
-
}, 100);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
61
|
terminal.onExit((_exitCode) => {
|
|
70
62
|
const timer = setTimeout(() => {
|
|
71
63
|
this.delete(id);
|
|
@@ -155,37 +155,13 @@ export function createOpenAIOAuthFetch(config: OpenAIOAuthConfig) {
|
|
|
155
155
|
parsed.include.push('reasoning.encrypted_content');
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
effort
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
summary:
|
|
166
|
-
providerOpts.reasoningSummary ||
|
|
167
|
-
config.reasoningSummary ||
|
|
168
|
-
'auto',
|
|
169
|
-
};
|
|
170
|
-
} else {
|
|
171
|
-
const providerOpts = parsed.providerOptions?.openai || {};
|
|
172
|
-
if (!parsed.reasoning) {
|
|
173
|
-
parsed.reasoning = parsed.reasoningText;
|
|
174
|
-
}
|
|
175
|
-
if (!parsed.reasoning.effort) {
|
|
176
|
-
parsed.reasoning.effort =
|
|
177
|
-
providerOpts.reasoningEffort ||
|
|
178
|
-
config.reasoningEffort ||
|
|
179
|
-
'medium';
|
|
180
|
-
}
|
|
181
|
-
if (!parsed.reasoning.summary) {
|
|
182
|
-
parsed.reasoning.summary =
|
|
183
|
-
providerOpts.reasoningSummary ||
|
|
184
|
-
config.reasoningSummary ||
|
|
185
|
-
'auto';
|
|
186
|
-
}
|
|
187
|
-
delete parsed.reasoningText;
|
|
188
|
-
}
|
|
158
|
+
const existingReasoning = parsed.reasoning || {};
|
|
159
|
+
parsed.reasoning = {
|
|
160
|
+
effort:
|
|
161
|
+
existingReasoning.effort || config.reasoningEffort || 'medium',
|
|
162
|
+
summary:
|
|
163
|
+
existingReasoning.summary || config.reasoningSummary || 'auto',
|
|
164
|
+
};
|
|
189
165
|
|
|
190
166
|
delete parsed.max_output_tokens;
|
|
191
167
|
delete parsed.max_completion_tokens;
|
|
@@ -149,7 +149,11 @@ export function estimateModelCostUsd(
|
|
|
149
149
|
typeof m.cost?.cacheRead === 'number' ? m.cost.cacheRead : 0;
|
|
150
150
|
const cacheWritePerMillion =
|
|
151
151
|
typeof m.cost?.cacheWrite === 'number' ? m.cost.cacheWrite : 0;
|
|
152
|
-
const
|
|
152
|
+
const nonCachedInput = Math.max(
|
|
153
|
+
0,
|
|
154
|
+
inputTokens - cachedInputTokens - cacheCreationInputTokens,
|
|
155
|
+
);
|
|
156
|
+
const inputCost = (nonCachedInput * inputPerMillion) / 1_000_000;
|
|
153
157
|
const outputCost = (outputTokens * outputPerMillion) / 1_000_000;
|
|
154
158
|
const cacheReadCost = (cachedInputTokens * cacheReadPerMillion) / 1_000_000;
|
|
155
159
|
const cacheWriteCost =
|
|
@@ -161,7 +165,12 @@ export function estimateModelCostUsd(
|
|
|
161
165
|
// Fallback to legacy table if catalog lacks pricing
|
|
162
166
|
const entry = findPricing(provider, model.toLowerCase());
|
|
163
167
|
if (!entry) return undefined;
|
|
164
|
-
const
|
|
168
|
+
const nonCachedInputFallback = Math.max(
|
|
169
|
+
0,
|
|
170
|
+
inputTokens - cachedInputTokens - cacheCreationInputTokens,
|
|
171
|
+
);
|
|
172
|
+
const inputCost =
|
|
173
|
+
(nonCachedInputFallback * entry.inputPerMillion) / 1_000_000;
|
|
165
174
|
const outputCost = (outputTokens * entry.outputPerMillion) / 1_000_000;
|
|
166
175
|
const total = inputCost + outputCost;
|
|
167
176
|
return Number.isFinite(total) ? Number(total.toFixed(6)) : undefined;
|