@lsamien/yaoyao 0.4.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +6 -0
- package/README.md +103 -0
- package/THIRD_PARTY_NOTICES.md +16 -0
- package/bin/desktop-service-sync.mjs +43 -0
- package/bin/hermes-yaoyao-updater.mjs +315 -0
- package/bin/hermes-yaoyao.mjs +246 -0
- package/bin/lib/data-home.d.mts +4 -0
- package/bin/lib/data-home.mjs +24 -0
- package/bin/lib/data-migration.d.mts +2 -0
- package/bin/lib/data-migration.mjs +107 -0
- package/bin/lib/desktop-activation.d.mts +4 -0
- package/bin/lib/desktop-activation.mjs +18 -0
- package/bin/lib/managed-data-migration.mjs +45 -0
- package/bin/lib/release-source.d.mts +2 -0
- package/bin/lib/release-source.mjs +23 -0
- package/bin/lib/runtime-release.mjs +78 -0
- package/bin/lib/service-data.mjs +57 -0
- package/bin/lib/service-update.mjs +372 -0
- package/bin/migrate-data-home.mjs +20 -0
- package/build-info.json +657 -0
- package/desktop/main.mjs +679 -0
- package/dist/assets/AboutDialog-BvuJp8Pe.js +2 -0
- package/dist/assets/AboutDialog-BvuJp8Pe.js.map +1 -0
- package/dist/assets/AboutDialog-DC5YWX39.css +1 -0
- package/dist/assets/BotAutomationsView-Ddgs5Hes.js +2 -0
- package/dist/assets/BotAutomationsView-Ddgs5Hes.js.map +1 -0
- package/dist/assets/BotAutomationsView-DeJ-e3y5.css +1 -0
- package/dist/assets/BotPluginsDialog-Db5dTqvg.css +1 -0
- package/dist/assets/BotPluginsDialog-xPqUSyHS.js +2 -0
- package/dist/assets/BotPluginsDialog-xPqUSyHS.js.map +1 -0
- package/dist/assets/BotSettingsDialog-BkjoAZtf.css +1 -0
- package/dist/assets/BotSettingsDialog-wLz_KGzX.js +5 -0
- package/dist/assets/BotSettingsDialog-wLz_KGzX.js.map +1 -0
- package/dist/assets/ChatView-DRPu2nKr.js +2 -0
- package/dist/assets/ChatView-DRPu2nKr.js.map +1 -0
- package/dist/assets/ChatView-Dx8YlcPr.css +1 -0
- package/dist/assets/ChevronForwardOutline-D--GIQK6.js +2 -0
- package/dist/assets/ChevronForwardOutline-D--GIQK6.js.map +1 -0
- package/dist/assets/ComputerPanel-Byr2_yKj.js +2 -0
- package/dist/assets/ComputerPanel-Byr2_yKj.js.map +1 -0
- package/dist/assets/ComputerPanel-CQOv4v8E.css +1 -0
- package/dist/assets/ComputerViewerView-BBAs4bzi.css +1 -0
- package/dist/assets/ComputerViewerView-DJ6hB-5e.js +2 -0
- package/dist/assets/ComputerViewerView-DJ6hB-5e.js.map +1 -0
- package/dist/assets/ConversationsView-C_VZl5g2.css +1 -0
- package/dist/assets/ConversationsView-cu1Yrq68.js +6 -0
- package/dist/assets/ConversationsView-cu1Yrq68.js.map +1 -0
- package/dist/assets/FilesView-DAIzo9Ps.css +1 -0
- package/dist/assets/FilesView-h9oJFmZt.js +2 -0
- package/dist/assets/FilesView-h9oJFmZt.js.map +1 -0
- package/dist/assets/FloatingResourceSearch-BF2XOLd-.css +1 -0
- package/dist/assets/FloatingResourceSearch-TofG1_DV.js +9 -0
- package/dist/assets/FloatingResourceSearch-TofG1_DV.js.map +1 -0
- package/dist/assets/HistoryView-Bh0SU969.js +2 -0
- package/dist/assets/HistoryView-Bh0SU969.js.map +1 -0
- package/dist/assets/HistoryView-DvuCAjlo.css +1 -0
- package/dist/assets/KanbanView-B-2vG4w7.css +1 -0
- package/dist/assets/KanbanView-CcqMOzB7.js +2 -0
- package/dist/assets/KanbanView-CcqMOzB7.js.map +1 -0
- package/dist/assets/LocalVmSettingsPanel-C8PIgMr3.js +2 -0
- package/dist/assets/LocalVmSettingsPanel-C8PIgMr3.js.map +1 -0
- package/dist/assets/LocalVmSettingsPanel-Dedfhqlq.css +1 -0
- package/dist/assets/RunnerSettingsPanel-CfxxQKpV.css +1 -0
- package/dist/assets/RunnerSettingsPanel-CvNnWcdH.js +4 -0
- package/dist/assets/RunnerSettingsPanel-CvNnWcdH.js.map +1 -0
- package/dist/assets/StandaloneDialog-BbNWY6IJ.js +2 -0
- package/dist/assets/StandaloneDialog-BbNWY6IJ.js.map +1 -0
- package/dist/assets/StandaloneDialog-Bg5U9bMJ.css +1 -0
- package/dist/assets/UpdateCheckDialog-C357uDSE.js +2 -0
- package/dist/assets/UpdateCheckDialog-C357uDSE.js.map +1 -0
- package/dist/assets/UpdateCheckDialog-CRlyWnE7.css +1 -0
- package/dist/assets/WorkspaceKnowledgePanel-B6xMyHdp.css +1 -0
- package/dist/assets/WorkspaceKnowledgePanel-CE7qsu2i.js +2 -0
- package/dist/assets/WorkspaceKnowledgePanel-CE7qsu2i.js.map +1 -0
- package/dist/assets/WorkspaceRoutinesPanel-CLsHmBuH.css +1 -0
- package/dist/assets/WorkspaceRoutinesPanel-DybBh6PZ.js +2 -0
- package/dist/assets/WorkspaceRoutinesPanel-DybBh6PZ.js.map +1 -0
- package/dist/assets/WorkspaceShell-7wn8iTne.css +1 -0
- package/dist/assets/WorkspaceShell-kp1ObJTk.js +44 -0
- package/dist/assets/WorkspaceShell-kp1ObJTk.js.map +1 -0
- package/dist/assets/WorkspaceView-CtNI0_AO.js +2 -0
- package/dist/assets/WorkspaceView-CtNI0_AO.js.map +1 -0
- package/dist/assets/_plugin-vue_export-helper-CscYwSBt.js +3 -0
- package/dist/assets/_plugin-vue_export-helper-CscYwSBt.js.map +1 -0
- package/dist/assets/browser-B97PQaMt.js +11 -0
- package/dist/assets/browser-B97PQaMt.js.map +1 -0
- package/dist/assets/docx-preview-YvkiVUyQ.js +22 -0
- package/dist/assets/docx-preview-YvkiVUyQ.js.map +1 -0
- package/dist/assets/index-GQxxBKs2.js +17 -0
- package/dist/assets/index-GQxxBKs2.js.map +1 -0
- package/dist/assets/index-g5POnMkp.css +1 -0
- package/dist/assets/localVm-owThjmhy.js +2 -0
- package/dist/assets/localVm-owThjmhy.js.map +1 -0
- package/dist/assets/pdf-pqGpzpl1.js +55 -0
- package/dist/assets/pdf-pqGpzpl1.js.map +1 -0
- package/dist/assets/pdf.worker.min-iDqQPrd3.mjs +31 -0
- package/dist/assets/sessionOwnership-BTz0Fyp5.css +1 -0
- package/dist/assets/sessionOwnership-bedp16q1.js +6 -0
- package/dist/assets/sessionOwnership-bedp16q1.js.map +1 -0
- package/dist/assets/viewModels-BYFb-v4u.js +38 -0
- package/dist/assets/viewModels-BYFb-v4u.js.map +1 -0
- package/dist/assets/viewModels-CkZuSvKm.css +1 -0
- package/dist/brand/AppIcon-1024.png +0 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/favicon-32.png +0 -0
- package/dist/icons/icon-192.png +0 -0
- package/dist/icons/icon-512.png +0 -0
- package/dist/icons/logo-64.png +0 -0
- package/dist/index.html +19 -0
- package/dist/manifest.webmanifest +21 -0
- package/dist/setting-previews/dark.png +0 -0
- package/dist/setting-previews/light.png +0 -0
- package/dist/setting-previews/system.png +0 -0
- package/dist-server/runner/agent.js +563 -0
- package/dist-server/runner/browser/installation.js +180 -0
- package/dist-server/runner/browser/publicProxy.js +157 -0
- package/dist-server/runner/browser/runtime.js +622 -0
- package/dist-server/runner/browser/types.js +8 -0
- package/dist-server/runner/computers/commandProcess.js +127 -0
- package/dist-server/runner/computers/compose.js +139 -0
- package/dist-server/runner/computers/computer-image/Dockerfile +101 -0
- package/dist-server/runner/computers/computer-image/Dockerfile.cursor +27 -0
- package/dist-server/runner/computers/computer-image/Dockerfile.network +9 -0
- package/dist-server/runner/computers/computer-image/compose_bridge.py +329 -0
- package/dist-server/runner/computers/computer-image/cursor-browser.sh +6 -0
- package/dist-server/runner/computers/computer-image/cursor-desktop.py +86 -0
- package/dist-server/runner/computers/computer-image/network_gateway.py +197 -0
- package/dist-server/runner/computers/computer-image/prepare-firefox.sh +11 -0
- package/dist-server/runner/computers/computer-image/skill_bundle.py +111 -0
- package/dist-server/runner/computers/computerFailures.js +30 -0
- package/dist-server/runner/computers/container.js +652 -0
- package/dist-server/runner/computers/dataSnapshot.js +62 -0
- package/dist-server/runner/computers/desktopClose.js +41 -0
- package/dist-server/runner/computers/imageCli.js +42 -0
- package/dist-server/runner/computers/imageManagement.js +321 -0
- package/dist-server/runner/computers/images.js +130 -0
- package/dist-server/runner/computers/localVm.js +270 -0
- package/dist-server/runner/computers/maintenance.js +96 -0
- package/dist-server/runner/computers/maintenanceCli.js +59 -0
- package/dist-server/runner/computers/migrateUserData.js +62 -0
- package/dist-server/runner/computers/pool.js +407 -0
- package/dist-server/runner/computers/third-party/openmausbot/LICENSE +202 -0
- package/dist-server/runner/computers/third-party/openmausbot/NOTICE +4 -0
- package/dist-server/runner/computers/userData.js +128 -0
- package/dist-server/runner/computers/workspaceRecovery.js +120 -0
- package/dist-server/runner/config.js +37 -0
- package/dist-server/runner/hermes-bots-bridge/README.md +102 -0
- package/dist-server/runner/hermes-bots-bridge/__init__.py +59 -0
- package/dist-server/runner/hermes-bots-bridge/bootstrap.py +31 -0
- package/dist-server/runner/hermes-bots-bridge/bridge_runtime.py +1179 -0
- package/dist-server/runner/hermes-bots-bridge/dashboard/bridge.js +2 -0
- package/dist-server/runner/hermes-bots-bridge/dashboard/manifest.json +9 -0
- package/dist-server/runner/hermes-bots-bridge/dashboard/plugin_api.py +132 -0
- package/dist-server/runner/hermes-bots-bridge/file_transfer.py +146 -0
- package/dist-server/runner/hermes-bots-bridge/model_settings.py +136 -0
- package/dist-server/runner/hermes-bots-bridge/plugin.yaml +4 -0
- package/dist-server/runner/hermes-bots-bridge/profile_runtime_repair.py +77 -0
- package/dist-server/runner/index.js +75 -0
- package/dist-server/runner/install-hermes-bridge.py +192 -0
- package/dist-server/runner/managedBrowser.js +266 -0
- package/dist-server/runner/network/computerProxy.js +117 -0
- package/dist-server/runner/network/managedProxy.js +96 -0
- package/dist-server/runner/network/publicDestination.js +47 -0
- package/dist-server/runner/network/socketBroker.js +131 -0
- package/dist-server/runner/network/upstreamProxy.js +118 -0
- package/dist-server/runner/worker/control.js +212 -0
- package/dist-server/runner/worker/fileTransfer.js +9 -0
- package/dist-server/runner/worker/gateway.js +1009 -0
- package/dist-server/runner/worker/guest_proxy.py +116 -0
- package/dist-server/runner/worker/hermes_worker.py +310 -0
- package/dist-server/runner/worker/hostTools.js +115 -0
- package/dist-server/runner/worker/process.js +123 -0
- package/dist-server/runner/worker/profileSession.js +144 -0
- package/dist-server/runner/worker/profile_skills.py +361 -0
- package/dist-server/runner/worker/skill_bundle.py +111 -0
- package/dist-server/runner/worker/skills.js +119 -0
- package/dist-server/runner/worker/taskEnvironment.js +35 -0
- package/dist-server/server/accountPairing.js +72 -0
- package/dist-server/server/allowedHostsConfiguration.js +170 -0
- package/dist-server/server/apns.js +261 -0
- package/dist-server/server/apnsConfiguration.js +298 -0
- package/dist-server/server/app.js +639 -0
- package/dist-server/server/botModelSettings.js +60 -0
- package/dist-server/server/botPlugins/connectedApps.js +213 -0
- package/dist-server/server/botPlugins/httpMcp.js +117 -0
- package/dist-server/server/botPlugins/stdioMcp.js +263 -0
- package/dist-server/server/botPlugins/workspacePlugins.js +353 -0
- package/dist-server/server/browserFiles.js +79 -0
- package/dist-server/server/buildIdentity.js +18 -0
- package/dist-server/server/chatCache.js +1651 -0
- package/dist-server/server/chatEventProjection.js +70 -0
- package/dist-server/server/chatTranscriptApi.js +145 -0
- package/dist-server/server/chatTranscriptStore.js +1021 -0
- package/dist-server/server/chatUnread.js +34 -0
- package/dist-server/server/codexAuthorization.js +149 -0
- package/dist-server/server/composeDesktops.js +69 -0
- package/dist-server/server/computerControls.js +122 -0
- package/dist-server/server/computerNames.js +41 -0
- package/dist-server/server/config.js +176 -0
- package/dist-server/server/dashboardController.js +120 -0
- package/dist-server/server/dashboardSupervisor.js +176 -0
- package/dist-server/server/desktopActivation.js +26 -0
- package/dist-server/server/desktopEnvironments.js +600 -0
- package/dist-server/server/desktopHostProtocol.js +17 -0
- package/dist-server/server/desktopHosts.js +117 -0
- package/dist-server/server/errors.js +12 -0
- package/dist-server/server/executionSettings.js +171 -0
- package/dist-server/server/fcm.js +247 -0
- package/dist-server/server/fcmConfiguration.js +270 -0
- package/dist-server/server/fileAccess.js +103 -0
- package/dist-server/server/fileTransfer.js +98 -0
- package/dist-server/server/githubReleases.js +73 -0
- package/dist-server/server/grokAuth.js +333 -0
- package/dist-server/server/grokCloud.js +458 -0
- package/dist-server/server/hermesBotRelay.js +117 -0
- package/dist-server/server/hermesBridge.js +245 -0
- package/dist-server/server/hostToolSettings.js +60 -0
- package/dist-server/server/imageManagement.js +55 -0
- package/dist-server/server/index.js +132 -0
- package/dist-server/server/leases.js +69 -0
- package/dist-server/server/localAuth.js +737 -0
- package/dist-server/server/localVm.js +358 -0
- package/dist-server/server/loopbackAuthorization.js +58 -0
- package/dist-server/server/managedBrowserTools.js +16 -0
- package/dist-server/server/managedBrowsers.js +735 -0
- package/dist-server/server/notificationText.js +125 -0
- package/dist-server/server/openVikingConfiguration.js +222 -0
- package/dist-server/server/openVikingMemoryProvider.js +279 -0
- package/dist-server/server/openVikingService.js +177 -0
- package/dist-server/server/openVikingSessionSync.js +286 -0
- package/dist-server/server/pairing.js +342 -0
- package/dist-server/server/profileIdentities.js +103 -0
- package/dist-server/server/pushCoordinator.js +1422 -0
- package/dist-server/server/pushEventAdapter.js +31 -0
- package/dist-server/server/pushEvents.js +1218 -0
- package/dist-server/server/realtimeApi.js +330 -0
- package/dist-server/server/realtimeBroker.js +835 -0
- package/dist-server/server/realtimeProtocol.js +353 -0
- package/dist-server/server/realtimeReceipts.js +60 -0
- package/dist-server/server/releases.js +46 -0
- package/dist-server/server/routes.js +2156 -0
- package/dist-server/server/runnerHub.js +687 -0
- package/dist-server/server/security.js +196 -0
- package/dist-server/server/serverIdentity.js +31 -0
- package/dist-server/server/serviceInstance.js +178 -0
- package/dist-server/server/sessionWorkingDirectory.js +39 -0
- package/dist-server/server/sharedComputers.js +221 -0
- package/dist-server/server/subaccountAccess.js +28 -0
- package/dist-server/server/taskCoordinator.js +580 -0
- package/dist-server/server/toolOperationJournal.js +81 -0
- package/dist-server/server/updateManager.js +340 -0
- package/dist-server/server/uploads.js +265 -0
- package/dist-server/server/upstream.js +375 -0
- package/dist-server/server/upstreamReadCache.js +133 -0
- package/dist-server/server/vmComputer.js +96 -0
- package/dist-server/server/websocket.js +753 -0
- package/dist-server/server/workspaceAssets.js +192 -0
- package/dist-server/server/workspaceCollaboration.js +224 -0
- package/dist-server/server/workspaceDiscussion.js +23 -0
- package/dist-server/server/workspaceEnvironment.js +43 -0
- package/dist-server/server/workspaceGateway.js +509 -0
- package/dist-server/server/workspaceInspector.js +47 -0
- package/dist-server/server/workspaceKnowledge.js +557 -0
- package/dist-server/server/workspaceKnowledgeRoutes.js +78 -0
- package/dist-server/server/workspaceKnowledgeTools.js +105 -0
- package/dist-server/server/workspaceMemoryContext.js +34 -0
- package/dist-server/server/workspaceMemorySynthesis.js +201 -0
- package/dist-server/server/workspaceMentions.js +31 -0
- package/dist-server/server/workspacePairedNode.js +166 -0
- package/dist-server/server/workspacePrompt.js +93 -0
- package/dist-server/server/workspaceRelay.js +90 -0
- package/dist-server/server/workspaceRemoteAgents.js +191 -0
- package/dist-server/server/workspaceRoutes.js +703 -0
- package/dist-server/server/workspaceRoutineTools.js +109 -0
- package/dist-server/server/workspaceRoutines.js +163 -0
- package/dist-server/server/workspaceRuntime.js +1363 -0
- package/dist-server/server/workspaceScheduler.js +592 -0
- package/dist-server/server/workspaceStore.js +1220 -0
- package/dist-server/server/workspaceSync.js +129 -0
- package/dist-server/server/workspaceTeamTools.js +312 -0
- package/dist-server/server/workspaceToolLease.js +280 -0
- package/dist-server/shared/agentIdentity.js +90 -0
- package/dist-server/shared/agentTasks.js +1 -0
- package/dist-server/shared/botEnvironment.js +28 -0
- package/dist-server/shared/botModelSettings.js +3 -0
- package/dist-server/shared/chatTools.js +32 -0
- package/dist-server/shared/chatTranscript.js +50 -0
- package/dist-server/shared/composeDesktops.js +1 -0
- package/dist-server/shared/computerControl.js +1 -0
- package/dist-server/shared/desktopEnvironment.js +1 -0
- package/dist-server/shared/desktopHost.js +1 -0
- package/dist-server/shared/executionEnvironment.js +1 -0
- package/dist-server/shared/fileTransfer.js +5 -0
- package/dist-server/shared/fileTransferEndpoint.mjs +133 -0
- package/dist-server/shared/grokAuth.js +1 -0
- package/dist-server/shared/hermesBridge.js +1 -0
- package/dist-server/shared/hostPaths.mjs +22 -0
- package/dist-server/shared/imageManagement.js +1 -0
- package/dist-server/shared/index.js +1 -0
- package/dist-server/shared/localVm.js +9 -0
- package/dist-server/shared/managedBrowser.js +1 -0
- package/dist-server/shared/messageFiles.js +90 -0
- package/dist-server/shared/openVikingSync.js +1 -0
- package/dist-server/shared/runner.js +2 -0
- package/dist-server/shared/serverFiles.js +55 -0
- package/dist-server/shared/serverIdentity.js +1 -0
- package/dist-server/shared/sse.js +47 -0
- package/dist-server/shared/types.js +8 -0
- package/dist-server/shared/workspace.js +61 -0
- package/dist-server/shared/workspaceKnowledge.js +1 -0
- package/dist-server/shared/workspaceLifecycle.js +1 -0
- package/dist-server/shared/workspaceMessagePatch.js +63 -0
- package/dist-server/shared/workspacePanels.js +1 -0
- package/dist-server/shared/workspacePlugins.js +1 -0
- package/licenses/LaoA-GrokBot/LICENSE +21 -0
- package/licenses/OpenMausBot/LICENSE +202 -0
- package/licenses/OpenMausBot/NOTICE +6 -0
- package/package.json +122 -0
- package/release.json +6 -0
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
3
|
+
import { ComputerError } from './container.js';
|
|
4
|
+
import { DEFAULT_VM_IDLE_STOP_MINUTES } from '../../shared/localVm.js';
|
|
5
|
+
/** Durable lifecycle fencing with shared holders. Turns hold the same
|
|
6
|
+
* environment concurrently so sharing a desktop never queues whole turns;
|
|
7
|
+
* starting, stopping and reconfiguring remain exclusive and drain everyone.
|
|
8
|
+
* A holder that fails or cancels only fences itself — the container is
|
|
9
|
+
* stopped once the last holder leaves. */
|
|
10
|
+
export class ComputerPool {
|
|
11
|
+
db;
|
|
12
|
+
provider;
|
|
13
|
+
limits;
|
|
14
|
+
now;
|
|
15
|
+
idleStopMinutes = DEFAULT_VM_IDLE_STOP_MINUTES;
|
|
16
|
+
entries = new Map();
|
|
17
|
+
changing = new Map();
|
|
18
|
+
ready = false;
|
|
19
|
+
closing = false;
|
|
20
|
+
maintenance = false;
|
|
21
|
+
holdMaintenance() { this.maintenance = true; let released = false; return () => { if (!released) {
|
|
22
|
+
released = true;
|
|
23
|
+
this.maintenance = false;
|
|
24
|
+
} }; }
|
|
25
|
+
beginMaintenance({ allowIdle = false } = {}) {
|
|
26
|
+
if (this.maintenance || this.changing.size || this.rows().some(row => row.status !== 'free' && !(allowIdle && row.status === 'idle')))
|
|
27
|
+
throw new ComputerError('computer_busy', allowIdle ? '请先停止正在使用虚拟机的任务并交还控制权,再修改虚拟机设置' : '请先停止电脑任务并交还控制权,再管理镜像');
|
|
28
|
+
return this.holdMaintenance();
|
|
29
|
+
}
|
|
30
|
+
constructor(db, provider, limits = { concurrent: 2, environments: 32, ttlMs: 30000 }, now = Date.now) {
|
|
31
|
+
this.db = db;
|
|
32
|
+
this.provider = provider;
|
|
33
|
+
this.limits = limits;
|
|
34
|
+
this.now = now;
|
|
35
|
+
if (![limits.concurrent, limits.environments, limits.ttlMs].every(Number.isSafeInteger) || limits.concurrent < 1 || limits.concurrent > 8 || limits.environments < limits.concurrent || limits.environments > 128 || limits.ttlMs < 1000 || limits.ttlMs > 120000)
|
|
36
|
+
throw new Error('电脑资源配额无效');
|
|
37
|
+
db.exec('CREATE TABLE IF NOT EXISTS computer_environments(id TEXT PRIMARY KEY,value TEXT NOT NULL)');
|
|
38
|
+
}
|
|
39
|
+
rows() { return [...this.entries.values()]; }
|
|
40
|
+
get(id) { return this.entries.get(id); }
|
|
41
|
+
/** Holders are runtime-only state; the durable row keeps the lifecycle. */
|
|
42
|
+
save(entry) { entry.updatedAt = this.now(); this.db.prepare('INSERT INTO computer_environments VALUES(?,?) ON CONFLICT(id) DO UPDATE SET value=excluded.value').run(entry.spec.id, JSON.stringify({ spec: entry.spec, generation: entry.generation, status: entry.status, expiresAt: entry.expiresAt, updatedAt: entry.updatedAt })); }
|
|
43
|
+
load() {
|
|
44
|
+
const rows = this.db.prepare('SELECT id,value FROM computer_environments').all();
|
|
45
|
+
const entries = rows.map(row => { const parsed = JSON.parse(row.value); return { spec: parsed.spec, generation: parsed.generation, status: parsed.status, holders: new Map(), expiresAt: parsed.expiresAt, updatedAt: parsed.updatedAt }; });
|
|
46
|
+
for (const entry of entries)
|
|
47
|
+
this.entries.set(entry.spec.id, entry);
|
|
48
|
+
return entries;
|
|
49
|
+
}
|
|
50
|
+
serial(id, action) {
|
|
51
|
+
const pending = (this.changing.get(id) ?? Promise.resolve()).catch(() => { }).then(action);
|
|
52
|
+
this.changing.set(id, pending);
|
|
53
|
+
void pending.finally(() => { if (this.changing.get(id) === pending)
|
|
54
|
+
this.changing.delete(id); }).catch(() => { });
|
|
55
|
+
return pending;
|
|
56
|
+
}
|
|
57
|
+
/** Must run under the Runner's OS instance lock before accepting commands. */
|
|
58
|
+
async recover() {
|
|
59
|
+
if (this.ready)
|
|
60
|
+
throw new ComputerError('computer_pool_active', '运行中的资源池不能重新执行启动恢复');
|
|
61
|
+
for (const entry of this.load())
|
|
62
|
+
if (entry.status !== 'free')
|
|
63
|
+
await this.serial(entry.spec.id, () => this.stopEntry(entry)).catch(() => { });
|
|
64
|
+
this.ready = true;
|
|
65
|
+
}
|
|
66
|
+
status(ownerKey) { return this.rows().filter(row => row.spec.ownerKey === ownerKey).map(row => ({ environmentId: row.spec.id, status: row.status, generation: row.generation, holderIds: [...row.holders.values()].map(active => active.lease.holderId), expiresAt: row.expiresAt })); }
|
|
67
|
+
hasHolders(ownerKey, environmentId) { const entry = this.get(environmentId); return !!entry && entry.spec.ownerKey === ownerKey && entry.status === 'active' && entry.holders.size > 0; }
|
|
68
|
+
require(lease, activeOnly = true) {
|
|
69
|
+
const entry = this.get(lease.environmentId), active = entry?.holders.get(lease.id);
|
|
70
|
+
if (!entry || entry.spec.ownerKey !== lease.ownerKey || !active || active.lease.holderId !== lease.holderId || active.lease.generation !== lease.generation || entry.generation !== lease.generation || (activeOnly && entry.status !== 'active'))
|
|
71
|
+
throw new ComputerError('computer_lease_stale', '电脑控制权已改变,旧操作不能继续');
|
|
72
|
+
return entry;
|
|
73
|
+
}
|
|
74
|
+
assert(lease) {
|
|
75
|
+
const entry = this.require(lease), active = entry.holders.get(lease.id);
|
|
76
|
+
if (this.closing || entry.expiresAt <= this.now())
|
|
77
|
+
throw new ComputerError('computer_lease_expired', '电脑控制授权已到期');
|
|
78
|
+
active.authorize();
|
|
79
|
+
}
|
|
80
|
+
async acquire(spec, holderId, authorize, signal) {
|
|
81
|
+
spec = this.provider.validateSpecification(spec);
|
|
82
|
+
if (!holderId || holderId.length > 256)
|
|
83
|
+
throw new ComputerError('computer_holder_invalid', '电脑任务身份无效');
|
|
84
|
+
return this.serial(spec.id, async () => {
|
|
85
|
+
authorize();
|
|
86
|
+
if (signal?.aborted)
|
|
87
|
+
throw new ComputerError('computer_cancelled', '操作已停止');
|
|
88
|
+
if (this.maintenance)
|
|
89
|
+
throw new ComputerError('computer_busy', '执行节点正在管理镜像,请稍后重试');
|
|
90
|
+
if (!this.ready || this.closing)
|
|
91
|
+
throw new ComputerError('computer_pool_unavailable', '电脑资源正在恢复或关闭');
|
|
92
|
+
let entry = this.get(spec.id);
|
|
93
|
+
if (entry && (entry.spec.ownerKey !== spec.ownerKey || JSON.stringify(entry.spec) !== JSON.stringify(spec)))
|
|
94
|
+
throw new ComputerError('computer_owner_mismatch', '电脑环境归属或配置不匹配');
|
|
95
|
+
const own = entry && entry.status === 'active' ? [...entry.holders.values()].find(active => active.lease.holderId === holderId) : undefined;
|
|
96
|
+
if (own) {
|
|
97
|
+
this.assert(own.lease);
|
|
98
|
+
return own.lease;
|
|
99
|
+
}
|
|
100
|
+
// An active environment is shared: a new holder joins it without
|
|
101
|
+
// touching the container or the concurrency quota.
|
|
102
|
+
const joining = entry?.status === 'active';
|
|
103
|
+
if (!joining && entry && entry.status !== 'free' && entry.status !== 'idle')
|
|
104
|
+
throw new ComputerError('computer_busy', '电脑正在使用或需要核对停止状态');
|
|
105
|
+
const rows = this.rows();
|
|
106
|
+
if ((!entry && rows.length >= this.limits.environments) || (!joining && rows.filter(row => row.status !== 'free' && row.spec.id !== spec.id).length >= this.limits.concurrent))
|
|
107
|
+
throw new ComputerError('computer_quota', '本地虚拟机数量已达上限,请先停止另一台桌面');
|
|
108
|
+
const lease = { id: randomUUID(), environmentId: spec.id, ownerKey: spec.ownerKey, holderId, generation: joining ? entry.generation : (entry?.generation ?? 0) + 1 };
|
|
109
|
+
if (!joining) {
|
|
110
|
+
entry = { spec: structuredClone(spec), generation: lease.generation, status: 'preparing', holders: new Map(), expiresAt: this.now() + this.limits.ttlMs, updatedAt: this.now() };
|
|
111
|
+
this.entries.set(spec.id, entry);
|
|
112
|
+
}
|
|
113
|
+
const holder = entry;
|
|
114
|
+
// This reservation is synchronous, before any provider await or next acquire.
|
|
115
|
+
const abort = () => {
|
|
116
|
+
const current = this.get(spec.id);
|
|
117
|
+
if (!current?.holders.has(lease.id))
|
|
118
|
+
return;
|
|
119
|
+
this.removeHolder(current, lease.id);
|
|
120
|
+
if (current.holders.size) {
|
|
121
|
+
this.save(current);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
this.invalidate(current);
|
|
125
|
+
void this.serial(spec.id, () => this.stopEntry(current)).catch(() => { });
|
|
126
|
+
};
|
|
127
|
+
const active = { lease, authorize, controller: new AbortController(), operations: new Set(), detach: () => signal?.removeEventListener('abort', abort) };
|
|
128
|
+
holder.holders.set(lease.id, active);
|
|
129
|
+
holder.expiresAt = Math.max(holder.expiresAt, this.now() + this.limits.ttlMs);
|
|
130
|
+
this.save(holder);
|
|
131
|
+
signal?.addEventListener('abort', abort, { once: true });
|
|
132
|
+
if (signal?.aborted)
|
|
133
|
+
abort();
|
|
134
|
+
if (joining) {
|
|
135
|
+
this.assert(lease);
|
|
136
|
+
return lease;
|
|
137
|
+
}
|
|
138
|
+
const guard = () => { const current = this.require(lease, false); if (this.closing || active.controller.signal.aborted || current.status !== 'preparing' || current.expiresAt <= this.now())
|
|
139
|
+
throw new ComputerError('computer_lease_expired', '电脑启动授权已失效'); authorize(); };
|
|
140
|
+
try {
|
|
141
|
+
await this.provider.ensure(spec, guard);
|
|
142
|
+
guard();
|
|
143
|
+
holder.status = 'active';
|
|
144
|
+
this.save(holder);
|
|
145
|
+
return lease;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
this.removeHolder(holder, lease.id);
|
|
149
|
+
await this.stopEntry(holder).catch(() => { });
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
async configure(spec, authorize) {
|
|
155
|
+
spec = this.provider.validateSpecification(spec);
|
|
156
|
+
return this.serial(spec.id, async () => {
|
|
157
|
+
authorize();
|
|
158
|
+
if (this.maintenance)
|
|
159
|
+
throw new ComputerError('computer_busy', '执行节点正在管理镜像,请稍后重试');
|
|
160
|
+
if (!this.ready || this.closing)
|
|
161
|
+
throw new ComputerError('computer_pool_unavailable', '电脑资源正在恢复或关闭');
|
|
162
|
+
const entry = this.get(spec.id);
|
|
163
|
+
if (!entry)
|
|
164
|
+
return;
|
|
165
|
+
if (entry.spec.ownerKey !== spec.ownerKey)
|
|
166
|
+
throw new ComputerError('computer_owner_mismatch', '电脑环境归属不匹配');
|
|
167
|
+
if (JSON.stringify(entry.spec) === JSON.stringify(spec))
|
|
168
|
+
return;
|
|
169
|
+
if (entry.status !== 'free' && entry.status !== 'idle')
|
|
170
|
+
throw new ComputerError('computer_busy', '请先释放当前电脑,再应用新的配置');
|
|
171
|
+
entry.status = 'stopping';
|
|
172
|
+
entry.generation++;
|
|
173
|
+
this.save(entry);
|
|
174
|
+
try {
|
|
175
|
+
await this.provider.remove(entry.spec);
|
|
176
|
+
authorize();
|
|
177
|
+
entry.spec = spec;
|
|
178
|
+
entry.status = 'free';
|
|
179
|
+
this.save(entry);
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
entry.status = 'uncertain';
|
|
183
|
+
this.save(entry);
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
authorize(lease) { this.assert(lease); }
|
|
189
|
+
renew(lease) { this.assert(lease); const entry = this.require(lease); entry.expiresAt = this.now() + this.limits.ttlMs; this.save(entry); void this.provider.renewFence?.(entry.spec).catch(() => { }); }
|
|
190
|
+
use(lease, action) {
|
|
191
|
+
this.assert(lease);
|
|
192
|
+
const active = this.require(lease).holders.get(lease.id);
|
|
193
|
+
const pending = Promise.resolve().then(() => { this.assert(lease); return action({ signal: active.controller.signal, authorize: () => this.assert(lease), mayFence: () => { try {
|
|
194
|
+
const entry = this.require(lease, false);
|
|
195
|
+
return entry.status === 'active' && entry.holders.size <= 1;
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
return false;
|
|
199
|
+
} } }); }).then(value => { this.assert(lease); return value; });
|
|
200
|
+
active.operations.add(pending);
|
|
201
|
+
void pending.finally(() => active.operations.delete(pending)).catch(() => { });
|
|
202
|
+
return pending;
|
|
203
|
+
}
|
|
204
|
+
/** Synchronous removal of one holder; true when it was the last one. */
|
|
205
|
+
removeHolder(entry, leaseId) {
|
|
206
|
+
const active = entry.holders.get(leaseId);
|
|
207
|
+
if (active) {
|
|
208
|
+
entry.holders.delete(leaseId);
|
|
209
|
+
active.controller.abort();
|
|
210
|
+
active.detach();
|
|
211
|
+
}
|
|
212
|
+
return entry.holders.size === 0;
|
|
213
|
+
}
|
|
214
|
+
release(lease, keepRunning = false) {
|
|
215
|
+
// Synchronous identity check, like the original fence: an already-ended
|
|
216
|
+
// lease must throw immediately rather than reject after queuing.
|
|
217
|
+
{
|
|
218
|
+
const entry = this.get(lease.environmentId), active = entry?.holders.get(lease.id);
|
|
219
|
+
if (!entry || !active || entry.spec.ownerKey !== lease.ownerKey || active.lease.holderId !== lease.holderId)
|
|
220
|
+
throw new ComputerError('computer_lease_stale', '电脑控制权已改变,旧操作不能继续');
|
|
221
|
+
}
|
|
222
|
+
return this.serial(lease.environmentId, async () => {
|
|
223
|
+
const entry = this.get(lease.environmentId), active = entry?.holders.get(lease.id);
|
|
224
|
+
if (!entry || !active || entry.spec.ownerKey !== lease.ownerKey || active.lease.holderId !== lease.holderId)
|
|
225
|
+
throw new ComputerError('computer_lease_stale', '电脑控制权已改变,旧操作不能继续');
|
|
226
|
+
// A fencing release stops without further authorization, mirroring the
|
|
227
|
+
// stop path: it must proceed even after the holder's grant just lapsed.
|
|
228
|
+
if (keepRunning) {
|
|
229
|
+
this.assert(lease);
|
|
230
|
+
if (active.operations.size)
|
|
231
|
+
throw new ComputerError('computer_busy', '电脑仍有未结束操作,暂不能交出环境');
|
|
232
|
+
}
|
|
233
|
+
this.removeHolder(entry, lease.id);
|
|
234
|
+
if (entry.holders.size) {
|
|
235
|
+
this.save(entry);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (keepRunning) {
|
|
239
|
+
if (this.provider.releaseFence)
|
|
240
|
+
await this.provider.releaseFence(entry.spec, true);
|
|
241
|
+
entry.status = 'idle';
|
|
242
|
+
entry.generation++;
|
|
243
|
+
entry.expiresAt = 0;
|
|
244
|
+
this.save(entry);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
this.invalidate(entry);
|
|
248
|
+
await this.stopEntry(entry);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
definition(ownerKey, id) { const entry = this.get(id); if (entry && entry.spec.ownerKey !== ownerKey)
|
|
252
|
+
throw new ComputerError('computer_owner_mismatch', '电脑环境归属不匹配'); return entry?.spec; }
|
|
253
|
+
async desktop(spec, action, authorize) {
|
|
254
|
+
spec = this.provider.validateSpecification(spec);
|
|
255
|
+
await this.serial(spec.id, async () => {
|
|
256
|
+
authorize();
|
|
257
|
+
if (!this.ready || this.closing || this.maintenance)
|
|
258
|
+
throw new ComputerError('computer_busy', '本地虚拟机正在维护');
|
|
259
|
+
let entry = this.get(spec.id);
|
|
260
|
+
if (entry?.spec.ownerKey !== undefined && entry.spec.ownerKey !== spec.ownerKey)
|
|
261
|
+
throw new ComputerError('computer_owner_mismatch', '虚拟机归属不匹配');
|
|
262
|
+
// Startup only restores saved, stopped desktops. Serialize this check
|
|
263
|
+
// with manual removal and task acquisition so neither can be undone.
|
|
264
|
+
if (action === 'restore') {
|
|
265
|
+
if (!entry || entry.status !== 'free')
|
|
266
|
+
return;
|
|
267
|
+
spec = { ...entry.spec, network: spec.network };
|
|
268
|
+
}
|
|
269
|
+
if (entry && !['free', 'idle'].includes(entry.status))
|
|
270
|
+
throw new ComputerError('computer_busy', '请先停止机器人任务并交还控制权');
|
|
271
|
+
const starts = ['create', 'start', 'recreate', 'restore'].includes(action);
|
|
272
|
+
if (starts && this.rows().filter(row => row.status !== 'free' && row.spec.id !== spec.id).length >= this.limits.concurrent)
|
|
273
|
+
throw new ComputerError('computer_quota', '本地虚拟机数量已达上限,请先停止另一台桌面');
|
|
274
|
+
if (!entry && !starts)
|
|
275
|
+
return;
|
|
276
|
+
entry ??= { spec, generation: 0, status: 'free', holders: new Map(), expiresAt: 0, updatedAt: this.now() };
|
|
277
|
+
this.entries.set(spec.id, entry);
|
|
278
|
+
entry.status = 'preparing';
|
|
279
|
+
entry.generation++;
|
|
280
|
+
this.save(entry);
|
|
281
|
+
try {
|
|
282
|
+
if (['stop', 'recreate', 'remove'].includes(action)) {
|
|
283
|
+
await this.provider.stop(entry.spec);
|
|
284
|
+
await this.provider.remove(entry.spec);
|
|
285
|
+
}
|
|
286
|
+
authorize();
|
|
287
|
+
if (starts) {
|
|
288
|
+
entry.spec = spec;
|
|
289
|
+
await this.provider.ensure(spec, authorize);
|
|
290
|
+
entry.status = 'idle';
|
|
291
|
+
}
|
|
292
|
+
else
|
|
293
|
+
entry.status = 'free';
|
|
294
|
+
if (action === 'remove') {
|
|
295
|
+
this.db.prepare('DELETE FROM computer_environments WHERE id=?').run(spec.id);
|
|
296
|
+
this.entries.delete(spec.id);
|
|
297
|
+
}
|
|
298
|
+
else
|
|
299
|
+
this.save(entry);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
entry.status = 'uncertain';
|
|
303
|
+
this.save(entry);
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
async retire(ownerKey, id) {
|
|
309
|
+
return this.serial(id, async () => {
|
|
310
|
+
const entry = this.get(id);
|
|
311
|
+
if (!entry)
|
|
312
|
+
return;
|
|
313
|
+
if (entry.spec.ownerKey !== ownerKey)
|
|
314
|
+
throw new ComputerError('computer_owner_mismatch', '电脑环境归属不匹配');
|
|
315
|
+
if (entry.status !== 'free' && entry.status !== 'idle')
|
|
316
|
+
throw new ComputerError('computer_busy', '电脑停止状态尚未确认');
|
|
317
|
+
if (entry.status === 'idle')
|
|
318
|
+
await this.provider.stop(entry.spec);
|
|
319
|
+
await this.provider.remove(entry.spec);
|
|
320
|
+
this.db.prepare('DELETE FROM computer_environments WHERE id=?').run(id);
|
|
321
|
+
this.entries.delete(id);
|
|
322
|
+
return entry.spec;
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
async stopHolder(ownerKey, id, holderId) {
|
|
326
|
+
return this.serial(id, async () => {
|
|
327
|
+
const entry = this.get(id);
|
|
328
|
+
if (!entry || entry.spec.ownerKey !== ownerKey)
|
|
329
|
+
throw new ComputerError('computer_owner_mismatch', '电脑环境归属不匹配');
|
|
330
|
+
const active = [...entry.holders.values()].find(active => active.lease.holderId === holderId);
|
|
331
|
+
if (!active)
|
|
332
|
+
return;
|
|
333
|
+
this.removeHolder(entry, active.lease.id);
|
|
334
|
+
if (entry.holders.size)
|
|
335
|
+
this.save(entry);
|
|
336
|
+
else {
|
|
337
|
+
this.invalidate(entry);
|
|
338
|
+
await this.stopEntry(entry);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
/** The stop fence: ends every holder, then confirms the container stopped. */
|
|
343
|
+
invalidate(expected) {
|
|
344
|
+
const entry = this.get(expected.spec.id);
|
|
345
|
+
if (!entry || entry.status === 'free')
|
|
346
|
+
return undefined;
|
|
347
|
+
if (entry.status !== 'stopping') {
|
|
348
|
+
entry.generation++;
|
|
349
|
+
entry.status = 'stopping';
|
|
350
|
+
entry.expiresAt = 0;
|
|
351
|
+
this.save(entry);
|
|
352
|
+
}
|
|
353
|
+
for (const active of entry.holders.values()) {
|
|
354
|
+
active.controller.abort();
|
|
355
|
+
active.detach();
|
|
356
|
+
}
|
|
357
|
+
entry.holders.clear();
|
|
358
|
+
return entry;
|
|
359
|
+
}
|
|
360
|
+
async stopEntry(expected) {
|
|
361
|
+
const entry = this.invalidate(expected);
|
|
362
|
+
if (!entry)
|
|
363
|
+
return;
|
|
364
|
+
try {
|
|
365
|
+
await this.provider.stop(entry.spec);
|
|
366
|
+
// Retire the runtime identity as well as the lease generation. A delayed
|
|
367
|
+
// exec targeting the old container ID can never enter its successor.
|
|
368
|
+
await this.provider.remove(entry.spec);
|
|
369
|
+
entry.status = 'free';
|
|
370
|
+
entry.expiresAt = 0;
|
|
371
|
+
this.save(entry);
|
|
372
|
+
}
|
|
373
|
+
catch (error) {
|
|
374
|
+
entry.status = 'uncertain';
|
|
375
|
+
this.save(entry);
|
|
376
|
+
throw error;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
async expire() {
|
|
380
|
+
for (const id of this.rows().map(entry => entry.spec.id)) {
|
|
381
|
+
const entry = this.get(id);
|
|
382
|
+
if (entry.status === 'idle' && this.idleStopMinutes > 0 && this.now() - entry.updatedAt >= this.idleStopMinutes * 60000) {
|
|
383
|
+
this.invalidate(entry);
|
|
384
|
+
await this.serial(id, () => this.stopEntry(entry)).catch(() => { });
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if ((entry.status === 'active' || entry.status === 'preparing') && entry.expiresAt <= this.now()) {
|
|
388
|
+
this.invalidate(entry);
|
|
389
|
+
await this.serial(id, () => this.stopEntry(entry)).catch(() => { });
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
// An unconfirmed stop must not block the environment forever: retry it
|
|
393
|
+
// on later sweeps until the provider confirms the desktop has stopped.
|
|
394
|
+
if (entry.status === 'uncertain' && this.now() - entry.updatedAt >= 30000)
|
|
395
|
+
await this.serial(id, () => this.stopEntry(entry)).catch(() => { });
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async close() {
|
|
399
|
+
this.closing = true;
|
|
400
|
+
for (const entry of this.rows())
|
|
401
|
+
if (entry.status !== 'free')
|
|
402
|
+
this.invalidate(entry);
|
|
403
|
+
await Promise.allSettled(this.rows().filter(entry => entry.status !== 'free').map(entry => this.serial(entry.spec.id, () => this.stopEntry(this.get(entry.spec.id)))));
|
|
404
|
+
if (this.rows().some(entry => entry.status !== 'free'))
|
|
405
|
+
throw new ComputerError('computer_stop_uncertain', '尚未确认所有电脑环境已停止');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
The computer image recipe derives from OpenMausBot server/container-computer.ts, commit 886b786c.
|
|
2
|
+
OpenMausBot contributors, Apache License 2.0.
|
|
3
|
+
Changes: standalone Dockerfile, Yaoyao image metadata and persistent Firefox profile preparation.
|
|
4
|
+
CUA, XFCE, browsers, fonts and base image retain their respective upstream licenses.
|