@promptbook/cli 0.112.0-139 → 0.112.0-140
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 +1 -1
- package/apps/agents-server/README.md +9 -0
- package/apps/agents-server/src/app/actions.ts +18 -7
- package/apps/agents-server/src/app/admin/login-methods/shibboleth/page.tsx +7 -17
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +395 -30
- package/apps/agents-server/src/app/api/agents/export/route.ts +28 -2
- package/apps/agents-server/src/app/api/auth/change-password/route.ts +53 -6
- package/apps/agents-server/src/app/api/auth/login/route.ts +17 -8
- package/apps/agents-server/src/app/api/chat/export/pdf/route.ts +167 -2
- package/apps/agents-server/src/app/api/emails/incoming/sendgrid/route.ts +24 -2
- package/apps/agents-server/src/app/api/metadata/import/route.ts +2 -1
- package/apps/agents-server/src/app/api/users/[username]/route.ts +3 -2
- package/apps/agents-server/src/app/api/users/route.ts +5 -4
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +1 -13
- package/apps/agents-server/src/components/Homepage/AgentsListHeader.tsx +3 -19
- package/apps/agents-server/src/components/Homepage/AgentsListListView.tsx +6 -0
- package/apps/agents-server/src/components/Homepage/AgentsListViewContent.tsx +6 -0
- package/apps/agents-server/src/components/Homepage/SortableFolderCard.tsx +7 -1
- package/apps/agents-server/src/components/Homepage/useAgentsListImportExportState.ts +45 -43
- package/apps/agents-server/src/components/Homepage/useAgentsListState.ts +1 -3
- package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +2 -10
- package/apps/agents-server/src/database/seedCoreAgents.ts +8 -7
- package/apps/agents-server/src/message-providers/email/sendgrid/verifySendgridInboundParseWebhook.ts +345 -0
- package/apps/agents-server/src/utils/agentsTransfer/createAgentsExportZipStream.ts +15 -2
- package/apps/agents-server/src/utils/authenticateUser.ts +110 -3
- package/apps/agents-server/src/utils/authenticationAttemptRateLimit.ts +504 -0
- package/apps/agents-server/src/utils/backup/createBooksBackupZipStream.ts +76 -5
- package/apps/agents-server/src/utils/chatExport/renderHtmlToPdfOnServer.ts +32 -0
- package/apps/agents-server/src/utils/chatExport/sanitizeChatPdfExportHtml.ts +193 -0
- package/apps/agents-server/src/utils/currentUserIdentity.ts +22 -9
- package/apps/agents-server/src/utils/externalChatRunner/processExternalUserChatJob.ts +5 -0
- package/apps/agents-server/src/utils/getUserById.ts +19 -5
- package/apps/agents-server/src/utils/localChatRunner/processLocalUserChatJob.ts +5 -0
- package/apps/agents-server/src/utils/metadataConfigurationTransfer.ts +32 -16
- package/apps/agents-server/src/utils/publicUser.ts +59 -0
- package/apps/agents-server/src/utils/shibbolethAuthentication.ts +17 -9
- package/apps/agents-server/src/utils/userChat/createRunUserChatJobPersistenceController.ts +17 -11
- package/apps/agents-server/src/utils/userChat/createUserChatHarnessProgressCard.ts +99 -0
- package/apps/agents-server/src/utils/userChat/createUserChatRunnerProgressCard.ts +63 -0
- package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +0 -3
- package/apps/agents-server/src/utils/vpsConfiguration.ts +3 -0
- package/esm/index.es.js +14 -5
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/book-components/Chat/Chat/createChatMessageToolCallRenderModel.ts +2 -9
- package/src/book-components/Chat/utils/isVisibleChatToolCall.ts +23 -0
- package/src/other/templates/getTemplatesPipelineCollection.ts +868 -755
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +14 -5
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-components/Chat/utils/isVisibleChatToolCall.d.ts +10 -0
- package/umd/src/version.d.ts +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AgentsServerDatabase } from '../database/schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Database row shape for the `User` table.
|
|
5
|
+
*/
|
|
6
|
+
type UserRow = AgentsServerDatabase['public']['Tables']['User']['Row'];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Public user shape safe to send to browser UI.
|
|
10
|
+
*
|
|
11
|
+
* @private internal Agents Server API shape
|
|
12
|
+
*/
|
|
13
|
+
export type PublicUser = Pick<
|
|
14
|
+
UserRow,
|
|
15
|
+
'id' | 'username' | 'isAdmin' | 'createdAt' | 'updatedAt' | 'profileImageUrl'
|
|
16
|
+
> & {
|
|
17
|
+
/**
|
|
18
|
+
* Email address from external authentication providers.
|
|
19
|
+
*/
|
|
20
|
+
readonly email?: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Human-readable display name from external authentication providers.
|
|
23
|
+
*/
|
|
24
|
+
readonly displayName?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Authentication provider marker such as `LOCAL` or `SHIBBOLETH`.
|
|
27
|
+
*/
|
|
28
|
+
readonly authenticationProvider?: string | null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Supabase projection for user fields safe to return from UI-facing endpoints.
|
|
33
|
+
*
|
|
34
|
+
* @private internal Agents Server API projection
|
|
35
|
+
*/
|
|
36
|
+
export const PUBLIC_USER_SELECT_COLUMNS: string =
|
|
37
|
+
'id, username, isAdmin, createdAt, updatedAt, profileImageUrl, email, displayName, authenticationProvider';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Maps a database user projection into the public user response shape.
|
|
41
|
+
*
|
|
42
|
+
* @param row - User projection loaded from the database.
|
|
43
|
+
* @returns User data safe to serialize to the browser.
|
|
44
|
+
*
|
|
45
|
+
* @private internal Agents Server API mapper
|
|
46
|
+
*/
|
|
47
|
+
export function toPublicUser(row: PublicUser): PublicUser {
|
|
48
|
+
return {
|
|
49
|
+
id: row.id,
|
|
50
|
+
username: row.username,
|
|
51
|
+
isAdmin: row.isAdmin,
|
|
52
|
+
createdAt: row.createdAt,
|
|
53
|
+
updatedAt: row.updatedAt,
|
|
54
|
+
profileImageUrl: row.profileImageUrl ?? null,
|
|
55
|
+
email: row.email ?? null,
|
|
56
|
+
displayName: row.displayName ?? null,
|
|
57
|
+
authenticationProvider: row.authenticationProvider ?? null,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -61,9 +61,12 @@ const SHIBBOLETH_AUTHENTICATION_PROVIDER = 'SHIBBOLETH';
|
|
|
61
61
|
const LOCAL_AND_SHIBBOLETH_AUTHENTICATION_PROVIDER = 'LOCAL_AND_SHIBBOLETH';
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* User table row
|
|
64
|
+
* User table row fields needed while linking Shibboleth identities.
|
|
65
65
|
*/
|
|
66
|
-
type UserRowWithShibbolethColumns =
|
|
66
|
+
type UserRowWithShibbolethColumns = Pick<
|
|
67
|
+
AgentsServerDatabase['public']['Tables']['User']['Row'],
|
|
68
|
+
'id' | 'username' | 'isAdmin'
|
|
69
|
+
> & {
|
|
67
70
|
readonly email?: string | null;
|
|
68
71
|
readonly displayName?: string | null;
|
|
69
72
|
readonly authenticationProvider?: string | null;
|
|
@@ -87,6 +90,11 @@ type UserUpdateWithShibbolethColumns = AgentsServerDatabase['public']['Tables'][
|
|
|
87
90
|
readonly authenticationProvider?: string | null;
|
|
88
91
|
};
|
|
89
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Supabase projection for user fields needed while linking Shibboleth identities.
|
|
95
|
+
*/
|
|
96
|
+
const SHIBBOLETH_USER_SELECT_COLUMNS: string = 'id, username, isAdmin, email, displayName, authenticationProvider';
|
|
97
|
+
|
|
90
98
|
/**
|
|
91
99
|
* Prefixed Shibboleth identity row.
|
|
92
100
|
*
|
|
@@ -791,7 +799,7 @@ async function findUserRowById(userId: number): Promise<UserRowWithShibbolethCol
|
|
|
791
799
|
const supabase = $provideSupabaseForServer();
|
|
792
800
|
const { data, error } = await supabase
|
|
793
801
|
.from(await $getTableName('User'))
|
|
794
|
-
.select(
|
|
802
|
+
.select(SHIBBOLETH_USER_SELECT_COLUMNS)
|
|
795
803
|
.eq('id', userId)
|
|
796
804
|
.maybeSingle();
|
|
797
805
|
|
|
@@ -809,7 +817,7 @@ async function findUserRowByEmail(email: string): Promise<UserRowWithShibbolethC
|
|
|
809
817
|
const supabase = $provideSupabaseForServer();
|
|
810
818
|
const { data, error } = await supabase
|
|
811
819
|
.from(await $getTableName('User'))
|
|
812
|
-
.select(
|
|
820
|
+
.select(SHIBBOLETH_USER_SELECT_COLUMNS)
|
|
813
821
|
.eq('email' as never, email as never)
|
|
814
822
|
.maybeSingle();
|
|
815
823
|
|
|
@@ -827,7 +835,7 @@ async function findUserRowByUsername(username: string): Promise<UserRowWithShibb
|
|
|
827
835
|
const supabase = $provideSupabaseForServer();
|
|
828
836
|
const { data, error } = await supabase
|
|
829
837
|
.from(await $getTableName('User'))
|
|
830
|
-
.select(
|
|
838
|
+
.select(SHIBBOLETH_USER_SELECT_COLUMNS)
|
|
831
839
|
.eq('username', username)
|
|
832
840
|
.maybeSingle();
|
|
833
841
|
|
|
@@ -859,14 +867,14 @@ async function insertShibbolethUser(
|
|
|
859
867
|
const { data, error } = await supabase
|
|
860
868
|
.from(await $getTableName('User'))
|
|
861
869
|
.insert(userInsert)
|
|
862
|
-
.select(
|
|
870
|
+
.select(SHIBBOLETH_USER_SELECT_COLUMNS)
|
|
863
871
|
.single();
|
|
864
872
|
|
|
865
873
|
if (error) {
|
|
866
874
|
throw new Error(`Failed to create Shibboleth user: ${error.message}`);
|
|
867
875
|
}
|
|
868
876
|
|
|
869
|
-
return data as UserRowWithShibbolethColumns;
|
|
877
|
+
return data as unknown as UserRowWithShibbolethColumns;
|
|
870
878
|
}
|
|
871
879
|
|
|
872
880
|
/**
|
|
@@ -892,14 +900,14 @@ async function updateLinkedShibbolethUser(
|
|
|
892
900
|
.from(await $getTableName('User'))
|
|
893
901
|
.update(userUpdate)
|
|
894
902
|
.eq('id', user.id)
|
|
895
|
-
.select(
|
|
903
|
+
.select(SHIBBOLETH_USER_SELECT_COLUMNS)
|
|
896
904
|
.single();
|
|
897
905
|
|
|
898
906
|
if (error) {
|
|
899
907
|
throw new Error(`Failed to update Shibboleth user: ${error.message}`);
|
|
900
908
|
}
|
|
901
909
|
|
|
902
|
-
return data as UserRowWithShibbolethColumns;
|
|
910
|
+
return data as unknown as UserRowWithShibbolethColumns;
|
|
903
911
|
}
|
|
904
912
|
|
|
905
913
|
/**
|
|
@@ -2,6 +2,7 @@ import { prepareToolCallsForStreaming } from '@/src/utils/toolCallStreaming';
|
|
|
2
2
|
import type { ChatMessage, LlmToolDefinition, ToolCall } from '@promptbook-local/types';
|
|
3
3
|
import type { ChatPromptResult } from '../../../../../src/execution/PromptResult';
|
|
4
4
|
import { mergeToolCalls } from '../../../../../src/utils/toolCalls/mergeToolCalls';
|
|
5
|
+
import { createUserChatHarnessProgressCard } from './createUserChatHarnessProgressCard';
|
|
5
6
|
import { persistUserChatJobTerminalState } from './persistUserChatJobTerminalState';
|
|
6
7
|
import { updateUserChatAssistantMessage } from './updateUserChatAssistantMessage';
|
|
7
8
|
import { USER_CHAT_JOB_ASSISTANT_MESSAGE_PERSIST_INTERVAL_MS } from './userChatJobRuntimeConstants';
|
|
@@ -125,17 +126,22 @@ export function createRunUserChatJobPersistenceController(options: {
|
|
|
125
126
|
}
|
|
126
127
|
|
|
127
128
|
queueAssistantMessageUpdate(
|
|
128
|
-
(message) =>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
(message) => {
|
|
130
|
+
const harnessProgressCard = createUserChatHarnessProgressCard(latestToolCalls);
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
...message,
|
|
134
|
+
content: latestContent,
|
|
135
|
+
ongoingToolCalls: latestToolCalls,
|
|
136
|
+
lifecycleState: 'running',
|
|
137
|
+
lifecycleError: undefined,
|
|
138
|
+
isComplete: false,
|
|
139
|
+
progressCard: harnessProgressCard ?? message.progressCard,
|
|
140
|
+
prompt: options.createPromptSnapshot({
|
|
141
|
+
toolCalls: latestToolCalls,
|
|
142
|
+
}),
|
|
143
|
+
};
|
|
144
|
+
},
|
|
139
145
|
{
|
|
140
146
|
snapshotSignature,
|
|
141
147
|
},
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ChatMessage, ToolCall } from '@promptbook-local/types';
|
|
2
|
+
import { spaceTrim } from '../../../../../src/_packages/utils.index';
|
|
3
|
+
import { TOOL_TITLES } from '../../../../../src/book-components/Chat/utils/getToolCallChipletInfo';
|
|
4
|
+
import { isVisibleChatToolCall } from '../../../../../src/book-components/Chat/utils/isVisibleChatToolCall';
|
|
5
|
+
import { resolveToolCallState } from '../../../../../src/book-components/Chat/utils/resolveToolCallState';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Default title used while a running chat job reports harness action progress.
|
|
9
|
+
*/
|
|
10
|
+
const USER_CHAT_HARNESS_PROGRESS_TITLE = 'Working on your request';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates a user-facing progress card from the latest visible harness/tool action.
|
|
14
|
+
*
|
|
15
|
+
* @param toolCalls - Latest aggregated tool-call snapshots emitted by the agent runtime.
|
|
16
|
+
* @returns Progress card for the latest visible action, or null when there is no user-facing action yet.
|
|
17
|
+
*/
|
|
18
|
+
export function createUserChatHarnessProgressCard(
|
|
19
|
+
toolCalls: ReadonlyArray<ToolCall> | undefined,
|
|
20
|
+
): NonNullable<ChatMessage['progressCard']> | null {
|
|
21
|
+
const latestVisibleToolCall = resolveLatestVisibleToolCall(toolCalls);
|
|
22
|
+
if (!latestVisibleToolCall) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
title: USER_CHAT_HARNESS_PROGRESS_TITLE,
|
|
28
|
+
now: createHarnessProgressNowText(latestVisibleToolCall),
|
|
29
|
+
items: [],
|
|
30
|
+
updatedAt: new Date().toISOString() as NonNullable<ChatMessage['progressCard']>['updatedAt'],
|
|
31
|
+
isVisible: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the latest user-facing tool call from an aggregated runtime snapshot.
|
|
37
|
+
*
|
|
38
|
+
* @private internal helper of `createUserChatHarnessProgressCard`
|
|
39
|
+
*/
|
|
40
|
+
function resolveLatestVisibleToolCall(toolCalls: ReadonlyArray<ToolCall> | undefined): ToolCall | null {
|
|
41
|
+
if (!toolCalls || toolCalls.length === 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (let index = toolCalls.length - 1; index >= 0; index--) {
|
|
46
|
+
const toolCall = toolCalls[index]!;
|
|
47
|
+
if (isVisibleChatToolCall(toolCall)) {
|
|
48
|
+
return toolCall;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates the current-action text shown in the progress card.
|
|
57
|
+
*
|
|
58
|
+
* @private internal helper of `createUserChatHarnessProgressCard`
|
|
59
|
+
*/
|
|
60
|
+
function createHarnessProgressNowText(toolCall: ToolCall): string {
|
|
61
|
+
const actionLabel = resolveToolCallActionLabel(toolCall);
|
|
62
|
+
const toolCallState = resolveToolCallState(toolCall);
|
|
63
|
+
|
|
64
|
+
switch (toolCallState) {
|
|
65
|
+
case 'COMPLETE':
|
|
66
|
+
return spaceTrim(`
|
|
67
|
+
Action completed: ${actionLabel}.
|
|
68
|
+
`);
|
|
69
|
+
case 'ERROR':
|
|
70
|
+
return spaceTrim(`
|
|
71
|
+
Action failed: ${actionLabel}.
|
|
72
|
+
`);
|
|
73
|
+
case 'PENDING':
|
|
74
|
+
case 'PARTIAL':
|
|
75
|
+
default:
|
|
76
|
+
return spaceTrim(`
|
|
77
|
+
Running action: ${actionLabel}.
|
|
78
|
+
`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Resolves a concise user-facing action label from one technical tool call name.
|
|
84
|
+
*
|
|
85
|
+
* @private internal helper of `createUserChatHarnessProgressCard`
|
|
86
|
+
*/
|
|
87
|
+
function resolveToolCallActionLabel(toolCall: ToolCall): string {
|
|
88
|
+
const knownTitle = TOOL_TITLES[toolCall.name]?.title;
|
|
89
|
+
if (knownTitle) {
|
|
90
|
+
return knownTitle;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const normalizedName = toolCall.name
|
|
94
|
+
.trim()
|
|
95
|
+
.replace(/[_-]+/g, ' ')
|
|
96
|
+
.replace(/\s+/g, ' ');
|
|
97
|
+
|
|
98
|
+
return normalizedName || 'agent action';
|
|
99
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ChatMessage } from '@promptbook-local/types';
|
|
2
|
+
import { spaceTrim } from '../../../../../src/_packages/utils.index';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Runner types that can own durable chat work outside the browser request.
|
|
6
|
+
*/
|
|
7
|
+
export type UserChatRunnerKind = 'local' | 'external';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Runner progress phases visible before a final answer is available.
|
|
11
|
+
*/
|
|
12
|
+
export type UserChatRunnerProgressPhase = 'queued_for_runner';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Default title used while an out-of-process runner is working on a chat answer.
|
|
16
|
+
*/
|
|
17
|
+
const USER_CHAT_RUNNER_PROGRESS_TITLE = 'Working on your request';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* User-facing labels for durable chat runners.
|
|
21
|
+
*/
|
|
22
|
+
const USER_CHAT_RUNNER_LABELS: Record<UserChatRunnerKind, string> = {
|
|
23
|
+
local: 'local agent runner',
|
|
24
|
+
external: 'external agent runner',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a progress card for the observable state of an out-of-process chat runner.
|
|
29
|
+
*
|
|
30
|
+
* @param options - Runner kind and current progress phase.
|
|
31
|
+
* @returns Progress card with one concise real runner state.
|
|
32
|
+
*/
|
|
33
|
+
export function createUserChatRunnerProgressCard(options: {
|
|
34
|
+
readonly runnerKind: UserChatRunnerKind;
|
|
35
|
+
readonly phase: UserChatRunnerProgressPhase;
|
|
36
|
+
}): NonNullable<ChatMessage['progressCard']> {
|
|
37
|
+
return {
|
|
38
|
+
title: USER_CHAT_RUNNER_PROGRESS_TITLE,
|
|
39
|
+
now: createUserChatRunnerProgressNowText(options),
|
|
40
|
+
items: [],
|
|
41
|
+
updatedAt: new Date().toISOString() as NonNullable<ChatMessage['progressCard']>['updatedAt'],
|
|
42
|
+
isVisible: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates the current runner-state text shown in the progress card.
|
|
48
|
+
*
|
|
49
|
+
* @private internal helper of `createUserChatRunnerProgressCard`
|
|
50
|
+
*/
|
|
51
|
+
function createUserChatRunnerProgressNowText(options: {
|
|
52
|
+
readonly runnerKind: UserChatRunnerKind;
|
|
53
|
+
readonly phase: UserChatRunnerProgressPhase;
|
|
54
|
+
}): string {
|
|
55
|
+
const runnerLabel = USER_CHAT_RUNNER_LABELS[options.runnerKind];
|
|
56
|
+
|
|
57
|
+
switch (options.phase) {
|
|
58
|
+
case 'queued_for_runner':
|
|
59
|
+
return spaceTrim(`
|
|
60
|
+
The ${runnerLabel} has the request and is working on the answer.
|
|
61
|
+
`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { ChatMessage } from '../../../../../src/_packages/types.index';
|
|
2
|
-
import { createUserChatProgressCard } from './userChatProgressCard';
|
|
3
|
-
|
|
4
2
|
/**
|
|
5
3
|
* Lifecycle states rendered on canonical server-owned chat messages.
|
|
6
4
|
*/
|
|
@@ -46,7 +44,6 @@ export function createQueuedUserChatAssistantMessage(options: {
|
|
|
46
44
|
isComplete: false,
|
|
47
45
|
lifecycleState: 'queued',
|
|
48
46
|
jobId: options.jobId,
|
|
49
|
-
progressCard: createUserChatProgressCard('queued'),
|
|
50
47
|
};
|
|
51
48
|
}
|
|
52
49
|
|
|
@@ -25,6 +25,9 @@ export const VPS_ENVIRONMENT_VARIABLE_KEYS = [
|
|
|
25
25
|
'SESSION_SECRET',
|
|
26
26
|
'PTBK_AGENTS_SERVER_USER_CHAT_WORKER_TOKEN',
|
|
27
27
|
'PROMPTBOOK_TEAM_AGENT_ACCESS_TOKEN',
|
|
28
|
+
'SENDGRID_INBOUND_PARSE_PUBLIC_KEY',
|
|
29
|
+
'SENDGRID_INBOUND_PARSE_WEBHOOK_SECRET',
|
|
30
|
+
'SENDGRID_INBOUND_PARSE_HOSTS',
|
|
28
31
|
'OPENAI_API_KEY',
|
|
29
32
|
'PTBK_HARNESS',
|
|
30
33
|
'PTBK_MODEL',
|
package/esm/index.es.js
CHANGED
|
@@ -59,7 +59,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
59
59
|
* @generated
|
|
60
60
|
* @see https://github.com/webgptorg/promptbook
|
|
61
61
|
*/
|
|
62
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
62
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-140';
|
|
63
63
|
/**
|
|
64
64
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
65
65
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -28825,6 +28825,18 @@ async function runScriptUntilMarkerIdle(options) {
|
|
|
28825
28825
|
settleOnce(handler);
|
|
28826
28826
|
});
|
|
28827
28827
|
};
|
|
28828
|
+
/**
|
|
28829
|
+
* Finishes a marker-completed run and then asks bash to stop.
|
|
28830
|
+
*/
|
|
28831
|
+
const finishAfterIdleTimeout = () => {
|
|
28832
|
+
settleWithLog('completed after idle timeout', () => resolve(fullOutput));
|
|
28833
|
+
try {
|
|
28834
|
+
commandProcess.kill();
|
|
28835
|
+
}
|
|
28836
|
+
catch (_a) {
|
|
28837
|
+
// Windows can report EPERM when bash exits before the idle timer fires.
|
|
28838
|
+
}
|
|
28839
|
+
};
|
|
28828
28840
|
/**
|
|
28829
28841
|
* Resets the idle timer that triggers termination after inactivity.
|
|
28830
28842
|
*/
|
|
@@ -28832,10 +28844,7 @@ async function runScriptUntilMarkerIdle(options) {
|
|
|
28832
28844
|
if (idleTimer) {
|
|
28833
28845
|
clearTimeout(idleTimer);
|
|
28834
28846
|
}
|
|
28835
|
-
idleTimer = setTimeout(
|
|
28836
|
-
commandProcess.kill();
|
|
28837
|
-
settleWithLog('completed after idle timeout', () => resolve(fullOutput));
|
|
28838
|
-
}, idleTimeoutMs);
|
|
28847
|
+
idleTimer = setTimeout(finishAfterIdleTimeout, idleTimeoutMs);
|
|
28839
28848
|
};
|
|
28840
28849
|
/**
|
|
28841
28850
|
* Processes completed output lines to detect completion markers.
|