mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
sync
This commit is contained in:
22
js/src/session/session.ts
Normal file
22
js/src/session/session.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Identifier } from "../id/id";
|
||||
import { Storage } from "../storage/storage";
|
||||
import { Log } from "../util/log";
|
||||
|
||||
export namespace Session {
|
||||
const log = Log.create({ service: "session" });
|
||||
|
||||
export interface Info {
|
||||
id: string;
|
||||
title: string;
|
||||
}
|
||||
|
||||
export async function create() {
|
||||
const result: Info = {
|
||||
id: Identifier.create("session"),
|
||||
title: "New Session - " + new Date().toISOString(),
|
||||
};
|
||||
log.info("created", result);
|
||||
await Storage.write("session/info/" + result.id, JSON.stringify(result));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user