From 7b9f0a6b16e990b6d1e6396e7037ccb6daeeafa5 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 15 Apr 2024 10:12:30 +0200 Subject: [PATCH] Repairs after merge --- .../core/local-protocols/schemas/mirror.prs | 20 +++++++++---------- packages/core/src/runtime/dataspace.ts | 2 +- packages/core/src/runtime/mirror.ts | 20 ++++++++----------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/packages/core/local-protocols/schemas/mirror.prs b/packages/core/local-protocols/schemas/mirror.prs index f2e13c3..9705512 100644 --- a/packages/core/local-protocols/schemas/mirror.prs +++ b/packages/core/local-protocols/schemas/mirror.prs @@ -1,10 +1,10 @@ version 1 . -Reflect = . +Reflect = . -Type = . -Facet = . -Attribute = . +Type = . +Facet = . +Attribute = . TypeName = / =entity @@ -18,19 +18,19 @@ TypeName = EntityClass = . # Facet -FacetActor = . +FacetActor = . FacetAlive = . -FacetChild = . -FacetParent = =root / . -FacetAssertion = . +FacetChild = . +FacetParent = =root / . +FacetAssertion = . FacetInertPreventers = . # Actor ActorName = . -ActorRoot = . +ActorRoot = . ActorStatus = =running / =done / . # Space SpaceTaskCount = . -SpaceActor = . +SpaceActor = . SpaceStatus = =running / =paused / =terminated . diff --git a/packages/core/src/runtime/dataspace.ts b/packages/core/src/runtime/dataspace.ts index 1c281b7..1b1daed 100644 --- a/packages/core/src/runtime/dataspace.ts +++ b/packages/core/src/runtime/dataspace.ts @@ -99,7 +99,7 @@ export class Dataspace implements Partial { delete this._reflection; } else { this._reflection = { mirror, assertionHandles: {} }; - mirror.constProp(Refl.EntityClass(Symbol.for('dataspace'))); + mirror.constProp(Refl.EntityClass(Symbol.for('dataspace'))); this.handleMap.forEach((v, handle) => this._reflection?.mirror.setProp( this._reflection.assertionHandles, diff --git a/packages/core/src/runtime/mirror.ts b/packages/core/src/runtime/mirror.ts index 86d5ed2..ba3757e 100644 --- a/packages/core/src/runtime/mirror.ts +++ b/packages/core/src/runtime/mirror.ts @@ -1,15 +1,15 @@ /// SPDX-License-Identifier: GPL-3.0-or-later -/// SPDX-FileCopyrightText: Copyright © 2023 Tony Garnock-Jones +/// SPDX-FileCopyrightText: Copyright © 2023-2024 Tony Garnock-Jones -import { Actor, Ref, RefImpl, Facet, LocalAction, Turn, assertionFrom } from './actor'; +import { Actor, Ref, Facet, LocalAction, Turn, assertionFrom } from './actor'; import type { Handle, Assertable } from './actor'; import type { Field } from './dataflow'; import * as Refl from '../gen/mirror'; import { Observe } from '../gen/dataspace'; -import * as P from '../gen/dataspacePatterns'; +import * as P from './pattern'; import { ActorSpace } from './space'; import { assertionFacetObserver, Dataspace } from './dataspace'; -import { stringify, isEmbedded } from '@preserves/core'; +import { stringify, isEmbedded, KeyedDictionary } from '@preserves/core'; export interface Reflectable { asRef(): Ref; @@ -93,15 +93,11 @@ export function spawnMirror(sourceSpace: ActorSpace, targetSpace = new ActorSpac tracer: (event, a, _ds, sig) => console.log('DS', event, stringify(a), sig), })); t.assert(image, Observe({ - pattern: P.Pattern.DCompound(P.DCompound.rec({ - label: Symbol.for('reflect'), - fields: [P.Pattern.DBind(P.DBind(P.Pattern.DDiscard(P.DDiscard())))], - })), + pattern: P.rec(Symbol.for('reflect'), P.bind()), observer: t.ref(assertionFacetObserver(a => { if (!Array.isArray(a)) return; - const [thing_embedded] = a; - if (!isEmbedded(thing_embedded)) return; - const thing = thing_embedded.embeddedValue; + const [thing] = a; + if (!isEmbedded(thing)) return; new Mirror(thing, image, sourceSpace, Turn.active); })), })); @@ -114,7 +110,7 @@ export function _asRef( facet: Facet, ): Ref { if (x._reflectableRef === void 0) { - x._reflectableRef = new RefImpl(facet, { data: x, setMirror: m => x.setMirror(m) }); + x._reflectableRef = new Ref(facet, { data: x, setMirror: m => x.setMirror(m) }); } return x._reflectableRef; }