@promptbook/types 0.114.0-33 → 0.114.0-35

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 (87) hide show
  1. package/esm/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  2. package/esm/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  3. package/esm/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +2 -1
  4. package/esm/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
  5. package/esm/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  6. package/esm/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
  7. package/esm/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
  8. package/esm/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  9. package/esm/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  10. package/esm/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  11. package/esm/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
  12. package/esm/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
  13. package/esm/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  14. package/esm/src/cli/cli-commands/common/$askForConfirmation.d.ts +4 -2
  15. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  16. package/esm/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  17. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  18. package/esm/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  19. package/esm/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  20. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  21. package/esm/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  22. package/esm/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  23. package/esm/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  24. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  25. package/esm/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  26. package/esm/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +2 -1
  27. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -2
  28. package/esm/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +26 -0
  29. package/esm/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +4 -2
  30. package/esm/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +2 -1
  31. package/esm/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  32. package/esm/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  33. package/esm/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  34. package/esm/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  35. package/esm/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  36. package/esm/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  37. package/esm/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  38. package/esm/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  39. package/esm/src/version.d.ts +1 -1
  40. package/package.json +2 -5
  41. package/umd/src/book-2.0/book-language-documentation/getSafeCodeBlock.d.ts +1 -1
  42. package/umd/src/book-components/Chat/MockedChat/MockedChat.test.d.ts +2 -0
  43. package/umd/src/cli/cli-commands/coder/$ensureCoderHarnessGitignoreRules.d.ts +2 -1
  44. package/umd/src/cli/cli-commands/coder/agentCliOptions.d.ts +21 -0
  45. package/umd/src/cli/cli-commands/coder/boilerplateTemplates.d.ts +8 -21
  46. package/umd/src/cli/cli-commands/coder/coderReferencedArtifacts.d.ts +33 -0
  47. package/umd/src/cli/cli-commands/coder/ensureCoderPackageJsonFile.d.ts +4 -2
  48. package/umd/src/cli/cli-commands/coder/ensureCoderVscodeSettingsFile.d.ts +2 -0
  49. package/umd/src/cli/cli-commands/coder/ensureDirectory.d.ts +6 -0
  50. package/umd/src/cli/cli-commands/coder/getDefaultCoderPackageJsonScripts.d.ts +6 -0
  51. package/umd/src/cli/cli-commands/coder/init.test.d.ts +1 -0
  52. package/umd/src/cli/cli-commands/coder/initializeCoderProjectConfiguration.d.ts +7 -5
  53. package/umd/src/cli/cli-commands/coder/mergeStringRecordJsonFile.d.ts +19 -1
  54. package/umd/src/cli/cli-commands/coder/printCoderRunFailure.d.ts +6 -0
  55. package/umd/src/cli/cli-commands/common/$askForConfirmation.d.ts +4 -2
  56. package/umd/src/cli/cli-commands/common/$askForConfirmation.test.d.ts +1 -0
  57. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.d.ts +12 -0
  58. package/umd/src/cli/cli-commands/common/disk-space/$assertSufficientFreeDiskSpace.test.d.ts +1 -0
  59. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.d.ts +11 -0
  60. package/umd/src/cli/cli-commands/common/disk-space/$readFreeDiskSpaceStatus.test.d.ts +1 -0
  61. package/umd/src/cli/cli-commands/common/disk-space/FreeDiskSpaceStatus.d.ts +33 -0
  62. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.d.ts +6 -0
  63. package/umd/src/cli/cli-commands/common/disk-space/formatFreeDiskSpaceBytes.test.d.ts +1 -0
  64. package/umd/src/cli/cli-commands/common/disk-space/formatLowFreeDiskSpaceWarning.d.ts +10 -0
  65. package/umd/src/cli/cli-commands/common/disk-space/freeDiskSpaceConstants.d.ts +28 -0
  66. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.d.ts +7 -0
  67. package/umd/src/cli/cli-commands/common/disk-space/resolveFreeDiskSpaceLevel.test.d.ts +1 -0
  68. package/umd/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.d.ts +2 -1
  69. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -2
  70. package/umd/src/cli/cli-commands/common/harness/HarnessDefinition.d.ts +26 -0
  71. package/umd/src/cli/cli-commands/common/npm/$askForNpmPackageInstallationApproval.d.ts +4 -2
  72. package/umd/src/cli/cli-commands/common/promptbook-cli/$ensurePromptbookCliInstallations.d.ts +2 -1
  73. package/umd/src/cli/cli-commands/common/questionsCliOptions.d.ts +45 -0
  74. package/umd/src/cli/cli-commands/common/questionsCliOptions.test.d.ts +1 -0
  75. package/umd/src/cli/common/$deprecateCliCommand.d.ts +3 -0
  76. package/umd/src/cli/common/$hideCliCommandFromHelp.d.ts +11 -0
  77. package/umd/src/cli/common/$hideCliCommandFromHelp.test.d.ts +1 -0
  78. package/umd/src/cli/common/$requireCliSubcommand.d.ts +18 -0
  79. package/umd/src/cli/common/$requireCliSubcommand.test.d.ts +1 -0
  80. package/umd/src/llm-providers/vercel/VercelExecutionToolsOptions.d.ts +5 -2
  81. package/umd/src/version.d.ts +1 -1
  82. package/esm/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  83. package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +0 -29
  84. package/umd/src/cli/cli-commands/coder/agentCodingFile.d.ts +0 -13
  85. package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +0 -29
  86. /package/esm/src/cli/cli-commands/{common/harnessUpdateCliOptions.test.d.ts → coder/init.test.d.ts} +0 -0
  87. /package/{umd/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts → esm/src/cli/cli-commands/common/$askForConfirmation.test.d.ts} +0 -0
