@promptbook/cli 0.104.0-1 → 0.104.0-3
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 +7 -3
- package/apps/agents-server/public/fonts/OpenMoji-color-cbdt.woff2 +0 -0
- package/apps/agents-server/public/swagger.json +115 -0
- package/apps/agents-server/scripts/generate-reserved-paths/generate-reserved-paths.ts +54 -0
- package/apps/agents-server/scripts/generate-reserved-paths/tsconfig.json +19 -0
- package/apps/agents-server/src/app/AddAgentButton.tsx +3 -3
- package/apps/agents-server/src/app/actions.ts +17 -5
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +221 -274
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +94 -137
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +23 -19
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +15 -1
- package/apps/agents-server/src/app/agents/[agentName]/AgentOptionsMenu.tsx +51 -9
- package/apps/agents-server/src/app/agents/[agentName]/AgentProfileChat.tsx +47 -4
- 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 +20 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/mcp/route.ts +6 -11
- 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 +5 -2
- 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 +68 -0
- package/apps/agents-server/src/app/agents/[agentName]/code/page.tsx +214 -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]/clone/route.ts +10 -12
- 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 +41 -0
- package/apps/agents-server/src/app/api/agents/route.ts +28 -3
- package/apps/agents-server/src/app/api/api-tokens/route.ts +6 -7
- package/apps/agents-server/src/app/api/docs/book.md/route.ts +61 -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/metadata/route.ts +5 -6
- package/apps/agents-server/src/app/api/upload/route.ts +128 -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/app/swagger/page.tsx +14 -0
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +9 -98
- package/apps/agents-server/src/components/AgentProfile/QrCodeModal.tsx +0 -1
- package/apps/agents-server/src/components/AgentProfile/useAgentBackground.ts +97 -0
- package/apps/agents-server/src/components/Auth/AuthControls.tsx +5 -4
- 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 +106 -40
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +104 -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/components/_utils/headlessParam.tsx +7 -3
- 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 +32 -0
- package/apps/agents-server/src/middleware.ts +19 -23
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +6 -1
- package/apps/agents-server/src/utils/auth.ts +117 -17
- 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 +35 -0
- package/apps/agents-server/src/utils/handleChatCompletion.ts +65 -5
- package/apps/agents-server/src/utils/normalization/filenameToPrompt.ts +21 -0
- package/apps/agents-server/src/utils/validateApiKey.ts +7 -11
- package/esm/index.es.js +194 -34
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/types.index.d.ts +8 -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/Chat/types/ChatMessage.d.ts +7 -11
- 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/Message.d.ts +49 -0
- 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 +200 -40
- 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/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-3';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1373,13 +1373,14 @@ class EnvironmentMismatchError extends Error {
|
|
|
1373
1373
|
*
|
|
1374
1374
|
* @public exported from `@promptbook/utils`
|
|
1375
1375
|
*/
|
|
1376
|
-
|
|
1376
|
+
function $isRunningInNode() {
|
|
1377
1377
|
try {
|
|
1378
|
-
return
|
|
1379
|
-
}
|
|
1378
|
+
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
1379
|
+
}
|
|
1380
|
+
catch (e) {
|
|
1380
1381
|
return false;
|
|
1381
1382
|
}
|
|
1382
|
-
|
|
1383
|
+
}
|
|
1383
1384
|
/**
|
|
1384
1385
|
* TODO: [🎺]
|
|
1385
1386
|
*/
|
|
@@ -1391,13 +1392,14 @@ const $isRunningInNode = new Function(`
|
|
|
1391
1392
|
*
|
|
1392
1393
|
* @public exported from `@promptbook/utils`
|
|
1393
1394
|
*/
|
|
1394
|
-
|
|
1395
|
+
function $isRunningInBrowser() {
|
|
1395
1396
|
try {
|
|
1396
|
-
return
|
|
1397
|
-
}
|
|
1397
|
+
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
|
1398
|
+
}
|
|
1399
|
+
catch (e) {
|
|
1398
1400
|
return false;
|
|
1399
1401
|
}
|
|
1400
|
-
|
|
1402
|
+
}
|
|
1401
1403
|
/**
|
|
1402
1404
|
* TODO: [🎺]
|
|
1403
1405
|
*/
|
|
@@ -1409,13 +1411,15 @@ const $isRunningInBrowser = new Function(`
|
|
|
1409
1411
|
*
|
|
1410
1412
|
* @public exported from `@promptbook/utils`
|
|
1411
1413
|
*/
|
|
1412
|
-
|
|
1414
|
+
function $isRunningInJest() {
|
|
1415
|
+
var _a;
|
|
1413
1416
|
try {
|
|
1414
|
-
return process.env.JEST_WORKER_ID !== undefined;
|
|
1415
|
-
}
|
|
1417
|
+
return typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.JEST_WORKER_ID) !== undefined;
|
|
1418
|
+
}
|
|
1419
|
+
catch (e) {
|
|
1416
1420
|
return false;
|
|
1417
1421
|
}
|
|
1418
|
-
|
|
1422
|
+
}
|
|
1419
1423
|
/**
|
|
1420
1424
|
* TODO: [🎺]
|
|
1421
1425
|
*/
|
|
@@ -1427,17 +1431,17 @@ const $isRunningInJest = new Function(`
|
|
|
1427
1431
|
*
|
|
1428
1432
|
* @public exported from `@promptbook/utils`
|
|
1429
1433
|
*/
|
|
1430
|
-
|
|
1434
|
+
function $isRunningInWebWorker() {
|
|
1431
1435
|
try {
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1436
|
+
// Note: Check for importScripts which is specific to workers
|
|
1437
|
+
// and not available in the main browser thread
|
|
1438
|
+
return (typeof self !== 'undefined' &&
|
|
1439
|
+
typeof self.importScripts === 'function');
|
|
1440
|
+
}
|
|
1441
|
+
catch (e) {
|
|
1438
1442
|
return false;
|
|
1439
1443
|
}
|
|
1440
|
-
|
|
1444
|
+
}
|
|
1441
1445
|
/**
|
|
1442
1446
|
* TODO: [🎺]
|
|
1443
1447
|
*/
|
|
@@ -1955,7 +1959,7 @@ function $registeredLlmToolsMessage() {
|
|
|
1955
1959
|
${i + 1}) **${title}** \`${className}\` from \`${packageName}\`
|
|
1956
1960
|
${morePieces.join('; ')}
|
|
1957
1961
|
`);
|
|
1958
|
-
if ($isRunningInNode) {
|
|
1962
|
+
if ($isRunningInNode()) {
|
|
1959
1963
|
if (isInstalled && isFullyConfigured) {
|
|
1960
1964
|
providerMessage = colors.green(providerMessage);
|
|
1961
1965
|
}
|
|
@@ -19444,7 +19448,7 @@ class OpenAiCompatibleExecutionTools {
|
|
|
19444
19448
|
let threadMessages = [];
|
|
19445
19449
|
if ('thread' in prompt && Array.isArray(prompt.thread)) {
|
|
19446
19450
|
threadMessages = prompt.thread.map((msg) => ({
|
|
19447
|
-
role: msg.
|
|
19451
|
+
role: msg.sender === 'assistant' ? 'assistant' : 'user',
|
|
19448
19452
|
content: msg.content,
|
|
19449
19453
|
}));
|
|
19450
19454
|
}
|
|
@@ -20400,10 +20404,10 @@ class OllamaExecutionTools extends OpenAiCompatibleExecutionTools {
|
|
|
20400
20404
|
// <- TODO: [🛄]
|
|
20401
20405
|
}
|
|
20402
20406
|
/**
|
|
20403
|
-
* Default model for
|
|
20407
|
+
* Default model for completion variant.
|
|
20404
20408
|
*/
|
|
20405
20409
|
getDefaultImageGenerationModel() {
|
|
20406
|
-
return this.getDefaultModel('
|
|
20410
|
+
return this.getDefaultModel('dall-e-3');
|
|
20407
20411
|
// <- TODO: [🛄]
|
|
20408
20412
|
}
|
|
20409
20413
|
}
|
|
@@ -21218,11 +21222,10 @@ class HardcodedOpenAiCompatibleExecutionTools extends OpenAiCompatibleExecutionT
|
|
|
21218
21222
|
throw new PipelineExecutionError(`${this.title} does not support EMBEDDING model variant`);
|
|
21219
21223
|
}
|
|
21220
21224
|
/**
|
|
21221
|
-
* Default model for
|
|
21225
|
+
* Default model for completion variant.
|
|
21222
21226
|
*/
|
|
21223
21227
|
getDefaultImageGenerationModel() {
|
|
21224
|
-
|
|
21225
|
-
// <- TODO: [🛄]
|
|
21228
|
+
throw new PipelineExecutionError(`${this.title} does not support IMAGE_GENERATION model variant`);
|
|
21226
21229
|
}
|
|
21227
21230
|
}
|
|
21228
21231
|
/**
|
|
@@ -23098,6 +23101,114 @@ class DeleteCommitmentDefinition extends BaseCommitmentDefinition {
|
|
|
23098
23101
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23099
23102
|
*/
|
|
23100
23103
|
|
|
23104
|
+
/**
|
|
23105
|
+
* DICTIONARY commitment definition
|
|
23106
|
+
*
|
|
23107
|
+
* The DICTIONARY commitment defines specific terms and their meanings that the agent should use correctly
|
|
23108
|
+
* in its reasoning and responses. This ensures consistent terminology usage.
|
|
23109
|
+
*
|
|
23110
|
+
* Key features:
|
|
23111
|
+
* - Multiple DICTIONARY commitments are automatically merged into one
|
|
23112
|
+
* - Content is placed in a dedicated section of the system message
|
|
23113
|
+
* - Terms and definitions are stored in metadata.DICTIONARY for debugging
|
|
23114
|
+
* - Agent should use the defined terms correctly in responses
|
|
23115
|
+
*
|
|
23116
|
+
* Example usage in agent source:
|
|
23117
|
+
*
|
|
23118
|
+
* ```book
|
|
23119
|
+
* Legal Assistant
|
|
23120
|
+
*
|
|
23121
|
+
* PERSONA You are a knowledgeable legal assistant
|
|
23122
|
+
* DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
|
|
23123
|
+
* DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
|
|
23124
|
+
* DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
|
|
23125
|
+
* ```
|
|
23126
|
+
*
|
|
23127
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
23128
|
+
*/
|
|
23129
|
+
class DictionaryCommitmentDefinition extends BaseCommitmentDefinition {
|
|
23130
|
+
constructor() {
|
|
23131
|
+
super('DICTIONARY');
|
|
23132
|
+
}
|
|
23133
|
+
/**
|
|
23134
|
+
* Short one-line description of DICTIONARY.
|
|
23135
|
+
*/
|
|
23136
|
+
get description() {
|
|
23137
|
+
return 'Define terms and their meanings for consistent terminology usage.';
|
|
23138
|
+
}
|
|
23139
|
+
/**
|
|
23140
|
+
* Icon for this commitment.
|
|
23141
|
+
*/
|
|
23142
|
+
get icon() {
|
|
23143
|
+
return '📚';
|
|
23144
|
+
}
|
|
23145
|
+
/**
|
|
23146
|
+
* Markdown documentation for DICTIONARY commitment.
|
|
23147
|
+
*/
|
|
23148
|
+
get documentation() {
|
|
23149
|
+
return spaceTrim$1(`
|
|
23150
|
+
# DICTIONARY
|
|
23151
|
+
|
|
23152
|
+
Defines specific terms and their meanings that the agent should use correctly in reasoning and responses.
|
|
23153
|
+
|
|
23154
|
+
## Key aspects
|
|
23155
|
+
|
|
23156
|
+
- Multiple \`DICTIONARY\` commitments are merged together.
|
|
23157
|
+
- Terms are defined in the format: "Term is definition"
|
|
23158
|
+
- The agent should use these terms consistently in responses.
|
|
23159
|
+
- Definitions help ensure accurate and consistent terminology.
|
|
23160
|
+
|
|
23161
|
+
## Examples
|
|
23162
|
+
|
|
23163
|
+
\`\`\`book
|
|
23164
|
+
Legal Assistant
|
|
23165
|
+
|
|
23166
|
+
PERSONA You are a knowledgeable legal assistant specializing in criminal law
|
|
23167
|
+
DICTIONARY Misdemeanor is a minor wrongdoing or criminal offense
|
|
23168
|
+
DICTIONARY Felony is a serious crime usually punishable by imprisonment for more than one year
|
|
23169
|
+
DICTIONARY Tort is a civil wrong that causes harm or loss to another person, leading to legal liability
|
|
23170
|
+
\`\`\`
|
|
23171
|
+
|
|
23172
|
+
\`\`\`book
|
|
23173
|
+
Medical Assistant
|
|
23174
|
+
|
|
23175
|
+
PERSONA You are a helpful medical assistant
|
|
23176
|
+
DICTIONARY Hypertension is persistently high blood pressure
|
|
23177
|
+
DICTIONARY Diabetes is a chronic condition that affects how the body processes blood sugar
|
|
23178
|
+
DICTIONARY Vaccine is a biological preparation that provides active immunity to a particular disease
|
|
23179
|
+
\`\`\`
|
|
23180
|
+
`);
|
|
23181
|
+
}
|
|
23182
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
23183
|
+
var _a;
|
|
23184
|
+
const trimmedContent = content.trim();
|
|
23185
|
+
if (!trimmedContent) {
|
|
23186
|
+
return requirements;
|
|
23187
|
+
}
|
|
23188
|
+
// Get existing dictionary entries from metadata
|
|
23189
|
+
const existingDictionary = ((_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.DICTIONARY) || '';
|
|
23190
|
+
// Merge the new dictionary entry with existing entries
|
|
23191
|
+
const mergedDictionary = existingDictionary
|
|
23192
|
+
? `${existingDictionary}\n${trimmedContent}`
|
|
23193
|
+
: trimmedContent;
|
|
23194
|
+
// Store the merged dictionary in metadata for debugging and inspection
|
|
23195
|
+
const updatedMetadata = {
|
|
23196
|
+
...requirements.metadata,
|
|
23197
|
+
DICTIONARY: mergedDictionary,
|
|
23198
|
+
};
|
|
23199
|
+
// Create the dictionary section for the system message
|
|
23200
|
+
// Format: "# DICTIONARY\nTerm: definition\nTerm: definition..."
|
|
23201
|
+
const dictionarySection = `# DICTIONARY\n${mergedDictionary}`;
|
|
23202
|
+
return {
|
|
23203
|
+
...this.appendToSystemMessage(requirements, dictionarySection),
|
|
23204
|
+
metadata: updatedMetadata,
|
|
23205
|
+
};
|
|
23206
|
+
}
|
|
23207
|
+
}
|
|
23208
|
+
/**
|
|
23209
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
23210
|
+
*/
|
|
23211
|
+
|
|
23101
23212
|
/**
|
|
23102
23213
|
* FORMAT commitment definition
|
|
23103
23214
|
*
|
|
@@ -25918,6 +26029,7 @@ const COMMITMENT_REGISTRY = [
|
|
|
25918
26029
|
new DeleteCommitmentDefinition('CANCEL'),
|
|
25919
26030
|
new DeleteCommitmentDefinition('DISCARD'),
|
|
25920
26031
|
new DeleteCommitmentDefinition('REMOVE'),
|
|
26032
|
+
new DictionaryCommitmentDefinition(),
|
|
25921
26033
|
new OpenCommitmentDefinition(),
|
|
25922
26034
|
new ClosedCommitmentDefinition(),
|
|
25923
26035
|
new UseBrowserCommitmentDefinition(),
|
|
@@ -26002,17 +26114,64 @@ function parseAgentSourceWithCommitments(agentSource) {
|
|
|
26002
26114
|
};
|
|
26003
26115
|
}
|
|
26004
26116
|
const lines = agentSource.split('\n');
|
|
26005
|
-
|
|
26117
|
+
let agentName = null;
|
|
26118
|
+
let agentNameLineIndex = -1;
|
|
26119
|
+
// Find the agent name: first non-empty line that is not a commitment and not a horizontal line
|
|
26120
|
+
for (let i = 0; i < lines.length; i++) {
|
|
26121
|
+
const line = lines[i];
|
|
26122
|
+
if (line === undefined) {
|
|
26123
|
+
continue;
|
|
26124
|
+
}
|
|
26125
|
+
const trimmed = line.trim();
|
|
26126
|
+
if (!trimmed) {
|
|
26127
|
+
continue;
|
|
26128
|
+
}
|
|
26129
|
+
const isHorizontal = HORIZONTAL_LINE_PATTERN.test(line);
|
|
26130
|
+
if (isHorizontal) {
|
|
26131
|
+
continue;
|
|
26132
|
+
}
|
|
26133
|
+
let isCommitment = false;
|
|
26134
|
+
for (const definition of COMMITMENT_REGISTRY) {
|
|
26135
|
+
const typeRegex = definition.createTypeRegex();
|
|
26136
|
+
const match = typeRegex.exec(trimmed);
|
|
26137
|
+
if (match && ((_a = match.groups) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
26138
|
+
isCommitment = true;
|
|
26139
|
+
break;
|
|
26140
|
+
}
|
|
26141
|
+
}
|
|
26142
|
+
if (!isCommitment) {
|
|
26143
|
+
agentName = trimmed;
|
|
26144
|
+
agentNameLineIndex = i;
|
|
26145
|
+
break;
|
|
26146
|
+
}
|
|
26147
|
+
}
|
|
26006
26148
|
const commitments = [];
|
|
26007
26149
|
const nonCommitmentLines = [];
|
|
26008
|
-
//
|
|
26009
|
-
|
|
26010
|
-
|
|
26150
|
+
// Add lines before agentName that are horizontal lines (they are non-commitment)
|
|
26151
|
+
for (let i = 0; i < agentNameLineIndex; i++) {
|
|
26152
|
+
const line = lines[i];
|
|
26153
|
+
if (line === undefined) {
|
|
26154
|
+
continue;
|
|
26155
|
+
}
|
|
26156
|
+
const trimmed = line.trim();
|
|
26157
|
+
if (!trimmed) {
|
|
26158
|
+
continue;
|
|
26159
|
+
}
|
|
26160
|
+
const isHorizontal = HORIZONTAL_LINE_PATTERN.test(line);
|
|
26161
|
+
if (isHorizontal) {
|
|
26162
|
+
nonCommitmentLines.push(line);
|
|
26163
|
+
}
|
|
26164
|
+
// Note: Commitments before agentName are not added to nonCommitmentLines
|
|
26165
|
+
}
|
|
26166
|
+
// Add the agent name line to non-commitment lines
|
|
26167
|
+
if (agentNameLineIndex >= 0) {
|
|
26168
|
+
nonCommitmentLines.push(lines[agentNameLineIndex]);
|
|
26011
26169
|
}
|
|
26012
26170
|
// Parse commitments with multiline support
|
|
26013
26171
|
let currentCommitment = null;
|
|
26014
|
-
// Process lines starting from the
|
|
26015
|
-
|
|
26172
|
+
// Process lines starting from after the agent name line
|
|
26173
|
+
const startIndex = agentNameLineIndex >= 0 ? agentNameLineIndex + 1 : 0;
|
|
26174
|
+
for (let i = startIndex; i < lines.length; i++) {
|
|
26016
26175
|
const line = lines[i];
|
|
26017
26176
|
if (line === undefined) {
|
|
26018
26177
|
continue;
|
|
@@ -26423,6 +26582,7 @@ function parseAgentSource(agentSource) {
|
|
|
26423
26582
|
return {
|
|
26424
26583
|
agentName: normalizeAgentName(parseResult.agentName || createDefaultAgentName(agentSource)),
|
|
26425
26584
|
agentHash,
|
|
26585
|
+
permanentId: meta.id,
|
|
26426
26586
|
personaDescription,
|
|
26427
26587
|
initialMessage,
|
|
26428
26588
|
meta,
|