Import AITURK IDE 1.0.0-beta.1 from Hermes 63279301; preserve MIT license
This commit is contained in:
commit
03634b1ca3
11340 files changed
+3442369
No files matched your search
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* The pieces every Bot Mode module needs and no single module can own: the
|
||||
* plugin id, the `PluginContext` `register()` captures, and the open
|
||||
* generation the bot-open and group-open click paths race on.
|
||||
*
|
||||
* The mutable ones live behind accessor pairs because an imported binding
|
||||
* cannot be reassigned — `register()` publishes the context once with
|
||||
* `setPluginCtx`, and every reader goes through `getPluginCtx()`.
|
||||
*/
|
||||
|
||||
import type { PluginContext } from '@hermes/plugin-sdk'
|
||||
|
||||
export const ID = 'hermes-bots'
|
||||
|
||||
/** Captured in register() so components can reach plugin storage. */
|
||||
let pluginCtx: PluginContext | null = null
|
||||
|
||||
export function getPluginCtx(): PluginContext | null {
|
||||
return pluginCtx
|
||||
}
|
||||
|
||||
export function setPluginCtx(ctx: PluginContext | null) {
|
||||
pluginCtx = ctx
|
||||
}
|
||||
|
||||
/** Monotonic open generation. A bot open and a group open supersede each
|
||||
* other, so both bump it and both compare against it — and they no longer
|
||||
* live in the same module. */
|
||||
let botOpenGeneration = 0
|
||||
|
||||
export function getBotOpenGeneration() {
|
||||
return botOpenGeneration
|
||||
}
|
||||
|
||||
/** Invalidate every in-flight open; returns the generation that now owns it. */
|
||||
export function bumpBotOpenGeneration() {
|
||||
return ++botOpenGeneration
|
||||
}
|
||||
Reference in new issue
Block a user