@webmaster-droid/server 0.1.0-alpha.0
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/dist/agent/index.d.ts +37 -0
- package/dist/agent/index.js +9 -0
- package/dist/api-aws/index.d.ts +6 -0
- package/dist/api-aws/index.js +11 -0
- package/dist/chunk-2LAI3MY2.js +620 -0
- package/dist/chunk-5CVLHGGO.js +672 -0
- package/dist/chunk-MLID7STX.js +412 -0
- package/dist/chunk-X6TU47KZ.js +1496 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +16 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +32 -0
- package/dist/service-BYwdlvCI.d.ts +47 -0
- package/dist/storage-s3/index.d.ts +49 -0
- package/dist/storage-s3/index.js +6 -0
- package/dist/types-OKJgq7Oo.d.ts +101 -0
- package/package.json +63 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { P as PatchApplicationOptions, f as PatchApplyResult, T as ThemeApplyResult, g as PatchValidationResult } from '../types-OKJgq7Oo.js';
|
|
2
|
+
export { A as AgentBatchMutationInput, a as AnyCmsDocument, C as CmsMutationInput, b as CmsServiceConfig, M as ModelAdapter, c as ModelAdapterInput, d as ModelAdapterOutput, e as MutationResult, S as StorageAdapter, h as ThemeMutationInput, i as ThemeMutationResult, j as ToolRegistry } from '../types-OKJgq7Oo.js';
|
|
3
|
+
import { CmsDocument, CmsPatch, ThemeTokenPatch } from '@webmaster-droid/contracts';
|
|
4
|
+
export { C as CmsService, c as createPatchFromAgentOperations, a as createThemePatchFromAgentOperations } from '../service-BYwdlvCI.js';
|
|
5
|
+
|
|
6
|
+
declare function validatePatch(patch: CmsPatch, source: CmsDocument, options: PatchApplicationOptions): PatchValidationResult;
|
|
7
|
+
declare function applyPatch(source: CmsDocument, patch: CmsPatch, options: PatchApplicationOptions): PatchApplyResult;
|
|
8
|
+
declare function applyThemeTokenPatch(source: CmsDocument, patch: ThemeTokenPatch): ThemeApplyResult;
|
|
9
|
+
|
|
10
|
+
export { PatchApplicationOptions, PatchApplyResult, PatchValidationResult, ThemeApplyResult, applyPatch, applyThemeTokenPatch, validatePatch };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CmsService,
|
|
3
|
+
applyPatch,
|
|
4
|
+
applyThemeTokenPatch,
|
|
5
|
+
createPatchFromAgentOperations,
|
|
6
|
+
createThemePatchFromAgentOperations,
|
|
7
|
+
validatePatch
|
|
8
|
+
} from "../chunk-2LAI3MY2.js";
|
|
9
|
+
export {
|
|
10
|
+
CmsService,
|
|
11
|
+
applyPatch,
|
|
12
|
+
applyThemeTokenPatch,
|
|
13
|
+
createPatchFromAgentOperations,
|
|
14
|
+
createThemePatchFromAgentOperations,
|
|
15
|
+
validatePatch
|
|
16
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { A as AgentBatchMutationInput, a as AnyCmsDocument, C as CmsMutationInput, b as CmsServiceConfig, M as ModelAdapter, c as ModelAdapterInput, d as ModelAdapterOutput, e as MutationResult, P as PatchApplicationOptions, f as PatchApplyResult, g as PatchValidationResult, S as StorageAdapter, T as ThemeApplyResult, h as ThemeMutationInput, i as ThemeMutationResult, j as ToolRegistry } from './types-OKJgq7Oo.js';
|
|
2
|
+
export { applyPatch, applyThemeTokenPatch, validatePatch } from './core/index.js';
|
|
3
|
+
export { C as CmsService, c as createPatchFromAgentOperations, a as createThemePatchFromAgentOperations } from './service-BYwdlvCI.js';
|
|
4
|
+
export { S3CmsStorage } from './storage-s3/index.js';
|
|
5
|
+
export { AgentRunnerInput, AgentRunnerResult, StaticToolName, listStaticToolNames, runAgentTurn } from './agent/index.js';
|
|
6
|
+
export { handler, streamHandler } from './api-aws/index.js';
|
|
7
|
+
import '@webmaster-droid/contracts';
|
|
8
|
+
import '@aws-sdk/client-s3';
|
|
9
|
+
import 'aws-lambda';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handler,
|
|
3
|
+
streamHandler
|
|
4
|
+
} from "./chunk-5CVLHGGO.js";
|
|
5
|
+
import {
|
|
6
|
+
listStaticToolNames,
|
|
7
|
+
runAgentTurn
|
|
8
|
+
} from "./chunk-X6TU47KZ.js";
|
|
9
|
+
import {
|
|
10
|
+
CmsService,
|
|
11
|
+
applyPatch,
|
|
12
|
+
applyThemeTokenPatch,
|
|
13
|
+
createPatchFromAgentOperations,
|
|
14
|
+
createThemePatchFromAgentOperations,
|
|
15
|
+
validatePatch
|
|
16
|
+
} from "./chunk-2LAI3MY2.js";
|
|
17
|
+
import {
|
|
18
|
+
S3CmsStorage
|
|
19
|
+
} from "./chunk-MLID7STX.js";
|
|
20
|
+
export {
|
|
21
|
+
CmsService,
|
|
22
|
+
S3CmsStorage,
|
|
23
|
+
applyPatch,
|
|
24
|
+
applyThemeTokenPatch,
|
|
25
|
+
createPatchFromAgentOperations,
|
|
26
|
+
createThemePatchFromAgentOperations,
|
|
27
|
+
handler,
|
|
28
|
+
listStaticToolNames,
|
|
29
|
+
runAgentTurn,
|
|
30
|
+
streamHandler,
|
|
31
|
+
validatePatch
|
|
32
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as _webmaster_droid_contracts from '@webmaster-droid/contracts';
|
|
2
|
+
import { CmsDocument, ModelProviderConfig, PublishRequest, RollbackRequest, CmsPatch, ThemeTokenPatch } from '@webmaster-droid/contracts';
|
|
3
|
+
import { S as StorageAdapter, b as CmsServiceConfig, a as AnyCmsDocument, C as CmsMutationInput, e as MutationResult, A as AgentBatchMutationInput, h as ThemeMutationInput, i as ThemeMutationResult } from './types-OKJgq7Oo.js';
|
|
4
|
+
|
|
5
|
+
declare class CmsService {
|
|
6
|
+
private readonly storage;
|
|
7
|
+
private readonly modelConfig;
|
|
8
|
+
private readonly maxOperationsPerPatch;
|
|
9
|
+
private readonly allowedInternalPaths;
|
|
10
|
+
private readonly publicAssetBaseUrl;
|
|
11
|
+
private readonly publicAssetPrefix;
|
|
12
|
+
constructor(storage: StorageAdapter, config: CmsServiceConfig);
|
|
13
|
+
ensureInitialized(seed: AnyCmsDocument): Promise<void>;
|
|
14
|
+
getContent(stage: "live" | "draft"): Promise<CmsDocument>;
|
|
15
|
+
getModelConfig(): ModelProviderConfig;
|
|
16
|
+
getPublicAssetBaseUrl(): string | null;
|
|
17
|
+
saveGeneratedImage(input: {
|
|
18
|
+
targetPath: string;
|
|
19
|
+
data: Uint8Array;
|
|
20
|
+
contentType: string;
|
|
21
|
+
cacheControl?: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
key: string;
|
|
24
|
+
url: string;
|
|
25
|
+
}>;
|
|
26
|
+
mutateDraft(input: CmsMutationInput): Promise<MutationResult>;
|
|
27
|
+
mutateDraftBatch(input: AgentBatchMutationInput): Promise<MutationResult>;
|
|
28
|
+
mutateThemeTokens(input: ThemeMutationInput): Promise<ThemeMutationResult>;
|
|
29
|
+
publishDraft(input: PublishRequest, actor?: string): Promise<_webmaster_droid_contracts.PublishedVersionMeta>;
|
|
30
|
+
rollbackDraft(input: RollbackRequest, actor?: string): Promise<CmsDocument<Record<string, unknown>, Record<string, unknown>, string>>;
|
|
31
|
+
listHistory(): Promise<{
|
|
32
|
+
checkpoints: _webmaster_droid_contracts.CheckpointMeta[];
|
|
33
|
+
published: _webmaster_droid_contracts.PublishedVersionMeta[];
|
|
34
|
+
}>;
|
|
35
|
+
deleteCheckpoint(checkpointId: string): Promise<void>;
|
|
36
|
+
private createEvent;
|
|
37
|
+
}
|
|
38
|
+
declare function createPatchFromAgentOperations(operations: Array<{
|
|
39
|
+
path: string;
|
|
40
|
+
value: unknown;
|
|
41
|
+
}>): CmsPatch;
|
|
42
|
+
declare function createThemePatchFromAgentOperations(operations: Array<{
|
|
43
|
+
token: keyof ThemeTokenPatch;
|
|
44
|
+
value: string;
|
|
45
|
+
}>): ThemeTokenPatch;
|
|
46
|
+
|
|
47
|
+
export { CmsService as C, createThemePatchFromAgentOperations as a, createPatchFromAgentOperations as c };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import { CmsDocument, CmsStage, CheckpointMeta, PublishedVersionMeta, RollbackRequest, AuditEvent } from '@webmaster-droid/contracts';
|
|
3
|
+
import { S as StorageAdapter } from '../types-OKJgq7Oo.js';
|
|
4
|
+
|
|
5
|
+
interface S3CmsStorageOptions {
|
|
6
|
+
bucket: string;
|
|
7
|
+
region: string;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
client?: S3Client;
|
|
10
|
+
}
|
|
11
|
+
declare class S3CmsStorage implements StorageAdapter {
|
|
12
|
+
private readonly bucket;
|
|
13
|
+
private readonly client;
|
|
14
|
+
private readonly prefix;
|
|
15
|
+
constructor(options: S3CmsStorageOptions);
|
|
16
|
+
ensureInitialized(seed: CmsDocument): Promise<void>;
|
|
17
|
+
getContent(stage: CmsStage): Promise<CmsDocument>;
|
|
18
|
+
saveDraft(content: CmsDocument): Promise<void>;
|
|
19
|
+
saveLive(content: CmsDocument): Promise<void>;
|
|
20
|
+
putPublicAsset(input: {
|
|
21
|
+
key: string;
|
|
22
|
+
body: Uint8Array;
|
|
23
|
+
contentType: string;
|
|
24
|
+
cacheControl?: string;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
createCheckpoint(content: CmsDocument, input: {
|
|
27
|
+
createdBy?: string;
|
|
28
|
+
reason: string;
|
|
29
|
+
}): Promise<CheckpointMeta>;
|
|
30
|
+
deleteCheckpoint(id: string): Promise<boolean>;
|
|
31
|
+
listCheckpoints(): Promise<CheckpointMeta[]>;
|
|
32
|
+
publishDraft(input: {
|
|
33
|
+
content: CmsDocument;
|
|
34
|
+
createdBy?: string;
|
|
35
|
+
}): Promise<PublishedVersionMeta>;
|
|
36
|
+
listPublishedVersions(): Promise<PublishedVersionMeta[]>;
|
|
37
|
+
getSnapshot(input: RollbackRequest): Promise<CmsDocument | null>;
|
|
38
|
+
appendEvent(event: AuditEvent): Promise<void>;
|
|
39
|
+
private tryGetStage;
|
|
40
|
+
private saveStage;
|
|
41
|
+
private stageKey;
|
|
42
|
+
private putJson;
|
|
43
|
+
private listKeys;
|
|
44
|
+
private tryGetText;
|
|
45
|
+
private getText;
|
|
46
|
+
private isMissingKey;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { S3CmsStorage };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { CmsPatch, ThemeTokenPatch, CmsDocument, CmsStage, CheckpointMeta, PublishedVersionMeta, RollbackRequest, AuditEvent, ModelProviderConfig } from '@webmaster-droid/contracts';
|
|
2
|
+
|
|
3
|
+
type AnyCmsDocument = CmsDocument<object, object, string>;
|
|
4
|
+
interface StorageAdapter {
|
|
5
|
+
ensureInitialized(seed: AnyCmsDocument): Promise<void>;
|
|
6
|
+
getContent(stage: CmsStage): Promise<CmsDocument>;
|
|
7
|
+
saveDraft(content: CmsDocument): Promise<void>;
|
|
8
|
+
saveLive(content: CmsDocument): Promise<void>;
|
|
9
|
+
putPublicAsset(input: {
|
|
10
|
+
key: string;
|
|
11
|
+
body: Uint8Array;
|
|
12
|
+
contentType: string;
|
|
13
|
+
cacheControl?: string;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
createCheckpoint(content: CmsDocument, input: {
|
|
16
|
+
createdBy?: string;
|
|
17
|
+
reason: string;
|
|
18
|
+
}): Promise<CheckpointMeta>;
|
|
19
|
+
deleteCheckpoint(id: string): Promise<boolean>;
|
|
20
|
+
listCheckpoints(): Promise<CheckpointMeta[]>;
|
|
21
|
+
publishDraft(input: {
|
|
22
|
+
content: CmsDocument;
|
|
23
|
+
createdBy?: string;
|
|
24
|
+
}): Promise<PublishedVersionMeta>;
|
|
25
|
+
listPublishedVersions(): Promise<PublishedVersionMeta[]>;
|
|
26
|
+
getSnapshot(input: RollbackRequest): Promise<CmsDocument | null>;
|
|
27
|
+
appendEvent(event: AuditEvent): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
interface ModelAdapterInput {
|
|
30
|
+
modelId: string;
|
|
31
|
+
systemPrompt: string;
|
|
32
|
+
userPrompt: string;
|
|
33
|
+
context: {
|
|
34
|
+
document: CmsDocument;
|
|
35
|
+
editableScopeSummary: string[];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
interface ModelAdapterOutput {
|
|
39
|
+
text: string;
|
|
40
|
+
proposedPatch: CmsPatch;
|
|
41
|
+
thinking?: string[];
|
|
42
|
+
}
|
|
43
|
+
interface ModelAdapter {
|
|
44
|
+
providerName(): string;
|
|
45
|
+
generate(input: ModelAdapterInput): Promise<ModelAdapterOutput>;
|
|
46
|
+
}
|
|
47
|
+
interface ToolRegistry {
|
|
48
|
+
listToolNames(): string[];
|
|
49
|
+
}
|
|
50
|
+
interface CmsServiceConfig {
|
|
51
|
+
modelConfig: ModelProviderConfig;
|
|
52
|
+
maxOperationsPerPatch?: number;
|
|
53
|
+
allowedInternalPaths?: string[];
|
|
54
|
+
publicAssetBaseUrl?: string;
|
|
55
|
+
publicAssetPrefix?: string;
|
|
56
|
+
}
|
|
57
|
+
interface MutationResult {
|
|
58
|
+
document: CmsDocument;
|
|
59
|
+
checkpoint: CheckpointMeta;
|
|
60
|
+
warnings: string[];
|
|
61
|
+
}
|
|
62
|
+
interface ThemeMutationResult {
|
|
63
|
+
document: CmsDocument;
|
|
64
|
+
checkpoint: CheckpointMeta;
|
|
65
|
+
warnings: string[];
|
|
66
|
+
}
|
|
67
|
+
interface PatchValidationResult {
|
|
68
|
+
valid: boolean;
|
|
69
|
+
warnings: string[];
|
|
70
|
+
errors: string[];
|
|
71
|
+
}
|
|
72
|
+
interface PatchApplicationOptions {
|
|
73
|
+
maxOperationsPerPatch: number;
|
|
74
|
+
allowedInternalPaths: string[];
|
|
75
|
+
}
|
|
76
|
+
interface PatchApplyResult {
|
|
77
|
+
document: CmsDocument;
|
|
78
|
+
warnings: string[];
|
|
79
|
+
}
|
|
80
|
+
interface ThemeApplyResult {
|
|
81
|
+
document: CmsDocument;
|
|
82
|
+
warnings: string[];
|
|
83
|
+
}
|
|
84
|
+
interface CmsMutationInput {
|
|
85
|
+
patch: CmsPatch;
|
|
86
|
+
actor?: string;
|
|
87
|
+
reason: string;
|
|
88
|
+
}
|
|
89
|
+
interface ThemeMutationInput {
|
|
90
|
+
patch: ThemeTokenPatch;
|
|
91
|
+
actor?: string;
|
|
92
|
+
reason: string;
|
|
93
|
+
}
|
|
94
|
+
interface AgentBatchMutationInput {
|
|
95
|
+
patch?: CmsPatch;
|
|
96
|
+
themePatch?: ThemeTokenPatch;
|
|
97
|
+
actor?: string;
|
|
98
|
+
reason: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type { AgentBatchMutationInput as A, CmsMutationInput as C, ModelAdapter as M, PatchApplicationOptions as P, StorageAdapter as S, ThemeApplyResult as T, AnyCmsDocument as a, CmsServiceConfig as b, ModelAdapterInput as c, ModelAdapterOutput as d, MutationResult as e, PatchApplyResult as f, PatchValidationResult as g, ThemeMutationInput as h, ThemeMutationResult as i, ToolRegistry as j };
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webmaster-droid/server",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./core": {
|
|
13
|
+
"types": "./dist/core/index.d.ts",
|
|
14
|
+
"import": "./dist/core/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./storage-s3": {
|
|
17
|
+
"types": "./dist/storage-s3/index.d.ts",
|
|
18
|
+
"import": "./dist/storage-s3/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./agent": {
|
|
21
|
+
"types": "./dist/agent/index.d.ts",
|
|
22
|
+
"import": "./dist/agent/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./api-aws": {
|
|
25
|
+
"types": "./dist/api-aws/index.d.ts",
|
|
26
|
+
"import": "./dist/api-aws/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@ai-sdk/google": "^3.0.29",
|
|
37
|
+
"@ai-sdk/openai": "^3.0.29",
|
|
38
|
+
"@aws-sdk/client-s3": "^3.888.0",
|
|
39
|
+
"@webmaster-droid/contracts": "^0.1.0-alpha.2",
|
|
40
|
+
"ai": "^6.0.86",
|
|
41
|
+
"aws-lambda": "^1.0.7",
|
|
42
|
+
"jose": "^6.1.0",
|
|
43
|
+
"zod": "^4.3.6"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"build": "tsup src/index.ts src/core/index.ts src/storage-s3/index.ts src/agent/index.ts src/api-aws/index.ts --format esm --dts --clean"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/aws-lambda": "^8.10.160"
|
|
51
|
+
},
|
|
52
|
+
"description": "Unified backend runtime: core service, S3 storage, AI agent, and AWS API adapters.",
|
|
53
|
+
"license": "MIT",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "git+https://github.com/Slava-AV/webmaster-droid.git",
|
|
57
|
+
"directory": "packages/server"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/Slava-AV/webmaster-droid/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/Slava-AV/webmaster-droid#readme"
|
|
63
|
+
}
|