@sharpee/world-model 0.9.113 → 1.0.0

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.
Files changed (80) hide show
  1. package/entities/entity-types.d.ts +2 -0
  2. package/entities/entity-types.d.ts.map +1 -1
  3. package/entities/entity-types.js +3 -0
  4. package/entities/entity-types.js.map +1 -1
  5. package/entities/index.d.ts +2 -0
  6. package/entities/index.d.ts.map +1 -1
  7. package/entities/index.js +3 -1
  8. package/entities/index.js.map +1 -1
  9. package/entities/wall-entity.d.ts +112 -0
  10. package/entities/wall-entity.d.ts.map +1 -0
  11. package/entities/wall-entity.js +50 -0
  12. package/entities/wall-entity.js.map +1 -0
  13. package/index.d.ts +3 -0
  14. package/index.d.ts.map +1 -1
  15. package/index.js +3 -0
  16. package/index.js.map +1 -1
  17. package/package.json +3 -3
  18. package/traits/acoustic/acousticDampenerTrait.d.ts +61 -0
  19. package/traits/acoustic/acousticDampenerTrait.d.ts.map +1 -0
  20. package/traits/acoustic/acousticDampenerTrait.js +38 -0
  21. package/traits/acoustic/acousticDampenerTrait.js.map +1 -0
  22. package/traits/acoustic/acousticTrait.d.ts +64 -0
  23. package/traits/acoustic/acousticTrait.d.ts.map +1 -0
  24. package/traits/acoustic/acousticTrait.js +47 -0
  25. package/traits/acoustic/acousticTrait.js.map +1 -0
  26. package/traits/acoustic/index.d.ts +3 -0
  27. package/traits/acoustic/index.d.ts.map +1 -0
  28. package/traits/acoustic/index.js +10 -0
  29. package/traits/acoustic/index.js.map +1 -0
  30. package/traits/implementations.d.ts.map +1 -1
  31. package/traits/implementations.js +8 -0
  32. package/traits/implementations.js.map +1 -1
  33. package/traits/index.d.ts +3 -0
  34. package/traits/index.d.ts.map +1 -1
  35. package/traits/index.js +5 -0
  36. package/traits/index.js.map +1 -1
  37. package/traits/listener/index.d.ts +2 -0
  38. package/traits/listener/index.d.ts.map +1 -0
  39. package/traits/listener/index.js +7 -0
  40. package/traits/listener/index.js.map +1 -0
  41. package/traits/listener/listenerTrait.d.ts +40 -0
  42. package/traits/listener/listenerTrait.d.ts.map +1 -0
  43. package/traits/listener/listenerTrait.js +23 -0
  44. package/traits/listener/listenerTrait.js.map +1 -0
  45. package/traits/obstructor-protocol.d.ts +96 -0
  46. package/traits/obstructor-protocol.d.ts.map +1 -0
  47. package/traits/obstructor-protocol.js +77 -0
  48. package/traits/obstructor-protocol.js.map +1 -0
  49. package/traits/room/roomTrait.d.ts +7 -0
  50. package/traits/room/roomTrait.d.ts.map +1 -1
  51. package/traits/room/roomTrait.js +2 -0
  52. package/traits/room/roomTrait.js.map +1 -1
  53. package/traits/story-info/storyInfoTrait.d.ts +6 -0
  54. package/traits/story-info/storyInfoTrait.d.ts.map +1 -1
  55. package/traits/story-info/storyInfoTrait.js +6 -0
  56. package/traits/story-info/storyInfoTrait.js.map +1 -1
  57. package/traits/trait-types.d.ts +3 -0
  58. package/traits/trait-types.d.ts.map +1 -1
  59. package/traits/trait-types.js +8 -0
  60. package/traits/trait-types.js.map +1 -1
  61. package/world/AuthorModel.d.ts +3 -0
  62. package/world/AuthorModel.d.ts.map +1 -1
  63. package/world/AuthorModel.js +7 -0
  64. package/world/AuthorModel.js.map +1 -1
  65. package/world/WorldModel.d.ts +23 -0
  66. package/world/WorldModel.d.ts.map +1 -1
  67. package/world/WorldModel.js +36 -0
  68. package/world/WorldModel.js.map +1 -1
  69. package/world/index.d.ts +4 -0
  70. package/world/index.d.ts.map +1 -1
  71. package/world/index.js +7 -1
  72. package/world/index.js.map +1 -1
  73. package/world/wall-creation.d.ts +38 -0
  74. package/world/wall-creation.d.ts.map +1 -0
  75. package/world/wall-creation.js +98 -0
  76. package/world/wall-creation.js.map +1 -0
  77. package/world/wall-validation.d.ts +45 -0
  78. package/world/wall-validation.d.ts.map +1 -0
  79. package/world/wall-validation.js +98 -0
  80. package/world/wall-validation.js.map +1 -0
