@creezio/electron-shell 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/.creezio-src-hash.json +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/meili.d.ts +1 -1
- package/dist/meili.d.ts.map +1 -1
- package/dist/meili.js +1 -1
- package/dist/meili.js.map +1 -1
- package/dist-cjs/index.js +6 -8
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/meili.js +1 -2
- package/dist-cjs/meili.js.map +1 -1
- package/package.json +9 -9
- package/dist/desktop/legacy-brand-compat.d.ts +0 -45
- package/dist/desktop/legacy-brand-compat.d.ts.map +0 -1
- package/dist/desktop/legacy-brand-compat.js +0 -49
- package/dist/desktop/legacy-brand-compat.js.map +0 -1
- package/dist/factory-reset-runtime.d.ts +0 -11
- package/dist/factory-reset-runtime.d.ts.map +0 -1
- package/dist/factory-reset-runtime.js +0 -77
- package/dist/factory-reset-runtime.js.map +0 -1
- package/dist/host/ai-workspace/actions.d.ts +0 -12
- package/dist/host/ai-workspace/actions.d.ts.map +0 -1
- package/dist/host/ai-workspace/actions.js +0 -243
- package/dist/host/ai-workspace/actions.js.map +0 -1
- package/dist/host/ai-workspace/bindings.d.ts +0 -51
- package/dist/host/ai-workspace/bindings.d.ts.map +0 -1
- package/dist/host/ai-workspace/bindings.js +0 -40
- package/dist/host/ai-workspace/bindings.js.map +0 -1
- package/dist/host/ai-workspace/index.d.ts +0 -11
- package/dist/host/ai-workspace/index.d.ts.map +0 -1
- package/dist/host/ai-workspace/index.js +0 -6
- package/dist/host/ai-workspace/index.js.map +0 -1
- package/dist/host/ai-workspace/manager.d.ts +0 -128
- package/dist/host/ai-workspace/manager.d.ts.map +0 -1
- package/dist/host/ai-workspace/manager.js +0 -519
- package/dist/host/ai-workspace/manager.js.map +0 -1
- package/dist/host/ai-workspace/profile-window.d.ts +0 -37
- package/dist/host/ai-workspace/profile-window.d.ts.map +0 -1
- package/dist/host/ai-workspace/profile-window.js +0 -121
- package/dist/host/ai-workspace/profile-window.js.map +0 -1
- package/dist/host/ai-workspace/screencast.d.ts +0 -56
- package/dist/host/ai-workspace/screencast.d.ts.map +0 -1
- package/dist/host/ai-workspace/screencast.js +0 -245
- package/dist/host/ai-workspace/screencast.js.map +0 -1
- package/dist/host/ai-workspace/types.d.ts +0 -40
- package/dist/host/ai-workspace/types.d.ts.map +0 -1
- package/dist/host/ai-workspace/types.js +0 -6
- package/dist/host/ai-workspace/types.js.map +0 -1
- package/dist/host/brand-host-runtime.d.ts +0 -107
- package/dist/host/brand-host-runtime.d.ts.map +0 -1
- package/dist/host/brand-host-runtime.js +0 -274
- package/dist/host/brand-host-runtime.js.map +0 -1
- package/dist/host/brand-host-stack.d.ts +0 -117
- package/dist/host/brand-host-stack.d.ts.map +0 -1
- package/dist/host/brand-host-stack.js +0 -253
- package/dist/host/brand-host-stack.js.map +0 -1
- package/dist/host/brand-kernel-http.d.ts +0 -34
- package/dist/host/brand-kernel-http.d.ts.map +0 -1
- package/dist/host/brand-kernel-http.js +0 -95
- package/dist/host/brand-kernel-http.js.map +0 -1
- package/dist/host/brand-meili-boot.d.ts +0 -67
- package/dist/host/brand-meili-boot.d.ts.map +0 -1
- package/dist/host/brand-meili-boot.js +0 -100
- package/dist/host/brand-meili-boot.js.map +0 -1
- package/dist/host/bridge-client.d.ts +0 -54
- package/dist/host/bridge-client.d.ts.map +0 -1
- package/dist/host/bridge-client.js +0 -187
- package/dist/host/bridge-client.js.map +0 -1
- package/dist/host/context.d.ts +0 -70
- package/dist/host/context.d.ts.map +0 -1
- package/dist/host/context.js +0 -16
- package/dist/host/context.js.map +0 -1
- package/dist/host/contracts.d.ts +0 -39
- package/dist/host/contracts.d.ts.map +0 -1
- package/dist/host/contracts.js +0 -26
- package/dist/host/contracts.js.map +0 -1
- package/dist/host/crash-reporter.d.ts +0 -65
- package/dist/host/crash-reporter.d.ts.map +0 -1
- package/dist/host/crash-reporter.js +0 -371
- package/dist/host/crash-reporter.js.map +0 -1
- package/dist/host/ensure-kit-binaries.d.ts +0 -17
- package/dist/host/ensure-kit-binaries.d.ts.map +0 -1
- package/dist/host/ensure-kit-binaries.js +0 -205
- package/dist/host/ensure-kit-binaries.js.map +0 -1
- package/dist/host/feature-off-host.d.ts +0 -130
- package/dist/host/feature-off-host.d.ts.map +0 -1
- package/dist/host/feature-off-host.js +0 -138
- package/dist/host/feature-off-host.js.map +0 -1
- package/dist/host/hermes/crm-key.d.ts +0 -49
- package/dist/host/hermes/crm-key.d.ts.map +0 -1
- package/dist/host/hermes/crm-key.js +0 -126
- package/dist/host/hermes/crm-key.js.map +0 -1
- package/dist/host/hermes/ensure-crm-key-db.d.ts +0 -7
- package/dist/host/hermes/ensure-crm-key-db.d.ts.map +0 -1
- package/dist/host/hermes/ensure-crm-key-db.js +0 -84
- package/dist/host/hermes/ensure-crm-key-db.js.map +0 -1
- package/dist/host/hermes/launcher.d.ts +0 -98
- package/dist/host/hermes/launcher.d.ts.map +0 -1
- package/dist/host/hermes/launcher.js +0 -972
- package/dist/host/hermes/launcher.js.map +0 -1
- package/dist/host/hermes/runtime-bootstrap.d.ts +0 -172
- package/dist/host/hermes/runtime-bootstrap.d.ts.map +0 -1
- package/dist/host/hermes/runtime-bootstrap.js +0 -789
- package/dist/host/hermes/runtime-bootstrap.js.map +0 -1
- package/dist/host/hermes/skills-seed.d.ts +0 -40
- package/dist/host/hermes/skills-seed.d.ts.map +0 -1
- package/dist/host/hermes/skills-seed.js +0 -100
- package/dist/host/hermes/skills-seed.js.map +0 -1
- package/dist/host/host-stack.d.ts +0 -35
- package/dist/host/host-stack.d.ts.map +0 -1
- package/dist/host/host-stack.js +0 -38
- package/dist/host/host-stack.js.map +0 -1
- package/dist/host/kit-os-resources.d.ts +0 -6
- package/dist/host/kit-os-resources.d.ts.map +0 -1
- package/dist/host/kit-os-resources.js +0 -88
- package/dist/host/kit-os-resources.js.map +0 -1
- package/dist/host/load-electron.d.ts +0 -2
- package/dist/host/load-electron.d.ts.map +0 -1
- package/dist/host/load-electron.js +0 -44
- package/dist/host/load-electron.js.map +0 -1
- package/dist/host/local-config.d.ts +0 -120
- package/dist/host/local-config.d.ts.map +0 -1
- package/dist/host/local-config.js +0 -633
- package/dist/host/local-config.js.map +0 -1
- package/dist/host/meili/browse.d.ts +0 -58
- package/dist/host/meili/browse.d.ts.map +0 -1
- package/dist/host/meili/browse.js +0 -98
- package/dist/host/meili/browse.js.map +0 -1
- package/dist/host/meili/coherence-db.d.ts +0 -35
- package/dist/host/meili/coherence-db.d.ts.map +0 -1
- package/dist/host/meili/coherence-db.js +0 -129
- package/dist/host/meili/coherence-db.js.map +0 -1
- package/dist/host/meili/coherence-query.d.ts +0 -10
- package/dist/host/meili/coherence-query.d.ts.map +0 -1
- package/dist/host/meili/coherence-query.js +0 -23
- package/dist/host/meili/coherence-query.js.map +0 -1
- package/dist/host/meili/coherence.d.ts +0 -53
- package/dist/host/meili/coherence.d.ts.map +0 -1
- package/dist/host/meili/coherence.js +0 -148
- package/dist/host/meili/coherence.js.map +0 -1
- package/dist/host/meili/feed.d.ts +0 -82
- package/dist/host/meili/feed.d.ts.map +0 -1
- package/dist/host/meili/feed.js +0 -100
- package/dist/host/meili/feed.js.map +0 -1
- package/dist/host/meili/generic-indexer.d.ts +0 -34
- package/dist/host/meili/generic-indexer.d.ts.map +0 -1
- package/dist/host/meili/generic-indexer.js +0 -333
- package/dist/host/meili/generic-indexer.js.map +0 -1
- package/dist/host/meili/index-schema.d.ts +0 -64
- package/dist/host/meili/index-schema.d.ts.map +0 -1
- package/dist/host/meili/index-schema.js +0 -70
- package/dist/host/meili/index-schema.js.map +0 -1
- package/dist/host/meili/index.d.ts +0 -13
- package/dist/host/meili/index.d.ts.map +0 -1
- package/dist/host/meili/index.js +0 -8
- package/dist/host/meili/index.js.map +0 -1
- package/dist/host/meili/indexer.d.ts +0 -31
- package/dist/host/meili/indexer.d.ts.map +0 -1
- package/dist/host/meili/indexer.js +0 -49
- package/dist/host/meili/indexer.js.map +0 -1
- package/dist/host/meili-launcher.d.ts +0 -30
- package/dist/host/meili-launcher.d.ts.map +0 -1
- package/dist/host/meili-launcher.js +0 -115
- package/dist/host/meili-launcher.js.map +0 -1
- package/dist/host/n8n/agent-isolation.d.ts +0 -55
- package/dist/host/n8n/agent-isolation.d.ts.map +0 -1
- package/dist/host/n8n/agent-isolation.js +0 -158
- package/dist/host/n8n/agent-isolation.js.map +0 -1
- package/dist/host/n8n/api-key.d.ts +0 -67
- package/dist/host/n8n/api-key.d.ts.map +0 -1
- package/dist/host/n8n/api-key.js +0 -297
- package/dist/host/n8n/api-key.js.map +0 -1
- package/dist/host/n8n/launcher.d.ts +0 -126
- package/dist/host/n8n/launcher.d.ts.map +0 -1
- package/dist/host/n8n/launcher.js +0 -1170
- package/dist/host/n8n/launcher.js.map +0 -1
- package/dist/host/n8n/runtime-bootstrap.d.ts +0 -44
- package/dist/host/n8n/runtime-bootstrap.d.ts.map +0 -1
- package/dist/host/n8n/runtime-bootstrap.js +0 -230
- package/dist/host/n8n/runtime-bootstrap.js.map +0 -1
- package/dist/host/node-runtime.d.ts +0 -52
- package/dist/host/node-runtime.d.ts.map +0 -1
- package/dist/host/node-runtime.js +0 -257
- package/dist/host/node-runtime.js.map +0 -1
- package/dist/host/npm-cli.d.ts +0 -43
- package/dist/host/npm-cli.d.ts.map +0 -1
- package/dist/host/npm-cli.js +0 -213
- package/dist/host/npm-cli.js.map +0 -1
- package/dist/host/plugins/accept-check.d.ts +0 -19
- package/dist/host/plugins/accept-check.d.ts.map +0 -1
- package/dist/host/plugins/accept-check.js +0 -172
- package/dist/host/plugins/accept-check.js.map +0 -1
- package/dist/host/plugins/brand-bindings.d.ts +0 -103
- package/dist/host/plugins/brand-bindings.d.ts.map +0 -1
- package/dist/host/plugins/brand-bindings.js +0 -65
- package/dist/host/plugins/brand-bindings.js.map +0 -1
- package/dist/host/plugins/control-adapters.d.ts +0 -11
- package/dist/host/plugins/control-adapters.d.ts.map +0 -1
- package/dist/host/plugins/control-adapters.js +0 -83
- package/dist/host/plugins/control-adapters.js.map +0 -1
- package/dist/host/plugins/control-extras.d.ts +0 -61
- package/dist/host/plugins/control-extras.d.ts.map +0 -1
- package/dist/host/plugins/control-extras.js +0 -382
- package/dist/host/plugins/control-extras.js.map +0 -1
- package/dist/host/plugins/control-plane.d.ts +0 -42
- package/dist/host/plugins/control-plane.d.ts.map +0 -1
- package/dist/host/plugins/control-plane.js +0 -124
- package/dist/host/plugins/control-plane.js.map +0 -1
- package/dist/host/plugins/control-token.d.ts +0 -24
- package/dist/host/plugins/control-token.d.ts.map +0 -1
- package/dist/host/plugins/control-token.js +0 -77
- package/dist/host/plugins/control-token.js.map +0 -1
- package/dist/host/plugins/crm-key.d.ts +0 -25
- package/dist/host/plugins/crm-key.d.ts.map +0 -1
- package/dist/host/plugins/crm-key.js +0 -126
- package/dist/host/plugins/crm-key.js.map +0 -1
- package/dist/host/plugins/data.d.ts +0 -21
- package/dist/host/plugins/data.d.ts.map +0 -1
- package/dist/host/plugins/data.js +0 -100
- package/dist/host/plugins/data.js.map +0 -1
- package/dist/host/plugins/events.d.ts +0 -6
- package/dist/host/plugins/events.d.ts.map +0 -1
- package/dist/host/plugins/events.js +0 -6
- package/dist/host/plugins/events.js.map +0 -1
- package/dist/host/plugins/execution-grant.d.ts +0 -6
- package/dist/host/plugins/execution-grant.d.ts.map +0 -1
- package/dist/host/plugins/execution-grant.js +0 -6
- package/dist/host/plugins/execution-grant.js.map +0 -1
- package/dist/host/plugins/git.d.ts +0 -56
- package/dist/host/plugins/git.d.ts.map +0 -1
- package/dist/host/plugins/git.js +0 -357
- package/dist/host/plugins/git.js.map +0 -1
- package/dist/host/plugins/host.d.ts +0 -68
- package/dist/host/plugins/host.d.ts.map +0 -1
- package/dist/host/plugins/host.js +0 -276
- package/dist/host/plugins/host.js.map +0 -1
- package/dist/host/plugins/launcher.d.ts +0 -146
- package/dist/host/plugins/launcher.d.ts.map +0 -1
- package/dist/host/plugins/launcher.js +0 -489
- package/dist/host/plugins/launcher.js.map +0 -1
- package/dist/host/plugins/runtime.d.ts +0 -28
- package/dist/host/plugins/runtime.d.ts.map +0 -1
- package/dist/host/plugins/runtime.js +0 -430
- package/dist/host/plugins/runtime.js.map +0 -1
- package/dist/host/plugins/test-runner.d.ts +0 -15
- package/dist/host/plugins/test-runner.d.ts.map +0 -1
- package/dist/host/plugins/test-runner.js +0 -106
- package/dist/host/plugins/test-runner.js.map +0 -1
- package/dist/host/safe-storage.d.ts +0 -21
- package/dist/host/safe-storage.d.ts.map +0 -1
- package/dist/host/safe-storage.js +0 -55
- package/dist/host/safe-storage.js.map +0 -1
- package/dist/host/sandbox/embed-sandbox.d.ts +0 -133
- package/dist/host/sandbox/embed-sandbox.d.ts.map +0 -1
- package/dist/host/sandbox/embed-sandbox.js +0 -378
- package/dist/host/sandbox/embed-sandbox.js.map +0 -1
- package/dist/host/sandbox/os-sandbox.d.ts +0 -41
- package/dist/host/sandbox/os-sandbox.d.ts.map +0 -1
- package/dist/host/sandbox/os-sandbox.js +0 -98
- package/dist/host/sandbox/os-sandbox.js.map +0 -1
- package/dist/host/server-env.d.ts +0 -50
- package/dist/host/server-env.d.ts.map +0 -1
- package/dist/host/server-env.js +0 -64
- package/dist/host/server-env.js.map +0 -1
- package/dist/host/server-launcher.d.ts +0 -49
- package/dist/host/server-launcher.d.ts.map +0 -1
- package/dist/host/server-launcher.js +0 -43
- package/dist/host/server-launcher.js.map +0 -1
- package/dist/host/tunnel/cloudflared-respawn.d.ts +0 -58
- package/dist/host/tunnel/cloudflared-respawn.d.ts.map +0 -1
- package/dist/host/tunnel/cloudflared-respawn.js +0 -73
- package/dist/host/tunnel/cloudflared-respawn.js.map +0 -1
- package/dist/host/tunnel/tunnel.d.ts +0 -72
- package/dist/host/tunnel/tunnel.d.ts.map +0 -1
- package/dist/host/tunnel/tunnel.js +0 -462
- package/dist/host/tunnel/tunnel.js.map +0 -1
- package/dist/logger.d.ts +0 -44
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -252
- package/dist/logger.js.map +0 -1
- package/dist-cjs/desktop/legacy-brand-compat.js +0 -56
- package/dist-cjs/desktop/legacy-brand-compat.js.map +0 -1
- package/dist-cjs/factory-reset-runtime.js +0 -117
- package/dist-cjs/factory-reset-runtime.js.map +0 -1
- package/dist-cjs/host/ai-workspace/actions.js +0 -247
- package/dist-cjs/host/ai-workspace/actions.js.map +0 -1
- package/dist-cjs/host/ai-workspace/bindings.js +0 -49
- package/dist-cjs/host/ai-workspace/bindings.js.map +0 -1
- package/dist-cjs/host/ai-workspace/index.js +0 -21
- package/dist-cjs/host/ai-workspace/index.js.map +0 -1
- package/dist-cjs/host/ai-workspace/manager.js +0 -528
- package/dist-cjs/host/ai-workspace/manager.js.map +0 -1
- package/dist-cjs/host/ai-workspace/profile-window.js +0 -125
- package/dist-cjs/host/ai-workspace/profile-window.js.map +0 -1
- package/dist-cjs/host/ai-workspace/screencast.js +0 -249
- package/dist-cjs/host/ai-workspace/screencast.js.map +0 -1
- package/dist-cjs/host/ai-workspace/types.js +0 -7
- package/dist-cjs/host/ai-workspace/types.js.map +0 -1
- package/dist-cjs/host/brand-host-runtime.js +0 -286
- package/dist-cjs/host/brand-host-runtime.js.map +0 -1
- package/dist-cjs/host/brand-host-stack.js +0 -259
- package/dist-cjs/host/brand-host-stack.js.map +0 -1
- package/dist-cjs/host/brand-kernel-http.js +0 -101
- package/dist-cjs/host/brand-kernel-http.js.map +0 -1
- package/dist-cjs/host/brand-meili-boot.js +0 -106
- package/dist-cjs/host/brand-meili-boot.js.map +0 -1
- package/dist-cjs/host/bridge-client.js +0 -191
- package/dist-cjs/host/bridge-client.js.map +0 -1
- package/dist-cjs/host/context.js +0 -20
- package/dist-cjs/host/context.js.map +0 -1
- package/dist-cjs/host/contracts.js +0 -32
- package/dist-cjs/host/contracts.js.map +0 -1
- package/dist-cjs/host/crash-reporter.js +0 -422
- package/dist-cjs/host/crash-reporter.js.map +0 -1
- package/dist-cjs/host/ensure-kit-binaries.js +0 -212
- package/dist-cjs/host/ensure-kit-binaries.js.map +0 -1
- package/dist-cjs/host/feature-off-host.js +0 -144
- package/dist-cjs/host/feature-off-host.js.map +0 -1
- package/dist-cjs/host/hermes/crm-key.js +0 -137
- package/dist-cjs/host/hermes/crm-key.js.map +0 -1
- package/dist-cjs/host/hermes/ensure-crm-key-db.js +0 -89
- package/dist-cjs/host/hermes/ensure-crm-key-db.js.map +0 -1
- package/dist-cjs/host/hermes/launcher.js +0 -981
- package/dist-cjs/host/hermes/launcher.js.map +0 -1
- package/dist-cjs/host/hermes/runtime-bootstrap.js +0 -853
- package/dist-cjs/host/hermes/runtime-bootstrap.js.map +0 -1
- package/dist-cjs/host/hermes/skills-seed.js +0 -110
- package/dist-cjs/host/hermes/skills-seed.js.map +0 -1
- package/dist-cjs/host/host-stack.js +0 -42
- package/dist-cjs/host/host-stack.js.map +0 -1
- package/dist-cjs/host/kit-os-resources.js +0 -96
- package/dist-cjs/host/kit-os-resources.js.map +0 -1
- package/dist-cjs/host/load-electron.js +0 -47
- package/dist-cjs/host/load-electron.js.map +0 -1
- package/dist-cjs/host/local-config.js +0 -640
- package/dist-cjs/host/local-config.js.map +0 -1
- package/dist-cjs/host/meili/browse.js +0 -103
- package/dist-cjs/host/meili/browse.js.map +0 -1
- package/dist-cjs/host/meili/coherence-db.js +0 -139
- package/dist-cjs/host/meili/coherence-db.js.map +0 -1
- package/dist-cjs/host/meili/coherence-query.js +0 -25
- package/dist-cjs/host/meili/coherence-query.js.map +0 -1
- package/dist-cjs/host/meili/coherence.js +0 -158
- package/dist-cjs/host/meili/coherence.js.map +0 -1
- package/dist-cjs/host/meili/feed.js +0 -108
- package/dist-cjs/host/meili/feed.js.map +0 -1
- package/dist-cjs/host/meili/generic-indexer.js +0 -340
- package/dist-cjs/host/meili/generic-indexer.js.map +0 -1
- package/dist-cjs/host/meili/index-schema.js +0 -79
- package/dist-cjs/host/meili/index-schema.js.map +0 -1
- package/dist-cjs/host/meili/index.js +0 -45
- package/dist-cjs/host/meili/index.js.map +0 -1
- package/dist-cjs/host/meili/indexer.js +0 -85
- package/dist-cjs/host/meili/indexer.js.map +0 -1
- package/dist-cjs/host/meili-launcher.js +0 -121
- package/dist-cjs/host/meili-launcher.js.map +0 -1
- package/dist-cjs/host/n8n/agent-isolation.js +0 -173
- package/dist-cjs/host/n8n/agent-isolation.js.map +0 -1
- package/dist-cjs/host/n8n/api-key.js +0 -314
- package/dist-cjs/host/n8n/api-key.js.map +0 -1
- package/dist-cjs/host/n8n/launcher.js +0 -1209
- package/dist-cjs/host/n8n/launcher.js.map +0 -1
- package/dist-cjs/host/n8n/runtime-bootstrap.js +0 -244
- package/dist-cjs/host/n8n/runtime-bootstrap.js.map +0 -1
- package/dist-cjs/host/node-runtime.js +0 -274
- package/dist-cjs/host/node-runtime.js.map +0 -1
- package/dist-cjs/host/npm-cli.js +0 -224
- package/dist-cjs/host/npm-cli.js.map +0 -1
- package/dist-cjs/host/plugins/accept-check.js +0 -176
- package/dist-cjs/host/plugins/accept-check.js.map +0 -1
- package/dist-cjs/host/plugins/brand-bindings.js +0 -78
- package/dist-cjs/host/plugins/brand-bindings.js.map +0 -1
- package/dist-cjs/host/plugins/control-adapters.js +0 -89
- package/dist-cjs/host/plugins/control-adapters.js.map +0 -1
- package/dist-cjs/host/plugins/control-extras.js +0 -397
- package/dist-cjs/host/plugins/control-extras.js.map +0 -1
- package/dist-cjs/host/plugins/control-plane.js +0 -130
- package/dist-cjs/host/plugins/control-plane.js.map +0 -1
- package/dist-cjs/host/plugins/control-token.js +0 -90
- package/dist-cjs/host/plugins/control-token.js.map +0 -1
- package/dist-cjs/host/plugins/crm-key.js +0 -135
- package/dist-cjs/host/plugins/crm-key.js.map +0 -1
- package/dist-cjs/host/plugins/data.js +0 -107
- package/dist-cjs/host/plugins/data.js.map +0 -1
- package/dist-cjs/host/plugins/events.js +0 -19
- package/dist-cjs/host/plugins/events.js.map +0 -1
- package/dist-cjs/host/plugins/execution-grant.js +0 -11
- package/dist-cjs/host/plugins/execution-grant.js.map +0 -1
- package/dist-cjs/host/plugins/git.js +0 -371
- package/dist-cjs/host/plugins/git.js.map +0 -1
- package/dist-cjs/host/plugins/host.js +0 -283
- package/dist-cjs/host/plugins/host.js.map +0 -1
- package/dist-cjs/host/plugins/launcher.js +0 -514
- package/dist-cjs/host/plugins/launcher.js.map +0 -1
- package/dist-cjs/host/plugins/runtime.js +0 -446
- package/dist-cjs/host/plugins/runtime.js.map +0 -1
- package/dist-cjs/host/plugins/test-runner.js +0 -112
- package/dist-cjs/host/plugins/test-runner.js.map +0 -1
- package/dist-cjs/host/safe-storage.js +0 -95
- package/dist-cjs/host/safe-storage.js.map +0 -1
- package/dist-cjs/host/sandbox/embed-sandbox.js +0 -396
- package/dist-cjs/host/sandbox/embed-sandbox.js.map +0 -1
- package/dist-cjs/host/sandbox/os-sandbox.js +0 -106
- package/dist-cjs/host/sandbox/os-sandbox.js.map +0 -1
- package/dist-cjs/host/server-env.js +0 -69
- package/dist-cjs/host/server-env.js.map +0 -1
- package/dist-cjs/host/server-launcher.js +0 -52
- package/dist-cjs/host/server-launcher.js.map +0 -1
- package/dist-cjs/host/tunnel/cloudflared-respawn.js +0 -80
- package/dist-cjs/host/tunnel/cloudflared-respawn.js.map +0 -1
- package/dist-cjs/host/tunnel/tunnel.js +0 -470
- package/dist-cjs/host/tunnel/tunnel.js.map +0 -1
- package/dist-cjs/logger.js +0 -269
- package/dist-cjs/logger.js.map +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Pont serveur local ↔ Electron pour le pilotage bot des onglets fournisseurs.
|
|
4
|
-
*
|
|
5
|
-
* - S'authentifie auprès du serveur Next local (POST /api/v1/auth/login avec
|
|
6
|
-
* les credentials bootstrappés) et conserve le cookie de session.
|
|
7
|
-
* - S'abonne au flux SSE GET /api/v1/assistant/supplier-actions/stream
|
|
8
|
-
* (nouvelle route — voir src/server/routes/assistant.ts dans le fork).
|
|
9
|
-
* - Pour chaque événement `supplier_action`, exécute l'action via
|
|
10
|
-
* supplier-driver puis POST le résultat sur la route EXISTANTE
|
|
11
|
-
* /api/v1/assistant/ui-actions/:id/result (résout la promesse serveur).
|
|
12
|
-
* - Reconnexion automatique avec backoff.
|
|
13
|
-
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.BridgeClient = void 0;
|
|
16
|
-
class BridgeClient {
|
|
17
|
-
opts;
|
|
18
|
-
cookie = null;
|
|
19
|
-
stopped = false;
|
|
20
|
-
abort = null;
|
|
21
|
-
constructor(opts) {
|
|
22
|
-
this.opts = opts;
|
|
23
|
-
}
|
|
24
|
-
log(line) {
|
|
25
|
-
(this.opts.onLog || ((l) => console.log(`[bridge] ${l}`)))(line);
|
|
26
|
-
}
|
|
27
|
-
async start() {
|
|
28
|
-
this.stopped = false;
|
|
29
|
-
void this.loop();
|
|
30
|
-
}
|
|
31
|
-
stop() {
|
|
32
|
-
this.stopped = true;
|
|
33
|
-
this.abort?.abort();
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* POST JSON authentifié avec la session bridge (frames screencast…).
|
|
37
|
-
* Retourne le JSON de réponse, ou null en cas d'échec (l'appelant décide
|
|
38
|
-
* de retenter / s'arrêter — jamais de throw).
|
|
39
|
-
*/
|
|
40
|
-
async postJson(path, body) {
|
|
41
|
-
try {
|
|
42
|
-
if (this.cookie === null)
|
|
43
|
-
await this.login();
|
|
44
|
-
const res = await fetch(`${this.opts.baseUrl}${path}`, {
|
|
45
|
-
method: "POST",
|
|
46
|
-
headers: {
|
|
47
|
-
"Content-Type": "application/json",
|
|
48
|
-
...(this.cookie ? { Cookie: this.cookie } : {}),
|
|
49
|
-
},
|
|
50
|
-
body: JSON.stringify(body),
|
|
51
|
-
});
|
|
52
|
-
if (res.status === 401) {
|
|
53
|
-
this.cookie = null; // relogin au prochain appel
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
if (!res.ok)
|
|
57
|
-
return null;
|
|
58
|
-
return (await res.json().catch(() => ({})));
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async loop() {
|
|
65
|
-
let backoffMs = 1000;
|
|
66
|
-
while (!this.stopped) {
|
|
67
|
-
try {
|
|
68
|
-
if (!this.cookie)
|
|
69
|
-
await this.login();
|
|
70
|
-
await this.consumeStream();
|
|
71
|
-
backoffMs = 1000; // stream terminé proprement → retry rapide
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
if (this.stopped)
|
|
75
|
-
return;
|
|
76
|
-
this.log(`connexion perdue (${e instanceof Error ? e.message : e}) — retry ${backoffMs}ms`);
|
|
77
|
-
}
|
|
78
|
-
await new Promise((r) => setTimeout(r, backoffMs));
|
|
79
|
-
backoffMs = Math.min(backoffMs * 2, 15000);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async login() {
|
|
83
|
-
// Mode session : réutilise le cookie posé par le login UI (client remote).
|
|
84
|
-
if (this.opts.getSessionCookie) {
|
|
85
|
-
const cookie = await this.opts.getSessionCookie();
|
|
86
|
-
if (!cookie) {
|
|
87
|
-
throw new Error("session CRM absente — en attente du login utilisateur");
|
|
88
|
-
}
|
|
89
|
-
this.cookie = cookie;
|
|
90
|
-
this.log("session bridge reprise (cookie appView)");
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const res = await fetch(`${this.opts.baseUrl}/api/v1/auth/login`, {
|
|
94
|
-
method: "POST",
|
|
95
|
-
headers: { "Content-Type": "application/json" },
|
|
96
|
-
body: JSON.stringify({ email: this.opts.authUser, password: this.opts.authPassword }),
|
|
97
|
-
});
|
|
98
|
-
if (!res.ok)
|
|
99
|
-
throw new Error(`login bridge échoué (HTTP ${res.status})`);
|
|
100
|
-
const setCookie = res.headers.get("set-cookie") || "";
|
|
101
|
-
const name = this.opts.sessionCookieName;
|
|
102
|
-
const re = new RegExp(`${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}=([^;]+)`);
|
|
103
|
-
const m = setCookie.match(re);
|
|
104
|
-
// AUTH_DISABLED=1 : pas de cookie posé, la session n'est pas requise.
|
|
105
|
-
this.cookie = m ? `${name}=${m[1]}` : "";
|
|
106
|
-
this.log("session bridge établie");
|
|
107
|
-
}
|
|
108
|
-
async consumeStream() {
|
|
109
|
-
this.abort = new AbortController();
|
|
110
|
-
const res = await fetch(`${this.opts.baseUrl}/api/v1/assistant/supplier-actions/stream`, {
|
|
111
|
-
headers: {
|
|
112
|
-
Accept: "text/event-stream",
|
|
113
|
-
...(this.cookie ? { Cookie: this.cookie } : {}),
|
|
114
|
-
...(this.opts.deviceId ? { "x-device-id": this.opts.deviceId } : {}),
|
|
115
|
-
...(this.opts.deviceLabel
|
|
116
|
-
? { "x-device-label": this.opts.deviceLabel }
|
|
117
|
-
: {}),
|
|
118
|
-
},
|
|
119
|
-
signal: this.abort.signal,
|
|
120
|
-
});
|
|
121
|
-
if (res.status === 401) {
|
|
122
|
-
this.cookie = null;
|
|
123
|
-
throw new Error("session expirée");
|
|
124
|
-
}
|
|
125
|
-
if (!res.ok || !res.body)
|
|
126
|
-
throw new Error(`stream HTTP ${res.status}`);
|
|
127
|
-
this.log("abonné au flux supplier-actions");
|
|
128
|
-
const reader = res.body.getReader();
|
|
129
|
-
const decoder = new TextDecoder();
|
|
130
|
-
let buffer = "";
|
|
131
|
-
for (;;) {
|
|
132
|
-
const { done, value } = await reader.read();
|
|
133
|
-
if (done)
|
|
134
|
-
break;
|
|
135
|
-
buffer += decoder.decode(value, { stream: true });
|
|
136
|
-
// Découpage SSE : événements séparés par une ligne vide.
|
|
137
|
-
let idx;
|
|
138
|
-
while ((idx = buffer.indexOf("\n\n")) !== -1) {
|
|
139
|
-
const rawEvent = buffer.slice(0, idx);
|
|
140
|
-
buffer = buffer.slice(idx + 2);
|
|
141
|
-
this.handleSseEvent(rawEvent);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
handleSseEvent(raw) {
|
|
146
|
-
let event = "message";
|
|
147
|
-
const dataLines = [];
|
|
148
|
-
for (const line of raw.split("\n")) {
|
|
149
|
-
if (line.startsWith("event:"))
|
|
150
|
-
event = line.slice(6).trim();
|
|
151
|
-
else if (line.startsWith("data:"))
|
|
152
|
-
dataLines.push(line.slice(5).trim());
|
|
153
|
-
}
|
|
154
|
-
if (event !== "supplier_action" || dataLines.length === 0)
|
|
155
|
-
return;
|
|
156
|
-
let req;
|
|
157
|
-
try {
|
|
158
|
-
req = JSON.parse(dataLines.join("\n"));
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
if (!req?.actionId || !req.type)
|
|
164
|
-
return;
|
|
165
|
-
void this.execute(req);
|
|
166
|
-
}
|
|
167
|
-
async execute(req) {
|
|
168
|
-
let result;
|
|
169
|
-
try {
|
|
170
|
-
result = await this.opts.executor(req);
|
|
171
|
-
}
|
|
172
|
-
catch (e) {
|
|
173
|
-
result = { ok: false, error: e instanceof Error ? e.message : "erreur exécuteur" };
|
|
174
|
-
}
|
|
175
|
-
try {
|
|
176
|
-
await fetch(`${this.opts.baseUrl}/api/v1/assistant/ui-actions/${encodeURIComponent(req.actionId)}/result`, {
|
|
177
|
-
method: "POST",
|
|
178
|
-
headers: {
|
|
179
|
-
"Content-Type": "application/json",
|
|
180
|
-
...(this.cookie ? { Cookie: this.cookie } : {}),
|
|
181
|
-
},
|
|
182
|
-
body: JSON.stringify(result),
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
catch {
|
|
186
|
-
this.log(`POST résultat ${req.actionId} échoué — le serveur timeoutera`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
exports.BridgeClient = BridgeClient;
|
|
191
|
-
//# sourceMappingURL=bridge-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-client.js","sourceRoot":"","sources":["../../src/host/bridge-client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAwBH,MAAa,YAAY;IAKH;IAJZ,MAAM,GAAkB,IAAI,CAAC;IAC7B,OAAO,GAAG,KAAK,CAAC;IAChB,KAAK,GAA2B,IAAI,CAAC;IAE7C,YAAoB,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEnC,GAAG,CAAC,IAAY;QACtB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CACZ,IAAY,EACZ,IAAa;QAEb,IAAI,CAAC;YACH,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI;gBAAE,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE;gBACrD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,kBAAkB;oBAClC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,E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AC;aAC7B,CACF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,GAAG,CAAC,iBAAiB,GAAG,CAAC,QAAQ,iCAAiC,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;CACF;AA3KD,oCA2KC"}
|
package/dist-cjs/host/context.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Contexte runtime hôte injecté dans tous les launchers B.2.
|
|
4
|
-
* Remplace les singletons TF2 (userDataDir(), paths.ts, logger).
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.hostProductName = hostProductName;
|
|
8
|
-
exports.hostLog = hostLog;
|
|
9
|
-
const platform_core_1 = require("@creezio/platform-core");
|
|
10
|
-
function hostProductName(ctx) {
|
|
11
|
-
const kind = ctx.appKind === "server" ? "server" : "client";
|
|
12
|
-
return (0, platform_core_1.displayNameFor)(ctx.manifest, kind);
|
|
13
|
-
}
|
|
14
|
-
function hostLog(ctx, scope, line) {
|
|
15
|
-
if (ctx.log)
|
|
16
|
-
ctx.log(scope, line);
|
|
17
|
-
else
|
|
18
|
-
console.log(`[${scope}] ${line}`);
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/host/context.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAkEH,0CAGC;AAED,0BAOC;AA3ED,0DAA6E;AA+D7E,SAAgB,eAAe,CAAC,GAAuB;IACrD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5D,OAAO,IAAA,8BAAc,EAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,OAAO,CACrB,GAAuB,EACvB,KAAa,EACb,IAAY;IAEZ,IAAI,GAAG,CAAC,GAAG;QAAE,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;;QAC7B,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Contrats des launchers hôte (Hermes / n8n / tunnel) — Phase B / B.2.
|
|
4
|
-
* Les implémentations complètes sont dans host/hermes, host/n8n, host/tunnel.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.DEFAULT_HOST_ONLY_ELECTRON_MODULES = void 0;
|
|
8
|
-
exports.buildEmbedHostEnv = buildEmbedHostEnv;
|
|
9
|
-
exports.cloudflaredEnvKey = cloudflaredEnvKey;
|
|
10
|
-
const brand_config_1 = require("@creezio/brand-config");
|
|
11
|
-
const platform_core_1 = require("@creezio/platform-core");
|
|
12
|
-
/** Env générique pour un embed hôte (préfixe marque). */
|
|
13
|
-
function buildEmbedHostEnv(manifest, extras = {}) {
|
|
14
|
-
return {
|
|
15
|
-
...(0, platform_core_1.brandEnv)(manifest, {
|
|
16
|
-
DESKTOP: "1",
|
|
17
|
-
BRAND_ID: manifest.brandId,
|
|
18
|
-
...extras,
|
|
19
|
-
}),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/** Clé override binaire cloudflared hors packagé. */
|
|
23
|
-
function cloudflaredEnvKey(manifest) {
|
|
24
|
-
return (0, brand_config_1.envKey)(manifest, "CLOUDFLARED_BINARY");
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Modules host-only exclus du paquet Client — réexport pour tooling.
|
|
28
|
-
* @see @creezio/brand-config DEFAULT_HOST_ONLY_ELECTRON_MODULES
|
|
29
|
-
*/
|
|
30
|
-
var brand_config_2 = require("@creezio/brand-config");
|
|
31
|
-
Object.defineProperty(exports, "DEFAULT_HOST_ONLY_ELECTRON_MODULES", { enumerable: true, get: function () { return brand_config_2.DEFAULT_HOST_ONLY_ELECTRON_MODULES; } });
|
|
32
|
-
//# sourceMappingURL=contracts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/host/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAmCH,8CAWC;AAGD,8CAEC;AAhDD,wDAA+C;AAC/C,0DAAkD;AA8BlD,yDAAyD;AACzD,SAAgB,iBAAiB,CAC/B,QAAqB,EACrB,SAA6C,EAAE;IAE/C,OAAO;QACL,GAAG,IAAA,wBAAQ,EAAC,QAAQ,EAAE;YACpB,OAAO,EAAE,GAAG;YACZ,QAAQ,EAAE,QAAQ,CAAC,OAAO;YAC1B,GAAG,MAAM;SACV,CAAC;KACH,CAAC;AACJ,CAAC;AAED,qDAAqD;AACrD,SAAgB,iBAAiB,CAAC,QAAqB;IACrD,OAAO,IAAA,qBAAM,EAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,sDAA2E;AAAlE,kIAAA,kCAAkC,OAAA"}
|
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Rapport de crash : fichier local (userData/logs/ + crash-reports/) + envoi
|
|
4
|
-
* automatique au collecteur éditeur (télémétrie — service autonome VPS).
|
|
5
|
-
*
|
|
6
|
-
* Règles :
|
|
7
|
-
* - best-effort intégral : timeout court, try/catch partout, JAMAIS de throw ;
|
|
8
|
-
* - l'envoi ne bloque rien (fire-and-forget) ;
|
|
9
|
-
* - queue fichier si hors-ligne → flush au rapport suivant / flushPending ;
|
|
10
|
-
* - identifiant d'installation anonyme (uuid v4, persisté userData).
|
|
11
|
-
*/
|
|
12
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(o, k2, desc);
|
|
19
|
-
}) : (function(o, m, k, k2) {
|
|
20
|
-
if (k2 === undefined) k2 = k;
|
|
21
|
-
o[k2] = m[k];
|
|
22
|
-
}));
|
|
23
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
-
}) : function(o, v) {
|
|
26
|
-
o["default"] = v;
|
|
27
|
-
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
-
var ownKeys = function(o) {
|
|
30
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
-
var ar = [];
|
|
32
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
-
return ar;
|
|
34
|
-
};
|
|
35
|
-
return ownKeys(o);
|
|
36
|
-
};
|
|
37
|
-
return function (mod) {
|
|
38
|
-
if (mod && mod.__esModule) return mod;
|
|
39
|
-
var result = {};
|
|
40
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
-
__setModuleDefault(result, mod);
|
|
42
|
-
return result;
|
|
43
|
-
};
|
|
44
|
-
})();
|
|
45
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
-
};
|
|
48
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.configureCrashReporter = configureCrashReporter;
|
|
50
|
-
exports.installEarlyCrashWriter = installEarlyCrashWriter;
|
|
51
|
-
exports.setBootStage = setBootStage;
|
|
52
|
-
exports.getBootStage = getBootStage;
|
|
53
|
-
exports.getBootTimeline = getBootTimeline;
|
|
54
|
-
exports.crashReportsDir = crashReportsDir;
|
|
55
|
-
exports.crashLogHint = crashLogHint;
|
|
56
|
-
exports.initCrashReporter = initCrashReporter;
|
|
57
|
-
exports.crashEndpoint = crashEndpoint;
|
|
58
|
-
exports.getInstallId = getInstallId;
|
|
59
|
-
exports.reportCrash = reportCrash;
|
|
60
|
-
exports.reportCrashDebounced = reportCrashDebounced;
|
|
61
|
-
exports.flushPendingCrashReports = flushPendingCrashReports;
|
|
62
|
-
exports.installGlobalHandlers = installGlobalHandlers;
|
|
63
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
64
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
65
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
66
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
67
|
-
const logger_js_1 = require("../logger.js");
|
|
68
|
-
let config = {
|
|
69
|
-
defaultEndpoint: "http://127.0.0.1/crash-disabled",
|
|
70
|
-
};
|
|
71
|
-
function configureCrashReporter(next) {
|
|
72
|
-
const { defaultEndpoint, ...rest } = next;
|
|
73
|
-
config = {
|
|
74
|
-
...config,
|
|
75
|
-
...rest,
|
|
76
|
-
...(defaultEndpoint !== undefined ? { defaultEndpoint } : {}),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function resolveCrashEndpoint() {
|
|
80
|
-
const key = config.endpointEnvKey;
|
|
81
|
-
if (key) {
|
|
82
|
-
const fromEnv = (process.env[key] || "").trim();
|
|
83
|
-
if (fromEnv)
|
|
84
|
-
return fromEnv;
|
|
85
|
-
}
|
|
86
|
-
const globalEnv = (process.env.CREEZIO_CRASH_ENDPOINT || "").trim();
|
|
87
|
-
if (globalEnv)
|
|
88
|
-
return globalEnv;
|
|
89
|
-
return config.defaultEndpoint || "http://127.0.0.1/crash-disabled";
|
|
90
|
-
}
|
|
91
|
-
function isUploadEnabled() {
|
|
92
|
-
const ep = resolveCrashEndpoint();
|
|
93
|
-
return Boolean(ep) && !/crash-disabled/i.test(ep);
|
|
94
|
-
}
|
|
95
|
-
/* ── Early crash writer ──────────────────────────────────────────────────
|
|
96
|
-
* Filet AVANT toute résolution de chemins (userData, logger, manifest…) :
|
|
97
|
-
* si le main crashe dans les toutes premières lignes du boot, on veut au
|
|
98
|
-
* moins un JSON sur disque à côté de l'exécutable. Aucune dépendance :
|
|
99
|
-
* dirname(execPath)/data/crash-reports/early-*.json (fallback tmpdir). */
|
|
100
|
-
let earlyWriterInstalled = false;
|
|
101
|
-
let earlyWriterActive = false;
|
|
102
|
-
function writeEarlyCrashFile(kind, detail) {
|
|
103
|
-
const stamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
104
|
-
const body = JSON.stringify({
|
|
105
|
-
kind,
|
|
106
|
-
early: true,
|
|
107
|
-
timestamp: new Date().toISOString(),
|
|
108
|
-
pid: process.pid,
|
|
109
|
-
execPath: process.execPath,
|
|
110
|
-
platform: process.platform,
|
|
111
|
-
arch: process.arch,
|
|
112
|
-
detail,
|
|
113
|
-
}, null, 2);
|
|
114
|
-
const candidates = [
|
|
115
|
-
node_path_1.default.join(node_path_1.default.dirname(process.execPath), "data", "crash-reports"),
|
|
116
|
-
node_path_1.default.join(node_os_1.default.tmpdir(), "creezio-crash"),
|
|
117
|
-
];
|
|
118
|
-
for (const dir of candidates) {
|
|
119
|
-
try {
|
|
120
|
-
node_fs_1.default.mkdirSync(dir, { recursive: true });
|
|
121
|
-
node_fs_1.default.writeFileSync(node_path_1.default.join(dir, `early-${stamp}-${kind}.json`), body);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
/* essayer le fallback suivant */
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Handler minimal `uncaughtException`/`unhandledRejection` à installer dès la
|
|
131
|
-
* PREMIÈRE ligne du main (avant Electron, avant résolution des paths).
|
|
132
|
-
* Se désactive quand `initCrashReporter` prend le relais (rapports complets).
|
|
133
|
-
*/
|
|
134
|
-
function installEarlyCrashWriter() {
|
|
135
|
-
if (earlyWriterInstalled)
|
|
136
|
-
return;
|
|
137
|
-
earlyWriterInstalled = true;
|
|
138
|
-
earlyWriterActive = true;
|
|
139
|
-
process.on("uncaughtException", (e) => {
|
|
140
|
-
if (!earlyWriterActive)
|
|
141
|
-
return;
|
|
142
|
-
writeEarlyCrashFile("uncaughtException", {
|
|
143
|
-
message: e?.message,
|
|
144
|
-
stack: e?.stack,
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
process.on("unhandledRejection", (reason) => {
|
|
148
|
-
if (!earlyWriterActive)
|
|
149
|
-
return;
|
|
150
|
-
writeEarlyCrashFile("unhandledRejection", {
|
|
151
|
-
message: reason instanceof Error ? reason.message : String(reason),
|
|
152
|
-
stack: reason instanceof Error ? reason.stack : undefined,
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
let installId = "unknown";
|
|
157
|
-
let appVersion = "0.0.0";
|
|
158
|
-
let crashDir = null;
|
|
159
|
-
let crashReportsDirPath = null;
|
|
160
|
-
let pendingDir = null;
|
|
161
|
-
let bootStage = "init";
|
|
162
|
-
const bootTimeline = [];
|
|
163
|
-
/** Étape de démarrage courante — jointe aux rapports pour situer le crash. */
|
|
164
|
-
function setBootStage(stage) {
|
|
165
|
-
bootStage = stage;
|
|
166
|
-
bootTimeline.push({ at: new Date().toISOString(), stage });
|
|
167
|
-
if (bootTimeline.length > 100)
|
|
168
|
-
bootTimeline.shift();
|
|
169
|
-
try {
|
|
170
|
-
(0, logger_js_1.log)("boot", `stage=${stage}`);
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
/* best-effort */
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function getBootStage() {
|
|
177
|
-
return bootStage;
|
|
178
|
-
}
|
|
179
|
-
function getBootTimeline() {
|
|
180
|
-
return bootTimeline.slice();
|
|
181
|
-
}
|
|
182
|
-
/** Dossier des JSON crash (userData/crash-reports). */
|
|
183
|
-
function crashReportsDir() {
|
|
184
|
-
return crashReportsDirPath;
|
|
185
|
-
}
|
|
186
|
-
/** Chemin journal texte principal (logger). */
|
|
187
|
-
function crashLogHint() {
|
|
188
|
-
return ((0, logger_js_1.logFilePath)() ||
|
|
189
|
-
crashReportsDirPath ||
|
|
190
|
-
crashDir ||
|
|
191
|
-
node_path_1.default.join(node_os_1.default.tmpdir(), "creezio-crash"));
|
|
192
|
-
}
|
|
193
|
-
function initCrashReporter(userDataDir, version) {
|
|
194
|
-
appVersion = version;
|
|
195
|
-
// Le reporter complet prend le relais — l'early writer se tait.
|
|
196
|
-
earlyWriterActive = false;
|
|
197
|
-
try {
|
|
198
|
-
crashDir = node_path_1.default.join(userDataDir, "logs");
|
|
199
|
-
crashReportsDirPath = node_path_1.default.join(userDataDir, "crash-reports");
|
|
200
|
-
pendingDir = node_path_1.default.join(crashReportsDirPath, "pending");
|
|
201
|
-
node_fs_1.default.mkdirSync(crashDir, { recursive: true });
|
|
202
|
-
node_fs_1.default.mkdirSync(crashReportsDirPath, { recursive: true });
|
|
203
|
-
node_fs_1.default.mkdirSync(pendingDir, { recursive: true });
|
|
204
|
-
const idFile = node_path_1.default.join(userDataDir, "install-id");
|
|
205
|
-
try {
|
|
206
|
-
installId = node_fs_1.default.readFileSync(idFile, "utf8").trim();
|
|
207
|
-
if (!installId)
|
|
208
|
-
throw new Error("vide");
|
|
209
|
-
}
|
|
210
|
-
catch {
|
|
211
|
-
installId = node_crypto_1.default.randomUUID();
|
|
212
|
-
try {
|
|
213
|
-
node_fs_1.default.writeFileSync(idFile, installId);
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
/* best-effort */
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
// Flush différé des rapports hors-ligne précédents.
|
|
220
|
-
setTimeout(() => {
|
|
221
|
-
void flushPendingCrashReports();
|
|
222
|
-
}, 2_000);
|
|
223
|
-
}
|
|
224
|
-
catch {
|
|
225
|
-
crashDir = null;
|
|
226
|
-
crashReportsDirPath = null;
|
|
227
|
-
pendingDir = null;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
/** Endpoint + identifiants exposés (injectés au serveur Next par server-launcher). */
|
|
231
|
-
function crashEndpoint() {
|
|
232
|
-
return resolveCrashEndpoint();
|
|
233
|
-
}
|
|
234
|
-
function getInstallId() {
|
|
235
|
-
return installId;
|
|
236
|
-
}
|
|
237
|
-
function writeLocalReport(report, kind, timestamp) {
|
|
238
|
-
const name = `crash-${timestamp.replace(/[:.]/g, "-")}-${kind}.json`;
|
|
239
|
-
const body = JSON.stringify(report, null, 2);
|
|
240
|
-
for (const dir of [crashReportsDirPath, crashDir]) {
|
|
241
|
-
if (!dir)
|
|
242
|
-
continue;
|
|
243
|
-
try {
|
|
244
|
-
node_fs_1.default.writeFileSync(node_path_1.default.join(dir, name), body);
|
|
245
|
-
}
|
|
246
|
-
catch {
|
|
247
|
-
/* best-effort */
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
function enqueuePending(report) {
|
|
252
|
-
if (!pendingDir)
|
|
253
|
-
return;
|
|
254
|
-
try {
|
|
255
|
-
const name = `pending-${Date.now()}-${node_crypto_1.default.randomBytes(4).toString("hex")}.json`;
|
|
256
|
-
node_fs_1.default.writeFileSync(node_path_1.default.join(pendingDir, name), JSON.stringify(report));
|
|
257
|
-
}
|
|
258
|
-
catch {
|
|
259
|
-
/* best-effort */
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Enregistre un rapport localement puis l'envoie au collecteur.
|
|
264
|
-
* Ne throw jamais.
|
|
265
|
-
*
|
|
266
|
-
* `boot-failure` : ring élargi + queue fichier + timeline des stages splash
|
|
267
|
-
* (sinon un npm install n8n noie les 120 dernières lignes utiles).
|
|
268
|
-
*/
|
|
269
|
-
function reportCrash(kind, detail) {
|
|
270
|
-
const isBootFail = kind === "boot-failure";
|
|
271
|
-
const timestamp = new Date().toISOString();
|
|
272
|
-
const report = {
|
|
273
|
-
kind,
|
|
274
|
-
brandId: config.brandId || null,
|
|
275
|
-
installId,
|
|
276
|
-
appVersion,
|
|
277
|
-
bootStage,
|
|
278
|
-
platform: process.platform,
|
|
279
|
-
arch: process.arch,
|
|
280
|
-
osRelease: node_os_1.default.release(),
|
|
281
|
-
electron: process.versions.electron,
|
|
282
|
-
timestamp,
|
|
283
|
-
detail,
|
|
284
|
-
bootTimeline: getBootTimeline(),
|
|
285
|
-
recentLog: (0, logger_js_1.recentLines)(isBootFail ? 800 : 120),
|
|
286
|
-
localPaths: {
|
|
287
|
-
crashReports: crashReportsDirPath,
|
|
288
|
-
logs: crashDir,
|
|
289
|
-
logFile: (0, logger_js_1.logFilePath)(),
|
|
290
|
-
},
|
|
291
|
-
};
|
|
292
|
-
if (isBootFail) {
|
|
293
|
-
const tail = (0, logger_js_1.logFileTail)(150_000);
|
|
294
|
-
if (tail != null)
|
|
295
|
-
report.logFileTail = tail;
|
|
296
|
-
}
|
|
297
|
-
writeLocalReport(report, kind, timestamp);
|
|
298
|
-
try {
|
|
299
|
-
(0, logger_js_1.log)("crash", `${kind} @ ${bootStage}: ${JSON.stringify(detail).slice(0, 500)} → ${crashLogHint()}`);
|
|
300
|
-
}
|
|
301
|
-
catch {
|
|
302
|
-
/* best-effort */
|
|
303
|
-
}
|
|
304
|
-
void sendReport(report).then((ok) => {
|
|
305
|
-
if (!ok && isUploadEnabled())
|
|
306
|
-
enqueuePending(report);
|
|
307
|
-
});
|
|
308
|
-
if (config.sendFleetCrash) {
|
|
309
|
-
void Promise.resolve(config.sendFleetCrash(report)).catch(() => {
|
|
310
|
-
/* best-effort */
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
if (kind !== "ops-anomaly") {
|
|
314
|
-
void Promise.resolve().then(() => __importStar(require("@creezio/observability"))).then((m) => m.trackCrashMirror(kind, detail))
|
|
315
|
-
.catch(() => {
|
|
316
|
-
/* best-effort */
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Variante anti-spam : au plus un rapport par `key` toutes les `intervalMs`
|
|
322
|
-
* (5 min par défaut). Les occurrences suivantes restent dans le log local.
|
|
323
|
-
*/
|
|
324
|
-
const lastReportByKey = new Map();
|
|
325
|
-
function reportCrashDebounced(kind, key, detail, intervalMs = 5 * 60_000) {
|
|
326
|
-
const now = Date.now();
|
|
327
|
-
const last = lastReportByKey.get(key) || 0;
|
|
328
|
-
if (now - last < intervalMs) {
|
|
329
|
-
try {
|
|
330
|
-
(0, logger_js_1.log)("crash", `(débounce ${key}) ${kind}: ${JSON.stringify(detail).slice(0, 300)}`);
|
|
331
|
-
}
|
|
332
|
-
catch {
|
|
333
|
-
/* best-effort */
|
|
334
|
-
}
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
lastReportByKey.set(key, now);
|
|
338
|
-
reportCrash(kind, detail);
|
|
339
|
-
}
|
|
340
|
-
async function postReport(report) {
|
|
341
|
-
if (!isUploadEnabled())
|
|
342
|
-
return false;
|
|
343
|
-
try {
|
|
344
|
-
const res = await fetch(resolveCrashEndpoint(), {
|
|
345
|
-
method: "POST",
|
|
346
|
-
headers: { "Content-Type": "application/json" },
|
|
347
|
-
body: JSON.stringify(report),
|
|
348
|
-
signal: AbortSignal.timeout(8_000),
|
|
349
|
-
});
|
|
350
|
-
return res.ok || res.status === 204;
|
|
351
|
-
}
|
|
352
|
-
catch {
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
async function sendReport(report) {
|
|
357
|
-
const ok = await postReport(report);
|
|
358
|
-
if (ok) {
|
|
359
|
-
try {
|
|
360
|
-
(0, logger_js_1.log)("crash", `upload OK → ${resolveCrashEndpoint().replace(/\/[^/]+$/, "/***")} `);
|
|
361
|
-
}
|
|
362
|
-
catch {
|
|
363
|
-
/* ignore */
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
return ok;
|
|
367
|
-
}
|
|
368
|
-
/** Renvoie les rapports pending (hors-ligne) — best-effort. */
|
|
369
|
-
async function flushPendingCrashReports() {
|
|
370
|
-
if (!pendingDir || !isUploadEnabled())
|
|
371
|
-
return 0;
|
|
372
|
-
let sent = 0;
|
|
373
|
-
try {
|
|
374
|
-
const files = node_fs_1.default.readdirSync(pendingDir).filter((f) => f.endsWith(".json"));
|
|
375
|
-
for (const f of files.slice(0, 40)) {
|
|
376
|
-
const full = node_path_1.default.join(pendingDir, f);
|
|
377
|
-
try {
|
|
378
|
-
const report = JSON.parse(node_fs_1.default.readFileSync(full, "utf8"));
|
|
379
|
-
if (await postReport(report)) {
|
|
380
|
-
node_fs_1.default.unlinkSync(full);
|
|
381
|
-
sent += 1;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
catch {
|
|
385
|
-
/* skip corrupt */
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
catch {
|
|
390
|
-
/* best-effort */
|
|
391
|
-
}
|
|
392
|
-
if (sent > 0) {
|
|
393
|
-
try {
|
|
394
|
-
(0, logger_js_1.log)("crash", `flush pending: ${sent} rapport(s) envoyé(s)`);
|
|
395
|
-
}
|
|
396
|
-
catch {
|
|
397
|
-
/* ignore */
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
return sent;
|
|
401
|
-
}
|
|
402
|
-
let globalHandlersInstalled = false;
|
|
403
|
-
/** Handlers globaux du process principal — à installer au tout début (idempotent). */
|
|
404
|
-
function installGlobalHandlers() {
|
|
405
|
-
if (globalHandlersInstalled)
|
|
406
|
-
return;
|
|
407
|
-
globalHandlersInstalled = true;
|
|
408
|
-
process.on("uncaughtException", (e) => {
|
|
409
|
-
reportCrash("uncaughtException", {
|
|
410
|
-
message: e?.message,
|
|
411
|
-
stack: e?.stack,
|
|
412
|
-
});
|
|
413
|
-
// On ne quitte PAS : beaucoup d'exceptions (ex. réseau) sont récupérables.
|
|
414
|
-
});
|
|
415
|
-
process.on("unhandledRejection", (reason) => {
|
|
416
|
-
reportCrash("unhandledRejection", {
|
|
417
|
-
message: reason instanceof Error ? reason.message : String(reason),
|
|
418
|
-
stack: reason instanceof Error ? reason.stack : undefined,
|
|
419
|
-
});
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
//# sourceMappingURL=crash-reporter.js.map
|