@promptbook/remote-server 0.112.0-62 → 0.112.0-64

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 (57) hide show
  1. package/esm/index.es.js +785 -40
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/_packages/components.index.d.ts +4 -0
  4. package/esm/src/_packages/core.index.d.ts +2 -0
  5. package/esm/src/_packages/types.index.d.ts +2 -0
  6. package/esm/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +0 -2
  7. package/esm/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +7 -1
  8. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +1 -1
  9. package/esm/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +2 -2
  10. package/esm/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +6 -3
  11. package/esm/src/book-components/Chat/types/ChatMessage.d.ts +34 -0
  12. package/esm/src/cli/cli-commands/agent/agentProjectPaths.d.ts +54 -0
  13. package/esm/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +13 -0
  14. package/esm/src/cli/cli-commands/agent/init.d.ts +10 -0
  15. package/esm/src/cli/cli-commands/agent/initializeAgentProjectConfiguration.d.ts +21 -0
  16. package/esm/src/cli/cli-commands/agent/printAgentInitializationSummary.d.ts +7 -0
  17. package/esm/src/cli/cli-commands/agent/run.d.ts +10 -0
  18. package/esm/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  19. package/esm/src/cli/cli-commands/agent/tick.d.ts +10 -0
  20. package/esm/src/cli/cli-commands/agent.d.ts +15 -0
  21. package/esm/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +86 -0
  22. package/esm/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +11 -0
  23. package/esm/src/commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts +1 -0
  24. package/esm/src/commitments/_common/toolRuntimeContext.d.ts +6 -0
  25. package/esm/src/commitments/index.d.ts +2 -1
  26. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +4 -2
  27. package/esm/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +9 -0
  28. package/esm/src/version.d.ts +1 -1
  29. package/package.json +2 -2
  30. package/umd/index.umd.js +785 -40
  31. package/umd/index.umd.js.map +1 -1
  32. package/umd/src/_packages/components.index.d.ts +4 -0
  33. package/umd/src/_packages/core.index.d.ts +2 -0
  34. package/umd/src/_packages/types.index.d.ts +2 -0
  35. package/umd/src/book-components/Chat/Chat/TeamToolCallModalContent.d.ts +0 -2
  36. package/umd/src/book-components/Chat/Chat/renderTimeoutToolCallDetails.d.ts +7 -1
  37. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +1 -1
  38. package/umd/src/book-components/Chat/Chat/useChatInputAreaDictation.d.ts +2 -2
  39. package/umd/src/book-components/Chat/hooks/useChatAutoScroll.d.ts +6 -3
  40. package/umd/src/book-components/Chat/types/ChatMessage.d.ts +34 -0
  41. package/umd/src/cli/cli-commands/agent/agentProjectPaths.d.ts +54 -0
  42. package/umd/src/cli/cli-commands/agent/agentRunCliOptions.d.ts +13 -0
  43. package/umd/src/cli/cli-commands/agent/init.d.ts +10 -0
  44. package/umd/src/cli/cli-commands/agent/initializeAgentProjectConfiguration.d.ts +21 -0
  45. package/umd/src/cli/cli-commands/agent/printAgentInitializationSummary.d.ts +7 -0
  46. package/umd/src/cli/cli-commands/agent/run.d.ts +10 -0
  47. package/umd/src/cli/cli-commands/agent/run.test.d.ts +1 -0
  48. package/umd/src/cli/cli-commands/agent/tick.d.ts +10 -0
  49. package/umd/src/cli/cli-commands/agent.d.ts +15 -0
  50. package/umd/src/cli/cli-commands/common/promptRunnerCliOptions.d.ts +86 -0
  51. package/umd/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +11 -0
  52. package/umd/src/commitments/KNOWLEDGE/KNOWLEDGE.test.d.ts +1 -0
  53. package/umd/src/commitments/_common/toolRuntimeContext.d.ts +6 -0
  54. package/umd/src/commitments/index.d.ts +2 -1
  55. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionTools.d.ts +4 -2
  56. package/umd/src/llm-providers/openai/OpenAiAgentKitExecutionToolsOptions.d.ts +9 -0
  57. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -40,7 +40,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
40
40
  * @generated
41
41
  * @see https://github.com/webgptorg/promptbook
42
42
  */
43
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-62';
43
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-64';
44
44
  /**
45
45
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
46
46
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -12679,6 +12679,18 @@ function parseDataUrlKnowledgeSource(source) {
12679
12679
  }
12680
12680
  // Note: [💞] Ignore a discrepancy between file name and entity name
12681
12681
 
12682
+ /**
12683
+ * Name of the tool used by agents to search configured `KNOWLEDGE` sources.
12684
+ *
12685
+ * @public exported from `@promptbook/core`
12686
+ */
12687
+ const KNOWLEDGE_SEARCH_TOOL_NAME = 'knowledge_search';
12688
+ /**
12689
+ * Title of the system-message section generated for `KNOWLEDGE` commitments.
12690
+ *
12691
+ * @private constant of `KnowledgeCommitmentDefinition`
12692
+ */
12693
+ const KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE = 'Knowledge Search';
12682
12694
  /**
12683
12695
  * KNOWLEDGE commitment definition
12684
12696
  *
@@ -12800,9 +12812,17 @@ class KnowledgeCommitmentDefinition extends BaseCommitmentDefinition {
12800
12812
  knowledgeInfoEntries.push(`Knowledge Source Inline: ${inlineSource.filename} (derived from inline content and processed for retrieval during chat)`);
12801
12813
  }
12802
12814
  if (knowledgeInfoEntries.length === 0) {
12803
- return nextRequirements;
12815
+ return addKnowledgeSearchToolAndSystemSection(nextRequirements);
12804
12816
  }
12805
- return this.appendToSystemMessage(nextRequirements, knowledgeInfoEntries.join('\n'), '\n\n');
12817
+ return addKnowledgeSearchToolAndSystemSection(nextRequirements);
12818
+ }
12819
+ /**
12820
+ * Gets human-readable titles for tool functions provided by this commitment.
12821
+ */
12822
+ getToolTitles() {
12823
+ return {
12824
+ [KNOWLEDGE_SEARCH_TOOL_NAME]: 'Knowledge search',
12825
+ };
12806
12826
  }
12807
12827
  }
