agent-steward 0.0.2 → 0.0.4
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/CHANGELOG.md +45 -2
- package/CROSS_PLATFORM.md +11 -9
- package/README.md +11 -10
- package/ROADMAP-STRATEGY.md +93 -44
- package/ROADMAP.md +148 -1017
- package/dist/core/cron-to-schtasks.d.ts +0 -8
- package/dist/core/cron-to-schtasks.d.ts.map +1 -1
- package/dist/core/cron-to-schtasks.js +11 -86
- package/dist/core/dlq-api.d.ts +44 -0
- package/dist/core/dlq-api.d.ts.map +1 -0
- package/dist/core/dlq-api.js +68 -0
- package/dist/core/dry-run.d.ts.map +1 -1
- package/dist/core/dry-run.js +19 -2
- package/dist/core/file-watcher.js +9 -9
- package/dist/core/git-trigger.js +4 -4
- package/dist/core/lock.d.ts +20 -4
- package/dist/core/lock.d.ts.map +1 -1
- package/dist/core/lock.js +99 -26
- package/dist/core/one-shot.d.ts +31 -5
- package/dist/core/one-shot.d.ts.map +1 -1
- package/dist/core/one-shot.js +78 -10
- package/dist/core/opencode-cli.d.ts +28 -0
- package/dist/core/opencode-cli.d.ts.map +1 -0
- package/dist/core/opencode-cli.js +74 -0
- package/dist/core/opencode-models.d.ts +62 -0
- package/dist/core/opencode-models.d.ts.map +1 -0
- package/dist/core/opencode-models.js +277 -0
- package/dist/core/otel.js +2 -2
- package/dist/core/ps-wrapper.d.ts +1 -1
- package/dist/core/ps-wrapper.d.ts.map +1 -1
- package/dist/core/ps-wrapper.js +66 -36
- package/dist/core/record-history.d.ts +15 -0
- package/dist/core/record-history.d.ts.map +1 -1
- package/dist/core/record-history.js +78 -54
- package/dist/core/router/dispatch.d.ts +36 -0
- package/dist/core/router/dispatch.d.ts.map +1 -0
- package/dist/core/router/dispatch.js +59 -0
- package/dist/core/router/escalation.d.ts +47 -0
- package/dist/core/router/escalation.d.ts.map +1 -0
- package/dist/core/router/escalation.js +87 -0
- package/dist/core/router/planner.d.ts +53 -0
- package/dist/core/router/planner.d.ts.map +1 -0
- package/dist/core/router/planner.js +113 -0
- package/dist/core/router/rules.d.ts +46 -0
- package/dist/core/router/rules.d.ts.map +1 -0
- package/dist/core/router/rules.js +85 -0
- package/dist/core/run-panel-api.d.ts +94 -0
- package/dist/core/run-panel-api.d.ts.map +1 -0
- package/dist/core/run-panel-api.js +169 -0
- package/dist/core/schedule-gate.js +5 -1
- package/dist/core/schedule-v2.d.ts +36 -2
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +98 -12
- package/dist/core/scheduler/at-fallback.d.ts +95 -0
- package/dist/core/scheduler/at-fallback.d.ts.map +1 -0
- package/dist/core/scheduler/at-fallback.js +200 -0
- package/dist/core/scheduler/linux.d.ts +13 -2
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +67 -13
- package/dist/core/scheduler/mac.d.ts +14 -8
- package/dist/core/scheduler/mac.d.ts.map +1 -1
- package/dist/core/scheduler/mac.js +71 -22
- package/dist/core/scheduler/posix.d.ts.map +1 -1
- package/dist/core/scheduler/posix.js +37 -2
- package/dist/core/scheduler/registry.d.ts +13 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -1
- package/dist/core/scheduler/registry.js +83 -21
- package/dist/core/scheduler/run-now.d.ts +16 -0
- package/dist/core/scheduler/run-now.d.ts.map +1 -0
- package/dist/core/scheduler/run-now.js +28 -0
- package/dist/core/scheduler/windows.d.ts +16 -3
- package/dist/core/scheduler/windows.d.ts.map +1 -1
- package/dist/core/scheduler/windows.js +249 -96
- package/dist/core/secrets.d.ts.map +1 -1
- package/dist/core/secrets.js +127 -30
- package/dist/core/self-analysis.js +55 -55
- package/dist/core/session.d.ts.map +1 -1
- package/dist/core/session.js +18 -11
- package/dist/core/summary.js +1 -1
- package/dist/core/task-name.d.ts +24 -0
- package/dist/core/task-name.d.ts.map +1 -0
- package/dist/core/task-name.js +40 -0
- package/dist/core/triage-chain.js +1 -1
- package/dist/core/triage-worker.js +2 -2
- package/dist/core/triage.js +1 -1
- package/dist/core/wrappers/bash.d.ts.map +1 -1
- package/dist/core/wrappers/bash.js +82 -37
- package/dist/db/capability-repo.d.ts +83 -0
- package/dist/db/capability-repo.d.ts.map +1 -0
- package/dist/db/capability-repo.js +182 -0
- package/dist/db/history-repo.d.ts +8 -0
- package/dist/db/history-repo.d.ts.map +1 -1
- package/dist/db/history-repo.js +19 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +48 -2
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +3 -1
- package/dist/db/run-context.d.ts +103 -0
- package/dist/db/run-context.d.ts.map +1 -0
- package/dist/db/run-context.js +224 -0
- package/dist/db/run-dlq.d.ts +100 -0
- package/dist/db/run-dlq.d.ts.map +1 -0
- package/dist/db/run-dlq.js +191 -0
- package/dist/db/run-journal.d.ts +60 -0
- package/dist/db/run-journal.d.ts.map +1 -0
- package/dist/db/run-journal.js +143 -0
- package/dist/db/run-resume.d.ts +51 -0
- package/dist/db/run-resume.d.ts.map +1 -0
- package/dist/db/run-resume.js +156 -0
- package/dist/db/runs-repo.d.ts +128 -0
- package/dist/db/runs-repo.d.ts.map +1 -0
- package/dist/db/runs-repo.js +342 -0
- package/dist/db/schema.d.ts +16 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +342 -35
- package/dist/db/settings-repo.d.ts +11 -0
- package/dist/db/settings-repo.d.ts.map +1 -1
- package/dist/db/settings-repo.js +25 -0
- package/dist/db/step-idempotency.d.ts +51 -0
- package/dist/db/step-idempotency.d.ts.map +1 -0
- package/dist/db/step-idempotency.js +136 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +168 -40
- package/dist/notifications.js +18 -18
- package/dist/profiles.d.ts +7 -3
- package/dist/profiles.d.ts.map +1 -1
- package/dist/profiles.js +85 -7
- package/dist/rpc.d.ts +787 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +324 -0
- package/dist/server.d.ts +33 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +115 -54
- package/dist/shared/jobs-view.d.ts.map +1 -1
- package/dist/skill.js +1 -1
- package/dist/task-transfer.d.ts +1 -1
- package/dist/task-transfer.d.ts.map +1 -1
- package/dist/task-transfer.js +14 -10
- package/dist/types.d.ts +20 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +44 -9
- package/dist/workspaces.d.ts +25 -3
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +44 -9
- package/docs/ARCHITECTURE.md +335 -9
- package/docs/COMPATIBILITY.md +10 -6
- package/docs/CONCEPT.md +183 -91
- package/docs/CROSS_PLATFORM.ru.md +11 -9
- package/docs/CROSS_PLATFORM.zh.md +11 -9
- package/docs/EXECUTION-LOOP.md +196 -0
- package/docs/FAQ.md +2 -2
- package/docs/FAQ.ru.md +2 -2
- package/docs/FAQ.zh.md +2 -2
- package/docs/FEATURES.md +5 -4
- package/docs/FEATURES.zh.md +5 -4
- package/docs/MIGRATION.md +34 -26
- package/docs/README.ru.md +27 -8
- package/docs/README.zh.md +11 -10
- package/docs/SAFETY.md +122 -0
- package/docs/SAVINGS.md +29 -0
- package/docs/SAVINGS.ru.md +29 -0
- package/docs/SAVINGS.zh.md +18 -0
- package/docs/V1-V2-COMPATIBILITY-PLAN.md +6 -6
- package/gui-experimental.cjs +8 -8
- package/index.js +1 -0
- package/locales/en.json +68 -0
- package/locales/ru.json +68 -0
- package/locales/zh.json +68 -0
- package/package.json +57 -11
- package/scripts/audit-bundle.mjs +215 -0
- package/src/core/analytics.ts +2 -2
- package/src/core/audit.ts +17 -17
- package/src/core/cron-to-schtasks.ts +14 -93
- package/src/core/dlq-api.ts +98 -0
- package/src/core/dry-run.ts +51 -27
- package/src/core/file-watcher.ts +17 -17
- package/src/core/git-trigger.ts +9 -9
- package/src/core/glob.ts +1 -1
- package/src/core/local-ai.ts +2 -2
- package/src/core/lock.ts +104 -31
- package/src/core/matrix.ts +31 -31
- package/src/core/native-notify.ts +2 -2
- package/src/core/one-shot.ts +91 -13
- package/src/core/opencode-cli.ts +103 -0
- package/src/core/opencode-models.ts +315 -0
- package/src/core/otel.ts +4 -4
- package/src/core/permissions.ts +5 -5
- package/src/core/prometheus.ts +17 -17
- package/src/core/ps-wrapper.ts +68 -38
- package/src/core/record-history.ts +114 -76
- package/src/core/retention.ts +3 -3
- package/src/core/router/dispatch.ts +94 -0
- package/src/core/router/escalation.ts +129 -0
- package/src/core/router/planner.ts +166 -0
- package/src/core/router/rules.ts +109 -0
- package/src/core/run-panel-api.ts +262 -0
- package/src/core/savings.ts +1 -1
- package/src/core/schedule-gate.ts +17 -13
- package/src/core/schedule-v2.ts +138 -29
- package/src/core/scheduler/at-fallback.ts +298 -0
- package/src/core/scheduler/index.ts +3 -3
- package/src/core/scheduler/linux.ts +92 -19
- package/src/core/scheduler/logs.ts +1 -1
- package/src/core/scheduler/mac.ts +112 -60
- package/src/core/scheduler/posix.ts +35 -2
- package/src/core/scheduler/registry.ts +109 -26
- package/src/core/scheduler/run-now.ts +32 -0
- package/src/core/scheduler/windows.ts +295 -125
- package/src/core/secrets.ts +139 -39
- package/src/core/self-analysis.ts +61 -61
- package/src/core/session.ts +26 -13
- package/src/core/structured-log.ts +3 -3
- package/src/core/summary.ts +25 -25
- package/src/core/task-name.ts +67 -0
- package/src/core/telegram.ts +16 -16
- package/src/core/triage-chain.ts +4 -4
- package/src/core/triage-compare.ts +8 -8
- package/src/core/triage-rules.ts +4 -4
- package/src/core/triage-shadow.ts +7 -7
- package/src/core/triage-worker.ts +6 -6
- package/src/core/triage.ts +23 -23
- package/src/core/watch-paths.ts +1 -1
- package/src/core/wrappers/bash.ts +90 -45
- package/src/db/capability-repo.ts +285 -0
- package/src/db/git-state-repo.ts +1 -1
- package/src/db/history-repo.ts +44 -22
- package/src/db/index.ts +53 -7
- package/src/db/metrics-repo.ts +10 -10
- package/src/db/migrate.ts +13 -11
- package/src/db/recovery.ts +3 -3
- package/src/db/run-context.ts +370 -0
- package/src/db/run-dlq.ts +310 -0
- package/src/db/run-journal.ts +212 -0
- package/src/db/run-resume.ts +256 -0
- package/src/db/runs-repo.ts +504 -0
- package/src/db/schema.ts +357 -44
- package/src/db/settings-repo.ts +33 -2
- package/src/db/step-idempotency.ts +185 -0
- package/src/db/tasks-repo.ts +10 -10
- package/src/db/templates-repo.ts +7 -7
- package/src/gui.tsx +516 -1
- package/src/history.ts +4 -4
- package/src/i18n.ts +7 -7
- package/src/index.ts +465 -308
- package/src/integrations.ts +6 -6
- package/src/notifications.ts +76 -76
- package/src/profiles.ts +98 -7
- package/src/rpc.ts +347 -1
- package/src/schtasks.ts +2 -2
- package/src/server.ts +155 -78
- package/src/settings.ts +44 -44
- package/src/shared/jobs-view.ts +60 -60
- package/src/skill.ts +1 -1
- package/src/task-transfer.ts +58 -56
- package/src/templates.ts +1 -1
- package/src/types.ts +54 -10
- package/src/workspaces.ts +73 -24
- package/dist/core/self-analysis.test.d.ts +0 -2
- package/dist/core/self-analysis.test.d.ts.map +0 -1
- package/dist/core/self-analysis.test.js +0 -219
- package/dist/gui-experimental.cjs +0 -1
package/src/integrations.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function signHookPayload(secret: string, body: Buffer | string): string {
|
|
|
70
70
|
export function signHookPayloadWithTimestamp(
|
|
71
71
|
secret: string,
|
|
72
72
|
timestamp: string,
|
|
73
|
-
body: Buffer | string
|
|
73
|
+
body: Buffer | string,
|
|
74
74
|
): string {
|
|
75
75
|
const payload = Buffer.isBuffer(body) ? body : Buffer.from(body, "utf8");
|
|
76
76
|
const prefixed = Buffer.concat([Buffer.from(`${timestamp}.`, "utf8"), payload]);
|
|
@@ -106,7 +106,7 @@ export function verifyHookSignature(
|
|
|
106
106
|
secret: string,
|
|
107
107
|
body: Buffer | string,
|
|
108
108
|
signature: string | null,
|
|
109
|
-
timestamp?: string | null
|
|
109
|
+
timestamp?: string | null,
|
|
110
110
|
): boolean {
|
|
111
111
|
if (!secret || !signature) return false;
|
|
112
112
|
const normalized = signature.trim();
|
|
@@ -128,7 +128,7 @@ export function verifyHookSignature(
|
|
|
128
128
|
export function verifyHookTimestamp(
|
|
129
129
|
value: string | null,
|
|
130
130
|
toleranceSeconds: number,
|
|
131
|
-
nowMs = Date.now()
|
|
131
|
+
nowMs = Date.now(),
|
|
132
132
|
): { ok: boolean; reason?: string } {
|
|
133
133
|
if (!value || toleranceSeconds <= 0) return { ok: true };
|
|
134
134
|
const trimmed = value.trim();
|
|
@@ -219,7 +219,7 @@ export function authenticateHookRequest(input: HookAuthInput): HookAuthResult {
|
|
|
219
219
|
settings.secret,
|
|
220
220
|
input.body,
|
|
221
221
|
input.signature,
|
|
222
|
-
needsSignedTimestamp ? timestampValue : null
|
|
222
|
+
needsSignedTimestamp ? timestampValue : null,
|
|
223
223
|
)
|
|
224
224
|
) {
|
|
225
225
|
return { ok: false, status: 401, error: "Неверная HMAC-подпись." };
|
|
@@ -228,7 +228,7 @@ export function authenticateHookRequest(input: HookAuthInput): HookAuthResult {
|
|
|
228
228
|
const timestamp = verifyHookTimestamp(
|
|
229
229
|
timestampValue,
|
|
230
230
|
settings.timestampToleranceSeconds,
|
|
231
|
-
input.nowMs
|
|
231
|
+
input.nowMs,
|
|
232
232
|
);
|
|
233
233
|
if (!timestamp.ok) {
|
|
234
234
|
return { ok: false, status: 401, error: timestamp.reason };
|
|
@@ -248,7 +248,7 @@ export type BodyReadResult =
|
|
|
248
248
|
*/
|
|
249
249
|
export function readRequestBody(
|
|
250
250
|
req: http.IncomingMessage,
|
|
251
|
-
maxBytes: number
|
|
251
|
+
maxBytes: number,
|
|
252
252
|
): Promise<BodyReadResult> {
|
|
253
253
|
return new Promise((resolve) => {
|
|
254
254
|
const limit = Math.max(1, Math.floor(maxBytes) || 1);
|
package/src/notifications.ts
CHANGED
|
@@ -91,7 +91,7 @@ export function wildcardMatch(pattern: string, value: string): boolean {
|
|
|
91
91
|
/** Проверяет, разрешена ли задача фильтрами include/exclude. */
|
|
92
92
|
export function isTaskAllowed(
|
|
93
93
|
taskName: string,
|
|
94
|
-
filters?: NotificationFilters
|
|
94
|
+
filters?: NotificationFilters,
|
|
95
95
|
): boolean {
|
|
96
96
|
if (!filters) return true;
|
|
97
97
|
const name = (taskName ?? "").trim();
|
|
@@ -106,10 +106,10 @@ export function isTaskAllowed(
|
|
|
106
106
|
/** Подставляет {key} в шаблон; неизвестные плейсхолдеры остаются как есть. */
|
|
107
107
|
export function renderTemplate(
|
|
108
108
|
template: string,
|
|
109
|
-
vars: Record<string, string
|
|
109
|
+
vars: Record<string, string>,
|
|
110
110
|
): string {
|
|
111
111
|
return template.replace(/\{(\w+)\}/g, (match, key: string) =>
|
|
112
|
-
Object.prototype.hasOwnProperty.call(vars, key) ? vars[key] : match
|
|
112
|
+
Object.prototype.hasOwnProperty.call(vars, key) ? vars[key] : match,
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -120,7 +120,7 @@ export function renderTemplate(
|
|
|
120
120
|
*/
|
|
121
121
|
export function formatNotificationMessage(
|
|
122
122
|
payload: NotificationPayload,
|
|
123
|
-
templates?: NotificationTemplates
|
|
123
|
+
templates?: NotificationTemplates,
|
|
124
124
|
): string {
|
|
125
125
|
const { taskName, status, durationMs, error } = payload;
|
|
126
126
|
const duration = formatDuration(durationMs);
|
|
@@ -250,7 +250,7 @@ function validateWebhookUrl(url: string): URL {
|
|
|
250
250
|
async function postOnce(
|
|
251
251
|
parsed: URL,
|
|
252
252
|
message: string,
|
|
253
|
-
timeoutMs: number
|
|
253
|
+
timeoutMs: number,
|
|
254
254
|
): Promise<void> {
|
|
255
255
|
const controller = new AbortController();
|
|
256
256
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
@@ -267,14 +267,14 @@ async function postOnce(
|
|
|
267
267
|
const retryable = response.status >= 500 || response.status === 429;
|
|
268
268
|
throw new WebhookError(
|
|
269
269
|
`HTTP ${response.status}${body ? `: ${body.slice(0, 200)}` : ""}`,
|
|
270
|
-
retryable
|
|
270
|
+
retryable,
|
|
271
271
|
);
|
|
272
272
|
}
|
|
273
273
|
} catch (err: any) {
|
|
274
274
|
if (err?.name === "AbortError") {
|
|
275
275
|
throw new WebhookError(
|
|
276
276
|
t("notify.error.webhookTimeout", { seconds: timeoutMs / 1000 }),
|
|
277
|
-
true
|
|
277
|
+
true,
|
|
278
278
|
);
|
|
279
279
|
}
|
|
280
280
|
if (err instanceof WebhookError) throw err;
|
|
@@ -296,7 +296,7 @@ async function postOnce(
|
|
|
296
296
|
export async function sendWebhook(
|
|
297
297
|
url: string,
|
|
298
298
|
message: string,
|
|
299
|
-
options: WebhookOptions = {}
|
|
299
|
+
options: WebhookOptions = {},
|
|
300
300
|
): Promise<void> {
|
|
301
301
|
const parsed = validateWebhookUrl(url);
|
|
302
302
|
const timeoutMs = Math.max(1, Math.floor(options.timeoutMs ?? REQUEST_TIMEOUT_MS));
|
|
@@ -316,7 +316,7 @@ export async function sendWebhook(
|
|
|
316
316
|
if (!retryable || attempt === attempts - 1) break;
|
|
317
317
|
const delay = Math.min(
|
|
318
318
|
MAX_RETRY_DELAY_MS,
|
|
319
|
-
retryDelayMs * 2 ** attempt
|
|
319
|
+
retryDelayMs * 2 ** attempt,
|
|
320
320
|
);
|
|
321
321
|
await sleep(delay);
|
|
322
322
|
}
|
|
@@ -349,12 +349,12 @@ export interface ChannelDeliveryResult {
|
|
|
349
349
|
*/
|
|
350
350
|
export function isQuietHours(
|
|
351
351
|
now: Date,
|
|
352
|
-
quiet?: { enabled?: boolean; from?: string; to?: string } | null
|
|
352
|
+
quiet?: { enabled?: boolean; from?: string; to?: string } | null,
|
|
353
353
|
): boolean {
|
|
354
354
|
if (!quiet?.enabled) return false;
|
|
355
355
|
const parse = (value: unknown): number | null => {
|
|
356
356
|
const match = /^([01]\d|2[0-3]):([0-5]\d)$/.exec(
|
|
357
|
-
typeof value === "string" ? value.trim() : ""
|
|
357
|
+
typeof value === "string" ? value.trim() : "",
|
|
358
358
|
);
|
|
359
359
|
return match ? Number(match[1]) * 60 + Number(match[2]) : null;
|
|
360
360
|
};
|
|
@@ -369,7 +369,7 @@ export function isQuietHours(
|
|
|
369
369
|
|
|
370
370
|
/** URL дашборда: настройка, иначе фактический порт сервера, иначе null. */
|
|
371
371
|
async function resolveDashboardUrl(
|
|
372
|
-
config: NotificationSettings
|
|
372
|
+
config: NotificationSettings,
|
|
373
373
|
): Promise<string | null> {
|
|
374
374
|
const custom = (config.dashboardUrl ?? "").trim();
|
|
375
375
|
if (custom) return custom;
|
|
@@ -403,7 +403,7 @@ function telegramCredentials(config: NotificationSettings): {
|
|
|
403
403
|
async function deliverDetailed(
|
|
404
404
|
config: NotificationSettings,
|
|
405
405
|
message: string,
|
|
406
|
-
only?: NotificationChannel
|
|
406
|
+
only?: NotificationChannel,
|
|
407
407
|
): Promise<ChannelDeliveryResult[]> {
|
|
408
408
|
const results: ChannelDeliveryResult[] = [];
|
|
409
409
|
const dashboardUrl = await resolveDashboardUrl(config);
|
|
@@ -417,11 +417,11 @@ async function deliverDetailed(
|
|
|
417
417
|
) {
|
|
418
418
|
try {
|
|
419
419
|
await sendWebhook(webhook.url, message, webhookOptionsFrom(config));
|
|
420
|
-
console.log("[
|
|
420
|
+
console.log("[agent-steward] Уведомление отправлено в webhook.");
|
|
421
421
|
results.push({ channel: "webhook", ok: true });
|
|
422
422
|
} catch (err: any) {
|
|
423
423
|
const text = err instanceof Error ? err.message : String(err);
|
|
424
|
-
console.error(`[
|
|
424
|
+
console.error(`[agent-steward] Webhook: ${text}`);
|
|
425
425
|
results.push({ channel: "webhook", ok: false, error: text });
|
|
426
426
|
}
|
|
427
427
|
}
|
|
@@ -431,7 +431,7 @@ async function deliverDetailed(
|
|
|
431
431
|
const { token, chatId } = telegramCredentials(config);
|
|
432
432
|
if (!token || !chatId) {
|
|
433
433
|
const text = t("notify.error.telegramNoCreds");
|
|
434
|
-
console.error(`[
|
|
434
|
+
console.error(`[agent-steward] ${text}`);
|
|
435
435
|
results.push({ channel: "telegram", ok: false, error: text });
|
|
436
436
|
} else {
|
|
437
437
|
try {
|
|
@@ -443,11 +443,11 @@ async function deliverDetailed(
|
|
|
443
443
|
includeDashboardLink: telegram.includeDashboardLink,
|
|
444
444
|
dashboardUrl,
|
|
445
445
|
});
|
|
446
|
-
console.log("[
|
|
446
|
+
console.log("[agent-steward] Уведомление отправлено в Telegram.");
|
|
447
447
|
results.push({ channel: "telegram", ok: true });
|
|
448
448
|
} catch (err: any) {
|
|
449
449
|
const text = err instanceof Error ? err.message : String(err);
|
|
450
|
-
console.error(`[
|
|
450
|
+
console.error(`[agent-steward] Telegram: ${text}`);
|
|
451
451
|
results.push({ channel: "telegram", ok: false, error: text });
|
|
452
452
|
}
|
|
453
453
|
}
|
|
@@ -457,14 +457,14 @@ async function deliverDetailed(
|
|
|
457
457
|
if ((!only || only === "native") && config.enabled && native?.enabled) {
|
|
458
458
|
const result = await sendNativeNotification(
|
|
459
459
|
{ title: t("notify.native.title"), body: message, sound: native.sound },
|
|
460
|
-
{}
|
|
460
|
+
{},
|
|
461
461
|
);
|
|
462
462
|
if (result.success) {
|
|
463
|
-
console.log("[
|
|
463
|
+
console.log("[agent-steward] Нативное уведомление показано.");
|
|
464
464
|
results.push({ channel: "native", ok: true });
|
|
465
465
|
} else {
|
|
466
466
|
const text = result.error ?? t("notify.error.nativeFailed");
|
|
467
|
-
console.error(`[
|
|
467
|
+
console.error(`[agent-steward] Нативное уведомление: ${text}`);
|
|
468
468
|
results.push({ channel: "native", ok: false, error: text });
|
|
469
469
|
}
|
|
470
470
|
}
|
|
@@ -507,7 +507,7 @@ export interface DedupRecord {
|
|
|
507
507
|
|
|
508
508
|
/** Ключ дедупа: комбинация задачи и статуса. */
|
|
509
509
|
function dedupKey(taskName: string, status: string): string {
|
|
510
|
-
return (taskName +
|
|
510
|
+
return (taskName + "|" + status).toLowerCase();
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
/** Читает или создаёт запись дедупа. Возвращает { record, isDuplicate }.
|
|
@@ -519,7 +519,7 @@ function dedupReadOrCreate(
|
|
|
519
519
|
key: string,
|
|
520
520
|
taskName: string,
|
|
521
521
|
status: string,
|
|
522
|
-
dedup: NotificationDedupSettings
|
|
522
|
+
dedup: NotificationDedupSettings,
|
|
523
523
|
): { record: DedupRecord; isDuplicate: boolean } {
|
|
524
524
|
const now = new Date().toISOString();
|
|
525
525
|
const row = db
|
|
@@ -528,7 +528,7 @@ function dedupReadOrCreate(
|
|
|
528
528
|
|
|
529
529
|
if (!row) {
|
|
530
530
|
db.prepare(
|
|
531
|
-
"INSERT INTO notification_dedup (key, task_name, status, count, first_at, last_at, window_minutes) VALUES (?, ?, ?, 1, ?, ?, ?)"
|
|
531
|
+
"INSERT INTO notification_dedup (key, task_name, status, count, first_at, last_at, window_minutes) VALUES (?, ?, ?, 1, ?, ?, ?)",
|
|
532
532
|
).run(key, taskName, status, now, now, dedup.windowMinutes);
|
|
533
533
|
return {
|
|
534
534
|
record: {
|
|
@@ -551,7 +551,7 @@ function dedupReadOrCreate(
|
|
|
551
551
|
if (nowMs - last > windowMs) {
|
|
552
552
|
// Окно истекло — начинаем заново.
|
|
553
553
|
db.prepare(
|
|
554
|
-
"UPDATE notification_dedup SET count = 1, first_at = ?, last_at = ?, window_minutes = ? WHERE key = ?"
|
|
554
|
+
"UPDATE notification_dedup SET count = 1, first_at = ?, last_at = ?, window_minutes = ? WHERE key = ?",
|
|
555
555
|
).run(now, now, dedup.windowMinutes, key);
|
|
556
556
|
return {
|
|
557
557
|
record: {
|
|
@@ -569,7 +569,7 @@ function dedupReadOrCreate(
|
|
|
569
569
|
|
|
570
570
|
const count = Math.min(Number(row.count) + 1, dedup.maxCount);
|
|
571
571
|
db.prepare(
|
|
572
|
-
"UPDATE notification_dedup SET count = ?, last_at = ? WHERE key = ?"
|
|
572
|
+
"UPDATE notification_dedup SET count = ?, last_at = ? WHERE key = ?",
|
|
573
573
|
).run(count, now, key);
|
|
574
574
|
return {
|
|
575
575
|
record: {
|
|
@@ -588,10 +588,10 @@ function dedupReadOrCreate(
|
|
|
588
588
|
/** Подавлять ли уведомление по дедупу: только если не важный статус. */
|
|
589
589
|
function isDedupSuppressed(
|
|
590
590
|
status: string,
|
|
591
|
-
dedup: NotificationDedupSettings
|
|
591
|
+
dedup: NotificationDedupSettings,
|
|
592
592
|
): boolean {
|
|
593
593
|
const important = dedup.importantStatuses.some(
|
|
594
|
-
(s: string) => s.toLowerCase() === status.toLowerCase()
|
|
594
|
+
(s: string) => s.toLowerCase() === status.toLowerCase(),
|
|
595
595
|
);
|
|
596
596
|
return !important;
|
|
597
597
|
}
|
|
@@ -599,7 +599,7 @@ function isDedupSuppressed(
|
|
|
599
599
|
/** Добавляет счётчик повторов к сообщению, если это не первое уведомление. */
|
|
600
600
|
function messageWithDedupCount(message: string, count: number): string {
|
|
601
601
|
if (count <= 1) return message;
|
|
602
|
-
return message +
|
|
602
|
+
return message + " " + t("notify.dedup.count", { count });
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
/**
|
|
@@ -636,7 +636,7 @@ function fnv1a32(value: string): number {
|
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
function embeddingKey(taskName: string, status: string): string {
|
|
639
|
-
return `emb:${(taskName +
|
|
639
|
+
return `emb:${(taskName + "|" + status).toLowerCase()}`;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
/** Простой токенизатор: слова, цифры, нижний регистр. */
|
|
@@ -710,21 +710,21 @@ function embeddingExists(
|
|
|
710
710
|
status: string,
|
|
711
711
|
message: string,
|
|
712
712
|
threshold: number,
|
|
713
|
-
windowMinutes: number
|
|
713
|
+
windowMinutes: number,
|
|
714
714
|
): { found: boolean; key: string } | null {
|
|
715
715
|
const since = new Date(
|
|
716
|
-
Date.now() - windowMinutes * 60_000
|
|
716
|
+
Date.now() - windowMinutes * 60_000,
|
|
717
717
|
).toISOString();
|
|
718
718
|
const rows = db
|
|
719
719
|
.prepare(
|
|
720
720
|
"SELECT key, embedding_json FROM notification_embeddings " +
|
|
721
721
|
"WHERE task_name = ? AND status = ? AND created_at >= ? " +
|
|
722
|
-
"ORDER BY created_at DESC LIMIT 500"
|
|
722
|
+
"ORDER BY created_at DESC LIMIT 500",
|
|
723
723
|
)
|
|
724
|
-
.all(taskName, status, since) as
|
|
724
|
+
.all(taskName, status, since) as {
|
|
725
725
|
key: string;
|
|
726
726
|
embedding_json: string;
|
|
727
|
-
}
|
|
727
|
+
}[];
|
|
728
728
|
const vec = textToVector(message);
|
|
729
729
|
let bestKey = "";
|
|
730
730
|
let bestSim = 0;
|
|
@@ -757,14 +757,14 @@ function storeEmbedding(
|
|
|
757
757
|
status: string,
|
|
758
758
|
message: string,
|
|
759
759
|
vector: number[],
|
|
760
|
-
windowMinutes: number
|
|
760
|
+
windowMinutes: number,
|
|
761
761
|
): void {
|
|
762
762
|
const now = new Date().toISOString();
|
|
763
763
|
const key =
|
|
764
764
|
embeddingKey(taskName, status) +
|
|
765
765
|
`:${Date.now().toString(36)}:${Math.random().toString(36).slice(2, 8)}`;
|
|
766
766
|
db.prepare(
|
|
767
|
-
"INSERT INTO notification_embeddings (key, task_name, status, message_text, embedding_json, dimension, created_at, window_minutes) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
|
767
|
+
"INSERT INTO notification_embeddings (key, task_name, status, message_text, embedding_json, dimension, created_at, window_minutes) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
768
768
|
).run(
|
|
769
769
|
key,
|
|
770
770
|
taskName,
|
|
@@ -773,7 +773,7 @@ function storeEmbedding(
|
|
|
773
773
|
JSON.stringify(vector),
|
|
774
774
|
vector.length,
|
|
775
775
|
now,
|
|
776
|
-
windowMinutes
|
|
776
|
+
windowMinutes,
|
|
777
777
|
);
|
|
778
778
|
}
|
|
779
779
|
|
|
@@ -781,18 +781,18 @@ function storeEmbedding(
|
|
|
781
781
|
function cleanupEmbeddings(
|
|
782
782
|
db: ReturnType<typeof getDb>,
|
|
783
783
|
windowMinutes: number,
|
|
784
|
-
maxVectors?: number
|
|
784
|
+
maxVectors?: number,
|
|
785
785
|
): void {
|
|
786
786
|
const since = new Date(
|
|
787
|
-
Date.now() - windowMinutes * 60_000
|
|
787
|
+
Date.now() - windowMinutes * 60_000,
|
|
788
788
|
).toISOString();
|
|
789
789
|
db.prepare(
|
|
790
|
-
"DELETE FROM notification_embeddings WHERE created_at < ?"
|
|
790
|
+
"DELETE FROM notification_embeddings WHERE created_at < ?",
|
|
791
791
|
).run(since);
|
|
792
792
|
if (maxVectors && maxVectors > 0) {
|
|
793
793
|
db.prepare(
|
|
794
794
|
"DELETE FROM notification_embeddings WHERE key NOT IN (" +
|
|
795
|
-
"SELECT key FROM notification_embeddings ORDER BY created_at DESC LIMIT ?)"
|
|
795
|
+
"SELECT key FROM notification_embeddings ORDER BY created_at DESC LIMIT ?)",
|
|
796
796
|
).run(maxVectors);
|
|
797
797
|
}
|
|
798
798
|
}
|
|
@@ -804,7 +804,7 @@ export async function notifyTaskCompletion(
|
|
|
804
804
|
error?: string | null,
|
|
805
805
|
tokens?: number | null,
|
|
806
806
|
costUsd?: number | null,
|
|
807
|
-
options: NotifyTaskOptions = {}
|
|
807
|
+
options: NotifyTaskOptions = {},
|
|
808
808
|
): Promise<void> {
|
|
809
809
|
try {
|
|
810
810
|
const settings = await loadSettings();
|
|
@@ -834,23 +834,23 @@ export async function notifyTaskCompletion(
|
|
|
834
834
|
try {
|
|
835
835
|
const job = (options.scheduleTriage ?? scheduleTriageJob)(
|
|
836
836
|
triageInput,
|
|
837
|
-
triageSettings
|
|
837
|
+
triageSettings,
|
|
838
838
|
);
|
|
839
839
|
// Injected scheduler может быть асинхронным — не оставляем rejection.
|
|
840
840
|
if (job && typeof (job as PromiseLike<unknown>).then === "function") {
|
|
841
841
|
void Promise.resolve(job).catch((err: any) => {
|
|
842
842
|
console.error(
|
|
843
|
-
`[
|
|
843
|
+
`[agent-steward] Ошибка фонового триажа: ${
|
|
844
844
|
err instanceof Error ? err.message : String(err)
|
|
845
|
-
}
|
|
845
|
+
}`,
|
|
846
846
|
);
|
|
847
847
|
});
|
|
848
848
|
}
|
|
849
849
|
} catch (err: any) {
|
|
850
850
|
console.error(
|
|
851
|
-
`[
|
|
851
|
+
`[agent-steward] Не удалось запустить фоновый триаж: ${
|
|
852
852
|
err instanceof Error ? err.message : String(err)
|
|
853
|
-
}
|
|
853
|
+
}`,
|
|
854
854
|
);
|
|
855
855
|
}
|
|
856
856
|
} else if (mode !== "off") {
|
|
@@ -870,7 +870,7 @@ export async function notifyTaskCompletion(
|
|
|
870
870
|
// Читать-изменять-записать нужно атомарно: иначе два процесса
|
|
871
871
|
// (задача + дашборд) теряют инкременты счётчика повторов.
|
|
872
872
|
const { record, isDuplicate } = withTransaction(() =>
|
|
873
|
-
dedupReadOrCreate(db, key, taskName, status, dedup)
|
|
873
|
+
dedupReadOrCreate(db, key, taskName, status, dedup),
|
|
874
874
|
);
|
|
875
875
|
dedupCount = record.count;
|
|
876
876
|
if (isDuplicate && isDedupSuppressed(status, dedup)) {
|
|
@@ -881,9 +881,9 @@ export async function notifyTaskCompletion(
|
|
|
881
881
|
const baseMessage = messageWithDedupCount(
|
|
882
882
|
formatNotificationMessage(
|
|
883
883
|
{ taskName, status, durationMs, error, tokens, costUsd },
|
|
884
|
-
config.templates
|
|
884
|
+
config.templates,
|
|
885
885
|
),
|
|
886
|
-
dedupCount
|
|
886
|
+
dedupCount,
|
|
887
887
|
);
|
|
888
888
|
|
|
889
889
|
// Эмбеддинг-дедуп (31.1): семантическое подавление похожих сообщений.
|
|
@@ -898,7 +898,7 @@ export async function notifyTaskCompletion(
|
|
|
898
898
|
status,
|
|
899
899
|
message,
|
|
900
900
|
config.embedding.threshold,
|
|
901
|
-
config.embedding.windowMinutes ?? 60
|
|
901
|
+
config.embedding.windowMinutes ?? 60,
|
|
902
902
|
);
|
|
903
903
|
if (
|
|
904
904
|
hit &&
|
|
@@ -919,12 +919,12 @@ export async function notifyTaskCompletion(
|
|
|
919
919
|
status,
|
|
920
920
|
message,
|
|
921
921
|
vec,
|
|
922
|
-
config.embedding.windowMinutes ?? 60
|
|
922
|
+
config.embedding.windowMinutes ?? 60,
|
|
923
923
|
);
|
|
924
924
|
cleanupEmbeddings(
|
|
925
925
|
db,
|
|
926
926
|
config.embedding.windowMinutes ?? 60,
|
|
927
|
-
config.embedding.maxVectors
|
|
927
|
+
config.embedding.maxVectors,
|
|
928
928
|
);
|
|
929
929
|
}
|
|
930
930
|
|
|
@@ -943,12 +943,12 @@ export async function notifyTaskCompletion(
|
|
|
943
943
|
},
|
|
944
944
|
config.summary,
|
|
945
945
|
summaryProviderFromTriage(config.triage),
|
|
946
|
-
{}
|
|
946
|
+
{},
|
|
947
947
|
);
|
|
948
948
|
if (summary.lines.length) {
|
|
949
949
|
finalMessage = messageWithDedupCount(
|
|
950
950
|
`${taskName} — ${status}\n${summary.lines.join("\n")}`,
|
|
951
|
-
dedupCount
|
|
951
|
+
dedupCount,
|
|
952
952
|
);
|
|
953
953
|
}
|
|
954
954
|
}
|
|
@@ -956,9 +956,9 @@ export async function notifyTaskCompletion(
|
|
|
956
956
|
} catch (err: any) {
|
|
957
957
|
// Уведомление не должно ломать запись истории и саму задачу.
|
|
958
958
|
console.error(
|
|
959
|
-
`[
|
|
959
|
+
`[agent-steward] Ошибка подготовки уведомления: ${
|
|
960
960
|
err instanceof Error ? err.message : String(err)
|
|
961
|
-
}
|
|
961
|
+
}`,
|
|
962
962
|
);
|
|
963
963
|
}
|
|
964
964
|
}
|
|
@@ -970,7 +970,7 @@ export async function notifyTaskCompletion(
|
|
|
970
970
|
* `matrix.onAllFailed`; успех — только когда `onlyOnError === false`.
|
|
971
971
|
*/
|
|
972
972
|
export async function notifyMatrixCompletion(
|
|
973
|
-
info: MatrixNotificationInfo
|
|
973
|
+
info: MatrixNotificationInfo,
|
|
974
974
|
): Promise<void> {
|
|
975
975
|
try {
|
|
976
976
|
const settings = await loadSettings();
|
|
@@ -990,9 +990,9 @@ export async function notifyMatrixCompletion(
|
|
|
990
990
|
await deliver(config, formatMatrixMessage(info));
|
|
991
991
|
} catch (err: any) {
|
|
992
992
|
console.error(
|
|
993
|
-
`[
|
|
993
|
+
`[agent-steward] Ошибка уведомления о матрице: ${
|
|
994
994
|
err instanceof Error ? err.message : String(err)
|
|
995
|
-
}
|
|
995
|
+
}`,
|
|
996
996
|
);
|
|
997
997
|
}
|
|
998
998
|
}
|
|
@@ -1021,7 +1021,7 @@ export function findStuckMatrixClones(
|
|
|
1021
1021
|
running: RunningTaskRecord[],
|
|
1022
1022
|
parentByClone: Map<string, string>,
|
|
1023
1023
|
now: Date,
|
|
1024
|
-
thresholdMinutes: number
|
|
1024
|
+
thresholdMinutes: number,
|
|
1025
1025
|
): StuckMatrixClone[] {
|
|
1026
1026
|
if (!Number.isFinite(thresholdMinutes) || thresholdMinutes <= 0) return [];
|
|
1027
1027
|
const thresholdMs = thresholdMinutes * 60_000;
|
|
@@ -1065,9 +1065,9 @@ export async function notifyStuckMatrix(stuck: StuckMatrixClone): Promise<boolea
|
|
|
1065
1065
|
return await deliver(config, formatStuckMatrixMessage(stuck));
|
|
1066
1066
|
} catch (err: any) {
|
|
1067
1067
|
console.error(
|
|
1068
|
-
`[
|
|
1068
|
+
`[agent-steward] Ошибка уведомления о зависшей матрице: ${
|
|
1069
1069
|
err instanceof Error ? err.message : String(err)
|
|
1070
|
-
}
|
|
1070
|
+
}`,
|
|
1071
1071
|
);
|
|
1072
1072
|
return false;
|
|
1073
1073
|
}
|
|
@@ -1102,7 +1102,7 @@ function formatLocalDate(date: Date): string {
|
|
|
1102
1102
|
/** Строит сводку дайджеста из записей истории. */
|
|
1103
1103
|
export function buildDigestSummary(
|
|
1104
1104
|
records: AnalyticsRecord[],
|
|
1105
|
-
options: { frequency: DigestFrequency; now?: Date }
|
|
1105
|
+
options: { frequency: DigestFrequency; now?: Date },
|
|
1106
1106
|
): DigestSummary {
|
|
1107
1107
|
const now = options.now ?? new Date();
|
|
1108
1108
|
const windowDays = options.frequency === "weekly" ? 7 : 1;
|
|
@@ -1128,7 +1128,7 @@ export function buildDigestSummary(
|
|
|
1128
1128
|
/** Текст дайджеста. */
|
|
1129
1129
|
export function formatDigestMessage(
|
|
1130
1130
|
summary: DigestSummary,
|
|
1131
|
-
now: Date = new Date()
|
|
1131
|
+
now: Date = new Date(),
|
|
1132
1132
|
): string {
|
|
1133
1133
|
const periodLabel =
|
|
1134
1134
|
summary.period === "weekly"
|
|
@@ -1152,7 +1152,7 @@ export function formatDigestMessage(
|
|
|
1152
1152
|
lines.push(t("notify.digest.topErrors"));
|
|
1153
1153
|
for (const row of summary.topErrors) {
|
|
1154
1154
|
lines.push(
|
|
1155
|
-
t("notify.digest.topErrorRow", { message: row.message, count: row.count })
|
|
1155
|
+
t("notify.digest.topErrorRow", { message: row.message, count: row.count }),
|
|
1156
1156
|
);
|
|
1157
1157
|
}
|
|
1158
1158
|
} else if (summary.total > 0) {
|
|
@@ -1195,7 +1195,7 @@ export function isDigestDue(digest: DigestSettings, now: Date): boolean {
|
|
|
1195
1195
|
* «Отправить сейчас» не должна сдвигать расписание.
|
|
1196
1196
|
*/
|
|
1197
1197
|
export async function sendDigestNow(
|
|
1198
|
-
options: { now?: Date; updateLastSentAt?: boolean } = {}
|
|
1198
|
+
options: { now?: Date; updateLastSentAt?: boolean } = {},
|
|
1199
1199
|
): Promise<{ success: boolean; message: string }> {
|
|
1200
1200
|
const now = options.now ?? new Date();
|
|
1201
1201
|
try {
|
|
@@ -1257,16 +1257,16 @@ export async function maybeSendDigest(now: Date = new Date()): Promise<boolean>
|
|
|
1257
1257
|
if (!isDigestDue(digest, now)) return false;
|
|
1258
1258
|
const result = await sendDigestNow({ now, updateLastSentAt: true });
|
|
1259
1259
|
if (result.success) {
|
|
1260
|
-
console.log("[
|
|
1260
|
+
console.log("[agent-steward] Дайджест уведомлений отправлен.");
|
|
1261
1261
|
return true;
|
|
1262
1262
|
}
|
|
1263
|
-
console.error(`[
|
|
1263
|
+
console.error(`[agent-steward] Дайджест не отправлен: ${result.message}`);
|
|
1264
1264
|
return false;
|
|
1265
1265
|
} catch (err: any) {
|
|
1266
1266
|
console.error(
|
|
1267
|
-
`[
|
|
1267
|
+
`[agent-steward] Ошибка дайджеста: ${
|
|
1268
1268
|
err instanceof Error ? err.message : String(err)
|
|
1269
|
-
}
|
|
1269
|
+
}`,
|
|
1270
1270
|
);
|
|
1271
1271
|
return false;
|
|
1272
1272
|
}
|
|
@@ -1278,7 +1278,7 @@ export async function maybeSendDigest(now: Date = new Date()): Promise<boolean>
|
|
|
1278
1278
|
* результат возвращается пользователю: при тесте важна причина ошибки.
|
|
1279
1279
|
*/
|
|
1280
1280
|
export async function sendTestNotification(
|
|
1281
|
-
channel: "all" | NotificationChannel = "all"
|
|
1281
|
+
channel: "all" | NotificationChannel = "all",
|
|
1282
1282
|
): Promise<{
|
|
1283
1283
|
success: boolean;
|
|
1284
1284
|
message: string;
|
|
@@ -1313,7 +1313,7 @@ export async function sendTestNotification(
|
|
|
1313
1313
|
const results = await deliverDetailed(
|
|
1314
1314
|
config,
|
|
1315
1315
|
t("notify.test.body"),
|
|
1316
|
-
channel === "all" ? undefined : channel
|
|
1316
|
+
channel === "all" ? undefined : channel,
|
|
1317
1317
|
);
|
|
1318
1318
|
const sent = results.filter((item) => item.ok).map((item) => item.channel);
|
|
1319
1319
|
const failed = results.filter((item) => !item.ok);
|
|
@@ -1327,10 +1327,10 @@ export async function sendTestNotification(
|
|
|
1327
1327
|
errors: failed
|
|
1328
1328
|
.map(
|
|
1329
1329
|
(item) =>
|
|
1330
|
-
`${item.channel} — ${item.error ?? t("notify.error.testUnknown")}
|
|
1330
|
+
`${item.channel} — ${item.error ?? t("notify.error.testUnknown")}`,
|
|
1331
1331
|
)
|
|
1332
1332
|
.join("; "),
|
|
1333
|
-
})
|
|
1333
|
+
}),
|
|
1334
1334
|
);
|
|
1335
1335
|
}
|
|
1336
1336
|
return {
|