@@ -5,6 +5,6 @@
5
5
  * @param language - Optional info-string language label.
6
6
  * @returns Fenced code block.
7
7
  *
8
- * @private internal utility of `createStandaloneBookLanguageMarkdown`
8
+ * @private internal utility of `createStandaloneBookLanguageMarkdown` and of the `ptbk coder` run traces
9
9
  */
10
10
  export declare function getSafeCodeBlock(content: string, language?: string): string;
@@ -0,0 +1,2 @@
1
+ /** @jest-environment jsdom */
2
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { PromptRunnerHarnessName } from '../common/promptRunnerCliOptions';
2
+ import type { NormalizedQuestionsCliOptions } from '../common/questionsCliOptions';
2
3
  /**
3
4
  * Offers to add missing project-local ignore rules for the selected coding harness.
4
5
  *
@@ -6,4 +7,4 @@ import type { PromptRunnerHarnessName } from '../common/promptRunnerCliOptions';
6
7
  *
7
8
  * @private internal utility of `ptbk coder`
8
9
  */
9
- export declare function $ensureCoderHarnessGitignoreRules(projectPath: string, harnessName: PromptRunnerHarnessName | undefined): Promise<void>;
10
+ export declare function $ensureCoderHarnessGitignoreRules(projectPath: string, harnessName: PromptRunnerHarnessName | undefined, questionsOptions: NormalizedQuestionsCliOptions): Promise<void>;
@@ -0,0 +1,21 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Commander option bag for an optional Book agent used by coder commands.
4
+ *
5
+ * @private internal utility of `ptbk coder`
6
+ */
7
+ export type CoderAgentCliOptions = {
8
+ readonly agent?: string;
9
+ };
10
+ /**
11
+ * Description shared by coder commands which accept an agent Book.
12
+ *
13
+ * @private internal utility of `ptbk coder`
14
+ */
15
+ export declare const CODER_AGENT_OPTION_DESCRIPTION = "Path to a .book file used to personalize coding prompts and select agent-specific tasks";
16
+ /**
17
+ * Registers the shared `--agent` option for coder commands.
18
+ *
19
+ * @private internal utility of `ptbk coder`
20
+ */
21
+ export declare function addCoderAgentOption(command: Program): void;
@@ -16,6 +16,12 @@ export declare const PROMPTS_DONE_DIRECTORY_PATH: string;
16
16
  * @private internal utility of `ptbk coder`
17
17
  */
18
18
  export declare const PROMPTS_TEMPLATES_DIRECTORY_PATH: string;
19
+ /**
20
+ * Relative path to the project-agnostic `common` boilerplate template referenced by the default coder scripts.
21
+ *
22
+ * @private internal utility of `ptbk coder`
23
+ */
24
+ export declare const COMMON_PROMPT_TEMPLATE_FILE_PATH: string;
19
25
  /**
20
26
  * Initialization statuses used when creating or updating coder configuration artifacts.
21
27
  *
@@ -55,25 +61,6 @@ export type CoderPromptTemplateDefinition = {
55
61
  */
56
62
  readonly isDefaultProjectTemplate: boolean;
