@promptbook/cli 0.112.0-110 → 0.112.0-112

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 (44) hide show
  1. package/apps/agents-server/src/app/admin/servers/CreateServerDialog.tsx +16 -0
  2. package/apps/agents-server/src/app/admin/servers/useCreateServerWizard.ts +31 -5
  3. package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +7 -5
  4. package/apps/agents-server/src/app/agents/[agentName]/api/user-chats/[chatId]/stream/route.ts +4 -86
  5. package/apps/agents-server/src/app/api/admin/servers/route.ts +5 -0
  6. package/apps/agents-server/src/app/api/metadata/route.ts +4 -0
  7. package/apps/agents-server/src/components/ApplicationErrorPage/ApplicationErrorPage.tsx +118 -12
  8. package/apps/agents-server/src/database/customJavascript.ts +62 -1
  9. package/apps/agents-server/src/database/customStylesheet.ts +60 -1
  10. package/apps/agents-server/src/database/getMetadata.ts +84 -3
  11. package/apps/agents-server/src/instrumentation.ts +3 -0
  12. package/apps/agents-server/src/utils/agentRouting/resolveAgentRouteTarget.ts +27 -62
  13. package/apps/agents-server/src/utils/errorReporting/applicationErrorHandling.ts +45 -0
  14. package/apps/agents-server/src/utils/errorReporting/refreshApplicationDocument.ts +10 -0
  15. package/apps/agents-server/src/utils/errorReporting/registerServerErrorSentryLogging.ts +331 -0
  16. package/apps/agents-server/src/utils/errorReporting/sendApplicationErrorReportToSentry.ts +8 -153
  17. package/apps/agents-server/src/utils/errorReporting/sentryStore.ts +177 -0
  18. package/apps/agents-server/src/utils/importAgent.ts +1 -57
  19. package/apps/agents-server/src/utils/importAgentWithFallback.ts +0 -10
  20. package/apps/agents-server/src/utils/serverManagement/createManagedServer/bootstrapManagedServer.ts +3 -1
  21. package/apps/agents-server/src/utils/serverManagement/createManagedServer/normalizeCreateServerInput.ts +6 -0
  22. package/apps/agents-server/src/utils/serverManagement/createManagedServer/seedServerDefaultAgents.ts +7 -3
  23. package/apps/agents-server/src/utils/serverManagement/createManagedServer.ts +5 -0
  24. package/apps/agents-server/src/utils/userChat/listUserChats.ts +109 -0
  25. package/apps/agents-server/src/utils/userChat.ts +0 -1
  26. package/esm/index.es.js +39 -13
  27. package/esm/index.es.js.map +1 -1
  28. package/esm/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +2 -1
  29. package/esm/src/cli/cli-commands/agents-server/startAgentsServer.test.d.ts +1 -0
  30. package/esm/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
  31. package/esm/src/version.d.ts +1 -1
  32. package/package.json +1 -1
  33. package/src/cli/cli-commands/agents-server/startAgentsServer.ts +23 -2
  34. package/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.ts +91 -14
  35. package/src/other/templates/getTemplatesPipelineCollection.ts +801 -652
  36. package/src/version.ts +2 -2
  37. package/src/versions.txt +2 -0
  38. package/umd/index.umd.js +39 -13
  39. package/umd/index.umd.js.map +1 -1
  40. package/umd/src/cli/cli-commands/agents-server/startAgentsServer.d.ts +2 -1
  41. package/umd/src/cli/cli-commands/agents-server/startAgentsServer.test.d.ts +1 -0
  42. package/umd/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +22 -0
  43. package/umd/src/version.d.ts +1 -1
  44. package/apps/agents-server/src/utils/userChat/getUserChatRevision.ts +0 -145
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-110';
19
+ export const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version = '0.112.0-112';
20
20
 
21
21
  /**
22
22
  * Represents the version string of the Promptbook engine.
23
- * It follows semantic versioning (e.g., `0.112.0-109`).
23
+ * It follows semantic versioning (e.g., `0.112.0-111`).
24
24
  *
25
25
  * @generated
26
26
  */
package/src/versions.txt CHANGED
@@ -1144,3 +1144,5 @@
1144
1144
  0.112.0-108
1145
1145
  0.112.0-109
1146
1146
  0.112.0-110
1147
+ 0.112.0-111
1148
+ 0.112.0-112
package/umd/index.umd.js CHANGED
@@ -60,7 +60,7 @@
60
60
  * @generated
61
61
  * @see https://github.com/webgptorg/promptbook
62
62
  */
