@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/umd/index.umd.js CHANGED
@@ -28,7 +28,7 @@
28
28
  * @generated
29
29
  * @see https://github.com/webgptorg/promptbook
30
30
  */
31
- const PROMPTBOOK_ENGINE_VERSION = '0.114.0-13';
31
+ const PROMPTBOOK_ENGINE_VERSION = '0.114.0-18';
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
@@ -9898,6 +9898,12 @@
9898
9898
 
9899
9899
  Inherits agent source from another agent.
9900
9900
 
9901
+ Every agent inherits from the core agent \`@Adam\` unless it says otherwise, so writing no ${this.type} at all
9902
+ is the same as writing \`${this.type} @Adam\`. Write \`${this.type} @Null\` to inherit from nothing.
9903
+
9904
+ An agent has exactly one parent, so when ${this.type} is written more than once, the last one wins and
9905
+ overrides every earlier one.
9906
+
9901
9907
  ## Examples
9902
9908
 
9903
9909
  \`\`\`book
@@ -9906,6 +9912,13 @@
9906
9912
  FROM https://s6.ptbk.io/benjamin-white
9907
9913
  RULE Speak only in English.
9908
9914
  \`\`\`
9915
+
9916
+ \`\`\`book
9917
+ My Standalone Agent
9918
+
9919
+ FROM @Null
9920
+ RULE Speak only in English.
9921
+ \`\`\`
9909
9922
  `);
9910
9923
  }
9911
9924
  applyToAgentModelRequirements(requirements, content) {
@@ -26084,7 +26097,7 @@
26084
26097
  const DEFAULT_BOOK = padBook(validateBook(spacetrim.spaceTrim(`
26085
26098
  AI Avatar
26086
26099
 
26087
- PERSONA A friendly AI assistant that helps you with your tasks
26100
+ GOAL Help users with their tasks as a friendly AI assistant.
26088
26101
  `)));
26089
26102
  // <- Note: Not using book`...` notation to avoid strange error in jest unit tests `TypeError: (0 , book_notation_1.book) is not a function`
26090
26103
  // <- TODO: [🐱‍🚀] `GENESIS_BOOK` / `ADAM_BOOK` in `/agents/adam.book`
@@ -26575,7 +26588,12 @@
26575
26588
  \`FROM\` odkazuje na zdroj rodičovského agenta. Při vyhodnocení dědičnosti platí:
26576
26589
 
26577
26590
  - Obsah rodiče se sloučí do výsledného zdroje.
26578
- - \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26591
+ - Když \`FROM\` není uvedeno vůbec, platí to samé jako \`FROM @Adam\`, tedy jádrový agent, ze kterého dědí každý agent.
26592
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` znamená výslovné „žádný rodič“.
26593
+ - Výslovně zvolený rodič nahradí implicitního Adama; vlastní řetězec \`FROM\` tohoto rodiče se pak zdědí běžným způsobem.
26594
+ - \`@Jmeno\` je pro jednoslovné jméno agenta zkratka zápisu \`{Jmeno}\`.
26595
+ - Když je \`FROM\` uvedeno vícekrát, platí poslední a přepíše všechna předchozí.
26596
+ - 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.
26579
26597
  - Chybějící odkazy se do výsledného zdroje propíší jako poznámky.
26580
26598
  `),
26581
26599
  },
@@ -26873,7 +26891,12 @@
26873
26891
  \`FROM\` points to a parent agent source. During inheritance resolution:
26874
26892
 
26875
26893
  - Parent corpus is merged into effective source.
26876
- - \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
26894
+ - Writing no \`FROM\` at all is the same as writing \`FROM @Adam\`, the core agent every agent inherits from.
26895
+ - \`FROM @Null\` / \`FROM {Void}\` / \`FROM VOID\` means explicit "no parent".
26896
+ - An explicit parent replaces the implicit Adam parent; the selected parent's own \`FROM\` chain is then inherited normally.
26897
+ - \`@Name\` is shorthand for \`{Name}\` when the agent name is one word.
26898
+ - When \`FROM\` is written more than once, the last one wins and overrides every earlier one.
26899
+ - 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.
26877
26900
  - Missing references are surfaced as notes in resolved source.
26878
26901
  `),
26879
26902
  },
@@ -28466,16 +28489,49 @@
28466
28489
  }
28467
28490
  /**
28468
28491
  * Retrieves the permanent ID of an agent by its name or permanent ID.
28492
+ *
28493
+ * An agent that still exists always wins over a soft-deleted one, so a name that was deleted and
28494
+ * later created again resolves to the agent that is live now instead of to the recycle-bin leftover.
28495
+ * Soft-deleted agents stay resolvable as a fallback because the recycle bin restores them by name
28496
+ * or permanent id.
28469
28497
  */
28470
28498
  async getAgentPermanentId(agentNameOrPermanentId) {
28471
- const selectResult = await this.supabaseClient
28499
+ const activeAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28500
+ isDeletedAgentIncluded: false,
28501
+ });
28502
+ if (activeAgentPermanentId !== null) {
28503
+ return activeAgentPermanentId;
28504
+ }
28505
+ const deletedAgentPermanentId = await this.findAgentPermanentId(agentNameOrPermanentId, {
28506
+ isDeletedAgentIncluded: true,
28507
+ });
28508
+ if (deletedAgentPermanentId !== null) {
28509
+ return deletedAgentPermanentId;
28510
+ }
28511
+ throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28512
+ }
28513
+ /**
28514
+ * Looks up the permanent id of the oldest agent matching one name or permanent id.
28515
+ *
28516
+ * @param agentNameOrPermanentId - Agent name or stable permanent identifier to match.
28517
+ * @param options - Whether soft-deleted agents may be matched as well.
28518
+ * @returns Permanent id of the matched agent, or `null` when nothing matches.
28519
+ *
28520
+ * @private internal helper of `AgentCollectionInSupabase`
28521
+ */
28522
+ async findAgentPermanentId(agentNameOrPermanentId, options) {
28523
+ const selectQuery = this.supabaseClient
28472
28524
  .from(this.getTableName('Agent'))
28473
28525
  .select('permanentId')
28474
- .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId))
28526
+ .or(buildAgentNameOrPermanentIdFilter(agentNameOrPermanentId));
28527
+ if (!options.isDeletedAgentIncluded) {
28528
+ selectQuery.is('deletedAt', null);
28529
+ }
28530
+ const selectResult = await selectQuery
28475
28531
  .order('createdAt', { ascending: true }) // Pick oldest if multiple match by name
28476
28532
  .limit(1);
28477
28533
  if (selectResult.error || !selectResult.data || selectResult.data.length === 0) {
28478
- throw new NotFoundError(`Agent with name or id "${agentNameOrPermanentId}" not found`);
28534
+ return null;
28479
28535
  }
28480
28536
  return selectResult.data[0].permanentId;
28481
28537
  }
@@ -48888,7 +48944,7 @@
48888
48944
  ${agentName}
48889
48945
 
48890
48946
 
48891
- PERSONA ${block(personaDescription)}
48947
+ GOAL ${block(personaDescription)}
48892
48948
  ${block(initialRules.map((rule) => `RULE ${rule}`).join('\n'))}
48893
48949
  CLOSED
48894
48950
  `));