@agent-native/core 0.80.5 → 0.80.6
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +7 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/cli/create.ts +1 -0
- package/corpus/core/src/sharing/registry.ts +17 -0
- package/corpus/core/src/templates/default/pnpm-workspace.yaml +1 -0
- package/corpus/core/src/templates/workspace-root/pnpm-workspace.yaml +1 -0
- package/corpus/templates/content/AGENTS.md +45 -44
- package/corpus/templates/content/README.md +16 -0
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +125 -0
- package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +28 -6
- package/corpus/templates/content/actions/_builder-cms-write-adapter.ts +238 -69
- package/corpus/templates/content/actions/_builder-cms-write-settings.ts +125 -43
- package/corpus/templates/content/actions/_database-source-utils.ts +746 -97
- package/corpus/templates/content/actions/_database-utils.ts +17 -14
- package/corpus/templates/content/actions/_federation-join.ts +14 -2
- package/corpus/templates/content/actions/_join-suggestion.ts +89 -14
- package/corpus/templates/content/actions/_local-file-documents.ts +2 -1
- package/corpus/templates/content/actions/attach-content-database-source.ts +124 -5
- package/corpus/templates/content/actions/bind-content-database-source-field.ts +256 -0
- package/corpus/templates/content/actions/change-content-database-source-role.ts +420 -0
- package/corpus/templates/content/actions/create-document.ts +8 -0
- package/corpus/templates/content/actions/execute-builder-source-batch.ts +282 -0
- package/corpus/templates/content/actions/execute-builder-source-execution.ts +220 -8
- package/corpus/templates/content/actions/get-content-database.ts +10 -2
- package/corpus/templates/content/actions/prepare-builder-source-execution.ts +19 -2
- package/corpus/templates/content/actions/prepare-builder-source-review.ts +47 -15
- package/corpus/templates/content/actions/refresh-content-database-source.ts +11 -4
- package/corpus/templates/content/actions/review-content-database-source-change-set.ts +6 -2
- package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +32 -12
- package/corpus/templates/content/actions/stage-builder-revision.ts +14 -10
- package/corpus/templates/content/actions/validate-builder-source-execution.ts +25 -3
- package/corpus/templates/content/app/components/editor/DocumentDatabase.tsx +1520 -553
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +150 -1
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +647 -66
- package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +543 -204
- package/corpus/templates/content/app/hooks/use-content-database.ts +62 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +64 -0
- package/corpus/templates/content/app/i18n-data.ts +784 -0
- package/corpus/templates/content/changelog/2026-06-29-builder-review-checks-now-preserve-publish-and-unpublish-cho.md +6 -0
- package/corpus/templates/content/changelog/2026-06-29-database-sources-can-now-be-added-as-more-rows-or-matched.md +6 -0
- package/corpus/templates/content/changelog/2026-06-29-fixed-loading-the-final-rows-in-larger-databases-without-bre.md +6 -0
- package/corpus/templates/content/shared/api.ts +91 -1
- package/corpus/templates/content/vite.config.ts +14 -7
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +1 -0
- package/dist/cli/create.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/sharing/registry.d.ts.map +1 -1
- package/dist/sharing/registry.js +11 -0
- package/dist/sharing/registry.js.map +1 -1
- package/dist/templates/default/pnpm-workspace.yaml +1 -0
- package/dist/templates/workspace-root/pnpm-workspace.yaml +1 -0
- package/package.json +1 -1
- package/src/templates/default/pnpm-workspace.yaml +1 -0
- package/src/templates/workspace-root/pnpm-workspace.yaml +1 -0
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
BUILDER_CMS_SAFE_WRITE_MODEL,
|
|
3
3
|
type ContentDatabaseSourceCapabilities,
|
|
4
4
|
type ContentDatabaseSourcePushMode,
|
|
5
|
+
type ContentDatabaseSourceWriteMode,
|
|
5
6
|
} from "../shared/api.js";
|
|
6
7
|
|
|
7
8
|
export type BuilderCmsLiveWriteMode = Exclude<
|
|
@@ -14,7 +15,9 @@ export interface BuilderCmsWriteSettingsPatch {
|
|
|
14
15
|
sourceTable: string;
|
|
15
16
|
capabilitiesJson: string;
|
|
16
17
|
metadataJson: string;
|
|
17
|
-
liveWritesEnabled
|
|
18
|
+
liveWritesEnabled?: boolean;
|
|
19
|
+
writeMode?: ContentDatabaseSourceWriteMode;
|
|
20
|
+
allowPublicationTransitions?: boolean;
|
|
18
21
|
allowedWriteModes?: BuilderCmsLiveWriteMode[];
|
|
19
22
|
allowDraftWrites?: boolean;
|
|
20
23
|
allowPublishWrites?: boolean;
|
|
@@ -40,6 +43,16 @@ function normalizeMode(value: unknown): BuilderCmsLiveWriteMode | null {
|
|
|
40
43
|
: null;
|
|
41
44
|
}
|
|
42
45
|
|
|
46
|
+
function normalizeWriteMode(
|
|
47
|
+
value: unknown,
|
|
48
|
+
): ContentDatabaseSourceWriteMode | null {
|
|
49
|
+
return value === "read_only" ||
|
|
50
|
+
value === "stage_only" ||
|
|
51
|
+
value === "publish_updates"
|
|
52
|
+
? value
|
|
53
|
+
: null;
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
function uniqueModes(
|
|
44
57
|
modes: readonly BuilderCmsLiveWriteMode[] | undefined,
|
|
45
58
|
): BuilderCmsLiveWriteMode[] {
|
|
@@ -50,25 +63,100 @@ function uniqueModes(
|
|
|
50
63
|
return unique;
|
|
51
64
|
}
|
|
52
65
|
|
|
66
|
+
function legacyWriteModeFromStored(args: {
|
|
67
|
+
liveWritesEnabled: boolean;
|
|
68
|
+
allowedWriteModes: readonly BuilderCmsLiveWriteMode[];
|
|
69
|
+
pushMode?: unknown;
|
|
70
|
+
}): ContentDatabaseSourceWriteMode {
|
|
71
|
+
if (!args.liveWritesEnabled) return "read_only";
|
|
72
|
+
const pushMode = normalizeMode(args.pushMode);
|
|
73
|
+
return args.allowedWriteModes.some((mode) => mode !== "autosave") ||
|
|
74
|
+
(pushMode && pushMode !== "autosave")
|
|
75
|
+
? "publish_updates"
|
|
76
|
+
: "stage_only";
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function writeModeFromPatch(
|
|
80
|
+
args: BuilderCmsWriteSettingsPatch,
|
|
81
|
+
): ContentDatabaseSourceWriteMode {
|
|
82
|
+
const explicit = normalizeWriteMode(args.writeMode);
|
|
83
|
+
if (args.writeMode !== undefined && !explicit) {
|
|
84
|
+
throw new Error("Choose a valid Builder write mode.");
|
|
85
|
+
}
|
|
86
|
+
if (explicit) return explicit;
|
|
87
|
+
if (args.liveWritesEnabled === false) return "read_only";
|
|
88
|
+
if (args.liveWritesEnabled === true) {
|
|
89
|
+
const allowed = uniqueModes(args.allowedWriteModes);
|
|
90
|
+
return allowed.some((mode) => mode !== "autosave")
|
|
91
|
+
? "publish_updates"
|
|
92
|
+
: "stage_only";
|
|
93
|
+
}
|
|
94
|
+
const metadata = parseRecord(args.metadataJson);
|
|
95
|
+
const capabilities = parseRecord(args.capabilitiesJson);
|
|
96
|
+
const allowedWriteModes = Array.isArray(metadata.allowedWriteModes)
|
|
97
|
+
? uniqueModes(
|
|
98
|
+
metadata.allowedWriteModes
|
|
99
|
+
.map(normalizeMode)
|
|
100
|
+
.filter((mode): mode is BuilderCmsLiveWriteMode => !!mode),
|
|
101
|
+
)
|
|
102
|
+
: [];
|
|
103
|
+
return (
|
|
104
|
+
normalizeWriteMode(metadata.writeMode) ??
|
|
105
|
+
legacyWriteModeFromStored({
|
|
106
|
+
liveWritesEnabled: capabilities.liveWritesEnabled === true,
|
|
107
|
+
allowedWriteModes,
|
|
108
|
+
pushMode: metadata.pushMode,
|
|
109
|
+
})
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function allowedWriteModesForTier(
|
|
114
|
+
writeMode: ContentDatabaseSourceWriteMode,
|
|
115
|
+
): BuilderCmsLiveWriteMode[] {
|
|
116
|
+
if (writeMode === "stage_only") return ["autosave"];
|
|
117
|
+
if (writeMode === "publish_updates") return ["autosave", "publish"];
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function pushModeForTier(
|
|
122
|
+
writeMode: ContentDatabaseSourceWriteMode,
|
|
123
|
+
): ContentDatabaseSourcePushMode {
|
|
124
|
+
if (writeMode === "stage_only") return "autosave";
|
|
125
|
+
if (writeMode === "publish_updates") return "publish";
|
|
126
|
+
return "none";
|
|
127
|
+
}
|
|
128
|
+
|
|
53
129
|
export function builderCmsWriteSettingsFromJson(args: {
|
|
54
130
|
capabilitiesJson: string | null | undefined;
|
|
55
131
|
metadataJson: string | null | undefined;
|
|
56
132
|
}) {
|
|
57
133
|
const capabilities = parseRecord(args.capabilitiesJson);
|
|
58
134
|
const metadata = parseRecord(args.metadataJson);
|
|
59
|
-
const
|
|
135
|
+
const legacyAllowedWriteModes = Array.isArray(metadata.allowedWriteModes)
|
|
60
136
|
? uniqueModes(
|
|
61
137
|
metadata.allowedWriteModes
|
|
62
138
|
.map(normalizeMode)
|
|
63
139
|
.filter((mode): mode is BuilderCmsLiveWriteMode => !!mode),
|
|
64
140
|
)
|
|
65
141
|
: [];
|
|
142
|
+
const writeMode =
|
|
143
|
+
normalizeWriteMode(metadata.writeMode) ??
|
|
144
|
+
legacyWriteModeFromStored({
|
|
145
|
+
liveWritesEnabled: capabilities.liveWritesEnabled === true,
|
|
146
|
+
allowedWriteModes: legacyAllowedWriteModes,
|
|
147
|
+
pushMode: metadata.pushMode,
|
|
148
|
+
});
|
|
149
|
+
const allowedWriteModes = allowedWriteModesForTier(writeMode);
|
|
66
150
|
|
|
67
151
|
return {
|
|
68
|
-
|
|
152
|
+
writeMode,
|
|
153
|
+
liveWritesEnabled: writeMode !== "read_only",
|
|
69
154
|
allowedWriteModes,
|
|
70
|
-
|
|
71
|
-
|
|
155
|
+
allowPublicationTransitions:
|
|
156
|
+
writeMode === "publish_updates" &&
|
|
157
|
+
metadata.allowPublicationTransitions === true,
|
|
158
|
+
allowDraftWrites: false,
|
|
159
|
+
allowPublishWrites: writeMode === "publish_updates",
|
|
72
160
|
};
|
|
73
161
|
}
|
|
74
162
|
|
|
@@ -77,8 +165,14 @@ export function buildBuilderCmsWriteModeJson(
|
|
|
77
165
|
) {
|
|
78
166
|
const capabilities = parseRecord(args.capabilitiesJson);
|
|
79
167
|
const metadata = parseRecord(args.metadataJson);
|
|
168
|
+
const writeMode = writeModeFromPatch(args);
|
|
169
|
+
const enabled = writeMode !== "read_only";
|
|
170
|
+
const allowPublicationTransitions =
|
|
171
|
+
enabled &&
|
|
172
|
+
writeMode === "publish_updates" &&
|
|
173
|
+
args.allowPublicationTransitions === true;
|
|
80
174
|
|
|
81
|
-
if (
|
|
175
|
+
if (enabled) {
|
|
82
176
|
if (args.sourceType !== "builder-cms") {
|
|
83
177
|
throw new Error(
|
|
84
178
|
"Live writes can only be enabled for Builder CMS sources.",
|
|
@@ -91,50 +185,28 @@ export function buildBuilderCmsWriteModeJson(
|
|
|
91
185
|
}
|
|
92
186
|
}
|
|
93
187
|
|
|
94
|
-
const enabled = args.liveWritesEnabled === true;
|
|
95
|
-
const allowedWriteModes = enabled ? uniqueModes(args.allowedWriteModes) : [];
|
|
96
|
-
if (args.liveWritesEnabled && allowedWriteModes.length === 0) {
|
|
97
|
-
throw new Error(
|
|
98
|
-
"Choose at least one allowed Builder write mode before enabling live writes.",
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
188
|
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
args.allowDraftWrites !== true
|
|
105
|
-
) {
|
|
106
|
-
throw new Error("Draft writes require explicit draft opt-in.");
|
|
107
|
-
}
|
|
108
|
-
if (
|
|
109
|
-
enabled &&
|
|
110
|
-
allowedWriteModes.includes("publish") &&
|
|
111
|
-
args.allowPublishWrites !== true
|
|
189
|
+
args.allowPublicationTransitions === true &&
|
|
190
|
+
writeMode !== "publish_updates"
|
|
112
191
|
) {
|
|
113
|
-
throw new Error("
|
|
192
|
+
throw new Error("Publication transitions require publish updates mode.");
|
|
114
193
|
}
|
|
115
194
|
|
|
195
|
+
const allowedWriteModes = allowedWriteModesForTier(writeMode);
|
|
116
196
|
const nextCapabilities: Partial<ContentDatabaseSourceCapabilities> = {
|
|
117
197
|
...capabilities,
|
|
118
198
|
liveWritesEnabled: enabled,
|
|
119
199
|
};
|
|
120
200
|
const nextMetadata: Record<string, unknown> = {
|
|
121
201
|
...metadata,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
202
|
+
writeMode,
|
|
203
|
+
allowPublicationTransitions,
|
|
204
|
+
allowedWriteModes,
|
|
205
|
+
allowDraftWrites: false,
|
|
206
|
+
allowPublishWrites: writeMode === "publish_updates",
|
|
207
|
+
pushMode: pushModeForTier(writeMode),
|
|
125
208
|
};
|
|
126
209
|
|
|
127
|
-
if (
|
|
128
|
-
enabled &&
|
|
129
|
-
(!nextMetadata.pushMode ||
|
|
130
|
-
nextMetadata.pushMode === "none" ||
|
|
131
|
-
!allowedWriteModes.includes(
|
|
132
|
-
normalizeMode(nextMetadata.pushMode) ?? "autosave",
|
|
133
|
-
))
|
|
134
|
-
) {
|
|
135
|
-
nextMetadata.pushMode = allowedWriteModes[0];
|
|
136
|
-
}
|
|
137
|
-
|
|
138
210
|
return {
|
|
139
211
|
capabilitiesJson: JSON.stringify(nextCapabilities),
|
|
140
212
|
metadataJson: JSON.stringify(nextMetadata),
|
|
@@ -155,7 +227,7 @@ export function mergeBuilderCmsWriteSettingsIntoJson(args: {
|
|
|
155
227
|
if (
|
|
156
228
|
currentSettings.liveWritesEnabled !== true ||
|
|
157
229
|
args.sourceTable !== BUILDER_CMS_SAFE_WRITE_MODEL ||
|
|
158
|
-
currentSettings.
|
|
230
|
+
currentSettings.writeMode === "read_only"
|
|
159
231
|
) {
|
|
160
232
|
return {
|
|
161
233
|
capabilitiesJson: args.nextCapabilitiesJson,
|
|
@@ -168,9 +240,19 @@ export function mergeBuilderCmsWriteSettingsIntoJson(args: {
|
|
|
168
240
|
sourceTable: args.sourceTable,
|
|
169
241
|
capabilitiesJson: args.nextCapabilitiesJson,
|
|
170
242
|
metadataJson: args.nextMetadataJson,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
allowDraftWrites: currentSettings.allowDraftWrites,
|
|
174
|
-
allowPublishWrites: currentSettings.allowPublishWrites,
|
|
243
|
+
writeMode: currentSettings.writeMode,
|
|
244
|
+
allowPublicationTransitions: currentSettings.allowPublicationTransitions,
|
|
175
245
|
});
|
|
176
246
|
}
|
|
247
|
+
|
|
248
|
+
export function builderCmsAllowedWriteModesForTier(
|
|
249
|
+
writeMode: ContentDatabaseSourceWriteMode,
|
|
250
|
+
) {
|
|
251
|
+
return allowedWriteModesForTier(writeMode);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function builderCmsPushModeForTier(
|
|
255
|
+
writeMode: ContentDatabaseSourceWriteMode,
|
|
256
|
+
) {
|
|
257
|
+
return pushModeForTier(writeMode);
|
|
258
|
+
}
|