@promptbook/cli 0.114.0-34 → 0.114.0-38

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 (41) hide show
  1. package/apps/agents-server/package.json +1 -1
  2. package/apps/agents-server/scripts/build-agents-server.js +4 -0
  3. package/apps/agents-server/scripts/build-e2e.js +1 -1
  4. package/apps/agents-server/src/app/swagger/SwaggerPageClient.tsx +35 -19
  5. package/apps/agents-server/src/types/swagger-ui-dist.d.ts +5 -0
  6. package/esm/index.es.js +363 -98
  7. package/esm/index.es.js.map +1 -1
  8. package/esm/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +7 -0
  9. package/esm/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +5 -8
  10. package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -4
  11. package/esm/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -17
  12. package/esm/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +3 -15
  13. package/esm/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +14 -1
  14. package/esm/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +2 -9
  15. package/esm/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
  16. package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  17. package/esm/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
  18. package/esm/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  19. package/esm/src/version.d.ts +1 -1
  20. package/package.json +2 -3
  21. package/src/book-2.0/agent-source/createAgentModelRequirementsWithCommitments.ts +3 -2
  22. package/src/book-2.0/agent-source/deduplicateSystemMessage.ts +327 -0
  23. package/src/cli/$initializePromptbookCliProgram.ts +87 -0
  24. package/src/cli/promptbookCli.ts +2 -87
  25. package/src/other/templates/getTemplatesPipelineCollection.ts +903 -663
  26. package/src/version.ts +2 -2
  27. package/src/versions.txt +4 -0
  28. package/umd/index.umd.js +363 -98
  29. package/umd/index.umd.js.map +1 -1
  30. package/umd/scripts/run-codex-prompts/common/resolveCoderAgent.d.ts +7 -0
  31. package/umd/scripts/run-codex-prompts/main/resolvePromptRunner.d.ts +5 -8
  32. package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -4
  33. package/umd/scripts/run-codex-prompts/prompts/buildPromptRunTraceContent.d.ts +5 -17
  34. package/umd/scripts/run-codex-prompts/prompts/buildPromptStatusDetails.d.ts +3 -15
  35. package/umd/scripts/run-codex-prompts/prompts/formatRunnerSignature.d.ts +14 -1
  36. package/umd/scripts/run-codex-prompts/prompts/markPromptFailed.d.ts +2 -9
  37. package/umd/src/book-2.0/agent-source/createAgentModelRequirements.deduplication.test.d.ts +1 -0
  38. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.d.ts +14 -0
  39. package/umd/src/book-2.0/agent-source/deduplicateSystemMessage.test.d.ts +1 -0
  40. package/umd/src/cli/$initializePromptbookCliProgram.d.ts +8 -0
  41. package/umd/src/version.d.ts +1 -1
@@ -8,7 +8,7 @@
8
8
  "test": "npm run test-e2e",
9
9
  "test-e2e": "node ./scripts/run-e2e-tests.js",
10
10
  "pretest-build": "node ./scripts/kill-port.js 4021 4440",
11
- "test-build": "npm run build",
11
+ "test-build": "npm run build -- --no-sentry-upload",
12
12
  "pretest-e2e": "node ./scripts/kill-port.js 4021 4440",
13
13
  "build": "node ./scripts/build-agents-server.js",
14
14
  "build-e2e": "node ./scripts/build-e2e.js",
@@ -25,6 +25,8 @@ const AGENTS_SERVER_BUILD_MAX_OLD_SPACE_MIB = 8192;
25
25
  * lint command has already completed successfully. The optional `--no-homepage-prerender`
26
26
  * argument is used by builds whose caller starts the very same production server right
27
27
  * afterwards, which makes the extra prerender server a repetition of that work.
28
+ * Test builds pass `--no-sentry-upload` to avoid publishing source maps and creating
29
+ * temporary upload bundles with credentials from the local `.env` file.
28
30
  */