63
- const PROMPTBOOK_ENGINE_VERSION = '0.112.0-110';
63
+ const PROMPTBOOK_ENGINE_VERSION = '0.112.0-112';
64
64
  /**
65
65
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
66
66
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -34202,17 +34202,23 @@
34202
34202
  var _a;
34203
34203
  const delimiter = resolveShellHereDocumentDelimiter(CODEX_PROMPT_DELIMITER, options.prompt);
34204
34204
  const projectPath = toPosixPath(options.projectPath);
34205
- const loginMethodConfig = options.allowCredits
34206
- ? 'CODEX_LOGIN_METHOD_ARGUMENTS=()'
34207
- : spaceTrim(`
34208
- CODEX_LOGIN_METHOD_ARGUMENTS=(-c forced_login_method=chatgpt)
34209
- if [ "\${PTBK_OPENAI_CODEX_USE_API_KEY:-0}" = "1" ] && [ -n "\${OPENAI_API_KEY:-}" ]; then
34210
- CODEX_LOGIN_METHOD_ARGUMENTS=()
34211
- fi
34212
- `);
34205
+ const loginMethodConfig = spaceTrim(`
34206
+ ${options.allowCredits ? 'CODEX_LOGIN_METHOD_ARGUMENTS=()' : 'CODEX_LOGIN_METHOD_ARGUMENTS=(-c forced_login_method=chatgpt)'}
34207
+ CODEX_USE_API_KEY="\${PTBK_OPENAI_CODEX_USE_API_KEY:-}"
34208
+ if [ -z "\$CODEX_USE_API_KEY" ] && [ -n "\${OPENAI_API_KEY:-}" ]; then
34209
+ CODEX_USE_API_KEY=1
34210
+ fi
34211
+ if [ "\$CODEX_USE_API_KEY" = "1" ] && [ -n "\${OPENAI_API_KEY:-}" ]; then
34212
+ CODEX_LOGIN_METHOD_ARGUMENTS=(-c forced_login_method=api)
34213
+ fi
34214
+ `);
34213
34215
  const thinkingLevel = (_a = options.thinkingLevel) !== null && _a !== void 0 ? _a : DEFAULT_CODEX_THINKING_LEVEL;
34214
34216
  const lines = [
34215
- 'if [ -f .env ]; then',
34217
+ 'if [ -n "${PTBK_AGENTS_SERVER_ENV_FILE:-}" ] && [ -f "${PTBK_AGENTS_SERVER_ENV_FILE}" ]; then',
34218
+ 'set -a',
34219
+ 'source "${PTBK_AGENTS_SERVER_ENV_FILE}"',
34220
+ 'set +a',
34221
+ 'elif [ -f .env ]; then',
34216
34222
  'set -a',
34217
34223
  'source .env',
34218
34224
  'set +a',
@@ -34220,7 +34226,7 @@
34220
34226
  '',
34221
34227
  loginMethodConfig,
34222
34228
  '',
34223
- 'if [ "${PTBK_OPENAI_CODEX_USE_API_KEY:-0}" != "1" ] || [ -z "${OPENAI_API_KEY:-}" ]; then',
34229
+ 'if [ "${CODEX_USE_API_KEY:-0}" != "1" ] || [ -z "${OPENAI_API_KEY:-}" ]; then',
34224
34230
  'unset OPENAI_API_KEY',
34225
34231
  'unset OPENAI_BASE_URL',
34226
34232
  'fi',
@@ -37274,6 +37280,12 @@
37274
37280
  * @private internal constant of `ptbk agents-server`
37275
37281
  */
37276
37282
  const PTBK_HOSTNAME_ENV = 'PTBK_HOSTNAME';
37283
+ /**
37284
+ * Explicit installed `.env` file passed by standalone VPS pm2/runtime launchers.
37285
+ *
37286
+ * @private internal constant of `ptbk agents-server`
37287
+ */
37288
+ const PTBK_AGENTS_SERVER_ENV_FILE_ENV = 'PTBK_AGENTS_SERVER_ENV_FILE';
37277
37289
  /**
37278
37290
  * Entropy size for the local-only token shared by the CLI pump and the Next app.
37279
37291
  *
@@ -37399,11 +37411,20 @@
37399
37411
  });
37400
37412
  }
37401
37413
  /**
37402
- * Loads launch-directory `.env` values without overriding explicit process environment.
37414
+ * Loads Agents Server runtime environment from the installed `.env` file when explicitly configured and falls back
37415
+ * to the launch-directory `.env`.
37403
37416
  *
37404
37417
  * @private internal utility of `ptbk agents-server`
37405
37418
  */
37406
37419
  function loadAgentsServerProjectEnvironment(launchWorkingDirectory) {
37420
+ var _a;
37421
+ const explicitEnvFilePath = (_a = process.env[PTBK_AGENTS_SERVER_ENV_FILE_ENV]) === null || _a === void 0 ? void 0 : _a.trim();
37422
+ if (explicitEnvFilePath) {
37423
+ const explicitLoadResult = dotenv__namespace.config({ path: explicitEnvFilePath, override: true });
37424
+ if (!explicitLoadResult.error) {
37425
+ return;
37426
+ }
37427
+ }
37407
37428
  dotenv__namespace.config({ path: path.join(launchWorkingDirectory, AGENTS_SERVER_PROJECT_ENV_FILE_NAME) });
37408
37429
  }
37409
37430
  /**
@@ -37429,7 +37450,12 @@
37429
37450
  var _a;
37430
37451
  const nextRuntimeModeLabel = describeAgentsServerNextRuntimeMode(options.options.nextRuntimeMode);
37431
37452
  logRunnerEvent(options.logStreams.runner, `Starting the Agents Server Next process in ${nextRuntimeModeLabel} mode.`);
37432
- const nextArguments = [options.nextCliPath, options.options.nextRuntimeMode, '--port', String(options.options.port)];
37453
+ const nextArguments = [
37454
+ options.nextCliPath,
37455
+ options.options.nextRuntimeMode,
37456
+ '--port',
37457
+ String(options.options.port),
37458
+ ];
37433
37459
  const hostname = (_a = options.childEnvironment[PTBK_HOSTNAME_ENV]) === null || _a === void 0 ? void 0 : _a.trim();
37434
37460
  if (hostname) {
37435
37461
  nextArguments.push('--hostname', hostname);