@meetopenbot/openbot 1.2.6 → 1.2.8
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/auto-model.js +1 -1
- package/dist/model.js +8 -2
- package/dist/runtime.js +2 -3
- package/dist/system-prompt.js +1 -0
- package/dist/thread-naming.js +25 -0
- package/dist/tools/thread-title.js +16 -1
- package/package.json +1 -1
package/dist/auto-model.js
CHANGED
|
@@ -10,7 +10,7 @@ export const AUTO_MODEL_OPTION = {
|
|
|
10
10
|
* Auto currently always uses this model. Restore a cheap pool (preference
|
|
11
11
|
* order, failover, intent routing) without changing the `openbot/auto` alias.
|
|
12
12
|
*/
|
|
13
|
-
export const AUTO_MODEL_POOL = ['deepseek/deepseek-
|
|
13
|
+
export const AUTO_MODEL_POOL = ['deepseek/deepseek-flash'];
|
|
14
14
|
function providerByokKeys(provider) {
|
|
15
15
|
return BYOK_ENV_KEYS[provider];
|
|
16
16
|
}
|
package/dist/model.js
CHANGED
|
@@ -5,6 +5,10 @@ import { createGoogle, google as defaultGoogle } from '@ai-sdk/google';
|
|
|
5
5
|
import { expandModelString } from './auto-model.js';
|
|
6
6
|
import { CREDITS_API_KEY_PLACEHOLDER, INTEGRATIONS_TOKEN_HEADER, creditsProviderBaseUrl, resolveByokApiKey, resolveCreditsAuthConfig, shouldUseCreditsAuth, } from '@meetopenbot/plugin-sdk';
|
|
7
7
|
const ZAI_BYOK_BASE_URL = 'https://api.z.ai/api/paas/v4';
|
|
8
|
+
/** DeepSeek API id for V4.1 Flash; legacy marketplace ids still resolve here. */
|
|
9
|
+
function deepseekApiModelId(modelId) {
|
|
10
|
+
return modelId === 'deepseek-v4.1-flash' ? 'deepseek-flash' : modelId;
|
|
11
|
+
}
|
|
8
12
|
/** AI SDK default: OpenAI Responses API (`/v1/responses`), required for tools on Luna. */
|
|
9
13
|
function openAiResponsesModel(options, modelId) {
|
|
10
14
|
return createOpenAI(options)(modelId);
|
|
@@ -60,8 +64,10 @@ export function resolveModel(modelString, options) {
|
|
|
60
64
|
return useCredits ? resolveCreditsProvider('anthropic', modelId) : anthropic(modelId);
|
|
61
65
|
case 'google':
|
|
62
66
|
return useCredits ? resolveCreditsProvider('google', modelId) : googleByok(modelId);
|
|
63
|
-
case 'deepseek':
|
|
64
|
-
|
|
67
|
+
case 'deepseek': {
|
|
68
|
+
const apiModelId = deepseekApiModelId(modelId);
|
|
69
|
+
return useCredits ? resolveCreditsProvider('deepseek', apiModelId) : deepSeek(apiModelId);
|
|
70
|
+
}
|
|
65
71
|
case 'zai':
|
|
66
72
|
return useCredits ? resolveCreditsProvider('zai', modelId) : zaiByok(modelId);
|
|
67
73
|
default:
|
package/dist/runtime.js
CHANGED
|
@@ -8,6 +8,7 @@ import { AUTO_MODEL_ID, isAutoModel, isRetryableModelError, listAutoModelCandida
|
|
|
8
8
|
import { reasoningForModel, resolveModel } from './model.js';
|
|
9
9
|
import { errorFromStreamPart } from './stream-error.js';
|
|
10
10
|
import { createAgentOutputBuffer, isOutputBoundaryPart } from './output-buffer.js';
|
|
11
|
+
import { threadNamingHint } from './thread-naming.js';
|
|
11
12
|
async function buildSystemPrompt(state, storage, instructions, host) {
|
|
12
13
|
const context = await buildContext(state, storage, host);
|
|
13
14
|
const sections = [
|
|
@@ -16,9 +17,7 @@ async function buildSystemPrompt(state, storage, instructions, host) {
|
|
|
16
17
|
context,
|
|
17
18
|
];
|
|
18
19
|
const threadState = state.threadDetails?.state;
|
|
19
|
-
|
|
20
|
-
sections.push('', '## SYSTEM HINT', 'This thread is unnamed. Please use the `set_thread_title` tool to set a concise, descriptive title (e.g., "Project Brainstorming" instead of "project-brainstorm"). Only do this once.');
|
|
21
|
-
}
|
|
20
|
+
sections.push(...threadNamingHint(threadState));
|
|
22
21
|
return sections.join('\n');
|
|
23
22
|
}
|
|
24
23
|
function toAiTools(tools, args, flushPendingOutput) {
|
package/dist/system-prompt.js
CHANGED
|
@@ -32,6 +32,7 @@ export const OPENBOT_SYSTEM_PROMPT = [
|
|
|
32
32
|
"# JOB TITLE",
|
|
33
33
|
"- Unnamed jobs get a system hint to call `set_thread_title` once with a concise, human-readable title.",
|
|
34
34
|
"- Call `set_thread_title` again only if the topic clearly changes.",
|
|
35
|
+
"- Never re-title a job the user renamed.",
|
|
35
36
|
"",
|
|
36
37
|
"# JOB STATUS",
|
|
37
38
|
"- Every thread is a job. Status is `working` (in progress), `needs_input`, `ready_for_review`, `completed`, or `archived`.",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
function asNamingState(state) {
|
|
2
|
+
return state && typeof state === 'object' ? state : {};
|
|
3
|
+
}
|
|
4
|
+
/** True when the user renamed the thread; the agent must not re-title it. */
|
|
5
|
+
export function isManuallyNamedThread(state) {
|
|
6
|
+
return asNamingState(state).isManuallyNamed === true;
|
|
7
|
+
}
|
|
8
|
+
/** The stored thread name from `state.json`, or `''`. */
|
|
9
|
+
export function threadNameFromState(state) {
|
|
10
|
+
const { name } = asNamingState(state);
|
|
11
|
+
return typeof name === 'string' ? name.trim() : '';
|
|
12
|
+
}
|
|
13
|
+
/** System-prompt lines asking the agent to name the thread, or `[]` once it has a name. */
|
|
14
|
+
export function threadNamingHint(state) {
|
|
15
|
+
if (asNamingState(state).isSmartNamed || isManuallyNamedThread(state))
|
|
16
|
+
return [];
|
|
17
|
+
return [
|
|
18
|
+
'',
|
|
19
|
+
'## SYSTEM HINT',
|
|
20
|
+
'This thread is unnamed. Please use the `set_thread_title` tool to set a concise, descriptive title (e.g., "Project Brainstorming" instead of "project-brainstorm"). Only do this once.',
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
export function manualNameKeptOutput(name) {
|
|
24
|
+
return `The user named this job "${name}"; kept their name and did not change the title.`;
|
|
25
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
+
import { isManuallyNamedThread, manualNameKeptOutput, threadNameFromState, } from "../thread-naming.js";
|
|
2
3
|
function formatTitleOutput(title) {
|
|
3
4
|
return `Job title set to ${title}.`;
|
|
4
5
|
}
|
|
5
6
|
export const toolDefinitions = {
|
|
6
7
|
set_thread_title: {
|
|
7
|
-
description: "Set this job's title. Use a concise, human-readable name (e.g. \"Project Brainstorming\", not \"project-brainstorm\"). Call once when the thread is unnamed; call again only if the topic clearly changes.",
|
|
8
|
+
description: "Set this job's title. Use a concise, human-readable name (e.g. \"Project Brainstorming\", not \"project-brainstorm\"). Call once when the thread is unnamed; call again only if the topic clearly changes. Never re-title a job the user renamed.",
|
|
8
9
|
inputSchema: z.object({
|
|
9
10
|
title: z
|
|
10
11
|
.string()
|
|
@@ -28,6 +29,20 @@ export const tools = {
|
|
|
28
29
|
if (!title) {
|
|
29
30
|
throw new Error("title is required");
|
|
30
31
|
}
|
|
32
|
+
const current = await ctx.storage.getThreadDetails({
|
|
33
|
+
channelId,
|
|
34
|
+
threadId,
|
|
35
|
+
});
|
|
36
|
+
if (isManuallyNamedThread(current.state)) {
|
|
37
|
+
ctx.state.threadDetails = current;
|
|
38
|
+
const keptName = threadNameFromState(current.state);
|
|
39
|
+
return {
|
|
40
|
+
success: true,
|
|
41
|
+
skipped: true,
|
|
42
|
+
title: keptName,
|
|
43
|
+
output: manualNameKeptOutput(keptName),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
31
46
|
await ctx.storage.patchThreadState({
|
|
32
47
|
channelId,
|
|
33
48
|
threadId,
|