@promptbook/cli 0.112.0-40 → 0.112.0-42

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 (78) hide show
  1. package/README.md +23 -21
  2. package/esm/apps/agents-server/src/database/acquireMigrationExecutionLock.d.ts +13 -2
  3. package/esm/apps/agents-server/src/database/importRuntimeModule.d.ts +8 -0
  4. package/esm/apps/agents-server/src/database/migratePrefix.d.ts +1 -1
  5. package/esm/apps/agents-server/src/database/resolveMigrationsDirectory.d.ts +2 -2
  6. package/esm/apps/agents-server/src/database/runDatabaseMigrations.d.ts +9 -0
  7. package/esm/index.es.js +5755 -3403
  8. package/esm/index.es.js.map +1 -1
  9. package/esm/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
  10. package/esm/scripts/verify-prompts/verify-prompts.d.ts +23 -2
  11. package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +8 -2
  12. package/esm/src/book-components/Chat/Chat/ChatInputArea.d.ts +0 -10
  13. package/esm/src/book-components/Chat/Chat/ChatInputUploadedFile.d.ts +10 -0
  14. package/esm/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +46 -0
  15. package/esm/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +146 -0
  16. package/esm/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +1 -1
  17. package/esm/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +39 -0
  18. package/esm/src/book-components/Chat/Chat/useChatPostprocessedMessages.d.ts +17 -0
  19. package/esm/src/book-components/Chat/Chat/useChatScrollState.d.ts +34 -0
  20. package/esm/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +61 -0
  21. package/esm/src/book-components/Chat/Chat/useChatToolCallState.d.ts +35 -0
  22. package/esm/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +58 -0
  23. package/esm/src/book-components/Chat/LlmChat/useLlmChatMessages.d.ts +29 -0
  24. package/esm/src/book-components/Chat/LlmChat/useLlmChatState.d.ts +53 -0
  25. package/esm/src/cli/cli-commands/coder/verify.test.d.ts +1 -0
  26. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -14
  27. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.d.ts +40 -0
  28. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.test.d.ts +1 -0
  29. package/esm/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +7 -1
  30. package/esm/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +52 -0
  31. package/esm/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +128 -0
  32. package/esm/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
  33. package/esm/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +54 -0
  34. package/esm/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +29 -0
  35. package/esm/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +28 -0
  36. package/esm/src/types/number_usd.d.ts +1 -1
  37. package/esm/src/types/string_parameter_name.d.ts +2 -2
  38. package/esm/src/types/typeAliases.d.ts +2 -2
  39. package/esm/src/version.d.ts +1 -1
  40. package/package.json +1 -1
  41. package/umd/apps/agents-server/src/database/acquireMigrationExecutionLock.d.ts +13 -2
  42. package/umd/apps/agents-server/src/database/importRuntimeModule.d.ts +8 -0
  43. package/umd/apps/agents-server/src/database/migratePrefix.d.ts +1 -1
  44. package/umd/apps/agents-server/src/database/resolveMigrationsDirectory.d.ts +2 -2
  45. package/umd/apps/agents-server/src/database/runDatabaseMigrations.d.ts +9 -0
  46. package/umd/index.umd.js +5758 -3406
  47. package/umd/index.umd.js.map +1 -1
  48. package/umd/scripts/run-codex-prompts/git/commitChanges.d.ts +3 -1
  49. package/umd/scripts/verify-prompts/verify-prompts.d.ts +23 -2
  50. package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.d.ts +8 -2
  51. package/umd/src/book-components/Chat/Chat/ChatInputArea.d.ts +0 -10
  52. package/umd/src/book-components/Chat/Chat/ChatInputUploadedFile.d.ts +10 -0
  53. package/umd/src/book-components/Chat/Chat/ChatToolCallModalContent.d.ts +46 -0
  54. package/umd/src/book-components/Chat/Chat/resolveRunBrowserToolCallDetailsState.d.ts +146 -0
  55. package/umd/src/book-components/Chat/Chat/useChatInputAreaAttachments.d.ts +1 -1
  56. package/umd/src/book-components/Chat/Chat/useChatInputAreaComposer.d.ts +39 -0
  57. package/umd/src/book-components/Chat/Chat/useChatPostprocessedMessages.d.ts +17 -0
  58. package/umd/src/book-components/Chat/Chat/useChatScrollState.d.ts +34 -0
  59. package/umd/src/book-components/Chat/Chat/useChatToolCallModalState.d.ts +61 -0
  60. package/umd/src/book-components/Chat/Chat/useChatToolCallState.d.ts +35 -0
  61. package/umd/src/book-components/Chat/LlmChat/useLlmChatMessageHandler.d.ts +58 -0
  62. package/umd/src/book-components/Chat/LlmChat/useLlmChatMessages.d.ts +29 -0
  63. package/umd/src/book-components/Chat/LlmChat/useLlmChatState.d.ts +53 -0
  64. package/umd/src/cli/cli-commands/coder/verify.test.d.ts +1 -0
  65. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +2 -14
  66. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.d.ts +40 -0
  67. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/createAgentPersistenceRecords.test.d.ts +1 -0
  68. package/umd/src/collection/pipeline-collection/constructors/createPipelineCollectionFromDirectory.d.ts +7 -1
  69. package/umd/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +52 -0
  70. package/umd/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +128 -0
  71. package/umd/src/llm-providers/openai/OpenAiCompatibleExecutionTools.d.ts +3 -3
  72. package/umd/src/llm-providers/openai/OpenAiVectorStoreHandler.d.ts +54 -0
  73. package/umd/src/llm-providers/openai/utils/OpenAiCompatibleUnsupportedParameterRetrier.d.ts +29 -0
  74. package/umd/src/llm-providers/openai/utils/callOpenAiCompatibleChatModel.d.ts +28 -0
  75. package/umd/src/types/number_usd.d.ts +1 -1
  76. package/umd/src/types/string_parameter_name.d.ts +2 -2
  77. package/umd/src/types/typeAliases.d.ts +2 -2
  78. package/umd/src/version.d.ts +1 -1