12808
12828
  /**
@@ -12816,6 +12836,128 @@ function hasMeaningfulNonUrlText(content, urls) {
12816
12836
  const significantText = contentWithoutUrls.replace(/[\s.,!?;:'"`()[\]{}<>/-]+/g, '');
12817
12837
  return significantText.length > 0;
12818
12838
  }
12839
+ /**
12840
+ * Adds the shared `knowledge_search` tool definition and the consolidated system-message section.
12841
+ *
12842
+ * @param requirements - Requirements after one `KNOWLEDGE` commitment was applied.
12843
+ * @returns Requirements with the knowledge search instructions and tool definition.
12844
+ *
12845
+ * @private internal utility of `KnowledgeCommitmentDefinition`
12846
+ */
12847
+ function addKnowledgeSearchToolAndSystemSection(requirements) {
12848
+ const nextRequirements = addKnowledgeSearchTool(requirements);
12849
+ const section = createKnowledgeSearchSystemSection(nextRequirements);
12850
+ const sectionHeader = `## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}`;
12851
+ if (nextRequirements.systemMessage.includes(sectionHeader)) {
12852
+ return {
12853
+ ...nextRequirements,
12854
+ systemMessage: nextRequirements.systemMessage.replace(new RegExp(`## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}[\\s\\S]*?(?=\\n\\n##|$)`), section),
12855
+ };
12856
+ }
12857
+ return {
12858
+ ...nextRequirements,
12859
+ systemMessage: nextRequirements.systemMessage.trim()
12860
+ ? `${nextRequirements.systemMessage}\n\n${section}`
12861
+ : section,
12862
+ };
12863
+ }
12864
+ /**
12865
+ * Adds the `knowledge_search` model tool when it is not already present.
12866
+ *
12867
+ * @param requirements - Current model requirements.
12868
+ * @returns Requirements with the tool definition available to the model.
12869
+ *
12870
+ * @private internal utility of `KnowledgeCommitmentDefinition`
12871
+ */
12872
+ function addKnowledgeSearchTool(requirements) {
12873
+ const existingTools = requirements.tools || [];
12874
+ if (existingTools.some((tool) => tool.name === KNOWLEDGE_SEARCH_TOOL_NAME)) {
12875
+ return requirements;
12876
+ }
12877
+ return {
12878
+ ...requirements,
12879
+ tools: [
12880
+ ...existingTools,
12881
+ {
12882
+ name: KNOWLEDGE_SEARCH_TOOL_NAME,
12883
+ description: spaceTrim$1(`
12884
+ Search the agent's configured knowledge sources and return relevant excerpts with citation ids.
12885
+ Use this before answering questions that may depend on the agent's KNOWLEDGE commitments.
12886
+ `),
12887
+ parameters: {
12888
+ type: 'object',
12889
+ properties: {
12890
+ query: {
12891
+ type: 'string',
12892
+ description: 'The natural-language search query for the knowledge base.',
12893
+ },
12894
+ limit: {
12895
+ type: 'integer',
12896
+ description: 'Maximum number of matching source excerpts to return.',
12897
+ },
12898
+ },
12899
+ required: ['query'],
12900
+ },
12901
+ },
12902
+ ],
12903
+ };
12904
+ }
12905
+ /**
12906
+ * Creates the model-facing system-message section for knowledge search.
12907
+ *
12908
+ * @param requirements - Current model requirements.
12909
+ * @returns Markdown system-message section.
12910
+ *
12911
+ * @private internal utility of `KnowledgeCommitmentDefinition`
12912
+ */
12913
+ function createKnowledgeSearchSystemSection(requirements) {
12914
+ const sourceEntries = createKnowledgeSourceSystemEntries(requirements);
12915
+ const sourceList = sourceEntries.length > 0 ? sourceEntries.map((entry) => `- ${entry}`).join('\n') : '- None';
12916
+ return spaceTrim$1(`
12917
+ ## ${KNOWLEDGE_SEARCH_SYSTEM_SECTION_TITLE}
12918
+
12919
+ - Use \`${KNOWLEDGE_SEARCH_TOOL_NAME}\` to search the configured knowledge sources before answering questions that depend on this agent's knowledge base.
12920
+ - Base source-backed factual answers on the returned excerpts.
12921
+ - When you use a returned excerpt, include its citation marker in the answer body, for example \`[0:0]\`.
12922
+ - If the search returns no relevant information, say that the knowledge base did not contain the answer instead of inventing it.
12923
+
12924
+ Configured knowledge sources:
12925
+ ${sourceList}
12926
+ `);
12927
+ }
12928
+ /**
12929
+ * Builds a stable list of configured knowledge sources for system-message diagnostics.
12930
+ *
12931
+ * @param requirements - Current model requirements.
12932
+ * @returns Human-readable source entries.
12933
+ *
12934
+ * @private internal utility of `KnowledgeCommitmentDefinition`
12935
+ */
12936
+ function createKnowledgeSourceSystemEntries(requirements) {
12937
+ var _a;
12938
+ const entries = [];
12939
+ const seenEntries = new Set();
12940
+ for (const source of requirements.knowledgeSources || []) {
12941
+ const entry = `Source URL: ${source} (processed for retrieval during chat)`;
12942
+ if (seenEntries.has(entry)) {
12943
+ continue;
12944
+ }
12945
+ seenEntries.add(entry);
12946
+ entries.push(entry);
12947
+ }
12948
+ const inlineSources = (((_a = requirements._metadata) === null || _a === void 0 ? void 0 : _a.inlineKnowledgeSources) || [])
12949
+ .map((source) => source.filename)
12950
+ .filter(Boolean);
12951
+ for (const filename of inlineSources) {
12952
+ const entry = `Knowledge Source Inline: ${filename} (Inline source: processed for retrieval during chat)`;
12953
+ if (seenEntries.has(entry)) {
12954
+ continue;
12955
+ }
12956
+ seenEntries.add(entry);
12957
+ entries.push(entry);
12958
+ }
12959
+ return entries;
12960
+ }
12819
12961
 
12820
12962
  /**
12821
12963
  * LANGUAGE commitment definition
@@ -20575,7 +20717,7 @@ function resolveUseCalendarToolRuntime(args) {
20575
20717
  const runtimeContext = (readToolRuntimeContextFromToolArgs(args) ||
20576
20718
  {});
20577
20719
  const configuredCalendars = normalizeConfiguredCalendars$1((_a = runtimeContext.calendars) === null || _a === void 0 ? void 0 : _a.connections);
20578
- const calendarArgument = normalizeOptionalText$1(args.calendarUrl);
20720
+ const calendarArgument = normalizeOptionalText$2(args.calendarUrl);
20579
20721
  let calendarReference = null;
20580
20722
  if (calendarArgument) {
20581
20723
  calendarReference = parseGoogleCalendarReference(calendarArgument);
@@ -20595,7 +20737,7 @@ function resolveUseCalendarToolRuntime(args) {
20595
20737
  if (!calendarReference) {
20596
20738
  throw new Error('Calendar is required but was not resolved.');
20597
20739
  }
20598
- const accessToken = normalizeOptionalText$1((_b = runtimeContext.calendars) === null || _b === void 0 ? void 0 : _b.googleAccessToken) || '';
20740
+ const accessToken = normalizeOptionalText$2((_b = runtimeContext.calendars) === null || _b === void 0 ? void 0 : _b.googleAccessToken) || '';
20599
20741
  if (!accessToken) {
20600
20742
  throw new CalendarWalletCredentialRequiredError({
20601
20743
  calendarReference,
@@ -20628,7 +20770,7 @@ function normalizeConfiguredCalendars$1(rawCalendars) {
20628
20770
  continue;
20629
20771
  }
20630
20772
  const calendar = rawCalendar;
20631
- const rawUrl = normalizeOptionalText$1(calendar.url);
20773
+ const rawUrl = normalizeOptionalText$2(calendar.url);
20632
20774
  if (!rawUrl) {
20633
20775
  continue;
20634
20776
  }
@@ -20679,7 +20821,7 @@ function createCalendarWalletCredentialRequiredResult(error) {
20679
20821
  *
20680
20822
  * @private function of resolveUseCalendarToolRuntimeOrWalletCredentialResult
20681
20823
  */
