agent-steward 0.0.2 → 0.0.3
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 +25 -2
- package/CROSS_PLATFORM.md +11 -9
- package/README.md +9 -8
- package/ROADMAP-STRATEGY.md +93 -44
- package/ROADMAP.md +114 -999
- 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/dry-run.js +1 -1
- package/dist/core/file-watcher.js +9 -9
- package/dist/core/git-trigger.js +4 -4
- package/dist/core/lock.js +2 -4
- package/dist/core/one-shot.d.ts +27 -5
- package/dist/core/one-shot.d.ts.map +1 -1
- package/dist/core/one-shot.js +53 -10
- 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 +55 -35
- package/dist/core/record-history.js +22 -22
- package/dist/core/schedule-v2.d.ts +2 -2
- package/dist/core/schedule-v2.d.ts.map +1 -1
- package/dist/core/schedule-v2.js +7 -7
- package/dist/core/scheduler/at-fallback.d.ts +42 -0
- package/dist/core/scheduler/at-fallback.d.ts.map +1 -0
- package/dist/core/scheduler/at-fallback.js +70 -0
- package/dist/core/scheduler/linux.d.ts +3 -1
- package/dist/core/scheduler/linux.d.ts.map +1 -1
- package/dist/core/scheduler/linux.js +43 -7
- 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 +12 -1
- package/dist/core/scheduler/registry.d.ts +2 -0
- package/dist/core/scheduler/registry.d.ts.map +1 -1
- 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.js +2 -2
- package/dist/core/self-analysis.js +55 -55
- package/dist/core/summary.js +1 -1
- 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.js +33 -33
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +9 -1
- 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 +48 -0
- package/dist/db/run-resume.d.ts.map +1 -0
- package/dist/db/run-resume.js +137 -0
- package/dist/db/runs-repo.d.ts +120 -0
- package/dist/db/runs-repo.d.ts.map +1 -0
- package/dist/db/runs-repo.js +319 -0
- package/dist/db/schema.d.ts +16 -2
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +190 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -36
- 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 +109 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +89 -0
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +20 -19
- 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 +37 -9
- package/dist/workspaces.js +1 -1
- package/docs/ARCHITECTURE.md +110 -8
- package/docs/COMPATIBILITY.md +10 -6
- package/docs/CONCEPT.md +15 -3
- package/docs/CROSS_PLATFORM.ru.md +11 -9
- package/docs/CROSS_PLATFORM.zh.md +11 -9
- 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 +26 -7
- package/docs/README.zh.md +9 -8
- package/docs/V1-V2-COMPATIBILITY-PLAN.md +6 -6
- package/gui-experimental.cjs +8 -8
- package/index.js +1 -0
- package/locales/en.json +1 -0
- package/locales/ru.json +1 -0
- package/locales/zh.json +1 -0
- package/package.json +31 -10
- 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/dry-run.ts +26 -26
- 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 +9 -9
- package/src/core/matrix.ts +31 -31
- package/src/core/native-notify.ts +2 -2
- package/src/core/one-shot.ts +63 -13
- 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 +57 -37
- package/src/core/record-history.ts +40 -40
- package/src/core/retention.ts +3 -3
- package/src/core/savings.ts +1 -1
- package/src/core/schedule-gate.ts +12 -12
- package/src/core/schedule-v2.ts +24 -24
- package/src/core/scheduler/at-fallback.ts +113 -0
- package/src/core/scheduler/index.ts +3 -3
- package/src/core/scheduler/linux.ts +64 -13
- package/src/core/scheduler/logs.ts +1 -1
- package/src/core/scheduler/mac.ts +112 -60
- package/src/core/scheduler/posix.ts +15 -1
- package/src/core/scheduler/registry.ts +6 -4
- package/src/core/scheduler/windows.ts +295 -125
- package/src/core/secrets.ts +13 -13
- package/src/core/self-analysis.ts +61 -61
- package/src/core/session.ts +3 -3
- package/src/core/structured-log.ts +3 -3
- package/src/core/summary.ts +25 -25
- 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 +41 -41
- package/src/db/git-state-repo.ts +1 -1
- package/src/db/history-repo.ts +22 -22
- package/src/db/index.ts +16 -6
- package/src/db/metrics-repo.ts +10 -10
- package/src/db/migrate.ts +10 -10
- package/src/db/recovery.ts +3 -3
- package/src/db/run-journal.ts +212 -0
- package/src/db/run-resume.ts +220 -0
- package/src/db/runs-repo.ts +481 -0
- package/src/db/schema.ts +205 -44
- package/src/db/settings-repo.ts +2 -2
- package/src/db/tasks-repo.ts +10 -10
- package/src/db/templates-repo.ts +7 -7
- package/src/gui.tsx +1 -1
- package/src/history.ts +4 -4
- package/src/i18n.ts +7 -7
- package/src/index.ts +341 -304
- package/src/integrations.ts +6 -6
- package/src/notifications.ts +76 -76
- package/src/profiles.ts +98 -7
- package/src/rpc.ts +96 -1
- package/src/schtasks.ts +2 -2
- package/src/server.ts +43 -42
- 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 +45 -10
- package/src/workspaces.ts +16 -16
- 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/index.js
CHANGED
package/locales/en.json
CHANGED
|
@@ -671,6 +671,7 @@
|
|
|
671
671
|
"tool.error.matrixNoClones": "Matrix \"{name}\" has no clones.",
|
|
672
672
|
"tool.error.matrixNotMatrix": "Task \"{name}\" is not a matrix.",
|
|
673
673
|
"tool.error.matrixOverride": "Task \"{task}\": matrix.overrides contains workspace \"{workspace}\" that is not listed in workspaceIds.",
|
|
674
|
+
"tool.error.modelInvalid": "Invalid model \"{model}\": {error}",
|
|
674
675
|
"tool.error.mcpEventRequired": "An MCP trigger requires an event name (mcpEvent.event).",
|
|
675
676
|
"tool.error.onceFields": "runAt/delaySeconds are only allowed with triggerType=once.",
|
|
676
677
|
"tool.error.onceMatrixSchema": "One-shot cannot be combined with matrix: a matrix is started manually only.",
|
package/locales/ru.json
CHANGED
|
@@ -671,6 +671,7 @@
|
|
|
671
671
|
"tool.error.matrixNoClones": "У матрицы \"{name}\" нет клонов.",
|
|
672
672
|
"tool.error.matrixNotMatrix": "Задача \"{name}\" не является матрицей.",
|
|
673
673
|
"tool.error.matrixOverride": "Задача \"{task}\": matrix.overrides содержит workspace \"{workspace}\", которого нет в workspaceIds.",
|
|
674
|
+
"tool.error.modelInvalid": "Недопустимая модель «{model}»: {error}",
|
|
674
675
|
"tool.error.mcpEventRequired": "Для MCP-триггера нужно указать имя события (mcpEvent.event).",
|
|
675
676
|
"tool.error.onceFields": "runAt/delaySeconds допустимы только при triggerType=once.",
|
|
676
677
|
"tool.error.onceMatrixSchema": "One-shot нельзя комбинировать с matrix: матрица запускается только вручную.",
|
package/locales/zh.json
CHANGED
|
@@ -671,6 +671,7 @@
|
|
|
671
671
|
"tool.error.matrixNoClones": "矩阵 “{name}” 没有克隆。",
|
|
672
672
|
"tool.error.matrixNotMatrix": "任务 “{name}” 不是矩阵。",
|
|
673
673
|
"tool.error.matrixOverride": "任务 “{task}”:matrix.overrides 包含未在 workspaceIds 中列出的工作区 “{workspace}”。",
|
|
674
|
+
"tool.error.modelInvalid": "无效的模型 “{model}”:{error}",
|
|
674
675
|
"tool.error.mcpEventRequired": "MCP 触发器需要事件名称(mcpEvent.event)。",
|
|
675
676
|
"tool.error.onceFields": "runAt/delaySeconds 仅在 triggerType=once 时允许。",
|
|
676
677
|
"tool.error.onceMatrixSchema": "One-shot 不能与矩阵组合:矩阵仅可手动启动。",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-steward",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "OpenCode
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "OpenCode plugin for V1 and V2: scheduling and orchestrating AI agent jobs — cron, one-shot runs, DAG pipelines, matrix builds, quality gates, SQLite history, metrics and a local web dashboard. Windows, macOS and Linux. Free and open source (MIT).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "agent-steward contributors",
|
|
7
7
|
"homepage": "https://github.com/DeadSno/agent-steward#readme",
|
|
@@ -38,9 +38,13 @@
|
|
|
38
38
|
"types": "dist/index.d.ts",
|
|
39
39
|
"type": "module",
|
|
40
40
|
"exports": {
|
|
41
|
-
".":
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"default": "./dist/index.js"
|
|
44
|
+
},
|
|
42
45
|
"./tui": "./src/tui.tsx",
|
|
43
|
-
"./gui-experimental": "./gui-experimental.cjs"
|
|
46
|
+
"./gui-experimental": "./gui-experimental.cjs",
|
|
47
|
+
"./package.json": "./package.json"
|
|
44
48
|
},
|
|
45
49
|
"files": [
|
|
46
50
|
"dist",
|
|
@@ -48,7 +52,7 @@
|
|
|
48
52
|
"index.js",
|
|
49
53
|
"gui-experimental.cjs",
|
|
50
54
|
"skills",
|
|
51
|
-
|
|
55
|
+
"locales",
|
|
52
56
|
"scripts",
|
|
53
57
|
"docs",
|
|
54
58
|
"README.md",
|
|
@@ -66,14 +70,20 @@
|
|
|
66
70
|
},
|
|
67
71
|
"scripts": {
|
|
68
72
|
"build": "tsc",
|
|
73
|
+
"lint": "eslint src",
|
|
74
|
+
"lint-job": "eslint src",
|
|
69
75
|
"build:gui": "vite build",
|
|
70
76
|
"demo": "node scripts/demo-dashboard.mjs",
|
|
71
77
|
"bench:local": "node scripts/bench-local.mjs",
|
|
72
78
|
"prepare": "npm run build",
|
|
73
79
|
"prepublishOnly": "npm run build && npm run build:gui",
|
|
74
80
|
"pretest": "npm run build",
|
|
75
|
-
"test": "node test-sqlite.mjs && node test-crash-recovery.mjs && node test-workspaces.mjs && node test-role-scoped.mjs && node test-permissions-policy.mjs && node test-dry-run.mjs && node test-matrix.mjs && node test-matrix-lifecycle.mjs && node test-matrix-sync.mjs && node test-retention.mjs && node test-metrics.mjs && node test-savings.mjs && node test-schedule-v2.mjs && node test-notifications-v2.mjs && node test-notifications-dedup.mjs && node test-notifications-embedding.mjs && node test-notifications-summary.mjs && node test-settings.mjs && node test-notifications-v3.mjs && node test-triage.mjs && node test-triage-rules.mjs && node test-triage-compare.mjs && node test-triage-chain.mjs && node test-triage-shadow.mjs && node test-triage-audit.mjs && node test-triage-async.mjs && node test-local-ai.mjs && node test-secrets.mjs && node test-audit.mjs && node test-profiles.mjs && node test-env.mjs && node test-agent-tools.mjs && node test-skill.mjs && node test-integrations.mjs && node test-one-shot.mjs && node test-session-continuity.mjs && node test-task-status.mjs && node test-jobs-view.mjs && node test-dag.mjs && node test-dashboard.mjs && node test-dashboard-trust.mjs && node test-dashboard-dag.mjs && node test-dashboard-json.mjs && node test-docs.mjs && node test-glob.mjs && node test-git-trigger.mjs && node test-window-v3.mjs && node test-i18n.mjs && node test-gui-bundle.mjs && node test-stale-lock.mjs && node test-task-name-limit.mjs && node test-task-name-limit-profile.mjs && node test-delete-profile.mjs && node test-execution-hardening.mjs && node test-path-safety.mjs && node test-watch-paths.mjs && node test-windows-oem.mjs && node test-schtasks-errors.mjs && node test-shutdown.mjs && node test-dual-entry.mjs && node test-v1-integration.mjs && node test-usage-from-log.mjs && node test-posix-e2e.mjs",
|
|
81
|
+
"test": "node test-sqlite.mjs && node test-user-version.mjs && node test-run-state.mjs && node test-run-journal.mjs && node test-run-resume.mjs && node test-crash-recovery.mjs && node test-workspaces.mjs && node test-role-scoped.mjs && node test-permissions-policy.mjs && node test-dry-run.mjs && node test-matrix.mjs && node test-matrix-lifecycle.mjs && node test-matrix-sync.mjs && node test-retention.mjs && node test-metrics.mjs && node test-savings.mjs && node test-schedule-v2.mjs && node test-notifications-v2.mjs && node test-notifications-dedup.mjs && node test-notifications-embedding.mjs && node test-notifications-summary.mjs && node test-settings.mjs && node test-notifications-v3.mjs && node test-triage.mjs && node test-triage-rules.mjs && node test-triage-compare.mjs && node test-triage-chain.mjs && node test-triage-shadow.mjs && node test-triage-audit.mjs && node test-triage-async.mjs && node test-local-ai.mjs && node test-secrets.mjs && node test-audit.mjs && node test-profiles.mjs && node test-env.mjs && node test-agent-tools.mjs && node test-self-analysis.mjs && node test-skill.mjs && node test-integrations.mjs && node test-one-shot.mjs && node test-session-continuity.mjs && node test-task-status.mjs && node test-jobs-view.mjs && node test-dag.mjs && node test-dashboard.mjs && node test-dashboard-trust.mjs && node test-dashboard-dag.mjs && node test-dashboard-json.mjs && node test-docs.mjs && node test-glob.mjs && node test-git-trigger.mjs && node test-window-v3.mjs && node test-i18n.mjs && node test-gui-bundle.mjs && node test-stale-lock.mjs && node test-task-name-limit.mjs && node test-task-name-limit-profile.mjs && node test-delete-profile.mjs && node test-execution-hardening.mjs && node test-path-safety.mjs && node test-watch-paths.mjs && node test-windows-oem.mjs && node test-schtasks-errors.mjs && node test-schtasks-locales.mjs && node test-cron-to-schtasks.mjs && node test-mac-cron.mjs && node test-at-fallback.mjs && node test-shutdown.mjs && node test-dual-entry.mjs && node test-v1-integration.mjs && node test-usage-from-log.mjs && node test-posix-e2e.mjs && node test-model-validation.mjs",
|
|
76
82
|
"test:sqlite": "node test-sqlite.mjs",
|
|
83
|
+
"test:user-version": "node test-user-version.mjs",
|
|
84
|
+
"test:run-state": "node test-run-state.mjs",
|
|
85
|
+
"test:run-journal": "node test-run-journal.mjs",
|
|
86
|
+
"test:run-resume": "node test-run-resume.mjs",
|
|
77
87
|
"test:crash": "node test-crash-recovery.mjs",
|
|
78
88
|
"test:workspaces": "node test-workspaces.mjs",
|
|
79
89
|
"test:role": "node test-role-scoped.mjs",
|
|
@@ -89,6 +99,7 @@
|
|
|
89
99
|
"test:settings": "node test-settings.mjs",
|
|
90
100
|
"test:triage": "node test-triage.mjs",
|
|
91
101
|
"test:triage-rules": "node test-triage-rules.mjs",
|
|
102
|
+
"test:triage-compare": "node test-triage-compare.mjs",
|
|
92
103
|
"test:triage-chain": "node test-triage-chain.mjs",
|
|
93
104
|
"test:triage-shadow": "node test-triage-shadow.mjs",
|
|
94
105
|
"test:triage-audit": "node test-triage-audit.mjs",
|
|
@@ -114,20 +125,26 @@
|
|
|
114
125
|
"test:git-trigger": "node test-git-trigger.mjs",
|
|
115
126
|
"test:window-v3": "node test-window-v3.mjs",
|
|
116
127
|
"test:self-analysis": "node test-self-analysis.mjs",
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
"test:i18n": "node test-i18n.mjs",
|
|
129
|
+
"test:gui-bundle": "node test-gui-bundle.mjs",
|
|
119
130
|
"test:stale-lock": "node test-stale-lock.mjs",
|
|
120
131
|
"test:task-name-limit": "node test-task-name-limit.mjs && node test-task-name-limit-profile.mjs",
|
|
121
132
|
"test:delete-profile": "node test-delete-profile.mjs",
|
|
122
133
|
"test:windows-oem": "node test-windows-oem.mjs",
|
|
134
|
+
"test:schtasks-locales": "node test-schtasks-locales.mjs",
|
|
123
135
|
"test:schtasks-errors": "node test-schtasks-errors.mjs",
|
|
136
|
+
"test:cron-to-schtasks": "node test-cron-to-schtasks.mjs",
|
|
137
|
+
"test:mac-cron": "node test-mac-cron.mjs",
|
|
138
|
+
"test:at-fallback": "node test-at-fallback.mjs",
|
|
124
139
|
"test:shutdown": "node test-shutdown.mjs",
|
|
125
140
|
"test:usage-from-log": "node test-usage-from-log.mjs",
|
|
126
141
|
"test:posix-e2e": "node test-posix-e2e.mjs",
|
|
142
|
+
"test:model": "node test-model-validation.mjs",
|
|
127
143
|
"test:watch-paths": "node test-watch-paths.mjs",
|
|
128
144
|
"test:en": "node scripts/test-locale.mjs en",
|
|
129
145
|
"test:zh": "node scripts/test-locale.mjs zh",
|
|
130
146
|
"test:parallel": "node scripts/run-tests.mjs",
|
|
147
|
+
"pretest:parallel": "npm run build",
|
|
131
148
|
"test:parallel:en": "node scripts/run-tests.mjs --locale=en",
|
|
132
149
|
"test:parallel:zh": "node scripts/run-tests.mjs --locale=zh"
|
|
133
150
|
},
|
|
@@ -140,11 +157,15 @@
|
|
|
140
157
|
},
|
|
141
158
|
"devDependencies": {
|
|
142
159
|
"@opencode-ai/plugin": "1.19.5",
|
|
143
|
-
"@opentui/core": "
|
|
144
|
-
"@opentui/solid": "
|
|
160
|
+
"@opentui/core": "0.8.4",
|
|
161
|
+
"@opentui/solid": "0.8.4",
|
|
145
162
|
"@types/node": "^22.0.0",
|
|
163
|
+
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
|
164
|
+
"@typescript-eslint/parser": "^8.73.0",
|
|
165
|
+
"eslint": "^10.15.0",
|
|
146
166
|
"solid-js": "^1.9.0",
|
|
147
167
|
"typescript": "^5.9.3",
|
|
168
|
+
"typescript-eslint": "^8.73.0",
|
|
148
169
|
"vite": "^7.0.0",
|
|
149
170
|
"vite-plugin-solid": "^2.11.0"
|
|
150
171
|
}
|
package/src/core/analytics.ts
CHANGED
|
@@ -164,7 +164,7 @@ function percent(part: number, total: number): number {
|
|
|
164
164
|
*/
|
|
165
165
|
export function buildAnalytics(
|
|
166
166
|
records: AnalyticsRecord[],
|
|
167
|
-
options: BuildAnalyticsOptions = {}
|
|
167
|
+
options: BuildAnalyticsOptions = {},
|
|
168
168
|
): AnalyticsReport {
|
|
169
169
|
const windowDays = Math.max(1, Math.floor(options.days ?? 14));
|
|
170
170
|
const topLimit = Math.max(1, Math.floor(options.topLimit ?? 10));
|
|
@@ -416,7 +416,7 @@ export function historyToCsv(records: AnalyticsRecord[]): string {
|
|
|
416
416
|
record.error ?? "",
|
|
417
417
|
]
|
|
418
418
|
.map(csvCell)
|
|
419
|
-
.join(";")
|
|
419
|
+
.join(";"),
|
|
420
420
|
);
|
|
421
421
|
}
|
|
422
422
|
// BOM, чтобы Excel корректно открыл UTF-8 с кириллицей.
|
package/src/core/audit.ts
CHANGED
|
@@ -110,7 +110,7 @@ export function recordAudit(entry: AuditEntryInput): number | null {
|
|
|
110
110
|
.prepare(
|
|
111
111
|
`INSERT INTO audit_log
|
|
112
112
|
(ts, action, target_type, target, actor, source, details_json, remote)
|
|
113
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
113
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
114
114
|
)
|
|
115
115
|
.run(
|
|
116
116
|
ts,
|
|
@@ -120,7 +120,7 @@ export function recordAudit(entry: AuditEntryInput): number | null {
|
|
|
120
120
|
String(entry.actor || "system").slice(0, 32),
|
|
121
121
|
entry.source == null ? null : String(entry.source).slice(0, 128),
|
|
122
122
|
safeJson(entry.details),
|
|
123
|
-
entry.remote == null ? null : String(entry.remote).slice(0, 128)
|
|
123
|
+
entry.remote == null ? null : String(entry.remote).slice(0, 128),
|
|
124
124
|
);
|
|
125
125
|
maybeCleanup();
|
|
126
126
|
return Number(result.lastInsertRowid) || null;
|
|
@@ -129,7 +129,7 @@ export function recordAudit(entry: AuditEntryInput): number | null {
|
|
|
129
129
|
console.warn(
|
|
130
130
|
`[audit] не удалось записать событие: ${
|
|
131
131
|
err instanceof Error ? err.message : String(err)
|
|
132
|
-
}
|
|
132
|
+
}`,
|
|
133
133
|
);
|
|
134
134
|
} catch {
|
|
135
135
|
// console недоступен — молча игнорируем.
|
|
@@ -222,21 +222,21 @@ export function recordTaskToolBlocks(
|
|
|
222
222
|
actor: AuditActor = "system",
|
|
223
223
|
source = "policy",
|
|
224
224
|
policy?: PermissionPolicy,
|
|
225
|
-
legacyShell?: boolean
|
|
225
|
+
legacyShell?: boolean,
|
|
226
226
|
): number {
|
|
227
227
|
const normalizedDenied = Array.from(
|
|
228
228
|
new Set(
|
|
229
229
|
(deniedTools ?? [])
|
|
230
230
|
.map((tool) => String(tool).trim())
|
|
231
|
-
.filter(Boolean)
|
|
232
|
-
)
|
|
231
|
+
.filter(Boolean),
|
|
232
|
+
),
|
|
233
233
|
);
|
|
234
234
|
const normalizedAllowed = Array.from(
|
|
235
235
|
new Set(
|
|
236
236
|
(allowedTools ?? [])
|
|
237
237
|
.map((tool) => String(tool).trim())
|
|
238
|
-
.filter(Boolean)
|
|
239
|
-
)
|
|
238
|
+
.filter(Boolean),
|
|
239
|
+
),
|
|
240
240
|
);
|
|
241
241
|
const details = {
|
|
242
242
|
reason: "deniedTools",
|
|
@@ -331,17 +331,17 @@ export function readAuditLog(filter: ReadAuditFilter = {}): ReadAuditResult {
|
|
|
331
331
|
const db = getDb();
|
|
332
332
|
const totalRow = db
|
|
333
333
|
.prepare(`SELECT COUNT(*) AS count FROM audit_log ${clause}`)
|
|
334
|
-
.get(...params)
|
|
334
|
+
.get(...params);
|
|
335
335
|
const rows = db
|
|
336
336
|
.prepare(`SELECT * FROM audit_log ${clause} ORDER BY ts DESC, id DESC LIMIT ?`)
|
|
337
|
-
.all(...params, limit)
|
|
337
|
+
.all(...params, limit);
|
|
338
338
|
return { records: rows.map(rowToRecord), total: Number(totalRow?.count) || 0 };
|
|
339
339
|
} catch (err) {
|
|
340
340
|
try {
|
|
341
341
|
console.warn(
|
|
342
342
|
`[audit] не удалось прочитать журнал: ${
|
|
343
343
|
err instanceof Error ? err.message : String(err)
|
|
344
|
-
}
|
|
344
|
+
}`,
|
|
345
345
|
);
|
|
346
346
|
} catch {
|
|
347
347
|
// ignore
|
|
@@ -360,23 +360,23 @@ export function cleanupAuditLog(options: {
|
|
|
360
360
|
} = {}): number {
|
|
361
361
|
const retentionDays = Math.max(
|
|
362
362
|
0,
|
|
363
|
-
Math.floor(options.retentionDays ?? DEFAULT_AUDIT_RETENTION_DAYS) || 0
|
|
363
|
+
Math.floor(options.retentionDays ?? DEFAULT_AUDIT_RETENTION_DAYS) || 0,
|
|
364
364
|
);
|
|
365
365
|
const maxRecords = Math.max(
|
|
366
366
|
100,
|
|
367
|
-
Math.floor(options.maxRecords ?? DEFAULT_AUDIT_MAX_RECORDS) || DEFAULT_AUDIT_MAX_RECORDS
|
|
367
|
+
Math.floor(options.maxRecords ?? DEFAULT_AUDIT_MAX_RECORDS) || DEFAULT_AUDIT_MAX_RECORDS,
|
|
368
368
|
);
|
|
369
369
|
let deleted = 0;
|
|
370
370
|
try {
|
|
371
371
|
const db = getDb();
|
|
372
372
|
if (retentionDays > 0) {
|
|
373
373
|
const cutoff = new Date(
|
|
374
|
-
Date.now() - retentionDays * 24 * 60 * 60 * 1000
|
|
374
|
+
Date.now() - retentionDays * 24 * 60 * 60 * 1000,
|
|
375
375
|
).toISOString();
|
|
376
376
|
const result = db.prepare("DELETE FROM audit_log WHERE ts < ?").run(cutoff);
|
|
377
377
|
deleted += Number(result.changes) || 0;
|
|
378
378
|
}
|
|
379
|
-
const countRow = db.prepare("SELECT COUNT(*) AS count FROM audit_log").get()
|
|
379
|
+
const countRow = db.prepare("SELECT COUNT(*) AS count FROM audit_log").get();
|
|
380
380
|
const count = Number(countRow?.count) || 0;
|
|
381
381
|
if (count > maxRecords) {
|
|
382
382
|
const excess = count - maxRecords;
|
|
@@ -384,7 +384,7 @@ export function cleanupAuditLog(options: {
|
|
|
384
384
|
.prepare(
|
|
385
385
|
`DELETE FROM audit_log WHERE id IN (
|
|
386
386
|
SELECT id FROM audit_log ORDER BY ts ASC, id ASC LIMIT ?
|
|
387
|
-
)
|
|
387
|
+
)`,
|
|
388
388
|
)
|
|
389
389
|
.run(excess);
|
|
390
390
|
deleted += Number(result.changes) || 0;
|
|
@@ -394,7 +394,7 @@ export function cleanupAuditLog(options: {
|
|
|
394
394
|
console.warn(
|
|
395
395
|
`[audit] не удалось очистить журнал: ${
|
|
396
396
|
err instanceof Error ? err.message : String(err)
|
|
397
|
-
}
|
|
397
|
+
}`,
|
|
398
398
|
);
|
|
399
399
|
} catch {
|
|
400
400
|
// ignore
|
|
@@ -46,7 +46,7 @@ function isStar(value: string): boolean {
|
|
|
46
46
|
* Возвращает N или undefined.
|
|
47
47
|
*/
|
|
48
48
|
function parseStep(value: string): number | undefined {
|
|
49
|
-
const match =
|
|
49
|
+
const match = /^\*\/(\d+)$/.exec(value);
|
|
50
50
|
if (!match) return undefined;
|
|
51
51
|
const n = parseInt(match[1], 10);
|
|
52
52
|
return n > 0 ? n : undefined;
|
|
@@ -74,7 +74,7 @@ export function convertCronToSchTasks(cron: string): CronConversion {
|
|
|
74
74
|
"Ожидалось 5 полей cron-выражения (минута час день_месяца месяц день_недели), получено " +
|
|
75
75
|
fields.length +
|
|
76
76
|
".\n\n" +
|
|
77
|
-
UNSUPPORTED_ERROR
|
|
77
|
+
UNSUPPORTED_ERROR,
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -108,24 +108,30 @@ export function convertCronToSchTasks(cron: string): CronConversion {
|
|
|
108
108
|
"Интервал /mo " +
|
|
109
109
|
stepN +
|
|
110
110
|
" минут превышает максимально допустимый для schtasks (1439 минут).\n\n" +
|
|
111
|
-
UNSUPPORTED_ERROR
|
|
111
|
+
UNSUPPORTED_ERROR,
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
|
-
// schtasks /mo
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
114
|
+
// schtasks /mo Nanchors на момент создания задачи, а cron */N означает
|
|
115
|
+
// минуты 0, N, 2N … внутри часа. Семантики совпадают только когда N
|
|
116
|
+
// делит 60 без остатка И есть выровненный старт (00:00), поэтому ниже
|
|
117
|
+
// добавляется startTime: "00:00". Для N, не делящих 60, выбрасывается
|
|
118
|
+
// ошибка — задача уходит в минутный опрос с gate во враппере
|
|
119
|
+
// (needsPollMode в windows.ts), а не конвертируется здесь нативно.
|
|
118
120
|
if (60 % stepN !== 0) {
|
|
119
121
|
throw new Error(
|
|
120
122
|
"Интервал */" +
|
|
121
123
|
stepN +
|
|
122
124
|
" не делит час нацело: cron и schtasks понимают его по-разному.\n\n" +
|
|
123
|
-
UNSUPPORTED_ERROR
|
|
125
|
+
UNSUPPORTED_ERROR,
|
|
124
126
|
);
|
|
125
127
|
}
|
|
126
128
|
return {
|
|
127
129
|
sc: "MINUTE",
|
|
128
130
|
extraFlags: ["/mo", String(stepN)],
|
|
131
|
+
// schtasks /mo Nanchors на момент создания задачи; cron */N означает
|
|
132
|
+
// минуты 0, N, 2N … внутри часа. Выровненный старт 00:00 делает
|
|
133
|
+
// расписание идентичным cron для любого N, делящего 60.
|
|
134
|
+
startTime: "00:00",
|
|
129
135
|
};
|
|
130
136
|
}
|
|
131
137
|
|
|
@@ -186,91 +192,6 @@ export function convertCronToSchTasks(cron: string): CronConversion {
|
|
|
186
192
|
throw new Error(UNSUPPORTED_ERROR);
|
|
187
193
|
}
|
|
188
194
|
|
|
189
|
-
/**
|
|
190
|
-
* Вычисляет ближайшее прошедшее (<= now) время срабатывания для поддерживаемых
|
|
191
|
-
* cron-выражений. Нужно для восстановления пропущенных запусков (catch-up):
|
|
192
|
-
* сравнивая это время с историей, можно понять, выполнялась ли задача.
|
|
193
|
-
*
|
|
194
|
-
* Возвращает null, если выражение не поддерживается или не распознано.
|
|
195
|
-
*/
|
|
196
|
-
export function previousRunTime(cron: string, now: Date = new Date()): Date | null {
|
|
197
|
-
const fields = cron.trim().split(/\s+/);
|
|
198
|
-
if (fields.length !== 5) return null;
|
|
199
|
-
|
|
200
|
-
const [minute, hour, dayOfMonth, month, dayOfWeek] = fields;
|
|
201
|
-
const star = (value: string) => value === "*";
|
|
202
|
-
const intIn = (value: string, min: number, max: number): number | undefined => {
|
|
203
|
-
if (!/^\d+$/.test(value)) return undefined;
|
|
204
|
-
const n = parseInt(value, 10);
|
|
205
|
-
return n >= min && n <= max ? n : undefined;
|
|
206
|
-
};
|
|
207
|
-
const nowMs = now.getTime();
|
|
208
|
-
|
|
209
|
-
// * * * * * — каждую минуту: последняя граница минуты.
|
|
210
|
-
if (star(minute) && star(hour) && star(dayOfMonth) && star(month) && star(dayOfWeek)) {
|
|
211
|
-
return new Date(Math.floor(nowMs / 60000) * 60000);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// */N * * * * — каждые N минут внутри часа (минуты 0, N, 2N...).
|
|
215
|
-
const step = /^\*\/(\d+)$/.exec(minute);
|
|
216
|
-
if (step && star(hour) && star(dayOfMonth) && star(month) && star(dayOfWeek)) {
|
|
217
|
-
const n = parseInt(step[1], 10);
|
|
218
|
-
if (n > 0) {
|
|
219
|
-
const result = new Date(now);
|
|
220
|
-
result.setSeconds(0, 0);
|
|
221
|
-
const minuteOfHour = result.getMinutes();
|
|
222
|
-
result.setMinutes(n >= 60 ? 0 : minuteOfHour - (minuteOfHour % n));
|
|
223
|
-
return result;
|
|
224
|
-
}
|
|
225
|
-
return null;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// M * * * * — каждый час в минуту M.
|
|
229
|
-
const hourlyMinute = intIn(minute, 0, 59);
|
|
230
|
-
if (
|
|
231
|
-
hourlyMinute !== undefined &&
|
|
232
|
-
star(hour) &&
|
|
233
|
-
star(dayOfMonth) &&
|
|
234
|
-
star(month) &&
|
|
235
|
-
star(dayOfWeek)
|
|
236
|
-
) {
|
|
237
|
-
const result = new Date(now);
|
|
238
|
-
result.setSeconds(0, 0);
|
|
239
|
-
result.setMinutes(hourlyMinute);
|
|
240
|
-
if (result.getTime() > nowMs) result.setHours(result.getHours() - 1);
|
|
241
|
-
return result;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
const m = intIn(minute, 0, 59);
|
|
245
|
-
const h = intIn(hour, 0, 23);
|
|
246
|
-
if (m === undefined || h === undefined || !star(dayOfMonth) || !star(month)) {
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// M H * * * — ежедневно в HH:MM.
|
|
251
|
-
if (star(dayOfWeek)) {
|
|
252
|
-
const result = new Date(now);
|
|
253
|
-
result.setSeconds(0, 0);
|
|
254
|
-
result.setHours(h, m, 0, 0);
|
|
255
|
-
if (result.getTime() > nowMs) result.setDate(result.getDate() - 1);
|
|
256
|
-
return result;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// M H * * D — еженедельно в день D (0 и 7 — воскресенье) в HH:MM.
|
|
260
|
-
const dow = intIn(dayOfWeek, 0, 7);
|
|
261
|
-
if (dow === undefined) return null;
|
|
262
|
-
const targetDow = dow === 7 ? 0 : dow;
|
|
263
|
-
const result = new Date(now);
|
|
264
|
-
result.setSeconds(0, 0);
|
|
265
|
-
result.setHours(h, m, 0, 0);
|
|
266
|
-
// Не больше 8 итераций: одна неделя гарантированно содержит нужный день.
|
|
267
|
-
for (let i = 0; i <= 8; i += 1) {
|
|
268
|
-
if (result.getTime() <= nowMs && result.getDay() === targetDow) return result;
|
|
269
|
-
result.setDate(result.getDate() - 1);
|
|
270
|
-
}
|
|
271
|
-
return null;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
195
|
/**
|
|
275
196
|
* Формирует массив флагов расписания для schtasks на основе CronConversion.
|
|
276
197
|
* Включает /sc, /st (если есть), и дополнительные флаги (/mo, /d).
|
package/src/core/dry-run.ts
CHANGED
|
@@ -118,7 +118,7 @@ const ESTIMATE_SAMPLE = 10;
|
|
|
118
118
|
export const ESTIMATED_COST_PER_1K_TOKENS_USD = 0.003;
|
|
119
119
|
|
|
120
120
|
/** Опасные паттерны, о которых обязательно предупреждаем (ключи каталога). */
|
|
121
|
-
const DANGEROUS_PATTERNS:
|
|
121
|
+
const DANGEROUS_PATTERNS: { test: RegExp; messageKey: string }[] = [
|
|
122
122
|
{ test: /rm\s+-rf\s+\/(?:\s|$)/, messageKey: "dryRun.danger.rmRoot" },
|
|
123
123
|
{ test: /git\s+push\s+.*--force(?:\s|$)/, messageKey: "dryRun.danger.forcePush" },
|
|
124
124
|
];
|
|
@@ -165,7 +165,7 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
|
|
|
165
165
|
paths: def.gitPaths ?? undefined,
|
|
166
166
|
ignore: def.gitIgnore ?? undefined,
|
|
167
167
|
},
|
|
168
|
-
{ persist: false }
|
|
168
|
+
{ persist: false },
|
|
169
169
|
);
|
|
170
170
|
base.git = {
|
|
171
171
|
branch: result.branch ?? null,
|
|
@@ -180,7 +180,7 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
|
|
|
180
180
|
warnings.push(t("dryRun.git.notRepo"));
|
|
181
181
|
} else if (result.status === "branch-mismatch") {
|
|
182
182
|
warnings.push(
|
|
183
|
-
t("dryRun.git.branchMismatch", { branch: def.gitBranch ?? "" })
|
|
183
|
+
t("dryRun.git.branchMismatch", { branch: def.gitBranch ?? "" }),
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
} catch (err: any) {
|
|
@@ -213,14 +213,14 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
|
|
|
213
213
|
|
|
214
214
|
case "mcp-event": {
|
|
215
215
|
const ev = def.mcpEvent;
|
|
216
|
-
base.explanation = ev
|
|
216
|
+
base.explanation = ev?.event
|
|
217
217
|
? t("dryRun.mcp.event", {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
server: ev.server,
|
|
219
|
+
event: ev.event,
|
|
220
|
+
filter: ev.filter
|
|
221
|
+
? t("dryRun.mcp.filter", { filter: ev.filter })
|
|
222
|
+
: "",
|
|
223
|
+
})
|
|
224
224
|
: t("dryRun.mcp.missing");
|
|
225
225
|
break;
|
|
226
226
|
}
|
|
@@ -228,9 +228,9 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
|
|
|
228
228
|
case "cron": {
|
|
229
229
|
base.explanation = def.timezone
|
|
230
230
|
? t("dryRun.cronTimezone", {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
schedule: def.schedule,
|
|
232
|
+
timezone: def.timezone,
|
|
233
|
+
})
|
|
234
234
|
: t("dryRun.cron", { schedule: def.schedule });
|
|
235
235
|
break;
|
|
236
236
|
}
|
|
@@ -273,14 +273,14 @@ async function describeTrigger(opts: DescribeTriggerOptions): Promise<DryRunTrig
|
|
|
273
273
|
warnings.push(
|
|
274
274
|
iso
|
|
275
275
|
? t("dryRun.window.postpone", { reason, nextOpenAt: iso })
|
|
276
|
-
: t("dryRun.window.noOpening", { reason })
|
|
276
|
+
: t("dryRun.window.noOpening", { reason }),
|
|
277
277
|
);
|
|
278
278
|
}
|
|
279
279
|
} else if (!state.active && policy === "run") {
|
|
280
280
|
warnings.push(
|
|
281
281
|
t("dryRun.window.run", {
|
|
282
282
|
reason: state.reason ?? t("dryRun.window.outside"),
|
|
283
|
-
})
|
|
283
|
+
}),
|
|
284
284
|
);
|
|
285
285
|
}
|
|
286
286
|
}
|
|
@@ -376,13 +376,13 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
|
|
|
376
376
|
|
|
377
377
|
// Matrix (Спринт 15): родитель сам не выполняется — вместо него в отчёте
|
|
378
378
|
// показываем клоны, по одному на workspace, с их cwd и оценками.
|
|
379
|
-
const units:
|
|
379
|
+
const units: { def: TaskDefinition; matrixParent?: string }[] = [];
|
|
380
380
|
for (const def of ordered) {
|
|
381
381
|
if (def.matrix) {
|
|
382
382
|
try {
|
|
383
383
|
const clones = expandMatrixTask(def);
|
|
384
384
|
warnings.push(
|
|
385
|
-
t("dryRun.matrix.parent", { name: def.name, count: clones.length })
|
|
385
|
+
t("dryRun.matrix.parent", { name: def.name, count: clones.length }),
|
|
386
386
|
);
|
|
387
387
|
for (const clone of clones) units.push({ def: clone, matrixParent: def.name });
|
|
388
388
|
} catch (err: any) {
|
|
@@ -390,7 +390,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
|
|
|
390
390
|
list.push(
|
|
391
391
|
t("dryRun.matrix.expandError", {
|
|
392
392
|
error: err instanceof Error ? err.message : String(err),
|
|
393
|
-
})
|
|
393
|
+
}),
|
|
394
394
|
);
|
|
395
395
|
warningsPerTask.set(def.name.toLowerCase(), list);
|
|
396
396
|
warnings.push(`[${def.name}] ${list[list.length - 1]}`);
|
|
@@ -404,7 +404,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
|
|
|
404
404
|
const parallelMatrixParents = new Set(
|
|
405
405
|
allDefs
|
|
406
406
|
.filter((d) => d.matrix && (d.matrix.strategy ?? "parallel") !== "sequential")
|
|
407
|
-
.map((d) => d.name.toLowerCase())
|
|
407
|
+
.map((d) => d.name.toLowerCase()),
|
|
408
408
|
);
|
|
409
409
|
const parallelGroups = new Map<string, { maxDuration: number }>();
|
|
410
410
|
|
|
@@ -481,7 +481,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
|
|
|
481
481
|
for (const { test, messageKey } of DANGEROUS_PATTERNS) {
|
|
482
482
|
if (test.test(scanned)) {
|
|
483
483
|
taskWarnings.push(
|
|
484
|
-
t("dryRun.dangerPattern", { message: t(messageKey) })
|
|
484
|
+
t("dryRun.dangerPattern", { message: t(messageKey) }),
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
487
|
}
|
|
@@ -519,7 +519,7 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
|
|
|
519
519
|
}
|
|
520
520
|
} catch {
|
|
521
521
|
taskWarnings.push(
|
|
522
|
-
t("dryRun.cronParseError", { schedule: def.schedule })
|
|
522
|
+
t("dryRun.cronParseError", { schedule: def.schedule }),
|
|
523
523
|
);
|
|
524
524
|
}
|
|
525
525
|
scheduleDetails = {
|
|
@@ -581,14 +581,14 @@ export async function simulatePipeline(taskName: string): Promise<DryRunReport>
|
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
const hasAnyEstimate = tasks.some(
|
|
584
|
-
(t) => t.estimatedDurationSec != null || t.estimatedCostUsd != null || t.estimatedTokens != null
|
|
584
|
+
(t) => t.estimatedDurationSec != null || t.estimatedCostUsd != null || t.estimatedTokens != null,
|
|
585
585
|
);
|
|
586
586
|
const totals: DryRunTotals = hasAnyEstimate
|
|
587
587
|
? {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
588
|
+
estimatedDurationSec: totalDuration != null ? Math.round(totalDuration * 10) / 10 : null,
|
|
589
|
+
estimatedCostUsd: totalCost != null ? Math.round(totalCost * 10000) / 10000 : null,
|
|
590
|
+
estimatedTokens: totalTokens != null ? Math.round(totalTokens) : null,
|
|
591
|
+
}
|
|
592
592
|
: { estimatedDurationSec: null, estimatedCostUsd: null, estimatedTokens: null };
|
|
593
593
|
|
|
594
594
|
return {
|