@coffer-org/plugin-claude-agent 2.2.0 → 2.4.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/index.js +2 -11
- package/dist/models.d.ts +8 -21
- package/dist/models.js +23 -7
- package/dist/runtime/agent.js +1 -1
- package/dist/runtime/config.d.ts +4 -5
- package/dist/runtime/config.js +7 -12
- package/dist/schema.js +22 -29
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { definePlugin } from '@coffer-org/sdk/plugin';
|
|
2
2
|
import { defineSettings } from '@coffer-org/sdk/settings';
|
|
3
3
|
import { field } from '@coffer-org/sdk/fields';
|
|
4
|
-
import {
|
|
4
|
+
import { MODEL_PROFILES } from "./models.js";
|
|
5
5
|
export default definePlugin({
|
|
6
6
|
id: 'claude-agent',
|
|
7
7
|
version: '1.0.0',
|
|
@@ -31,16 +31,7 @@ export default definePlugin({
|
|
|
31
31
|
key: 'claude_model',
|
|
32
32
|
label: 'claude-agent.settings.claude_model',
|
|
33
33
|
default: 'haiku',
|
|
34
|
-
options:
|
|
35
|
-
}),
|
|
36
|
-
field.select({
|
|
37
|
-
key: 'effort',
|
|
38
|
-
label: 'claude-agent.settings.effort',
|
|
39
|
-
default: '',
|
|
40
|
-
options: [
|
|
41
|
-
{ value: '', title: 'claude-agent.settings.effort_default' },
|
|
42
|
-
...EFFORT_LEVELS.map((v) => ({ value: v, title: v })),
|
|
43
|
-
],
|
|
34
|
+
options: MODEL_PROFILES.map((p) => ({ value: p.value, title: p.title })),
|
|
44
35
|
}),
|
|
45
36
|
field.boolean({ key: 'thinking_enabled', label: 'claude-agent.settings.thinking_enabled', default: false }),
|
|
46
37
|
field.boolean({ key: 'skip_permissions', label: 'claude-agent.settings.skip_permissions', default: true }),
|
package/dist/models.d.ts
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
export declare const CLAUDE_MODELS: readonly [{
|
|
2
|
-
readonly value: "haiku";
|
|
3
|
-
readonly id: "claude-haiku-4-5";
|
|
4
|
-
readonly title: "Haiku 4.5 — найшвидша";
|
|
5
|
-
}, {
|
|
6
|
-
readonly value: "sonnet";
|
|
7
|
-
readonly id: "claude-sonnet-5";
|
|
8
|
-
readonly title: "Sonnet 5";
|
|
9
|
-
}, {
|
|
10
|
-
readonly value: "opus";
|
|
11
|
-
readonly id: "claude-opus-4-8";
|
|
12
|
-
readonly title: "Opus 4.8";
|
|
13
|
-
}, {
|
|
14
|
-
readonly value: "claude-opus-5";
|
|
15
|
-
readonly id: "claude-opus-5";
|
|
16
|
-
readonly title: "Opus 5";
|
|
17
|
-
}, {
|
|
18
|
-
readonly value: "claude-fable-5";
|
|
19
|
-
readonly id: "claude-fable-5";
|
|
20
|
-
readonly title: "Fable 5 — найдорожча";
|
|
21
|
-
}];
|
|
22
1
|
export declare const EFFORT_LEVELS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
23
2
|
export type Effort = (typeof EFFORT_LEVELS)[number];
|
|
3
|
+
export interface ModelProfile {
|
|
4
|
+
value: string;
|
|
5
|
+
id: string;
|
|
6
|
+
effort: Effort | '';
|
|
7
|
+
title: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const MODEL_PROFILES: ModelProfile[];
|
|
10
|
+
export declare function profileFor(value: string): ModelProfile;
|
package/dist/models.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
export const CLAUDE_MODELS = [
|
|
2
|
-
{ value: 'haiku', id: 'claude-haiku-4-5', title: 'Haiku 4.5 — найшвидша' },
|
|
3
|
-
{ value: 'sonnet', id: 'claude-sonnet-5', title: 'Sonnet 5' },
|
|
4
|
-
{ value: 'opus', id: 'claude-opus-4-8', title: 'Opus 4.8' },
|
|
5
|
-
{ value: 'claude-opus-5', id: 'claude-opus-5', title: 'Opus 5' },
|
|
6
|
-
{ value: 'claude-fable-5', id: 'claude-fable-5', title: 'Fable 5 — найдорожча' },
|
|
7
|
-
];
|
|
8
1
|
export const EFFORT_LEVELS = ['low', 'medium', 'high', 'xhigh', 'max'];
|
|
2
|
+
export const MODEL_PROFILES = [
|
|
3
|
+
{ value: 'haiku', id: 'claude-haiku-4-5', effort: '', title: 'Haiku 4.5 — найшвидша й найдешевша' },
|
|
4
|
+
{ value: 'sonnet-low', id: 'claude-sonnet-5', effort: 'low', title: 'Sonnet 5 · швидко' },
|
|
5
|
+
{ value: 'sonnet', id: 'claude-sonnet-5', effort: 'high', title: 'Sonnet 5 · ретельно' },
|
|
6
|
+
{ value: 'opus', id: 'claude-opus-4-8', effort: 'high', title: 'Opus 4.8 · ретельно' },
|
|
7
|
+
{ value: 'opus-5', id: 'claude-opus-5', effort: 'high', title: 'Opus 5 · ретельно' },
|
|
8
|
+
{ value: 'opus-5-max', id: 'claude-opus-5', effort: 'max', title: 'Opus 5 · максимум' },
|
|
9
|
+
];
|
|
10
|
+
const LEGACY_VALUES = {
|
|
11
|
+
'claude-opus-5': 'opus-5',
|
|
12
|
+
'claude-fable-5': 'opus-5-max',
|
|
13
|
+
'claude-opus-4-8': 'opus',
|
|
14
|
+
'claude-sonnet-5': 'sonnet',
|
|
15
|
+
'claude-haiku-4-5': 'haiku',
|
|
16
|
+
};
|
|
17
|
+
export function profileFor(value) {
|
|
18
|
+
const direct = MODEL_PROFILES.find((p) => p.value === value);
|
|
19
|
+
if (direct)
|
|
20
|
+
return direct;
|
|
21
|
+
const legacy = LEGACY_VALUES[value];
|
|
22
|
+
const mapped = legacy ? MODEL_PROFILES.find((p) => p.value === legacy) : undefined;
|
|
23
|
+
return mapped ?? MODEL_PROFILES.find((p) => p.value === 'opus');
|
|
24
|
+
}
|
package/dist/runtime/agent.js
CHANGED
|
@@ -155,7 +155,7 @@ export async function runAgent(request, deps = {}) {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
const thinking = thinkingParam(cfg.thinkingEnabled);
|
|
158
|
-
const outputConfig = effortParam(cfg.
|
|
158
|
+
const outputConfig = effortParam(cfg.claudeModel);
|
|
159
159
|
if (cfg.thinkingEnabled)
|
|
160
160
|
log.info(`extended thinking ON (${modelId(cfg.claudeModel)})`);
|
|
161
161
|
let tokensIn = null;
|
package/dist/runtime/config.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export declare const APP_ROOT: string;
|
|
2
2
|
export declare const PLUGIN_ROOT: string;
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { EFFORT_LEVELS, MODEL_PROFILES, profileFor, type Effort } from '../models.ts';
|
|
4
|
+
export { EFFORT_LEVELS, MODEL_PROFILES, profileFor };
|
|
5
5
|
export type { Effort };
|
|
6
6
|
export type AuthMode = 'subscription' | 'api_key';
|
|
7
7
|
export declare function supportsAdaptiveThinking(model: string): boolean;
|
|
8
|
-
export declare function modelId(
|
|
8
|
+
export declare function modelId(value: string): string;
|
|
9
9
|
export declare function supportsEffort(model: string): boolean;
|
|
10
|
-
export declare function effortParam(
|
|
10
|
+
export declare function effortParam(value: string): {
|
|
11
11
|
effort: Effort;
|
|
12
12
|
} | undefined;
|
|
13
13
|
export interface AgentConfig {
|
|
@@ -19,7 +19,6 @@ export interface AgentConfig {
|
|
|
19
19
|
ragEnabled: boolean;
|
|
20
20
|
ragTopK: number;
|
|
21
21
|
thinkingEnabled: boolean;
|
|
22
|
-
effort: string;
|
|
23
22
|
embeddingApiKey: string;
|
|
24
23
|
langfusePublicKey: string;
|
|
25
24
|
langfuseSecretKey: string;
|
package/dist/runtime/config.js
CHANGED
|
@@ -4,8 +4,8 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
5
|
export const APP_ROOT = path.resolve(__dirname, '../../../..');
|
|
6
6
|
export const PLUGIN_ROOT = path.resolve(__dirname, '../..');
|
|
7
|
-
import {
|
|
8
|
-
export {
|
|
7
|
+
import { EFFORT_LEVELS, MODEL_PROFILES, profileFor } from "../models.js";
|
|
8
|
+
export { EFFORT_LEVELS, MODEL_PROFILES, profileFor };
|
|
9
9
|
const ADAPTIVE_THINKING_MODELS = [
|
|
10
10
|
'claude-opus-5', 'claude-opus-4-8', 'claude-opus-4-7', 'claude-opus-4-6',
|
|
11
11
|
'claude-sonnet-5', 'claude-sonnet-4-6',
|
|
@@ -14,19 +14,15 @@ const ADAPTIVE_THINKING_MODELS = [
|
|
|
14
14
|
export function supportsAdaptiveThinking(model) {
|
|
15
15
|
return ADAPTIVE_THINKING_MODELS.some((m) => model === m || model.startsWith(`${m}-`));
|
|
16
16
|
}
|
|
17
|
-
export function modelId(
|
|
18
|
-
|
|
19
|
-
if (known)
|
|
20
|
-
return known.id;
|
|
21
|
-
return alias.startsWith('claude-') ? alias : 'claude-opus-4-8';
|
|
17
|
+
export function modelId(value) {
|
|
18
|
+
return profileFor(value).id;
|
|
22
19
|
}
|
|
23
20
|
export function supportsEffort(model) {
|
|
24
21
|
return supportsAdaptiveThinking(model);
|
|
25
22
|
}
|
|
26
|
-
export function effortParam(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
: undefined;
|
|
23
|
+
export function effortParam(value) {
|
|
24
|
+
const p = profileFor(value);
|
|
25
|
+
return p.effort && supportsEffort(p.id) ? { effort: p.effort } : undefined;
|
|
30
26
|
}
|
|
31
27
|
export function loadAgentConfig(opts = {}) {
|
|
32
28
|
const env = opts.env ?? process.env;
|
|
@@ -43,7 +39,6 @@ export function loadAgentConfig(opts = {}) {
|
|
|
43
39
|
ragTopK: 5,
|
|
44
40
|
thinkingEnabled: (env.AGENT_THINKING_ENABLED ?? String(db.thinking_enabled)) === 'true'
|
|
45
41
|
&& supportsAdaptiveThinking(modelId(claudeModel)),
|
|
46
|
-
effort: String(env.AGENT_EFFORT ?? db.effort ?? ''),
|
|
47
42
|
embeddingApiKey: env.OPENAI_API_KEY ?? db.openai_api_key ?? '',
|
|
48
43
|
langfusePublicKey: env.LANGFUSE_PUBLIC_KEY ?? db.langfuse_public_key ?? '',
|
|
49
44
|
langfuseSecretKey: env.LANGFUSE_SECRET_KEY ?? db.langfuse_secret_key ?? '',
|
package/dist/schema.js
CHANGED
|
@@ -7113,51 +7113,44 @@ var src_default = definePlugin({
|
|
|
7113
7113
|
{
|
|
7114
7114
|
value: "haiku",
|
|
7115
7115
|
id: "claude-haiku-4-5",
|
|
7116
|
-
|
|
7116
|
+
effort: "",
|
|
7117
|
+
title: "Haiku 4.5 — найшвидша й найдешевша"
|
|
7118
|
+
},
|
|
7119
|
+
{
|
|
7120
|
+
value: "sonnet-low",
|
|
7121
|
+
id: "claude-sonnet-5",
|
|
7122
|
+
effort: "low",
|
|
7123
|
+
title: "Sonnet 5 · швидко"
|
|
7117
7124
|
},
|
|
7118
7125
|
{
|
|
7119
7126
|
value: "sonnet",
|
|
7120
7127
|
id: "claude-sonnet-5",
|
|
7121
|
-
|
|
7128
|
+
effort: "high",
|
|
7129
|
+
title: "Sonnet 5 · ретельно"
|
|
7122
7130
|
},
|
|
7123
7131
|
{
|
|
7124
7132
|
value: "opus",
|
|
7125
7133
|
id: "claude-opus-4-8",
|
|
7126
|
-
|
|
7134
|
+
effort: "high",
|
|
7135
|
+
title: "Opus 4.8 · ретельно"
|
|
7127
7136
|
},
|
|
7128
7137
|
{
|
|
7129
|
-
value: "
|
|
7138
|
+
value: "opus-5",
|
|
7130
7139
|
id: "claude-opus-5",
|
|
7131
|
-
|
|
7140
|
+
effort: "high",
|
|
7141
|
+
title: "Opus 5 · ретельно"
|
|
7132
7142
|
},
|
|
7133
7143
|
{
|
|
7134
|
-
value: "
|
|
7135
|
-
id: "claude-
|
|
7136
|
-
|
|
7144
|
+
value: "opus-5-max",
|
|
7145
|
+
id: "claude-opus-5",
|
|
7146
|
+
effort: "max",
|
|
7147
|
+
title: "Opus 5 · максимум"
|
|
7137
7148
|
}
|
|
7138
|
-
].map((
|
|
7139
|
-
value:
|
|
7140
|
-
title:
|
|
7149
|
+
].map((p) => ({
|
|
7150
|
+
value: p.value,
|
|
7151
|
+
title: p.title
|
|
7141
7152
|
}))
|
|
7142
7153
|
}),
|
|
7143
|
-
field.select({
|
|
7144
|
-
key: "effort",
|
|
7145
|
-
label: "claude-agent.settings.effort",
|
|
7146
|
-
default: "",
|
|
7147
|
-
options: [{
|
|
7148
|
-
value: "",
|
|
7149
|
-
title: "claude-agent.settings.effort_default"
|
|
7150
|
-
}, ...[
|
|
7151
|
-
"low",
|
|
7152
|
-
"medium",
|
|
7153
|
-
"high",
|
|
7154
|
-
"xhigh",
|
|
7155
|
-
"max"
|
|
7156
|
-
].map((v) => ({
|
|
7157
|
-
value: v,
|
|
7158
|
-
title: v
|
|
7159
|
-
}))]
|
|
7160
|
-
}),
|
|
7161
7154
|
field.boolean({
|
|
7162
7155
|
key: "thinking_enabled",
|
|
7163
7156
|
label: "claude-agent.settings.thinking_enabled",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffer-org/plugin-claude-agent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24"
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@anthropic-ai/sdk": "^0.111.0",
|
|
29
|
-
"@coffer-org/mcp": "^2.
|
|
30
|
-
"@coffer-org/sdk": "^2.
|
|
31
|
-
"@coffer-org/server": "^2.
|
|
29
|
+
"@coffer-org/mcp": "^2.3.0",
|
|
30
|
+
"@coffer-org/sdk": "^2.1.0",
|
|
31
|
+
"@coffer-org/server": "^2.2.0",
|
|
32
32
|
"@langfuse/otel": "^4.6.1",
|
|
33
33
|
"@langfuse/tracing": "^4.6.1",
|
|
34
34
|
"@opentelemetry/sdk-trace-node": "^2.8.0",
|