57
63
  };
58
- /**
59
- * Result of ensuring one default coder template file exists inside a project.
60
- *
61
- * @private internal utility of `ptbk coder`
62
- */
63
- export type EnsuredCoderPromptTemplateFile = {
64
- /**
65
- * Stable built-in identifier of the template.
66
- */
67
- readonly id: BuiltInCoderPromptTemplate;
68
- /**
69
- * Project-relative path of the materialized template file.
70
- */
71
- readonly relativeFilePath: string;
72
- /**
73
- * Status describing whether the file had to be created.
74
- */
75
- readonly status: InitializationStatus;
76
- };
77
64
  /**
78
65
  * Fully resolved boilerplate template used by `coder generate-boilerplates`.
79
66
  *
@@ -116,11 +103,11 @@ export declare function getDefaultCoderProjectPromptTemplateDefinitions(): Reado
116
103
  */
117
104
  export declare function getDefaultCoderPromptTemplateDefinition(template: BuiltInCoderPromptTemplate): CoderPromptTemplateDefinition;
118
105
  /**
119
- * Ensures the default project-owned coder template files exist without overwriting user customizations.
106
+ * Ensures one project-owned coder template file exists without overwriting user customizations.
120
107
  *
121
108
  * @private internal utility of `ptbk coder`
122
109
  */
123
- export declare function ensureDefaultCoderPromptTemplateFiles(projectPath: string): Promise<ReadonlyArray<EnsuredCoderPromptTemplateFile>>;
110
+ export declare function ensureDefaultCoderPromptTemplateFile(projectPath: string, definition: CoderPromptTemplateDefinition): Promise<InitializationStatus>;
124
111
  /**
125
112
  * Resolves the template requested by `coder generate-boilerplates`.
126
113
  *
@@ -0,0 +1,33 @@
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ /**
3
+ * Status of one artifact referenced by the default coder scripts.
4
+ *
5
+ * `not-referenced` means that no newly added script points at the artifact, so `ptbk coder init` left it alone.
6
+ *
7
+ * @private internal utility of `coder init` command
8
+ */
9
+ export type CoderReferencedArtifactStatus = InitializationStatus | 'not-referenced';
10
+ /**
11
+ * Result of ensuring one artifact referenced by the default coder scripts.
12
+ *
13
+ * @private internal utility of `coder init` command
14
+ */
15
+ export type EnsuredCoderReferencedArtifact = {
16
+ /**
17
+ * Project-relative path of the referenced artifact.
18
+ */
19
+ readonly relativeFilePath: string;
20
+ /**
21
+ * Status describing whether the artifact had to be created.
22
+ */
23
+ readonly status: CoderReferencedArtifactStatus;
24
+ };
25
+ /**
26
+ * Creates only those referenced artifacts which the freshly added coder scripts point at.
27
+ *
28
+ * An artifact of a script which the project already defines is intentionally **not** created - the project-owned
29
+ * script is kept as is, so it does not reference the default artifact in the first place.
30
+ *
31
+ * @private function of `initializeCoderProjectConfiguration`
32
+ */
33
+ export declare function ensureCoderReferencedArtifacts(projectPath: string, referencedArtifactPaths: ReadonlySet<string>): Promise<ReadonlyArray<EnsuredCoderReferencedArtifact>>;
@@ -1,7 +1,9 @@
1
- import type { InitializationStatus } from './boilerplateTemplates';
1
+ import type { MergedStringRecordJsonFile } from './mergeStringRecordJsonFile';
2
2
  /**
3
3
  * Ensures `package.json` contains the standalone Promptbook coder helper scripts.
4
4
  *
5
+ * Scripts which the project already defines are kept as they are, only missing ones are added.
6
+ *
5
7
  * @private function of `initializeCoderProjectConfiguration`
6
8
  */
7
- export declare function ensureCoderPackageJsonFile(projectPath: string): Promise<InitializationStatus>;
9
+ export declare function ensureCoderPackageJsonFile(projectPath: string): Promise<MergedStringRecordJsonFile>;
@@ -2,6 +2,8 @@ import type { InitializationStatus } from './boilerplateTemplates';
2
2
  /**
3
3
  * Ensures VS Code routes pasted prompt images into `prompts/screenshots`.
4
4
  *
5
+ * Settings which the project already defines are kept as they are, only missing ones are added.
6
+ *
5
7
  * @private function of `initializeCoderProjectConfiguration`
6
8
  */