@@ -21,6 +21,8 @@ export declare const EntityType: {
21
21
  readonly SCENERY: "scenery";
22
22
  /** A directional exit (rarely used as entity) */
23
23
  readonly EXIT: "exit";
24
+ /** A physical adjacency between two rooms (ADR-173) */
25
+ readonly WALL: "wall";
24
26
  /** A geographic grouping of rooms (ADR-149) */
25
27
  readonly REGION: "region";
26
28
  /** A temporal phase of the story (ADR-149) */
@@ -1 +1 @@
1
- {"version":3,"file":"entity-types.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,UAAU;IACrB,mCAAmC;;IAGnC,wCAAwC;;IAGxC,gCAAgC;;IAGhC,kCAAkC;;IAGlC,+CAA+C;;IAG/C,sDAAsD;;IAGtD,mDAAmD;;IAGnD,iDAAiD;;IAGjD,+CAA+C;;IAG/C,8CAA8C;;IAG9C,oCAAoC;;CAE5B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,UAAU,CAE7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAgB5D"}
1
+ {"version":3,"file":"entity-types.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,UAAU;IACrB,mCAAmC;;IAGnC,wCAAwC;;IAGxC,gCAAgC;;IAGhC,kCAAkC;;IAGlC,+CAA+C;;IAG/C,sDAAsD;;IAGtD,mDAAmD;;IAGnD,iDAAiD;;IAGjD,uDAAuD;;IAGvD,+CAA+C;;IAG/C,8CAA8C;;IAG9C,oCAAoC;;CAE5B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEpE;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,UAAU,CAE7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAiB5D"}
@@ -26,6 +26,8 @@ exports.EntityType = {
26
26
  SCENERY: 'scenery',
27
27
  /** A directional exit (rarely used as entity) */
28
28
  EXIT: 'exit',
29
+ /** A physical adjacency between two rooms (ADR-173) */
30
+ WALL: 'wall',
29
31
  /** A geographic grouping of rooms (ADR-149) */
30
32
  REGION: 'region',
31
33
  /** A temporal phase of the story (ADR-149) */
@@ -53,6 +55,7 @@ function getEntityTypePrefix(type) {
53
55
  [exports.EntityType.SUPPORTER]: 's',
54
56
  [exports.EntityType.SCENERY]: 'y',
55
57
  [exports.EntityType.EXIT]: 'e',
58
+ [exports.EntityType.WALL]: 'w',
56
59
  [exports.EntityType.REGION]: 'rg',
57
60
  [exports.EntityType.SCENE]: 'sc',
58
61
  [exports.EntityType.OBJECT]: 'o'
@@ -1 +1 @@
1
- {"version":3,"file":"entity-types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":";;;AAiDA,oCAEC;AAMD,kDAgBC;AAzED;;;;;GAKG;AACU,QAAA,UAAU,GAAG;IACxB,mCAAmC;IACnC,IAAI,EAAE,MAAM;IAEZ,wCAAwC;IACxC,IAAI,EAAE,MAAM;IAEZ,gCAAgC;IAChC,IAAI,EAAE,MAAM;IAEZ,kCAAkC;IAClC,KAAK,EAAE,OAAO;IAEd,+CAA+C;IAC/C,SAAS,EAAE,WAAW;IAEtB,sDAAsD;IACtD,SAAS,EAAE,WAAW;IAEtB,mDAAmD;IACnD,OAAO,EAAE,SAAS;IAElB,iDAAiD;IACjD,IAAI,EAAE,MAAM;IAEZ,+CAA+C;IAC/C,MAAM,EAAE,QAAQ;IAEhB,8CAA8C;IAC9C,KAAK,EAAE,OAAO;IAEd,oCAAoC;IACpC,MAAM,EAAE,QAAQ;CACR,CAAC;AAOX;;GAEG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,MAAM,CAAC,MAAM,CAAC,kBAAU,CAAC,CAAC,QAAQ,CAAC,IAAkB,CAAC,CAAC;AAChE,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAAgB;IAClD,MAAM,SAAS,GAA+B;QAC5C,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,KAAK,CAAC,EAAE,GAAG;QACvB,CAAC,kBAAU,CAAC,SAAS,CAAC,EAAE,GAAG;QAC3B,CAAC,kBAAU,CAAC,SAAS,CAAC,EAAE,GAAG;QAC3B,CAAC,kBAAU,CAAC,OAAO,CAAC,EAAE,GAAG;QACzB,CAAC,kBAAU,CAAC,IAAI,CAAC,EAAE,GAAG;QACtB,CAAC,kBAAU,CAAC,MAAM,CAAC,EAAE,IAAI;QACzB,CAAC,kBAAU,CAAC,KAAK,CAAC,EAAE,IAAI;QACxB,CAAC,kBAAU,CAAC,MAAM,CAAC,EAAE,GAAG;KACzB,CAAC;IAEF,OAAO,SAAS,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"entity-types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/entity-types.ts"],"names":[],"mappings":";;;AAoDA,oCAEC;AAMD,kDAiBC;AA7ED;;;;;GAKG;AACU,QAAA,UAAU,GAAG;IACxB,mCAAmC;IACnC,IAAI,EAAE,MAAM;IAEZ,wCAAwC;IACxC,IAAI,EAAE,MAAM;IAEZ,gCAAgC;IAChC,IAAI,EAAE,MAAM;IAEZ,kCAAkC;IAClC,KAAK,EAAE,OAAO;IAEd,+CAA+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IFEntity } from './if-entity';
2
2
  export { EntityStore } from './entity-store';
3
3
  export { EntityType, isEntityType, getEntityTypePrefix } from './entity-types';
4
4
  export type { EntityType as EntityTypeValue } from './entity-types';
5
+ export { WallEntity } from './wall-entity';
6
+ export type { IWallEntity, IWallSideData, IWallSpec, IWallsSpec } from './wall-entity';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,YAAY,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC/E,YAAY,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
package/entities/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // packages/world-model/src/entities/index.ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getEntityTypePrefix = exports.isEntityType = exports.EntityType = exports.EntityStore = exports.IFEntity = void 0;
4
+ exports.WallEntity = exports.getEntityTypePrefix = exports.isEntityType = exports.EntityType = exports.EntityStore = exports.IFEntity = void 0;
5
5
  var if_entity_1 = require("./if-entity");
6
6
  Object.defineProperty(exports, "IFEntity", { enumerable: true, get: function () { return if_entity_1.IFEntity; } });
7
7
  var entity_store_1 = require("./entity-store");
@@ -10,4 +10,6 @@ var entity_types_1 = require("./entity-types");
10
10
  Object.defineProperty(exports, "EntityType", { enumerable: true, get: function () { return entity_types_1.EntityType; } });
11
11
  Object.defineProperty(exports, "isEntityType", { enumerable: true, get: function () { return entity_types_1.isEntityType; } });
12
12
  Object.defineProperty(exports, "getEntityTypePrefix", { enumerable: true, get: function () { return entity_types_1.getEntityTypePrefix; } });
13
+ var wall_entity_1 = require("./wall-entity");
14
+ Object.defineProperty(exports, "WallEntity", { enumerable: true, get: function () { return wall_entity_1.WallEntity; } });
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAE7C,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,+CAA+E;AAAtE,0GAAA,UAAU,OAAA;AAAE,4GAAA,YAAY,OAAA;AAAE,mHAAA,mBAAmB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/index.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAE7C,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,+CAA+E;AAAtE,0GAAA,UAAU,OAAA;AAAE,4GAAA,YAAY,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AAEtD,6CAA2C;AAAlC,yGAAA,UAAU,OAAA"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Wall entity primitive (ADR-173).
3
+ *
4
+ * A wall is an IFEntity-derived entity expressing a physical adjacency
5
+ * between exactly two distinct rooms. It carries whole-wall traits (the
6
+ * entity's regular trait map — symmetric properties of the wall as a
7
+ * physical object) and per-side data (asymmetric interface properties
8
+ * keyed by the room id you encounter the wall from).
9
+ *
10
+ * Public interface: `IWallSideData`, `IWallSpec`, `WallEntity`. Authors
11
+ * do not instantiate `WallEntity` directly — they use `WorldModel.createWall`,
12
+ * which constructs the entity, runs validation, and maintains reciprocal
13
+ * references on both rooms.
14
+ *
15
+ * Owner context: `@sharpee/world-model` — entities / spatial primitives.
16
+ */
17
+ import { EntityId, IEntityCreationParams } from "../../core/index";
18
+ import { IFEntity } from './if-entity';
19
+ import { ITrait } from '../traits/trait';
20
+ /**
21
+ * Per-side data for a wall (ADR-173).
22
+ *
23
+ * Keyed by the room id the player is in when looking at the wall.
24
+ */
25
+ export interface IWallSideData {
26
+ /**
27
+ * The adjective the parser uses to disambiguate this wall from other
28
+ * walls visible from the same room (e.g. 'oak', 'brick'). Required.
29
+ * Must be unique within any single room across all walls visible
30
+ * from that room.
31
+ */
32
+ adjective: string;
33
+ /**
34
+ * Optional per-side description, rendered when the player examines
35
+ * the wall from this side.
36
+ */
37
+ description?: string;
38
+ /**
39
+ * Optional reference to an entity that obstructs capability access
40
+ * to this side of the wall (e.g. a bookcase against the parlor side).
41
+ * Per ADR-173, the obstructor's own traits declare which capabilities
42
+ * it modifies (the "generalized obstructor protocol"). Must reference
43
+ * an entity that exists and is located in the appropriate room at
44
+ * world-load time; runtime evaluation re-checks the obstructor's
45
+ * current location.
46
+ */
47
+ obstructedBy?: EntityId;
48
+ }
49
+ /**
50
+ * Author-supplied specification for `WorldModel.createWall` (ADR-173).
51
+ *
52
+ * `between` is two distinct rooms (passed as either entities or ids).
53
+ * `whole` carries traits applied to the wall as a single object —
54
+ * symmetric properties (acoustic cost, structural material). `sides`
55
+ * carries the per-side data, keyed by each room's id.
56
+ */
57
+ export interface IWallSpec {
58
+ between: [IFEntity | EntityId, IFEntity | EntityId];
59
+ whole?: ITrait[];
60
+ sides: Record<EntityId, IWallSideData>;
61
+ }
62
+ /**
63
+ * Author-supplied specification for `WorldModel.createWalls` (ADR-173).
64
+ *
65
+ * Fans out into one wall entity per element of `to`. `sides` is a
66
+ * function called once per pair to produce that side's data; the
67
+ * caller is given the room id and may produce per-room-distinct
68
+ * adjectives or descriptions.
69
+ */
70
+ export interface IWallsSpec {
71
+ from: IFEntity | EntityId;
72
+ to: ReadonlyArray<IFEntity | EntityId>;
73
+ whole?: ITrait[];
74
+ sides: (roomId: EntityId) => IWallSideData;
75
+ }
76
+ /**
77
+ * IFEntity subclass for walls. Adds the `between` relation and the
78
+ * per-side data map. Whole-wall traits live on the entity's existing
79
+ * trait map (`entity.add(trait)`); per-side state is held here because
80
+ * it is keyed by room id rather than trait type.
81
+ */
82
+ export declare class WallEntity extends IFEntity {
83
+ /**
84
+ * The two rooms this wall borders. Exactly two distinct room ids.
85
+ * Invariant established by `WorldModel.createWall` and held for the
86
+ * wall's lifetime — there is no API to mutate `between`.
87
+ */
88
+ readonly between: [EntityId, EntityId];
89
+ /**
90
+ * Per-side data keyed by room id. Always has exactly the two keys in
91
+ * `between`; populated by `WorldModel.createWall`.
92
+ */
93
+ readonly sides: Map<EntityId, IWallSideData>;
94
+ constructor(id: string, between: [EntityId, EntityId], params?: Partial<IEntityCreationParams>);
95
+ /**
96
+ * Returns the per-side data for the side facing `roomId`, or undefined
97
+ * if `roomId` is not one of the wall's two rooms.
98
+ */
99
+ getSide(roomId: EntityId): IWallSideData | undefined;
100
+ /**
101
+ * Returns the id of the room on the other side of the wall from
102
+ * `roomId`, or undefined if `roomId` is not one of the wall's two
103
+ * rooms.
104
+ */
105
+ otherRoom(roomId: EntityId): EntityId | undefined;
106
+ }
107
+ /**
108
+ * `IWallEntity` is the structural shape consumers code against.
109
+ * `WallEntity` is the concrete class produced by `WorldModel.createWall`.
110
+ */
111
+ export type IWallEntity = WallEntity;
112
+ //# sourceMappingURL=wall-entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wall-entity.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/entities/wall-entity.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,CAAC,QAAQ,GAAG,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;IACpD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;CACxC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,EAAE,EAAE,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,aAAa,CAAC;CAC5C;AAED;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,QAAQ;IACtC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEvC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;gBAG3C,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC;IAOzC;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS;IAIpD;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS;CAKlD;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ // packages/world-model/src/entities/wall-entity.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.WallEntity = void 0;
5
+ const if_entity_1 = require("./if-entity");
6
+ /**
7
+ * IFEntity subclass for walls. Adds the `between` relation and the
8
+ * per-side data map. Whole-wall traits live on the entity's existing
9
+ * trait map (`entity.add(trait)`); per-side state is held here because
10
+ * it is keyed by room id rather than trait type.
11
+ */
12
+ class WallEntity extends if_entity_1.IFEntity {
13
+ /**
14
+ * The two rooms this wall borders. Exactly two distinct room ids.
15
+ * Invariant established by `WorldModel.createWall` and held for the
16
+ * wall's lifetime — there is no API to mutate `between`.
17
+ */
18
+ between;
19
+ /**
20
+ * Per-side data keyed by room id. Always has exactly the two keys in
21
+ * `between`; populated by `WorldModel.createWall`.
22
+ */
23
+ sides;
24
+ constructor(id, between, params) {
25
+ super(id, 'wall', params);
26
+ this.between = between;
27
+ this.sides = new Map();
28
+ }
29
+ /**
30
+ * Returns the per-side data for the side facing `roomId`, or undefined
31
+ * if `roomId` is not one of the wall's two rooms.
32
+ */
33
+ getSide(roomId) {
34
+ return this.sides.get(roomId);
35
+ }
36
+ /**
37
+ * Returns the id of the room on the other side of the wall from
38
+ * `roomId`, or undefined if `roomId` is not one of the wall's two
39
+ * rooms.
40
+ */
41
+ otherRoom(roomId) {
42
+ if (roomId === this.between[0])
43
+ return this.between[1];
44
+ if (roomId === this.between[1])
45
+ return this.between[0];
46
+ return undefined;
47
+ }
48
+ }
49
+ exports.WallEntity = WallEntity;
50
+ //# sourceMappingURL=wall-entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wall-entity.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/entities/wall-entity.ts"],"names":[],"mappings":";AAAA,mDAAmD;;;AAoBnD,2CAAuC;AAgEvC;;;;;GAKG;AACH,MAAa,UAAW,SAAQ,oBAAQ;IACtC;;;;OAIG;IACM,OAAO,CAAuB;IAEvC;;;OAGG;IACM,KAAK,CAA+B;IAE7C,YACE,EAAU,EACV,OAA6B,EAC7B,MAAuC;QAEvC,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,MAAgB;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,MAAgB;QACxB,IAAI,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACvD,IAAI,MAAM,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACvD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AA1CD,gCA0CC"}
package/index.d.ts CHANGED
@@ -33,6 +33,9 @@ export * from './traits/vehicle';
33
33
  export * from './traits/story-info';
34
34
  export * from './traits/character-model';
35
35
  export * from './traits/concealment';
36
+ export * from './traits/acoustic';
37
+ export * from './traits/listener';
38
+ export * from './traits/obstructor-protocol';
36
39
  export * from './extensions';
37
40
  export * from './world';
38
41
  export * from './scope';
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAG7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAG7C,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,gBAAgB,CAAC;AAG/B,cAAc,gBAAgB,CAAC;AAG/B,cAAc,eAAe,CAAC"}
package/index.js CHANGED
@@ -56,6 +56,9 @@ __exportStar(require("./traits/vehicle"), exports);
56
56
  __exportStar(require("./traits/story-info"), exports);
57
57
  __exportStar(require("./traits/character-model"), exports);
58
58
  __exportStar(require("./traits/concealment"), exports);
59
+ __exportStar(require("./traits/acoustic"), exports);
60
+ __exportStar(require("./traits/listener"), exports);
61
+ __exportStar(require("./traits/obstructor-protocol"), exports);
59
62
  // Extension system
60
63
  __exportStar(require("./extensions"), exports);
61
64
  // World model
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,6CAA2B;AAE3B,iBAAiB;AACjB,8CAA4B;AAE5B,YAAY;AACZ,8CAA4B;AAE5B,8CAA8C;AAC9C,6CAA2B;AAC3B,+CAA6B;AAE7B,SAAS;AACT,iDAA+B;AAC/B,uDAAqC;AACrC,2DAAyC;AAEzC,2BAA2B;AAC3B,oDAAkC;AAClC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,iDAA+B;AAC/B,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,4DAA0C;AAC1C,oDAAkC;AAClC,oDAAkC;AAClC,+CAA6B;AAC7B,mDAAiC;AACjC,sDAAoC;AACpC,2DAAyC;AACzC,uDAAqC;AAErC,mBAAmB;AACnB,+CAA6B;AAE7B,cAAc;AACd,0CAAwB;AAExB,eAAe;AACf,0CAAwB;AAExB,mFAAmF;AACnF,iDAA+B;AAE/B,uCAAuC;AACvC,iDAA+B;AAE/B,wBAAwB;AACxB,gDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/index.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;;;;;AAEpC,gBAAgB;AAChB,6CAA2B;AAE3B,iBAAiB;AACjB,8CAA4B;AAE5B,YAAY;AACZ,8CAA4B;AAE5B,8CAA8C;AAC9C,6CAA2B;AAC3B,+CAA6B;AAE7B,SAAS;AACT,iDAA+B;AAC/B,uDAAqC;AACrC,2DAAyC;AAEzC,2BAA2B;AAC3B,oDAAkC;AAClC,qDAAmC;AACnC,gDAA8B;AAC9B,oDAAkC;AAClC,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,gDAA8B;AAC9B,qDAAmC;AACnC,mDAAiC;AACjC,qDAAmC;AACnC,sDAAoC;AACpC,oDAAkC;AAClC,kDAAgC;AAChC,gDAA8B;AAC9B,iDAA+B;AAC/B,oDAAkC;AAClC,kDAAgC;AAChC,oDAAkC;AAClC,4DAA0C;AAC1C,oDAAkC;AAClC,oDAAkC;AAClC,+CAA6B;AAC7B,mDAAiC;AACjC,sDAAoC;AACpC,2DAAyC;AACzC,uDAAqC;AACrC,oDAAkC;AAClC,oDAAkC;AAClC,+DAA6C;AAE7C,mBAAmB;AACnB,+CAA6B;AAE7B,cAAc;AACd,0CAAwB;AAExB,eAAe;AACf,0CAAwB;AAExB,mFAAmF;AACnF,iDAA+B;AAE/B,uCAAuC;AACvC,iDAA+B;AAE/B,wBAAwB;AACxB,gDAA8B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/world-model",
3
- "version": "0.9.113",
3
+ "version": "1.0.0",
4
4
  "description": "World model for Sharpee IF platform - entities, traits, and behaviors",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,8 +12,8 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^0.9.113",
16
- "@sharpee/if-domain": "^0.9.113"
15
+ "@sharpee/core": "^1.0.0",
16
+ "@sharpee/if-domain": "^1.0.0"
17
17
  },
18
18
  "keywords": [
19
19
  "interactive-fiction",
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Acoustic dampener trait — obstructor-side sound-cost contribution
3
+ * (ADR-172). Attaches to entities (tapestries, peepholes, foam panels,
4
+ * heavy curtains) that, when referenced as a wall side's obstructor
5
+ * (via `IWallSideData.obstructedBy` per ADR-173), modify the wall's
6
+ * effective acoustic cost.
7
+ *
8
+ * Per ADR-173's generalized obstructor protocol, the wall does *not*
9
+ * hardcode rules about what obstructors do; the obstructor's own
10
+ * traits declare which capabilities it modifies. `AcousticDampenerTrait`
11
+ * is the first capability-specific obstructor trait (ADR-172); future
12
+ * capabilities (visual line-of-sight, olfactory, thermal) ship sibling
13
+ * traits via the same protocol without changes to wall-substrate code.
14
+ *
15
+ * Sign convention:
16
+ * - **Positive** `contribution` adds to the wall's effective cost
17
+ * (dampens — tapestry, foam panel, heavy curtain).
18
+ * - **Negative** `contribution` subtracts from the wall's effective
19
+ * cost (more permeable — peephole, hole, vent opening).
20
+ *
21
+ * Phase 2 ships only the trait shape. The wall's effective acoustic
22
+ * cost is computed by the propagation algorithm in `@sharpee/engine`
23
+ * (Phase 3), which consults this trait via the obstructor-protocol
24
+ * helpers shipped in ADR-173 Phase 5.
25
+ *
26
+ * Owner context: `@sharpee/world-model` — wall / spatial primitives.
27
+ *
28
+ * @see ADR-172 — Spatial Sound Propagation
29
+ * @see ADR-173 — Wall Adjacency Primitive (obstructor protocol)
30
+ */
31
+ import { ITrait } from '../trait';
32
+ /**
33
+ * Acoustic dampener trait — attaches to obstructor entities (tapestry,
34
+ * peephole, foam panel, heavy curtain).
35
+ *
36
+ * @example
37
+ * const tapestry = author.createEntity('tapestry', EntityType.OBJECT);
38
+ * tapestry.add(new AcousticDampenerTrait(2)); // +2 dampening
39
+ * author.moveEntity(tapestry.id, parlor.id);
40
+ *
41
+ * world.createWall({
42
+ * between: [parlor, library],
43
+ * sides: {
44
+ * [parlor.id]: { adjective: 'oak', obstructedBy: tapestry.id },
45
+ * [library.id]: { adjective: 'brick' },
46
+ * },
47
+ * });
48
+ */
49
+ export declare class AcousticDampenerTrait implements ITrait {
50
+ readonly contribution: number;
51
+ static readonly type: "if.trait.acoustic_dampener";
52
+ /**
53
+ * Per ADR-173 taxonomy. Documentation only — not enforced; obstructors
54
+ * are referenced by the wall's per-side `obstructedBy` and located by
55
+ * room at query time per the ADR-173 obstructor protocol.
56
+ */
57
+ static readonly slot = "obstructor";
58
+ readonly type: "if.trait.acoustic_dampener";
59
+ constructor(contribution: number);
60
+ }
61
+ //# sourceMappingURL=acousticDampenerTrait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acousticDampenerTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticDampenerTrait.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,qBAAsB,YAAW,MAAM;aAUtB,YAAY,EAAE,MAAM;IAThD,MAAM,CAAC,QAAQ,CAAC,IAAI,+BAA+B;IACnD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB;IACpC,QAAQ,CAAC,IAAI,+BAA+B;gBAEhB,YAAY,EAAE,MAAM;CACjD"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ // packages/world-model/src/traits/acoustic/acousticDampenerTrait.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AcousticDampenerTrait = void 0;
5
+ const trait_types_1 = require("../trait-types");
6
+ /**
7
+ * Acoustic dampener trait — attaches to obstructor entities (tapestry,
8
+ * peephole, foam panel, heavy curtain).
9
+ *
10
+ * @example
11
+ * const tapestry = author.createEntity('tapestry', EntityType.OBJECT);
12
+ * tapestry.add(new AcousticDampenerTrait(2)); // +2 dampening
13
+ * author.moveEntity(tapestry.id, parlor.id);
14
+ *
15
+ * world.createWall({
16
+ * between: [parlor, library],
17
+ * sides: {
18
+ * [parlor.id]: { adjective: 'oak', obstructedBy: tapestry.id },
19
+ * [library.id]: { adjective: 'brick' },
20
+ * },
21
+ * });
22
+ */
23
+ class AcousticDampenerTrait {
24
+ contribution;
25
+ static type = trait_types_1.TraitType.ACOUSTIC_DAMPENER;
26
+ /**
27
+ * Per ADR-173 taxonomy. Documentation only — not enforced; obstructors
28
+ * are referenced by the wall's per-side `obstructedBy` and located by
29
+ * room at query time per the ADR-173 obstructor protocol.
30
+ */
31
+ static slot = 'obstructor';
32
+ type = trait_types_1.TraitType.ACOUSTIC_DAMPENER;
33
+ constructor(contribution) {
34
+ this.contribution = contribution;
35
+ }
36
+ }
37
+ exports.AcousticDampenerTrait = AcousticDampenerTrait;
38
+ //# sourceMappingURL=acousticDampenerTrait.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acousticDampenerTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticDampenerTrait.ts"],"names":[],"mappings":";AAAA,oEAAoE;;;AAkCpE,gDAA2C;AAE3C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,qBAAqB;IAUJ;IAT5B,MAAM,CAAU,IAAI,GAAG,uBAAS,CAAC,iBAAiB,CAAC;IACnD;;;;OAIG;IACH,MAAM,CAAU,IAAI,GAAG,YAAY,CAAC;IAC3B,IAAI,GAAG,uBAAS,CAAC,iBAAiB,CAAC;IAE5C,YAA4B,YAAoB;QAApB,iBAAY,GAAZ,YAAY,CAAQ;IAAG,CAAC;;AAVtD,sDAWC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Acoustic trait — wall-intrinsic sound-cost data (ADR-172).
3
+ *
4
+ * Per ADR-173's whole-wall-vs-per-side trait taxonomy, a wall's *base*
5
+ * acoustic cost (the contribution of its material — plaster vs masonry
6
+ * vs soundproof panel) is symmetric from both sides. It lives in the
7
+ * whole-wall slot: attached to the wall entity itself, not to either
8
+ * side's per-side data.
9
+ *
10
+ * Per-side dampening (a tapestry covering one face, a peephole drilled
11
+ * through one face) lives on the *obstructor* entity and uses
12
+ * `AcousticDampenerTrait` (the per-side capability-specific obstructor
13
+ * trait per ADR-173's generalized obstructor protocol).
14
+ *
15
+ * Phase 2 ships only the trait shape and its tier→cost table. The
16
+ * propagation algorithm in `@sharpee/engine` (Phase 3) consumes
17
+ * `ACOUSTIC_TIER_COSTS`.
18
+ *
19
+ * Owner context: `@sharpee/world-model` — wall / spatial primitives.
20
+ *
21
+ * @see ADR-172 — Spatial Sound Propagation
22
+ * @see ADR-173 — Wall Adjacency Primitive (taxonomy)
23
+ */
24
+ import { ITrait } from '../trait';
25
+ /**
26
+ * The four discrete acoustic tiers a wall material may have. Authored
27
+ * qualitatively at world-load time; the propagation algorithm reads the
28
+ * cost via `ACOUSTIC_TIER_COSTS`.
29
+ */
30
+ export type AcousticTier = 'thin' | 'default' | 'thick' | 'soundproof';
31
+ /**
32
+ * Platform-default acoustic costs per wall tier, in path-cost units
33
+ * (ADR-172). Walls without an explicit `AcousticTrait` resolve to
34
+ * `default`.
35
+ *
36
+ * `Infinity` for `soundproof` collapses to `silent` audibility through
37
+ * the standard clarity formula (`clarity = budget − cost`) without the
38
+ * propagation algorithm needing a special case.
39
+ */
40
+ export declare const ACOUSTIC_TIER_COSTS: Readonly<Record<AcousticTier, number>>;
41
+ /**
42
+ * Acoustic trait — attaches to wall entities to declare their intrinsic
43
+ * acoustic cost tier. Whole-wall (symmetric) per ADR-173 taxonomy.
44
+ *
45
+ * @example
46
+ * world.createWall({
47
+ * between: [parlor, library],
48
+ * whole: [new AcousticTrait('thick')],
49
+ * sides: { ... }
50
+ * });
51
+ */
52
+ export declare class AcousticTrait implements ITrait {
53
+ readonly tier: AcousticTier;
54
+ static readonly type: "if.trait.acoustic";
55
+ /**
56
+ * Per ADR-173 taxonomy. Documentation only — not enforced; the wall
57
+ * creation API simply attaches whole-wall traits via `wall.add()`
58
+ * and per-side data via `wall.sides`.
59
+ */
60
+ static readonly slot = "whole-wall";
61
+ readonly type: "if.trait.acoustic";
62
+ constructor(tier: AcousticTier);
63
+ }
64
+ //# sourceMappingURL=acousticTrait.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acousticTrait.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticTrait.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAKrE,CAAC;AAEH;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,YAAW,MAAM;aAUd,IAAI,EAAE,YAAY;IAT9C,MAAM,CAAC,QAAQ,CAAC,IAAI,sBAAsB;IAC1C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB;IACpC,QAAQ,CAAC,IAAI,sBAAsB;gBAEP,IAAI,EAAE,YAAY;CAC/C"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ // packages/world-model/src/traits/acoustic/acousticTrait.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AcousticTrait = exports.ACOUSTIC_TIER_COSTS = void 0;
5
+ const trait_types_1 = require("../trait-types");
6
+ /**
7
+ * Platform-default acoustic costs per wall tier, in path-cost units
8
+ * (ADR-172). Walls without an explicit `AcousticTrait` resolve to
9
+ * `default`.
10
+ *
11
+ * `Infinity` for `soundproof` collapses to `silent` audibility through
12
+ * the standard clarity formula (`clarity = budget − cost`) without the
13
+ * propagation algorithm needing a special case.
14
+ */
15
+ exports.ACOUSTIC_TIER_COSTS = Object.freeze({
16
+ thin: 2,
17
+ default: 4,
18
+ thick: 6,
19
+ soundproof: Number.POSITIVE_INFINITY,
20
+ });
21
+ /**
22
+ * Acoustic trait — attaches to wall entities to declare their intrinsic
23
+ * acoustic cost tier. Whole-wall (symmetric) per ADR-173 taxonomy.
24
+ *
25
+ * @example
26
+ * world.createWall({
27
+ * between: [parlor, library],
28
+ * whole: [new AcousticTrait('thick')],
29
+ * sides: { ... }
30
+ * });
31
+ */
32
+ class AcousticTrait {
33
+ tier;
34
+ static type = trait_types_1.TraitType.ACOUSTIC;
35
+ /**
36
+ * Per ADR-173 taxonomy. Documentation only — not enforced; the wall
37
+ * creation API simply attaches whole-wall traits via `wall.add()`
38
+ * and per-side data via `wall.sides`.
39
+ */
40
+ static slot = 'whole-wall';
41
+ type = trait_types_1.TraitType.ACOUSTIC;
42
+ constructor(tier) {
43
+ this.tier = tier;
44
+ }
45
+ }
46
+ exports.AcousticTrait = AcousticTrait;
47
+ //# sourceMappingURL=acousticTrait.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acousticTrait.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/acousticTrait.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;AA2B5D,gDAA2C;AAS3C;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAA2C,MAAM,CAAC,MAAM,CAAC;IACvF,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,MAAM,CAAC,iBAAiB;CACrC,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IAUI;IAT5B,MAAM,CAAU,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;IAC1C;;;;OAIG;IACH,MAAM,CAAU,IAAI,GAAG,YAAY,CAAC;IAC3B,IAAI,GAAG,uBAAS,CAAC,QAAQ,CAAC;IAEnC,YAA4B,IAAkB;QAAlB,SAAI,GAAJ,IAAI,CAAc;IAAG,CAAC;;AAVpD,sCAWC"}
@@ -0,0 +1,3 @@
1
+ export { AcousticTrait, ACOUSTIC_TIER_COSTS, type AcousticTier } from './acousticTrait';
2
+ export { AcousticDampenerTrait } from './acousticDampenerTrait';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // packages/world-model/src/traits/acoustic/index.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AcousticDampenerTrait = exports.ACOUSTIC_TIER_COSTS = exports.AcousticTrait = void 0;
5
+ var acousticTrait_1 = require("./acousticTrait");
6
+ Object.defineProperty(exports, "AcousticTrait", { enumerable: true, get: function () { return acousticTrait_1.AcousticTrait; } });
7
+ Object.defineProperty(exports, "ACOUSTIC_TIER_COSTS", { enumerable: true, get: function () { return acousticTrait_1.ACOUSTIC_TIER_COSTS; } });
8
+ var acousticDampenerTrait_1 = require("./acousticDampenerTrait");
9
+ Object.defineProperty(exports, "AcousticDampenerTrait", { enumerable: true, get: function () { return acousticDampenerTrait_1.AcousticDampenerTrait; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/world-model/src/traits/acoustic/index.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;AAEpD,iDAAwF;AAA/E,8GAAA,aAAa,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC3C,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"implementations.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/traits/implementations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD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ACd,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EAGZ,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,gBAAgB,EAGhB,SAAS,EACT,WAAW,EACX,UAAU,EAGV,UAAU,EAGV,SAAS,EACT,cAAc,EAGd,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,oBAAoB,EAGpB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EAGb,QAAQ,EACR,kBAAkB,EAGlB,mBAAmB,EAGnB,YAAY,EACZ,cAAc,EAGd,cAAc,EAGf,CAAC"}
1
+ {"version":3,"file":"implementations.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/traits/implementations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,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CAAC,SAAS,EAAE,iBAAiB,CAyEtE,CAAC;AAEF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAErF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,YAAY,CAAC,iBAAiB,CAAC,CAMxF;AAGD,OAAO,EAEL,aAAa,EACb,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EAGZ,aAAa,EACb,aAAa,EACb,eAAe,EACf,aAAa,EACb,gBAAgB,EAGhB,SAAS,EACT,WAAW,EACX,UAAU,EAGV,UAAU,EAGV,SAAS,EACT,cAAc,EAGd,aAAa,EACb,aAAa,EACb,aAAa,EACb,WAAW,EACX,oBAAoB,EAGpB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EAGb,QAAQ,EACR,kBAAkB,EAGlB,mBAAmB,EAGnB,YAAY,EACZ,cAAc,EAGd,cAAc,EAGf,CAAC"}
@@ -89,6 +89,10 @@ Object.defineProperty(exports, "EnterableTrait", { enumerable: true, get: functi
89
89
  // Concealment traits (ADR-148)
90
90
  const concealmentTrait_1 = require("./concealment/concealmentTrait");
91
91
  const concealedStateTrait_1 = require("./concealment/concealedStateTrait");
92
+ // Spatial sound traits (ADR-172)
93
+ const acousticTrait_1 = require("./acoustic/acousticTrait");
94
+ const acousticDampenerTrait_1 = require("./acoustic/acousticDampenerTrait");
95
+ const listenerTrait_1 = require("./listener/listenerTrait");
92
96
  // System traits
93
97
  const storyInfoTrait_1 = require("./story-info/storyInfoTrait");
94
98
  Object.defineProperty(exports, "StoryInfoTrait", { enumerable: true, get: function () { return storyInfoTrait_1.StoryInfoTrait; } });
@@ -143,6 +147,10 @@ exports.TRAIT_IMPLEMENTATIONS = {
143
147
  // Concealment traits (ADR-148)
144
148
  [trait_types_1.TraitType.CONCEALMENT]: concealmentTrait_1.ConcealmentTrait,
145
149
  [trait_types_1.TraitType.CONCEALED_STATE]: concealedStateTrait_1.ConcealedStateTrait,
150
+ // Spatial sound traits (ADR-172)
151
+ [trait_types_1.TraitType.ACOUSTIC]: acousticTrait_1.AcousticTrait,
152
+ [trait_types_1.TraitType.ACOUSTIC_DAMPENER]: acousticDampenerTrait_1.AcousticDampenerTrait,
153
+ [trait_types_1.TraitType.LISTENER]: listenerTrait_1.ListenerTrait,
146
154
  // System traits
147
155
  [trait_types_1.TraitType.STORY_INFO]: storyInfoTrait_1.StoryInfoTrait,
148
156
  // Object property traits