@promptbook/core 0.112.0 → 0.113.0-1

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.
Files changed (34) hide show
  1. package/README.md +45 -29
  2. package/esm/index.es.js +299 -32
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/src/_packages/core.index.d.ts +22 -0
  5. package/esm/src/_packages/types.index.d.ts +2 -0
  6. package/esm/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -0
  7. package/esm/src/book-2.0/agent-source/agentSourceVisibility.d.ts +97 -0
  8. package/esm/src/book-2.0/agent-source/agentSourceVisibility.test.d.ts +1 -0
  9. package/esm/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  10. package/esm/src/book-components/Chat/Chat/CitationIframePreview.d.ts +2 -2
  11. package/esm/src/book-components/Chat/utils/livePagePreviewConstants.d.ts +12 -0
  12. package/esm/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +6 -0
  13. package/esm/src/collection/agent-collection/CreateAgentInput.d.ts +2 -1
  14. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +21 -1
  15. package/esm/src/commitments/META_VISIBILITY/META_VISIBILITY.d.ts +27 -0
  16. package/esm/src/commitments/index.d.ts +2 -1
  17. package/esm/src/version.d.ts +1 -1
  18. package/package.json +1 -1
  19. package/umd/index.umd.js +311 -34
  20. package/umd/index.umd.js.map +1 -1
  21. package/umd/src/_packages/core.index.d.ts +22 -0
  22. package/umd/src/_packages/types.index.d.ts +2 -0
  23. package/umd/src/book-2.0/agent-source/AgentBasicInformation.d.ts +2 -0
  24. package/umd/src/book-2.0/agent-source/agentSourceVisibility.d.ts +97 -0
  25. package/umd/src/book-2.0/agent-source/agentSourceVisibility.test.d.ts +1 -0
  26. package/umd/src/book-components/BookEditor/BookEditorMonacoTokenization.d.ts +1 -0
  27. package/umd/src/book-components/Chat/Chat/CitationIframePreview.d.ts +2 -2
  28. package/umd/src/book-components/Chat/utils/livePagePreviewConstants.d.ts +12 -0
  29. package/umd/src/cli/cli-commands/agents-server/buildAgentsServer.d.ts +6 -0
  30. package/umd/src/collection/agent-collection/CreateAgentInput.d.ts +2 -1
  31. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/prepareAgentSourceForPersistence.d.ts +21 -1
  32. package/umd/src/commitments/META_VISIBILITY/META_VISIBILITY.d.ts +27 -0
  33. package/umd/src/commitments/index.d.ts +2 -1
  34. package/umd/src/version.d.ts +1 -1
