@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,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIRA integration types.
|
|
3
|
+
* Covers webhook payloads, REST API responses, and internal processing types.
|
|
4
|
+
*/
|
|
5
|
+
export type JiraUser = {
|
|
6
|
+
accountId?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
emailAddress?: string;
|
|
10
|
+
};
|
|
11
|
+
export type JiraIssue = {
|
|
12
|
+
key: string;
|
|
13
|
+
id: string;
|
|
14
|
+
fields: {
|
|
15
|
+
summary: string;
|
|
16
|
+
description: unknown;
|
|
17
|
+
status: {
|
|
18
|
+
name: string;
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
labels: string[];
|
|
22
|
+
attachment: JiraAttachment[];
|
|
23
|
+
reporter?: JiraUser;
|
|
24
|
+
assignee?: JiraUser | null;
|
|
25
|
+
creator?: JiraUser;
|
|
26
|
+
comment?: {
|
|
27
|
+
comments: JiraComment[];
|
|
28
|
+
};
|
|
29
|
+
/** Custom fields can carry siteId, slug, etc. */
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type JiraComment = {
|
|
34
|
+
id: string;
|
|
35
|
+
author: JiraUser;
|
|
36
|
+
body: unknown;
|
|
37
|
+
created: string;
|
|
38
|
+
updated: string;
|
|
39
|
+
};
|
|
40
|
+
export type JiraAttachment = {
|
|
41
|
+
id: string;
|
|
42
|
+
filename: string;
|
|
43
|
+
mimeType: string;
|
|
44
|
+
size: number;
|
|
45
|
+
content: string;
|
|
46
|
+
};
|
|
47
|
+
export type JiraTransition = {
|
|
48
|
+
id: string;
|
|
49
|
+
name: string;
|
|
50
|
+
to: {
|
|
51
|
+
name: string;
|
|
52
|
+
id: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type JiraWebhookPayload = {
|
|
56
|
+
webhookEvent: string;
|
|
57
|
+
issue_event_type_name?: string;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
issue: JiraIssue;
|
|
60
|
+
comment?: JiraComment;
|
|
61
|
+
changelog?: {
|
|
62
|
+
items: Array<{
|
|
63
|
+
field: string;
|
|
64
|
+
fieldtype: string;
|
|
65
|
+
from: string | null;
|
|
66
|
+
fromString: string | null;
|
|
67
|
+
to: string | null;
|
|
68
|
+
toString: string | null;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
user?: JiraUser;
|
|
72
|
+
};
|
|
73
|
+
export type JiraProcessingResult = {
|
|
74
|
+
issueKey: string;
|
|
75
|
+
status: "success" | "error";
|
|
76
|
+
summary: string;
|
|
77
|
+
changes: string[];
|
|
78
|
+
durationMs: number;
|
|
79
|
+
modelUsed?: string;
|
|
80
|
+
published?: boolean;
|
|
81
|
+
error?: string;
|
|
82
|
+
};
|
|
83
|
+
export type JiraProcessingEntry = {
|
|
84
|
+
issueKey: string;
|
|
85
|
+
state: "queued" | "processing" | "done" | "error";
|
|
86
|
+
queuedAt: number;
|
|
87
|
+
startedAt?: number;
|
|
88
|
+
completedAt?: number;
|
|
89
|
+
result?: JiraProcessingResult;
|
|
90
|
+
};
|
|
91
|
+
export type JiraConfig = {
|
|
92
|
+
baseUrl: string;
|
|
93
|
+
email: string;
|
|
94
|
+
apiToken: string;
|
|
95
|
+
webhookSecret?: string;
|
|
96
|
+
agentAccountId?: string;
|
|
97
|
+
/** Legacy alias for reviewStatus — kept so pre-3-stage configs keep working. */
|
|
98
|
+
triggerStatus: string;
|
|
99
|
+
/** Status where tickets wait for agent review / reporter approval before edits. */
|
|
100
|
+
reviewStatus: string;
|
|
101
|
+
/** Status the agent transitions tickets to when it starts applying edits. */
|
|
102
|
+
executeStatus: string;
|
|
103
|
+
/** Status the agent transitions tickets to once draft edits are ready for preview. */
|
|
104
|
+
previewStatus: string;
|
|
105
|
+
doneStatus: string;
|
|
106
|
+
failedStatus?: string;
|
|
107
|
+
siteId: string;
|
|
108
|
+
session: string;
|
|
109
|
+
/** Skip the preview stage: auto-publish after execute and close the ticket. */
|
|
110
|
+
autoPublish: boolean;
|
|
111
|
+
/** Max review rounds per ticket before the agent forces a proceed-or-stop. */
|
|
112
|
+
maxReviewPasses: number;
|
|
113
|
+
pollEnabled: boolean;
|
|
114
|
+
pollJql: string;
|
|
115
|
+
pollIntervalMs: number;
|
|
116
|
+
};
|
|
117
|
+
export declare function loadJiraConfig(): JiraConfig | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIRA integration types.
|
|
3
|
+
* Covers webhook payloads, REST API responses, and internal processing types.
|
|
4
|
+
*/
|
|
5
|
+
export function loadJiraConfig() {
|
|
6
|
+
const baseUrl = process.env.JIRA_BASE_URL?.trim();
|
|
7
|
+
const apiToken = process.env.JIRA_API_TOKEN?.trim();
|
|
8
|
+
if (!baseUrl || !apiToken)
|
|
9
|
+
return null;
|
|
10
|
+
// Status names: prefer the new 3-stage config, fall back to legacy triggerStatus.
|
|
11
|
+
const reviewStatus = process.env.JIRA_REVIEW_STATUS?.trim()
|
|
12
|
+
|| process.env.JIRA_TRIGGER_STATUS?.trim()
|
|
13
|
+
|| "To Do";
|
|
14
|
+
const executeStatus = process.env.JIRA_EXECUTE_STATUS?.trim() || "In Progress";
|
|
15
|
+
const previewStatus = process.env.JIRA_PREVIEW_STATUS?.trim() || "In Review";
|
|
16
|
+
const doneStatus = process.env.JIRA_DONE_STATUS?.trim() || "Done";
|
|
17
|
+
return {
|
|
18
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
19
|
+
email: process.env.JIRA_USER_EMAIL?.trim() ?? "",
|
|
20
|
+
apiToken,
|
|
21
|
+
webhookSecret: process.env.JIRA_WEBHOOK_SECRET?.trim() || undefined,
|
|
22
|
+
agentAccountId: process.env.JIRA_AGENT_ACCOUNT_ID?.trim() || undefined,
|
|
23
|
+
triggerStatus: reviewStatus,
|
|
24
|
+
reviewStatus,
|
|
25
|
+
executeStatus,
|
|
26
|
+
previewStatus,
|
|
27
|
+
doneStatus,
|
|
28
|
+
failedStatus: process.env.JIRA_FAILED_STATUS?.trim() || undefined,
|
|
29
|
+
siteId: process.env.JIRA_SITE_ID?.trim() || "avocado-stories",
|
|
30
|
+
session: process.env.JIRA_SESSION?.trim() || "dev",
|
|
31
|
+
autoPublish: process.env.JIRA_AUTO_PUBLISH === "1",
|
|
32
|
+
maxReviewPasses: Number(process.env.JIRA_MAX_REVIEW_PASSES) || 3,
|
|
33
|
+
pollEnabled: process.env.JIRA_POLL_ENABLED === "1",
|
|
34
|
+
pollJql: process.env.JIRA_POLL_JQL?.trim()
|
|
35
|
+
|| `status in ("${reviewStatus}", "${previewStatus}")`,
|
|
36
|
+
pollIntervalMs: Number(process.env.JIRA_POLL_INTERVAL_MS) || 60_000,
|
|
37
|
+
};
|
|
38
|
+
}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
info(obj: object, msg?: string): void;
|
|
3
|
+
info(msg: string): void;
|
|
4
|
+
warn(obj: object, msg?: string): void;
|
|
5
|
+
warn(msg: string): void;
|
|
6
|
+
error(obj: object, msg?: string): void;
|
|
7
|
+
error(msg: string): void;
|
|
8
|
+
debug(obj: object, msg?: string): void;
|
|
9
|
+
debug(msg: string): void;
|
|
10
|
+
}
|
|
11
|
+
/** Console-backed Logger. Useful as a default in createOrchestrator(). */
|
|
12
|
+
export declare function consoleLogger(): Logger;
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Console-backed Logger. Useful as a default in createOrchestrator(). */
|
|
2
|
+
export function consoleLogger() {
|
|
3
|
+
const fmt = (level, a, b) => {
|
|
4
|
+
if (typeof a === "string")
|
|
5
|
+
return `[${level}] ${a}`;
|
|
6
|
+
if (b !== undefined)
|
|
7
|
+
return [`[${level}] ${b}`, a];
|
|
8
|
+
return [`[${level}]`, a];
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
info: (a, b) => {
|
|
12
|
+
const out = fmt("info", a, b);
|
|
13
|
+
Array.isArray(out) ? console.log(...out) : console.log(out);
|
|
14
|
+
},
|
|
15
|
+
warn: (a, b) => {
|
|
16
|
+
const out = fmt("warn", a, b);
|
|
17
|
+
Array.isArray(out) ? console.warn(...out) : console.warn(out);
|
|
18
|
+
},
|
|
19
|
+
error: (a, b) => {
|
|
20
|
+
const out = fmt("error", a, b);
|
|
21
|
+
Array.isArray(out) ? console.error(...out) : console.error(out);
|
|
22
|
+
},
|
|
23
|
+
debug: (a, b) => {
|
|
24
|
+
const out = fmt("debug", a, b);
|
|
25
|
+
Array.isArray(out) ? console.debug(...out) : console.debug(out);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|