@promptbook/core 0.114.0-13 → 0.114.0-18

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 (47) hide show
  1. package/esm/index.es.js +64 -8
  2. package/esm/index.es.js.map +1 -1
  3. package/esm/src/book-3.0/AgentMessageRunReport.d.ts +18 -0
  4. package/esm/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +38 -5
  5. package/esm/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  6. package/esm/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  7. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  8. package/esm/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  9. package/esm/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  10. package/esm/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  11. package/esm/src/book-components/Chat/utils/agentProjectToolCall.d.ts +39 -0
  12. package/esm/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  13. package/esm/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  14. package/esm/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +6 -0
  15. package/esm/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  16. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  17. package/esm/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  18. package/esm/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  19. package/esm/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +3 -0
  20. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  21. package/esm/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  22. package/esm/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  23. package/esm/src/version.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/umd/index.umd.js +64 -8
  26. package/umd/index.umd.js.map +1 -1
  27. package/umd/src/book-3.0/AgentMessageRunReport.d.ts +18 -0
  28. package/umd/src/book-3.0/AgentPlannedMessagesSidecar.d.ts +38 -5
  29. package/umd/src/book-3.0/describeAgentPlannedMessageSchedule.d.ts +31 -0
  30. package/umd/src/book-components/BookEditor/createDeprecatedCommitmentDiagnostics.browser.d.ts +1 -9
  31. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.d.ts +28 -0
  32. package/umd/src/book-components/BookEditor/createDuplicateFromCommitmentDiagnostics.test.d.ts +1 -0
  33. package/umd/src/book-components/Chat/Chat/renderAgentProjectDiff.d.ts +13 -0
  34. package/umd/src/book-components/Chat/Chat/renderAgentProjectToolCallDetails.d.ts +16 -0
  35. package/umd/src/book-components/Chat/utils/agentProjectToolCall.d.ts +39 -0
  36. package/umd/src/book-components/Chat/utils/agentProjectToolCall.test.d.ts +1 -0
  37. package/umd/src/book-components/Chat/utils/externalSourceToolCall.d.ts +38 -0
  38. package/umd/src/book-components/Chat/utils/timeoutToolCallPresentation.d.ts +6 -0
  39. package/umd/src/cli/cli-commands/coder/waitOptions.d.ts +12 -0
  40. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +15 -0
  41. package/umd/src/utils/agent-message-runtime/AgentMessageProjectChange.d.ts +76 -0
  42. package/umd/src/utils/agent-message-runtime/AgentMessageTouchedExternalSource.d.ts +45 -0
  43. package/umd/src/utils/agent-message-runtime/parseAgentMessageRuntimeLogEvents.d.ts +3 -0
  44. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.d.ts +18 -0
  45. package/umd/src/utils/agent-message-runtime/resolveAgentMessageTouchedExternalSources.test.d.ts +1 -0
  46. package/umd/src/utils/random/$generateBookBoilerplate.test.d.ts +1 -0
  47. package/umd/src/version.d.ts +1 -1
package/esm/index.es.js CHANGED
@@ -26,7 +26,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
26
26
  * @generated
27
27
  * @see https://github.com/webgptorg/promptbook
28
28
  */
