@promptbook/node 0.114.0-23 → 0.114.0-25
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/README.md +2 -2
- package/esm/index.es.js +226 -46
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/runners/common/estimateUsageFromTextLength.d.ts +33 -0
- package/esm/scripts/run-codex-prompts/runners/common/modelPricing.d.ts +41 -0
- package/esm/scripts/run-codex-prompts/runners/gemini/gemini-pricing.d.ts +5 -18
- package/esm/scripts/run-codex-prompts/runners/qwen-code/QwenCodeRunner.d.ts +23 -0
- package/esm/scripts/run-codex-prompts/runners/qwen-code/buildQwenCodeScript.d.ts +8 -0
- package/esm/scripts/run-codex-prompts/runners/qwen-code/parseQwenCodeUsageFromOutput.d.ts +9 -0
- package/esm/scripts/run-codex-prompts/runners/qwen-code/qwen-code-pricing.d.ts +30 -0
- package/esm/src/book-3.0/cliAgentEnv.d.ts +3 -3
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +8 -2
- package/esm/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +226 -46
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/runners/common/estimateUsageFromTextLength.d.ts +33 -0
- package/umd/scripts/run-codex-prompts/runners/common/modelPricing.d.ts +41 -0
- package/umd/scripts/run-codex-prompts/runners/gemini/gemini-pricing.d.ts +5 -18
- package/umd/scripts/run-codex-prompts/runners/qwen-code/QwenCodeRunner.d.ts +23 -0
- package/umd/scripts/run-codex-prompts/runners/qwen-code/buildQwenCodeScript.d.ts +8 -0
- package/umd/scripts/run-codex-prompts/runners/qwen-code/parseQwenCodeUsageFromOutput.d.ts +9 -0
- package/umd/scripts/run-codex-prompts/runners/qwen-code/qwen-code-pricing.d.ts +30 -0
- package/umd/src/book-3.0/cliAgentEnv.d.ts +3 -3
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +8 -2
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Usage } from '../../../../src/execution/Usage';
|
|
2
|
+
import type { ModelPricing } from './modelPricing';
|
|
3
|
+
/**
|
|
4
|
+
* Options for estimating the usage of one harness run.
|
|
5
|
+
*/
|
|
6
|
+
export type EstimateUsageFromTextLengthOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Human-readable harness name used when the estimation itself fails.
|
|
9
|
+
*/
|
|
10
|
+
readonly harnessLabel: string;
|
|
11
|
+
/**
|
|
12
|
+
* The prompt that was sent to the harness.
|
|
13
|
+
*/
|
|
14
|
+
readonly prompt: string;
|
|
15
|
+
/**
|
|
16
|
+
* The output which the harness has printed.
|
|
17
|
+
*/
|
|
18
|
+
readonly output: string;
|
|
19
|
+
/**
|
|
20
|
+
* Reads the pricing of the model which was used for this run.
|
|
21
|
+
*
|
|
22
|
+
* It is resolved lazily so that a broken pricing table degrades to an uncertain estimate
|
|
23
|
+
* instead of failing the coding round, because a price estimate must never block coding work.
|
|
24
|
+
*/
|
|
25
|
+
readonly resolvePricing: () => ModelPricing;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Estimates the usage of one harness run from the length of its prompt and its output.
|
|
29
|
+
*
|
|
30
|
+
* Harnesses which do not report their own token counts are billed per token anyway, so the
|
|
31
|
+
* character counts are the only signal available for a price estimate.
|
|
32
|
+
*/
|
|
33
|
+
export declare function estimateUsageFromTextLength(options: EstimateUsageFromTextLengthOptions): Usage;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price of one model per 1 million tokens in USD.
|
|
3
|
+
*/
|
|
4
|
+
export type ModelPricing = {
|
|
5
|
+
/**
|
|
6
|
+
* Price of 1 million input tokens in USD.
|
|
7
|
+
*/
|
|
8
|
+
readonly input: number;
|
|
9
|
+
/**
|
|
10
|
+
* Price of 1 million output tokens in USD.
|
|
11
|
+
*/
|
|
12
|
+
readonly output: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Pricing of all known models of one harness, keyed by the model identifier.
|
|
16
|
+
*/
|
|
17
|
+
export type ModelPricingTable = Readonly<Record<string, ModelPricing>>;
|
|
18
|
+
/**
|
|
19
|
+
* Options for resolving the pricing of one model.
|
|
20
|
+
*/
|
|
21
|
+
export type ResolveModelPricingOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* Pricing of all models known to one harness.
|
|
24
|
+
*/
|
|
25
|
+
readonly pricingTable: ModelPricingTable;
|
|
26
|
+
/**
|
|
27
|
+
* Model whose pricing is used when the requested model is unknown.
|
|
28
|
+
*/
|
|
29
|
+
readonly modelNameForEstimation: string;
|
|
30
|
+
/**
|
|
31
|
+
* Model requested for the run, or `undefined` when the harness picks its own model.
|
|
32
|
+
*/
|
|
33
|
+
readonly modelName?: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the pricing of one model of one harness.
|
|
37
|
+
*
|
|
38
|
+
* It first tries exact match, then prefix match, then falls back to the pricing of a stable
|
|
39
|
+
* default model, because every harness names new models faster than the pricing tables grow.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveModelPricing(options: ResolveModelPricingOptions): ModelPricing;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ModelPricing } from '../common/modelPricing';
|
|
1
2
|
/**
|
|
2
3
|
* The pricing for Gemini models per 1 million tokens in USD.
|
|
3
4
|
*
|
|
@@ -6,30 +7,16 @@
|
|
|
6
7
|
* @see https://ai.google.dev/pricing
|
|
7
8
|
*/
|
|
8
9
|
export declare const GEMINI_PRICING: {
|
|
9
|
-
'gemini-1.5-flash': {
|
|
10
|
-
input:
|
|
11
|
-
output:
|
|
10
|
+
readonly 'gemini-1.5-flash': {
|
|
11
|
+
readonly input: 0.1125;
|
|
12
|
+
readonly output: 0.45;
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
15
16
|
* The model to use for price estimation.
|
|
16
17
|
*/
|
|
17
18
|
export declare const GEMINI_MODEL_FOR_ESTIMATION = "gemini-1.5-flash";
|
|
18
|
-
/**
|
|
19
|
-
* Gemini pricing entry per 1 million tokens.
|
|
20
|
-
*/
|
|
21
|
-
export type GeminiPricing = {
|
|
22
|
-
input: number;
|
|
23
|
-
output: number;
|
|
24
|
-
};
|
|
25
19
|
/**
|
|
26
20
|
* Resolves Gemini pricing for the requested model.
|
|
27
|
-
*
|
|
28
|
-
* It first tries exact match, then prefix match, then falls back to a stable
|
|
29
|
-
* default pricing model.
|
|
30
|
-
*/
|
|
31
|
-
export declare function resolveGeminiPricing(modelName?: string): GeminiPricing;
|
|
32
|
-
/**
|
|
33
|
-
* A an estimation of how many characters are in one token.
|
|
34
21
|
*/
|
|
35
|
-
export declare
|
|
22
|
+
export declare function resolveGeminiPricing(modelName?: string): ModelPricing;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PromptRunner } from '../types/PromptRunner';
|
|
2
|
+
import type { PromptRunOptions } from '../types/PromptRunOptions';
|
|
3
|
+
import type { PromptRunResult } from '../types/PromptRunResult';
|
|
4
|
+
import type { QwenCodeRunnerOptions } from './QwenCodeRunnerOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Default Qwen Code model used by the coding runner.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_QWEN_CODE_MODEL = "qwen3.8-max";
|
|
9
|
+
/**
|
|
10
|
+
* Runs prompts via the Qwen Code CLI.
|
|
11
|
+
*/
|
|
12
|
+
export declare class QwenCodeRunner implements PromptRunner {
|
|
13
|
+
private readonly options;
|
|
14
|
+
readonly name = "qwen-code";
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new Qwen Code runner.
|
|
17
|
+
*/
|
|
18
|
+
constructor(options: QwenCodeRunnerOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Runs the prompt using Qwen Code and parses usage output.
|
|
21
|
+
*/
|
|
22
|
+
runPrompt(options: PromptRunOptions): Promise<PromptRunResult>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { QwenCodeScriptOptions } from './QwenCodeScriptOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the shell script that runs Qwen Code with the prompt and coding context.
|
|
4
|
+
*
|
|
5
|
+
* Note: `-y` runs the harness unattended, because `ptbk coder` approves the whole prompt
|
|
6
|
+
* up front and there is nobody at the keyboard to confirm the single tool calls.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildQwenCodeScript(options: QwenCodeScriptOptions): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Usage } from '../../../../src/execution/Usage';
|
|
2
|
+
/**
|
|
3
|
+
* Parses Qwen Code CLI output and extracts usage information.
|
|
4
|
+
*
|
|
5
|
+
* @param output The output from the Qwen Code CLI.
|
|
6
|
+
* @param prompt The prompt that was sent to the Qwen Code CLI.
|
|
7
|
+
* @param modelName The Qwen Code model used for this run.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseQwenCodeUsageFromOutput(output: string, prompt: string, modelName?: string): Usage;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ModelPricing } from '../common/modelPricing';
|
|
2
|
+
/**
|
|
3
|
+
* The pricing for Qwen Code models per 1 million tokens in USD.
|
|
4
|
+
*
|
|
5
|
+
* Note: This is an estimation.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.alibabacloud.com/help/en/model-studio/models
|
|
8
|
+
*/
|
|
9
|
+
export declare const QWEN_CODE_PRICING: {
|
|
10
|
+
readonly 'qwen3-coder-plus': {
|
|
11
|
+
readonly input: 1;
|
|
12
|
+
readonly output: 5;
|
|
13
|
+
};
|
|
14
|
+
readonly 'qwen3-coder-flash': {
|
|
15
|
+
readonly input: 0.3;
|
|
16
|
+
readonly output: 1.5;
|
|
17
|
+
};
|
|
18
|
+
readonly 'qwen3-max': {
|
|
19
|
+
readonly input: 1.2;
|
|
20
|
+
readonly output: 6;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The model to use for price estimation.
|
|
25
|
+
*/
|
|
26
|
+
export declare const QWEN_CODE_MODEL_FOR_ESTIMATION = "qwen3-coder-plus";
|
|
27
|
+
/**
|
|
28
|
+
* Resolves Qwen Code pricing for the requested model.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveQwenCodePricing(modelName?: string): ModelPricing;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @public exported from `@promptbook/node`
|
|
5
5
|
*/
|
|
6
|
-
export declare const CLI_AGENT_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
|
|
6
|
+
export declare const CLI_AGENT_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini", "qwen-code"];
|
|
7
7
|
/**
|
|
8
8
|
* All supported thinking-level values for CLI coding-agent runners.
|
|
9
9
|
*
|
|
@@ -13,8 +13,8 @@ export declare const CLI_AGENT_THINKING_LEVEL_VALUES: readonly ["low", "medium",
|
|
|
13
13
|
/**
|
|
14
14
|
* Environment variable used as the default runner identifier when `--harness` is omitted or not set in `CliAgent`.
|
|
15
15
|
*
|
|
16
|
-
* Set this to one of the harness names (`openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini
|
|
17
|
-
* so that `CliAgent` and `ptbk agent exec` can run without an explicit `harness` option.
|
|
16
|
+
* Set this to one of the harness names (`openai-codex`, `github-copilot`, `cline`, `claude-code`, `opencode`, `gemini`,
|
|
17
|
+
* `qwen-code`) so that `CliAgent` and `ptbk agent exec` can run without an explicit `harness` option.
|
|
18
18
|
*
|
|
19
19
|
* @public exported from `@promptbook/node`
|
|
20
20
|
*/
|
|
@@ -8,7 +8,7 @@ export { PTBK_HARNESS_ENV, PTBK_MODEL_ENV, PTBK_THINKING_LEVEL_ENV };
|
|
|
8
8
|
*
|
|
9
9
|
* @private internal utility of `promptbookCli`
|
|
10
10
|
*/
|
|
11
|
-
export declare const PROMPT_RUNNER_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini"];
|
|
11
|
+
export declare const PROMPT_RUNNER_HARNESS_NAMES: readonly ["openai-codex", "github-copilot", "cline", "claude-code", "opencode", "gemini", "qwen-code"];
|
|
12
12
|
/**
|
|
13
13
|
* Runner identifier supported by Promptbook CLI agent orchestration commands.
|
|
14
14
|
*
|
|
@@ -72,7 +72,13 @@ export declare const PROMPT_RUNNER_DESCRIPTION: string;
|
|
|
72
72
|
*
|
|
73
73
|
* @private internal utility of `promptbookCli`
|
|
74
74
|
*/
|
|
75
|
-
export declare const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION
|
|
75
|
+
export declare const PROMPT_RUNNER_HARNESS_OPTION_DESCRIPTION: string;
|
|
76
|
+
/**
|
|
77
|
+
* Runner harness names listed as alternatives of the `--harness` option in error messages.
|
|
78
|
+
*
|
|
79
|
+
* @private internal utility of `promptbookCli`
|
|
80
|
+
*/
|
|
81
|
+
export declare const PROMPT_RUNNER_HARNESS_OPTION_HINT: string;
|
|
76
82
|
/**
|
|
77
83
|
* Commander description for the `--model` option.
|
|
78
84
|
*
|
package/umd/src/version.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
|
|
|
15
15
|
export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
|
|
16
16
|
/**
|
|
17
17
|
* Represents the version string of the Promptbook engine.
|
|
18
|
-
* It follows semantic versioning (e.g., `0.114.0-
|
|
18
|
+
* It follows semantic versioning (e.g., `0.114.0-24`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|