@avocadostudio-ai/orchestrator-core 0.23.0 → 0.24.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/agents/edit-safety-runner.js +2 -1
- package/dist/agents/enabled.d.ts +18 -0
- package/dist/agents/enabled.js +21 -0
- package/dist/agents/inbox.js +4 -0
- package/dist/agents/learning.js +3 -0
- package/dist/agents/mention.js +4 -0
- package/dist/agents/tick.js +3 -0
- package/dist/handler/create-orchestrator.js +4 -1
- package/package.json +3 -3
|
@@ -3,6 +3,7 @@ import { buildBlockManifest } from "@avocadostudio-ai/shared";
|
|
|
3
3
|
import { getDurableStore, noteDurableFailure } from "../durable/durable-store-singleton.js";
|
|
4
4
|
import { agentState } from "./settings.js";
|
|
5
5
|
import { countIssues, describeIssues, detectEditDamage } from "./edit-safety.js";
|
|
6
|
+
import { siteOpsAgentsEnabled } from "./enabled.js";
|
|
6
7
|
/*
|
|
7
8
|
* Binds the Edit safety diff to a real edit, and records what it found.
|
|
8
9
|
*
|
|
@@ -55,7 +56,7 @@ export function pagesBefore(ops, getPage, also = []) {
|
|
|
55
56
|
*/
|
|
56
57
|
export async function checkEditSafety(args) {
|
|
57
58
|
try {
|
|
58
|
-
if (args.before.size === 0)
|
|
59
|
+
if (args.before.size === 0 || !siteOpsAgentsEnabled())
|
|
59
60
|
return null;
|
|
60
61
|
const agent = await agentState(args.scopeKey, "edit-safety");
|
|
61
62
|
if (!agent.enabled)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Site ops agents — Edit safety, the Inbox, scheduled and custom agents, site
|
|
3
|
+
* facts, @mentions — are pre-alpha, and off unless `SITE_OPS_AGENTS=1`.
|
|
4
|
+
*
|
|
5
|
+
* Off has to mean off on the server, not just hidden tabs: Edit safety alerts
|
|
6
|
+
* hold publishing (409) until someone resolves them in the Inbox, so an editor
|
|
7
|
+
* that hides the Inbox while the server still raises alerts leaves publish
|
|
8
|
+
* stuck with no screen that can unstick it. Each entry point checks this:
|
|
9
|
+
* Edit safety raises nothing, nothing holds publish, the planner is given no
|
|
10
|
+
* site facts, a tick runs nothing, and an @handle goes to the planner. The
|
|
11
|
+
* editor reads it from `/status/planner` (`features.siteOpsAgents`) and hides
|
|
12
|
+
* Inbox, Agents and @-agent routing.
|
|
13
|
+
*
|
|
14
|
+
* Read per call, like every flag here, so a test or a library-mode host can set
|
|
15
|
+
* it after import. The hermetic test runner switches it on; the tests that pin
|
|
16
|
+
* the default delete it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function siteOpsAgentsEnabled(): boolean;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { envFlag } from "../env-flags.js";
|
|
2
|
+
/**
|
|
3
|
+
* Site ops agents — Edit safety, the Inbox, scheduled and custom agents, site
|
|
4
|
+
* facts, @mentions — are pre-alpha, and off unless `SITE_OPS_AGENTS=1`.
|
|
5
|
+
*
|
|
6
|
+
* Off has to mean off on the server, not just hidden tabs: Edit safety alerts
|
|
7
|
+
* hold publishing (409) until someone resolves them in the Inbox, so an editor
|
|
8
|
+
* that hides the Inbox while the server still raises alerts leaves publish
|
|
9
|
+
* stuck with no screen that can unstick it. Each entry point checks this:
|
|
10
|
+
* Edit safety raises nothing, nothing holds publish, the planner is given no
|
|
11
|
+
* site facts, a tick runs nothing, and an @handle goes to the planner. The
|
|
12
|
+
* editor reads it from `/status/planner` (`features.siteOpsAgents`) and hides
|
|
13
|
+
* Inbox, Agents and @-agent routing.
|
|
14
|
+
*
|
|
15
|
+
* Read per call, like every flag here, so a test or a library-mode host can set
|
|
16
|
+
* it after import. The hermetic test runner switches it on; the tests that pin
|
|
17
|
+
* the default delete it.
|
|
18
|
+
*/
|
|
19
|
+
export function siteOpsAgentsEnabled() {
|
|
20
|
+
return envFlag("SITE_OPS_AGENTS", false);
|
|
21
|
+
}
|
package/dist/agents/inbox.js
CHANGED
|
@@ -11,6 +11,7 @@ import { withoutPages } from "./edit-safety-resolve.js";
|
|
|
11
11
|
import { currentValue, fixFieldFor, fixOps, writeFix } from "./fix-writer.js";
|
|
12
12
|
import { listSiteFacts, recordOutcome } from "./learning.js";
|
|
13
13
|
import { resolveSiteAgents } from "./settings.js";
|
|
14
|
+
import { siteOpsAgentsEnabled } from "./enabled.js";
|
|
14
15
|
/** How many closed items the Done tab shows. */
|
|
15
16
|
export const DONE_TAB_LIMIT = 50;
|
|
16
17
|
function entryFromItem(stored) {
|
|
@@ -137,6 +138,9 @@ export async function buildInboxView(scopeKey, now = Date.now()) {
|
|
|
137
138
|
* hold for the site — a whole-site publish ships every page.
|
|
138
139
|
*/
|
|
139
140
|
export async function publishHolds(scopeKey, slugs) {
|
|
141
|
+
// With agents off nobody can see or resolve an alert, so none may hold.
|
|
142
|
+
if (!siteOpsAgentsEnabled())
|
|
143
|
+
return [];
|
|
140
144
|
const open = await getDurableStore().listInboxItems({ scopeKey, status: "open", limit: 500 });
|
|
141
145
|
const wanted = slugs && slugs.length > 0 ? new Set(slugs) : null;
|
|
142
146
|
return open.filter((item) => item.blocksPublish && (!wanted || item.slugs.some((slug) => wanted.has(slug))));
|
package/dist/agents/learning.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getDurableStore, noteDurableFailure } from "../durable/durable-store-singleton.js";
|
|
2
|
+
import { siteOpsAgentsEnabled } from "./enabled.js";
|
|
2
3
|
/*
|
|
3
4
|
* Memory and corrections, wired in (site-ops-agents.md SO-10, SO-11).
|
|
4
5
|
*
|
|
@@ -55,6 +56,8 @@ export async function listSiteFacts(scopeKey, limit = 200) {
|
|
|
55
56
|
* because memory could not be read; it plans without it, as it did before.
|
|
56
57
|
*/
|
|
57
58
|
export async function siteFactsForPlanner(scopeKey, log) {
|
|
59
|
+
if (!siteOpsAgentsEnabled())
|
|
60
|
+
return [];
|
|
58
61
|
try {
|
|
59
62
|
const facts = await listSiteFacts(scopeKey, SITE_FACTS_IN_PROMPT);
|
|
60
63
|
if (facts.length === 0)
|
package/dist/agents/mention.js
CHANGED
|
@@ -4,6 +4,7 @@ import { agentOfFinding } from "./inbox.js";
|
|
|
4
4
|
import { runAgentSpec } from "./run-spec.js";
|
|
5
5
|
import { resolveSiteAgents } from "./settings.js";
|
|
6
6
|
import { CUSTOM_AGENT_PREFIX } from "./spec.js";
|
|
7
|
+
import { siteOpsAgentsEnabled } from "./enabled.js";
|
|
7
8
|
const WEEK = 7 * 24 * 3_600_000;
|
|
8
9
|
const TOP = 3;
|
|
9
10
|
/** An agent's handle in chat: its id, without the `custom:` prefix. */
|
|
@@ -47,6 +48,9 @@ async function openFor(scopeKey, agentId, store) {
|
|
|
47
48
|
return open.filter((f) => agentOfFinding(f) === agentId);
|
|
48
49
|
}
|
|
49
50
|
export async function handleMention(args) {
|
|
51
|
+
// Off, an @handle is just text: the planner gets it, as before agents existed.
|
|
52
|
+
if (!siteOpsAgentsEnabled())
|
|
53
|
+
return { handled: false };
|
|
50
54
|
const head = /^\s*@([a-z0-9][a-z0-9:-]*)\b(.*)$/is.exec(args.message);
|
|
51
55
|
if (!head)
|
|
52
56
|
return { handled: false };
|
package/dist/agents/tick.js
CHANGED
|
@@ -3,6 +3,7 @@ import { agentOfFinding } from "./inbox.js";
|
|
|
3
3
|
import { runAgentSpec } from "./run-spec.js";
|
|
4
4
|
import { isDue, latestSlot } from "./schedule.js";
|
|
5
5
|
import { resolveSiteAgents } from "./settings.js";
|
|
6
|
+
import { siteOpsAgentsEnabled } from "./enabled.js";
|
|
6
7
|
/*
|
|
7
8
|
* POST /agents/tick (site-ops-agents.md §8 item 6): run every scheduled agent
|
|
8
9
|
* whose slot has passed, on every site, and post each site's weekly digest.
|
|
@@ -22,6 +23,8 @@ export async function tickAgents(args = {}) {
|
|
|
22
23
|
const now = args.now ?? Date.now();
|
|
23
24
|
const store = args.store ?? getDurableStore();
|
|
24
25
|
const outcome = { at: now, sites: 0, ran: [], failed: [], digests: [] };
|
|
26
|
+
if (!siteOpsAgentsEnabled())
|
|
27
|
+
return outcome;
|
|
25
28
|
for (const scopeKey of await store.listAgentScopes()) {
|
|
26
29
|
outcome.sites += 1;
|
|
27
30
|
try {
|
|
@@ -43,6 +43,7 @@ import { screenshotAction } from "../http/screenshot-actions.js";
|
|
|
43
43
|
import { runChecksAction, listFindingsAction, listCheckRunsAction, updateFindingAction } from "../http/checks-actions.js";
|
|
44
44
|
import { listInboxAction, resolveAlertAction, undoAlertAction, markReportReadAction, approveFindingsAction, writeFixesAction, rejectFindingsAction, listAgentsAction, agentStatsAction, updateAgentsAction, backtestAgentsAction, listTemplatesAction, saveAgentSpecAction, removeAgentSpecAction, runAgentAction, tickAgentsAction, draftAgentAction, mentionAction, listFactsAction, addFactAction, removeFactAction } from "../http/inbox-actions.js";
|
|
45
45
|
import { publishHoldResponse } from "../agents/inbox.js";
|
|
46
|
+
import { siteOpsAgentsEnabled } from "../agents/enabled.js";
|
|
46
47
|
import { fileImageStore, formatImageChatFrame, generateImageAction, imageChatAction, imageChatStreamAction, interpretImageAction, validateImageChatRequest } from "../http/image-generate-actions.js";
|
|
47
48
|
import { transcribeAudioAction, transcriptionUnavailable, validateAudioInput } from "../http/audio-actions.js";
|
|
48
49
|
import { formatVariationFrame, parseVariationRequest, scopeVariationSession, variationsAction, variationsStreamAction } from "../http/variations-actions.js";
|
|
@@ -1204,7 +1205,9 @@ export function createOrchestrator(config = {}) {
|
|
|
1204
1205
|
* offered.
|
|
1205
1206
|
*/
|
|
1206
1207
|
audioTranscription: Boolean(process.env.OPENAI_API_KEY?.trim() || process.env.GOOGLE_GENAI_API_KEY?.trim()),
|
|
1207
|
-
agentMode: false
|
|
1208
|
+
agentMode: false,
|
|
1209
|
+
// Pre-alpha; the editor hides Inbox, Agents and @-agents unless this is true.
|
|
1210
|
+
siteOpsAgents: siteOpsAgentsEnabled()
|
|
1208
1211
|
},
|
|
1209
1212
|
/*
|
|
1210
1213
|
* The capability probe lives here rather than on `/whoami` because
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avocadostudio-ai/orchestrator-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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.35.4",
|
|
24
24
|
"zod": "^4.3.6",
|
|
25
|
-
"@avocadostudio-ai/migration-sdk": "^0.
|
|
26
|
-
"@avocadostudio-ai/shared": "^0.
|
|
25
|
+
"@avocadostudio-ai/migration-sdk": "^0.24.0",
|
|
26
|
+
"@avocadostudio-ai/shared": "^0.24.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@anthropic-ai/claude-agent-sdk": "^0.3.220",
|