@promptbook/cli 0.114.0-10 → 0.114.0-12

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 (75) hide show
  1. package/apps/agents-server/src/app/admin/messages/MessagesClient.tsx +8 -1
  2. package/apps/agents-server/src/app/admin/messages/send-email/SendEmailClient.tsx +193 -63
  3. package/apps/agents-server/src/app/admin/messages/send-email/actions.ts +25 -28
  4. package/apps/agents-server/src/app/admin/messages/send-email/emailTesting.ts +153 -0
  5. package/apps/agents-server/src/app/admin/messages/send-email/emailTestingAccess.ts +30 -0
  6. package/apps/agents-server/src/app/admin/messages/send-email/page.tsx +18 -5
  7. package/apps/agents-server/src/app/api/internal/agent-goal-chat-planned-messages/route.ts +34 -7
  8. package/apps/agents-server/src/message-providers/email/stalwart/StalwartMessageProvider.ts +2 -1
  9. package/apps/agents-server/src/utils/email/agentEmailAddress.ts +14 -0
  10. package/apps/agents-server/src/utils/email/sendEmailThroughStalwart.ts +2 -1
  11. package/esm/index.es.js +404 -115
  12. package/esm/index.es.js.map +1 -1
  13. package/esm/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +25 -0
  14. package/esm/scripts/run-codex-prompts/common/runGoScript/$terminateLoggedBashProcessTree.d.ts +11 -0
  15. package/esm/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +4 -0
  16. package/esm/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  17. package/esm/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  18. package/esm/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
  19. package/esm/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  20. package/esm/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  21. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  22. package/esm/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  23. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  24. package/esm/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  25. package/esm/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -3
  26. package/esm/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +3 -2
  27. package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +29 -0
  28. package/esm/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts +1 -0
  29. package/esm/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  30. package/esm/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  31. package/esm/src/version.d.ts +1 -1
  32. package/package.json +1 -1
  33. package/src/book-2.0/agent-source/AgentSourceParseResult.ts +6 -0
  34. package/src/book-2.0/agent-source/ParsedUnknownCommitment.ts +29 -0
  35. package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments/augmentAgentModelRequirementsFromSource.ts +38 -1
  36. package/src/book-2.0/agent-source/getBookCommitmentLineType.ts +36 -0
  37. package/src/book-2.0/agent-source/parseAgentSourceWithCommitments.ts +128 -61
  38. package/src/book-components/BookEditor/BookEditorMonaco.tsx +6 -1
  39. package/src/book-components/BookEditor/BookEditorMonacoTokenization.ts +3 -1
  40. package/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.ts +50 -0
  41. package/src/cli/cli-commands/coder/boilerplateTemplates.ts +3 -15
  42. package/src/cli/cli-commands/coder/init.ts +11 -2
  43. package/src/cli/cli-commands/coder/ping.ts +11 -1
  44. package/src/cli/cli-commands/coder/run.ts +11 -2
  45. package/src/cli/cli-commands/coder/server.ts +11 -2
  46. package/src/cli/cli-commands/common/harness/$applyHarnessInstallationStatus.ts +5 -0
  47. package/src/cli/cli-commands/common/harness/$checkHarnessInstallation.ts +17 -5
  48. package/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.ts +6 -3
  49. package/src/cli/cli-commands/common/harness/HarnessInstallationStatus.ts +3 -2
  50. package/src/cli/cli-commands/common/harnessUpdateCliOptions.ts +49 -0
  51. package/src/executables/platforms/locateAppOnWindows.ts +12 -9
  52. package/src/other/templates/getTemplatesPipelineCollection.ts +881 -685
  53. package/src/version.ts +2 -2
  54. package/src/versions.txt +1 -0
  55. package/umd/index.umd.js +403 -114
  56. package/umd/index.umd.js.map +1 -1
  57. package/umd/scripts/run-codex-prompts/common/runGoScript/$spawnLoggedBashScript.d.ts +25 -0
  58. package/umd/scripts/run-codex-prompts/common/runGoScript/$terminateLoggedBashProcessTree.d.ts +11 -0
  59. package/umd/scripts/run-codex-prompts/common/runGoScript/scriptExecutionLog.d.ts +4 -0
  60. package/umd/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +5 -0
  61. package/umd/src/book-2.0/agent-source/ParsedUnknownCommitment.d.ts +26 -0
  62. package/umd/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.unknown.test.d.ts +1 -0
  63. package/umd/src/book-2.0/agent-source/getBookCommitmentLineType.d.ts +19 -0
  64. package/umd/src/book-2.0/agent-source/parseAgentSourceWithCommitments.unknown.test.d.ts +1 -0
  65. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.d.ts +28 -0
  66. package/umd/src/book-components/BookEditor/createUnknownCommitmentDiagnostics.test.d.ts +1 -0
  67. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.d.ts +3 -3
  68. package/umd/src/cli/cli-commands/common/harness/$checkHarnessInstallation.test.d.ts +1 -0
  69. package/umd/src/cli/cli-commands/common/harness/$ensureHarnessInstallations.d.ts +3 -3
  70. package/umd/src/cli/cli-commands/common/harness/HarnessInstallationStatus.d.ts +3 -2
  71. package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.d.ts +29 -0
  72. package/umd/src/cli/cli-commands/common/harnessUpdateCliOptions.test.d.ts +1 -0
  73. package/umd/src/executables/platforms/locateAppOnWindows.d.ts +1 -1
  74. package/umd/src/executables/platforms/locateAppOnWindows.test.d.ts +1 -0
  75. package/umd/src/version.d.ts +1 -1
