@xopcai/xopc 0.0.179 → 0.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-A5FUMjeV.js → activity-store-DFKtQDgE.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-NghNiDWx.js → agent-avatar-dicebear-CcTvB_4W.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Baq8Shzy.js → agents-DgGj9bu6.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Bmzslx0Z.js → api-CUClAvuL.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DDWS_BBJ.js → app-management-settings-panel-Ib-cWKHM.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C6znvVtX.js → appearance-settings-CRSN8WuA.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-d-Y0Jbe1.js → apps-page-B5xahuT-.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-fvTZhPUr.js → archive-plugin-BBF9zspN.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BFEgvg-Q.js → attachment-load-D3QQfA7w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BUYrvMmD.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CuI2bOc7.js → binary-plugins-D78XOjJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Z_k8W0al.js → block-editor-D_VVXlYX.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CGApoYPr.js → browser-settings-page-Cjw07q9h.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-gs6b5e9-.js → browser-workflow-inputs-_gu08MA4.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Cq5qXStp.js → browser-workflows-page-58DBMXgG.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-BC-8n4Hl.js → capabilities-settings-panel-D_dfVxHY.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-BTKhPoDC.js → capability-presets-api-DhCn9rPv.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-D7WQ0oBN.js → capability-presets-settings-panel-LWWIYUT7.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-TwMak0SE.js → channel-recipient-api-DYtoNV5A.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-DysELlO_.js → channels-settings-Cyj5OunL.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-TEFnV0IG.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-DBKotvNr.js → connector-logo-CxIXnifA.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-QH-0WnOo.js → connectors-page-0TobCpBB.js} +2 -2
- package/dist/gateway/static/root/assets/{desktop-pet-Dwml8znf.js → desktop-pet-CwVSLL6N.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CyIg2jJp.js → desktop-pet-settings-BOIp4q0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B6fc_7SL.js → directory-picker-path-field-C8_lsW6S.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CUQxGnDf.js → dreaming-settings-Da9FeWQl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-AbRNi2ON.js → extension-debug-page-CMNnSJP6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-ClYfiLXC.js → extension-page-t0pJqLvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BGVP2hw1.js → extension-settings-page-aiR-tKnW.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-B7GqtklK.js → gateway-config-api-CkyQBD6r.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BMeK8igT.js → gateway-settings-BIZfAgfB.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CKKL96r_.js → gateway-startup-retry-CSU7UvzG.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-Dj0ao2qA.js → goals-settings-Dx9uTyWF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CTI2nPKa.js → heartbeat-settings-Cnr5ORXL.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BY3VQ5Mv.js → image-generation-api-BR6Kb77X.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BDzspHrg.js → index-BA56bQ68.js} +8 -8
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CELtDFz3.js → keyboard-shortcuts-settings-D76uYKeQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-m8CTSGix.js → local-app-workbench-page-DSUNtLHg.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-CF5uUd1n.js → local-apps-page-BsLnojTh.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DIVc0AQs.js → locale-store-BNC8HUCI.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DmH7Tk4k.js → logs-page-yI8kpQtO.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-CN85EdB8.js → markdown-split-D6smTQWD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CxYEc-b8.js → media-plugins-D1TmMF0A.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-DYqBwJAK.js → messages-H_iJjnEM.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-Goab4781.js → notes-page-Vt-diFf0.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-C4jDBVBN.js → notes-workbench-BD297EZt.js} +2 -2
- package/dist/gateway/static/root/assets/{outcome-detail-page-DNRfeLZp.js → outcome-detail-page-C5i_ZR9a.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-tQNQcAts.js → page-tabs-BnSzIjH0.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BSTlgsDB.js → preview-open-alternatives-CF12Eqi4.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-iQ5gTCip.js → product-open-page-Du0TE_CU.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-D7anK-eu.js → project-detail-page-D1HGz7Dy.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BePESKWy.js → projects-page-CqP2TnW-.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-CHrzBKIs.js → remote-access-hub-BXdVJLS3.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BsPf5Gkk.js → save-bar-controls-B53UNtDM.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-kAytH7mq.js → schedule-field-C3dIMN5q.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Bbw8l2ri.js → schema-form-BKvpxqof.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-He5YAczL.js → sessions-page-CPAwDdl5.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C-jGsoft.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BqbibcnJ.js → settings-form-section-kt6GIS32.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DNLNCEGT.js → settings-loading-skeleton-85eUPcKz.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BR6Ss0bK.js → settings-page-Di5x6Xrc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Cdb1e2Cz.js → settings-page-layout-CkkCee_x.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-moT-D-ia.js → setup-status-panel-uxEE6gAB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CkrASny2.js → share-preview-page-BtLEstaI.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-X49zY21H.js → shares-settings-2mcsMWgn.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ocDwsrEt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-9_jfsFU5.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-BG5dGkyA.js → skills-page.utils-C2SHvq8V.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-XdY8eyYf.js → system-settings-panel-CIJ66cUy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DtwI_VLT.js → theme-store-ClDa_Bci.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-UghsQu_I.js → time-picker-D0zAsHOo.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DOnpwsrE.js → typed-models-lib-GsmwmB40.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-BWDtfNvQ.js → use-channel-catalog-BQz3K7xj.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-BtNBEtKj.js → user-context-page-Bn4BLg4W.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DP80jW-W.js → voice-api-key-field-Blaxsbb3.js} +1 -1
- package/dist/gateway/static/root/assets/{work-copy-hQmivDgT.js → work-copy-Cwyan9Sn.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CkDOVZBr.js → work-discovery-page-iJ9RBSpu.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-CqvkcFcR.js → work-item-detail-page-CqTH7PQX.js} +1 -1
- package/dist/gateway/static/root/assets/{work-page-BL8TZW4Z.js → work-page-H3m99ccS.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BLlVqKdA.js → workflow-run-setup-panel-CTG4RpRE.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BgsdRu3_.js → workflows-page-BxZSKMfv.js} +1 -1
- package/dist/gateway/static/root/index.html +6 -6
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +4 -1
- package/dist/src/agent/agent-manager.js +21 -7
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
- package/dist/src/agent/embedded/run-for-session.js +3 -1
- package/dist/src/agent/goals/post-turn.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +6 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +5 -2
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +2 -0
- package/dist/src/agent/lifecycle/timeout-wrapper.js +39 -9
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +6 -1
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +2 -0
- package/dist/src/agent/mcp/mcp-transport-config.js +10 -3
- package/dist/src/agent/mcp/mcp-transport.d.ts +1 -0
- package/dist/src/agent/mcp/mcp-transport.js +5 -2
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +6 -2
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -0
- package/dist/src/agent/service/process-direct-one-shot.js +4 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +6 -0
- package/dist/src/agent/skills/filesystem-watcher.d.ts +4 -0
- package/dist/src/agent/skills/filesystem-watcher.js +16 -7
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.d.ts +10 -7
- package/dist/src/agent/skills/index.js +56 -47
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.d.ts +5 -2
- package/dist/src/agent/skills/skill-manager.js +10 -5
- package/dist/src/agent/skills/skill-sources.d.ts +18 -0
- package/dist/src/agent/skills/skill-sources.js +143 -0
- package/dist/src/agent/skills/types.d.ts +25 -2
- package/dist/src/agent/tools/delegate-tool.js +2 -1
- package/dist/src/agent/tools/executor.d.ts +2 -0
- package/dist/src/agent/tools/executor.js +18 -11
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/managed-job-tool.d.ts +2 -0
- package/dist/src/agent/tools/managed-job-tool.js +160 -0
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -0
- package/dist/src/agent/workspace-runtime/registry.js +3 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/credentials.d.ts +9 -1
- package/dist/src/auth/credentials.js +112 -56
- package/dist/src/auth/model-credential-store.js +7 -22
- package/dist/src/auth/oauth-provider-lock.d.ts +5 -0
- package/dist/src/auth/oauth-provider-lock.js +91 -0
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/domain/defaults.d.ts +8 -1
- package/dist/src/automations/domain/defaults.js +9 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +33 -7
- package/dist/src/automations/domain/validation.d.ts +8 -0
- package/dist/src/automations/domain/validation.js +2 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +144 -34
- package/dist/src/automations/service/automation-service.d.ts +4 -0
- package/dist/src/automations/service/automation-service.js +197 -18
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +37 -7
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/utils/oauth-login.js +1 -7
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +3 -0
- package/dist/src/config/schema.js +2 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +1 -7
- package/dist/src/gateway/hono/oauth.js +1 -7
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/you.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service.js +3 -3
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/projects/project-loop.js +3 -3
- package/dist/src/providers/auth-runtime/oauth.js +12 -0
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +5 -0
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +8 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/backends/embedded-backend.d.ts +2 -0
- package/dist/src/tui/backends/embedded-backend.js +11 -7
- package/dist/src/tui/tui-backend.d.ts +2 -0
- package/dist/src/tui/tui-oauth-login.js +1 -7
- package/dist/src/tui/tui-picker-overlay.js +1 -0
- package/dist/src/tui/tui-picker-services.d.ts +1 -0
- package/dist/src/tui/tui-skills-autocomplete.d.ts +6 -2
- package/dist/src/tui/tui-skills-autocomplete.js +10 -6
- package/dist/src/tui/tui-startup-resources.d.ts +3 -1
- package/dist/src/tui/tui-startup-resources.js +4 -3
- package/dist/src/tui/tui.js +4 -1
- package/dist/src/work/home-query-service.d.ts +31 -2
- package/dist/src/work/home-query-service.js +4 -4
- package/dist/src/work/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +3 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/automations-page-CFYOCBlQ.js +0 -6
- package/dist/gateway/static/root/assets/channels-status-swr-BAC-R8IK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-2eAC9GCP.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CjpnFfOH.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DEwfSOUE.js +0 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
|
|
2
3
|
import { CredentialResolver, init_credentials } from "./credentials.js";
|
|
3
4
|
//#region src/auth/model-credential-store.ts
|
|
4
5
|
function normalizeProviderId(providerId) {
|
|
@@ -30,26 +31,10 @@ function toPersistedToken(credential, current) {
|
|
|
30
31
|
createdAt: current?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
-
const previous = providerModificationTails.get(providerId) ?? Promise.resolve();
|
|
35
|
-
let release;
|
|
36
|
-
const gate = new Promise((resolve) => {
|
|
37
|
-
release = resolve;
|
|
38
|
-
});
|
|
39
|
-
const tail = previous.catch(() => void 0).then(() => gate);
|
|
40
|
-
providerModificationTails.set(providerId, tail);
|
|
41
|
-
await previous.catch(() => void 0);
|
|
42
|
-
try {
|
|
43
|
-
return await operation();
|
|
44
|
-
} finally {
|
|
45
|
-
release();
|
|
46
|
-
if (providerModificationTails.get(providerId) === tail) providerModificationTails.delete(providerId);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
var providerModificationTails, XopcModelCredentialStore;
|
|
34
|
+
var XopcModelCredentialStore;
|
|
50
35
|
var init_model_credential_store = __esmMin((() => {
|
|
51
36
|
init_credentials();
|
|
52
|
-
|
|
37
|
+
init_oauth_provider_lock();
|
|
53
38
|
XopcModelCredentialStore = class {
|
|
54
39
|
runtimeApiKeys = /* @__PURE__ */ new Map();
|
|
55
40
|
constructor(repository = new CredentialResolver()) {
|
|
@@ -81,7 +66,7 @@ var init_model_credential_store = __esmMin((() => {
|
|
|
81
66
|
}
|
|
82
67
|
async modify(providerId, update, options) {
|
|
83
68
|
const normalizedProvider = normalizeProviderId(providerId);
|
|
84
|
-
return
|
|
69
|
+
return withOAuthProviderLock(normalizedProvider, async () => {
|
|
85
70
|
options?.signal?.throwIfAborted();
|
|
86
71
|
const persisted = await this.repository.loadOAuthTokenRecord(normalizedProvider);
|
|
87
72
|
const current = this.runtimeApiKeys.get(normalizedProvider) ?? (persisted ? toRuntimeCredential(persisted) : void 0);
|
|
@@ -93,15 +78,15 @@ var init_model_credential_store = __esmMin((() => {
|
|
|
93
78
|
this.runtimeApiKeys.delete(normalizedProvider);
|
|
94
79
|
} else this.runtimeApiKeys.set(normalizedProvider, updated);
|
|
95
80
|
return updated;
|
|
96
|
-
});
|
|
81
|
+
}, { signal: options?.signal });
|
|
97
82
|
}
|
|
98
83
|
async delete(providerId, options) {
|
|
99
84
|
const normalizedProvider = normalizeProviderId(providerId);
|
|
100
|
-
await
|
|
85
|
+
await withOAuthProviderLock(normalizedProvider, async () => {
|
|
101
86
|
options?.signal?.throwIfAborted();
|
|
102
87
|
await this.repository.deleteOAuthToken(normalizedProvider);
|
|
103
88
|
this.runtimeApiKeys.delete(normalizedProvider);
|
|
104
|
-
});
|
|
89
|
+
}, { signal: options?.signal });
|
|
105
90
|
}
|
|
106
91
|
};
|
|
107
92
|
}));
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_paths, resolveOAuthPath } from "../config/paths.js";
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
|
|
7
|
+
import { setTimeout } from "node:timers/promises";
|
|
8
|
+
//#region src/auth/oauth-provider-lock.ts
|
|
9
|
+
function lockPath(providerId) {
|
|
10
|
+
return `${resolveOAuthPath(providerId.toLowerCase())}.lock`;
|
|
11
|
+
}
|
|
12
|
+
function isAlreadyExists(error) {
|
|
13
|
+
return error?.code === "EEXIST";
|
|
14
|
+
}
|
|
15
|
+
function isMissing(error) {
|
|
16
|
+
return error?.code === "ENOENT";
|
|
17
|
+
}
|
|
18
|
+
async function removeStaleLock(path) {
|
|
19
|
+
try {
|
|
20
|
+
const info = await stat(path);
|
|
21
|
+
if (Date.now() - info.mtimeMs < STALE_LOCK_MS) return false;
|
|
22
|
+
await rm(path, { force: true });
|
|
23
|
+
return true;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (isMissing(error)) return true;
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function acquireFileLock(providerId, options) {
|
|
30
|
+
const path = lockPath(providerId);
|
|
31
|
+
const owner = `${process.pid}:${randomUUID()}`;
|
|
32
|
+
const deadline = Date.now() + LOCK_TIMEOUT_MS;
|
|
33
|
+
await mkdir(dirname(path), { recursive: true });
|
|
34
|
+
while (true) {
|
|
35
|
+
options.signal?.throwIfAborted();
|
|
36
|
+
try {
|
|
37
|
+
const handle = await open(path, "wx", 384);
|
|
38
|
+
try {
|
|
39
|
+
await handle.writeFile(owner, "utf8");
|
|
40
|
+
} finally {
|
|
41
|
+
await handle.close();
|
|
42
|
+
}
|
|
43
|
+
return async () => {
|
|
44
|
+
try {
|
|
45
|
+
if (await readFile(path, "utf8") === owner) await rm(path, { force: true });
|
|
46
|
+
} catch {}
|
|
47
|
+
};
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (!isAlreadyExists(error)) throw error;
|
|
50
|
+
if (await removeStaleLock(path)) continue;
|
|
51
|
+
if (Date.now() >= deadline) throw new Error(`Timed out waiting for OAuth credential lock for ${providerId}`);
|
|
52
|
+
await setTimeout(LOCK_RETRY_MS, void 0, options.signal ? { signal: options.signal } : void 0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function withOAuthProviderLock(providerId, operation, options = {}) {
|
|
57
|
+
const normalizedProvider = providerId.toLowerCase();
|
|
58
|
+
const heldLocks = heldProviderLocks.getStore();
|
|
59
|
+
if (heldLocks?.has(normalizedProvider)) return operation();
|
|
60
|
+
const previous = providerModificationTails.get(normalizedProvider) ?? Promise.resolve();
|
|
61
|
+
let releaseQueue;
|
|
62
|
+
const queueGate = new Promise((resolve) => {
|
|
63
|
+
releaseQueue = resolve;
|
|
64
|
+
});
|
|
65
|
+
const tail = previous.catch(() => void 0).then(() => queueGate);
|
|
66
|
+
providerModificationTails.set(normalizedProvider, tail);
|
|
67
|
+
await previous.catch(() => void 0);
|
|
68
|
+
let releaseFileLock;
|
|
69
|
+
try {
|
|
70
|
+
releaseFileLock = await acquireFileLock(normalizedProvider, options);
|
|
71
|
+
const nextHeldLocks = new Set(heldLocks);
|
|
72
|
+
nextHeldLocks.add(normalizedProvider);
|
|
73
|
+
return await heldProviderLocks.run(nextHeldLocks, operation);
|
|
74
|
+
} finally {
|
|
75
|
+
await releaseFileLock?.();
|
|
76
|
+
releaseQueue();
|
|
77
|
+
if (providerModificationTails.get(normalizedProvider) === tail) providerModificationTails.delete(normalizedProvider);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
var LOCK_RETRY_MS, LOCK_TIMEOUT_MS, STALE_LOCK_MS, providerModificationTails, heldProviderLocks;
|
|
81
|
+
var init_oauth_provider_lock = __esmMin((() => {
|
|
82
|
+
init_paths();
|
|
83
|
+
LOCK_RETRY_MS = 50;
|
|
84
|
+
LOCK_TIMEOUT_MS = 9e4;
|
|
85
|
+
STALE_LOCK_MS = 6e4;
|
|
86
|
+
providerModificationTails = /* @__PURE__ */ new Map();
|
|
87
|
+
heldProviderLocks = new AsyncLocalStorage();
|
|
88
|
+
}));
|
|
89
|
+
//#endregion
|
|
90
|
+
init_oauth_provider_lock();
|
|
91
|
+
export { init_oauth_provider_lock, withOAuthProviderLock };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
5
5
|
//#region src/auth/profiles/store.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
3
2
|
import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveOAuthPath } from "../config/paths.js";
|
|
4
|
-
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
3
|
import { init_registry, isOAuthOnlyProvider } from "./oauth/registry.js";
|
|
4
|
+
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
7
|
//#region src/auth/sync-provider-auth.ts
|
|
8
8
|
/**
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { AutomationAction } from './types.js';
|
|
2
|
+
export declare const DEFAULT_AUTOMATION_TIMEOUT_SECONDS: number;
|
|
3
|
+
export declare const DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS: number;
|
|
4
|
+
export declare function defaultAutomationTimeoutSeconds(action: AutomationAction): number;
|
|
5
|
+
export declare function resolveAutomationTimeoutSeconds(action: AutomationAction, reliability?: {
|
|
6
|
+
executionTimeoutSeconds?: number;
|
|
7
|
+
timeoutSeconds?: number;
|
|
8
|
+
}): number;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
//#region src/automations/domain/defaults.ts
|
|
2
|
-
const DEFAULT_AUTOMATION_TIMEOUT_SECONDS =
|
|
2
|
+
const DEFAULT_AUTOMATION_TIMEOUT_SECONDS = 1800;
|
|
3
|
+
const DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS = 600;
|
|
4
|
+
function defaultAutomationTimeoutSeconds(action) {
|
|
5
|
+
return action.kind === "browser_recipe" ? 600 : DEFAULT_AUTOMATION_TIMEOUT_SECONDS;
|
|
6
|
+
}
|
|
7
|
+
function resolveAutomationTimeoutSeconds(action, reliability) {
|
|
8
|
+
return reliability?.executionTimeoutSeconds ?? action.timeoutSeconds ?? reliability?.timeoutSeconds ?? defaultAutomationTimeoutSeconds(action);
|
|
9
|
+
}
|
|
3
10
|
//#endregion
|
|
4
|
-
export { DEFAULT_AUTOMATION_TIMEOUT_SECONDS };
|
|
11
|
+
export { DEFAULT_AUTOMATION_TIMEOUT_SECONDS, DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS, defaultAutomationTimeoutSeconds, resolveAutomationTimeoutSeconds };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_AUTOMATION_TIMEOUT_SECONDS } from "./defaults.js";
|
|
1
|
+
import { DEFAULT_AUTOMATION_TIMEOUT_SECONDS, DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS, defaultAutomationTimeoutSeconds, resolveAutomationTimeoutSeconds } from "./defaults.js";
|
|
2
2
|
import { computeNextAutomationRunAtMs, computeNextScheduleRunAtMs, timerDelayUntil } from "./schedule.js";
|
|
3
3
|
import { AutomationActionSchema, AutomationAfterRunSchema, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, UpdateAutomationSchema } from "./validation.js";
|
|
4
|
-
export { AutomationActionSchema, AutomationAfterRunSchema, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, DEFAULT_AUTOMATION_TIMEOUT_SECONDS, UpdateAutomationSchema, computeNextAutomationRunAtMs, computeNextScheduleRunAtMs, timerDelayUntil };
|
|
4
|
+
export { AutomationActionSchema, AutomationAfterRunSchema, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, DEFAULT_AUTOMATION_TIMEOUT_SECONDS, DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS, UpdateAutomationSchema, computeNextAutomationRunAtMs, computeNextScheduleRunAtMs, defaultAutomationTimeoutSeconds, resolveAutomationTimeoutSeconds, timerDelayUntil };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WorkflowRunInputEnvelope } from '../../workflows/domain/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { WorkflowRunServiceLike } from '../../workflows/service/workflow-run-service.types.js';
|
|
3
3
|
export type AutomationSchedule = {
|
|
4
4
|
kind: 'once';
|
|
5
5
|
at: string;
|
|
@@ -58,11 +58,20 @@ export type AutomationAfterRun = {
|
|
|
58
58
|
url: string;
|
|
59
59
|
};
|
|
60
60
|
export interface AutomationReliability {
|
|
61
|
+
/** Overall run deadline. `timeoutSeconds` remains a read-only legacy fallback. */
|
|
62
|
+
executionTimeoutSeconds?: number;
|
|
61
63
|
timeoutSeconds?: number;
|
|
62
64
|
retryCount?: number;
|
|
63
65
|
maxConcurrentRuns?: number;
|
|
64
66
|
disableAfterConsecutiveFailures?: number;
|
|
65
67
|
}
|
|
68
|
+
export type AutomationRunPhase = 'queued' | 'action' | 'after_run' | 'cancelling' | 'completed';
|
|
69
|
+
export interface AutomationRunTermination {
|
|
70
|
+
reason: 'completed' | 'failed' | 'user_cancelled' | 'deadline_exceeded';
|
|
71
|
+
component?: 'automation' | 'agent_turn' | 'tool' | 'mcp' | 'process';
|
|
72
|
+
componentName?: string;
|
|
73
|
+
cancellationConfirmed: boolean;
|
|
74
|
+
}
|
|
66
75
|
export type AutomationSafetyMode = 'suggest_only' | 'ask_before_apply' | 'auto_apply';
|
|
67
76
|
export interface AutomationSafetyPolicy {
|
|
68
77
|
mode: AutomationSafetyMode;
|
|
@@ -90,7 +99,7 @@ export interface Automation {
|
|
|
90
99
|
createdAtMs: number;
|
|
91
100
|
updatedAtMs: number;
|
|
92
101
|
}
|
|
93
|
-
export type AutomationRunStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'timeout';
|
|
102
|
+
export type AutomationRunStatus = 'queued' | 'running' | 'cancelling' | 'succeeded' | 'failed' | 'cancelled' | 'timeout';
|
|
94
103
|
export interface AutomationRun {
|
|
95
104
|
id: string;
|
|
96
105
|
automationId: string;
|
|
@@ -108,8 +117,18 @@ export interface AutomationRun {
|
|
|
108
117
|
sessionKey?: string;
|
|
109
118
|
workflowRunId?: string;
|
|
110
119
|
model?: string;
|
|
120
|
+
deadlineAtMs?: number;
|
|
121
|
+
currentPhase?: AutomationRunPhase;
|
|
122
|
+
cancelRequestedAtMs?: number;
|
|
123
|
+
cancelConfirmedAtMs?: number;
|
|
124
|
+
termination?: AutomationRunTermination;
|
|
125
|
+
heartbeatAtMs?: number;
|
|
126
|
+
leaseOwner?: string;
|
|
127
|
+
leaseExpiresAtMs?: number;
|
|
128
|
+
attemptNumber?: number;
|
|
129
|
+
rootRunId?: string;
|
|
111
130
|
}
|
|
112
|
-
export type AutomationRunEventType = 'run.queued' | 'run.started' | 'action.started' | 'action.completed' | 'action.failed' | 'after_run.started' | 'after_run.completed' | 'after_run.failed' | 'run.completed';
|
|
131
|
+
export type AutomationRunEventType = 'run.queued' | 'run.started' | 'run.deadline_resolved' | 'run.cancel_requested' | 'run.cancel_confirmed' | 'run.cancellation_unconfirmed' | 'run.recovered' | 'action.started' | 'action.retry_scheduled' | 'action.completed' | 'action.failed' | 'after_run.started' | 'after_run.completed' | 'after_run.failed' | 'run.completed';
|
|
113
132
|
export interface AutomationRunEvent {
|
|
114
133
|
id: string;
|
|
115
134
|
runId: string;
|
|
@@ -147,15 +166,17 @@ export interface AutomationDeps {
|
|
|
147
166
|
applyAutomationModelOverride?: (sessionKey: string, model: string | undefined) => Promise<boolean>;
|
|
148
167
|
};
|
|
149
168
|
turnDispatcher?: {
|
|
150
|
-
processDirect: (message: string, sessionKey: string
|
|
169
|
+
processDirect: (message: string, sessionKey: string, attachments?: unknown[], thinking?: string, options?: {
|
|
170
|
+
signal?: AbortSignal;
|
|
171
|
+
runId?: string;
|
|
172
|
+
deadlineAtMs?: number;
|
|
173
|
+
}) => Promise<string>;
|
|
151
174
|
};
|
|
152
175
|
getModelForSession?: (sessionKey: string) => string | undefined;
|
|
153
176
|
};
|
|
154
177
|
getDefaultAgentId?: () => string;
|
|
155
178
|
getProjectWorkspaceRoot?: (projectId: string) => string | undefined;
|
|
156
|
-
workflowRunService?:
|
|
157
|
-
startWorkflowRun(params: StartWorkflowRunServiceParams): Promise<WorkflowRunServiceResult>;
|
|
158
|
-
};
|
|
179
|
+
workflowRunService?: WorkflowRunServiceLike;
|
|
159
180
|
browserRecipeService?: {
|
|
160
181
|
runAndWait(recipeId: string, args: Record<string, unknown>, signal?: AbortSignal): Promise<{
|
|
161
182
|
id: string;
|
|
@@ -173,4 +194,9 @@ export interface AutomationActionOutcome {
|
|
|
173
194
|
sessionKey?: string;
|
|
174
195
|
workflowRunId?: string;
|
|
175
196
|
model?: string;
|
|
197
|
+
deadlineAtMs?: number;
|
|
198
|
+
termination?: AutomationRunTermination;
|
|
199
|
+
}
|
|
200
|
+
export interface AutomationActionExecutionHooks {
|
|
201
|
+
onRunPatch?: (patch: Partial<AutomationRun>) => void | Promise<void>;
|
|
176
202
|
}
|
|
@@ -73,6 +73,7 @@ export declare const AutomationAfterRunSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
73
73
|
url: z.ZodString;
|
|
74
74
|
}, z.core.$strict>], "kind">;
|
|
75
75
|
export declare const AutomationReliabilitySchema: z.ZodObject<{
|
|
76
|
+
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
76
77
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
77
78
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
78
79
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
@@ -96,6 +97,7 @@ export declare const AutomationStateSchema: z.ZodObject<{
|
|
|
96
97
|
cancelled: "cancelled";
|
|
97
98
|
timeout: "timeout";
|
|
98
99
|
succeeded: "succeeded";
|
|
100
|
+
cancelling: "cancelling";
|
|
99
101
|
}>>;
|
|
100
102
|
lastError: z.ZodOptional<z.ZodString>;
|
|
101
103
|
consecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -175,6 +177,7 @@ export declare const AutomationSchema: z.ZodObject<{
|
|
|
175
177
|
url: z.ZodString;
|
|
176
178
|
}, z.core.$strict>], "kind">>;
|
|
177
179
|
reliability: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
178
181
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
179
182
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
180
183
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
@@ -191,6 +194,7 @@ export declare const AutomationSchema: z.ZodObject<{
|
|
|
191
194
|
cancelled: "cancelled";
|
|
192
195
|
timeout: "timeout";
|
|
193
196
|
succeeded: "succeeded";
|
|
197
|
+
cancelling: "cancelling";
|
|
194
198
|
}>>;
|
|
195
199
|
lastError: z.ZodOptional<z.ZodString>;
|
|
196
200
|
consecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -271,6 +275,7 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
271
275
|
url: z.ZodString;
|
|
272
276
|
}, z.core.$strict>], "kind">>;
|
|
273
277
|
reliability: z.ZodOptional<z.ZodObject<{
|
|
278
|
+
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
274
279
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
275
280
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
276
281
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
@@ -289,6 +294,7 @@ export declare const CreateAutomationSchema: z.ZodObject<{
|
|
|
289
294
|
cancelled: "cancelled";
|
|
290
295
|
timeout: "timeout";
|
|
291
296
|
succeeded: "succeeded";
|
|
297
|
+
cancelling: "cancelling";
|
|
292
298
|
}>>>;
|
|
293
299
|
lastError: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
294
300
|
consecutiveFailures: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -337,6 +343,7 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
337
343
|
cancelled: "cancelled";
|
|
338
344
|
timeout: "timeout";
|
|
339
345
|
succeeded: "succeeded";
|
|
346
|
+
cancelling: "cancelling";
|
|
340
347
|
}>>;
|
|
341
348
|
lastError: z.ZodOptional<z.ZodString>;
|
|
342
349
|
consecutiveFailures: z.ZodOptional<z.ZodNumber>;
|
|
@@ -383,6 +390,7 @@ export declare const UpdateAutomationSchema: z.ZodObject<{
|
|
|
383
390
|
url: z.ZodString;
|
|
384
391
|
}, z.core.$strict>], "kind">>>;
|
|
385
392
|
reliability: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
393
|
+
executionTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
386
394
|
timeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
387
395
|
retryCount: z.ZodOptional<z.ZodNumber>;
|
|
388
396
|
maxConcurrentRuns: z.ZodOptional<z.ZodNumber>;
|
|
@@ -97,6 +97,7 @@ const AutomationAfterRunSchema = z.discriminatedUnion("kind", [
|
|
|
97
97
|
}).strict()
|
|
98
98
|
]);
|
|
99
99
|
const AutomationReliabilitySchema = z.object({
|
|
100
|
+
executionTimeoutSeconds: z.number().int().min(1).max(86400).optional(),
|
|
100
101
|
timeoutSeconds: z.number().int().min(1).max(86400).optional(),
|
|
101
102
|
retryCount: z.number().int().min(0).max(10).optional(),
|
|
102
103
|
maxConcurrentRuns: z.number().int().min(1).max(20).optional(),
|
|
@@ -114,6 +115,7 @@ const AutomationStateSchema = z.object({
|
|
|
114
115
|
lastRunStatus: z.enum([
|
|
115
116
|
"queued",
|
|
116
117
|
"running",
|
|
118
|
+
"cancelling",
|
|
117
119
|
"succeeded",
|
|
118
120
|
"failed",
|
|
119
121
|
"cancelled",
|
|
@@ -78,6 +78,7 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
78
78
|
url: string;
|
|
79
79
|
};
|
|
80
80
|
reliability?: {
|
|
81
|
+
executionTimeoutSeconds?: number;
|
|
81
82
|
timeoutSeconds?: number;
|
|
82
83
|
retryCount?: number;
|
|
83
84
|
maxConcurrentRuns?: number;
|
|
@@ -89,7 +90,7 @@ export declare function buildAutomationDraftResponse(draft: GeneratedAutomationD
|
|
|
89
90
|
nextRunAtMs?: number;
|
|
90
91
|
runningRunId?: string;
|
|
91
92
|
lastRunAtMs?: number;
|
|
92
|
-
lastRunStatus?: "queued" | "running" | "failed" | "cancelled" | "timeout" | "succeeded";
|
|
93
|
+
lastRunStatus?: "queued" | "running" | "failed" | "cancelled" | "timeout" | "succeeded" | "cancelling";
|
|
93
94
|
lastError?: string;
|
|
94
95
|
consecutiveFailures?: number;
|
|
95
96
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { onAutomationProductEvent, publishAutomationProductEvent } from "./product-events.js";
|
|
2
|
-
import { DEFAULT_AUTOMATION_TIMEOUT_SECONDS } from "./domain/defaults.js";
|
|
2
|
+
import { DEFAULT_AUTOMATION_TIMEOUT_SECONDS, DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS, defaultAutomationTimeoutSeconds, resolveAutomationTimeoutSeconds } from "./domain/defaults.js";
|
|
3
3
|
import { computeNextAutomationRunAtMs, computeNextScheduleRunAtMs, timerDelayUntil } from "./domain/schedule.js";
|
|
4
4
|
import { AutomationActionSchema, AutomationAfterRunSchema, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, UpdateAutomationSchema } from "./domain/validation.js";
|
|
5
5
|
import "./domain/index.js";
|
|
6
6
|
import { AutomationActionExecutor } from "./service/action-executor.js";
|
|
7
7
|
import { AutomationAlreadyRunningError, AutomationService } from "./service/automation-service.js";
|
|
8
8
|
import "./service/index.js";
|
|
9
|
-
export { AutomationActionExecutor, AutomationActionSchema, AutomationAfterRunSchema, AutomationAlreadyRunningError, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationService, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, DEFAULT_AUTOMATION_TIMEOUT_SECONDS, UpdateAutomationSchema, computeNextAutomationRunAtMs, computeNextScheduleRunAtMs, onAutomationProductEvent, publishAutomationProductEvent, timerDelayUntil };
|
|
9
|
+
export { AutomationActionExecutor, AutomationActionSchema, AutomationAfterRunSchema, AutomationAlreadyRunningError, AutomationReliabilitySchema, AutomationSafetyPolicySchema, AutomationScheduleSchema, AutomationSchema, AutomationService, AutomationStateSchema, AutomationTriggerSchema, CreateAutomationSchema, DEFAULT_AUTOMATION_TIMEOUT_SECONDS, DEFAULT_BROWSER_AUTOMATION_TIMEOUT_SECONDS, UpdateAutomationSchema, computeNextAutomationRunAtMs, computeNextScheduleRunAtMs, defaultAutomationTimeoutSeconds, onAutomationProductEvent, publishAutomationProductEvent, resolveAutomationTimeoutSeconds, timerDelayUntil };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Automation, AutomationActionOutcome, AutomationDeps, AutomationRun } from '../domain/types.js';
|
|
1
|
+
import type { Automation, AutomationActionExecutionHooks, AutomationActionOutcome, AutomationDeps, AutomationRun } from '../domain/types.js';
|
|
2
2
|
export declare class AutomationActionExecutor {
|
|
3
3
|
private deps;
|
|
4
4
|
setDeps(deps: AutomationDeps): void;
|
|
5
|
-
execute(automation: Automation, run: AutomationRun, signal: AbortSignal): Promise<AutomationActionOutcome>;
|
|
5
|
+
execute(automation: Automation, run: AutomationRun, signal: AbortSignal, hooks?: AutomationActionExecutionHooks): Promise<AutomationActionOutcome>;
|
|
6
6
|
private executeWithoutTimeout;
|
|
7
7
|
private executeBrowserRecipe;
|
|
8
8
|
private executeAgent;
|