cortico-world-starpost 0.8.0 → 0.8.1
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/world.ts +3 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/world.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { STARPOST_CONFIG_GROUP } from './config.ts';
|
|
|
10
10
|
|
|
11
11
|
const ENV_PROMPT_FILE = fileURLToPath(new URL('./ENV_PROMPT.md', import.meta.url));
|
|
12
12
|
const DEFAULT_EMOJI_DIR = fileURLToPath(new URL('../emoji/', import.meta.url));
|
|
13
|
+
const STARPOST_PACKAGE_FILE = fileURLToPath(new URL('../package.json', import.meta.url));
|
|
13
14
|
const arg = (o: Record<string, unknown>, key: string) => String(o[key] ?? '');
|
|
14
15
|
const params = (properties: Record<string, unknown>, required: string[] = []) => ({ type: 'object' as const, additionalProperties: false, properties, required });
|
|
15
16
|
const s = (description: string) => ({ type: 'string', description });
|
|
@@ -69,7 +70,7 @@ export class StarpostWorld implements World {
|
|
|
69
70
|
private pendingCoreCursor: number | null = null;
|
|
70
71
|
private pendingSinceMs: number | null = null;
|
|
71
72
|
private registering = false;
|
|
72
|
-
constructor(private readonly cfg: StarpostConfigSection, private readonly botDir: string,
|
|
73
|
+
constructor(private readonly cfg: StarpostConfigSection, private readonly botDir: string, _packageDir: string, private readonly dataDir: string, private readonly timezone: string, private readonly secret: (name: string) => string, private readonly clock: () => number = Date.now, private readonly extensionVersion: () => unknown = () => JSON.parse(readFileSync(STARPOST_PACKAGE_FILE, 'utf8')).version) {
|
|
73
74
|
this.cursorFile = join(dataDir, 'starpost-cursor.json');
|
|
74
75
|
this.identityFile = join(dataDir, 'starpost-identity.json');
|
|
75
76
|
this.versionNoticeFile = join(dataDir, 'starpost-version-notice.json');
|
|
@@ -227,7 +228,7 @@ export class StarpostWorld implements World {
|
|
|
227
228
|
}
|
|
228
229
|
private async announceUpdate(): Promise<void> {
|
|
229
230
|
let version = '';
|
|
230
|
-
try { version =
|
|
231
|
+
try { version = this.extensionVersion() as string; } catch { return; }
|
|
231
232
|
if (typeof version !== 'string' || !/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/.test(version)) return;
|
|
232
233
|
let previous = '';
|
|
233
234
|
try { previous = JSON.parse(readFileSync(this.versionNoticeFile, 'utf8')).version; } catch {}
|