@sharpee/stdlib 2.0.0 → 2.1.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 (55) hide show
  1. package/actions/capability-dispatch.d.ts.map +1 -1
  2. package/actions/capability-dispatch.js +2 -2
  3. package/actions/capability-dispatch.js.map +1 -1
  4. package/actions/standard/attacking/attacking.d.ts.map +1 -1
  5. package/actions/standard/attacking/attacking.js +1 -1
  6. package/actions/standard/attacking/attacking.js.map +1 -1
  7. package/actions/standard/closing/closing.js +1 -1
  8. package/actions/standard/closing/closing.js.map +1 -1
  9. package/actions/standard/dropping/dropping.d.ts.map +1 -1
  10. package/actions/standard/dropping/dropping.js +1 -1
  11. package/actions/standard/dropping/dropping.js.map +1 -1
  12. package/actions/standard/entering/entering.d.ts.map +1 -1
  13. package/actions/standard/entering/entering.js +1 -1
  14. package/actions/standard/entering/entering.js.map +1 -1
  15. package/actions/standard/giving/giving.d.ts.map +1 -1
  16. package/actions/standard/giving/giving.js +1 -1
  17. package/actions/standard/giving/giving.js.map +1 -1
  18. package/actions/standard/going/going.d.ts.map +1 -1
  19. package/actions/standard/going/going.js +2 -2
  20. package/actions/standard/going/going.js.map +1 -1
  21. package/actions/standard/help/help.d.ts.map +1 -1
  22. package/actions/standard/help/help.js +23 -12
  23. package/actions/standard/help/help.js.map +1 -1
  24. package/actions/standard/hiding/hiding.d.ts.map +1 -1
  25. package/actions/standard/hiding/hiding.js +8 -0
  26. package/actions/standard/hiding/hiding.js.map +1 -1
  27. package/actions/standard/lowering/lowering.d.ts +4 -3
  28. package/actions/standard/lowering/lowering.d.ts.map +1 -1
  29. package/actions/standard/lowering/lowering.js +4 -3
  30. package/actions/standard/lowering/lowering.js.map +1 -1
  31. package/actions/standard/opening/opening.js +1 -1
  32. package/actions/standard/opening/opening.js.map +1 -1
  33. package/actions/standard/pushing/pushing.d.ts.map +1 -1
  34. package/actions/standard/pushing/pushing.js +1 -1
  35. package/actions/standard/pushing/pushing.js.map +1 -1
  36. package/actions/standard/putting/putting.d.ts.map +1 -1
  37. package/actions/standard/putting/putting.js +1 -1
  38. package/actions/standard/putting/putting.js.map +1 -1
  39. package/actions/standard/raising/raising.d.ts +2 -1
  40. package/actions/standard/raising/raising.d.ts.map +1 -1
  41. package/actions/standard/raising/raising.js +2 -1
  42. package/actions/standard/raising/raising.js.map +1 -1
  43. package/actions/standard/switching_on/switching_on.d.ts.map +1 -1
  44. package/actions/standard/switching_on/switching_on.js +15 -15
  45. package/actions/standard/switching_on/switching_on.js.map +1 -1
  46. package/actions/standard/taking/taking.js +1 -1
  47. package/actions/standard/taking/taking.js.map +1 -1
  48. package/actions/standard/throwing/throwing.d.ts.map +1 -1
  49. package/actions/standard/throwing/throwing.js +2 -2
  50. package/actions/standard/throwing/throwing.js.map +1 -1
  51. package/package.json +7 -7
  52. package/utils/entity-info.d.ts +0 -45
  53. package/utils/entity-info.d.ts.map +0 -1
  54. package/utils/entity-info.js +0 -71
  55. package/utils/entity-info.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/stdlib",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Standard library for Sharpee IF Platform - actions, commands, and game mechanics",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,12 +12,12 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^2.0.0",
16
- "@sharpee/if-domain": "^2.0.0",
17
- "@sharpee/if-services": "^2.0.0",
18
- "@sharpee/lang-en-us": "^2.0.0",
19
- "@sharpee/text-blocks": "^2.0.0",
20
- "@sharpee/world-model": "^2.0.0"
15
+ "@sharpee/core": "^2.1.0",
16
+ "@sharpee/if-domain": "^2.1.0",
17
+ "@sharpee/if-services": "^2.1.0",
18
+ "@sharpee/lang-en-us": "^2.1.0",
19
+ "@sharpee/text-blocks": "^2.1.0",
20
+ "@sharpee/world-model": "^2.1.0"
21
21
  },