7
9
  export declare function ensureCoderVscodeSettingsFile(projectPath: string): Promise<InitializationStatus>;
@@ -5,3 +5,9 @@ import type { InitializationStatus } from './boilerplateTemplates';
5
5
  * @private function of `initializeCoderProjectConfiguration`
6
6
  */
7
7
  export declare function ensureDirectory(projectPath: string, relativeDirectoryPath: string): Promise<InitializationStatus>;
8
+ /**
9
+ * Checks whether a project-relative directory is missing or contains no entries.
10
+ *
11
+ * @private internal utility of `coder init` command
12
+ */
13
+ export declare function isDirectoryEmpty(projectPath: string, relativeDirectoryPath: string): Promise<boolean>;
@@ -4,3 +4,9 @@
4
4
  * @private internal utility of `coder init` command
5
5
  */
6
6
  export declare function getDefaultCoderPackageJsonScripts(): Readonly<Record<string, string>>;
7
+ /**
8
+ * Collects the project-relative artifact paths referenced by the given default coder scripts.
9
+ *
10
+ * @private internal utility of `coder init` command
11
+ */
12
+ export declare function resolveCoderPackageJsonScriptReferencedArtifactPaths(scriptNames: ReadonlyArray<string>): ReadonlySet<string>;
@@ -1,4 +1,5 @@
1
- import type { EnsuredCoderPromptTemplateFile, InitializationStatus } from './boilerplateTemplates';
1
+ import type { InitializationStatus } from './boilerplateTemplates';
2
+ import type { EnsuredCoderReferencedArtifact } from './coderReferencedArtifacts';
2
3
  /**
3
4
  * Result summary returned after coder configuration initialization.
4
5
  *
@@ -8,20 +9,21 @@ export type CoderInitializationSummary = {
8
9
  readonly promptsDirectoryStatus: InitializationStatus;
9
10
  readonly promptsDoneDirectoryStatus: InitializationStatus;
10
11
  readonly promptsTemplatesDirectoryStatus: InitializationStatus;
11
- readonly promptTemplateFileStatuses: ReadonlyArray<EnsuredCoderPromptTemplateFile>;
12
12
  readonly agentsDirectoryStatus: InitializationStatus;
13
- readonly developerAgentFileStatus: InitializationStatus;
14
- readonly agentsFileStatus: InitializationStatus;
15
- readonly agentCodingFileStatus: InitializationStatus;
16
13
  readonly envFileStatus: InitializationStatus;
17
14
  readonly gitignoreFileStatus: InitializationStatus;
18
15
  readonly packageJsonFileStatus: InitializationStatus;
19
16
  readonly vscodeSettingsFileStatus: InitializationStatus;
17
+ readonly addedPackageJsonScriptNames: ReadonlyArray<string>;
18
+ readonly referencedArtifactStatuses: ReadonlyArray<EnsuredCoderReferencedArtifact>;
20
19
  readonly initializedEnvVariableNames: ReadonlyArray<string>;
21
20
  };
22
21
  /**
23
22
  * Creates or updates all coder configuration artifacts required in the current project.
24
23
  *
24
+ * Nothing the project already owns is ever overwritten - existing scripts, settings and files are kept as they are,
25
+ * and the artifacts they would reference are created only together with the scripts which actually reference them.
26
+ *
25
27
  * @private internal utility of `coder init` command
26
28
  */
27
29
  export declare function initializeCoderProjectConfiguration(projectPath: string): Promise<CoderInitializationSummary>;
@@ -9,10 +9,28 @@ type MergeStringRecordJsonFileOptions = {
9
9
  readonly nextEntries: Readonly<Record<string, string>>;
10
10
  readonly ensureParentDirectoryPath?: string;
11
11
  };
12
+ /**
13
+ * Result of one additive string-record merge into a JSON file.
14
+ *
15
+ * @private internal utility of `coder init` command
16
+ */
17
+ export type MergedStringRecordJsonFile = {
18
+ /**
19
+ * Status describing whether the JSON file had to be created or updated.
20
+ */
21
+ readonly status: InitializationStatus;
22
+ /**
23
+ * Keys which were missing in the JSON file and therefore added by the merge.
24
+ */
25
+ readonly addedEntryKeys: ReadonlyArray<string>;
26
+ };
12
27
  /**
13
28
  * Ensures one JSON object field contains the provided string-record entries.
14
29
  *
30
+ * Entries which the project already defines are **never** overridden - only missing keys are added,
31
+ * so hand-tuned scripts and settings survive every repeated `ptbk coder init`.
32
+ *
15
33
  * @private function of `initializeCoderProjectConfiguration`
16
34
  */