20682
- function normalizeOptionalText$1(value) {
20824
+ function normalizeOptionalText$2(value) {
20683
20825
  if (typeof value !== 'string') {
20684
20826
  return undefined;
20685
20827
  }
@@ -20711,13 +20853,13 @@ function createUseCalendarToolFunctions() {
20711
20853
  async [UseCalendarToolNames.listEvents](args) {
20712
20854
  return withUseCalendarRuntime(args, async ({ calendarReference, accessToken }) => {
20713
20855
  const query = {};
20714
- if (normalizeOptionalText(args.timeMin)) {
20856
+ if (normalizeOptionalText$1(args.timeMin)) {
20715
20857
  query.timeMin = args.timeMin.trim();
20716
20858
  }
20717
- if (normalizeOptionalText(args.timeMax)) {
20859
+ if (normalizeOptionalText$1(args.timeMax)) {
20718
20860
  query.timeMax = args.timeMax.trim();
20719
20861
  }
20720
- if (normalizeOptionalText(args.query)) {
20862
+ if (normalizeOptionalText$1(args.query)) {
20721
20863
  query.q = args.query.trim();
20722
20864
  }
20723
20865
  if (typeof args.maxResults === 'number' && Number.isFinite(args.maxResults) && args.maxResults > 0) {
@@ -20729,7 +20871,7 @@ function createUseCalendarToolFunctions() {
20729
20871
  if (args.orderBy === 'startTime' || args.orderBy === 'updated') {
20730
20872
  query.orderBy = args.orderBy;
20731
20873
  }
20732
- if (normalizeOptionalText(args.timeZone)) {
20874
+ if (normalizeOptionalText$1(args.timeZone)) {
20733
20875
  query.timeZone = args.timeZone.trim();
20734
20876
  }
20735
20877
  const payload = await callGoogleCalendarApi(accessToken, {
@@ -20767,11 +20909,11 @@ function createUseCalendarToolFunctions() {
20767
20909
  return withUseCalendarRuntime(args, async ({ calendarReference, accessToken }) => {
20768
20910
  const requestBody = createGoogleCalendarEventPayload({
20769
20911
  summary: normalizeRequiredText(args.summary, 'summary'),
20770
- description: normalizeOptionalText(args.description),
20771
- location: normalizeOptionalText(args.location),
20912
+ description: normalizeOptionalText$1(args.description),
20913
+ location: normalizeOptionalText$1(args.location),
20772
20914
  start: normalizeRequiredText(args.start, 'start'),
20773
20915
  end: normalizeRequiredText(args.end, 'end'),
20774
- timeZone: normalizeOptionalText(args.timeZone),
20916
+ timeZone: normalizeOptionalText$1(args.timeZone),
20775
20917
  attendees: normalizeAttendees(args.attendees),
20776
20918
  reminderMinutes: normalizeReminderMinutes(args.reminderMinutes),
20777
20919
  });
@@ -20793,12 +20935,12 @@ function createUseCalendarToolFunctions() {
20793
20935
  return withUseCalendarRuntime(args, async ({ calendarReference, accessToken }) => {
20794
20936
  const eventId = normalizeRequiredText(args.eventId, 'eventId');
20795
20937
  const requestBody = createGoogleCalendarEventPayload({
20796
- summary: normalizeOptionalText(args.summary),
20797
- description: normalizeOptionalText(args.description),
20798
- location: normalizeOptionalText(args.location),
20799
- start: normalizeOptionalText(args.start),
20800
- end: normalizeOptionalText(args.end),
20801
- timeZone: normalizeOptionalText(args.timeZone),
20938
+ summary: normalizeOptionalText$1(args.summary),
20939
+ description: normalizeOptionalText$1(args.description),
20940
+ location: normalizeOptionalText$1(args.location),
20941
+ start: normalizeOptionalText$1(args.start),
20942
+ end: normalizeOptionalText$1(args.end),
20943
+ timeZone: normalizeOptionalText$1(args.timeZone),
20802
20944
  attendees: normalizeAttendees(args.attendees),
20803
20945
  reminderMinutes: normalizeReminderMinutes(args.reminderMinutes),
20804
20946
  });
@@ -20845,7 +20987,7 @@ function createUseCalendarToolFunctions() {
20845
20987
  path: `/calendars/${encodeGoogleCalendarId(calendarReference.calendarId)}/events/${encodeURIComponent(eventId)}`,
20846
20988
  });
20847
20989
  const existingAttendees = ((existingEvent === null || existingEvent === void 0 ? void 0 : existingEvent.attendees) || [])
20848
- .map((attendee) => normalizeOptionalText(attendee.email))
20990
+ .map((attendee) => normalizeOptionalText$1(attendee.email))
20849
20991
  .filter((email) => Boolean(email));
20850
20992
  const mergedAttendees = [...new Set([...existingAttendees, ...guests])];
20851
20993
  const payload = await callGoogleCalendarApi(accessToken, {
@@ -20893,7 +21035,7 @@ function encodeGoogleCalendarId(calendarId) {
20893
21035
  * @private function of createUseCalendarToolFunctions
20894
21036
  */
20895
21037
  function normalizeRequiredText(value, fieldName) {
20896
- const normalizedValue = normalizeOptionalText(value);
21038
+ const normalizedValue = normalizeOptionalText$1(value);
20897
21039
  if (!normalizedValue) {
20898
21040
  throw new Error(`Tool "${fieldName}" requires non-empty value.`);
20899
21041
  }
@@ -20904,7 +21046,7 @@ function normalizeRequiredText(value, fieldName) {
20904
21046
  *
20905
21047
  * @private function of createUseCalendarToolFunctions
20906
21048
  */
20907
- function normalizeOptionalText(value) {
21049
+ function normalizeOptionalText$1(value) {
20908
21050
  if (typeof value !== 'string') {
20909
21051
  return undefined;
20910
21052
  }
@@ -25571,6 +25713,580 @@ class UseUserLocationCommitmentDefinition extends BaseCommitmentDefinition {
25571
25713
  }
25572
25714
  // Note: [💞] Ignore a discrepancy between file name and entity name
25573
25715
 
25716
+ /**
25717
+ * Names of tools used by the WALLET commitment.
25718
+ *
25719
+ * @private constant of WalletCommitmentDefinition
25720
+ */
25721
+ const WalletToolNames = {
25722
+ retrieve: 'retrieve_wallet_records',
25723
+ store: 'store_wallet_record',
25724
+ update: 'update_wallet_record',
25725
+ delete: 'delete_wallet_record',
25726
+ request: 'request_wallet_record',
25727
+ };
25728
+
25729
+ /**
25730
+ * Creates WALLET system-message instructions.
25731
+ *
25732
+ * @private function of WalletCommitmentDefinition
25733
+ */
25734
+ function createWalletSystemMessage(extraInstructions) {
25735
+ return spaceTrim$1((block) => `
25736
+ Wallet:
25737
+ - Use "${WalletToolNames.retrieve}" before authenticated operations.
25738
+ - Use "${WalletToolNames.store}" and "${WalletToolNames.update}" to maintain credentials.
25739
+ - Use "${WalletToolNames.delete}" to remove invalid credentials.
25740
+ - Use "${WalletToolNames.request}" to request missing credentials via UI popup.
25741
+ - Scope records by user (\`isUserScoped\`) and/or by agent (\`isGlobal=false\`) as needed.
25742
+ - Never expose raw credentials in chat responses.
25743
+ ${block(extraInstructions)}
25744
+ `);
25745
+ }
25746
+
25747
+ /**
25748
+ * Resolves disabled message for wallet runtime context.
25749
+ *
25750
+ * @private function of WalletCommitmentDefinition
25751
+ */
25752
+ function resolveWalletDisabledMessage(runtimeContext) {
25753
+ if (runtimeContext.isPrivateMode) {
25754
+ return 'Wallet is disabled because private mode is active.';
25755
+ }
25756
+ if (runtimeContext.isTeamConversation) {
25757
+ return 'Wallet is disabled for TEAM conversations.';
25758
+ }
25759
+ if (!runtimeContext.enabled) {
25760
+ return 'Wallet is disabled for unauthenticated users.';
25761
+ }
25762
+ return null;
25763
+ }
25764
+ /**
25765
+ * Resolves runtime adapter for wallet tools or returns disabled payload when unavailable.
25766
+ *
25767
+ * @private function of WalletCommitmentDefinition
25768
+ */
25769
+ function getWalletToolRuntimeAdapterOrDisabledResult(action, runtimeContext) {
25770
+ const disabledMessage = resolveWalletDisabledMessage(runtimeContext);
25771
+ if (disabledMessage) {
25772
+ return {
25773
+ adapter: null,
25774
+ disabledResult: {
25775
+ action,
25776
+ status: 'disabled',
25777
+ records: action === 'retrieve' ? [] : undefined,
25778
+ message: disabledMessage,
25779
+ },
25780
+ };
25781
+ }
25782
+ {
25783
+ return {
25784
+ adapter: null,
25785
+ disabledResult: {
25786
+ action,
25787
+ status: 'disabled',
25788
+ records: action === 'retrieve' ? [] : undefined,
25789
+ message: 'Wallet runtime is not available in this environment.',
25790
+ },
25791
+ };
25792
+ }
25793
+ }
25794
+
25795
+ /**
25796
+ * Parses store/update wallet payload.
25797
+ *
25798
+ * @private function of WalletCommitmentDefinition
25799
+ */
25800
+ function parseWalletPayload(args) {
25801
+ const recordType = parseWalletRecordType(args.recordType);
25802
+ return {
25803
+ recordType,
25804
+ service: parseWalletService(args.service),
25805
+ key: parseWalletKey(args.key),
25806
+ isUserScoped: args.isUserScoped === true,
25807
+ isGlobal: args.isGlobal === true,
25808
+ ...parseWalletSecrets({
25809
+ recordType,
25810
+ username: args.username,
25811
+ password: args.password,
25812
+ secret: args.secret,
25813
+ cookies: args.cookies,
25814
+ }),
25815
+ };
25816
+ }
25817
+ /**
25818
+ * Parses text argument and returns trimmed text when available.
25819
+ *
25820
+ * @private function of WalletCommitmentDefinition
25821
+ */
25822
+ function normalizeOptionalText(value) {
25823
+ if (typeof value !== 'string') {
25824
+ return undefined;
25825
+ }
25826
+ const trimmed = value.trim();
25827
+ return trimmed || undefined;
25828
+ }
25829
+ /**
25830
+ * Parses wallet service argument.
25831
+ *
25832
+ * @private function of WalletCommitmentDefinition
25833
+ */
25834
+ function parseWalletService(value) {
25835
+ return (normalizeOptionalText(value) || 'generic').toLowerCase();
25836
+ }
25837
+ /**
25838
+ * Parses wallet key argument.
25839
+ *
25840
+ * @private function of WalletCommitmentDefinition
25841
+ */
25842
+ function parseWalletKey(value) {
25843
+ return normalizeOptionalText(value) || 'default';
25844
+ }
25845
+ /**
25846
+ * Parses one wallet record id argument.
25847
+ *
25848
+ * @private function of WalletCommitmentDefinition
25849
+ */
25850
+ function parseWalletId(value) {
25851
+ const walletId = normalizeOptionalText(value);
25852
+ if (!walletId) {
25853
+ throw new Error('Wallet id is required.');
25854
+ }
25855
+ return walletId;
25856
+ }
25857
+ /**
25858
+ * Parses wallet record type.
25859
+ *
25860
+ * @private function of WalletCommitmentDefinition
25861
+ */
25862
+ function parseWalletRecordType(value, fallback) {
25863
+ var _a;
25864
+ const normalizedType = (_a = normalizeOptionalText(value)) === null || _a === void 0 ? void 0 : _a.toUpperCase();
25865
+ if (normalizedType === 'USERNAME_PASSWORD') {
25866
+ return 'USERNAME_PASSWORD';
25867
+ }
25868
+ if (normalizedType === 'SESSION_COOKIE') {
25869
+ return 'SESSION_COOKIE';
25870
+ }
25871
+ if (normalizedType === 'ACCESS_TOKEN') {
25872
+ return 'ACCESS_TOKEN';
25873
+ }
25874
+ if (fallback) {
25875
+ return fallback;
25876
+ }
25877
+ throw new Error('Unsupported wallet recordType. Expected one of: USERNAME_PASSWORD, SESSION_COOKIE, ACCESS_TOKEN.');
25878
+ }
25879
+ /**
25880
+ * Parses wallet secret fields according to record type.
25881
+ *
25882
+ * @private function of WalletCommitmentDefinition
25883
+ */
25884
+ function parseWalletSecrets(args) {
25885
+ const username = normalizeOptionalText(args.username);
25886
+ const password = normalizeOptionalText(args.password);
25887
+ const secret = normalizeOptionalText(args.secret);
25888
+ const cookies = normalizeOptionalText(args.cookies);
25889
+ if (args.recordType === 'USERNAME_PASSWORD') {
25890
+ if (!username || !password) {
25891
+ throw new Error('Both username and password are required for USERNAME_PASSWORD.');
25892
+ }
25893
+ return { username, password };
25894
+ }
25895
+ if (args.recordType === 'SESSION_COOKIE') {
25896
+ if (!cookies) {
25897
+ throw new Error('Cookies are required for SESSION_COOKIE.');
25898
+ }
25899
+ return { cookies };
25900
+ }
25901
+ if (!secret) {
25902
+ throw new Error('Secret is required for ACCESS_TOKEN.');
25903
+ }
25904
+ return { secret };
25905
+ }
25906
+ /**
25907
+ * Collection of WALLET tool argument parsers.
25908
+ *
25909
+ * @private function of WalletCommitmentDefinition
25910
+ */
25911
+ const parseWalletToolArgs = {
25912
+ /**
25913
+ * Parses retrieve arguments.
25914
+ */
25915
+ retrieve(args) {
25916
+ const limit = typeof args.limit === 'number' && Number.isFinite(args.limit) ? Math.floor(args.limit) : undefined;
25917
+ return {
25918
+ query: normalizeOptionalText(args.query),
25919
+ recordType: normalizeOptionalText(args.recordType) ? parseWalletRecordType(args.recordType) : undefined,
25920
+ service: normalizeOptionalText(args.service) ? parseWalletService(args.service) : undefined,
25921
+ key: normalizeOptionalText(args.key) ? parseWalletKey(args.key) : undefined,
25922
+ limit: limit && limit > 0 ? Math.min(limit, 20) : undefined,
25923
+ };
25924
+ },
25925
+ /**
25926
+ * Parses store payload.
25927
+ */
25928
+ store(args) {
25929
+ return parseWalletPayload(args);
25930
+ },
25931
+ /**
25932
+ * Parses update payload.
25933
+ */
25934
+ update(args) {
25935
+ const walletId = parseWalletId(args.walletId);
25936
+ const record = parseWalletPayload(args);
25937
+ return {
25938
+ ...record,
25939
+ walletId,
25940
+ };
25941
+ },
25942
+ /**
25943
+ * Parses delete payload.
25944
+ */
25945
+ delete(args) {
25946
+ return { walletId: parseWalletId(args.walletId) };
25947
+ },
25948
+ /**
25949
+ * Parses request payload for user wallet input prompt.
25950
+ */
25951
+ request(args) {
25952
+ return {
25953
+ recordType: parseWalletRecordType(args.recordType, 'ACCESS_TOKEN'),
25954
+ service: parseWalletService(args.service),
25955
+ key: parseWalletKey(args.key),
25956
+ message: normalizeOptionalText(args.message),
25957
+ isUserScoped: args.isUserScoped === true,
25958
+ isGlobal: args.isGlobal === true,
25959
+ };
25960
+ },
25961
+ };
25962
+
25963
+ /**
25964
+ * Resolves runtime context from hidden tool arguments.
25965
+ *
25966
+ * @private function of WalletCommitmentDefinition
25967
+ */
25968
+ function resolveWalletRuntimeContext(args) {
25969
+ const runtimeContext = readToolRuntimeContextFromToolArgs(args);
25970
+ const memoryContext = runtimeContext === null || runtimeContext === void 0 ? void 0 : runtimeContext.memory;
25971
+ return {
25972
+ enabled: (memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.enabled) === true,
25973
+ userId: memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.userId,
25974
+ username: memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.username,
25975
+ agentId: memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.agentId,
25976
+ agentName: memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.agentName,
25977
+ isTeamConversation: (memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.isTeamConversation) === true,
25978
+ isPrivateMode: (memoryContext === null || memoryContext === void 0 ? void 0 : memoryContext.isPrivateMode) === true,
25979
+ };
25980
+ }
25981
+
25982
+ /**
25983
+ * Creates runtime wallet tool function implementations.
25984
+ *
25985
+ * @private function of WalletCommitmentDefinition
25986
+ */
25987
+ function createWalletToolFunctions() {
25988
+ return {
25989
+ async [WalletToolNames.retrieve](args) {
25990
+ const runtimeContext = resolveWalletRuntimeContext(args);
25991
+ const { adapter, disabledResult } = getWalletToolRuntimeAdapterOrDisabledResult('retrieve', runtimeContext);
25992
+ if (!adapter || disabledResult) {
25993
+ return JSON.stringify(disabledResult);
25994
+ }
25995
+ try {
25996
+ const parsedArgs = parseWalletToolArgs.retrieve(args);
25997
+ const records = await adapter.retrieveWalletRecords(parsedArgs, runtimeContext);
25998
+ return JSON.stringify({
25999
+ action: 'retrieve',
26000
+ status: 'ok',
26001
+ query: parsedArgs.query,
26002
+ records,
26003
+ });
26004
+ }
26005
+ catch (error) {
26006
+ return JSON.stringify({
26007
+ action: 'retrieve',
26008
+ status: 'error',
26009
+ records: [],
26010
+ message: error instanceof Error ? error.message : String(error),
26011
+ });
26012
+ }
26013
+ },
26014
+ async [WalletToolNames.store](args) {
26015
+ const runtimeContext = resolveWalletRuntimeContext(args);
26016
+ const { adapter, disabledResult } = getWalletToolRuntimeAdapterOrDisabledResult('store', runtimeContext);
26017
+ if (!adapter || disabledResult) {
26018
+ return JSON.stringify(disabledResult);
26019
+ }
26020
+ try {
26021
+ const parsedArgs = parseWalletToolArgs.store(args);
26022
+ const record = await adapter.storeWalletRecord(parsedArgs, runtimeContext);
26023
+ return JSON.stringify({
26024
+ action: 'store',
26025
+ status: 'stored',
26026
+ record,
26027
+ });
26028
+ }
26029
+ catch (error) {
26030
+ return JSON.stringify({
26031
+ action: 'store',
26032
+ status: 'error',
26033
+ message: error instanceof Error ? error.message : String(error),
26034
+ });
26035
+ }
26036
+ },
26037
+ async [WalletToolNames.update](args) {
26038
+ const runtimeContext = resolveWalletRuntimeContext(args);
26039
+ const { adapter, disabledResult } = getWalletToolRuntimeAdapterOrDisabledResult('update', runtimeContext);
26040
+ if (!adapter || disabledResult) {
26041
+ return JSON.stringify(disabledResult);
26042
+ }
26043
+ try {
26044
+ const parsedArgs = parseWalletToolArgs.update(args);
26045
+ const record = await adapter.updateWalletRecord(parsedArgs, runtimeContext);
26046
+ return JSON.stringify({
26047
+ action: 'update',
26048
+ status: 'updated',
26049
+ record,
26050
+ });
26051
+ }
26052
+ catch (error) {
26053
+ return JSON.stringify({
26054
+ action: 'update',
26055
+ status: 'error',
26056
+ message: error instanceof Error ? error.message : String(error),
26057
+ });
26058
+ }
26059
+ },
26060
+ async [WalletToolNames.delete](args) {
26061
+ const runtimeContext = resolveWalletRuntimeContext(args);
26062
+ const { adapter, disabledResult } = getWalletToolRuntimeAdapterOrDisabledResult('delete', runtimeContext);
26063
+ if (!adapter || disabledResult) {
26064
+ return JSON.stringify(disabledResult);
26065
+ }
26066
+ try {
26067
+ const parsedArgs = parseWalletToolArgs.delete(args);
26068
+ const deleted = await adapter.deleteWalletRecord(parsedArgs, runtimeContext);
26069
+ return JSON.stringify({
26070
+ action: 'delete',
26071
+ status: 'deleted',
26072
+ walletId: deleted.id,
26073
+ });
26074
+ }
26075
+ catch (error) {
26076
+ return JSON.stringify({
26077
+ action: 'delete',
26078
+ status: 'error',
26079
+ message: error instanceof Error ? error.message : String(error),
26080
+ });
26081
+ }
26082
+ },
26083
+ async [WalletToolNames.request](args) {
26084
+ const runtimeContext = resolveWalletRuntimeContext(args);
26085
+ const disabledMessage = resolveWalletDisabledMessage(runtimeContext);
26086
+ if (disabledMessage) {
26087
+ return JSON.stringify({
26088
+ action: 'request',
26089
+ status: 'disabled',
26090
+ message: disabledMessage,
26091
+ });
26092
+ }
26093
+ const request = parseWalletToolArgs.request(args);
26094
+ return JSON.stringify({
26095
+ action: 'request',
26096
+ status: 'requested',
26097
+ request,
26098
+ message: request.message ||
26099
+ `Request user to provide ${request.recordType} credentials for service "${request.service}".`,
26100
+ });
26101
+ },
26102
+ };
26103
+ }
26104
+
26105
+ /**
26106
+ * Creates tool definitions required by WALLET commitment.
26107
+ *
26108
+ * @private function of WalletCommitmentDefinition
26109
+ */
26110
+ function createWalletTools(existingTools) {
26111
+ const tools = [...(existingTools || [])];
26112
+ addWalletToolIfMissing(tools, {
26113
+ name: WalletToolNames.retrieve,
26114
+ description: 'Retrieve wallet records relevant to the current task.',
26115
+ parameters: {
26116
+ type: 'object',
26117
+ properties: {
26118
+ query: { type: 'string', description: 'Optional text query used to filter wallet records.' },
26119
+ recordType: {
26120
+ type: 'string',
26121
+ description: 'Optional record type filter (USERNAME_PASSWORD, SESSION_COOKIE, ACCESS_TOKEN).',
26122
+ },
26123
+ service: { type: 'string', description: 'Optional service filter, for example github.' },
26124
+ key: { type: 'string', description: 'Optional wallet key filter.' },
26125
+ limit: { type: 'integer', description: 'Optional maximum number of records (default 5, max 20).' },
26126
+ },
26127
+ required: [],
26128
+ },
26129
+ });
26130
+ addWalletToolIfMissing(tools, {
26131
+ name: WalletToolNames.store,
26132
+ description: 'Store one wallet record.',
26133
+ parameters: {
26134
+ type: 'object',
26135
+ properties: {
26136
+ recordType: {
26137
+ type: 'string',
26138
+ description: 'Record type: USERNAME_PASSWORD, SESSION_COOKIE, ACCESS_TOKEN.',
26139
+ },
26140
+ service: { type: 'string', description: 'Service identifier, for example github.' },
26141
+ key: { type: 'string', description: 'Logical credential key.' },
26142
+ username: { type: 'string', description: 'Username for USERNAME_PASSWORD.' },
26143
+ password: { type: 'string', description: 'Password for USERNAME_PASSWORD.' },
26144
+ secret: { type: 'string', description: 'Token/API key for ACCESS_TOKEN.' },
26145
+ cookies: { type: 'string', description: 'Cookie header/json for SESSION_COOKIE.' },
26146
+ isUserScoped: { type: 'boolean', description: 'Set true to scope this record to current user.' },
26147
+ isGlobal: { type: 'boolean', description: 'Set true to make this record global.' },
26148
+ },
26149
+ required: ['recordType', 'service'],
26150
+ },
26151
+ });
26152
+ addWalletToolIfMissing(tools, {
26153
+ name: WalletToolNames.update,
26154
+ description: 'Update one existing wallet record.',
26155
+ parameters: {
26156
+ type: 'object',
26157
+ properties: {
26158
+ walletId: { type: 'string', description: 'Wallet record id to update.' },
26159
+ recordType: {
26160
+ type: 'string',
26161
+ description: 'Record type: USERNAME_PASSWORD, SESSION_COOKIE, ACCESS_TOKEN.',
26162
+ },
26163
+ service: { type: 'string', description: 'Service identifier, for example github.' },
26164
+ key: { type: 'string', description: 'Logical credential key.' },
26165
+ username: { type: 'string', description: 'Username for USERNAME_PASSWORD.' },
26166
+ password: { type: 'string', description: 'Password for USERNAME_PASSWORD.' },
26167
+ secret: { type: 'string', description: 'Token/API key for ACCESS_TOKEN.' },
26168
+ cookies: { type: 'string', description: 'Cookie header/json for SESSION_COOKIE.' },
26169
+ isUserScoped: { type: 'boolean', description: 'Set true to scope this record to current user.' },
26170
+ isGlobal: { type: 'boolean', description: 'Set true to make this record global.' },
26171
+ },
26172
+ required: ['walletId', 'recordType', 'service'],
26173
+ },
26174
+ });
26175
+ addWalletToolIfMissing(tools, {
26176
+ name: WalletToolNames.delete,
26177
+ description: 'Delete one wallet record.',
26178
+ parameters: {
26179
+ type: 'object',
26180
+ properties: {
26181
+ walletId: { type: 'string', description: 'Wallet record id to delete.' },
26182
+ },
26183
+ required: ['walletId'],
26184
+ },
26185
+ });
26186
+ addWalletToolIfMissing(tools, {
26187
+ name: WalletToolNames.request,
26188
+ description: 'Request missing credential from user via popup.',
26189
+ parameters: {
26190
+ type: 'object',
26191
+ properties: {
26192
+ recordType: {
26193
+ type: 'string',
26194
+ description: 'Requested record type: USERNAME_PASSWORD, SESSION_COOKIE, ACCESS_TOKEN.',
26195
+ },
26196
+ service: { type: 'string', description: 'Service identifier.' },
26197
+ key: { type: 'string', description: 'Logical credential key.' },
26198
+ message: { type: 'string', description: 'Optional UI message for user.' },
26199
+ isUserScoped: {
26200
+ type: 'boolean',
26201
+ description: 'Set true when record should be scoped to current user.',
26202
+ },
26203
+ isGlobal: { type: 'boolean', description: 'Set true when record should be global.' },
26204
+ },
26205
+ required: [],
26206
+ },
26207
+ });
26208
+ return tools;
26209
+ }
26210
+ /**
26211
+ * Registers one wallet tool when missing in current tool list.
26212
+ *
26213
+ * @private function of WalletCommitmentDefinition
26214
+ */
26215
+ function addWalletToolIfMissing(tools, tool) {
26216
+ if (!tools.some((existingTool) => existingTool.name === tool.name)) {
26217
+ tools.push(tool);
26218
+ }
26219
+ }
26220
+
26221
+ /**
26222
+ * Gets markdown documentation for WALLET commitment.
26223
+ *
26224
+ * @private function of WalletCommitmentDefinition
26225
+ */
26226
+ function getWalletCommitmentDocumentation(type) {
26227
+ return spaceTrim$1(`
26228
+ # ${type}
26229
+
26230
+ Enables private credential storage for tokens, usernames/passwords, and session cookies.
26231
+ `);
26232
+ }
26233
+
26234
+ /**
26235
+ * Gets human-readable titles for WALLET tool functions.
26236
+ *
26237
+ * @private function of WalletCommitmentDefinition
26238
+ */
26239
+ function getWalletToolTitles() {
26240
+ return {
26241
+ [WalletToolNames.retrieve]: 'Wallet',
26242
+ [WalletToolNames.store]: 'Store wallet record',
26243
+ [WalletToolNames.update]: 'Update wallet record',
26244
+ [WalletToolNames.delete]: 'Delete wallet record',
26245
+ [WalletToolNames.request]: 'Request wallet record',
26246
+ };
26247
+ }
26248
+
26249
+ /**
26250
+ * WALLET commitment definition.
26251
+ *
26252
+ * @private [🪔] Maybe export the commitments through some package
26253
+ */
26254
+ class WalletCommitmentDefinition extends BaseCommitmentDefinition {
26255
+ constructor(type = 'WALLET') {
26256
+ super(type);
26257
+ }
26258
+ get requiresContent() {
26259
+ return false;
26260
+ }
26261
+ get description() {
26262
+ return 'Enable persistent private credential storage (tokens, logins, cookies) scoped per agent or globally.';
26263
+ }
26264
+ get icon() {
26265
+ return '👛';
26266
+ }
26267
+ get documentation() {
26268
+ return getWalletCommitmentDocumentation(this.type);
26269
+ }
26270
+ applyToAgentModelRequirements(requirements, content) {
26271
+ const extraInstructions = formatOptionalInstructionBlock('Wallet instructions', content);
26272
+ return this.appendToSystemMessage({
26273
+ ...requirements,
26274
+ tools: createWalletTools(requirements.tools),
26275
+ _metadata: {
26276
+ ...requirements._metadata,
26277
+ useWallet: content || true,
26278
+ },
26279
+ }, createWalletSystemMessage(extraInstructions));
26280
+ }
26281
+ getToolTitles() {
26282
+ return getWalletToolTitles();
26283
+ }
26284
+ getToolFunctions() {
26285
+ return createWalletToolFunctions();
26286
+ }
26287
+ }
26288
+ // Note: [💞] Ignore a discrepancy between file name and entity name
26289
+
25574
26290
  /**
25575
26291
  * `WRITING RULES` commitment definition.
25576
26292
  *
@@ -25845,6 +26561,8 @@ const COMMITMENT_REGISTRY = [
25845
26561
  new MessageSuffixCommitmentDefinition(),
25846
26562
  new MessageCommitmentDefinition('MESSAGE'),
25847
26563
  new MessageCommitmentDefinition('MESSAGES'),
26564
+ new WalletCommitmentDefinition('WALLET'),
26565
+ new WalletCommitmentDefinition('WALLETS'),
25848
26566
  new ScenarioCommitmentDefinition('SCENARIO'),
25849
26567
  new ScenarioCommitmentDefinition('SCENARIOS'),
25850
26568
  new DeleteCommitmentDefinition('DELETE'),
@@ -25891,11 +26609,11 @@ const COMMITMENT_REGISTRY = [
25891
26609
  */
25892
26610
  const IMPORTANT_COMMITMENT_TYPE_SORT_ORDER = new Map([
25893
26611
  ['GOAL', 0],
25894
- ['GOALS', 1],
25895
- ['RULE', 2],
25896
- ['RULES', 3],
25897
- ['KNOWLEDGE', 4],
25898
- ['TEAM', 5],
26612
+ ['RULE', 1],
26613
+ ['KNOWLEDGE', 2],
26614
+ ['TEAM', 3],
26615
+ ['GOALS', 4],
26616
+ ['RULES', 5],
25899
26617
  ]);
25900
26618
  /**
25901
26619
  * Sort rank used when unfinished, low-level, and deprecated commitments should be grouped last.
@@ -28985,7 +29703,6 @@ function createInheritanceCapability(content) {
28985
29703
  if (isVoidPseudoAgentReference(reference)) {
28986
29704
  label = VOID_PSEUDO_AGENT_REFERENCE; // <- {Void} label
28987
29705
  iconName = 'ShieldAlert';
28988
- return null; // <- Note: Do not show `{Void}` in capabilities, it's only used for internal logic
28989
29706
  }
28990
29707
  return {
28991
29708
  type: 'inheritance',
@@ -29851,6 +30568,12 @@ const OVERWRITTEN_COMMITMENT_GROUP_BY_TYPE = new Map([
29851
30568
  ['GOAL', 'GOAL'],
29852
30569
  ['GOALS', 'GOAL'],
29853
30570
  ]);
30571
+ /**
30572
+ * Legacy commitments that should be parsed for compatibility but ignored by the model-requirements pipeline.
30573
+ *
30574
+ * @private internal constant of `filterCommitmentsForAgentModelRequirements`
30575
+ */
30576
+ const IGNORED_COMMITMENT_TYPES = new Set(['WALLET', 'WALLETS']);
29854
30577
  /**
29855
30578
  * Applies the commitment filtering rules used before commitment definitions are executed.
29856
30579
  *
@@ -29899,6 +30622,9 @@ function filterOverwrittenCommitments(commitments) {
29899
30622
  function filterDeletedCommitments(commitments) {
29900
30623
  const filteredCommitments = [];
29901
30624
  for (const commitment of commitments) {
30625
+ if (isIgnoredCommitmentType(commitment.type)) {
30626
+ continue;
30627
+ }
29902
30628
  if (!isDeleteCommitmentType(commitment.type)) {
29903
30629
  filteredCommitments.push(commitment);
29904
30630
  continue;
@@ -29929,6 +30655,17 @@ function filterDeletedCommitments(commitments) {
29929
30655
  function isDeleteCommitmentType(commitmentType) {
29930
30656
  return DELETE_COMMITMENT_TYPES.has(commitmentType);
29931
30657
  }
30658
+ /**
30659
+ * Checks whether a parsed commitment is intentionally ignored by the current model compiler.
30660
+ *
30661
+ * @param commitmentType - Commitment type to check.
30662
+ * @returns `true` when the commitment should not affect model requirements.
30663
+ *
30664
+ * @private internal utility of `filterDeletedCommitments`
30665
+ */
30666
+ function isIgnoredCommitmentType(commitmentType) {
30667
+ return IGNORED_COMMITMENT_TYPES.has(commitmentType);
30668
+ }
29932
30669
  /**
29933
30670
  * Extracts normalized parameter names used for DELETE-like invalidation matching.
29934
30671
  *
@@ -34337,8 +35074,8 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
34337
35074
  * Prepares an AgentKit agent with optional knowledge sources and tool definitions.
34338
35075
  */
34339
35076
  async prepareAgentKitAgent(options) {
34340
- var _a, _b, _c;
34341
- const { name, instructions, knowledgeSources, tools, nativeAgentKitTools, vectorStoreId: cachedVectorStoreId, storeAsPrepared, } = options;
35077
+ var _a, _b;
35078
+ const { name, instructions, knowledgeSources, tools, vectorStoreId: cachedVectorStoreId, storeAsPrepared, } = options;
34342
35079
  await this.ensureAgentKitDefaults();
34343
35080
  if (this.options.isVerbose) {
34344
35081
  console.info('[🤰]', 'Preparing OpenAI AgentKit agent', {
@@ -34346,11 +35083,10 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
34346
35083
  instructionsLength: instructions.length,
34347
35084
  knowledgeSourcesCount: (_a = knowledgeSources === null || knowledgeSources === void 0 ? void 0 : knowledgeSources.length) !== null && _a !== void 0 ? _a : 0,
34348
35085
  toolsCount: (_b = tools === null || tools === void 0 ? void 0 : tools.length) !== null && _b !== void 0 ? _b : 0,
34349
- nativeAgentKitToolsCount: (_c = nativeAgentKitTools === null || nativeAgentKitTools === void 0 ? void 0 : nativeAgentKitTools.length) !== null && _c !== void 0 ? _c : 0,
34350
35086
  });
34351
35087
  }
34352
35088
  let vectorStoreId = cachedVectorStoreId;
34353
- if (!vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
35089
+ if (this.isNativeKnowledgeSearchEnabled && !vectorStoreId && knowledgeSources && knowledgeSources.length > 0) {
34354
35090
  const vectorStoreResult = await this.createVectorStoreWithKnowledgeSources({
34355
35091
  client: await this.getClient(),
34356
35092
  name,
@@ -34359,13 +35095,19 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
34359
35095
  });
34360
35096
  vectorStoreId = vectorStoreResult.vectorStoreId;
34361
35097
  }
34362
- else if (vectorStoreId && this.options.isVerbose) {
35098
+ else if (this.isNativeKnowledgeSearchEnabled && vectorStoreId && this.options.isVerbose) {
34363
35099
  console.info('[🤰]', 'Using cached vector store for AgentKit agent', {
34364
35100
  name,
34365
35101
  vectorStoreId,
34366
35102
  });
34367
35103
  }
34368
- const agentKitTools = this.buildAgentKitTools({ tools, nativeAgentKitTools, vectorStoreId });
35104
+ if (!this.isNativeKnowledgeSearchEnabled) {
35105
+ vectorStoreId = undefined;
35106
+ }
35107
+ const agentKitTools = this.buildAgentKitTools({
35108
+ tools,
35109
+ vectorStoreId,
35110
+ });
34369
35111
  const openAiAgentKitAgent = new Agent$1({
34370
35112
  name,
34371
35113
  model: this.agentKitModelName,
@@ -34384,7 +35126,7 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
34384
35126
  name,
34385
35127
  model: this.agentKitModelName,
34386
35128
  toolCount: agentKitTools.length,
34387
- hasVectorStore: Boolean(vectorStoreId),
35129
+ hasVectorStore: this.isNativeKnowledgeSearchEnabled && Boolean(vectorStoreId),
34388
35130
  });
34389
35131
  }
34390
35132
  return preparedAgent;
@@ -34404,14 +35146,11 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
34404
35146
  * Builds the tool list for AgentKit, including hosted file search when applicable.
34405
35147
  */
34406
35148
  buildAgentKitTools(options) {
34407
- const { tools, nativeAgentKitTools, vectorStoreId } = options;
35149
+ const { tools, vectorStoreId } = options;
34408
35150
  const agentKitTools = [];
34409
35151
  if (vectorStoreId) {
34410
35152
  agentKitTools.push(fileSearchTool(vectorStoreId));
34411
35153
  }
34412
- if (nativeAgentKitTools && nativeAgentKitTools.length > 0) {
34413
- agentKitTools.push(...nativeAgentKitTools);
34414
- }
34415
35154
  if (tools && tools.length > 0) {
34416
35155
  let scriptTools = null;
34417
35156
  for (const toolDefinition of tools) {
@@ -34886,6 +35625,12 @@ class OpenAiAgentKitExecutionTools extends OpenAiVectorStoreHandler {
34886
35625
  get agentKitOptions() {
34887
35626
  return this.options;
34888
35627
  }
35628
+ /**
35629
+ * Returns true when hosted OpenAI vector-store search should back `knowledgeSources`.
35630
+ */
35631
+ get isNativeKnowledgeSearchEnabled() {
35632
+ return this.agentKitOptions.isNativeKnowledgeSearchEnabled !== false;
35633
+ }
34889
35634
  /**
34890
35635
  * Discriminant for type guards.
34891
35636
  */