@volter/world-runtime 3.0.88 → 3.0.89

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.
@@ -4,10 +4,10 @@ import { optionValue, ownerOption } from "./cli-args.js";
4
4
  import { printReady } from "./up-cli.js";
5
5
  import { spawn, spawnSync } from 'node:child_process';
6
6
  import { createRequire } from 'node:module';
7
- import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
7
+ import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
8
8
  import { tmpdir } from 'node:os';
9
- import { dirname, join, resolve } from 'node:path';
10
- import { activateScript, branchWorld, checkoutWorld, fetchFromOrigin, pushWorldChangeset, rebaseWorldChangeset, resetWorld, seedWorld, worldOrigin, approveWorldChangeset, checkPrerequisites, coverWorld, createWorldChangeset, diffWorld, doctorWorld, downWorld, findWorldChangeset, formatCoverageReport, formatInitReport, formatPrerequisiteChecks, formatProjectInspection, initWorld, inspectProject, isRemoteWorldRef, listWorldChangesets, listWorlds, markWorld, migrateWorldConfig, readReflectRoutes, reflectRoutesPath, replayWorldChangeset, resolveWorldRef, attachWorld, retireWorldConsumers, runWorld, shareWorldServices, shellWorld, startReflectFront, startReflectResolver, statusWorld, statusWorldChangeset, tailWorldActions, unshareWorld, urlsWorld, urlWorld, verifyWorldChangeset, worldManifest, writeReflectRoutes, readReflectManifest, writeReflectManifest, clearReflectManifest, composeOverrideForReflect, splitDockerComposeArgs, dockerComposeWithOverride, ATTACHED_CA_PATH } from "./index.js";
9
+ import { join, resolve } from 'node:path';
10
+ import { activateScript, branchWorld, checkoutWorld, fetchFromOrigin, pushWorldChangeset, rebaseWorldChangeset, resetWorld, seedWorld, worldOrigin, approveWorldChangeset, writeWorldClock, checkPrerequisites, coverWorld, createWorldChangeset, diffWorld, doctorWorld, downWorld, findWorldChangeset, formatCoverageReport, formatInitReport, formatPrerequisiteChecks, formatProjectInspection, initWorld, inspectProject, isRemoteWorldRef, listWorldChangesets, listWorlds, markWorld, migrateWorldConfig, readReflectRoutes, reflectRoutesPath, replayWorldChangeset, resolveWorldRef, attachWorld, retireWorldConsumers, runWorld, shareWorldServices, shellWorld, startReflectFront, startReflectResolver, statusWorld, statusWorldChangeset, tailWorldActions, unshareWorld, urlsWorld, urlWorld, verifyWorldChangeset, worldManifest, writeReflectRoutes, readReflectManifest, writeReflectManifest, clearReflectManifest, composeOverrideForReflect, splitDockerComposeArgs, dockerComposeWithOverride, ATTACHED_CA_PATH } from "./index.js";
11
11
  import { formatApplication, formatChangeset, formatRebaseReport, formatChangesetStatus, formatLedgerDelta, formatReplayReport, formatVerification, parseVerifierExpression } from '@volter/world-core/runtime';
12
12
  import { advertiseWorldManifest, fetchRemoteManifest, MANIFEST_PATH, remoteAttachEnv, startManifestServer } from "./serve.js";
13
13
  import { clockFile, instanceDir, pruneWorlds, withoutVaultSignIn } from "./runtime.js";
