@promptbook/cli 0.112.0-102 → 0.112.0-103
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/apps/agents-server/README.md +0 -6
- package/apps/agents-server/src/app/admin/image-generator-test/ImageAttachmentsEditor.tsx +11 -6
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +13 -15
- package/apps/agents-server/src/app/admin/servers/useCreateServerWizard.ts +13 -14
- package/apps/agents-server/src/app/api/upload/route.ts +110 -383
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +52 -55
- package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +17 -49
- package/apps/agents-server/src/utils/cdn/classes/TrackedFilesStorage.ts +5 -2
- package/apps/agents-server/src/utils/cdn/interfaces/IFilesStorage.ts +5 -0
- package/apps/agents-server/src/utils/shareTargetPayloads.ts +15 -63
- package/apps/agents-server/src/utils/upload/createBookEditorUploadHandler.ts +23 -150
- package/apps/agents-server/src/utils/upload/uploadFileToServer.ts +113 -0
- package/esm/index.es.js +194 -35
- package/esm/index.es.js.map +1 -1
- package/esm/scripts/run-codex-prompts/common/waitForPause.d.ts +12 -0
- package/esm/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -1
- package/esm/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
- package/esm/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -1
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/book-components/Chat/MarkdownContent/MarkdownContent.tsx +1 -3
- package/src/other/templates/getTemplatesPipelineCollection.ts +737 -815
- package/src/version.ts +2 -2
- package/src/versions.txt +1 -0
- package/umd/index.umd.js +194 -35
- package/umd/index.umd.js.map +1 -1
- package/umd/scripts/run-codex-prompts/common/waitForPause.d.ts +12 -0
- package/umd/scripts/run-codex-prompts/main/runPromptRound.d.ts +2 -1
- package/umd/scripts/run-codex-prompts/ui/buildCoderRunUiFrame.d.ts +1 -0
- package/umd/scripts/run-codex-prompts/ui/buildRunUiFrameShared.d.ts +1 -1
- package/umd/src/version.d.ts +1 -1
- package/apps/agents-server/src/utils/cdn/resolveCdnStorageProvider.ts +0 -40
|
@@ -41,12 +41,6 @@ ptbk agents-server start --agent github-copilot --model gpt-5.4 --thinking-level
|
|
|
41
41
|
<a id="agents-server-env-admin-password"></a>
|
|
42
42
|
- `ADMIN_PASSWORD`: Password for the built-in `admin` login on a self-hosted Agents Server. Choose a private value before using the admin UI.
|
|
43
43
|
|
|
44
|
-
<a id="agents-server-env-next-public-cdn-storage-provider"></a>
|
|
45
|
-
- `NEXT_PUBLIC_CDN_STORAGE_PROVIDER`: File storage provider for uploads. Use `s3` for S3-compatible storage such as the VPS installer's self-contained MinIO service or external S3, and `vercel` for Vercel Blob.
|
|
46
|
-
|
|
47
|
-
<a id="agents-server-env-s3-cdn"></a>
|
|
48
|
-
- `CDN_BUCKET`, `CDN_ENDPOINT`, `CDN_ACCESS_KEY_ID`, `CDN_SECRET_ACCESS_KEY`, `NEXT_PUBLIC_CDN_PUBLIC_URL`, and `NEXT_PUBLIC_CDN_PATH_PREFIX`: S3-compatible upload configuration used when `NEXT_PUBLIC_CDN_STORAGE_PROVIDER=s3`.
|
|
49
|
-
|
|
50
44
|
## Creating servers
|
|
51
45
|
|
|
52
46
|
When creating new Agents server, search across the repository for [☁]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { upload } from '@vercel/blob/client';
|
|
2
1
|
import { useCallback, useRef, useState, type ChangeEvent } from 'react';
|
|
3
2
|
import { showAlert } from '../../../components/AsyncDialogs/asyncDialogs';
|
|
4
3
|
import { getSafeCdnPath } from '../../../utils/cdn/utils/getSafeCdnPath';
|
|
5
4
|
import { normalizeUploadFilename } from '../../../utils/normalization/normalizeUploadFilename';
|
|
5
|
+
import { uploadFileToServer } from '../../../utils/upload/uploadFileToServer';
|
|
6
6
|
import type { UseImageGeneratorTestState } from './useImageGeneratorTestState';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -36,17 +36,22 @@ async function uploadImageAttachment(
|
|
|
36
36
|
file: File,
|
|
37
37
|
): Promise<UseImageGeneratorTestState['prompts'][number]['attachments'][number]> {
|
|
38
38
|
const normalizedFilename = normalizeUploadFilename(file.name);
|
|
39
|
-
const uploadPath = getSafeCdnPath({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const uploadPath = getSafeCdnPath({
|
|
40
|
+
pathname: normalizedFilename,
|
|
41
|
+
pathPrefix: process.env.NEXT_PUBLIC_CDN_PATH_PREFIX,
|
|
42
|
+
});
|
|
43
|
+
const uploadResult = await uploadFileToServer({
|
|
44
|
+
file,
|
|
45
|
+
pathname: uploadPath,
|
|
46
|
+
purpose: 'IMAGE_GENERATOR_TEST_ATTACHMENT',
|
|
47
|
+
contentType: file.type,
|
|
43
48
|
});
|
|
44
49
|
|
|
45
50
|
return {
|
|
46
51
|
id: createAttachmentIdentifier(),
|
|
47
52
|
name: file.name,
|
|
48
53
|
type: file.type,
|
|
49
|
-
url:
|
|
54
|
+
url: uploadResult.url,
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { upload } from '@vercel/blob/client';
|
|
4
3
|
import { FileTextIcon, HashIcon, ImageIcon, ListIcon, ShieldIcon, ToggleLeftIcon, TypeIcon, Upload } from 'lucide-react';
|
|
5
4
|
import Link from 'next/link';
|
|
6
5
|
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
@@ -8,6 +7,7 @@ import { showConfirm } from '../../../components/AsyncDialogs/asyncDialogs';
|
|
|
8
7
|
import { getMetadataDefinition, metadataDefaults, type MetadataDefinition } from '../../../database/metadataDefaults';
|
|
9
8
|
import { getSafeCdnPath } from '../../../utils/cdn/utils/getSafeCdnPath';
|
|
10
9
|
import { normalizeUploadFilename } from '../../../utils/normalization/normalizeUploadFilename';
|
|
10
|
+
import { buildDefaultUserFileUploadPath, uploadFileToServer } from '../../../utils/upload/uploadFileToServer';
|
|
11
11
|
import { getDeprecatedLimitMetadataDefinition, type DeprecatedLimitMetadataDefinition } from '../../../constants/serverLimits';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -502,23 +502,21 @@ export function MetadataClient() {
|
|
|
502
502
|
try {
|
|
503
503
|
setUploading(true);
|
|
504
504
|
|
|
505
|
-
const pathPrefix = process.env.NEXT_PUBLIC_CDN_PATH_PREFIX || '';
|
|
506
505
|
const normalizedFilename = normalizeUploadFilename(file.name);
|
|
507
|
-
const uploadPath =
|
|
508
|
-
|
|
509
|
-
:
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
const blob = await upload(safeUploadPath, file, {
|
|
513
|
-
access: 'public',
|
|
514
|
-
handleUploadUrl: '/api/upload',
|
|
515
|
-
clientPayload: JSON.stringify({
|
|
516
|
-
purpose: formState.key || 'METADATA_IMAGE',
|
|
517
|
-
contentType: file.type,
|
|
518
|
-
}),
|
|
506
|
+
const uploadPath = buildDefaultUserFileUploadPath(normalizedFilename);
|
|
507
|
+
const safeUploadPath = getSafeCdnPath({
|
|
508
|
+
pathname: uploadPath,
|
|
509
|
+
pathPrefix: process.env.NEXT_PUBLIC_CDN_PATH_PREFIX,
|
|
519
510
|
});
|
|
520
511
|
|
|
521
|
-
const
|
|
512
|
+
const uploadResult = await uploadFileToServer({
|
|
513
|
+
file,
|
|
514
|
+
pathname: safeUploadPath,
|
|
515
|
+
purpose: formState.key || 'METADATA_IMAGE',
|
|
516
|
+
contentType: file.type,
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
const fileUrl = uploadResult.url;
|
|
522
520
|
|
|
523
521
|
const LONG_URL = `${process.env.NEXT_PUBLIC_CDN_PUBLIC_URL!}/${process.env
|
|
524
522
|
.NEXT_PUBLIC_CDN_PATH_PREFIX!}/user/files/`;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { upload } from '@vercel/blob/client';
|
|
4
3
|
import { useCallback, useMemo, useRef, useState, type ChangeEvent, type RefObject } from 'react';
|
|
5
4
|
import { showAlert } from '../../../components/AsyncDialogs/asyncDialogs';
|
|
6
5
|
import { useDirtyModalGuard } from '../../../components/utils/useDirtyModalGuard';
|
|
@@ -8,6 +7,7 @@ import { buildServerTablePrefix } from '../../../utils/buildServerTablePrefix';
|
|
|
8
7
|
import type { ChatFeedbackMode } from '../../../utils/chatFeedbackMode';
|
|
9
8
|
import { getSafeCdnPath } from '../../../utils/cdn/utils/getSafeCdnPath';
|
|
10
9
|
import { normalizeUploadFilename } from '../../../utils/normalization/normalizeUploadFilename';
|
|
10
|
+
import { buildDefaultUserFileUploadPath, uploadFileToServer } from '../../../utils/upload/uploadFileToServer';
|
|
11
11
|
import type { ManagedServerEnvironment } from './useServersRegistryState';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -425,22 +425,21 @@ export function useCreateServerWizard(options: UseCreateServerWizardOptions): Us
|
|
|
425
425
|
setIsUploadingIcon(true);
|
|
426
426
|
setWizardError(null);
|
|
427
427
|
|
|
428
|
-
const pathPrefix = process.env.NEXT_PUBLIC_CDN_PATH_PREFIX || '';
|
|
429
428
|
const normalizedFilename = normalizeUploadFilename(file.name);
|
|
430
|
-
const uploadPath =
|
|
431
|
-
|
|
432
|
-
:
|
|
433
|
-
|
|
434
|
-
const blob = await upload(getSafeCdnPath({ pathname: uploadPath }), file, {
|
|
435
|
-
access: 'public',
|
|
436
|
-
handleUploadUrl: '/api/upload',
|
|
437
|
-
clientPayload: JSON.stringify({
|
|
438
|
-
purpose: 'SERVER_ICON',
|
|
439
|
-
contentType: file.type,
|
|
440
|
-
}),
|
|
429
|
+
const uploadPath = buildDefaultUserFileUploadPath(normalizedFilename);
|
|
430
|
+
const safeUploadPath = getSafeCdnPath({
|
|
431
|
+
pathname: uploadPath,
|
|
432
|
+
pathPrefix: process.env.NEXT_PUBLIC_CDN_PATH_PREFIX,
|
|
441
433
|
});
|
|
442
434
|
|
|
443
|
-
|
|
435
|
+
const uploadResult = await uploadFileToServer({
|
|
436
|
+
file,
|
|
437
|
+
pathname: safeUploadPath,
|
|
438
|
+
purpose: 'SERVER_ICON',
|
|
439
|
+
contentType: file.type,
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
updateWizardField('iconUrl', uploadResult.url);
|
|
444
443
|
} catch (uploadError) {
|
|
445
444
|
setWizardError({
|
|
446
445
|
message: uploadError instanceof Error ? uploadError.message : 'Failed to upload the server icon.',
|