package/README.md CHANGED
@@ -19,11 +19,13 @@ Create persistent AI agents that turn your company's scattered knowledge into ac
19
19
  [![🧪 Test types](https://github.com/webgptorg/promptbook/actions/workflows/test-types.yml/badge.svg)](https://github.com/webgptorg/promptbook/actions/workflows/test-types.yml)
20
20
  [![Issues](https://img.shields.io/github/issues/webgptorg/promptbook.svg?style=flat)](https://github.com/webgptorg/promptbook/issues)
21
21
 
22
+ ## 🚀 Quick deploy
22
23
 
23
24
 
24
- ## 🌟 New Features
25
25
 
26
- - **Gemini 3 Support**
26
+ [![Vercel](https://img.shields.io/badge/Vercel-Deploy%20Agents%20Server-black?logo=vercel)](https://vercel.com/new/clone?project-name=promptbook-agents-server&repository-name=promptbook-agents-server&repository-url=https%3A%2F%2Fgithub.com%2Fwebgptorg%2Fpromptbook&root-directory=apps%2Fagents-server&demo-title=Promptbook+Agents+Server&demo-description=Persistent+AI+agents+with+a+built-in+admin+UI.+This+deploy+creates+a+Supabase+project+automatically%2C+injects+the+required+database+credentials%2C+and+Promptbook+runs+the+SQL+migrations+on+first+startup.&demo-url=https%3A%2F%2Fgallery.ptbk.io%2F&external-id=https%3A%2F%2Fgithub.com%2Fwebgptorg%2Fpromptbook%2Ftree%2Fmain%2Fapps%2Fagents-server&env=OPENAI_API_KEY%2CADMIN_PASSWORD%2CSUPABASE_AUTO_MIGRATE&envDescription=Supabase+is+created+automatically+by+the+required+Vercel+integration.+Add+OPENAI_API_KEY+from+https%3A%2F%2Fplatform.openai.com%2Fapi-keys%2C+choose+ADMIN_PASSWORD+for+your+first+admin+login%2C+and+leave+SUPABASE_AUTO_MIGRATE+enabled.&envLink=https%3A%2F%2Fgithub.com%2Fwebgptorg%2Fpromptbook%2Fblob%2Fmain%2FREADME.md%23vercel-form-fields&envDefaults=%7B%22SUPABASE_AUTO_MIGRATE%22%3A%22true%22%7D&stores=%5B%7B%22type%22%3A%22integration%22%2C%22integrationSlug%22%3A%22supabase%22%2C%22productSlug%22%3A%22supabase%22%7D%5D)
27
+
28
+
27
29
 
28
30
 
29
31
 
@@ -597,28 +599,28 @@ npx ptbk coder verify
597
599
 
598
600
  #### What each command does
599
601
 
600
- | Command | What it does |
601
- | --- | --- |
602
- | `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
603
- | `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
604
- | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, marks success or failure, then commits and pushes the result. |
605
- | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow|low|medium|high|xhigh|extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
606
- | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
602
+ | Command | What it does |
603
+ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | ------ | ---- | ----- | ------------------------------------------------------------------------ |
604
+ | `ptbk coder init` | Creates `prompts/`, `prompts/done/`, the project-generic template files materialized in `prompts/templates/` (currently `common.md`), and a starter `AGENTS.md`; ensures `.env` contains `CODING_AGENT_GIT_NAME`, `CODING_AGENT_GIT_EMAIL`, and `CODING_AGENT_GIT_SIGNING_KEY`; adds helper coder scripts to `package.json`; ensures `.gitignore` contains `/.tmp`; and configures `.vscode/settings.json` to save pasted prompt images into `prompts/screenshots/`. |
605
+ | `ptbk coder generate-boilerplates` | Creates new prompt markdown files with fresh emoji tags so you can quickly fill in coding tasks; `--template` accepts either a built-in alias or a markdown file path relative to the project root. |
606
+ | `ptbk coder run` | Picks the next ready prompt, appends optional context, runs it through the selected coding agent, marks success or failure, then commits and pushes the result. |
607
+ | `ptbk coder find-refactor-candidates` | Scans the repository for oversized or overpacked files and writes prompt files for likely refactors; `--level <xlow | low | medium | high | xhigh | extreme>` ranges from a very benevolent scan to a very aggressive sweep. |
608
+ | `ptbk coder verify` | Walks through completed prompts, archives truly finished work, and adds follow-up repair prompts for unfinished results. |
607
609
 
608
610
  #### Most useful `ptbk coder run` flags
609
611
 
610
- | Flag | Purpose |
611
- | --- | --- |
612
- | `--agent <name>` | Selects the coding backend. |
613
- | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
614
- | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
615
- | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
616
- | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
617
- | `--ignore-git-changes` | Disables the clean-working-tree guard. |
618
- | `--priority <n>` | Runs only prompts at or above the given priority. |
619
- | `--dry-run` | Prints which prompts are ready instead of executing them. |
620
- | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
621
- | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
612
+ | Flag | Purpose |
613
+ | -------------------------- | -------------------------------------------------------------------------------------------------- |
614
+ | `--agent <name>` | Selects the coding backend. |
615
+ | `--model <model>` | Chooses the runner model; required for `openai-codex` and `gemini`, optional for `github-copilot`. |
616
+ | `--context <text-or-file>` | Appends extra instructions inline or from a file like `AGENTS.md`. |
617
+ | `--thinking-level <level>` | Sets reasoning effort for supported runners. |
618
+ | `--no-wait` | Skips interactive pauses between prompts for unattended execution. |
619
+ | `--ignore-git-changes` | Disables the clean-working-tree guard. |
620
+ | `--priority <n>` | Runs only prompts at or above the given priority. |
621
+ | `--dry-run` | Prints which prompts are ready instead of executing them. |
622
+ | `--allow-credits` | Lets OpenAI Codex spend credits when required. |
623
+ | `--auto-migrate` | Runs testing-server database migrations after each successful prompt. |
622
624
 
623
625
  #### Typical usage pattern
624
626
 
@@ -1,14 +1,25 @@
1
- import { Client } from 'pg';
1
+ import type { Client } from 'pg';
2
2
  import type { DatabaseMigrationLogger } from './runDatabaseMigrations';
3
+ /**
4
+ * Lock-acquisition strategies used by the migration runner.
5
+ *
6
+ * `wait` is appropriate for explicit/manual migration flows where the caller expects one serialized run.
7
+ * `skip` is appropriate for background startup checks where waiting would block request handling.
8
+ *
9
+ * @private function of runDatabaseMigrations
10
+ */
11
+ export type DatabaseMigrationExecutionLockMode = 'wait' | 'skip';
3
12
  /**
4
13
  * Acquires advisory lock preventing concurrent migration execution across processes.
5
14
  *
6
15
  * @param client Connected PostgreSQL client.
7
16
  * @param logger Logger used for progress output.
17
+ * @param mode Whether the caller should block for the lock or skip when it is already held.
18
+ * @returns `true` when the lock was acquired and migrations may proceed.
8
19
  *
9
20
  * @private function of runDatabaseMigrations
10
21
  */
11
- export declare function acquireMigrationExecutionLock(client: Client, logger: DatabaseMigrationLogger): Promise<void>;
22
+ export declare function acquireMigrationExecutionLock(client: Client, logger: DatabaseMigrationLogger, mode?: DatabaseMigrationExecutionLockMode): Promise<boolean>;
12
23
  /**
13
24
  * Releases advisory lock used for migration execution.
14
25
  *
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Imports a runtime-only module without letting Next.js statically bundle Node-only dependencies.
3
+ *
4
+ * @param specifier - Module specifier to import at runtime.
5
+ * @returns Imported module namespace.
6
+ * @private internal helper for runtime-only database utilities
7
+ */
8
+ export declare function importRuntimeModule<TModule>(specifier: string): Promise<TModule>;
@@ -1,4 +1,4 @@
1
- import { Client } from 'pg';
1
+ import type { Client } from 'pg';
2
2
  import type { DatabaseMigrationAppliedBy, DatabaseMigrationLogger } from './runDatabaseMigrations';
3
3
  /**
4
4
  * Context for one prefix migration pass.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @private function of runDatabaseMigrations
7
7
  */
8
- export declare function resolveMigrationsDirectory(): string;
8
+ export declare function resolveMigrationsDirectory(): Promise<string>;
9
9
  /**
10
10
  * Reads migration files from directory and sorts them lexicographically.
11
11
  *
@@ -14,4 +14,4 @@ export declare function resolveMigrationsDirectory(): string;
14
14
  *
15
15
  * @private function of runDatabaseMigrations
16
16
  */
17
- export declare function readMigrationFiles(migrationsDirectory: string): Array<string>;
17
+ export declare function readMigrationFiles(migrationsDirectory: string): Promise<Array<string>>;
@@ -1,4 +1,5 @@
1
1
  import { type ServerRecord } from '../utils/serverRegistry';
2
+ import { type DatabaseMigrationExecutionLockMode } from './acquireMigrationExecutionLock';
2
3
  /**
3
4
  * Allowed values describing who applied a migration record.
4
5
  */
@@ -67,6 +68,10 @@ export type RunDatabaseMigrationsOptions = {
67
68
  * If true, prints every SQL migration body before execution.
68
69
  */
69
70
  readonly logSqlStatements?: boolean;
71
+ /**
72
+ * Whether migration execution should wait for the advisory lock or skip when another process already owns it.
73
+ */
74
+ readonly executionLockMode?: DatabaseMigrationExecutionLockMode;
70
75
  };
71
76
  /**
72
77
  * Result of one prefix migration run.
@@ -97,6 +102,10 @@ export type RunDatabaseMigrationsResult = {
97
102
  * Per-prefix summary.
98
103
  */
99
104
  readonly perPrefix: ReadonlyArray<DatabaseMigrationPrefixResult>;
105
+ /**
106
+ * Whether migration execution was skipped because another process already held the advisory lock.
107
+ */
108
+ readonly isSkippedDueToActiveMigrationLock: boolean;
100
109
  };
101
110
  /**
102
111
  * Reads migration runtime configuration from environment variables and `_Server`.