@promptbook/cli 0.112.0-117 → 0.112.0-118
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/apps/agents-server/src/app/agents/[agentName]/chat/AgentChatSidebarDefault.tsx +5 -6
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +17 -7
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +17 -7
- package/apps/agents-server/src/utils/userChat/createImmediateUserChatAnswerModelRequirements.ts +11 -0
- package/apps/agents-server/src/utils/userChat/listUserChats.ts +5 -7
- package/esm/index.es.js +417 -64
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
- package/esm/src/_packages/node.index.d.ts +10 -0
- package/esm/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
- package/esm/src/book-3.0/CliAgent.d.ts +7 -2
- package/esm/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/_packages/node.index.ts +10 -0
- package/src/avatars/avatarAnimationScheduler.ts +33 -2
- package/src/avatars/visuals/fractalAvatarVisual.ts +5 -4
- package/src/avatars/visuals/minecraft2AvatarVisual.ts +16 -11
- package/src/avatars/visuals/minecraftAvatarVisual.ts +21 -7
- package/src/avatars/visuals/octopus3d2AvatarVisual.ts +69 -17
- package/src/avatars/visuals/octopus3d3AvatarVisual.ts +81 -18
- package/src/avatars/visuals/octopus3dAvatarVisual.ts +69 -17
- package/src/book-3.0/Book.ts +3 -1
- package/src/book-3.0/BookNodeAgentSource.ts +2 -2
- package/src/book-3.0/CliAgent.ts +84 -6
- package/src/book-3.0/cliAgentEnv.ts +46 -0
- package/src/cli/cli-commands/coder/run.ts +28 -3
- package/src/cli/cli-commands/common/promptRunnerCliOptions.ts +9 -29
- package/src/other/templates/getTemplatesPipelineCollection.ts +713 -735
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +417 -64
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/parseDuration.d.ts +19 -0
- package/umd/src/_packages/node.index.d.ts +10 -0
- package/umd/src/book-3.0/BookNodeAgentSource.d.ts +1 -1
- package/umd/src/book-3.0/CliAgent.d.ts +7 -2
- package/umd/src/book-3.0/cliAgentEnv.d.ts +33 -0
- package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +2 -18
- package/umd/src/version.d.ts +1 -1
|
@@ -168,10 +168,7 @@ function resolveAgentChatSidebarExpandedStatusClassName(activityKind: AgentChatS
|
|
|
168
168
|
*
|
|
169
169
|
* @private function of AgentChatSidebar
|
|
170
170
|
*/
|
|
171
|
-
function AgentChatSidebarDefaultCollapsedRow({
|
|
172
|
-
item,
|
|
173
|
-
onChatSelect,
|
|
174
|
-
}: AgentChatSidebarDefaultCollapsedRowProps) {
|
|
171
|
+
function AgentChatSidebarDefaultCollapsedRow({ item, onChatSelect }: AgentChatSidebarDefaultCollapsedRowProps) {
|
|
175
172
|
const statusClassName = resolveAgentChatSidebarCollapsedStatusClassName(
|
|
176
173
|
item.content.activityIndicator.kind,
|
|
177
174
|
item.isActive,
|
|
@@ -444,7 +441,9 @@ function AgentChatSidebarDefaultCollapsedSection({
|
|
|
444
441
|
) : (
|
|
445
442
|
<div className="flex min-h-0 w-full flex-1 flex-col gap-2 overflow-y-auto scrollbar-hidden">
|
|
446
443
|
{sidebarItems.length === 0 ? (
|
|
447
|
-
<p className="px-1 text-center text-[11px] text-slate-500 dark:text-slate-400">
|
|
444
|
+
<p className="px-1 text-center text-[11px] text-slate-500 dark:text-slate-400">
|
|
445
|
+
{emptyStateText}
|
|
446
|
+
</p>
|
|
448
447
|
) : (
|
|
449
448
|
sidebarItems.map((item) => (
|
|
450
449
|
<AgentChatSidebarDefaultCollapsedRow
|
|
@@ -600,7 +599,7 @@ export function AgentChatSidebarDefault({
|
|
|
600
599
|
</div>
|
|
601
600
|
</div>
|
|
602
601
|
|
|
603
|
-
<div className="agent-chat-sidebar-toggle-slot pointer-events-none absolute inset-y-0 right-0 z-10 hidden translate-x-1
|
|
602
|
+
<div className="agent-chat-sidebar-toggle-slot pointer-events-none absolute inset-y-0 right-0 z-10 hidden translate-x-1 items-center justify-center md:flex">
|
|
604
603
|
<SolidArrowButton
|
|
605
604
|
direction={isCollapsed ? 'right' : 'left'}
|
|
606
605
|
onClick={onToggleCollapse}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Json } from '@/src/database/schema';
|
|
2
|
+
import { parseAgentSource } from '../../../../../src/book-2.0/agent-source/parseAgentSource';
|
|
2
3
|
import { createUserChatJobFailureDetails } from '../userChat/createUserChatJobFailureDetails';
|
|
3
4
|
import { claimNextQueuedUserChatJob } from '../userChat/claimNextQueuedUserChatJob';
|
|
4
5
|
import { finalizeUserChatJob } from '../userChat/finalizeUserChatJob';
|
|
@@ -148,13 +149,22 @@ async function enqueueExternalUserChatJob(job: UserChatJobRecord): Promise<Proce
|
|
|
148
149
|
return { didMutate: false, outcome: 'waiting' };
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
const
|
|
152
|
-
.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
const agentInitialMessage = previousThreadMessages.length === 0
|
|
153
|
+
? parseAgentSource(agentSourceSnapshot.agentSource).initialMessage
|
|
154
|
+
: null;
|
|
155
|
+
const initialAgentThreadMessages = agentInitialMessage
|
|
156
|
+
? [{ sender: 'AGENT' as const, content: agentInitialMessage }]
|
|
157
|
+
: [];
|
|
158
|
+
|
|
159
|
+
const threadMessages = [
|
|
160
|
+
...initialAgentThreadMessages,
|
|
161
|
+
...[...previousThreadMessages, userMessage]
|
|
162
|
+
.filter((message) => message.isComplete !== false)
|
|
163
|
+
.filter((message) => message.sender === 'USER' || message.sender === 'AGENT'),
|
|
164
|
+
].map((message) => ({
|
|
165
|
+
sender: String(message.sender),
|
|
166
|
+
content: message.content,
|
|
167
|
+
}));
|
|
158
168
|
|
|
159
169
|
const repository = await ensureExternalAgentRepository(agentSourceSnapshot);
|
|
160
170
|
const queuedAt = new Date().toISOString();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Json } from '@/src/database/schema';
|
|
2
2
|
import { mkdir, readFile, rm, writeFile } from 'fs/promises';
|
|
3
3
|
import { join } from 'path';
|
|
4
|
+
import { parseAgentSource } from '../../../../../src/book-2.0/agent-source/parseAgentSource';
|
|
4
5
|
import { createUserChatJobFailureDetails } from '../userChat/createUserChatJobFailureDetails';
|
|
5
6
|
import { claimNextQueuedUserChatJob } from '../userChat/claimNextQueuedUserChatJob';
|
|
6
7
|
import { finalizeUserChatJob } from '../userChat/finalizeUserChatJob';
|
|
@@ -145,13 +146,22 @@ async function enqueueLocalUserChatJob(job: UserChatJobRecord): Promise<ProcessL
|
|
|
145
146
|
return { didMutate: false, outcome: 'waiting' };
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
const
|
|
149
|
-
.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
const agentInitialMessage = previousThreadMessages.length === 0
|
|
150
|
+
? parseAgentSource(agentSourceSnapshot.agentSource).initialMessage
|
|
151
|
+
: null;
|
|
152
|
+
const initialAgentThreadMessages = agentInitialMessage
|
|
153
|
+
? [{ sender: 'AGENT' as const, content: agentInitialMessage }]
|
|
154
|
+
: [];
|
|
155
|
+
|
|
156
|
+
const threadMessages = [
|
|
157
|
+
...initialAgentThreadMessages,
|
|
158
|
+
...[...previousThreadMessages, userMessage]
|
|
159
|
+
.filter((message) => message.isComplete !== false)
|
|
160
|
+
.filter((message) => message.sender === 'USER' || message.sender === 'AGENT'),
|
|
161
|
+
].map((message) => ({
|
|
162
|
+
sender: String(message.sender),
|
|
163
|
+
content: message.content,
|
|
164
|
+
}));
|
|
155
165
|
|
|
156
166
|
const agentFolder = await ensureLocalAgentFolder(agentSourceSnapshot);
|
|
157
167
|
const queuedAt = new Date().toISOString();
|
package/apps/agents-server/src/utils/userChat/createImmediateUserChatAnswerModelRequirements.ts
CHANGED
|
@@ -29,7 +29,9 @@ const IMMEDIATE_USER_CHAT_ANSWER_INSTRUCTION_COMMITMENTS = new Set<string>([
|
|
|
29
29
|
* Prefix added to the immediate pre-answer system message.
|
|
30
30
|
*/
|
|
31
31
|
const IMMEDIATE_USER_CHAT_ANSWER_SYSTEM_PREAMBLE = spaceTrim(`
|
|
32
|
+
|
|
32
33
|
You are preparing a short in-progress confirmation for the user while a slower full agent run continues separately.
|
|
34
|
+
|
|
33
35
|
This response is not the final answer. It is only a confirmation that the task is being handled.
|
|
34
36
|
These immediate-answer rules override any agent instruction below that would make the answer sound final or complete.
|
|
35
37
|
|
|
@@ -37,6 +39,7 @@ const IMMEDIATE_USER_CHAT_ANSWER_SYSTEM_PREAMBLE = spaceTrim(`
|
|
|
37
39
|
- You understood what the user wants.
|
|
38
40
|
- You are working on it now or the job has already started.
|
|
39
41
|
- The final answer will arrive after the background processing finishes.
|
|
42
|
+
- You can use Markdown formatting in the messages like **bold** or *italic*
|
|
40
43
|
|
|
41
44
|
Keep the whole response short, preferably one or two sentences.
|
|
42
45
|
Do not provide any part of the final answer yet.
|
|
@@ -46,6 +49,14 @@ const IMMEDIATE_USER_CHAT_ANSWER_SYSTEM_PREAMBLE = spaceTrim(`
|
|
|
46
49
|
Do not use or claim to have used external tools, memory, knowledge bases, web browsing, search, calendar, email, projects, or teammate agents.
|
|
47
50
|
Never present this message as complete, definitive, or ready to use.
|
|
48
51
|
If the user asks for something that clearly requires unavailable capabilities, simply say the checked final answer is still being prepared.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Example of a good immediate pre-answer response:
|
|
55
|
+
|
|
56
|
+
\`\`\`markdown
|
|
57
|
+
xxx
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
49
60
|
`);
|
|
50
61
|
|
|
51
62
|
/**
|
|
@@ -40,7 +40,7 @@ const CLIENT_SQL_MISSING_CONNECTION_MESSAGE_FRAGMENT =
|
|
|
40
40
|
const SQLITE_CHAT_MESSAGES_JSON_EXPRESSION = `CASE WHEN json_valid(chat."messages") THEN chat."messages" ELSE '[]' END`;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
* Lists all user chats for one agent ordered by
|
|
43
|
+
* Lists all user chats for one agent ordered by creation time (newest first).
|
|
44
44
|
*/
|
|
45
45
|
export async function listUserChats(options: ListUserChatsOptions): Promise<Array<UserChatRecord>> {
|
|
46
46
|
const { userId, viewerIsAdmin, agentPermanentId, includeExternalChats = false } = options;
|
|
@@ -53,9 +53,7 @@ export async function listUserChats(options: ListUserChatsOptions): Promise<Arra
|
|
|
53
53
|
.eq('userId', userId)
|
|
54
54
|
.eq('agentPermanentId', agentPermanentId)
|
|
55
55
|
.eq('source', USER_CHAT_SOURCES.WEB_UI);
|
|
56
|
-
const { data, error } = await query
|
|
57
|
-
.order('lastMessageAt', { ascending: false, nullsFirst: false })
|
|
58
|
-
.order('updatedAt', { ascending: false });
|
|
56
|
+
const { data, error } = await query.order('createdAt', { ascending: false });
|
|
59
57
|
|
|
60
58
|
if (error) {
|
|
61
59
|
throw new Error(`Failed to list user chats: ${error.message}`);
|
|
@@ -73,7 +71,7 @@ export async function listUserChats(options: ListUserChatsOptions): Promise<Arra
|
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
/**
|
|
76
|
-
* Lists lightweight chat-summary seeds without loading full `messages` JSON payloads.
|
|
74
|
+
* Lists lightweight chat-summary seeds without loading full `messages` JSON payloads, ordered by creation time (newest first).
|
|
77
75
|
*
|
|
78
76
|
* @private function of `userChat`
|
|
79
77
|
*/
|
|
@@ -149,7 +147,7 @@ export async function listUserChatSummarySeeds(options: ListUserChatsOptions): P
|
|
|
149
147
|
) AS "pendingAssistantMessageCount"
|
|
150
148
|
FROM ${userChatTableName}
|
|
151
149
|
WHERE ${whereClause}
|
|
152
|
-
ORDER BY "
|
|
150
|
+
ORDER BY "createdAt" DESC
|
|
153
151
|
`,
|
|
154
152
|
queryValues,
|
|
155
153
|
);
|
|
@@ -235,7 +233,7 @@ async function listUserChatSummarySeedsViaSqlite(options: ListUserChatsOptions):
|
|
|
235
233
|
) AS "pendingAssistantMessageCount"
|
|
236
234
|
FROM ${userChatTableName} AS chat
|
|
237
235
|
WHERE ${whereClause}
|
|
238
|
-
ORDER BY chat."
|
|
236
|
+
ORDER BY chat."createdAt" DESC
|
|
239
237
|
`,
|
|
240
238
|
)
|
|
241
239
|
.all(...queryValues) as Array<UserChatSummarySeedSqlRow>;
|