@avocadostudio-ai/orchestrator-core 0.7.0 → 0.8.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.
|
@@ -68,7 +68,8 @@ async function readPublishedJsonFile() {
|
|
|
68
68
|
export async function loadPublishedForDiff(opts) {
|
|
69
69
|
const { siteOrigin, logger } = opts;
|
|
70
70
|
let remotePages = null;
|
|
71
|
-
|
|
71
|
+
/** `undefined` = the site did not say. See `PublishedContent`. */
|
|
72
|
+
let remoteSiteConfig;
|
|
72
73
|
if (siteOrigin) {
|
|
73
74
|
try {
|
|
74
75
|
const res = await fetch(`${siteOrigin.replace(/\/+$/, "")}/api/editor/pages`, {
|
|
@@ -78,7 +79,13 @@ export async function loadPublishedForDiff(opts) {
|
|
|
78
79
|
const data = (await res.json());
|
|
79
80
|
if (Array.isArray(data.pages)) {
|
|
80
81
|
remotePages = data.pages;
|
|
81
|
-
|
|
82
|
+
/*
|
|
83
|
+
* Absent and `null` are different answers and must stay different.
|
|
84
|
+
* `null` is the site saying it publishes no header config; absent is
|
|
85
|
+
* an editor API that does not report one at all, which is most of
|
|
86
|
+
* them — an Astro site returns `{pages}` and nothing else.
|
|
87
|
+
*/
|
|
88
|
+
remoteSiteConfig = "siteConfig" in data ? (data.siteConfig ?? null) : undefined;
|
|
82
89
|
}
|
|
83
90
|
}
|
|
84
91
|
else {
|
|
@@ -89,17 +96,29 @@ export async function loadPublishedForDiff(opts) {
|
|
|
89
96
|
logger.warn({ siteOrigin, err: String(err) }, "publish/diff: site fetch failed, falling back");
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
|
-
// Hot path: remote
|
|
93
|
-
if (remotePages && remoteSiteConfig) {
|
|
99
|
+
// Hot path: the remote answered about both.
|
|
100
|
+
if (remotePages && remoteSiteConfig !== undefined) {
|
|
94
101
|
return { pages: remotePages, siteConfig: remoteSiteConfig, source: "site" };
|
|
95
102
|
}
|
|
96
|
-
// Either the remote didn't run, didn't
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
103
|
+
// Either the remote didn't run, didn't mention siteConfig, or didn't include
|
|
104
|
+
// pages. Read the JSON file to backfill the missing pieces — without it, a
|
|
105
|
+
// missing siteConfig would be misread as "header added · all fields" on
|
|
106
|
+
// every publish-diff load.
|
|
100
107
|
const fromFile = await readPublishedJsonFile();
|
|
101
108
|
const pages = remotePages ?? fromFile.pages;
|
|
102
|
-
|
|
109
|
+
/*
|
|
110
|
+
* The file is `apps/site`'s published content, so it may only answer for
|
|
111
|
+
* `apps/site`. When the remote supplied the pages it is the authority on its
|
|
112
|
+
* own header config, and a site that did not mention one has not said it has
|
|
113
|
+
* none — it has said nothing, which `publishDiffAction` reads as "no header
|
|
114
|
+
* change" rather than as a change.
|
|
115
|
+
*
|
|
116
|
+
* Backfilling here instead is what made every diff for a site whose editor
|
|
117
|
+
* API returns only `{pages}` report the bundled demo's name, logo, navGroups
|
|
118
|
+
* and navLabels as the "before" — seven changed fields, all of them
|
|
119
|
+
* describing a site nobody had asked about.
|
|
120
|
+
*/
|
|
121
|
+
const siteConfig = remotePages ? undefined : (remoteSiteConfig ?? fromFile.siteConfig);
|
|
103
122
|
if (pages)
|
|
104
123
|
return { pages, siteConfig, source: remotePages ? "site" : "file" };
|
|
105
124
|
logger.warn("publish/diff: falling back to in-memory publishedPages — diff may be inaccurate");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avocadostudio-ai/orchestrator-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"openai": "^4.87.1",
|
|
23
23
|
"sharp": "^0.34.5",
|
|
24
24
|
"zod": "^4.3.6",
|
|
25
|
-
"@avocadostudio-ai/
|
|
26
|
-
"@avocadostudio-ai/
|
|
25
|
+
"@avocadostudio-ai/shared": "^0.8.0",
|
|
26
|
+
"@avocadostudio-ai/migration-sdk": "^0.8.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@anthropic-ai/claude-agent-sdk": "^0.3.220",
|
|
@@ -58,12 +58,7 @@
|
|
|
58
58
|
"license": "Apache-2.0",
|
|
59
59
|
"homepage": "https://docs.avocadostudio.dev",
|
|
60
60
|
"bugs": {
|
|
61
|
-
"url": "https://
|
|
62
|
-
},
|
|
63
|
-
"repository": {
|
|
64
|
-
"type": "git",
|
|
65
|
-
"url": "https://github.com/avocadostudio-ai/avocado.git",
|
|
66
|
-
"directory": "packages/orchestrator-core"
|
|
61
|
+
"url": "https://docs.avocadostudio.dev"
|
|
67
62
|
},
|
|
68
63
|
"peerDependencies": {
|
|
69
64
|
"googleapis": "^171.4.0",
|