29
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-13';
29
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-18';
30
30
  /**
31
31
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
32
32
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -9896,6 +9896,12 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
9896
9896
 
9897
9897
  Inherits agent source from another agent.
9898
9898
 
9899
+ Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
9900
+ is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
9901
+
9902
+ An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
9903
+ overrides every earlier one.
9904
+
9899
9905
  ## Examples
9900
9906
 
9901
9907
  \`\`\`book
@@ -9904,6 +9910,13 @@ class FromCommitmentDefinition extends BaseCommitmentDefinition {
9904
9910
  FROM https://s6.ptbk.io/benjamin-white
9905
9911
  RULE Speak only in English.
9906
9912
  \`\`\`
9913
+
9914
+ \`\`\`book
9915
+ My Standalone Agent
9916
+
9917
+ FROM @Null
9918
+ RULE Speak only in English.
9919
+ \`\`\`
9907
9920
  `);
9908
9921
  }
9909
9922
  applyToAgentModelRequirements(requirements, content) {
@@ -26082,7 +26095,7 @@ function validateBook(source) {
26082
26095
  const DEFAULT_BOOK = padBook(validateBook(spaceTrim$1(`
26083
26096
  AI Avatar
26084
26097
 
26085
- PERSONA A friendly AI assistant that helps you with your tasks
26098
+ GOAL Help users with their tasks as a friendly AI assistant.
26086
26099
  `)));
26087
26100
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
26088
26101
  // <- TODO: [🐱‍🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
@@ -26573,7 +26586,12 @@ const czechBookLanguageManualDictionary = {
26573
26586
  \`FROM\` odkazuje na zdroj rodičovského agenta. Při vyhodnocení dědičnosti platí:
26574
26587
 
26575
26588
  - Obsah rodiče se sloučí do výsledného zdroje.
26576
- - \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26589
+ - Když \`FROM\` není uvedeno vůbec, platí to samé jako \`FROM @Adam\`, tedy jádrový agent, ze kterého dědí každý agent.
26590
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26591
+ - Výslovně zvolený rodič nahradí implicitního Adama; vlastní řetězec \`FROM\` tohoto rodiče se pak zdědí běžným způsobem.
26592
+ - \`@Jmeno\` je pro jednoslovné jméno agenta zkratka zápisu \`{Jmeno}\`.
26593
+ - Když je \`FROM\` uvedeno vícekrát, platí poslední a přepíše všechna předchozí.
26594
+ - Adam je kořenový agent a musí výslovně použít \`FROM @Null\` (\`@Void\` je ekvivalentní). Editor knihy upozorní na jiného Adamova rodiče i na lokální cykly dědičnosti.
26577
26595
  - Chybějící odkazy se do výsledného zdroje propíší jako poznámky.
26578
26596
  `),
26579
26597
  },
@@ -26871,7 +26889,12 @@ const englishBookLanguageManualDictionary = {
26871
26889
  \`FROM\` points to a parent agent source. During inheritance resolution:
26872
26890
 
26873
26891
  - Parent corpus is merged into effective source.
26874
- - \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
26892
+ - Writing no \`FROM\` at all is the same as writing \`FROM @Adam\`, the core agent every agent inherits from.
26893
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
26894
+ - An explicit parent replaces the implicit Adam parent; the selected parent's own \`FROM\` chain is then inherited normally.
26895
+ - \`@Name\` is shorthand for \`{Name}\` when the agent name is one word.
26896
+ - When \`FROM\` is written more than once, the last one wins and overrides every earlier one.
26897
+ - Adam is the root agent and must explicitly use \`FROM @Null\` (\`@Void\` is equivalent). The Book editor warns about a different Adam parent and local inheritance cycles.
26875
26898
  - Missing references are surfaced as notes in resolved source.
26876
26899
  `),
26877
26900
  },
@@ -28464,16 +28487,49 @@ class AgentCollectionInSupabase /* TODO: [🌈][🐱‍🚀] implements AgentCol
28464
28487
  }
28465
28488
  /**
28466
28489
  * Retrieves the permanent ID of an agent by its name or permanent ID.
28490
+ *
28491
+ * An agent that still exists always wins over a soft-deleted one, so a name that was deleted and
28492
+ * later created again resolves to the agent that is live now instead of to the recycle-bin leftover.
28493
+ * Soft-deleted agents stay resolvable as a fallback because the recycle bin restores them by name
28494
+ * or permanent id.
28467
28495
  */
28468
28496
  async getAgentPermanentId(agentNameOrPermanentId) {
28469
- const selectResult = await this.supabaseClient
28497
+ const activeAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28498
+ isDeletedAgentIncluded: false,
28499
+ });
28500
+ if (activeAgentPermanentId !== null) {
28501
+ return activeAgentPermanentId;
28502
+ }
28503
+ const deletedAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28504
+ isDeletedAgentIncluded: true,
28505
+ });
28506
+ if (deletedAgentPermanentId !== null) {
28507
+ return deletedAgentPermanentId;
28508
+ }
28509
+ throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28510
+ }
28511
+ /**
28512
+ * Looks up the permanent id of the oldest agent matching one name or permanent id.
28513
+ *
28514
+ * @param agentNameOrPermanentId - Agent name or stable permanent identifier to match.
28515
+ * @param options - Whether soft-deleted agents may be matched as well.
28516
+ * @returns Permanent id of the matched agent, or `null` when nothing matches.
28517
+ *
28518
+ * @private internal helper of `AgentCollectionInSupabase`
28519
+ */
28520
+ async findAgentPermanentId(agentNameOrPermanentId, options) {
28521
+ const selectQuery = this.supabaseClient
28470
28522
  .from(this.getTableName('Agent'))
28471
28523
  .select('permanentId')
28472
- .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId))
28524
+ .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId));
28525
+ if (!options.isDeletedAgentIncluded) {
28526
+ selectQuery.is('deletedAt', null);
28527
+ }
28528
+ const selectResult = await selectQuery
28473
28529
  .order('createdAt', { ascending: true }) // Pick oldest if multiple match by name
28474
28530
  .limit(1);
28475
28531
  if (selectResult.error || !selectResult.data || selectResult.data.length === 0) {
28476
- throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28532
+ return null;
28477
28533
  }
28478
28534
  return selectResult.data[0].permanentId;
28479
28535
  }
@@ -48886,7 +48942,7 @@ function $generateBookBoilerplate(options) {
48886
48942
  ${agentName}
48887
48943
 
48888
48944
 
48889
- PERSONA ${block(personaDescription)}
48945
+ GOAL ${block(personaDescription)}
48890
48946
  ${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
48891
48947
  CLOSED
48892
48948
  `));