@@ -539,8 +539,7 @@ export async function main() {
539
539
  const file = clockFile(rootDir, name);
540
540
  const current = existsSync(file) ? clockForm.parseClock(readFileSync(file, 'utf8')) : null;
541
541
  const write = (clock) => {
542
- mkdirSync(dirname(file), { recursive: true });
543
- writeFileSync(file, `${clockForm.formatClock(clock)}\n`);
542
+ writeWorldClock(name, rootDir, clock);
544
543
  // the World's time now, bare, as scripts read it (`show` says which form)
545
544
  console.log(new Date(clockForm.clockNowMs(clock, Date.now())).toISOString());
546
545
  };
@@ -0,0 +1,3 @@
1
+ import type { WorldClock } from '@volter/world-core/world-clock';
2
+ export declare function writeWorldClock(name: string, root: string, clock: WorldClock): void;
3
+ export declare function setWorldClock(name: string, root: string, at: string): void;
@@ -0,0 +1,18 @@
1
+ // The programmatic counterpart of the operator's clock command. Callers own their World root; only invoked
2
+ // operations read or write it. Formatting belongs to the kernel's shared clock contract.
3
+ import { mkdirSync, writeFileSync } from 'node:fs';
4
+ import { createRequire } from 'node:module';
5
+ import { dirname } from 'node:path';
6
+ import { clockFile } from "./runtime.js";
7
+ const clockForm = createRequire(import.meta.url)('@volter/world-core/world-clock');
8
+ export function writeWorldClock(name, root, clock) {
9
+ const file = clockFile(root, name);
10
+ mkdirSync(dirname(file), { recursive: true });
11
+ writeFileSync(file, `${clockForm.formatClock(clock)}\n`);
12
+ }
13
+ export function setWorldClock(name, root, at) {
14
+ const parsed = Date.parse(at);
15
+ if (Number.isNaN(parsed))
16
+ throw new Error(`clock set: ${JSON.stringify(at)} is not an ISO-8601 instant`);
17
+ writeWorldClock(name, root, { kind: 'frozen', at: parsed });
18
+ }
@@ -22,6 +22,7 @@ export type { CoverageReport, CoverageRow, CoverageStatus, CoverageOptions, Repo
22
22
  export { formatInitReport, initWorld, packCatalog, planWorldInit, renderEnvFile, writeWorldInit } from './init.js';
23
23
  export { STATE_GITIGNORE } from './init.js';
24
24
  export { clockFile, instanceDir } from './runtime.js';
25
+ export { setWorldClock, writeWorldClock } from './clock.js';
25
26
  export { checkoutCatalog, findInstalledPackage, installedCatalog, resolveCatalog, resolveServicePackage, twinPackageName, TWIN_PACKAGE_PREFIX, type Catalog, type CatalogKind, packCli, packEntry } from './catalog.js';
26
27
  export { ISSUE_ENV_PREFIX, MINT_ENV } from './schema.js';
27
28
  export type { EnvDisposition, InitEnvRow, InitInfraStub, InitOptions, InitPlan, InitResult, InitVendorPlan, InitWiring, } from './init.js';
package/dist/src/index.js CHANGED
@@ -20,6 +20,7 @@ export { coverWorld, detectRepoVendors, envNameVendor, formatCoverageReport, inj
20
20
  export { formatInitReport, initWorld, packCatalog, planWorldInit, renderEnvFile, writeWorldInit } from "./init.js";
21
21
  export { STATE_GITIGNORE } from "./init.js";
22
22
  export { clockFile, instanceDir } from "./runtime.js";
23
+ export { setWorldClock, writeWorldClock } from "./clock.js";
23
24
  export { checkoutCatalog, findInstalledPackage, installedCatalog, resolveCatalog, resolveServicePackage, twinPackageName, TWIN_PACKAGE_PREFIX, packCli, packEntry } from "./catalog.js";
24
25
  export { ISSUE_ENV_PREFIX, MINT_ENV } from "./schema.js";
25
26
  export { deriveWorldManifest, findWorldRefFile, isRemoteWorldRef, resolveWorldRef, WORLD_REF_FILE, worldManifest, } from "./attach.js";
@@ -67,7 +67,7 @@ export type WorldUrlInfo = {
67
67
  * the instance dir — one layout owner, no duplicated path knowledge. */
68
68
  /** THE WORLD CLOCK file (TWIN-PROGRAMMING-MODEL P3): a single frozen ISO instant every twin
69
69
  * stamps from (kernel worldNow()); absent → real wall-clock. Written only by the
70
- * `volter-world clock` operator door — time is physics, advanced explicitly, never drifting. */
70
+ * `volter-world clock` operator door or its runtime API — time is physics, advanced explicitly, never drifting. */
71
71
  export declare function clockFile(root: string, name: string): string;
72
72
  export declare function instanceDir(root: string, name: string): string;
73
73
  export type SharingClaim = {
@@ -290,7 +290,7 @@ function assertSafeWorldName(name) {
290
290
  * the instance dir — one layout owner, no duplicated path knowledge. */
291
291
  /** THE WORLD CLOCK file (TWIN-PROGRAMMING-MODEL P3): a single frozen ISO instant every twin
292
292
  * stamps from (kernel worldNow()); absent → real wall-clock. Written only by the
293
- * `volter-world clock` operator door — time is physics, advanced explicitly, never drifting. */
293
+ * `volter-world clock` operator door or its runtime API — time is physics, advanced explicitly, never drifting. */
294
294
  export function clockFile(root, name) {
295
295
  return join(instanceDir(root, name), 'clock');
296
296
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/world-runtime",
3
- "version": "3.0.88",
3
+ "version": "3.0.89",
4
4
  "description": "World configs for twins: boot named local runtimes, allocate ports, generate world.env/instance.json, and run apps against fake-key twin worlds.",
5
5
  "keywords": [
6
6
  "twin",
@@ -69,14 +69,14 @@
69
69
  "node": ">=22.3"
70
70
  },
71
71
  "peerDependencies": {
72
- "@volter/world-core": "3.0.88",
73
- "@volter/world-console": "3.0.83"
72
+ "@volter/world-core": "3.0.89",
73
+ "@volter/world-console": "3.0.84"
74
74
  },
75
75
  "dependencies": {
76
76
  "@electric-sql/pglite": "0.5.8",
77
77
  "@electric-sql/pglite-pgvector": "0.0.9",
78
78
  "@volter/world-access": "3.0.1",
79
- "@volter/world-core": "3.0.88",
79
+ "@volter/world-core": "3.0.89",
80
80
  "mongodb": "~6.20.0",
81
81
  "pg-gateway": "0.3.0-beta.4",
82
82
  "smol-toml": "^1.8.0",
@@ -7,7 +7,7 @@ import { createRequire } from 'node:module';
7
7
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from 'node:fs';
8
8
  import { tmpdir } from 'node:os';
9
9
  import { dirname, join, resolve, resolve as resolvePath } from 'node:path';
10
- import { activateScript, branchWorld, checkoutWorld, fetchFromOrigin, pushWorldChangeset, rebaseWorldChangeset, resetWorld, seedWorld, worldOrigin, approveWorldChangeset, checkPrerequisites, coverWorld, createWorldChangeset, diffWorld, doctorWorld, downWorld, findWorldChangeset, formatCoverageReport, formatInitReport, formatPrerequisiteChecks, formatProjectInspection, initWorld, inspectProject, isRemoteWorldRef, listWorldChangesets, listWorlds, markWorld, migrateWorldConfig, readReflectRoutes, reflectRoutesPath, replayWorldChangeset, resolveWorldRef, attachWorld, retireWorldConsumers, runWorld, shareWorldServices, shellWorld, startReflectFront, startReflectResolver, statusWorld, statusWorldChangeset, tailWorldActions, unshareWorld, upWorld, urlsWorld, urlWorld, verifyWorldChangeset, worldManifest, writeReflectRoutes, readReflectManifest, writeReflectManifest, clearReflectManifest, composeOverrideForReflect, splitDockerComposeArgs, dockerComposeWithOverride, ATTACHED_CA_PATH } from './index.ts';
10
+ import { activateScript, branchWorld, checkoutWorld, fetchFromOrigin, pushWorldChangeset, rebaseWorldChangeset, resetWorld, seedWorld, worldOrigin, approveWorldChangeset, writeWorldClock, checkPrerequisites, coverWorld, createWorldChangeset, diffWorld, doctorWorld, downWorld, findWorldChangeset, formatCoverageReport, formatInitReport, formatPrerequisiteChecks, formatProjectInspection, initWorld, inspectProject, isRemoteWorldRef, listWorldChangesets, listWorlds, markWorld, migrateWorldConfig, readReflectRoutes, reflectRoutesPath, replayWorldChangeset, resolveWorldRef, attachWorld, retireWorldConsumers, runWorld, shareWorldServices, shellWorld, startReflectFront, startReflectResolver, statusWorld, statusWorldChangeset, tailWorldActions, unshareWorld, upWorld, urlsWorld, urlWorld, verifyWorldChangeset, worldManifest, writeReflectRoutes, readReflectManifest, writeReflectManifest, clearReflectManifest, composeOverrideForReflect, splitDockerComposeArgs, dockerComposeWithOverride, ATTACHED_CA_PATH } from './index.ts';
11
11
  import { formatApplication, formatChangeset, formatRebaseReport, formatChangesetStatus, formatLedgerDelta, formatReplayReport, formatVerification, parseVerifierExpression } from '@volter/world-core/runtime';
12
12
  import { advertiseWorldManifest, fetchRemoteManifest, MANIFEST_PATH, remoteAttachEnv, startManifestServer } from './serve.ts';
13
13
  import type { WorldManifest } from './attach.ts';
@@ -491,8 +491,7 @@ export async function main(): Promise<void> {
491
491
  const file = clockFile(rootDir, name);
492
492
  const current = existsSync(file) ? clockForm.parseClock(readFileSync(file, 'utf8')) : null;
493
493
  const write = (clock: Parameters<typeof clockForm.formatClock>[0]) => {
494
- mkdirSync(dirname(file), { recursive: true });
495
- writeFileSync(file, `${clockForm.formatClock(clock)}\n`);
494
+ writeWorldClock(name, rootDir, clock);
496
495
  // the World's time now, bare, as scripts read it (`show` says which form)
497
496
  console.log(new Date(clockForm.clockNowMs(clock, Date.now())).toISOString());
498
497
  };
package/src/clock.ts ADDED
@@ -0,0 +1,21 @@
1
+ // The programmatic counterpart of the operator's clock command. Callers own their World root; only invoked
2
+ // operations read or write it. Formatting belongs to the kernel's shared clock contract.
3
+ import { mkdirSync, writeFileSync } from 'node:fs';
4
+ import { createRequire } from 'node:module';
5
+ import { dirname } from 'node:path';
6
+ import type { WorldClock } from '@volter/world-core/world-clock';
7
+ import { clockFile } from './runtime.ts';
8
+
9
+ const clockForm = createRequire(import.meta.url)('@volter/world-core/world-clock') as typeof import('@volter/world-core/world-clock');
10
+
11
+ export function writeWorldClock(name: string, root: string, clock: WorldClock): void {
12
+ const file = clockFile(root, name);
13
+ mkdirSync(dirname(file), { recursive: true });
14
+ writeFileSync(file, `${clockForm.formatClock(clock)}\n`);
15
+ }
16
+
17
+ export function setWorldClock(name: string, root: string, at: string): void {
18
+ const parsed = Date.parse(at);
19
+ if (Number.isNaN(parsed)) throw new Error(`clock set: ${JSON.stringify(at)} is not an ISO-8601 instant`);
20
+ writeWorldClock(name, root, { kind: 'frozen', at: parsed });
21
+ }
package/src/index.ts CHANGED
@@ -100,6 +100,7 @@ export type { CoverageReport, CoverageRow, CoverageStatus, CoverageOptions, Repo
100
100
  export { formatInitReport, initWorld, packCatalog, planWorldInit, renderEnvFile, writeWorldInit } from './init.ts';
101
101
  export { STATE_GITIGNORE } from './init.ts';
102
102
  export { clockFile, instanceDir } from './runtime.ts';
103
+ export { setWorldClock, writeWorldClock } from './clock.ts';
103
104
  export { checkoutCatalog, findInstalledPackage, installedCatalog, resolveCatalog, resolveServicePackage, twinPackageName, TWIN_PACKAGE_PREFIX, type Catalog, type CatalogKind, packCli, packEntry } from './catalog.ts';
104
105
  export { ISSUE_ENV_PREFIX, MINT_ENV } from './schema.ts';
105
106
  export type {
package/src/runtime.ts CHANGED
@@ -315,7 +315,7 @@ function assertSafeWorldName(name: string): void {
315
315
  * the instance dir — one layout owner, no duplicated path knowledge. */
316
316
  /** THE WORLD CLOCK file (TWIN-PROGRAMMING-MODEL P3): a single frozen ISO instant every twin
317
317
  * stamps from (kernel worldNow()); absent → real wall-clock. Written only by the
318
- * `volter-world clock` operator door — time is physics, advanced explicitly, never drifting. */
318
+ * `volter-world clock` operator door or its runtime API — time is physics, advanced explicitly, never drifting. */
319
319
  export function clockFile(root: string, name: string): string {
320
320
  return join(instanceDir(root, name), 'clock');
321
321
  }