@promptbook/cli 0.104.0-1 → 0.104.0-2
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/next.config.ts +2 -2
- package/apps/agents-server/package.json +6 -1
- package/apps/agents-server/public/fonts/OpenMoji-color-cbdt.woff2 +0 -0
- package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +50 -0
- package/apps/agents-server/scripts/generate-reserved-paths/tsconfig.json +19 -0
- package/apps/agents-server/src/app/AddAgentButton.tsx +4 -3
- package/apps/agents-server/src/app/actions.ts +17 -5
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +15 -11
- package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +51 -7
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +32 -2
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileWrapper.tsx +2 -0
- package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +18 -0
- package/apps/agents-server/src/app/agents/[agentName]/agentLinks.tsx +8 -8
- package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +17 -26
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +17 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +1 -1
- package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +1 -1
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +20 -16
- package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +15 -2
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/page.tsx +15 -2
- package/apps/agents-server/src/app/agents/[agentName]/chat/page.tsx +12 -0
- package/apps/agents-server/src/app/agents/[agentName]/code/api/route.ts +66 -0
- package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +211 -0
- package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +5 -0
- package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +2 -2
- package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +1 -1
- package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +2 -2
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +12 -6
- package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +87 -0
- package/apps/agents-server/src/app/api/admin-email/route.ts +12 -0
- package/apps/agents-server/src/app/api/agents/[agentName]/restore/route.ts +19 -0
- package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +42 -0
- package/apps/agents-server/src/app/api/agents/route.ts +29 -4
- package/apps/agents-server/src/app/api/docs/book.md/route.ts +58 -0
- package/apps/agents-server/src/app/api/federated-agents/route.ts +12 -0
- package/apps/agents-server/src/app/api/images/[filename]/route.ts +107 -0
- package/apps/agents-server/src/app/api/upload/route.ts +119 -45
- package/apps/agents-server/src/app/docs/[docId]/page.tsx +2 -3
- package/apps/agents-server/src/app/docs/page.tsx +12 -12
- package/apps/agents-server/src/app/globals.css +140 -33
- package/apps/agents-server/src/app/layout.tsx +27 -22
- package/apps/agents-server/src/app/page.tsx +50 -4
- package/apps/agents-server/src/app/recycle-bin/actions.ts +20 -14
- package/apps/agents-server/src/app/recycle-bin/page.tsx +25 -41
- package/apps/agents-server/src/app/sitemap.xml/route.ts +6 -3
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +6 -97
- package/apps/agents-server/src/components/AgentProfile/useAgentBackground.ts +97 -0
- package/apps/agents-server/src/components/DeletedAgentBanner.tsx +26 -0
- package/apps/agents-server/src/components/DocsToolbar/DocsToolbar.tsx +38 -0
- package/apps/agents-server/src/components/DocumentationContent/DocumentationContent.tsx +11 -9
- package/apps/agents-server/src/components/Footer/Footer.tsx +5 -5
- package/apps/agents-server/src/components/ForgottenPasswordDialog/ForgottenPasswordDialog.tsx +61 -0
- package/apps/agents-server/src/components/Header/Header.tsx +79 -35
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +85 -20
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +72 -12
- package/apps/agents-server/src/components/Homepage/DeletedAgentsList.tsx +50 -0
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +3 -2
- package/apps/agents-server/src/components/LoginForm/LoginForm.tsx +50 -1
- package/apps/agents-server/src/components/NotFoundPage/NotFoundPage.tsx +7 -2
- package/apps/agents-server/src/components/OpenMojiIcon/OpenMojiIcon.tsx +16 -7
- package/apps/agents-server/src/components/PrintHeader/PrintHeader.tsx +4 -4
- package/apps/agents-server/src/components/RegisterUserDialog/RegisterUserDialog.tsx +61 -0
- package/apps/agents-server/src/database/metadataDefaults.ts +19 -1
- package/apps/agents-server/src/database/migrations/2025-12-0240-agent-public-id.sql +3 -0
- package/apps/agents-server/src/database/migrations/2025-12-0360-agent-deleted-at.sql +1 -0
- package/apps/agents-server/src/database/migrations/2025-12-0370-image-table.sql +19 -0
- package/apps/agents-server/src/database/migrations/2025-12-0380-agent-visibility.sql +1 -0
- package/apps/agents-server/src/database/migrations/2025-12-0390-upload-tracking.sql +20 -0
- package/apps/agents-server/src/database/migrations/2025-12-0401-file-upload-status.sql +13 -0
- package/apps/agents-server/src/database/migrations/2025-12-0640-openai-assistant-cache.sql +12 -0
- package/apps/agents-server/src/database/schema.ts +109 -0
- package/apps/agents-server/src/generated/reservedPaths.ts +27 -0
- package/apps/agents-server/src/middleware.ts +7 -20
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +6 -1
- package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +57 -0
- package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +4 -0
- package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +18 -0
- package/apps/agents-server/src/utils/getUserIdFromRequest.ts +33 -0
- package/apps/agents-server/src/utils/handleChatCompletion.ts +60 -4
- package/apps/agents-server/src/utils/normalization/filenameToPrompt.ts +21 -0
- package/apps/agents-server/src/utils/validateApiKey.ts +2 -1
- package/esm/index.es.js +140 -27
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +6 -2
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +6 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatMessageItem.d.ts +5 -1
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +5 -0
- package/esm/typings/src/book-components/Chat/CodeBlock/CodeBlock.d.ts +13 -0
- package/esm/typings/src/book-components/Chat/MarkdownContent/MarkdownContent.d.ts +1 -0
- package/esm/typings/src/book-components/_common/Dropdown/Dropdown.d.ts +2 -2
- package/esm/typings/src/book-components/_common/MenuHoisting/MenuHoistingContext.d.ts +56 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +13 -7
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +6 -0
- package/esm/typings/src/commitments/DICTIONARY/DICTIONARY.d.ts +46 -0
- package/esm/typings/src/commitments/index.d.ts +2 -1
- package/esm/typings/src/llm-providers/ollama/OllamaExecutionTools.d.ts +1 -1
- package/esm/typings/src/llm-providers/openai/createOpenAiCompatibleExecutionTools.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +12 -0
- package/esm/typings/src/utils/environment/$detectRuntimeEnvironment.d.ts +4 -4
- package/esm/typings/src/utils/environment/$isRunningInBrowser.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInJest.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInNode.d.ts +1 -1
- package/esm/typings/src/utils/environment/$isRunningInWebWorker.d.ts +1 -1
- package/esm/typings/src/utils/markdown/extractAllBlocksFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/markdown/extractOneBlockFromMarkdown.d.ts +2 -2
- package/esm/typings/src/utils/random/$randomBase58.d.ts +12 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +146 -33
- package/umd/index.umd.js.map +1 -1
- package/apps/agents-server/package-lock.json +0 -27
- package/apps/agents-server/public/fonts/download-font.js +0 -22
- package/apps/agents-server/src/components/PrintButton/PrintButton.tsx +0 -18
package/umd/index.umd.js
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* @generated
|
|
57
57
|
* @see https://github.com/webgptorg/promptbook
|
|
58
58
|
*/
|
|
59
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
59
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-2';
|
|
60
60
|
/**
|
|
61
61
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
62
62
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1382,13 +1382,14 @@
|
|
|
1382
1382
|
*
|
|
1383
1383
|
* @public exported from `@promptbook/utils`
|
|
1384
1384
|
*/
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1385
|
+
function $isRunningInNode() {
|
|
1386
|
+
try {
|
|
1387
|
+
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
1388
|
+
}
|
|
1389
|
+
catch (e) {
|
|
1390
|
+
return false;
|
|
1391
|
+
}
|
|
1390
1392
|
}
|
|
1391
|
-
`);
|
|
1392
1393
|
/**
|
|
1393
1394
|
* TODO: [🎺]
|
|
1394
1395
|
*/
|
|
@@ -1400,13 +1401,14 @@
|
|
|
1400
1401
|
*
|
|
1401
1402
|
* @public exported from `@promptbook/utils`
|
|
1402
1403
|
*/
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1404
|
+
function $isRunningInBrowser() {
|
|
1405
|
+
try {
|
|
1406
|
+
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
1407
|
+
}
|
|
1408
|
+
catch (e) {
|
|
1409
|
+
return false;
|
|
1410
|
+
}
|
|
1408
1411
|
}
|
|
1409
|
-
`);
|
|
1410
1412
|
/**
|
|
1411
1413
|
* TODO: [🎺]
|
|
1412
1414
|
*/
|
|
@@ -1418,13 +1420,15 @@
|
|
|
1418
1420
|
*
|
|
1419
1421
|
* @public exported from `@promptbook/utils`
|
|
1420
1422
|
*/
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1423
|
+
function $isRunningInJest() {
|
|
1424
|
+
var _a;
|
|
1425
|
+
try {
|
|
1426
|
+
return typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.JEST_WORKER_ID) !== undefined;
|
|
1427
|
+
}
|
|
1428
|
+
catch (e) {
|
|
1429
|
+
return false;
|
|
1430
|
+
}
|
|
1426
1431
|
}
|
|
1427
|
-
`);
|
|
1428
1432
|
/**
|
|
1429
1433
|
* TODO: [🎺]
|
|
1430
1434
|
*/
|
|
@@ -1436,17 +1440,17 @@
|
|
|
1436
1440
|
*
|
|
1437
1441
|
* @public exported from `@promptbook/utils`
|
|
1438
1442
|
*/
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1443
|
+
function $isRunningInWebWorker() {
|
|
1444
|
+
try {
|
|
1445
|
+
// Note: Check for importScripts which is specific to workers
|
|
1446
|
+
// and not available in the main browser thread
|
|
1447
|
+
return (typeof self !== 'undefined' &&
|
|
1448
|
+
typeof self.importScripts === 'function');
|
|
1449
|
+
}
|
|
1450
|
+
catch (e) {
|
|
1444
1451
|
return false;
|
|
1445
1452
|
}
|
|
1446
|
-
} catch (e) {
|
|
1447
|
-
return false;
|
|
1448
1453
|
}
|
|
1449
|
-
`);
|
|
1450
1454
|
/**
|
|
1451
1455
|
* TODO: [🎺]
|
|
1452
1456
|
*/
|
|
@@ -1964,7 +1968,7 @@
|
|
|
1964
1968
|
${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
|
|
1965
1969
|
${morePieces.join('; ')}
|
|
1966
1970
|
`);
|
|
1967
|
-
if ($isRunningInNode) {
|
|
1971
|
+
if ($isRunningInNode()) {
|
|
1968
1972
|
if (isInstalled && isFullyConfigured) {
|
|
1969
1973
|
providerMessage = colors__default["default"].green(providerMessage);
|
|
1970
1974
|
}
|
|
@@ -20409,10 +20413,10 @@
|
|
|
20409
20413
|
// <- TODO: [🛄]
|
|
20410
20414
|
}
|
|
20411
20415
|
/**
|
|
20412
|
-
* Default model for
|
|
20416
|
+
* Default model for completion variant.
|
|
20413
20417
|
*/
|
|
20414
20418
|
getDefaultImageGenerationModel() {
|
|
20415
|
-
return this.getDefaultModel('
|
|
20419
|
+
return this.getDefaultModel('dall-e-3');
|
|
20416
20420
|
// <- TODO: [🛄]
|
|
20417
20421
|
}
|
|
20418
20422
|
}
|
|
@@ -21227,11 +21231,10 @@
|
|
|
21227
21231
|
throw new PipelineExecutionError(`${this.title} does not support EMBEDDING model variant`);
|
|
21228
21232
|
}
|
|
21229
21233
|
/**
|
|
21230
|
-
* Default model for
|
|
21234
|
+
* Default model for completion variant.
|
|
21231
21235
|
*/
|
|
21232
21236
|
getDefaultImageGenerationModel() {
|
|
21233
|
-
|
|
21234
|
-
// <- TODO: [🛄]
|
|
21237
|
+
throw new PipelineExecutionError(`${this.title} does not support IMAGE_GENERATION model variant`);
|
|
21235
21238
|
}
|
|
21236
21239
|
}
|
|
21237
21240
|
/**
|
|
@@ -23107,6 +23110,114 @@
|
|
|
23107
23110
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23108
23111
|
*/
|
|
23109
23112
|
|
|
23113
|
+
/**
|
|
23114
|
+
* DICTIONARY commitment definition
|
|
23115
|
+
*
|
|
23116
|
+
* The DICTIONARY commitment defines specific terms and their meanings that the agent should use correctly
|
|
23117
|
+
* in its reasoning and responses. This ensures consistent terminology usage.
|
|
23118
|
+
*
|
|
23119
|
+
* Key features:
|
|
23120
|
+
* - Multiple DICTIONARY commitments are automatically merged into one
|
|
23121
|
+
* - Content is placed in a dedicated section of the system message
|
|
23122
|
+
* - Terms and definitions are stored in metadata.DICTIONARY for debugging
|
|
23123
|
+
* - Agent should use the defined terms correctly in responses
|
|
23124
|
+
*
|
|
23125
|
+
* Example usage in agent source:
|
|
23126
|
+
*
|
|
23127
|
+
* ```book
|
|
23128
|
+
* Legal Assistant
|
|
23129
|
+
*
|
|
23130
|
+
* PERSONA You are a knowledgeable legal assistant
|
|
23131
|
+
* DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
|
|
23132
|
+
* DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
|
|
23133
|
+
* DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
|
|
23134
|
+
* ```
|
|
23135
|
+
*
|
|
23136
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
23137
|
+
*/
|
|
23138
|
+
class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
23139
|
+
constructor() {
|
|
23140
|
+
super('DICTIONARY');
|
|
23141
|
+
}
|
|
23142
|
+
/**
|
|
23143
|
+
* Short one-line description of DICTIONARY.
|
|
23144
|
+
*/
|
|
23145
|
+
get description() {
|
|
23146
|
+
return 'Define terms and their meanings for consistent terminology usage.';
|
|
23147
|
+
}
|
|
23148
|
+
/**
|
|
23149
|
+
* Icon for this commitment.
|
|
23150
|
+
*/
|
|
23151
|
+
get icon() {
|
|
23152
|
+
return '📚';
|
|
23153
|
+
}
|
|
23154
|
+
/**
|
|
23155
|
+
* Markdown documentation for DICTIONARY commitment.
|
|
23156
|
+
*/
|
|
23157
|
+
get documentation() {
|
|
23158
|
+
return spaceTrim$1.spaceTrim(`
|
|
23159
|
+
# DICTIONARY
|
|
23160
|
+
|
|
23161
|
+
Defines specific terms and their meanings that the agent should use correctly in reasoning and responses.
|
|
23162
|
+
|
|
23163
|
+
## Key aspects
|
|
23164
|
+
|
|
23165
|
+
- Multiple \`DICTIONARY\` commitments are merged together.
|
|
23166
|
+
- Terms are defined in the format: "Term is definition"
|
|
23167
|
+
- The agent should use these terms consistently in responses.
|
|
23168
|
+
- Definitions help ensure accurate and consistent terminology.
|
|
23169
|
+
|
|
23170
|
+
## Examples
|
|
23171
|
+
|
|
23172
|
+
\`\`\`book
|
|
23173
|
+
Legal Assistant
|
|
23174
|
+
|
|
23175
|
+
PERSONA You are a knowledgeable legal assistant specializing in criminal law
|
|
23176
|
+
DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
|
|
23177
|
+
DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
|
|
23178
|
+
DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
|
|
23179
|
+
\`\`\`
|
|
23180
|
+
|
|
23181
|
+
\`\`\`book
|
|
23182
|
+
Medical Assistant
|
|
23183
|
+
|
|
23184
|
+
PERSONA You are a helpful medical assistant
|
|
23185
|
+
DICTIONARY Hypertension is persistently high blood pressure
|
|
23186
|
+
DICTIONARY Diabetes is a chronic condition that affects how the body processes blood sugar
|
|
23187
|
+
DICTIONARY Vaccine is a biological preparation that provides active immunity to a particular disease
|
|
23188
|
+
\`\`\`
|
|
23189
|
+
`);
|
|
23190
|
+
}
|
|
23191
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
23192
|
+
var _a;
|
|
23193
|
+
const trimmedContent = content.trim();
|
|
23194
|
+
if (!trimmedContent) {
|
|
23195
|
+
return requirements;
|
|
23196
|
+
}
|
|
23197
|
+
// Get existing dictionary entries from metadata
|
|
23198
|
+
const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
|
|
23199
|
+
// Merge the new dictionary entry with existing entries
|
|
23200
|
+
const mergedDictionary = existingDictionary
|
|
23201
|
+
? `${existingDictionary}\n${trimmedContent}`
|
|
23202
|
+
: trimmedContent;
|
|
23203
|
+
// Store the merged dictionary in metadata for debugging and inspection
|
|
23204
|
+
const updatedMetadata = {
|
|
23205
|
+
...requirements.metadata,
|
|
23206
|
+
DICTIONARY: mergedDictionary,
|
|
23207
|
+
};
|
|
23208
|
+
// Create the dictionary section for the system message
|
|
23209
|
+
// Format: "# DICTIONARY\nTerm: definition\nTerm: definition..."
|
|
23210
|
+
const dictionarySection = `# DICTIONARY\n${mergedDictionary}`;
|
|
23211
|
+
return {
|
|
23212
|
+
...this.appendToSystemMessage(requirements, dictionarySection),
|
|
23213
|
+
metadata: updatedMetadata,
|
|
23214
|
+
};
|
|
23215
|
+
}
|
|
23216
|
+
}
|
|
23217
|
+
/**
|
|
23218
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23219
|
+
*/
|
|
23220
|
+
|
|
23110
23221
|
/**
|
|
23111
23222
|
* FORMAT commitment definition
|
|
23112
23223
|
*
|
|
@@ -25927,6 +26038,7 @@
|
|
|
25927
26038
|
new DeleteCommitmentDefinition('CANCEL'),
|
|
25928
26039
|
new DeleteCommitmentDefinition('DISCARD'),
|
|
25929
26040
|
new DeleteCommitmentDefinition('REMOVE'),
|
|
26041
|
+
new DictionaryCommitmentDefinition(),
|
|
25930
26042
|
new OpenCommitmentDefinition(),
|
|
25931
26043
|
new ClosedCommitmentDefinition(),
|
|
25932
26044
|
new UseBrowserCommitmentDefinition(),
|
|
@@ -26432,6 +26544,7 @@
|
|
|
26432
26544
|
return {
|
|
26433
26545
|
agentName: normalizeAgentName(parseResult.agentName || createDefaultAgentName(agentSource)),
|
|
26434
26546
|
agentHash,
|
|
26547
|
+
permanentId: meta.id,
|
|
26435
26548
|
personaDescription,
|
|
26436
26549
|
initialMessage,
|
|
26437
26550
|
meta,
|