17
- export declare function mergeStringRecordJsonFile({ projectPath, relativeFilePath, fieldPath, nextEntries, ensureParentDirectoryPath, }: MergeStringRecordJsonFileOptions): Promise<InitializationStatus>;
35
+ export declare function mergeStringRecordJsonFile({ projectPath, relativeFilePath, fieldPath, nextEntries, ensureParentDirectoryPath, }: MergeStringRecordJsonFileOptions): Promise<MergedStringRecordJsonFile>;
18
36
  export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Prints why a coder run has ended to the terminal.
3
+ *
4
+ * @private internal utility of `coder run` and `coder server` commands
5
+ */
6
+ export declare function printCoderRunFailure(error: Error): void;
@@ -1,9 +1,11 @@
1
+ import type { NormalizedQuestionsCliOptions } from './questionsCliOptions';
1
2
  /**
2
3
  * Asks the user in the terminal to confirm one optional change.
3
4
  *
4
5
  * Note: `$` is used to indicate that this function is not a pure function - it reads the answer from stdin.
5
6
  *
6
- * @returns `true` when the user confirms, `false` when the user declines or the terminal is not interactive.
7
+ * @returns `true` when the user confirms, `false` when the user declines, the terminal is not interactive
8
+ * or the questions are disabled by `--no-questions`.
7
9
  * @private internal utility of `promptbookCli`
8
10
  */