package/umd/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js'), require('crypto-js/enc-hex'), require('spacetrim'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('path'), require('mime-types'), require('papaparse'), require('moment'), require('crypto'), require('colors'), require('@openai/agents'), require('bottleneck'), require('openai')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'crypto-js', 'crypto-js/enc-hex', 'spacetrim', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'path', 'mime-types', 'papaparse', 'moment', 'crypto', 'colors', '@openai/agents', 'bottleneck', 'openai'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.CryptoJS, global.hexEncoder, global.spacetrim, global.rxjs, global.waitasecond, global.sha256, global.path, global.mimeTypes, global.papaparse, global.moment, global.crypto, global.colors, global.agents, global.Bottleneck, global.OpenAI));
5
- })(this, (function (exports, CryptoJS, hexEncoder, spacetrim, rxjs, waitasecond, sha256, path, mimeTypes, papaparse, moment, crypto, colors, agents, Bottleneck, OpenAI) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('spacetrim'), require('crypto-js'), require('crypto-js/enc-hex'), require('rxjs'), require('waitasecond'), require('crypto-js/sha256'), require('path'), require('mime-types'), require('papaparse'), require('moment'), require('crypto'), require('colors'), require('@openai/agents'), require('bottleneck'), require('openai')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'spacetrim', 'crypto-js', 'crypto-js/enc-hex', 'rxjs', 'waitasecond', 'crypto-js/sha256', 'path', 'mime-types', 'papaparse', 'moment', 'crypto', 'colors', '@openai/agents', 'bottleneck', 'openai'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["promptbook-core"] = {}, global.spacetrim, global.CryptoJS, global.hexEncoder, global.rxjs, global.waitasecond, global.sha256, global.path, global.mimeTypes, global.papaparse, global.moment, global.crypto, global.colors, global.agents, global.Bottleneck, global.OpenAI));
5
+ })(this, (function (exports, spacetrim, CryptoJS, hexEncoder, rxjs, waitasecond, sha256, path, mimeTypes, papaparse, moment, crypto, colors, agents, Bottleneck, OpenAI) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -29,12 +29,26 @@
29
29
  * @generated
30
30
  * @see https://github.com/webgptorg/promptbook
31
31
  */
32
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0';
32
+ const PROMPTBOOK_ENGINE_VERSION = '0.113.0-1';
33
33
  /**
34
34
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
35
35
  * Note: [💞] Ignore a discrepancy between file name and entity name
36
36
  */
37
37
 
38
+ /**
39
+ * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
40
+ *
41
+ * @public exported from `@promptbook/core`
42
+ */
43
+ class ParseError extends Error {
44
+ constructor(message) {
45
+ super(message);
46
+ this.name = 'ParseError';
47
+ Object.setPrototypeOf(this, ParseError.prototype);
48
+ }
49
+ }
50
+ // TODO: Maybe split `ParseError` and `ApplyError`
51
+
38
52
  /**
39
53
  * Trims string from all 4 sides
40
54
  *
@@ -47,6 +61,181 @@
47
61
  */
48
62
  const spaceTrim = spacetrim.spaceTrim;
49
63
 
64
+ /**
65
+ * Supported visibility states for persisted agents.
66
+ *
67
+ * @public exported from `@promptbook/core`
68
+ */
69
+ const AGENT_VISIBILITY_VALUES = ['PRIVATE', 'UNLISTED', 'PUBLIC'];
70
+ /**
71
+ * Fallback visibility used when no valid value is configured.
72
+ *
73
+ * @public exported from `@promptbook/core`
74
+ */
75
+ const DEFAULT_AGENT_VISIBILITY = 'UNLISTED';
76
+ /**
77
+ * Matches a single-line `META VISIBILITY` commitment in book source.
78
+ */
79
+ const META_VISIBILITY_LINE_PATTERN = /^(\s*)META\s+VISIBILITY\b([\s\S]*)$/iu;
80
+ /**
81
+ * Returns `true` when the value is one of supported visibility states.
82
+ *
83
+ * @param value - Raw value to validate.
84
+ * @returns Whether the value is a valid `AgentVisibility`.
85
+ *
86
+ * @public exported from `@promptbook/core`
87
+ */
88
+ function isAgentVisibility(value) {
89
+ return typeof value === 'string' && AGENT_VISIBILITY_VALUES.includes(value);
90
+ }
91
+ /**
92
+ * Normalizes raw visibility text into a supported value.
93
+ *
94
+ * @param value - Raw visibility value.
95
+ * @returns Normalized visibility, or `null` when invalid.
96
+ *
97
+ * @public exported from `@promptbook/core`
98
+ */
99
+ function normalizeAgentVisibility(value) {
100
+ if (typeof value !== 'string') {
101
+ return null;
102
+ }
103
+ const normalized = value.trim().toUpperCase();
104
+ return isAgentVisibility(normalized) ? normalized : null;
105
+ }
106
+ /**
107
+ * Parses visibility from an unknown value with a safe fallback.
108
+ *
109
+ * @param value - Raw visibility value.
110
+ * @param fallback - Fallback when the value is invalid.
111
+ * @returns Parsed visibility.
112
+ *
113
+ * @public exported from `@promptbook/core`
114
+ */
115
+ function parseAgentVisibility(value, fallback = DEFAULT_AGENT_VISIBILITY) {
116
+ var _a;
117
+ return (_a = normalizeAgentVisibility(value)) !== null && _a !== void 0 ? _a : fallback;
118
+ }
119
+ /**
120
+ * Parses visibility and throws when the value is not supported.
121
+ *
122
+ * @param value - Raw visibility value.
123
+ * @param sourceLabel - Human-readable source used in the error message.
124
+ * @returns Parsed visibility.
125
+ *
126
+ * @public exported from `@promptbook/core`
127
+ */
128
+ function parseAgentVisibilityStrict(value, sourceLabel = 'visibility') {
129
+ const visibility = normalizeAgentVisibility(value);
130
+ if (visibility) {
131
+ return visibility;
132
+ }
133
+ throw new ParseError(spaceTrim(`
134
+ Invalid ${sourceLabel}.
135
+
136
+ Value must be one of: ${AGENT_VISIBILITY_VALUES.map((allowedValue) => `\`${allowedValue}\``).join(', ')}.
137
+ `));
138
+ }
139
+ /**
140
+ * Extracts the last `META VISIBILITY` value from an agent source.
141
+ *
142
+ * @param agentSource - Raw book source.
143
+ * @param options - Strict parsing options.
144
+ * @returns Normalized visibility, or `null` when no commitment is present.
145
+ *
146
+ * @public exported from `@promptbook/core`
147
+ */
148
+ function parseAgentSourceVisibility(agentSource, options = {}) {
149
+ let visibilityContent = null;
150
+ for (const line of agentSource.split(/\r?\n/u)) {
151
+ const lineMatch = META_VISIBILITY_LINE_PATTERN.exec(line);
152
+ if (lineMatch) {
153
+ visibilityContent = lineMatch[2].trim();
154
+ }
155
+ }
156
+ if (visibilityContent === null) {
157
+ return null;
158
+ }
159
+ const visibility = normalizeAgentVisibility(visibilityContent);
160
+ if (visibility || !options.isStrict) {
161
+ return visibility;
162
+ }
163
+ return parseAgentVisibilityStrict(visibilityContent, '`META VISIBILITY` commitment');
164
+ }
165
+ /**
166
+ * Returns whether an agent should be listed publicly in anonymous views.
167
+ *
168
+ * @param visibility - Agent visibility to evaluate.
169
+ * @returns `true` for publicly listed agents.
170
+ *
171
+ * @public exported from `@promptbook/core`
172
+ */
173
+ function isPublicAgentVisibility(visibility) {
174
+ return visibility === 'PUBLIC';
175
+ }
176
+ /**
177
+ * Returns the next visibility in UI rotation order.
178
+ *
179
+ * @param visibility - Current visibility.
180
+ * @returns Next visibility value.
181
+ *
182
+ * @public exported from `@promptbook/core`
183
+ */
184
+ function getNextAgentVisibility(visibility) {
185
+ switch (visibility) {
186
+ case 'PRIVATE':
187
+ return 'UNLISTED';
188
+ case 'UNLISTED':
189
+ return 'PUBLIC';
190
+ case 'PUBLIC':
191
+ default:
192
+ return 'PRIVATE';
193
+ }
194
+ }
195
+ /**
196
+ * Inserts or replaces the `META VISIBILITY` commitment in a book source.
197
+ *
198
+ * @param agentSource - Raw book source.
199
+ * @param visibility - Visibility to persist.
200
+ * @returns Source with exactly one normalized `META VISIBILITY` line.
201
+ *
202
+ * @public exported from `@promptbook/core`
203
+ */
204
+ function setAgentSourceVisibility(agentSource, visibility) {
205
+ var _a;
206
+ const normalizedVisibility = parseAgentVisibilityStrict(visibility, '`META VISIBILITY` commitment');
207
+ const lines = agentSource.split(/\r?\n/u);
208
+ const nextLines = [];
209
+ let isVisibilityLineWritten = false;
210
+ for (const line of lines) {
211
+ const lineMatch = META_VISIBILITY_LINE_PATTERN.exec(line);
212
+ if (!lineMatch) {
213
+ nextLines.push(line);
214
+ continue;
215
+ }
216
+ if (isVisibilityLineWritten) {
217
+ continue;
218
+ }
219
+ nextLines.push(`${(_a = lineMatch[1]) !== null && _a !== void 0 ? _a : ''}META VISIBILITY ${normalizedVisibility}`);
220
+ isVisibilityLineWritten = true;
221
+ }
222
+ if (!isVisibilityLineWritten) {
223
+ nextLines.splice(findMetaVisibilityInsertIndex(nextLines), 0, `META VISIBILITY ${normalizedVisibility}`);
224
+ }
225
+ return nextLines.join('\n');
226
+ }
227
+ /**
228
+ * Finds the position after the first non-empty line, which is the agent title.
229
+ *
230
+ * @param lines - Source lines.
231
+ * @returns Insertion index for profile metadata.
232
+ */
233
+ function findMetaVisibilityInsertIndex(lines) {
234
+ const titleLineIndex = lines.findIndex((line) => line.trim().length > 0);
235
+ return titleLineIndex === -1 ? 0 : titleLineIndex + 1;
236
+ }
237
+ // Note: [💞] Ignore a discrepancy between file name and entity name
238
+
50
239
  /**
51
240
  * Class implementing take chain.
52
241
  *
@@ -1770,20 +1959,6 @@
1770
1959
  }
1771
1960
  }
1772
1961
 
1773
- /**
1774
- * This error indicates that the promptbook in a markdown format cannot be parsed into a valid promptbook object
1775
- *
1776
- * @public exported from `@promptbook/core`
1777
- */
1778
- class ParseError extends Error {
1779
- constructor(message) {
1780
- super(message);
1781
- this.name = 'ParseError';
1782
- Object.setPrototypeOf(this, ParseError.prototype);
1783
- }
1784
- }
1785
- // TODO: Maybe split `ParseError` and `ApplyError`
1786
-
1787
1962
  /**
1788
1963
  * Function isValidJsonString will tell you if the string is valid JSON or not
1789
1964
  *
@@ -18591,6 +18766,70 @@
18591
18766
  }
18592
18767
  // Note: [💞] Ignore a discrepancy between file name and entity name
18593
18768
 
18769
+ /**
18770
+ * META VISIBILITY commitment definition.
18771
+ *
18772
+ * The `META VISIBILITY` commitment stores whether an agent is public, private, or unlisted.
18773
+ * Agents Server mirrors this value into the database for efficient filtering, but the book
18774
+ * commitment remains the editable source of truth.
18775
+ *
18776
+ * @private Metadata-only commitment used by Agents Server.
18777
+ */
18778
+ class MetaVisibilityCommitmentDefinition extends BaseCommitmentDefinition {
18779
+ constructor() {
18780
+ super('META VISIBILITY');
18781
+ }
18782
+ /**
18783
+ * Short one-line description of META VISIBILITY.
18784
+ */
18785
+ get description() {
18786
+ return 'Set whether the agent is private, unlisted, or public.';
18787
+ }
18788
+ /**
18789
+ * Icon for this commitment.
18790
+ */
18791
+ get icon() {
18792
+ return '👁️';
18793
+ }
18794
+ /**
18795
+ * Markdown documentation for META VISIBILITY commitment.
18796
+ */
18797
+ get documentation() {
18798
+ return spacetrim.spaceTrim(`
18799
+ # META VISIBILITY
18800
+
18801
+ Sets the agent visibility used by Agents Server.
18802
+
18803
+ ## Allowed values
18804
+
18805
+ - \`PRIVATE\` - accessible only to signed-in users with access.
18806
+ - \`UNLISTED\` - accessible by direct link but hidden from public listings.
18807
+ - \`PUBLIC\` - visible in public listings and accessible by anyone.
18808
+
18809
+ ## Key aspects
18810
+
18811
+ - Does not modify the agent's behavior, system message, or tools.
18812
+ - Whitespace and letter case are normalized when persisted.
18813
+ - If multiple \`META VISIBILITY\` commitments are present, persistence keeps one normalized value.
18814
+ - Agents Server mirrors the value into the database for filtering, but the book is the source of truth.
18815
+
18816
+ ## Example
18817
+
18818
+ \`\`\`book
18819
+ Helpful Assistant
18820
+
18821
+ GOAL Be helpful and friendly.
18822
+ META VISIBILITY PUBLIC
18823
+ \`\`\`
18824
+ `);
18825
+ }
18826
+ applyToAgentModelRequirements(requirements, content) {
18827
+ // META VISIBILITY is metadata only and does not alter model requirements.
18828
+ return requirements;
18829
+ }
18830
+ }
18831
+ // Note: [💞] Ignore a discrepancy between file name and entity name
18832
+
18594
18833
  /**
18595
18834
  * META VOICE commitment definition
18596
18835
  *
@@ -27114,6 +27353,7 @@
27114
27353
  new MetaDomainCommitmentDefinition(),
27115
27354
  new MetaDisclaimerCommitmentDefinition(),
27116
27355
  new MetaInputPlaceholderCommitmentDefinition(),
27356
+ new MetaVisibilityCommitmentDefinition(),
27117
27357
  new MetaCommitmentDefinition(),
27118
27358
  new MetaVoiceCommitmentDefinition(),
27119
27359
  new NoteCommitmentDefinition('NOTE'),
@@ -28458,6 +28698,7 @@
28458
28698
  'META COLOR': applyMetaColorContent,
28459
28699
  'META FONT': applyMetaFontContent,
28460
28700
  'META VOICE': applyMetaVoiceContent,
28701
+ 'META VISIBILITY': applyMetaVisibilityContent,
28461
28702
  };
28462
28703
  /**
28463
28704
  * Applies META-style commitments that mutate parsed profile metadata.
@@ -28487,6 +28728,10 @@
28487
28728
  applyMetaAvatarContent(state, metaValue);
28488
28729
  return;
28489
28730
  }
28731
+ if (metaTypeRaw.toUpperCase() === 'VISIBILITY') {
28732
+ applyMetaVisibilityContent(state, metaValue);
28733
+ return;
28734
+ }
28490
28735
  const metaType = normalizeTo_camelCase(metaTypeRaw);
28491
28736
  state.meta[metaType] = metaValue;
28492
28737
  }
@@ -28563,6 +28808,15 @@
28563
28808
  function applyMetaVoiceContent(state, content) {
28564
28809
  state.meta.voice = spacetrim.spaceTrim(content);
28565
28810
  }
28811
+ /**
28812
+ * Applies META VISIBILITY content into the normalized `meta.visibility` field.
28813
+ */
28814
+ function applyMetaVisibilityContent(state, content) {
28815
+ const visibility = normalizeAgentVisibility(content);
28816
+ if (visibility) {
28817
+ state.meta.visibility = visibility;
28818
+ }
28819
+ }
28566
28820
  /**
28567
28821
  * Normalizes the separator in the content
28568
28822
  *
@@ -29668,6 +29922,7 @@
29668
29922
  'META DESCRIPTION',
29669
29923
  'META DISCLAIMER',
29670
29924
  'META INPUT PLACEHOLDER',
29925
+ 'META VISIBILITY',
29671
29926
  'META COLOR',
29672
29927
  'META FONT',
29673
29928
  'META VOICE',
@@ -30343,18 +30598,23 @@
30343
30598
  *
30344
30599
  * @private shared persistence helper for `AgentCollectionInSupabase`
30345
30600
  */
