@promptbook/cli 0.112.0-123 → 0.112.0-125
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.
- package/README.md +14 -14
- package/agents/default/developer.book +23 -0
- package/apps/agents-server/src/app/api/scrape/route.ts +18 -0
- package/apps/agents-server/src/tools/createAgentProgressTools.ts +6 -4
- package/apps/agents-server/src/utils/assertSafeUrl.ts +136 -0
- package/apps/agents-server/src/utils/authenticateUser.ts +2 -1
- package/apps/agents-server/src/utils/getCurrentUser.ts +2 -1
- package/apps/agents-server/src/utils/isAdminPasswordEqual.ts +28 -0
- package/apps/agents-server/src/utils/isUserGlobalAdmin.ts +3 -1
- package/apps/agents-server/src/utils/userChat/createRunUserChatJobPersistenceController.ts +21 -0
- package/apps/agents-server/src/utils/userChat/retryUserChatJob.ts +4 -0
- package/apps/agents-server/src/utils/userChat/userChatMessageLifecycle.ts +2 -0
- package/apps/agents-server/src/utils/userChat/userChatProgressCard.ts +288 -0
- package/esm/index.es.js +78 -7
- package/esm/index.es.js.map +1 -1
- package/esm/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
- package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.ts +79 -0
- package/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.ts +1 -1
- package/src/cli/cli-commands/coder/init.ts +2 -0
- package/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.ts +10 -0
- package/src/cli/cli-commands/coder/printInitializationSummary.ts +3 -0
- package/src/other/templates/getTemplatesPipelineCollection.ts +871 -790
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +77 -6
- package/umd/index.umd.js.map +1 -1
- package/umd/src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.d.ts +25 -0
- package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +2 -0
- package/umd/src/version.d.ts +1 -1
package/src/version.ts
CHANGED
|
@@ -16,11 +16,11 @@ export const BOOK_LANGUAGE_VERSION: string_semantic_version = '2.0.0';
|
|
|
16
16
|
* @generated
|
|
17
17
|
* @see https://github.com/webgptorg/promptbook
|
|
18
18
|
*/
|
|
19
|
-
export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-
|
|
19
|
+
export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-125';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Represents the version string of the Promptbook engine.
|
|
23
|
-
* It follows semantic versioning (e.g., `0.112.0-
|
|
23
|
+
* It follows semantic versioning (e.g., `0.112.0-123`).
|
|
24
24
|
*
|
|
25
25
|
* @generated
|
|
26
26
|
*/
|
package/src/versions.txt
CHANGED
package/umd/index.umd.js
CHANGED
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
* @generated
|
|
64
64
|
* @see https://github.com/webgptorg/promptbook
|
|
65
65
|
*/
|
|
66
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
66
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-125';
|
|
67
67
|
/**
|
|
68
68
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
69
69
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2181,7 +2181,7 @@
|
|
|
2181
2181
|
*/
|
|
2182
2182
|
async function ensureCoderMarkdownFile(projectPath, relativeFilePath, fileContent) {
|
|
2183
2183
|
const absoluteFilePath = path.join(projectPath, relativeFilePath);
|
|
2184
|
-
if (await isExistingFile$
|
|
2184
|
+
if (await isExistingFile$3(absoluteFilePath)) {
|
|
2185
2185
|
return 'unchanged';
|
|
2186
2186
|
}
|
|
2187
2187
|
await promises.writeFile(absoluteFilePath, `${fileContent}\n`, 'utf-8');
|
|
@@ -2190,7 +2190,7 @@
|
|
|
2190
2190
|
/**
|
|
2191
2191
|
* Checks whether a path exists and is a file.
|
|
2192
2192
|
*/
|
|
2193
|
-
async function isExistingFile$
|
|
2193
|
+
async function isExistingFile$3(path) {
|
|
2194
2194
|
try {
|
|
2195
2195
|
return (await promises.stat(path)).isFile();
|
|
2196
2196
|
}
|
|
@@ -38762,7 +38762,7 @@
|
|
|
38762
38762
|
const ensuredTemplateFiles = [];
|
|
38763
38763
|
for (const definition of DEFAULT_CODER_PROJECT_PROMPT_TEMPLATE_DEFINITIONS) {
|
|
38764
38764
|
const absoluteTemplatePath = path.join(projectPath, definition.relativeFilePath);
|
|
38765
|
-
if (await isExistingFile$
|
|
38765
|
+
if (await isExistingFile$2(absoluteTemplatePath)) {
|
|
38766
38766
|
ensuredTemplateFiles.push({
|
|
38767
38767
|
id: definition.id,
|
|
38768
38768
|
relativeFilePath: definition.relativeFilePath,
|
|
@@ -38876,7 +38876,7 @@
|
|
|
38876
38876
|
/**
|
|
38877
38877
|
* Checks whether a path exists and is a file.
|
|
38878
38878
|
*/
|
|
38879
|
-
async function isExistingFile$
|
|
38879
|
+
async function isExistingFile$2(path) {
|
|
38880
38880
|
try {
|
|
38881
38881
|
return (await promises.stat(path)).isFile();
|
|
38882
38882
|
}
|
|
@@ -39149,6 +39149,70 @@
|
|
|
39149
39149
|
// Note: [🟡] Code for coder AGENT_CODING file boilerplate [agentCodingFile](src/cli/cli-commands/coder/agentCodingFile.ts) should never be published outside of `@promptbook/cli`
|
|
39150
39150
|
// Note: [💞] Ignore a discrepancy between file name and exported helper names
|
|
39151
39151
|
|
|
39152
|
+
/**
|
|
39153
|
+
* Relative directory path for agents initialized by `ptbk coder init`.
|
|
39154
|
+
*
|
|
39155
|
+
* @private internal utility of `coder init` command
|
|
39156
|
+
*/
|
|
39157
|
+
const CODER_AGENTS_DIRECTORY_PATH = 'agents';
|
|
39158
|
+
/**
|
|
39159
|
+
* Relative file path to the default developer agent initialized by `ptbk coder init`.
|
|
39160
|
+
*
|
|
39161
|
+
* @private internal utility of `coder init` command
|
|
39162
|
+
*/
|
|
39163
|
+
const CODER_DEVELOPER_AGENT_FILE_PATH = 'agents/developer.book';
|
|
39164
|
+
/**
|
|
39165
|
+
* Source file path of the bundled developer agent inside the Promptbook repository.
|
|
39166
|
+
*
|
|
39167
|
+
* @private internal utility of `coder init` command
|
|
39168
|
+
*/
|
|
39169
|
+
const DEFAULT_CODER_DEVELOPER_AGENT_SOURCE_FILE_PATH = 'agents/default/developer.book';
|
|
39170
|
+
/**
|
|
39171
|
+
* Ensures the default developer agent exists in the initialized project.
|
|
39172
|
+
*
|
|
39173
|
+
* @private function of `initializeCoderProjectConfiguration`
|
|
39174
|
+
*/
|
|
39175
|
+
async function ensureCoderDeveloperAgentFile(projectPath) {
|
|
39176
|
+
const absoluteFilePath = path.join(projectPath, CODER_DEVELOPER_AGENT_FILE_PATH);
|
|
39177
|
+
if (await isExistingFile$1(absoluteFilePath)) {
|
|
39178
|
+
return 'unchanged';
|
|
39179
|
+
}
|
|
39180
|
+
await promises.copyFile(await resolveDefaultCoderDeveloperAgentFilePath(), absoluteFilePath);
|
|
39181
|
+
return 'created';
|
|
39182
|
+
}
|
|
39183
|
+
/**
|
|
39184
|
+
* Resolves the bundled developer agent from a source checkout or generated CLI package.
|
|
39185
|
+
*/
|
|
39186
|
+
async function resolveDefaultCoderDeveloperAgentFilePath() {
|
|
39187
|
+
const candidates = [
|
|
39188
|
+
path.join(__dirname, '..', DEFAULT_CODER_DEVELOPER_AGENT_SOURCE_FILE_PATH),
|
|
39189
|
+
path.join(__dirname, '..', '..', '..', '..', DEFAULT_CODER_DEVELOPER_AGENT_SOURCE_FILE_PATH),
|
|
39190
|
+
];
|
|
39191
|
+
for (const candidate of candidates) {
|
|
39192
|
+
if (await isExistingFile$1(candidate)) {
|
|
39193
|
+
return candidate;
|
|
39194
|
+
}
|
|
39195
|
+
}
|
|
39196
|
+
throw new NotAllowed(_spaceTrim.spaceTrim(`
|
|
39197
|
+
Cannot find the bundled Promptbook developer agent.
|
|
39198
|
+
|
|
39199
|
+
Checked:
|
|
39200
|
+
${candidates.map((candidate) => `- \`${candidate}\``).join('\n')}
|
|
39201
|
+
`));
|
|
39202
|
+
}
|
|
39203
|
+
/**
|
|
39204
|
+
* Checks whether a path exists and is a file.
|
|
39205
|
+
*/
|
|
39206
|
+
async function isExistingFile$1(path) {
|
|
39207
|
+
try {
|
|
39208
|
+
return (await promises.stat(path)).isFile();
|
|
39209
|
+
}
|
|
39210
|
+
catch (_a) {
|
|
39211
|
+
return false;
|
|
39212
|
+
}
|
|
39213
|
+
}
|
|
39214
|
+
// Note: [🟡] Code for coder init developer agent bootstrapping [ensureCoderDeveloperAgentFile](src/cli/cli-commands/coder/ensureCoderDeveloperAgentFile.ts) should never be published outside of `@promptbook/cli`
|
|
39215
|
+
|
|
39152
39216
|
/**
|
|
39153
39217
|
* Fallback `.env` content used when no required variables need to be appended.
|
|
39154
39218
|
*/
|
|
@@ -39225,7 +39289,7 @@
|
|
|
39225
39289
|
*/
|
|
39226
39290
|
const DEFAULT_CODER_PACKAGE_JSON_SCRIPTS = {
|
|
39227
39291
|
'coder:generate-boilerplates': 'ptbk coder generate-boilerplates --template ./prompts/templates/common.md',
|
|
39228
|
-
'coder:run': 'ptbk coder run --harness openai-codex --model gpt-5.4 --thinking-level xhigh --context AGENTS.md --no-wait',
|
|
39292
|
+
'coder:run': 'ptbk coder run --harness openai-codex --model gpt-5.4 --thinking-level xhigh --agent agents/developer.book --context AGENTS.md --no-wait',
|
|
39229
39293
|
// 'coder:find-refactor-candidates': 'ptbk coder find-refactor-candidates',
|
|
39230
39294
|
'coder:verify': 'ptbk coder verify',
|
|
39231
39295
|
};
|
|
@@ -39471,6 +39535,8 @@
|
|
|
39471
39535
|
const promptsDoneDirectoryStatus = await ensureDirectory(projectPath, PROMPTS_DONE_DIRECTORY_PATH);
|
|
39472
39536
|
const promptsTemplatesDirectoryStatus = await ensureDirectory(projectPath, PROMPTS_TEMPLATES_DIRECTORY_PATH);
|
|
39473
39537
|
const promptTemplateFileStatuses = await ensureDefaultCoderPromptTemplateFiles(projectPath);
|
|
39538
|
+
const agentsDirectoryStatus = await ensureDirectory(projectPath, CODER_AGENTS_DIRECTORY_PATH);
|
|
39539
|
+
const developerAgentFileStatus = await ensureCoderDeveloperAgentFile(projectPath);
|
|
39474
39540
|
const agentsFileStatus = await ensureCoderMarkdownFile(projectPath, AGENTS_FILE_PATH, getDefaultCoderAgentsFileContent());
|
|
39475
39541
|
const agentCodingFileStatus = await ensureCoderMarkdownFile(projectPath, AGENT_CODING_FILE_PATH, getDefaultCoderAgentCodingFileContent({
|
|
39476
39542
|
packageJsonScripts: getDefaultCoderPackageJsonScripts(),
|
|
@@ -39484,6 +39550,8 @@
|
|
|
39484
39550
|
promptsDoneDirectoryStatus,
|
|
39485
39551
|
promptsTemplatesDirectoryStatus,
|
|
39486
39552
|
promptTemplateFileStatuses,
|
|
39553
|
+
agentsDirectoryStatus,
|
|
39554
|
+
developerAgentFileStatus,
|
|
39487
39555
|
agentsFileStatus,
|
|
39488
39556
|
agentCodingFileStatus,
|
|
39489
39557
|
envFileStatus,
|
|
@@ -39508,6 +39576,8 @@
|
|
|
39508
39576
|
for (const templateFileStatus of summary.promptTemplateFileStatuses) {
|
|
39509
39577
|
printInitializationStatusLine(formatDisplayPath(templateFileStatus.relativeFilePath), templateFileStatus.status);
|
|
39510
39578
|
}
|
|
39579
|
+
printInitializationStatusLine('agents/', summary.agentsDirectoryStatus);
|
|
39580
|
+
printInitializationStatusLine(CODER_DEVELOPER_AGENT_FILE_PATH, summary.developerAgentFileStatus);
|
|
39511
39581
|
printInitializationStatusLine(AGENTS_FILE_PATH, summary.agentsFileStatus);
|
|
39512
39582
|
printInitializationStatusLine(AGENT_CODING_FILE_PATH, summary.agentCodingFileStatus);
|
|
39513
39583
|
printInitializationStatusLine('.env', summary.envFileStatus);
|
|
@@ -39564,6 +39634,7 @@
|
|
|
39564
39634
|
- prompts/
|
|
39565
39635
|
- prompts/done/
|
|
39566
39636
|
${listDefaultCoderProjectPromptTemplateDisplayPaths()}
|
|
39637
|
+
- ${CODER_DEVELOPER_AGENT_FILE_PATH}
|
|
39567
39638
|
- ${AGENTS_FILE_PATH}
|
|
39568
39639
|
- ${AGENT_CODING_FILE_PATH}
|
|
39569
39640
|
- .gitignore
|