22
22
  "keywords": [
23
23
  "interactive-fiction",
@@ -1,45 +0,0 @@
1
- /**
2
- * @file entity-info.ts
3
- * @module @sharpee/stdlib/utils
4
- *
5
- * Bridges world-model's `IFEntity` to lang-en-us's `EntityInfo` so that
6
- * message templates using formatter chains (`{the:cap:item}`, `{a:item}`,
7
- * `{some:item}`) receive the metadata they need to choose articles correctly.
8
- *
9
- * Per ADR-158: stdlib actions and capability behaviors must populate
10
- * entity-valued message parameters with `EntityInfo` (built via this helper),
11
- * not with bare entity names. The helper lives in stdlib because stdlib is
12
- * the only package depending on both `@sharpee/world-model` (source of
13
- * `IFEntity`) and `@sharpee/lang-en-us` (source of `EntityInfo`).
14
- *
15
- * @see ADR-158 Entity-Valued Message Params Carry EntityInfo
16
- * @see ADR-095 Message Templates with Formatters
17
- */
18
- import type { EntityInfo } from '@sharpee/lang-en-us';
19
- import { IFEntity } from '@sharpee/world-model';
20
- /**
21
- * Build an `EntityInfo` from an `IFEntity` for use as a message-template
22
- * parameter value.
23
- *
24
- * Reads `IdentityTrait` fields and projects them onto the formatter's
25
- * consumption shape. If the entity has no `IdentityTrait`, returns a minimal
26
- * `{ name }` so callers do not need null guards — the `the` formatter will
27
- * fall back to "the {name}" as before.
28
- *
29
- * @param entity - Any IFEntity. Typically the noun, container, target, etc.
30
- * from an action's `ValidatedCommand` or capability behavior.
31
- * @returns An `EntityInfo` consumable by `theFormatter`, `aFormatter`,
32
- * `someFormatter`, and the `:cap` chain.
33
- *
34
- * @example
35
- * // In an action's report() phase:
36
- * return {
37
- * valid: false,
38
- * error: TakingMessages.FIXED_IN_PLACE,
39
- * params: { item: entityInfoFrom(noun) }
40
- * };
41
- * // Template: "{the:cap:item} is fixed in place."
42
- * // Renders: "The white house is fixed in place."
43
- */
44
- export declare function entityInfoFrom(entity: IFEntity): EntityInfo;
45
- //# sourceMappingURL=entity-info.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-info.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/stdlib/src/utils/entity-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAA4B,MAAM,sBAAsB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,CA4B3D"}
@@ -1,71 +0,0 @@
1
- "use strict";
2
- /**
3
- * @file entity-info.ts
4
- * @module @sharpee/stdlib/utils
5
- *
6
- * Bridges world-model's `IFEntity` to lang-en-us's `EntityInfo` so that
7
- * message templates using formatter chains (`{the:cap:item}`, `{a:item}`,
8
- * `{some:item}`) receive the metadata they need to choose articles correctly.
9
- *
10
- * Per ADR-158: stdlib actions and capability behaviors must populate
11
- * entity-valued message parameters with `EntityInfo` (built via this helper),
12
- * not with bare entity names. The helper lives in stdlib because stdlib is
13
- * the only package depending on both `@sharpee/world-model` (source of
14
- * `IFEntity`) and `@sharpee/lang-en-us` (source of `EntityInfo`).
15
- *
16
- * @see ADR-158 Entity-Valued Message Params Carry EntityInfo
17
- * @see ADR-095 Message Templates with Formatters
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.entityInfoFrom = entityInfoFrom;
21
- const world_model_1 = require("@sharpee/world-model");
22
- /**
23
- * Build an `EntityInfo` from an `IFEntity` for use as a message-template
24
- * parameter value.
25
- *
26
- * Reads `IdentityTrait` fields and projects them onto the formatter's
27
- * consumption shape. If the entity has no `IdentityTrait`, returns a minimal
28
- * `{ name }` so callers do not need null guards — the `the` formatter will
29
- * fall back to "the {name}" as before.
30
- *
31
- * @param entity - Any IFEntity. Typically the noun, container, target, etc.
32
- * from an action's `ValidatedCommand` or capability behavior.
33
- * @returns An `EntityInfo` consumable by `theFormatter`, `aFormatter`,
34
- * `someFormatter`, and the `:cap` chain.
35
- *
36
- * @example
37
- * // In an action's report() phase:
38
- * return {
39
- * valid: false,
40
- * error: TakingMessages.FIXED_IN_PLACE,
41
- * params: { item: entityInfoFrom(noun) }
42
- * };
43
- * // Template: "{the:cap:item} is fixed in place."
44
- * // Renders: "The white house is fixed in place."
45
- */
46
- function entityInfoFrom(entity) {
47
- if (!entity.has(world_model_1.TraitType.IDENTITY)) {
48
- return { name: entity.name };
49
- }
50
- const identity = entity.get(world_model_1.TraitType.IDENTITY);
51
- const info = {
52
- name: identity.name || entity.name,
53
- };
54
- if (identity.nounType !== undefined) {
55
- info.nounType = identity.nounType;
56
- }
57
- if (identity.properName) {
58
- info.properName = true;
59
- }
60
- if (identity.article) {
61
- info.article = identity.article;
62
- }
63
- if (identity.grammaticalNumber !== undefined) {
64
- info.grammaticalNumber = identity.grammaticalNumber;
65
- }
66
- if (identity.plural) {
67
- info.plural = identity.plural;
68
- }
69
- return info;
70
- }
71
- //# sourceMappingURL=entity-info.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"entity-info.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/stdlib/src/utils/entity-info.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AA6BH,wCA4BC;AAtDD,sDAA0E;AAE1E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,cAAc,CAAC,MAAgB;IAC7C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAS,CAAC,QAAQ,CAAkB,CAAC;IAEjE,MAAM,IAAI,GAAe;QACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI;KACnC,CAAC;IAEF,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACpC,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IAClC,CAAC;IACD,IAAI,QAAQ,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;QAC7C,IAAI,CAAC,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC;IACtD,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}