@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
45 lines • 2.09 kB
JavaScript
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========
/**
* Storage seam for the job plane: each session's job list, each job's
* console, which owners still run their jobs, and the processes each owner
* runs.
*
* A session's list is one record, `{"next": n, "jobs": {id: job}}`,
* written under a generation CAS the way the session table is, so two
* workspaces that start a job on one session at once never hand out the
* same number. A job's console is a stream the record names; any workspace
* on the same store attaches to it by that name, follows it, and ends it
* to kill the job. A lease says an owner is still alive: a job whose
* owner's lease lapsed with no ending was lost with it. Each owner
* publishes the processes it runs, so every workspace on the store lists
* them and asks the owner to stop one; another workspace stops a lapsed
* owner's native runs itself.
*
* Subclasses are infra adapters (RAM, Redis); everything above (job
* numbers, waits, kills, hangups) is the table's, mirroring the
* NamespaceStore design. Mirrors Python's `JobStore`.
*/
export class JobStore {
leaseSeconds;
/**
* @param leaseSeconds how long an owner's renewal keeps it alive; null
* means owners never lapse, which holds where every owner shares one
* process.
*/
constructor(leaseSeconds = null) {
this.leaseSeconds = leaseSeconds;
}
}
//# sourceMappingURL=store.js.map