@avocadostudio-ai/orchestrator-core 0.1.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/LICENSE +201 -0
- package/dist/agent/agent-context.d.ts +19 -0
- package/dist/agent/agent-context.js +67 -0
- package/dist/agent/agent-logger.d.ts +5 -0
- package/dist/agent/agent-logger.js +22 -0
- package/dist/agent/agent-loop-openai.d.ts +8 -0
- package/dist/agent/agent-loop-openai.js +172 -0
- package/dist/agent/agent-loop.d.ts +56 -0
- package/dist/agent/agent-loop.js +167 -0
- package/dist/agent/agent-provider.d.ts +28 -0
- package/dist/agent/agent-provider.js +63 -0
- package/dist/agent/agent-tools.d.ts +28 -0
- package/dist/agent/agent-tools.js +899 -0
- package/dist/agent/context/editing-guidelines.md +46 -0
- package/dist/agent/context/role.md +39 -0
- package/dist/agent/integration-prompt.d.ts +9 -0
- package/dist/agent/integration-prompt.js +154 -0
- package/dist/agent/sites-agent-context.d.ts +12 -0
- package/dist/agent/sites-agent-context.js +316 -0
- package/dist/agent/sites-agent-shared.d.ts +161 -0
- package/dist/agent/sites-agent-shared.js +1101 -0
- package/dist/agent/sites-agent-tools.d.ts +18 -0
- package/dist/agent/sites-agent-tools.js +1227 -0
- package/dist/chat/anthropic-cache.d.ts +20 -0
- package/dist/chat/anthropic-cache.js +54 -0
- package/dist/chat/anthropic-planner.d.ts +98 -0
- package/dist/chat/anthropic-planner.js +1012 -0
- package/dist/chat/changelog-coverage-validator.d.ts +37 -0
- package/dist/chat/changelog-coverage-validator.js +215 -0
- package/dist/chat/chat-pipeline-context.d.ts +211 -0
- package/dist/chat/chat-pipeline-context.js +249 -0
- package/dist/chat/chat-pipeline-deterministic.d.ts +61 -0
- package/dist/chat/chat-pipeline-deterministic.js +407 -0
- package/dist/chat/chat-pipeline-image.d.ts +86 -0
- package/dist/chat/chat-pipeline-image.js +897 -0
- package/dist/chat/chat-pipeline-shared.d.ts +69 -0
- package/dist/chat/chat-pipeline-shared.js +212 -0
- package/dist/chat/chat-pipeline-translation.d.ts +27 -0
- package/dist/chat/chat-pipeline-translation.js +417 -0
- package/dist/chat/chat-pipeline-ui.d.ts +14 -0
- package/dist/chat/chat-pipeline-ui.js +244 -0
- package/dist/chat/chat-pipeline.d.ts +99 -0
- package/dist/chat/chat-pipeline.js +3999 -0
- package/dist/chat/decomposer.d.ts +21 -0
- package/dist/chat/decomposer.js +65 -0
- package/dist/chat/gemini-planner.d.ts +70 -0
- package/dist/chat/gemini-planner.js +541 -0
- package/dist/chat/hallucination-validator.d.ts +36 -0
- package/dist/chat/hallucination-validator.js +110 -0
- package/dist/chat/locale-strings.d.ts +47 -0
- package/dist/chat/locale-strings.js +100 -0
- package/dist/chat/plan-json-schema.d.ts +133 -0
- package/dist/chat/plan-json-schema.js +112 -0
- package/dist/chat/planner-types.d.ts +120 -0
- package/dist/chat/planner-types.js +66 -0
- package/dist/chat/planner.d.ts +148 -0
- package/dist/chat/planner.js +1361 -0
- package/dist/chat/prompts.d.ts +67 -0
- package/dist/chat/prompts.js +356 -0
- package/dist/chat/provider-routing.d.ts +14 -0
- package/dist/chat/provider-routing.js +27 -0
- package/dist/chat/variation-pipeline.d.ts +135 -0
- package/dist/chat/variation-pipeline.js +837 -0
- package/dist/chat/vision-alt-generator.d.ts +35 -0
- package/dist/chat/vision-alt-generator.js +152 -0
- package/dist/cms/adapter.d.ts +62 -0
- package/dist/cms/adapter.js +1 -0
- package/dist/cms/bootstrap.d.ts +17 -0
- package/dist/cms/bootstrap.js +85 -0
- package/dist/cms/editor-api-adapter.d.ts +23 -0
- package/dist/cms/editor-api-adapter.js +71 -0
- package/dist/cms/index.d.ts +4 -0
- package/dist/cms/index.js +3 -0
- package/dist/cms/json-file-adapter.d.ts +11 -0
- package/dist/cms/json-file-adapter.js +62 -0
- package/dist/demo-mode.d.ts +59 -0
- package/dist/demo-mode.js +201 -0
- package/dist/errors.d.ts +67 -0
- package/dist/errors.js +129 -0
- package/dist/http/chat-stream-resumable.d.ts +108 -0
- package/dist/http/chat-stream-resumable.js +290 -0
- package/dist/http/chat-stream.d.ts +99 -0
- package/dist/http/chat-stream.js +92 -0
- package/dist/image/gdrive-client.d.ts +22 -0
- package/dist/image/gdrive-client.js +215 -0
- package/dist/image/image-helpers.d.ts +95 -0
- package/dist/image/image-helpers.js +488 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/jira/jira-approval.d.ts +22 -0
- package/dist/jira/jira-approval.js +51 -0
- package/dist/jira/jira-client.d.ts +44 -0
- package/dist/jira/jira-client.js +313 -0
- package/dist/jira/jira-poller.d.ts +46 -0
- package/dist/jira/jira-poller.js +184 -0
- package/dist/jira/jira-processor.d.ts +103 -0
- package/dist/jira/jira-processor.js +1085 -0
- package/dist/jira/jira-types.d.ts +117 -0
- package/dist/jira/jira-types.js +38 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.js +28 -0
- package/dist/migration/mcp-server-stdio.d.ts +8 -0
- package/dist/migration/mcp-server-stdio.js +672 -0
- package/dist/migration/migration-prompt.d.ts +7 -0
- package/dist/migration/migration-prompt.js +197 -0
- package/dist/migration/migration-tools.d.ts +17 -0
- package/dist/migration/migration-tools.js +159 -0
- package/dist/migration/scrape-cache.d.ts +9 -0
- package/dist/migration/scrape-cache.js +19 -0
- package/dist/nlp/deterministic-planner-context.d.ts +141 -0
- package/dist/nlp/deterministic-planner-context.js +362 -0
- package/dist/nlp/deterministic-planner-pages.d.ts +26 -0
- package/dist/nlp/deterministic-planner-pages.js +170 -0
- package/dist/nlp/deterministic-planner-patches.d.ts +80 -0
- package/dist/nlp/deterministic-planner-patches.js +508 -0
- package/dist/nlp/deterministic-planner-refs.d.ts +33 -0
- package/dist/nlp/deterministic-planner-refs.js +164 -0
- package/dist/nlp/deterministic-planner-suggestions.d.ts +49 -0
- package/dist/nlp/deterministic-planner-suggestions.js +579 -0
- package/dist/nlp/deterministic-planner.d.ts +85 -0
- package/dist/nlp/deterministic-planner.js +1631 -0
- package/dist/nlp/intent-detection.d.ts +309 -0
- package/dist/nlp/intent-detection.js +730 -0
- package/dist/nlp/intent-helpers.d.ts +15 -0
- package/dist/nlp/intent-helpers.js +243 -0
- package/dist/nlp/intent-patterns.d.ts +40 -0
- package/dist/nlp/intent-patterns.js +223 -0
- package/dist/nlp/plan-normalizer.d.ts +41 -0
- package/dist/nlp/plan-normalizer.js +1537 -0
- package/dist/ops/destructive-action-gate.d.ts +44 -0
- package/dist/ops/destructive-action-gate.js +90 -0
- package/dist/ops/ops-engine.d.ts +151 -0
- package/dist/ops/ops-engine.js +1394 -0
- package/dist/publish/diff-engine.d.ts +18 -0
- package/dist/publish/diff-engine.js +305 -0
- package/dist/publish/publish-helpers.d.ts +87 -0
- package/dist/publish/publish-helpers.js +521 -0
- package/dist/publish/publish-target-registry.d.ts +7 -0
- package/dist/publish/publish-target-registry.js +61 -0
- package/dist/publish/publish-target.d.ts +81 -0
- package/dist/publish/publish-target.js +1 -0
- package/dist/publish/targets/deploy-hook.d.ts +13 -0
- package/dist/publish/targets/deploy-hook.js +123 -0
- package/dist/publish/targets/git.d.ts +13 -0
- package/dist/publish/targets/git.js +55 -0
- package/dist/publish/targets/site-contract.d.ts +19 -0
- package/dist/publish/targets/site-contract.js +124 -0
- package/dist/state/content-source.d.ts +17 -0
- package/dist/state/content-source.js +1 -0
- package/dist/state/in-memory-content-source.d.ts +27 -0
- package/dist/state/in-memory-content-source.js +51 -0
- package/dist/state/session-lock.d.ts +13 -0
- package/dist/state/session-lock.js +29 -0
- package/dist/state/session-state.d.ts +310 -0
- package/dist/state/session-state.js +1083 -0
- package/dist/state/sqlite-store-singleton.d.ts +31 -0
- package/dist/state/sqlite-store-singleton.js +170 -0
- package/dist/state/sqlite-store.d.ts +135 -0
- package/dist/state/sqlite-store.js +421 -0
- package/dist/telemetry/chat-telemetry.d.ts +105 -0
- package/dist/telemetry/chat-telemetry.js +247 -0
- package/dist/telemetry/eval-candidate-store.d.ts +50 -0
- package/dist/telemetry/eval-candidate-store.js +120 -0
- package/dist/telemetry/feedback-store.d.ts +34 -0
- package/dist/telemetry/feedback-store.js +76 -0
- package/dist/telemetry/jira-telemetry.d.ts +57 -0
- package/dist/telemetry/jira-telemetry.js +68 -0
- package/dist/telemetry/migration-telemetry.d.ts +35 -0
- package/dist/telemetry/migration-telemetry.js +40 -0
- package/dist/telemetry/usage.d.ts +24 -0
- package/dist/telemetry/usage.js +80 -0
- package/dist/tools/builtin-registrations.d.ts +12 -0
- package/dist/tools/builtin-registrations.js +33 -0
- package/dist/tools/builtins/gdrive-browse.d.ts +3 -0
- package/dist/tools/builtins/gdrive-browse.js +68 -0
- package/dist/tools/builtins/image-generate.d.ts +3 -0
- package/dist/tools/builtins/image-generate.js +211 -0
- package/dist/tools/builtins/unsplash-get-by-id.d.ts +23 -0
- package/dist/tools/builtins/unsplash-get-by-id.js +119 -0
- package/dist/tools/builtins/unsplash-search.d.ts +3 -0
- package/dist/tools/builtins/unsplash-search.js +74 -0
- package/dist/tools/executor.d.ts +23 -0
- package/dist/tools/executor.js +169 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +5 -0
- package/dist/tools/registry.d.ts +21 -0
- package/dist/tools/registry.js +75 -0
- package/dist/tools/runtime.d.ts +27 -0
- package/dist/tools/runtime.js +48 -0
- package/dist/tools/schema-validator.d.ts +24 -0
- package/dist/tools/schema-validator.js +88 -0
- package/dist/tools/types.d.ts +86 -0
- package/dist/tools/types.js +1 -0
- package/dist/variation-images.d.ts +19 -0
- package/dist/variation-images.js +12 -0
- package/package.json +78 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type BlockType, type EditPlan, type PageDoc, type PublishDiff, type Operation } from "@avocadostudio-ai/shared";
|
|
3
|
+
import { type ModelKey } from "../state/session-state.ts";
|
|
4
|
+
import { type GuardrailErrorCategory } from "../errors.ts";
|
|
5
|
+
export type { GuardrailErrorCategory };
|
|
6
|
+
export declare const siteCapabilitiesSchema: z.ZodObject<{
|
|
7
|
+
allowStructuralEdits: z.ZodBoolean;
|
|
8
|
+
manifestStatus: z.ZodEnum<{
|
|
9
|
+
loading: "loading";
|
|
10
|
+
ready: "ready";
|
|
11
|
+
degraded: "degraded";
|
|
12
|
+
}>;
|
|
13
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
14
|
+
manifestVersion: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
blockCount: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
checkedAt: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type SiteCapabilities = z.infer<typeof siteCapabilitiesSchema>;
|
|
19
|
+
export declare const chatAttachmentSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
kind: z.ZodEnum<{
|
|
22
|
+
image: "image";
|
|
23
|
+
pdf: "pdf";
|
|
24
|
+
}>;
|
|
25
|
+
url: z.ZodString;
|
|
26
|
+
mimeType: z.ZodString;
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
28
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type ChatAttachment = z.infer<typeof chatAttachmentSchema>;
|
|
31
|
+
export declare const chatRequestBodySchema: z.ZodObject<{
|
|
32
|
+
session: z.ZodOptional<z.ZodString>;
|
|
33
|
+
siteId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
componentsManifest: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString]>>;
|
|
35
|
+
siteCapabilities: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
36
|
+
allowStructuralEdits: z.ZodBoolean;
|
|
37
|
+
manifestStatus: z.ZodEnum<{
|
|
38
|
+
loading: "loading";
|
|
39
|
+
ready: "ready";
|
|
40
|
+
degraded: "degraded";
|
|
41
|
+
}>;
|
|
42
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
43
|
+
manifestVersion: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
blockCount: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
checkedAt: z.ZodString;
|
|
46
|
+
}, z.core.$strip>, z.ZodString]>>;
|
|
47
|
+
sitePurpose: z.ZodOptional<z.ZodString>;
|
|
48
|
+
siteHosting: z.ZodOptional<z.ZodString>;
|
|
49
|
+
businessContext: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
50
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
51
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
52
|
+
constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
53
|
+
}, z.core.$strip>, z.ZodString]>>;
|
|
54
|
+
siteContext: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
55
|
+
siteId: z.ZodOptional<z.ZodString>;
|
|
56
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
57
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
58
|
+
hosting: z.ZodOptional<z.ZodString>;
|
|
59
|
+
tone: z.ZodOptional<z.ZodString>;
|
|
60
|
+
constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
gdriveFolderId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>, z.ZodString]>>;
|
|
63
|
+
locale: z.ZodOptional<z.ZodString>;
|
|
64
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
65
|
+
message: z.ZodOptional<z.ZodString>;
|
|
66
|
+
modelKey: z.ZodOptional<z.ZodEnum<{
|
|
67
|
+
fast: "fast";
|
|
68
|
+
balanced: "balanced";
|
|
69
|
+
reasoning: "reasoning";
|
|
70
|
+
codex: "codex";
|
|
71
|
+
}>>;
|
|
72
|
+
provider: z.ZodOptional<z.ZodEnum<{
|
|
73
|
+
openai: "openai";
|
|
74
|
+
anthropic: "anthropic";
|
|
75
|
+
gemini: "gemini";
|
|
76
|
+
}>>;
|
|
77
|
+
activeBlockId: z.ZodOptional<z.ZodString>;
|
|
78
|
+
activeBlockType: z.ZodOptional<z.ZodString>;
|
|
79
|
+
activeEditablePath: z.ZodOptional<z.ZodString>;
|
|
80
|
+
executionMode: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
auto: "auto";
|
|
82
|
+
plan_only: "plan_only";
|
|
83
|
+
apply_pending_plan: "apply_pending_plan";
|
|
84
|
+
discard_pending_plan: "discard_pending_plan";
|
|
85
|
+
continue_chain: "continue_chain";
|
|
86
|
+
}>>;
|
|
87
|
+
pendingPlanId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
continuationChainId: z.ZodOptional<z.ZodString>;
|
|
89
|
+
attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
id: z.ZodString;
|
|
91
|
+
kind: z.ZodEnum<{
|
|
92
|
+
image: "image";
|
|
93
|
+
pdf: "pdf";
|
|
94
|
+
}>;
|
|
95
|
+
url: z.ZodString;
|
|
96
|
+
mimeType: z.ZodString;
|
|
97
|
+
name: z.ZodOptional<z.ZodString>;
|
|
98
|
+
bytes: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
}, z.core.$strip>>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
export type ChatRequestBody = z.infer<typeof chatRequestBodySchema>;
|
|
102
|
+
/** Per-op outcome surfaced to the editor for the plan-preview card. Mirrors the engine's OpResult. */
|
|
103
|
+
export type PlanOpResult = {
|
|
104
|
+
index: number;
|
|
105
|
+
op: Operation["op"];
|
|
106
|
+
status: "applied" | "skipped" | "failed";
|
|
107
|
+
reason?: string;
|
|
108
|
+
category?: string;
|
|
109
|
+
};
|
|
110
|
+
export type ChatResult = {
|
|
111
|
+
status: string;
|
|
112
|
+
summary: string;
|
|
113
|
+
changes: string[];
|
|
114
|
+
mentionedSlugs?: string[];
|
|
115
|
+
suggestions?: string[];
|
|
116
|
+
validationErrors?: unknown;
|
|
117
|
+
previewVersion: number;
|
|
118
|
+
focusBlockId?: string;
|
|
119
|
+
updatedSlug?: string;
|
|
120
|
+
undoSlug?: string;
|
|
121
|
+
plannerSource: "openai" | "anthropic" | "gemini" | "demo";
|
|
122
|
+
modelUsed: string;
|
|
123
|
+
modelKey: ModelKey;
|
|
124
|
+
pendingPlanId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* True when a "make a plan first" request was applied to the draft as a
|
|
127
|
+
* revertible soft draft (status "applied"). The editor renders an inline
|
|
128
|
+
* Keep / Revert affordance instead of the held Apply / Discard card; Revert is
|
|
129
|
+
* a one-step undo on `undoSlug`. Nothing is published — it stays a draft.
|
|
130
|
+
*/
|
|
131
|
+
planApplied?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Structured before→after preview of a held plan (plan_ready), computed by a
|
|
134
|
+
* dry-run of the plan's ops. Powers the diff rendered in the approval card so
|
|
135
|
+
* the user sees exactly what will change before confirming — not just the
|
|
136
|
+
* change_log text. `planPreview.opResults` says which ops will apply / skip /
|
|
137
|
+
* fail; `planPreview.diff` is the same PublishDiff shape used by publish review.
|
|
138
|
+
*/
|
|
139
|
+
planPreview?: {
|
|
140
|
+
opResults: PlanOpResult[];
|
|
141
|
+
diff: PublishDiff;
|
|
142
|
+
appliedCount: number;
|
|
143
|
+
skippedCount: number;
|
|
144
|
+
failedCount: number;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Tier-1 destructive-action reasons, surfaced when the approval gate was
|
|
148
|
+
* triggered because the plan contains destructive ops (remove_page with
|
|
149
|
+
* content, multi-page scope, bulk deletes). Rendered as a warning in the
|
|
150
|
+
* approval card so the user sees what will be deleted before confirming.
|
|
151
|
+
*/
|
|
152
|
+
destructiveReasons?: string[];
|
|
153
|
+
continuation?: {
|
|
154
|
+
chainId: string;
|
|
155
|
+
currentStep: number;
|
|
156
|
+
totalSteps: number;
|
|
157
|
+
nextStepLabel: string;
|
|
158
|
+
};
|
|
159
|
+
debug?: {
|
|
160
|
+
traceId: string;
|
|
161
|
+
promptHash: string;
|
|
162
|
+
promptExcerpt: string;
|
|
163
|
+
outcome?: string;
|
|
164
|
+
reasonCategory?: GuardrailErrorCategory;
|
|
165
|
+
reason?: string;
|
|
166
|
+
intent?: EditPlan["intent"];
|
|
167
|
+
opTypes?: string[];
|
|
168
|
+
opCount?: number;
|
|
169
|
+
inputTokens?: number;
|
|
170
|
+
outputTokens?: number;
|
|
171
|
+
totalTokens?: number;
|
|
172
|
+
cacheCreationInputTokens?: number;
|
|
173
|
+
cacheReadInputTokens?: number;
|
|
174
|
+
estimatedUsd?: number | null;
|
|
175
|
+
plannerTier?: "forced_deterministic" | "deterministic" | "llm_intent_router" | "full_llm" | "demo";
|
|
176
|
+
modelUsed?: string;
|
|
177
|
+
plannerSource?: "openai" | "anthropic" | "gemini" | "demo";
|
|
178
|
+
planningAttempts?: number;
|
|
179
|
+
executionMode?: string;
|
|
180
|
+
skippedOpCount?: number;
|
|
181
|
+
skippedOps?: Array<{
|
|
182
|
+
index: number;
|
|
183
|
+
op: string;
|
|
184
|
+
reason: "empty_patch" | "unchanged_value";
|
|
185
|
+
pageSlug?: string;
|
|
186
|
+
blockId?: string;
|
|
187
|
+
}>;
|
|
188
|
+
timeline?: Array<{
|
|
189
|
+
stage: "request_received" | "first_token" | "first_structured_progress" | "plan_ready" | "first_op_applied" | "done";
|
|
190
|
+
atMs: number;
|
|
191
|
+
}>;
|
|
192
|
+
currentPage?: string;
|
|
193
|
+
siteId?: string;
|
|
194
|
+
activeBlockId?: string;
|
|
195
|
+
activeEditablePath?: string;
|
|
196
|
+
/**
|
|
197
|
+
* Auto-routing decision. Populated when the chat pipeline considered an
|
|
198
|
+
* automatic model-tier change (up- or downgrade). `reason: "shadow"` means
|
|
199
|
+
* the upgrade was logged but not applied — used while validating the
|
|
200
|
+
* router's complexity signal before flipping `CHAT_AUTO_UPGRADE_COMPLEX`.
|
|
201
|
+
*/
|
|
202
|
+
routingDecision?: {
|
|
203
|
+
from: "fast" | "balanced" | "reasoning" | "codex";
|
|
204
|
+
to: "fast" | "balanced" | "reasoning" | "codex";
|
|
205
|
+
reason: "simple_downgrade" | "complex_upgrade" | "shadow" | "user_override";
|
|
206
|
+
complexity?: "simple" | "standard" | "complex";
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
export declare function normalizeForIntent(message: string): string;
|
|
211
|
+
export { BLOCK_CATALOG_PATTERNS } from "./intent-patterns.ts";
|
|
212
|
+
export declare function isBlockCatalogQuery(message: string): boolean;
|
|
213
|
+
export declare function stripPositionalAnchorPhrase(message: string): string;
|
|
214
|
+
/** Return the ordered list of BlockType values mentioned in the message. */
|
|
215
|
+
export declare function extractMentionedBlockTypes(message: string): BlockType[];
|
|
216
|
+
/**
|
|
217
|
+
* Returns true when the message is "add X in/to [the Y] heading/subheading/copy/..."
|
|
218
|
+
* — a field-content update phrased with "add", NOT a batch block add.
|
|
219
|
+
* Guards the loose fallback below from false positives when field-targeting
|
|
220
|
+
* prepositions are combined with block-type keyword aliases like "numbers"
|
|
221
|
+
* (Stats) or "copy" (RichText).
|
|
222
|
+
*/
|
|
223
|
+
export declare function isFieldContentUpdateRequest(message: string): boolean;
|
|
224
|
+
export declare function isBatchAddRequest(message: string): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Detects batch remove requests — any remove/delete/clear that implies
|
|
227
|
+
* multiple blocks should be affected. Broadly matches so the LLM can
|
|
228
|
+
* handle the nuance (typos, "this one", etc.) without strict single-op limits.
|
|
229
|
+
*/
|
|
230
|
+
export declare function isPageWideRewriteRequest(message: string): boolean;
|
|
231
|
+
export declare function isBatchReorderRequest(message: string): boolean;
|
|
232
|
+
export declare function isBatchRemoveRequest(message: string): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Detects duplicate/copy/clone requests targeting a block on the current
|
|
235
|
+
* page. The fast LLM intent router's schema has no "duplicate" action
|
|
236
|
+
* (only add|move|update|remove|info|clarify), so these requests must
|
|
237
|
+
* bypass the router and go straight to the full planner, which supports
|
|
238
|
+
* the `duplicate_block` op.
|
|
239
|
+
*/
|
|
240
|
+
export declare function isDuplicateBlockRequest(message: string): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Detects "duplicate this page and modify the content" patterns — duplicate /
|
|
243
|
+
* clone / copy a page combined with a modification verb (populate, fill,
|
|
244
|
+
* suggest, update, modify, change, adjust, replace, rewrite). Used to bypass
|
|
245
|
+
* `chatStrictPrimaryOpMode` so the planner can emit `duplicate_page` plus
|
|
246
|
+
* follow-on `update_props` / `add_block` / `remove_block` ops in one plan.
|
|
247
|
+
*
|
|
248
|
+
* Without this, strict mode truncates duplicate-and-modify plans to just the
|
|
249
|
+
* `duplicate_page` op, leaving the user with an unmodified clone.
|
|
250
|
+
*/
|
|
251
|
+
export declare function isDuplicateAndModifyRequest(message: string): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Detects "show me a plan first" / "plan it before doing" phrasing — the user
|
|
254
|
+
* wants the planner to assemble ops but hold them behind the approval gate
|
|
255
|
+
* instead of auto-applying. Used by the chat pipeline to override
|
|
256
|
+
* `executionMode` to `plan_only` when the message asks for review-before-apply.
|
|
257
|
+
*/
|
|
258
|
+
export declare function requestsPlanFirst(message: string): boolean;
|
|
259
|
+
export declare function isPageBlockListQuery(message: string): boolean;
|
|
260
|
+
export declare function isInfoQuery(message: string): boolean;
|
|
261
|
+
export declare function isPageListQuery(message: string): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* True when the message asks for a mutation that spans the whole site rather
|
|
264
|
+
* than the current page ("update the CTA on all pages", "make the footer
|
|
265
|
+
* site-wide", "change X everywhere"). The single-page deterministic path can't
|
|
266
|
+
* honor this — it would silently narrow the edit to the current page — so the
|
|
267
|
+
* gate defers these to the LLM, whose ops carry pageSlug and can fan out across
|
|
268
|
+
* pages or clarify. See planner-quality issue #29.
|
|
269
|
+
*/
|
|
270
|
+
export declare function hasCrossPageScope(message: string): boolean;
|
|
271
|
+
export declare function isContentQuery(message: string): boolean;
|
|
272
|
+
export declare function isAdviceQuery(message: string): boolean;
|
|
273
|
+
export declare function adviceResponse(args: {
|
|
274
|
+
body: ChatRequestBody;
|
|
275
|
+
current: PageDoc;
|
|
276
|
+
plannerSource: "openai" | "anthropic" | "gemini" | "demo";
|
|
277
|
+
modelUsed: string;
|
|
278
|
+
modelKey: ModelKey;
|
|
279
|
+
}): {
|
|
280
|
+
code: number;
|
|
281
|
+
payload: ChatResult;
|
|
282
|
+
};
|
|
283
|
+
export declare function plannerMessageWithPendingContext(session: string, message: string): string;
|
|
284
|
+
/** Build the site context lines without wrapping in a message. Returns null if empty. */
|
|
285
|
+
export declare function buildSiteContextBlock(args?: {
|
|
286
|
+
sitePurpose?: string;
|
|
287
|
+
siteHosting?: string;
|
|
288
|
+
businessContext?: ChatRequestBody["businessContext"];
|
|
289
|
+
siteContext?: ChatRequestBody["siteContext"];
|
|
290
|
+
pageDirectory?: string;
|
|
291
|
+
}): string | null;
|
|
292
|
+
export declare function withSiteContext(message: string, args?: {
|
|
293
|
+
sitePurpose?: string;
|
|
294
|
+
siteHosting?: string;
|
|
295
|
+
businessContext?: ChatRequestBody["businessContext"];
|
|
296
|
+
siteContext?: ChatRequestBody["siteContext"];
|
|
297
|
+
}): string;
|
|
298
|
+
export declare function stripSiteContextEnvelope(message: string): string;
|
|
299
|
+
export declare function extractSiteContextLineValue(message: string, label: string): string | undefined;
|
|
300
|
+
export declare function infoResponse(args: {
|
|
301
|
+
body: ChatRequestBody;
|
|
302
|
+
current: PageDoc;
|
|
303
|
+
plannerSource: "openai" | "anthropic" | "gemini" | "demo";
|
|
304
|
+
modelUsed: string;
|
|
305
|
+
modelKey: ModelKey;
|
|
306
|
+
}): {
|
|
307
|
+
code: number;
|
|
308
|
+
payload: ChatResult;
|
|
309
|
+
};
|