30346
- function prepareAgentSourceForPersistence(agentSource) {
30347
- let agentProfile = parseAgentSource(agentSource);
30348
- const permanentId = agentProfile.permanentId;
30349
- const strippedAgentSource = stripMetaIdLines(agentSource);
30350
- if (strippedAgentSource !== agentSource) {
30351
- agentSource = strippedAgentSource;
30352
- agentProfile = parseAgentSource(agentSource);
30353
- }
30601
+ function prepareAgentSourceForPersistence(agentSource, options = {}) {
30602
+ var _a, _b, _c;
30603
+ const originalAgentProfile = parseAgentSource(agentSource);
30604
+ const permanentId = originalAgentProfile.permanentId;
30605
+ agentSource = stripMetaIdLines(agentSource);
30606
+ const sourceVisibility = parseAgentSourceVisibility(agentSource, { isStrict: true });
30607
+ const resolvedVisibility = options.isVisibilityOverride || !sourceVisibility
30608
+ ? (_b = (_a = options.visibility) !== null && _a !== void 0 ? _a : sourceVisibility) !== null && _b !== void 0 ? _b : DEFAULT_AGENT_VISIBILITY
30609
+ : sourceVisibility;
30610
+ agentSource = setAgentSourceVisibility(agentSource, resolvedVisibility);
30611
+ const agentProfile = parseAgentSource(agentSource);
30612
+ const visibility = (_c = parseAgentSourceVisibility(agentSource, { isStrict: true })) !== null && _c !== void 0 ? _c : undefined;
30354
30613
  return {
30355
30614
  agentProfile,
30356
30615
  agentSource,
30357
30616
  permanentId,
30617
+ visibility,
30358
30618
  };
30359
30619
  }
30360
30620
  /**
@@ -30385,8 +30645,11 @@
30385
30645
  * @private shared persistence helper for `AgentCollectionInSupabase`
30386
30646
  */
30387
30647
  function createAgentPersistenceRecords(agentSource, options = {}, createdAt = new Date().toISOString()) {
30388
- const preparedAgentSource = prepareAgentSourceForPersistence(agentSource);
30389
- const { agentProfile, agentSource: normalizedAgentSource } = preparedAgentSource;
30648
+ const preparedAgentSource = prepareAgentSourceForPersistence(agentSource, {
30649
+ visibility: options.visibility,
30650
+ isVisibilityOverride: options.visibility !== undefined,
30651
+ });
30652
+ const { agentProfile, agentSource: normalizedAgentSource, visibility } = preparedAgentSource;
30390
30653
  const permanentId = preparedAgentSource.permanentId || $randomBase58(14);
30391
30654
  const { agentName, agentHash } = agentProfile;
30392
30655
  const agentInsertRecord = {
@@ -30406,8 +30669,8 @@
30406
30669
  if (options.sortOrder !== undefined) {
30407
30670
  agentInsertRecord.sortOrder = options.sortOrder;
30408
30671
  }
30409
- if (options.visibility !== undefined) {
30410
- agentInsertRecord.visibility = options.visibility;
30672
+ if (visibility !== undefined) {
30673
+ agentInsertRecord.visibility = visibility;
30411
30674
  }
30412
30675
  return {
30413
30676
  createdAgent: {
@@ -30624,7 +30887,7 @@
30624
30887
  async updateAgentSource(permanentId, agentSource, options = {}) {
30625
30888
  const selectPreviousAgentResult = await this.supabaseClient
30626
30889
  .from(this.getTableName('Agent'))
30627
- .select('agentHash,agentName,permanentId')
30890
+ .select('agentHash,agentName,permanentId,visibility')
30628
30891
  .eq('permanentId', permanentId)
30629
30892
  .single();
30630
30893
  if (selectPreviousAgentResult.error) {
@@ -30639,8 +30902,11 @@
30639
30902
  selectPreviousAgentResult.data.agentName;
30640
30903
  const previousAgentHash = selectPreviousAgentResult.data.agentHash;
30641
30904
  const previousPermanentId = selectPreviousAgentResult.data.permanentId;
30642
- const preparedAgentSource = prepareAgentSourceForPersistence(agentSource);
30643
- const { agentProfile, agentSource: normalizedAgentSource } = preparedAgentSource;
30905
+ const previousVisibility = selectPreviousAgentResult.data.visibility;
30906
+ const preparedAgentSource = prepareAgentSourceForPersistence(agentSource, {
30907
+ visibility: previousVisibility,
30908
+ });
30909
+ const { agentProfile, agentSource: normalizedAgentSource, visibility } = preparedAgentSource;
30644
30910
  let { permanentId: newPermanentId } = preparedAgentSource;
30645
30911
  const { agentHash, agentName } = agentProfile;
30646
30912
  if (!newPermanentId && previousPermanentId) {
@@ -30662,6 +30928,7 @@
30662
30928
  updatedAt: new Date().toISOString(),
30663
30929
  agentHash: agentProfile.agentHash,
30664
30930
  agentSource: normalizedAgentSource,
30931
+ visibility: visibility !== null && visibility !== void 0 ? visibility : previousVisibility,
30665
30932
  promptbookEngineVersion: PROMPTBOOK_ENGINE_VERSION,
30666
30933
  })
30667
30934
  .eq('permanentId', permanentId);
@@ -50852,6 +51119,7 @@
50852
51119
  exports.$scrapersRegister = $scrapersRegister;
50853
51120
  exports.ADMIN_EMAIL = ADMIN_EMAIL;
50854
51121
  exports.ADMIN_GITHUB_NAME = ADMIN_GITHUB_NAME;
51122
+ exports.AGENT_VISIBILITY_VALUES = AGENT_VISIBILITY_VALUES;
50855
51123
  exports.API_REQUEST_TIMEOUT = API_REQUEST_TIMEOUT;
50856
51124
  exports.AbstractFormatError = AbstractFormatError;
50857
51125
  exports.Agent = Agent;
@@ -50879,6 +51147,7 @@
50879
51147
  exports.CsvFormatError = CsvFormatError;
50880
51148
  exports.CsvFormatParser = CsvFormatParser;
50881
51149
  exports.DEFAULT_AGENTS_DIRNAME = DEFAULT_AGENTS_DIRNAME;
51150
+ exports.DEFAULT_AGENT_VISIBILITY = DEFAULT_AGENT_VISIBILITY;
50882
51151
  exports.DEFAULT_BOOK = DEFAULT_BOOK;
50883
51152
  exports.DEFAULT_BOOKS_DIRNAME = DEFAULT_BOOKS_DIRNAME;
50884
51153
  exports.DEFAULT_BOOK_OUTPUT_PARAMETER_NAME = DEFAULT_BOOK_OUTPUT_PARAMETER_NAME;
@@ -51025,14 +51294,17 @@
51025
51294
  exports.getAllCommitmentsToolTitles = getAllCommitmentsToolTitles;
51026
51295
  exports.getCommitmentDefinition = getCommitmentDefinition;
51027
51296
  exports.getGroupedCommitmentDefinitions = getGroupedCommitmentDefinitions;
51297
+ exports.getNextAgentVisibility = getNextAgentVisibility;
51028
51298
  exports.getPipelineInterface = getPipelineInterface;
51029
51299
  exports.getSingleLlmExecutionTools = getSingleLlmExecutionTools;
51030
51300
  exports.identificationToPromptbookToken = identificationToPromptbookToken;
51301
+ exports.isAgentVisibility = isAgentVisibility;
51031
51302
  exports.isCommitmentSupported = isCommitmentSupported;
51032
51303
  exports.isPassingExpectations = isPassingExpectations;
51033
51304
  exports.isPipelineImplementingInterface = isPipelineImplementingInterface;
51034
51305
  exports.isPipelineInterfacesEqual = isPipelineInterfacesEqual;
51035
51306
  exports.isPipelinePrepared = isPipelinePrepared;
51307
+ exports.isPublicAgentVisibility = isPublicAgentVisibility;
51036
51308
  exports.isValidBook = isValidBook;
51037
51309
  exports.isValidPipelineString = isValidPipelineString;
51038
51310
  exports.joinLlmExecutionTools = joinLlmExecutionTools;
@@ -51040,9 +51312,13 @@
51040
51312
  exports.makeKnowledgeSourceHandler = makeKnowledgeSourceHandler;
51041
51313
  exports.migratePipeline = migratePipeline;
51042
51314
  exports.normalizeAgentName = normalizeAgentName;
51315
+ exports.normalizeAgentVisibility = normalizeAgentVisibility;
51043
51316
  exports.normalizeChatAttachments = normalizeChatAttachments;
51044
51317
  exports.padBook = padBook;
51045
51318
  exports.parseAgentSource = parseAgentSource;
51319
+ exports.parseAgentSourceVisibility = parseAgentSourceVisibility;
51320
+ exports.parseAgentVisibility = parseAgentVisibility;
51321
+ exports.parseAgentVisibilityStrict = parseAgentVisibilityStrict;
51046
51322
  exports.parseParameters = parseParameters;
51047
51323
  exports.parsePipeline = parsePipeline;
51048
51324
  exports.pipelineCollectionToJson = pipelineCollectionToJson;
@@ -51054,6 +51330,7 @@
51054
51330
  exports.promptbookFetch = promptbookFetch;
51055
51331
  exports.promptbookTokenToIdentification = promptbookTokenToIdentification;
51056
51332
  exports.resolveChatAttachmentContents = resolveChatAttachmentContents;
51333
+ exports.setAgentSourceVisibility = setAgentSourceVisibility;
51057
51334
  exports.unpreparePipeline = unpreparePipeline;
51058
51335
  exports.usageToHuman = usageToHuman;
51059
51336
  exports.usageToWorktime = usageToWorktime;