29
31
  function buildAgentsServer() {
30
32
  const nextBuildArguments = [
@@ -44,6 +46,8 @@ function buildAgentsServer() {
44
46
  // the build process which spawned it. The same merge is done for the CLI-owned
45
47
  // production build in `src/cli/cli-commands/agents-server/buildAgentsServer/runNextBuild.ts`.
46
48
  NODE_OPTIONS: mergeNodeOptionsWithHeapSize(process.env.NODE_OPTIONS, AGENTS_SERVER_BUILD_MAX_OLD_SPACE_MIB),
49
+ // An empty value also prevents Next.js from loading an upload token from `.env`.
50
+ ...(process.argv.includes('--no-sentry-upload') ? { SENTRY_AUTH_TOKEN: '' } : {}),
47
51
  });
48
52
 
49
53
  if (!process.argv.includes('--no-homepage-prerender')) {
@@ -17,7 +17,7 @@ const APP_ROOT = path.resolve(__dirname, '..');
17
17
  * is compiled, and the tests open the homepage against that very same server, so the snapshot would
18
18
  * only repeat work the tests already do.
19
19
  */
20
- const E2E_BUILD_ARGUMENTS = ['--no-homepage-prerender'];
20
+ const E2E_BUILD_ARGUMENTS = ['--no-homepage-prerender', '--no-sentry-upload'];
21
21
 
22
22
  /**
23
23
  * Builds the production bundle used by the Agents Server E2E tests.
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { type ComponentType, useEffect, useState } from 'react';
4
- import 'swagger-ui-react/swagger-ui.css';
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import 'swagger-ui-dist/swagger-ui.css';
5
5
  import { SwaggerApiKeysPanel } from './SwaggerApiKeysPanel';
6
6
 
7
7
  /**
@@ -18,26 +18,43 @@ type SwaggerPageClientProps = {
18
18
  * Renders the runtime-generated Swagger UI and the compact API-key helper panel.
19
19
  */
20
20
  export function SwaggerPageClient({ isAdmin }: SwaggerPageClientProps) {
21
- const [SwaggerUI, setSwaggerUI] = useState<ComponentType<{
22
- url: string;
23
- persistAuthorization?: boolean;
24
- defaultModelsExpandDepth?: number;
25
- docExpansion?: 'list' | 'full' | 'none';
26
- }> | null>(null);
21
+ const containerRef = useRef<HTMLDivElement>(null);
22
+ const [isLoading, setIsLoading] = useState(true);
23
+ const [hasLoadError, setHasLoadError] = useState(false);
27
24
 
28
25
  useEffect(() => {
29
26
  let isMounted = true;
27
+ const container = containerRef.current;
30
28
 
31
29
  void (async () => {
32
- const swaggerUiModule = await import('swagger-ui-react');
30
+ try {
31
+ // Import the browser bundle directly; the package entry point also imports Node.js helpers.
32
+ const { default: SwaggerUIBundle } = await import('swagger-ui-dist/swagger-ui-bundle.js');
33
33
 
34
- if (isMounted) {
35
- setSwaggerUI(() => swaggerUiModule.default);
34
+ if (!isMounted || !container) {
35
+ return;
36
+ }
37
+
38
+ SwaggerUIBundle({
39
+ domNode: container,
40
+ url: '/openapi.json',
41
+ persistAuthorization: true,
42
+ defaultModelsExpandDepth: -1,
43
+ docExpansion: 'list',
44
+ });
45
+ setIsLoading(false);
46
+ } catch (error) {
47
+ if (isMounted) {
48
+ console.error('Failed to load Swagger UI:', error);
49
+ setHasLoadError(true);
50
+ setIsLoading(false);
51
+ }
36
52
  }
37
53
  })();
38
54
 
39
55
  return () => {
40
56
  isMounted = false;
57
+ container?.replaceChildren();
41
58
  };
42
59
  }, []);
43
60
 
@@ -47,16 +64,15 @@ export function SwaggerPageClient({ isAdmin }: SwaggerPageClientProps) {
47
64
  <SwaggerApiKeysPanel isAdmin={isAdmin} />
48
65
  </div>
49
66
  <div className="swagger-container bg-white min-h-screen">
50
- {SwaggerUI ? (
51
- <SwaggerUI
52
- url="/openapi.json"
53
- persistAuthorization
54
- defaultModelsExpandDepth={-1}
55
- docExpansion="list"
56
- />
57
- ) : (
67
+ {isLoading && (
58
68
  <div className="mx-auto max-w-7xl px-4 py-10 text-sm text-slate-500">Loading Swagger UI...</div>
59
69
  )}
70
+ {hasLoadError && (
71
+ <div role="alert" className="mx-auto max-w-7xl px-4 py-10 text-sm text-red-600">
72
+ Failed to load Swagger UI. Please reload the page.
73
+ </div>
74
+ )}
75
+ <div ref={containerRef} />
60
76
  </div>
61
77
  </div>
62
78
  );
@@ -0,0 +1,5 @@
1
+ declare module 'swagger-ui-dist/swagger-ui-bundle.js' {
2
+ import { SwaggerUIBundle } from 'swagger-ui-dist';
3
+
4
+ export default SwaggerUIBundle;
5
+ }