9
- export declare function $askForConfirmation(question: string): Promise<boolean>;
11
+ export declare function $askForConfirmation(question: string, { isAskingQuestionsEnabled }: NormalizedQuestionsCliOptions): Promise<boolean>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Refuses to start one `ptbk coder` command when the disk which hosts the project is nearly full.
3
+ *
4
+ * A run which starts without enough free disk space fails somewhere in the middle, after the coding agent has
5
+ * already rewritten a part of the project, so it is stopped before it writes anything at all.
6
+ *
7
+ * Note: `$` is used to indicate that this function is not a pure function - it reads the state of the filesystem
8
+ *
9
+ * @throws {LimitReachedError} when there is not enough free disk space left to start
10
+ * @private internal utility of `promptbookCli`
11
+ */
12
+ export declare function $assertSufficientFreeDiskSpace(inspectedPath: string): Promise<void>;
@@ -0,0 +1,11 @@
1
+ import type { FreeDiskSpaceStatus } from './FreeDiskSpaceStatus';
2
+ /**
3
+ * Measures the free disk space on the filesystem which hosts the given path.
4
+ *
5
+ * Note: `$` is used to indicate that this function is not a pure function - it reads the state of the filesystem
6
+ *
7
+ * @returns the measurement, or `null` when the filesystem can not be measured, for example on a platform which
8
+ * does not report filesystem statistics - a run is never stopped by a measurement which could not be taken
9
+ * @private internal utility of `promptbookCli`
10
+ */
11
+ export declare function $readFreeDiskSpaceStatus(inspectedPath: string): Promise<FreeDiskSpaceStatus | null>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * How much free disk space is left, measured against the `ptbk coder` free disk space limits.
3
+ *
4
+ * - `sufficient` - there is enough free disk space to start a run and to keep it running
5
+ * - `low` - there is not enough free disk space to start a new run
6
+ * - `critical` - there is not enough free disk space to keep a started run going
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export type FreeDiskSpaceLevel = 'sufficient' | 'low' | 'critical';
11
+ /**
12
+ * One measurement of the free disk space on the filesystem which hosts the inspected path.
13
+ *
14
+ * @private internal utility of `promptbookCli`
15
+ */
16
+ export type FreeDiskSpaceStatus = {
17
+ /**
18
+ * Path whose filesystem was measured.
19
+ */
20
+ readonly inspectedPath: string;
21
+ /**
22
+ * Bytes which are still available to the current user on that filesystem.
23
+ */
24
+ readonly availableBytes: number;
25
+ /**
26
+ * Total size of that filesystem in bytes.
27
+ */
28
+ readonly totalBytes: number;
29
+ /**
30
+ * Severity of the measured free disk space.
31
+ */
32
+ readonly level: FreeDiskSpaceLevel;
33
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Writes one byte count as a compact human-readable amount of disk space, for example `812 MB` or `1.5 GB`.
3
+ *
4
+ * @private internal utility of `promptbookCli`
5
+ */
6
+ export declare function formatFreeDiskSpaceBytes(bytes: number): string;
@@ -0,0 +1,10 @@
1
+ import type { FreeDiskSpaceStatus } from './FreeDiskSpaceStatus';
2
+ /**
3
+ * Writes the shared warning which explains one low free disk space measurement and how to get out of it.
4
+ *
5
+ * The very same wording is used by the check which refuses to start a run and by the check which pauses
6
+ * a run that ran out of disk space while it was working.
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export declare function formatLowFreeDiskSpaceWarning(freeDiskSpaceStatus: FreeDiskSpaceStatus): string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Free disk space below which `ptbk coder` refuses to start a new run.
3
+ *
4
+ * A coding round writes prompt and log artifacts, lets the harness rewrite the project, may install npm packages,
5
+ * may create a git worktree for `--isolate` and usually runs a build, so a run started with less than this
6
+ * would very likely die somewhere in the middle with a filesystem error.
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export declare const LOW_FREE_DISK_SPACE_BYTES: number;
11
+ /**
12
+ * Free disk space below which a started `ptbk coder` run stops at its next checkpoint and waits until space is freed.
13
+ *
14
+ * This limit is lower than `LOW_FREE_DISK_SPACE_BYTES`, because interrupting a run which is already in progress
15
+ * is more expensive than not starting one at all.
16
+ *
17
+ * @private internal utility of `promptbookCli`
18
+ */
19
+ export declare const CRITICALLY_LOW_FREE_DISK_SPACE_BYTES: number;
20
+ /**
21
+ * How long one free disk space measurement is reused before the filesystem is measured again during a run.
22
+ *
23
+ * Pause checkpoints are passed very often - for example on every tick of a timed wait - so without this
24
+ * interval the filesystem would be measured many times per second.
25
+ *
26
+ * @private internal utility of `promptbookCli`
27
+ */
28
+ export declare const FREE_DISK_SPACE_RECHECK_INTERVAL_MS: number;
@@ -0,0 +1,7 @@
1
+ import type { FreeDiskSpaceLevel } from './FreeDiskSpaceStatus';
2
+ /**
3
+ * Classifies one measured amount of free disk space against the `ptbk coder` free disk space limits.
4
+ *
5
+ * @private internal utility of `promptbookCli`
6
+ */
7
+ export declare function resolveFreeDiskSpaceLevel(availableBytes: number): FreeDiskSpaceLevel;
@@ -1,3 +1,4 @@
1
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
1
2
  import type { HarnessInstallationStatus } from './HarnessInstallationStatus';
2
3
  /**
3
4
  * Reports one detected harness installation status and offers to install or update the harness.
@@ -6,4 +7,4 @@ import type { HarnessInstallationStatus } from './HarnessInstallationStatus';
6
7
  *
7
8
  * @private internal utility of `promptbookCli`
8
9
  */
9
- export declare function $applyHarnessInstallationStatus(status: HarnessInstallationStatus): Promise<void>;
10
+ export declare function $applyHarnessInstallationStatus(status: HarnessInstallationStatus, questionsOptions: NormalizedQuestionsCliOptions): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  import type { PromptRunnerHarnessName } from '../promptRunnerCliOptions';
2
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
2
3
  /**
3
- * Checks that every given CLI coding harness is installed globally and, when enabled, up to date.
4
+ * Checks that every given CLI coding harness is installed globally and, when the questions are enabled, up to date.
4
5
  * Offers to install missing harnesses and update outdated ones.
5
6
  *
6
7
  * Harness names which are `undefined`, for example when no `--harness` is selected in a dry run,
@@ -10,4 +11,4 @@ import type { PromptRunnerHarnessName } from '../promptRunnerCliOptions';
10
11
  *
11
12
  * @private internal utility of `promptbookCli`
12
13
  */
13
- export declare function $ensureHarnessInstallations(harnessNames: ReadonlyArray<PromptRunnerHarnessName | undefined>, isHarnessUpdateCheckEnabled?: boolean): Promise<void>;
14
+ export declare function $ensureHarnessInstallations(harnessNames: ReadonlyArray<PromptRunnerHarnessName | undefined>, questionsOptions: NormalizedQuestionsCliOptions): Promise<void>;
@@ -19,6 +19,28 @@ export type HarnessStandaloneInstallation = {
19
19
  */
20
20
  readonly updateCommand: string;
21
21
  };
22
+ /**
23
+ * Description of how the user signs in to one CLI coding harness again.
24
+ *
25
+ * Every harness refuses to work once its login is missing or its session has expired, and each of them is
26
+ * signed in differently - some have a dedicated login command, others sign in from their own interactive UI.
27
+ *
28
+ * @private internal utility of `promptbookCli`
29
+ */
30
+ export type HarnessAuthenticationMethod = {
31
+ /**
32
+ * Command which starts the sign-in flow of the harness.
33
+ */
34
+ readonly command: string;
35
+ /**
36
+ * Step which finishes the sign-in inside the started command.
37
+ *
38
+ * Harnesses which sign in from their own interactive user interface leave the user in that interface, so
39
+ * naming just the command would not be enough to get them signed in. Harnesses with a dedicated login
40
+ * command leave this undefined.
41
+ */
42
+ readonly interactiveStep?: string;
43
+ };
22
44
  /**
23
45
  * Static description of one supported CLI coding harness.
24
46
  *
@@ -49,6 +71,10 @@ export type HarnessDefinition = {
49
71
  * Project-local files or directories which this harness can create and which should not be committed.
50
72
  */
51
73
  readonly projectGitignoreRules: ReadonlyArray<string>;
74
+ /**
75
+ * How the user signs in to this harness again after its login is missing or has expired.
76
+ */
77
+ readonly authenticationMethod: HarnessAuthenticationMethod;
52
78
  /**
53
79
  * How a standalone installation of this harness is recognized and updated.
54
80
  *
@@ -1,9 +1,11 @@
1
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
1
2
  /**
2
3
  * Asks the user in the terminal whether an npm package should be installed or updated now.
3
4
  *
4
5
  * Note: `$` is used to indicate that this function is not a pure function - it reads the answer from stdin
5
6
  *
6
- * @returns `true` when the user confirms, `false` when the user declines or the terminal is not interactive
7
+ * @returns `true` when the user confirms, `false` when the user declines, the terminal is not interactive
8
+ * or the questions are disabled by `--no-questions`
7
9
  * @private internal utility of `promptbookCli`
8
10
  */
9
- export declare function $askForNpmPackageInstallationApproval(question: string): Promise<boolean>;
11
+ export declare function $askForNpmPackageInstallationApproval(question: string, questionsOptions: NormalizedQuestionsCliOptions): Promise<boolean>;
@@ -1,3 +1,4 @@
1
+ import type { NormalizedQuestionsCliOptions } from '../questionsCliOptions';
1
2
  /**
2
3
  * Checks local and global Promptbook CLI installations before an interactive coder run and offers to update them.
3
4
  *
@@ -11,4 +12,4 @@
11
12
  * @returns `true` when at least one installation was updated and the current coder run should stop
12
13
  * @private internal utility of `promptbookCli`
13
14
  */
14
- export declare function $ensurePromptbookCliInstallations(): Promise<boolean>;
15
+ export declare function $ensurePromptbookCliInstallations(questionsOptions: NormalizedQuestionsCliOptions): Promise<boolean>;
@@ -0,0 +1,45 @@
1
+ import type { Command as Program } from 'commander';
2
+ /**
3
+ * Commander option bag for opting out of every interactive question.
4
+ *
5
+ * @private internal utility of `promptbookCli`
6
+ */
7
+ export type QuestionsCliOptions = {
8
+ readonly questions: boolean;
9
+ };
10
+ /**
11
+ * Normalized interactive-questions option shared by every `ptbk coder` command which can ask something.
12
+ *
13
+ * @private internal utility of `promptbookCli`
14
+ */
15
+ export type NormalizedQuestionsCliOptions = {
16
+ readonly isAskingQuestionsEnabled: boolean;
17
+ };
18
+ /**
19
+ * Description block shared by the `ptbk coder` commands which can ask interactive questions.
20
+ *
21
+ * @private internal utility of `promptbookCli`
22
+ */
23
+ export declare const QUESTIONS_DESCRIPTION: string;
24
+ /**
25
+ * Registers the shared `--no-questions` option on a `ptbk coder` command which can ask interactive questions.
26
+ *
27
+ * @private internal utility of `promptbookCli`
28
+ */
29
+ export declare function addQuestionsOption(command: Program): void;
30
+ /**
31
+ * Converts the Commander questions flag into the normalized interactive-questions option.
32
+ *
33
+ * @private internal utility of `promptbookCli`
34
+ */
35
+ export declare function normalizeQuestionsCliOptions(cliOptions: QuestionsCliOptions): NormalizedQuestionsCliOptions;
36
+ /**
37
+ * Asserts that a command which waits for a user confirmation before each prompt is allowed to ask for it.
38
+ *
39
+ * @throws {NotAllowed} when `--no-auto` is combined with `--no-questions`
40
+ * @private internal utility of `promptbookCli`
41
+ */
42
+ export declare function assertUserConfirmationIsAllowed(options: {
43
+ readonly isAskingQuestionsEnabled: boolean;
44
+ readonly isWaitingForUser: boolean;
45
+ }): void;
@@ -3,6 +3,9 @@ import type { $side_effect } from '../../utils/organization/$side_effect';
3
3
  /**
4
4
  * Marks one CLI command as deprecated while keeping it available for existing callers.
5
5
  *
6
+ * Deprecated commands are not advertised anymore - they are hidden from the list of commands in the help of their
7
+ * parent command, they warn when they are used and they explain the deprecation in their own help.
8
+ *
6
9
  * @private utility of CLI
7
10
  */
8
11
  export declare function $deprecateCliCommand(command: Command, deprecationMessage: string): $side_effect;
@@ -0,0 +1,11 @@
1
+ import type { Command } from 'commander';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
+ /**
4
+ * Keeps one already registered CLI command out of the help of its parent command while the command itself stays
5
+ * fully usable - it can still be run, it still has its own help and it is still reachable through `ptbk help <command>`.
6
+ *
7
+ * Note: `$` is used to indicate that this function is not a pure function - it changes how the CLI renders its help
8
+ *
9
+ * @private utility of CLI
10
+ */
11
+ export declare function $hideCliCommandFromHelp(command: Command): $side_effect;
@@ -0,0 +1,18 @@
1
+ import type { Command } from 'commander';
2
+ import type { $side_effect } from '../../utils/organization/$side_effect';
3
+ /**
4
+ * Makes one CLI command which only groups subcommands ask for a subcommand instead of doing anything on its own.
5
+ *
6
+ * Note: `$` is used to indicate that this function is not a pure function - it registers an action in the CLI
7
+ *
8
+ * @private utility of CLI
9
+ */
10
+ export declare function $requireCliSubcommand(command: Command): $side_effect;
11
+ /**
12
+ * Asks for a subcommand of one CLI command, prints its help and exits the process.
13
+ *
14
+ * Note: `$` is used to indicate that this function is not a pure function - it writes to the console and exits the process
15
+ *
16
+ * @private utility of CLI
17
+ */
18
+ export declare function $reportMissingCliSubcommand(command: Command): never;
@@ -0,0 +1 @@
1
+ export {};
@@ -17,7 +17,10 @@ export type VercelExecutionToolsOptions = CommonToolsOptions & Pick<LlmExecution
17
17
  */
18
18
  readonly availableModels: ReadonlyArray<AvailableModel>;
19
19
  /**
20
- * Additional settings for chat models when calling `vercelProvider.chat('model-name', settings)`
20
+ * Additional settings for chat models, for example `temperature` or `providerOptions`
21
+ *
22
+ * Note: Since Vercel AI SDK v5 these settings belong to the model call, not to
23
+ * `vercelProvider.chat('model-name')` which takes just the model name
21
24
  */
22
- readonly additionalChatSettings?: Partial<Parameters<VercelProvider['chat']>[1]>;
25
+ readonly additionalChatSettings?: Partial<Omit<Parameters<ReturnType<VercelProvider['chat']>['doGenerate']>[0], 'prompt'>>;
23
26
  };
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.114.0-32`).
18
+ * It follows semantic versioning (e.g., `0.114.0-34`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/types",
3
- "version": "0.114.0-33",
3
+ "version": "0.114.0-35",
4
4
  "description": "Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -90,12 +90,9 @@
90
90
  "node": ">=18.18.0",
91
91
  "npm": ">=8.0.0"
92
92
  },
93
- "overrides": {
94
- "zod": "$zod"
95
- },
96
93
  "types": "./esm/src/_packages/types.index.d.ts",
97
94
  "typings": "./esm/src/_packages/types.index.d.ts",
98
95
  "peerDependencies": {
99
- "@promptbook/core": "0.114.0-33"
96
+ "@promptbook/core": "0.114.0-35"
100
97
  }
101
98
  }