@promptbook/core 0.103.0-52 → 0.103.0-54
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/esm/index.es.js +588 -73
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +4 -0
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
- package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +17 -0
- package/esm/typings/src/commitments/ACTION/ACTION.d.ts +4 -0
- package/esm/typings/src/commitments/DELETE/DELETE.d.ts +4 -0
- package/esm/typings/src/commitments/FORMAT/FORMAT.d.ts +4 -0
- package/esm/typings/src/commitments/GOAL/GOAL.d.ts +4 -0
- package/esm/typings/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +4 -0
- package/esm/typings/src/commitments/MEMORY/MEMORY.d.ts +4 -0
- package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +4 -0
- package/esm/typings/src/commitments/MESSAGE/MESSAGE.d.ts +4 -0
- package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/META/META.d.ts +4 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +4 -0
- package/esm/typings/src/commitments/META_IMAGE/META_IMAGE.d.ts +4 -0
- package/esm/typings/src/commitments/META_LINK/META_LINK.d.ts +4 -0
- package/esm/typings/src/commitments/MODEL/MODEL.d.ts +4 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +4 -0
- package/esm/typings/src/commitments/PERSONA/PERSONA.d.ts +4 -0
- package/esm/typings/src/commitments/RULE/RULE.d.ts +4 -0
- package/esm/typings/src/commitments/SAMPLE/SAMPLE.d.ts +4 -0
- package/esm/typings/src/commitments/SCENARIO/SCENARIO.d.ts +4 -0
- package/esm/typings/src/commitments/STYLE/STYLE.d.ts +4 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +5 -0
- package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +5 -0
- package/esm/typings/src/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +4 -0
- package/esm/typings/src/commitments/index.d.ts +20 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +9 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +10 -1
- package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +589 -72
- package/umd/index.umd.js.map +1 -1
package/umd/index.umd.js
CHANGED
|
@@ -28,12 +28,23 @@
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.103.0-54';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Core Promptbook server configuration.
|
|
39
|
+
*
|
|
40
|
+
* This server is also used for auto-federation in the Agents Server.
|
|
41
|
+
*/
|
|
42
|
+
const CORE_SERVER = {
|
|
43
|
+
title: 'Promptbook Core',
|
|
44
|
+
description: `Core Promptbook server used for auto-federation`,
|
|
45
|
+
owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
|
|
46
|
+
urls: ['https://core.ptbk.io/'],
|
|
47
|
+
};
|
|
37
48
|
/**
|
|
38
49
|
* Available remote servers for the Promptbook
|
|
39
50
|
*
|
|
@@ -55,6 +66,7 @@
|
|
|
55
66
|
owner: 'AI Web, LLC <legal@ptbk.io> (https://www.ptbk.io/)',
|
|
56
67
|
urls: ['https://s6.ptbk.io/'],
|
|
57
68
|
},
|
|
69
|
+
CORE_SERVER,
|
|
58
70
|
/*
|
|
59
71
|
Note: Working on older version of Promptbook and not supported anymore
|
|
60
72
|
{
|
|
@@ -67,7 +79,14 @@
|
|
|
67
79
|
*/
|
|
68
80
|
];
|
|
69
81
|
/**
|
|
70
|
-
*
|
|
82
|
+
* Remote servers that are auto-federated by the Agents Server.
|
|
83
|
+
*
|
|
84
|
+
* These servers are always added in addition to the `FEDERATED_SERVERS` metadata.
|
|
85
|
+
*
|
|
86
|
+
* @public exported from `@promptbook/core`
|
|
87
|
+
*/
|
|
88
|
+
const AUTO_FEDERATED_AGENT_SERVER_URLS = CORE_SERVER.urls;
|
|
89
|
+
/**
|
|
71
90
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
72
91
|
*/
|
|
73
92
|
|
|
@@ -7568,6 +7587,12 @@
|
|
|
7568
7587
|
get description() {
|
|
7569
7588
|
return 'Define agent capabilities and actions it can perform.';
|
|
7570
7589
|
}
|
|
7590
|
+
/**
|
|
7591
|
+
* Icon for this commitment.
|
|
7592
|
+
*/
|
|
7593
|
+
get icon() {
|
|
7594
|
+
return '⚡';
|
|
7595
|
+
}
|
|
7571
7596
|
/**
|
|
7572
7597
|
* Markdown documentation for ACTION commitment.
|
|
7573
7598
|
*/
|
|
@@ -7647,6 +7672,12 @@
|
|
|
7647
7672
|
get description() {
|
|
7648
7673
|
return 'Remove or **disregard** certain information, context, or previous commitments.';
|
|
7649
7674
|
}
|
|
7675
|
+
/**
|
|
7676
|
+
* Icon for this commitment.
|
|
7677
|
+
*/
|
|
7678
|
+
get icon() {
|
|
7679
|
+
return '🗑️';
|
|
7680
|
+
}
|
|
7650
7681
|
/**
|
|
7651
7682
|
* Markdown documentation for DELETE commitment.
|
|
7652
7683
|
*/
|
|
@@ -7763,6 +7794,12 @@
|
|
|
7763
7794
|
get description() {
|
|
7764
7795
|
return 'Specify output structure or formatting requirements.';
|
|
7765
7796
|
}
|
|
7797
|
+
/**
|
|
7798
|
+
* Icon for this commitment.
|
|
7799
|
+
*/
|
|
7800
|
+
get icon() {
|
|
7801
|
+
return '📜';
|
|
7802
|
+
}
|
|
7766
7803
|
/**
|
|
7767
7804
|
* Markdown documentation for FORMAT commitment.
|
|
7768
7805
|
*/
|
|
@@ -7838,6 +7875,12 @@
|
|
|
7838
7875
|
get description() {
|
|
7839
7876
|
return 'Define main **goals** the AI assistant should achieve, with later goals having higher priority.';
|
|
7840
7877
|
}
|
|
7878
|
+
/**
|
|
7879
|
+
* Icon for this commitment.
|
|
7880
|
+
*/
|
|
7881
|
+
get icon() {
|
|
7882
|
+
return '🎯';
|
|
7883
|
+
}
|
|
7841
7884
|
/**
|
|
7842
7885
|
* Markdown documentation for GOAL commitment.
|
|
7843
7886
|
*/
|
|
@@ -7934,6 +7977,12 @@
|
|
|
7934
7977
|
get description() {
|
|
7935
7978
|
return 'Add domain **knowledge** via direct text or external sources (RAG).';
|
|
7936
7979
|
}
|
|
7980
|
+
/**
|
|
7981
|
+
* Icon for this commitment.
|
|
7982
|
+
*/
|
|
7983
|
+
get icon() {
|
|
7984
|
+
return '🧠';
|
|
7985
|
+
}
|
|
7937
7986
|
/**
|
|
7938
7987
|
* Markdown documentation for KNOWLEDGE commitment.
|
|
7939
7988
|
*/
|
|
@@ -8035,6 +8084,12 @@
|
|
|
8035
8084
|
get description() {
|
|
8036
8085
|
return 'Remember past interactions and user **preferences** for personalized responses.';
|
|
8037
8086
|
}
|
|
8087
|
+
/**
|
|
8088
|
+
* Icon for this commitment.
|
|
8089
|
+
*/
|
|
8090
|
+
get icon() {
|
|
8091
|
+
return '🧠';
|
|
8092
|
+
}
|
|
8038
8093
|
/**
|
|
8039
8094
|
* Markdown documentation for MEMORY commitment.
|
|
8040
8095
|
*/
|
|
@@ -8109,6 +8164,83 @@
|
|
|
8109
8164
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8110
8165
|
*/
|
|
8111
8166
|
|
|
8167
|
+
/**
|
|
8168
|
+
* AGENT MESSAGE commitment definition
|
|
8169
|
+
*
|
|
8170
|
+
* The AGENT MESSAGE commitment defines a message from the agent in the conversation history.
|
|
8171
|
+
* It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
|
|
8172
|
+
*
|
|
8173
|
+
* Example usage in agent source:
|
|
8174
|
+
*
|
|
8175
|
+
* ```book
|
|
8176
|
+
* AGENT MESSAGE What seems to be the issue?
|
|
8177
|
+
* ```
|
|
8178
|
+
*
|
|
8179
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
8180
|
+
*/
|
|
8181
|
+
class AgentMessageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
8182
|
+
constructor() {
|
|
8183
|
+
super('AGENT MESSAGE');
|
|
8184
|
+
}
|
|
8185
|
+
/**
|
|
8186
|
+
* Short one-line description of AGENT MESSAGE.
|
|
8187
|
+
*/
|
|
8188
|
+
get description() {
|
|
8189
|
+
return 'Defines a **message from the agent** in the conversation history.';
|
|
8190
|
+
}
|
|
8191
|
+
/**
|
|
8192
|
+
* Icon for this commitment.
|
|
8193
|
+
*/
|
|
8194
|
+
get icon() {
|
|
8195
|
+
return '🤖';
|
|
8196
|
+
}
|
|
8197
|
+
/**
|
|
8198
|
+
* Markdown documentation for AGENT MESSAGE commitment.
|
|
8199
|
+
*/
|
|
8200
|
+
get documentation() {
|
|
8201
|
+
return spaceTrim$1.spaceTrim(`
|
|
8202
|
+
# ${this.type}
|
|
8203
|
+
|
|
8204
|
+
Defines a message from the agent in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
|
|
8205
|
+
|
|
8206
|
+
## Key aspects
|
|
8207
|
+
|
|
8208
|
+
- Represents a message sent by the agent.
|
|
8209
|
+
- Used for setting up conversation context.
|
|
8210
|
+
- Can be used in conjunction with USER MESSAGE.
|
|
8211
|
+
|
|
8212
|
+
## Examples
|
|
8213
|
+
|
|
8214
|
+
\`\`\`book
|
|
8215
|
+
Conversation History
|
|
8216
|
+
|
|
8217
|
+
USER MESSAGE Hello, I have a problem.
|
|
8218
|
+
AGENT MESSAGE What seems to be the issue?
|
|
8219
|
+
USER MESSAGE My computer is not starting.
|
|
8220
|
+
\`\`\`
|
|
8221
|
+
`);
|
|
8222
|
+
}
|
|
8223
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
8224
|
+
// AGENT MESSAGE is for UI display purposes / conversation history construction
|
|
8225
|
+
// and typically doesn't need to be added to the system prompt or model requirements directly.
|
|
8226
|
+
// It is extracted separately for the chat interface.
|
|
8227
|
+
var _a;
|
|
8228
|
+
const pendingUserMessage = (_a = requirements.metadata) === null || _a === void 0 ? void 0 : _a.pendingUserMessage;
|
|
8229
|
+
if (pendingUserMessage) {
|
|
8230
|
+
const newSample = { question: pendingUserMessage, answer: content };
|
|
8231
|
+
const newSamples = [...(requirements.samples || []), newSample];
|
|
8232
|
+
const newMetadata = { ...requirements.metadata };
|
|
8233
|
+
delete newMetadata.pendingUserMessage;
|
|
8234
|
+
return {
|
|
8235
|
+
...requirements,
|
|
8236
|
+
samples: newSamples,
|
|
8237
|
+
metadata: newMetadata,
|
|
8238
|
+
};
|
|
8239
|
+
}
|
|
8240
|
+
return requirements;
|
|
8241
|
+
}
|
|
8242
|
+
}
|
|
8243
|
+
|
|
8112
8244
|
/**
|
|
8113
8245
|
* INITIAL MESSAGE commitment definition
|
|
8114
8246
|
*
|
|
@@ -8133,6 +8265,12 @@
|
|
|
8133
8265
|
get description() {
|
|
8134
8266
|
return 'Defines the **initial message** shown to the user when the chat starts.';
|
|
8135
8267
|
}
|
|
8268
|
+
/**
|
|
8269
|
+
* Icon for this commitment.
|
|
8270
|
+
*/
|
|
8271
|
+
get icon() {
|
|
8272
|
+
return '👋';
|
|
8273
|
+
}
|
|
8136
8274
|
/**
|
|
8137
8275
|
* Markdown documentation for INITIAL MESSAGE commitment.
|
|
8138
8276
|
*/
|
|
@@ -8191,6 +8329,12 @@
|
|
|
8191
8329
|
get description() {
|
|
8192
8330
|
return 'Include actual **messages** the AI assistant has sent during conversation history.';
|
|
8193
8331
|
}
|
|
8332
|
+
/**
|
|
8333
|
+
* Icon for this commitment.
|
|
8334
|
+
*/
|
|
8335
|
+
get icon() {
|
|
8336
|
+
return '💬';
|
|
8337
|
+
}
|
|
8194
8338
|
/**
|
|
8195
8339
|
* Markdown documentation for MESSAGE commitment.
|
|
8196
8340
|
*/
|
|
@@ -8273,6 +8417,73 @@
|
|
|
8273
8417
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
8274
8418
|
*/
|
|
8275
8419
|
|
|
8420
|
+
/**
|
|
8421
|
+
* USER MESSAGE commitment definition
|
|
8422
|
+
*
|
|
8423
|
+
* The USER MESSAGE commitment defines a message from the user in the conversation history.
|
|
8424
|
+
* It is used to pre-fill the chat with a conversation history or to provide few-shot examples.
|
|
8425
|
+
*
|
|
8426
|
+
* Example usage in agent source:
|
|
8427
|
+
*
|
|
8428
|
+
* ```book
|
|
8429
|
+
* USER MESSAGE Hello, I have a problem.
|
|
8430
|
+
* ```
|
|
8431
|
+
*
|
|
8432
|
+
* @private [🪔] Maybe export the commitments through some package
|
|
8433
|
+
*/
|
|
8434
|
+
class UserMessageCommitmentDefinition extends BaseCommitmentDefinition {
|
|
8435
|
+
constructor() {
|
|
8436
|
+
super('USER MESSAGE');
|
|
8437
|
+
}
|
|
8438
|
+
/**
|
|
8439
|
+
* Short one-line description of USER MESSAGE.
|
|
8440
|
+
*/
|
|
8441
|
+
get description() {
|
|
8442
|
+
return 'Defines a **message from the user** in the conversation history.';
|
|
8443
|
+
}
|
|
8444
|
+
/**
|
|
8445
|
+
* Icon for this commitment.
|
|
8446
|
+
*/
|
|
8447
|
+
get icon() {
|
|
8448
|
+
return '🧑';
|
|
8449
|
+
}
|
|
8450
|
+
/**
|
|
8451
|
+
* Markdown documentation for USER MESSAGE commitment.
|
|
8452
|
+
*/
|
|
8453
|
+
get documentation() {
|
|
8454
|
+
return spaceTrim$1.spaceTrim(`
|
|
8455
|
+
# ${this.type}
|
|
8456
|
+
|
|
8457
|
+
Defines a message from the user in the conversation history. This is used to pre-fill the chat with a conversation history or to provide few-shot examples.
|
|
8458
|
+
|
|
8459
|
+
## Key aspects
|
|
8460
|
+
|
|
8461
|
+
- Represents a message sent by the user.
|
|
8462
|
+
- Used for setting up conversation context.
|
|
8463
|
+
- Can be used in conjunction with AGENT MESSAGE.
|
|
8464
|
+
|
|
8465
|
+
## Examples
|
|
8466
|
+
|
|
8467
|
+
\`\`\`book
|
|
8468
|
+
Conversation History
|
|
8469
|
+
|
|
8470
|
+
USER MESSAGE Hello, I have a problem.
|
|
8471
|
+
AGENT MESSAGE What seems to be the issue?
|
|
8472
|
+
USER MESSAGE My computer is not starting.
|
|
8473
|
+
\`\`\`
|
|
8474
|
+
`);
|
|
8475
|
+
}
|
|
8476
|
+
applyToAgentModelRequirements(requirements, content) {
|
|
8477
|
+
return {
|
|
8478
|
+
...requirements,
|
|
8479
|
+
metadata: {
|
|
8480
|
+
...requirements.metadata,
|
|
8481
|
+
pendingUserMessage: content,
|
|
8482
|
+
},
|
|
8483
|
+
};
|
|
8484
|
+
}
|
|
8485
|
+
}
|
|
8486
|
+
|
|
8276
8487
|
/**
|
|
8277
8488
|
* META commitment definition
|
|
8278
8489
|
*
|
|
@@ -8309,6 +8520,12 @@
|
|
|
8309
8520
|
get description() {
|
|
8310
8521
|
return 'Set meta-information about the agent (IMAGE, LINK, TITLE, DESCRIPTION, etc.).';
|
|
8311
8522
|
}
|
|
8523
|
+
/**
|
|
8524
|
+
* Icon for this commitment.
|
|
8525
|
+
*/
|
|
8526
|
+
get icon() {
|
|
8527
|
+
return 'ℹ️';
|
|
8528
|
+
}
|
|
8312
8529
|
/**
|
|
8313
8530
|
* Markdown documentation for META commitment.
|
|
8314
8531
|
*/
|
|
@@ -8436,6 +8653,12 @@
|
|
|
8436
8653
|
get description() {
|
|
8437
8654
|
return "Set the agent's accent color.";
|
|
8438
8655
|
}
|
|
8656
|
+
/**
|
|
8657
|
+
* Icon for this commitment.
|
|
8658
|
+
*/
|
|
8659
|
+
get icon() {
|
|
8660
|
+
return '🎨';
|
|
8661
|
+
}
|
|
8439
8662
|
/**
|
|
8440
8663
|
* Markdown documentation for META COLOR commitment.
|
|
8441
8664
|
*/
|
|
@@ -8514,6 +8737,12 @@
|
|
|
8514
8737
|
get description() {
|
|
8515
8738
|
return "Set the agent's profile image URL.";
|
|
8516
8739
|
}
|
|
8740
|
+
/**
|
|
8741
|
+
* Icon for this commitment.
|
|
8742
|
+
*/
|
|
8743
|
+
get icon() {
|
|
8744
|
+
return '🖼️';
|
|
8745
|
+
}
|
|
8517
8746
|
/**
|
|
8518
8747
|
* Markdown documentation for META IMAGE commitment.
|
|
8519
8748
|
*/
|
|
@@ -8604,6 +8833,12 @@
|
|
|
8604
8833
|
get description() {
|
|
8605
8834
|
return 'Enforce AI model requirements including name and technical parameters.';
|
|
8606
8835
|
}
|
|
8836
|
+
/**
|
|
8837
|
+
* Icon for this commitment.
|
|
8838
|
+
*/
|
|
8839
|
+
get icon() {
|
|
8840
|
+
return '⚙️';
|
|
8841
|
+
}
|
|
8607
8842
|
/**
|
|
8608
8843
|
* Markdown documentation for MODEL commitment.
|
|
8609
8844
|
*/
|
|
@@ -8839,6 +9074,12 @@
|
|
|
8839
9074
|
get description() {
|
|
8840
9075
|
return 'Add developer-facing notes without changing behavior or output.';
|
|
8841
9076
|
}
|
|
9077
|
+
/**
|
|
9078
|
+
* Icon for this commitment.
|
|
9079
|
+
*/
|
|
9080
|
+
get icon() {
|
|
9081
|
+
return '📝';
|
|
9082
|
+
}
|
|
8842
9083
|
/**
|
|
8843
9084
|
* Markdown documentation for NOTE commitment.
|
|
8844
9085
|
*/
|
|
@@ -8941,6 +9182,12 @@
|
|
|
8941
9182
|
get description() {
|
|
8942
9183
|
return 'Define who the agent is: background, expertise, and personality.';
|
|
8943
9184
|
}
|
|
9185
|
+
/**
|
|
9186
|
+
* Icon for this commitment.
|
|
9187
|
+
*/
|
|
9188
|
+
get icon() {
|
|
9189
|
+
return '👤';
|
|
9190
|
+
}
|
|
8944
9191
|
/**
|
|
8945
9192
|
* Markdown documentation for PERSONA commitment.
|
|
8946
9193
|
*/
|
|
@@ -9068,6 +9315,12 @@
|
|
|
9068
9315
|
get description() {
|
|
9069
9316
|
return 'Add behavioral rules the agent must follow.';
|
|
9070
9317
|
}
|
|
9318
|
+
/**
|
|
9319
|
+
* Icon for this commitment.
|
|
9320
|
+
*/
|
|
9321
|
+
get icon() {
|
|
9322
|
+
return '⚖️';
|
|
9323
|
+
}
|
|
9071
9324
|
/**
|
|
9072
9325
|
* Markdown documentation for RULE/RULES commitment.
|
|
9073
9326
|
*/
|
|
@@ -9144,6 +9397,12 @@
|
|
|
9144
9397
|
get description() {
|
|
9145
9398
|
return 'Provide example responses to guide behavior.';
|
|
9146
9399
|
}
|
|
9400
|
+
/**
|
|
9401
|
+
* Icon for this commitment.
|
|
9402
|
+
*/
|
|
9403
|
+
get icon() {
|
|
9404
|
+
return '🔍';
|
|
9405
|
+
}
|
|
9147
9406
|
/**
|
|
9148
9407
|
* Markdown documentation for SAMPLE/EXAMPLE commitment.
|
|
9149
9408
|
*/
|
|
@@ -9221,6 +9480,12 @@
|
|
|
9221
9480
|
get description() {
|
|
9222
9481
|
return 'Define specific **situations** or contexts for AI responses, with later scenarios having higher priority.';
|
|
9223
9482
|
}
|
|
9483
|
+
/**
|
|
9484
|
+
* Icon for this commitment.
|
|
9485
|
+
*/
|
|
9486
|
+
get icon() {
|
|
9487
|
+
return '🎭';
|
|
9488
|
+
}
|
|
9224
9489
|
/**
|
|
9225
9490
|
* Markdown documentation for SCENARIO commitment.
|
|
9226
9491
|
*/
|
|
@@ -9337,6 +9602,12 @@
|
|
|
9337
9602
|
get description() {
|
|
9338
9603
|
return 'Control the tone and writing style of responses.';
|
|
9339
9604
|
}
|
|
9605
|
+
/**
|
|
9606
|
+
* Icon for this commitment.
|
|
9607
|
+
*/
|
|
9608
|
+
get icon() {
|
|
9609
|
+
return '🖋️';
|
|
9610
|
+
}
|
|
9340
9611
|
/**
|
|
9341
9612
|
* Markdown documentation for STYLE commitment.
|
|
9342
9613
|
*/
|
|
@@ -9406,6 +9677,12 @@
|
|
|
9406
9677
|
get description() {
|
|
9407
9678
|
return 'Placeholder commitment that appends content verbatim to the system message.';
|
|
9408
9679
|
}
|
|
9680
|
+
/**
|
|
9681
|
+
* Icon for this commitment.
|
|
9682
|
+
*/
|
|
9683
|
+
get icon() {
|
|
9684
|
+
return '🚧';
|
|
9685
|
+
}
|
|
9409
9686
|
/**
|
|
9410
9687
|
* Markdown documentation available at runtime.
|
|
9411
9688
|
*/
|
|
@@ -9486,6 +9763,8 @@
|
|
|
9486
9763
|
new GoalCommitmentDefinition('GOAL'),
|
|
9487
9764
|
new GoalCommitmentDefinition('GOALS'),
|
|
9488
9765
|
new InitialMessageCommitmentDefinition(),
|
|
9766
|
+
new UserMessageCommitmentDefinition(),
|
|
9767
|
+
new AgentMessageCommitmentDefinition(),
|
|
9489
9768
|
new MessageCommitmentDefinition('MESSAGE'),
|
|
9490
9769
|
new MessageCommitmentDefinition('MESSAGES'),
|
|
9491
9770
|
new ScenarioCommitmentDefinition('SCENARIO'),
|
|
@@ -9540,6 +9819,45 @@
|
|
|
9540
9819
|
function isCommitmentSupported(type) {
|
|
9541
9820
|
return COMMITMENT_REGISTRY.some((commitmentDefinition) => commitmentDefinition.type === type);
|
|
9542
9821
|
}
|
|
9822
|
+
/**
|
|
9823
|
+
* Gets all commitment definitions grouped by their aliases
|
|
9824
|
+
*
|
|
9825
|
+
* @returns Array of grouped commitment definitions
|
|
9826
|
+
*
|
|
9827
|
+
* @public exported from `@promptbook/core`
|
|
9828
|
+
*/
|
|
9829
|
+
function getGroupedCommitmentDefinitions() {
|
|
9830
|
+
const groupedCommitments = [];
|
|
9831
|
+
for (const commitment of COMMITMENT_REGISTRY) {
|
|
9832
|
+
const lastGroup = groupedCommitments[groupedCommitments.length - 1];
|
|
9833
|
+
// Check if we should group with the previous item
|
|
9834
|
+
let shouldGroup = false;
|
|
9835
|
+
if (lastGroup) {
|
|
9836
|
+
const lastPrimary = lastGroup.primary;
|
|
9837
|
+
// Case 1: Same class constructor (except NotYetImplemented)
|
|
9838
|
+
if (!(commitment instanceof NotYetImplementedCommitmentDefinition) &&
|
|
9839
|
+
commitment.constructor === lastPrimary.constructor) {
|
|
9840
|
+
shouldGroup = true;
|
|
9841
|
+
}
|
|
9842
|
+
// Case 2: NotYetImplemented with prefix matching (e.g. BEHAVIOUR -> BEHAVIOURS)
|
|
9843
|
+
else if (commitment instanceof NotYetImplementedCommitmentDefinition &&
|
|
9844
|
+
lastPrimary instanceof NotYetImplementedCommitmentDefinition &&
|
|
9845
|
+
commitment.type.startsWith(lastPrimary.type)) {
|
|
9846
|
+
shouldGroup = true;
|
|
9847
|
+
}
|
|
9848
|
+
}
|
|
9849
|
+
if (shouldGroup && lastGroup) {
|
|
9850
|
+
lastGroup.aliases.push(commitment.type);
|
|
9851
|
+
}
|
|
9852
|
+
else {
|
|
9853
|
+
groupedCommitments.push({
|
|
9854
|
+
primary: commitment,
|
|
9855
|
+
aliases: [],
|
|
9856
|
+
});
|
|
9857
|
+
}
|
|
9858
|
+
}
|
|
9859
|
+
return $deepFreeze(groupedCommitments);
|
|
9860
|
+
}
|
|
9543
9861
|
/**
|
|
9544
9862
|
* TODO: [🧠] Maybe create through standardized $register
|
|
9545
9863
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -10279,6 +10597,18 @@
|
|
|
10279
10597
|
* TODO: [🧠][🌻] Maybe export through `@promptbook/markdown-utils` not `@promptbook/utils`
|
|
10280
10598
|
*/
|
|
10281
10599
|
|
|
10600
|
+
/**
|
|
10601
|
+
* Normalizes message text for comparison
|
|
10602
|
+
*
|
|
10603
|
+
* @param text The message text to normalize
|
|
10604
|
+
* @returns The normalized message text
|
|
10605
|
+
*
|
|
10606
|
+
* @public exported from `@promptbook/utils`
|
|
10607
|
+
*/
|
|
10608
|
+
function normalizeMessageText(text) {
|
|
10609
|
+
return spaceTrim$1.spaceTrim(text);
|
|
10610
|
+
}
|
|
10611
|
+
|
|
10282
10612
|
/**
|
|
10283
10613
|
* Removes quotes from a string
|
|
10284
10614
|
*
|
|
@@ -10783,7 +11113,96 @@
|
|
|
10783
11113
|
* Deletes an agent from the collection
|
|
10784
11114
|
*/
|
|
10785
11115
|
async deleteAgent(agentName) {
|
|
10786
|
-
|
|
11116
|
+
const deleteResult = await this.supabaseClient
|
|
11117
|
+
.from(this.getTableName('Agent'))
|
|
11118
|
+
.delete()
|
|
11119
|
+
.eq('agentName', agentName);
|
|
11120
|
+
if (deleteResult.error) {
|
|
11121
|
+
throw new DatabaseError(spaceTrim((block) => `
|
|
11122
|
+
Error deleting agent "${agentName}" from Supabase:
|
|
11123
|
+
|
|
11124
|
+
${block(deleteResult.error.message)}
|
|
11125
|
+
`));
|
|
11126
|
+
}
|
|
11127
|
+
}
|
|
11128
|
+
/**
|
|
11129
|
+
* List history of an agent
|
|
11130
|
+
*/
|
|
11131
|
+
async listAgentHistory(agentName) {
|
|
11132
|
+
const result = await this.supabaseClient
|
|
11133
|
+
.from(this.getTableName('AgentHistory'))
|
|
11134
|
+
.select('id, createdAt, agentHash, promptbookEngineVersion')
|
|
11135
|
+
.eq('agentName', agentName)
|
|
11136
|
+
.order('createdAt', { ascending: false });
|
|
11137
|
+
if (result.error) {
|
|
11138
|
+
throw new DatabaseError(spaceTrim((block) => `
|
|
11139
|
+
Error listing history for agent "${agentName}" from Supabase:
|
|
11140
|
+
|
|
11141
|
+
${block(result.error.message)}
|
|
11142
|
+
`));
|
|
11143
|
+
}
|
|
11144
|
+
return result.data;
|
|
11145
|
+
}
|
|
11146
|
+
/**
|
|
11147
|
+
* List agents that are in history but not in the active agents list
|
|
11148
|
+
*/
|
|
11149
|
+
async listDeletedAgents() {
|
|
11150
|
+
const historyNamesResult = await this.supabaseClient.from(this.getTableName('AgentHistory')).select('agentName');
|
|
11151
|
+
const currentNamesResult = await this.supabaseClient.from(this.getTableName('Agent')).select('agentName');
|
|
11152
|
+
if (historyNamesResult.error) {
|
|
11153
|
+
throw new DatabaseError(spaceTrim((block) => `
|
|
11154
|
+
Error fetching agent history names from Supabase:
|
|
11155
|
+
|
|
11156
|
+
${block(historyNamesResult.error.message)}
|
|
11157
|
+
`));
|
|
11158
|
+
}
|
|
11159
|
+
if (currentNamesResult.error) {
|
|
11160
|
+
throw new DatabaseError(spaceTrim((block) => `
|
|
11161
|
+
Error fetching current agent names from Supabase:
|
|
11162
|
+
|
|
11163
|
+
${block(currentNamesResult.error.message)}
|
|
11164
|
+
`));
|
|
11165
|
+
}
|
|
11166
|
+
const currentNames = new Set(currentNamesResult.data.map((d) => d.agentName));
|
|
11167
|
+
const deletedNames = new Set();
|
|
11168
|
+
for (const { agentName } of historyNamesResult.data) {
|
|
11169
|
+
if (!currentNames.has(agentName)) {
|
|
11170
|
+
deletedNames.add(agentName);
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11173
|
+
return Array.from(deletedNames);
|
|
11174
|
+
}
|
|
11175
|
+
/**
|
|
11176
|
+
* Restore an agent from history
|
|
11177
|
+
*/
|
|
11178
|
+
async restoreAgent(historyId) {
|
|
11179
|
+
const historyResult = await this.supabaseClient
|
|
11180
|
+
.from(this.getTableName('AgentHistory'))
|
|
11181
|
+
.select('*')
|
|
11182
|
+
.eq('id', historyId)
|
|
11183
|
+
.single();
|
|
11184
|
+
if (historyResult.error) {
|
|
11185
|
+
throw new DatabaseError(spaceTrim((block) => `
|
|
11186
|
+
Error fetching agent history item "${historyId}" from Supabase:
|
|
11187
|
+
|
|
11188
|
+
${block(historyResult.error.message)}
|
|
11189
|
+
`));
|
|
11190
|
+
}
|
|
11191
|
+
const { agentName, agentSource } = historyResult.data;
|
|
11192
|
+
// Check if agent exists
|
|
11193
|
+
const agentResult = await this.supabaseClient
|
|
11194
|
+
.from(this.getTableName('Agent'))
|
|
11195
|
+
.select('id')
|
|
11196
|
+
.eq('agentName', agentName)
|
|
11197
|
+
.single();
|
|
11198
|
+
if (agentResult.data) {
|
|
11199
|
+
// Update
|
|
11200
|
+
await this.updateAgentSource(agentName, agentSource);
|
|
11201
|
+
}
|
|
11202
|
+
else {
|
|
11203
|
+
// Insert (Restore from deleted)
|
|
11204
|
+
await this.createAgent(agentSource);
|
|
11205
|
+
}
|
|
10787
11206
|
}
|
|
10788
11207
|
/**
|
|
10789
11208
|
* Get the Supabase table name with prefix
|
|
@@ -17212,12 +17631,15 @@
|
|
|
17212
17631
|
fileStreams.push(file);
|
|
17213
17632
|
}
|
|
17214
17633
|
else {
|
|
17634
|
+
/*
|
|
17635
|
+
TODO: [🐱🚀] Resolve problem with browser environment
|
|
17215
17636
|
// Assume it's a local file path
|
|
17216
17637
|
// Note: This will work in Node.js environment
|
|
17217
17638
|
// For browser environments, this would need different handling
|
|
17218
17639
|
const fs = await import('fs');
|
|
17219
17640
|
const fileStream = fs.createReadStream(source);
|
|
17220
17641
|
fileStreams.push(fileStream);
|
|
17642
|
+
*/
|
|
17221
17643
|
}
|
|
17222
17644
|
}
|
|
17223
17645
|
catch (error) {
|
|
@@ -17306,12 +17728,15 @@
|
|
|
17306
17728
|
fileStreams.push(file);
|
|
17307
17729
|
}
|
|
17308
17730
|
else {
|
|
17731
|
+
/*
|
|
17732
|
+
TODO: [🐱🚀] Resolve problem with browser environment
|
|
17309
17733
|
// Assume it's a local file path
|
|
17310
17734
|
// Note: This will work in Node.js environment
|
|
17311
17735
|
// For browser environments, this would need different handling
|
|
17312
17736
|
const fs = await import('fs');
|
|
17313
17737
|
const fileStream = fs.createReadStream(source);
|
|
17314
17738
|
fileStreams.push(fileStream);
|
|
17739
|
+
*/
|
|
17315
17740
|
}
|
|
17316
17741
|
}
|
|
17317
17742
|
catch (error) {
|
|
@@ -17685,7 +18110,53 @@
|
|
|
17685
18110
|
* Note: This method also implements the learning mechanism
|
|
17686
18111
|
*/
|
|
17687
18112
|
async callChatModelStream(prompt, onProgress) {
|
|
18113
|
+
// [1] Check if the user is asking the same thing as in the samples
|
|
18114
|
+
const modelRequirements = await this.getAgentModelRequirements();
|
|
18115
|
+
if (modelRequirements.samples) {
|
|
18116
|
+
const normalizedPrompt = normalizeMessageText(prompt.content);
|
|
18117
|
+
const sample = modelRequirements.samples.find((s) => normalizeMessageText(s.question) === normalizedPrompt);
|
|
18118
|
+
if (sample) {
|
|
18119
|
+
const now = new Date().toISOString();
|
|
18120
|
+
const result = {
|
|
18121
|
+
content: sample.answer,
|
|
18122
|
+
modelName: this.modelName,
|
|
18123
|
+
timing: {
|
|
18124
|
+
start: now,
|
|
18125
|
+
complete: now,
|
|
18126
|
+
},
|
|
18127
|
+
usage: {
|
|
18128
|
+
price: { value: 0, isUncertain: true },
|
|
18129
|
+
input: {
|
|
18130
|
+
tokensCount: { value: 0, isUncertain: true },
|
|
18131
|
+
charactersCount: { value: 0, isUncertain: true },
|
|
18132
|
+
wordsCount: { value: 0, isUncertain: true },
|
|
18133
|
+
linesCount: { value: 0, isUncertain: true },
|
|
18134
|
+
sentencesCount: { value: 0, isUncertain: true },
|
|
18135
|
+
paragraphsCount: { value: 0, isUncertain: true },
|
|
18136
|
+
pagesCount: { value: 0, isUncertain: true },
|
|
18137
|
+
},
|
|
18138
|
+
output: {
|
|
18139
|
+
tokensCount: { value: 0, isUncertain: true },
|
|
18140
|
+
charactersCount: { value: 0, isUncertain: true },
|
|
18141
|
+
wordsCount: { value: 0, isUncertain: true },
|
|
18142
|
+
linesCount: { value: 0, isUncertain: true },
|
|
18143
|
+
sentencesCount: { value: 0, isUncertain: true },
|
|
18144
|
+
paragraphsCount: { value: 0, isUncertain: true },
|
|
18145
|
+
pagesCount: { value: 0, isUncertain: true },
|
|
18146
|
+
},
|
|
18147
|
+
},
|
|
18148
|
+
rawPromptContent: prompt.content,
|
|
18149
|
+
rawRequest: null,
|
|
18150
|
+
rawResponse: { sample },
|
|
18151
|
+
};
|
|
18152
|
+
onProgress(result);
|
|
18153
|
+
return result;
|
|
18154
|
+
}
|
|
18155
|
+
}
|
|
17688
18156
|
const result = await super.callChatModelStream(prompt, onProgress);
|
|
18157
|
+
if (result.rawResponse && 'sample' in result.rawResponse) {
|
|
18158
|
+
return result;
|
|
18159
|
+
}
|
|
17689
18160
|
// TODO: !!! Extract learning to separate method
|
|
17690
18161
|
// Learning: Append the conversation sample to the agent source
|
|
17691
18162
|
const learningExample = spaceTrim__default["default"]((block) => `
|
|
@@ -17771,6 +18242,70 @@
|
|
|
17771
18242
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
17772
18243
|
*/
|
|
17773
18244
|
|
|
18245
|
+
/**
|
|
18246
|
+
* Function `isValidPipelineString` will validate the if the string is a valid pipeline string
|
|
18247
|
+
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
18248
|
+
*
|
|
18249
|
+
* @param {string} pipelineString the candidate for a pipeline string
|
|
18250
|
+
* @returns {boolean} if the string is a valid pipeline string
|
|
18251
|
+
* @public exported from `@promptbook/core`
|
|
18252
|
+
*/
|
|
18253
|
+
function isValidPipelineString(pipelineString) {
|
|
18254
|
+
try {
|
|
18255
|
+
validatePipelineString(pipelineString);
|
|
18256
|
+
return true;
|
|
18257
|
+
}
|
|
18258
|
+
catch (error) {
|
|
18259
|
+
assertsError(error);
|
|
18260
|
+
return false;
|
|
18261
|
+
}
|
|
18262
|
+
}
|
|
18263
|
+
/**
|
|
18264
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
18265
|
+
*/
|
|
18266
|
+
|
|
18267
|
+
/**
|
|
18268
|
+
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
18269
|
+
*
|
|
18270
|
+
* Note: There are 3 similar functions:
|
|
18271
|
+
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
18272
|
+
* 2) `promptTemplate` alias for `prompt`
|
|
18273
|
+
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
18274
|
+
*
|
|
18275
|
+
* @param strings The static string parts of the template literal
|
|
18276
|
+
* @param values The dynamic values embedded within the template literal used as data
|
|
18277
|
+
* @returns the pipeline string
|
|
18278
|
+
* @public exported from `@promptbook/core`
|
|
18279
|
+
*/
|
|
18280
|
+
function book(strings, ...values) {
|
|
18281
|
+
const bookString = prompt(strings, ...values);
|
|
18282
|
+
if (!isValidPipelineString(bookString)) {
|
|
18283
|
+
// TODO: Make the CustomError for this
|
|
18284
|
+
throw new Error(spaceTrim__default["default"](`
|
|
18285
|
+
The string is not a valid pipeline string
|
|
18286
|
+
|
|
18287
|
+
book\`
|
|
18288
|
+
${bookString}
|
|
18289
|
+
\`
|
|
18290
|
+
`));
|
|
18291
|
+
}
|
|
18292
|
+
if (!isValidBook(bookString)) {
|
|
18293
|
+
// TODO: Make the CustomError for this
|
|
18294
|
+
throw new Error(spaceTrim__default["default"](`
|
|
18295
|
+
The string is not a valid book
|
|
18296
|
+
|
|
18297
|
+
book\`
|
|
18298
|
+
${bookString}
|
|
18299
|
+
\`
|
|
18300
|
+
`));
|
|
18301
|
+
}
|
|
18302
|
+
return padBook(bookString);
|
|
18303
|
+
}
|
|
18304
|
+
/**
|
|
18305
|
+
* TODO: [🧠][🈴] Where is the best location for this file
|
|
18306
|
+
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18307
|
+
*/
|
|
18308
|
+
|
|
17774
18309
|
/**
|
|
17775
18310
|
* Represents one AI Agent
|
|
17776
18311
|
*
|
|
@@ -17792,11 +18327,12 @@
|
|
|
17792
18327
|
const profile = await profileResponse.json();
|
|
17793
18328
|
// Note: We are creating dummy agent source because we don't have the source from the remote agent
|
|
17794
18329
|
// But we populate the metadata from the profile
|
|
17795
|
-
const agentSource = new rxjs.BehaviorSubject(`
|
|
17796
|
-
|
|
18330
|
+
const agentSource = new rxjs.BehaviorSubject(book `
|
|
18331
|
+
${profile.agentName}
|
|
17797
18332
|
|
|
17798
|
-
${profile.personaDescription}
|
|
18333
|
+
${profile.personaDescription}
|
|
17799
18334
|
`);
|
|
18335
|
+
// <- TODO: [🐱🚀] createBookFromProfile
|
|
17800
18336
|
// <- TODO: [🐱🚀] Support updating and self-updating
|
|
17801
18337
|
const remoteAgent = new RemoteAgent({
|
|
17802
18338
|
...options,
|
|
@@ -17821,10 +18357,12 @@ ${profile.personaDescription}
|
|
|
17821
18357
|
remoteAgent.initialMessage = profile.initialMessage;
|
|
17822
18358
|
remoteAgent.links = profile.links;
|
|
17823
18359
|
remoteAgent.meta = profile.meta;
|
|
18360
|
+
remoteAgent._isVoiceCallingEnabled = profile.isVoiceCallingEnabled === true; // [✨✷] Store voice calling status
|
|
17824
18361
|
return remoteAgent;
|
|
17825
18362
|
}
|
|
17826
18363
|
constructor(options) {
|
|
17827
18364
|
super(options);
|
|
18365
|
+
this._isVoiceCallingEnabled = false; // [✨✷] Track voice calling status
|
|
17828
18366
|
this.agentUrl = options.agentUrl;
|
|
17829
18367
|
}
|
|
17830
18368
|
get agentName() {
|
|
@@ -17840,8 +18378,49 @@ ${profile.personaDescription}
|
|
|
17840
18378
|
return this.callChatModelStream(prompt, () => { });
|
|
17841
18379
|
}
|
|
17842
18380
|
/**
|
|
17843
|
-
* Calls the agent on agents remote server with
|
|
18381
|
+
* Calls the agent on agents remote server with voice
|
|
18382
|
+
* [✨✷] Only available when voice calling is enabled on the server
|
|
18383
|
+
* Returns undefined if voice calling is disabled
|
|
17844
18384
|
*/
|
|
18385
|
+
get callVoiceChatModel() {
|
|
18386
|
+
if (!this._isVoiceCallingEnabled) {
|
|
18387
|
+
return undefined;
|
|
18388
|
+
}
|
|
18389
|
+
return async (audio, prompt) => {
|
|
18390
|
+
// Ensure we're working with a chat prompt
|
|
18391
|
+
if (prompt.modelRequirements.modelVariant !== 'CHAT') {
|
|
18392
|
+
throw new Error('Agents only supports chat prompts');
|
|
18393
|
+
}
|
|
18394
|
+
const chatPrompt = prompt;
|
|
18395
|
+
const formData = new FormData();
|
|
18396
|
+
formData.append('audio', audio, 'voice.webm');
|
|
18397
|
+
formData.append('message', prompt.content);
|
|
18398
|
+
if (chatPrompt.thread) {
|
|
18399
|
+
formData.append('thread', JSON.stringify(chatPrompt.thread));
|
|
18400
|
+
}
|
|
18401
|
+
const response = await fetch(`${this.agentUrl}/api/voice`, {
|
|
18402
|
+
method: 'POST',
|
|
18403
|
+
body: formData,
|
|
18404
|
+
});
|
|
18405
|
+
if (!response.ok) {
|
|
18406
|
+
throw new Error(`Voice chat failed: ${response.statusText}`);
|
|
18407
|
+
}
|
|
18408
|
+
const result = await response.json();
|
|
18409
|
+
// Convert base64 audio back to Blob
|
|
18410
|
+
const binaryString = atob(result.audio);
|
|
18411
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
18412
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
18413
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
18414
|
+
}
|
|
18415
|
+
const audioBlob = new Blob([bytes], { type: 'audio/mp3' });
|
|
18416
|
+
return {
|
|
18417
|
+
text: result.agentMessage || result.text,
|
|
18418
|
+
userMessage: result.userMessage,
|
|
18419
|
+
agentMessage: result.agentMessage || result.text,
|
|
18420
|
+
audio: audioBlob,
|
|
18421
|
+
};
|
|
18422
|
+
};
|
|
18423
|
+
}
|
|
17845
18424
|
async callChatModelStream(prompt, onProgress) {
|
|
17846
18425
|
// Ensure we're working with a chat prompt
|
|
17847
18426
|
if (prompt.modelRequirements.modelVariant !== 'CHAT') {
|
|
@@ -18378,70 +18957,6 @@ ${profile.personaDescription}
|
|
|
18378
18957
|
return migratedPipeline;
|
|
18379
18958
|
}
|
|
18380
18959
|
|
|
18381
|
-
/**
|
|
18382
|
-
* Function `isValidPipelineString` will validate the if the string is a valid pipeline string
|
|
18383
|
-
* It does not check if the string is fully logically correct, but if it is a string that can be a pipeline string or the string looks completely different.
|
|
18384
|
-
*
|
|
18385
|
-
* @param {string} pipelineString the candidate for a pipeline string
|
|
18386
|
-
* @returns {boolean} if the string is a valid pipeline string
|
|
18387
|
-
* @public exported from `@promptbook/core`
|
|
18388
|
-
*/
|
|
18389
|
-
function isValidPipelineString(pipelineString) {
|
|
18390
|
-
try {
|
|
18391
|
-
validatePipelineString(pipelineString);
|
|
18392
|
-
return true;
|
|
18393
|
-
}
|
|
18394
|
-
catch (error) {
|
|
18395
|
-
assertsError(error);
|
|
18396
|
-
return false;
|
|
18397
|
-
}
|
|
18398
|
-
}
|
|
18399
|
-
/**
|
|
18400
|
-
* TODO: [🧠][🈴] Where is the best location for this file
|
|
18401
|
-
*/
|
|
18402
|
-
|
|
18403
|
-
/**
|
|
18404
|
-
* Tag function for notating a pipeline with a book\`...\ notation as template literal
|
|
18405
|
-
*
|
|
18406
|
-
* Note: There are 3 similar functions:
|
|
18407
|
-
* 1) `prompt` for notating single prompt exported from `@promptbook/utils`
|
|
18408
|
-
* 2) `promptTemplate` alias for `prompt`
|
|
18409
|
-
* 3) `book` for notating and validating entire books exported from `@promptbook/utils`
|
|
18410
|
-
*
|
|
18411
|
-
* @param strings The static string parts of the template literal
|
|
18412
|
-
* @param values The dynamic values embedded within the template literal used as data
|
|
18413
|
-
* @returns the pipeline string
|
|
18414
|
-
* @public exported from `@promptbook/core`
|
|
18415
|
-
*/
|
|
18416
|
-
function book(strings, ...values) {
|
|
18417
|
-
const bookString = prompt(strings, ...values);
|
|
18418
|
-
if (!isValidPipelineString(bookString)) {
|
|
18419
|
-
// TODO: Make the CustomError for this
|
|
18420
|
-
throw new Error(spaceTrim__default["default"](`
|
|
18421
|
-
The string is not a valid pipeline string
|
|
18422
|
-
|
|
18423
|
-
book\`
|
|
18424
|
-
${bookString}
|
|
18425
|
-
\`
|
|
18426
|
-
`));
|
|
18427
|
-
}
|
|
18428
|
-
if (!isValidBook(bookString)) {
|
|
18429
|
-
// TODO: Make the CustomError for this
|
|
18430
|
-
throw new Error(spaceTrim__default["default"](`
|
|
18431
|
-
The string is not a valid book
|
|
18432
|
-
|
|
18433
|
-
book\`
|
|
18434
|
-
${bookString}
|
|
18435
|
-
\`
|
|
18436
|
-
`));
|
|
18437
|
-
}
|
|
18438
|
-
return padBook(bookString);
|
|
18439
|
-
}
|
|
18440
|
-
/**
|
|
18441
|
-
* TODO: [🧠][🈴] Where is the best location for this file
|
|
18442
|
-
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
18443
|
-
*/
|
|
18444
|
-
|
|
18445
18960
|
/**
|
|
18446
18961
|
* Convert identification to Promptbook token
|
|
18447
18962
|
*
|
|
@@ -19204,7 +19719,7 @@ ${profile.personaDescription}
|
|
|
19204
19719
|
const agentSource = validateBook(spaceTrim__default["default"]((block) => `
|
|
19205
19720
|
${agentName}
|
|
19206
19721
|
|
|
19207
|
-
META COLOR ${color ||
|
|
19722
|
+
META COLOR ${color || PROMPTBOOK_COLOR.toHex()}
|
|
19208
19723
|
PERSONA ${block(personaDescription)}
|
|
19209
19724
|
`));
|
|
19210
19725
|
return agentSource;
|
|
@@ -19222,6 +19737,7 @@ ${profile.personaDescription}
|
|
|
19222
19737
|
exports.ADMIN_EMAIL = ADMIN_EMAIL;
|
|
19223
19738
|
exports.ADMIN_GITHUB_NAME = ADMIN_GITHUB_NAME;
|
|
19224
19739
|
exports.API_REQUEST_TIMEOUT = API_REQUEST_TIMEOUT;
|
|
19740
|
+
exports.AUTO_FEDERATED_AGENT_SERVER_URLS = AUTO_FEDERATED_AGENT_SERVER_URLS;
|
|
19225
19741
|
exports.AbstractFormatError = AbstractFormatError;
|
|
19226
19742
|
exports.Agent = Agent;
|
|
19227
19743
|
exports.AgentCollectionInSupabase = AgentCollectionInSupabase;
|
|
@@ -19370,6 +19886,7 @@ ${profile.personaDescription}
|
|
|
19370
19886
|
exports.getAllCommitmentDefinitions = getAllCommitmentDefinitions;
|
|
19371
19887
|
exports.getAllCommitmentTypes = getAllCommitmentTypes;
|
|
19372
19888
|
exports.getCommitmentDefinition = getCommitmentDefinition;
|
|
19889
|
+
exports.getGroupedCommitmentDefinitions = getGroupedCommitmentDefinitions;
|
|
19373
19890
|
exports.getPipelineInterface = getPipelineInterface;
|
|
19374
19891
|
exports.getSingleLlmExecutionTools = getSingleLlmExecutionTools;
|
|
19375
19892
|
exports.identificationToPromptbookToken = identificationToPromptbookToken;
|