@@ -6,11 +6,12 @@ import type { HarnessDefinition } from './HarnessDefinition';
6
6
  * - `up-to-date` the newest published version is installed
7
7
  * - `outdated` an older version is installed
8
8
  * - `not-installed` the harness command is not available globally
9
+ * - `installed` the harness is installed and automatic update checking was disabled
9
10
  * - `unknown` the harness is installed but the newest published version could not be resolved, for example when offline
10
11
  *
11
12
  * @private internal utility of `promptbookCli`
12
13
  */
13
- export type HarnessInstallationState = 'up-to-date' | 'outdated' | 'not-installed' | 'unknown';
14
+ export type HarnessInstallationState = 'up-to-date' | 'outdated' | 'not-installed' | 'installed' | 'unknown';
14
15
 
15
16
  /**
16
17
  * Installation state of one CLI coding harness on the current machine.
@@ -24,7 +25,7 @@ export type HarnessInstallationStatus = {
24
25
  readonly definition: HarnessDefinition;
25
26
 
26
27
  /**
27
- * Comparison of the installed version with the newest published one.
28
+ * Installation state, including whether the newest published version was checked.
28
29
  */
29
30
  readonly installationState: HarnessInstallationState;
30
31
 
@@ -0,0 +1,49 @@
1
+ import type {
2
+ Command as Program /* <- Note: [🔸] Using Program because Command is misleading name */,
3
+ } from 'commander';
4
+
5
+ /**
6
+ * Commander option bag for opting out of automatic coding-harness update checks.
7
+ *
8
+ * @private internal utility of `promptbookCli`
9
+ */
10
+ export type HarnessUpdateCliOptions = {
11
+ readonly harnessUpdate: boolean;
12
+ };
13
+
14
+ /**
15
+ * Normalized automatic coding-harness update-check option.
16
+ *
17
+ * @private internal utility of `promptbookCli`
18
+ */
19
+ export type NormalizedHarnessUpdateCliOptions = {
20
+ readonly isHarnessUpdateCheckEnabled: boolean;
21
+ };
22
+
23
+ /**
24
+ * Registers the shared `--no-harness-update` option on a `ptbk coder` command that uses a coding harness.
25
+ *
26
+ * @private internal utility of `promptbookCli`
27
+ */
28
+ export function addHarnessUpdateOption(command: Program): void {
29
+ command.option(
30
+ '--no-harness-update',
31
+ 'Skip checking whether globally installed coding harnesses are up to date',
32
+ );
33
+ }
34
+
35
+ /**
36
+ * Converts the Commander harness-update flag into the normalized harness-check option.
37
+ *
38
+ * @private internal utility of `promptbookCli`
39
+ */
40
+ export function normalizeHarnessUpdateCliOptions(
41
+ cliOptions: HarnessUpdateCliOptions,
42
+ ): NormalizedHarnessUpdateCliOptions {
43
+ return {
44
+ isHarnessUpdateCheckEnabled: cliOptions.harnessUpdate,
45
+ };
46
+ }
47
+
48
+ // Note: [🟡] Code for CLI harness update options [harnessUpdateCliOptions](src/cli/cli-commands/common/harnessUpdateCliOptions.ts) should never be published outside of `@promptbook/cli`
49
+ // Note: [💞] Ignore a discrepancy between file name and exported helper names
@@ -1,4 +1,4 @@
1
- import { join } from 'path';
1
+ import { delimiter, join } from 'path';
2
2
  import { assertsError } from '../../errors/assertsError';
3
3
  import { $provideFilesystemForNode } from '../../scrapers/_common/register/$provideFilesystemForNode';
4
4
  import type { string_executable_path } from '../../types/string_filename';
@@ -6,7 +6,7 @@ import { isExecutable } from '../../utils/files/isExecutable';
6
6
  import type { LocateAppOptions } from '../locateApp';
7
7
 
8
8
  /**
9
- * Attempts to locate the specified application on a Windows system by searching common installation directories.
9
+ * Attempts to locate the specified application on a Windows system by searching PATH and common installation directories.
10
10
  * Returns the path to the executable if found, or null otherwise.
11
11
  *
12
12
  * @private within the repository
@@ -16,18 +16,21 @@ export async function locateAppOnWindows({
16
16
  windowsSuffix,
17
17
  }: Pick<Required<LocateAppOptions>, 'appName' | 'windowsSuffix'>): Promise<string_executable_path | null> {
18
18
  try {
19
- const prefixes = [
19
+ const EXECUTABLE_FILENAME = windowsSuffix.replace(/^.*[\\/]/, '');
20
+ const PATH_EXECUTABLE_PATHS = (process.env.PATH || '')
21
+ .split(delimiter)
22
+ .filter(Boolean)
23
+ .map((pathPrefix) => join(pathPrefix, EXECUTABLE_FILENAME));
24
+ const INSTALLATION_EXECUTABLE_PATHS = [
20
25
  process.env.LOCALAPPDATA,
21
26
  join(process.env.LOCALAPPDATA || '', 'Programs'),
22
27
  process.env.PROGRAMFILES,
23
28
  process.env['PROGRAMFILES(X86)'],
24
- ];
29
+ ].map((pathPrefix) => pathPrefix + windowsSuffix);
25
30
 
26
- for (const prefix of prefixes) {
27
- const path = prefix + windowsSuffix;
28
-
29
- if (await isExecutable(path, $provideFilesystemForNode())) {
30
- return path;
31
+ for (const executablePath of [...PATH_EXECUTABLE_PATHS, ...INSTALLATION_EXECUTABLE_PATHS]) {
32
+ if (await isExecutable(executablePath, $provideFilesystemForNode())) {
33
+ return executablePath;
31
34
  }
32
35
  }
33
36