@onlyworlds/sdk 4.167.1 → 4.169.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.
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +16 -0
- package/SCHEMA.md +1 -1
- package/dist/{chunk-LHFKNEC4.js → chunk-MLVYQ5XG.js} +40 -36
- package/dist/index.d.ts +180 -125
- package/dist/index.js +59 -2
- package/dist/waymark.js +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# For AI agents using @onlyworlds/sdk
|
|
2
2
|
|
|
3
|
-
**Current as of**: SDK **4.x** · schema-dist **v0.34.1-dist.
|
|
3
|
+
**Current as of**: SDK **4.x** · schema-dist **v0.34.1-dist.129** (canonical 00.34.01).
|
|
4
4
|
This line is asserted by `codegen:check` in CI — if the pin moves and this file is not
|
|
5
5
|
re-read against it, the check fails rather than letting this document rot quietly.
|
|
6
6
|
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.169.0] - 2026-11-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `readReportLine(line, { world })` and `readReportLines(text, { world })`: a line of a report's `consequences` as the report profile reads it. The line's address is the last one that names an element of this world (`address`, written `ow://<type>/<id>`, with its `reading`, `start` and `end`), and `words` is what a reader shows: the line without its address when nothing the writer wrote is lost (canonical, no moment, no lens, standing apart), else the whole line. `readReportLines` splits a text at every carriage return and line feed and trims each line of White_Space. Both packages are held to the report profile's second fixture, `profiles/report-lines.fixture.json` (101 lines and 16 texts), byte for byte.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **The schema pin moves to `v0.34.1-dist.129`** (canonical 00.34.01 unchanged; no schema file moved): the report profile's rule 10, a line of `consequences` read in three parts, and its second fixture.
|
|
17
|
+
|
|
18
|
+
## [4.168.0] - 2026-11-14
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `DECLARED_LINKS`: the extension fields a published profile reads as links, each a list of ids in this world (`x_lens_leads_to`, `x_spine_depends_on`), the list `worldGraph` draws edges from. A writer that builds one of these lists names each element once, as the folder format 0.3.24 says of a multi-link, and can read the fields from here rather than copy them. A test holds it to the list schema-dist's own folder lint reads (`LINK_EXTENSIONS`), so a serial that grows the list reaches the package at its repin.
|
|
23
|
+
|
|
8
24
|
## [4.167.1] - 2026-11-14
|
|
9
25
|
|
|
10
26
|
### Fixed
|
package/SCHEMA.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# OnlyWorlds Schema Reference
|
|
2
2
|
|
|
3
|
-
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.34.1-dist.
|
|
3
|
+
**Source**: https://github.com/OnlyWorlds/schema-dist @ **v0.34.1-dist.129** — canonical schema **00.34.01**, published 2026-11-15.
|
|
4
4
|
|
|
5
5
|
GENERATED from the canonical schema YAML — do not hand-edit (regenerate: `python codegen/generate_types.py`).
|
|
6
6
|
Written for both humans and AI agents reading this package locally.
|
|
@@ -1122,6 +1122,9 @@ function trimWhiteSpace(text) {
|
|
|
1122
1122
|
while (end > start && WHITE_SPACE.has(text.charCodeAt(end - 1))) end--;
|
|
1123
1123
|
return text.slice(start, end);
|
|
1124
1124
|
}
|
|
1125
|
+
function isWhiteSpaceAt(text, i) {
|
|
1126
|
+
return i >= 0 && i < text.length && WHITE_SPACE.has(text.charCodeAt(i));
|
|
1127
|
+
}
|
|
1125
1128
|
var fold = (text) => simpleCaseFold(trimWhiteSpace(text));
|
|
1126
1129
|
function hasMark(el, field) {
|
|
1127
1130
|
const mark = Object.prototype.hasOwnProperty.call(el, field) ? el[field] : void 0;
|
|
@@ -1189,41 +1192,6 @@ function handsOnAsProposed(element) {
|
|
|
1189
1192
|
return isPresent(element[PROPOSED_MARK]);
|
|
1190
1193
|
}
|
|
1191
1194
|
|
|
1192
|
-
// src/names.ts
|
|
1193
|
-
var SLUGS = new Set(ELEMENT_TYPES);
|
|
1194
|
-
var OPTION_KEYS = ["supertype", "many"];
|
|
1195
|
-
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1196
|
-
function word(pair, many) {
|
|
1197
|
-
if (!isObject(pair) || typeof pair.one !== "string") return null;
|
|
1198
|
-
const one = trimWhiteSpace(pair.one);
|
|
1199
|
-
if (one === "") return null;
|
|
1200
|
-
if (!many) return one;
|
|
1201
|
-
const plural = typeof pair.many === "string" ? trimWhiteSpace(pair.many) : "";
|
|
1202
|
-
return plural === "" ? one : plural;
|
|
1203
|
-
}
|
|
1204
|
-
function typeWord(world, type, opts = {}) {
|
|
1205
|
-
refuseUnknownOptions("typeWord", opts, OPTION_KEYS);
|
|
1206
|
-
const map = world?.x_names;
|
|
1207
|
-
if (!isObject(map) || map.version !== 1) return null;
|
|
1208
|
-
const { types, supertypes } = map;
|
|
1209
|
-
if (types !== void 0 && !isObject(types)) return null;
|
|
1210
|
-
if (supertypes !== void 0) {
|
|
1211
|
-
if (!isObject(supertypes)) return null;
|
|
1212
|
-
for (const inner of Object.values(supertypes)) if (!isObject(inner)) return null;
|
|
1213
|
-
}
|
|
1214
|
-
if (!SLUGS.has(type)) return null;
|
|
1215
|
-
const many = opts.many === true;
|
|
1216
|
-
const supertype = typeof opts.supertype === "string" ? fold(opts.supertype) : "";
|
|
1217
|
-
if (supertype !== "" && isObject(supertypes) && isObject(supertypes[type])) {
|
|
1218
|
-
for (const [key, pair] of Object.entries(supertypes[type])) {
|
|
1219
|
-
if (fold(key) !== supertype) continue;
|
|
1220
|
-
const w = word(pair, many);
|
|
1221
|
-
if (w !== null) return w;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
return isObject(types) ? word(types[type], many) : null;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
1195
|
// src/address.ts
|
|
1228
1196
|
var MESSAGES = {
|
|
1229
1197
|
not_an_address: "not an address: it starts with neither https://www.onlyworlds.com/w/ nor ow://",
|
|
@@ -1477,6 +1445,41 @@ function findOwLinks(text) {
|
|
|
1477
1445
|
}
|
|
1478
1446
|
}
|
|
1479
1447
|
|
|
1448
|
+
// src/names.ts
|
|
1449
|
+
var SLUGS = new Set(ELEMENT_TYPES);
|
|
1450
|
+
var OPTION_KEYS = ["supertype", "many"];
|
|
1451
|
+
var isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
1452
|
+
function word(pair, many) {
|
|
1453
|
+
if (!isObject(pair) || typeof pair.one !== "string") return null;
|
|
1454
|
+
const one = trimWhiteSpace(pair.one);
|
|
1455
|
+
if (one === "") return null;
|
|
1456
|
+
if (!many) return one;
|
|
1457
|
+
const plural = typeof pair.many === "string" ? trimWhiteSpace(pair.many) : "";
|
|
1458
|
+
return plural === "" ? one : plural;
|
|
1459
|
+
}
|
|
1460
|
+
function typeWord(world, type, opts = {}) {
|
|
1461
|
+
refuseUnknownOptions("typeWord", opts, OPTION_KEYS);
|
|
1462
|
+
const map = world?.x_names;
|
|
1463
|
+
if (!isObject(map) || map.version !== 1) return null;
|
|
1464
|
+
const { types, supertypes } = map;
|
|
1465
|
+
if (types !== void 0 && !isObject(types)) return null;
|
|
1466
|
+
if (supertypes !== void 0) {
|
|
1467
|
+
if (!isObject(supertypes)) return null;
|
|
1468
|
+
for (const inner of Object.values(supertypes)) if (!isObject(inner)) return null;
|
|
1469
|
+
}
|
|
1470
|
+
if (!SLUGS.has(type)) return null;
|
|
1471
|
+
const many = opts.many === true;
|
|
1472
|
+
const supertype = typeof opts.supertype === "string" ? fold(opts.supertype) : "";
|
|
1473
|
+
if (supertype !== "" && isObject(supertypes) && isObject(supertypes[type])) {
|
|
1474
|
+
for (const [key, pair] of Object.entries(supertypes[type])) {
|
|
1475
|
+
if (fold(key) !== supertype) continue;
|
|
1476
|
+
const w = word(pair, many);
|
|
1477
|
+
if (w !== null) return w;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
return isObject(types) ? word(types[type], many) : null;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1480
1483
|
// src/marks.ts
|
|
1481
1484
|
var ELEMENT_MARKS = ["room", "hidden", "proposed", "map_space", "reading_aid"];
|
|
1482
1485
|
var MAP_SPACE = /* @__PURE__ */ new Set(["map", "pin", "marker"]);
|
|
@@ -1839,6 +1842,7 @@ export {
|
|
|
1839
1842
|
isKnownOf,
|
|
1840
1843
|
simpleCaseFold,
|
|
1841
1844
|
trimWhiteSpace,
|
|
1845
|
+
isWhiteSpaceAt,
|
|
1842
1846
|
fold,
|
|
1843
1847
|
hasMark,
|
|
1844
1848
|
isRoomElement,
|
|
@@ -1851,12 +1855,12 @@ export {
|
|
|
1851
1855
|
handsOnAsProposed,
|
|
1852
1856
|
MAP_SPACE,
|
|
1853
1857
|
isHiddenMark,
|
|
1854
|
-
typeWord,
|
|
1855
1858
|
OwAddressError,
|
|
1856
1859
|
elementAddress,
|
|
1857
1860
|
parseOwLink,
|
|
1858
1861
|
readOwLinkAt,
|
|
1859
1862
|
findOwLinks,
|
|
1863
|
+
typeWord,
|
|
1860
1864
|
openersFor,
|
|
1861
1865
|
TOOLS,
|
|
1862
1866
|
doorsOf,
|
package/dist/index.d.ts
CHANGED
|
@@ -6054,6 +6054,130 @@ declare function recordMarkOf(element: unknown): OwRecordMark | null;
|
|
|
6054
6054
|
*/
|
|
6055
6055
|
declare function recordsOf(characterId: string, elements: readonly unknown[]): OwRecord[];
|
|
6056
6056
|
|
|
6057
|
+
/** The two forms of an address: the site's (`human`) and the `ow://` text forms (`text`). */
|
|
6058
|
+
type OwAddressForm = 'human' | 'text';
|
|
6059
|
+
/** Why an address was refused, by the profile's own names, in the order a parser checks them. `no_world` and `bad_form` are the writer's only. */
|
|
6060
|
+
type OwAddressReason = 'not_an_address' | 'uppercase' | 'segments' | 'bad_world' | 'unknown_type' | 'bad_id' | 'bad_moment' | 'bad_lens' | 'no_world' | 'bad_form';
|
|
6061
|
+
/** What `elementAddress` writes from: a form and a triple, or a form and a world. Absent and null are the same. */
|
|
6062
|
+
interface OwAddress {
|
|
6063
|
+
form: OwAddressForm;
|
|
6064
|
+
/** The world's id; absent for the text form inside a world. Never a slug: a writer refuses one. */
|
|
6065
|
+
world?: string | null;
|
|
6066
|
+
/** The type word, lowercase (`character`); absent, with `id`, for a world's own address. */
|
|
6067
|
+
type?: string | null;
|
|
6068
|
+
/** The element's id; absent, with `type`, for a world's own address. */
|
|
6069
|
+
id?: string | null;
|
|
6070
|
+
/** A lens: an element's id, read through that lens. */
|
|
6071
|
+
lens?: string | null;
|
|
6072
|
+
/** A moment: one step of the world's time line, a whole number in the 32-bit range. */
|
|
6073
|
+
moment?: number | null;
|
|
6074
|
+
}
|
|
6075
|
+
/** What `parseOwLink` reads from a string. Hex is given lowercase; `type` and `id` are null for a world's own address. */
|
|
6076
|
+
interface OwAddressReading {
|
|
6077
|
+
form: OwAddressForm;
|
|
6078
|
+
/** The world's id or, in the site's form only, its slug; null in the text form inside a world. */
|
|
6079
|
+
world: string | null;
|
|
6080
|
+
/** True when `world` is a slug (the site's form only): never canonical, since a writer writes the id. */
|
|
6081
|
+
worldIsSlug: boolean;
|
|
6082
|
+
type: ElementType | null;
|
|
6083
|
+
id: string | null;
|
|
6084
|
+
lens: string | null;
|
|
6085
|
+
moment: number | null;
|
|
6086
|
+
/** True when the string as received is exactly what `elementAddress` writes for this reading. */
|
|
6087
|
+
canonical: boolean;
|
|
6088
|
+
}
|
|
6089
|
+
/** An address was refused; nothing was read or written. `reason` names why, by the profile's name, for a tool to word its own message. */
|
|
6090
|
+
declare class OwAddressError extends Error {
|
|
6091
|
+
readonly reason: OwAddressReason;
|
|
6092
|
+
constructor(reason: OwAddressReason, message?: string);
|
|
6093
|
+
}
|
|
6094
|
+
/**
|
|
6095
|
+
* An address as the profile writes it: lowercase throughout, the world's id (never its slug), the
|
|
6096
|
+
* moment before the lens, nothing else. `address` is a form and a triple (`{ form: 'text', world,
|
|
6097
|
+
* type, id }`; no `world` for the text form inside a world), or a form and a world alone for the
|
|
6098
|
+
* world's own address; `lens` and `moment` optional. A reading from `parseOwLink` is taken as it
|
|
6099
|
+
* stands, so `elementAddress(parseOwLink(s))` is the canonical spelling of `s` (a slug refuses).
|
|
6100
|
+
*
|
|
6101
|
+
* Refuses with `OwAddressError` (`reason`): `bad_form`, `segments` (a type without an id or an id
|
|
6102
|
+
* without a type), `no_world` (the site's form, or a world's own text form, with no world),
|
|
6103
|
+
* `bad_world` (not an id: a slug too), `uppercase` / `unknown_type`, `bad_id`, `bad_moment` (not a
|
|
6104
|
+
* whole number in the 32-bit range), `bad_lens`, in that order. An unknown key is a TypeError.
|
|
6105
|
+
*/
|
|
6106
|
+
declare function elementAddress(address: OwAddress | OwAddressReading): string;
|
|
6107
|
+
/**
|
|
6108
|
+
* One string read whole as an address (a link inside other text is the caller's to find first). The
|
|
6109
|
+
* checks run in the profile's order and the first that fails names the refusal, as an
|
|
6110
|
+
* `OwAddressError` with `reason`: trim (Unicode White_Space), the prefix (`uppercase` for one in
|
|
6111
|
+
* another case, else `not_an_address`; a value that is not a string is `not_an_address` too), drop a
|
|
6112
|
+
* fragment, split off the query at the first `?`, split the path on `/`, the last segment at its first
|
|
6113
|
+
* `@`; then `segments`, `bad_world`, `unknown_type` / `uppercase`, `bad_id`, `bad_moment`, `bad_lens`.
|
|
6114
|
+
*
|
|
6115
|
+
* Another query key and a fragment are ignored and make the reading not canonical; nothing is
|
|
6116
|
+
* percent-decoded. The site's form takes a slug for the world (reported as `worldIsSlug`, never
|
|
6117
|
+
* canonical); the text forms take the id only. Ids are read in either case of hex and given lowercase.
|
|
6118
|
+
*/
|
|
6119
|
+
declare function parseOwLink(text: string): OwAddressReading;
|
|
6120
|
+
/** What `findOwLinks` answers for each address in a text: where it starts and ends, and what it reads. */
|
|
6121
|
+
interface OwAddressFound {
|
|
6122
|
+
/** The index of the address's first character in the text. */
|
|
6123
|
+
start: number;
|
|
6124
|
+
/** The index just past the address, as `readOwLinkAt` answers it. */
|
|
6125
|
+
end: number;
|
|
6126
|
+
/** What `parseOwLink` answers for `text.slice(start, end)`. */
|
|
6127
|
+
reading: OwAddressReading;
|
|
6128
|
+
}
|
|
6129
|
+
/** What `readOwLinkAt` answers: the address read, and the index just past it in the text. */
|
|
6130
|
+
interface OwAddressAt {
|
|
6131
|
+
/** What `parseOwLink` answers for `text.slice(index, end)`. */
|
|
6132
|
+
reading: OwAddressReading;
|
|
6133
|
+
/** The index just past the address: the text's first character that is not part of it, or its length. */
|
|
6134
|
+
end: number;
|
|
6135
|
+
}
|
|
6136
|
+
/**
|
|
6137
|
+
* The address that starts exactly at `index` in a text, found in prose, and where it ends; null when the text there is
|
|
6138
|
+
* not an address. Both forms, `ow://` and `https://www.onlyworlds.com/w/`, the prefix as written (lowercase). In the
|
|
6139
|
+
* site's form the run after `/w/` is read whole, once, with no order between an id and a slug: it ends at the first
|
|
6140
|
+
* character outside the slug's alphabet (lowercase letters, digits, hyphens) or the id's (hex in either case); exactly
|
|
6141
|
+
* an id's form is the id, any other run `parseOwLink` reads as a slug is the slug (not a type word, no closing hyphen,
|
|
6142
|
+
* 3 to 40 characters), else no address; a run followed by a letter (any script), a combining mark or an underscore
|
|
6143
|
+
* is cut inside a word and is no address (`/w/mopPetopia.`, `/w/hyper_ion.`). After the world, or in the text form from the prefix, the path
|
|
6144
|
+
* is the longest one `parseOwLink` reads; after it the address continues only with `@` and a moment (the parser's step
|
|
6145
|
+
* grammar, its whole run of an optional minus and digits) and then `?lens=` and a lens (an id, which ends where its 36
|
|
6146
|
+
* characters end). Any other query key or a fragment is not part of an address found in prose: the address ends
|
|
6147
|
+
* before its `?`, `&` or `#`, and a `@` or `?lens=` whose value does not read is not taken (the address ends before
|
|
6148
|
+
* it). What follows is prose, a full stop included (serial 123). An address begins at the start of the text or after
|
|
6149
|
+
* a character that does not glue it to a word: after a letter (any script), a combining mark or an underscore the
|
|
6150
|
+
* start is inside a word and this answers null (`elbow://object/<id>`); a hyphen or a digit before it does not glue
|
|
6151
|
+
* (`x-ow://`, `3ow://`), the same set read from both ends.
|
|
6152
|
+
*
|
|
6153
|
+
* `end` is the index just past the address and `reading` what `parseOwLink` answers for `text.slice(index, end)`,
|
|
6154
|
+
* which `parseOwLink` itself still reads whole, unchanged: `ow://object/<id>.` handed to it whole is refused.
|
|
6155
|
+
* `index` and `end` count JavaScript string indexes (UTF-16 code units), so they match `text.slice` and `indexOf`. A text that is not a string, or an index that is not a
|
|
6156
|
+
* whole number from 0, is a TypeError; an index past the end reads nothing.
|
|
6157
|
+
*
|
|
6158
|
+
* ```ts
|
|
6159
|
+
* const line = 'Built the gate: ow://object/01a1d4ef-0000-7000-8000-000000000084.';
|
|
6160
|
+
* const found = readOwLinkAt(line, 16);
|
|
6161
|
+
* found?.end; // 64: line[64] is the full stop
|
|
6162
|
+
* found?.reading.id; // '01a1d4ef-0000-7000-8000-000000000084'
|
|
6163
|
+
* ```
|
|
6164
|
+
*/
|
|
6165
|
+
declare function readOwLinkAt(text: string, index?: number): OwAddressAt | null;
|
|
6166
|
+
/**
|
|
6167
|
+
* Every address in a text, in order: each `{start, end, reading}`, read by `readOwLinkAt` at every place either
|
|
6168
|
+
* prefix (`ow://`, `https://www.onlyworlds.com/w/`) starts, so a start glued to a word is prose and what follows an
|
|
6169
|
+
* address is prose as `readOwLinkAt` says. The search goes on from the end of each address found, so no two overlap,
|
|
6170
|
+
* and from just past a start that reads nothing. Linear in the text: each prefix's next place is searched once, and
|
|
6171
|
+
* a start reads a bounded stretch. `start` and `end` count JavaScript string indexes, as `readOwLinkAt`'s do. A text
|
|
6172
|
+
* that is not a string is a TypeError.
|
|
6173
|
+
*
|
|
6174
|
+
* ```ts
|
|
6175
|
+
* findOwLinks('See ow://object/01a1d4ef-0000-7000-8000-000000000084, not elbow://object/01a1d4ef-0000-7000-8000-000000000084.');
|
|
6176
|
+
* // [{ start: 4, end: 52, reading: { type: 'object', id: '01a1d4ef-…', … } }]
|
|
6177
|
+
* ```
|
|
6178
|
+
*/
|
|
6179
|
+
declare function findOwLinks(text: string): OwAddressFound[];
|
|
6180
|
+
|
|
6057
6181
|
/** What a report's parent is: none served, a report, a board entry, an id whose element is not held, another element, or the report itself. */
|
|
6058
6182
|
type OwReportParentKind = 'none' | 'report' | 'board' | 'missing' | 'other' | 'self';
|
|
6059
6183
|
/** One group: the parent's id, whether it is a report (a thread) or a board entry (the talks under it), and the reports that name it, in rule 9's order. */
|
|
@@ -6104,6 +6228,54 @@ interface OwReportThreads {
|
|
|
6104
6228
|
* A thread takes nothing away from where a report hangs: its `relations` and `events` still hold it. Pure.
|
|
6105
6229
|
*/
|
|
6106
6230
|
declare function reportThreadsOf(narratives: readonly object[]): OwReportThreads;
|
|
6231
|
+
/** What `readReportLine` answers for one line of a report's `consequences`. */
|
|
6232
|
+
interface OwReportLine {
|
|
6233
|
+
/** The line as read. */
|
|
6234
|
+
line: string;
|
|
6235
|
+
/** The words a reader shows: the line without its address where nothing the writer wrote is lost, else the whole line. */
|
|
6236
|
+
words: string;
|
|
6237
|
+
/** The element the line names, written `ow://<type>/<id>` (the id lowercase), or null when no address in it names an element of this world. */
|
|
6238
|
+
address: string | null;
|
|
6239
|
+
/** What `parseOwLink` reads in the address as written, or null. */
|
|
6240
|
+
reading: OwAddressReading | null;
|
|
6241
|
+
/** Where the address stands in the line (JavaScript string indexes, as `findOwLinks` counts them), or null. */
|
|
6242
|
+
start: number | null;
|
|
6243
|
+
end: number | null;
|
|
6244
|
+
}
|
|
6245
|
+
/** The options `readReportLine` and `readReportLines` take. */
|
|
6246
|
+
interface OwReportLineOptions {
|
|
6247
|
+
/** This world's id, lowercase as the world holds it. An address's world is read lowercase (its hex in either case) and compared with this exactly; without it, only an address with no world names an element here. */
|
|
6248
|
+
world?: string | null;
|
|
6249
|
+
}
|
|
6250
|
+
/**
|
|
6251
|
+
* One line of a report's `consequences`, read as the report profile reads it: the element it names and the words a
|
|
6252
|
+
* reader shows. The line's address is the last address in it (found as the address profile finds one in prose, by
|
|
6253
|
+
* `findOwLinks`) that names an element of this world: an `ow://` or site address, its ids' hex in either case (the
|
|
6254
|
+
* prefix, the host and the type word only in lowercase), whose world is `world` or is left out, and whose type and id
|
|
6255
|
+
* have an element's shape. An address of another world, a slug, a world
|
|
6256
|
+
* alone or a lens with no element is prose, and a line with only those has no address, which is no fault. The address
|
|
6257
|
+
* leaves the shown words only when nothing the writer wrote is lost: it is canonical, carries no moment and no lens,
|
|
6258
|
+
* and stands apart (before it the line's start, White_Space or one colon; after it the line's end, White_Space or a
|
|
6259
|
+
* closing mark, `. , ; : ! ) ] } ' " ’ ” »`), alone or in a matched pair (`()`, `[]`, `""`, `''`, `“”`, `‘’`, `«»`).
|
|
6260
|
+
* Then it goes with the White_Space on both sides and one colon before it, and the two halves join with one space,
|
|
6261
|
+
* or none when the second is empty or begins with a closing mark. In every other shape, and when nothing stands
|
|
6262
|
+
* before the address, the whole line stays, still naming its element. Whether that element exists is the caller's
|
|
6263
|
+
* to read. The line is read as given: `readReportLines` splits and trims a whole text. A line that is not a string,
|
|
6264
|
+
* options that are not an object, an unknown option or a `world` that is not a string or null is a TypeError.
|
|
6265
|
+
*
|
|
6266
|
+
* ```ts
|
|
6267
|
+
* readReportLine("Renamed the Consul's Steinway: ow://object/01a1d4ef-0000-7000-8000-000000000084.");
|
|
6268
|
+
* // { words: "Renamed the Consul's Steinway.", address: 'ow://object/01a1d4ef-0000-7000-8000-000000000084', … }
|
|
6269
|
+
* ```
|
|
6270
|
+
*/
|
|
6271
|
+
declare function readReportLine(line: string, options?: OwReportLineOptions): OwReportLine;
|
|
6272
|
+
/**
|
|
6273
|
+
* Every line of a report's `consequences`, each read by `readReportLine`. The text is split at every carriage return
|
|
6274
|
+
* and every line feed (so CRLF is one break), each piece trimmed of Unicode White_Space at both ends, and a piece
|
|
6275
|
+
* empty after trimming is no line; U+2028 and U+0085 stay inside a line, and a byte order mark is no White_Space.
|
|
6276
|
+
* A text that is not a string is a TypeError.
|
|
6277
|
+
*/
|
|
6278
|
+
declare function readReportLines(text: string, options?: OwReportLineOptions): OwReportLine[];
|
|
6107
6279
|
|
|
6108
6280
|
/**
|
|
6109
6281
|
* The review profile's proposed mark (schema-dist profiles/review.md): an element whose
|
|
@@ -6220,6 +6392,13 @@ interface OwWorldGraph {
|
|
|
6220
6392
|
/** With a lens whose `x_lens` the lens reader cannot read, the key it names (as `resolveLens`'s `unreadable`), and the graph is empty. Null otherwise, and always null without a lens. */
|
|
6221
6393
|
unreadable: string | null;
|
|
6222
6394
|
}
|
|
6395
|
+
/**
|
|
6396
|
+
* The extension fields a published profile reads as links, each a list of ids in this world: the lens profile's
|
|
6397
|
+
* closed table of declared links (`x_lens_leads_to`, and the spine profile's `x_spine_depends_on`). A reader reads each as
|
|
6398
|
+
* a multi-link (`worldGraph` draws its edges), and a writer that builds one names each element once, as the folder
|
|
6399
|
+
* format says of a multi-link. The same list as schema-dist's folder lint (`LINK_EXTENSIONS`).
|
|
6400
|
+
*/
|
|
6401
|
+
declare const DECLARED_LINKS: readonly string[];
|
|
6223
6402
|
/**
|
|
6224
6403
|
* Read a world as a graph for one reader (the lens profile's graph section): the elements the reader sees
|
|
6225
6404
|
* as nodes, the links between them as edges, and what was left out, counted by reason. Pure: it never
|
|
@@ -6623,130 +6802,6 @@ declare function typeWord(world: object | null | undefined, type: string, opts?:
|
|
|
6623
6802
|
many?: boolean;
|
|
6624
6803
|
}): string | null;
|
|
6625
6804
|
|
|
6626
|
-
/** The two forms of an address: the site's (`human`) and the `ow://` text forms (`text`). */
|
|
6627
|
-
type OwAddressForm = 'human' | 'text';
|
|
6628
|
-
/** Why an address was refused, by the profile's own names, in the order a parser checks them. `no_world` and `bad_form` are the writer's only. */
|
|
6629
|
-
type OwAddressReason = 'not_an_address' | 'uppercase' | 'segments' | 'bad_world' | 'unknown_type' | 'bad_id' | 'bad_moment' | 'bad_lens' | 'no_world' | 'bad_form';
|
|
6630
|
-
/** What `elementAddress` writes from: a form and a triple, or a form and a world. Absent and null are the same. */
|
|
6631
|
-
interface OwAddress {
|
|
6632
|
-
form: OwAddressForm;
|
|
6633
|
-
/** The world's id; absent for the text form inside a world. Never a slug: a writer refuses one. */
|
|
6634
|
-
world?: string | null;
|
|
6635
|
-
/** The type word, lowercase (`character`); absent, with `id`, for a world's own address. */
|
|
6636
|
-
type?: string | null;
|
|
6637
|
-
/** The element's id; absent, with `type`, for a world's own address. */
|
|
6638
|
-
id?: string | null;
|
|
6639
|
-
/** A lens: an element's id, read through that lens. */
|
|
6640
|
-
lens?: string | null;
|
|
6641
|
-
/** A moment: one step of the world's time line, a whole number in the 32-bit range. */
|
|
6642
|
-
moment?: number | null;
|
|
6643
|
-
}
|
|
6644
|
-
/** What `parseOwLink` reads from a string. Hex is given lowercase; `type` and `id` are null for a world's own address. */
|
|
6645
|
-
interface OwAddressReading {
|
|
6646
|
-
form: OwAddressForm;
|
|
6647
|
-
/** The world's id or, in the site's form only, its slug; null in the text form inside a world. */
|
|
6648
|
-
world: string | null;
|
|
6649
|
-
/** True when `world` is a slug (the site's form only): never canonical, since a writer writes the id. */
|
|
6650
|
-
worldIsSlug: boolean;
|
|
6651
|
-
type: ElementType | null;
|
|
6652
|
-
id: string | null;
|
|
6653
|
-
lens: string | null;
|
|
6654
|
-
moment: number | null;
|
|
6655
|
-
/** True when the string as received is exactly what `elementAddress` writes for this reading. */
|
|
6656
|
-
canonical: boolean;
|
|
6657
|
-
}
|
|
6658
|
-
/** An address was refused; nothing was read or written. `reason` names why, by the profile's name, for a tool to word its own message. */
|
|
6659
|
-
declare class OwAddressError extends Error {
|
|
6660
|
-
readonly reason: OwAddressReason;
|
|
6661
|
-
constructor(reason: OwAddressReason, message?: string);
|
|
6662
|
-
}
|
|
6663
|
-
/**
|
|
6664
|
-
* An address as the profile writes it: lowercase throughout, the world's id (never its slug), the
|
|
6665
|
-
* moment before the lens, nothing else. `address` is a form and a triple (`{ form: 'text', world,
|
|
6666
|
-
* type, id }`; no `world` for the text form inside a world), or a form and a world alone for the
|
|
6667
|
-
* world's own address; `lens` and `moment` optional. A reading from `parseOwLink` is taken as it
|
|
6668
|
-
* stands, so `elementAddress(parseOwLink(s))` is the canonical spelling of `s` (a slug refuses).
|
|
6669
|
-
*
|
|
6670
|
-
* Refuses with `OwAddressError` (`reason`): `bad_form`, `segments` (a type without an id or an id
|
|
6671
|
-
* without a type), `no_world` (the site's form, or a world's own text form, with no world),
|
|
6672
|
-
* `bad_world` (not an id: a slug too), `uppercase` / `unknown_type`, `bad_id`, `bad_moment` (not a
|
|
6673
|
-
* whole number in the 32-bit range), `bad_lens`, in that order. An unknown key is a TypeError.
|
|
6674
|
-
*/
|
|
6675
|
-
declare function elementAddress(address: OwAddress | OwAddressReading): string;
|
|
6676
|
-
/**
|
|
6677
|
-
* One string read whole as an address (a link inside other text is the caller's to find first). The
|
|
6678
|
-
* checks run in the profile's order and the first that fails names the refusal, as an
|
|
6679
|
-
* `OwAddressError` with `reason`: trim (Unicode White_Space), the prefix (`uppercase` for one in
|
|
6680
|
-
* another case, else `not_an_address`; a value that is not a string is `not_an_address` too), drop a
|
|
6681
|
-
* fragment, split off the query at the first `?`, split the path on `/`, the last segment at its first
|
|
6682
|
-
* `@`; then `segments`, `bad_world`, `unknown_type` / `uppercase`, `bad_id`, `bad_moment`, `bad_lens`.
|
|
6683
|
-
*
|
|
6684
|
-
* Another query key and a fragment are ignored and make the reading not canonical; nothing is
|
|
6685
|
-
* percent-decoded. The site's form takes a slug for the world (reported as `worldIsSlug`, never
|
|
6686
|
-
* canonical); the text forms take the id only. Ids are read in either case of hex and given lowercase.
|
|
6687
|
-
*/
|
|
6688
|
-
declare function parseOwLink(text: string): OwAddressReading;
|
|
6689
|
-
/** What `findOwLinks` answers for each address in a text: where it starts and ends, and what it reads. */
|
|
6690
|
-
interface OwAddressFound {
|
|
6691
|
-
/** The index of the address's first character in the text. */
|
|
6692
|
-
start: number;
|
|
6693
|
-
/** The index just past the address, as `readOwLinkAt` answers it. */
|
|
6694
|
-
end: number;
|
|
6695
|
-
/** What `parseOwLink` answers for `text.slice(start, end)`. */
|
|
6696
|
-
reading: OwAddressReading;
|
|
6697
|
-
}
|
|
6698
|
-
/** What `readOwLinkAt` answers: the address read, and the index just past it in the text. */
|
|
6699
|
-
interface OwAddressAt {
|
|
6700
|
-
/** What `parseOwLink` answers for `text.slice(index, end)`. */
|
|
6701
|
-
reading: OwAddressReading;
|
|
6702
|
-
/** The index just past the address: the text's first character that is not part of it, or its length. */
|
|
6703
|
-
end: number;
|
|
6704
|
-
}
|
|
6705
|
-
/**
|
|
6706
|
-
* The address that starts exactly at `index` in a text, found in prose, and where it ends; null when the text there is
|
|
6707
|
-
* not an address. Both forms, `ow://` and `https://www.onlyworlds.com/w/`, the prefix as written (lowercase). In the
|
|
6708
|
-
* site's form the run after `/w/` is read whole, once, with no order between an id and a slug: it ends at the first
|
|
6709
|
-
* character outside the slug's alphabet (lowercase letters, digits, hyphens) or the id's (hex in either case); exactly
|
|
6710
|
-
* an id's form is the id, any other run `parseOwLink` reads as a slug is the slug (not a type word, no closing hyphen,
|
|
6711
|
-
* 3 to 40 characters), else no address; a run followed by a letter (any script), a combining mark or an underscore
|
|
6712
|
-
* is cut inside a word and is no address (`/w/mopPetopia.`, `/w/hyper_ion.`). After the world, or in the text form from the prefix, the path
|
|
6713
|
-
* is the longest one `parseOwLink` reads; after it the address continues only with `@` and a moment (the parser's step
|
|
6714
|
-
* grammar, its whole run of an optional minus and digits) and then `?lens=` and a lens (an id, which ends where its 36
|
|
6715
|
-
* characters end). Any other query key or a fragment is not part of an address found in prose: the address ends
|
|
6716
|
-
* before its `?`, `&` or `#`, and a `@` or `?lens=` whose value does not read is not taken (the address ends before
|
|
6717
|
-
* it). What follows is prose, a full stop included (serial 123). An address begins at the start of the text or after
|
|
6718
|
-
* a character that does not glue it to a word: after a letter (any script), a combining mark or an underscore the
|
|
6719
|
-
* start is inside a word and this answers null (`elbow://object/<id>`); a hyphen or a digit before it does not glue
|
|
6720
|
-
* (`x-ow://`, `3ow://`), the same set read from both ends.
|
|
6721
|
-
*
|
|
6722
|
-
* `end` is the index just past the address and `reading` what `parseOwLink` answers for `text.slice(index, end)`,
|
|
6723
|
-
* which `parseOwLink` itself still reads whole, unchanged: `ow://object/<id>.` handed to it whole is refused.
|
|
6724
|
-
* `index` and `end` count JavaScript string indexes (UTF-16 code units), so they match `text.slice` and `indexOf`. A text that is not a string, or an index that is not a
|
|
6725
|
-
* whole number from 0, is a TypeError; an index past the end reads nothing.
|
|
6726
|
-
*
|
|
6727
|
-
* ```ts
|
|
6728
|
-
* const line = 'Built the gate: ow://object/01a1d4ef-0000-7000-8000-000000000084.';
|
|
6729
|
-
* const found = readOwLinkAt(line, 16);
|
|
6730
|
-
* found?.end; // 64: line[64] is the full stop
|
|
6731
|
-
* found?.reading.id; // '01a1d4ef-0000-7000-8000-000000000084'
|
|
6732
|
-
* ```
|
|
6733
|
-
*/
|
|
6734
|
-
declare function readOwLinkAt(text: string, index?: number): OwAddressAt | null;
|
|
6735
|
-
/**
|
|
6736
|
-
* Every address in a text, in order: each `{start, end, reading}`, read by `readOwLinkAt` at every place either
|
|
6737
|
-
* prefix (`ow://`, `https://www.onlyworlds.com/w/`) starts, so a start glued to a word is prose and what follows an
|
|
6738
|
-
* address is prose as `readOwLinkAt` says. The search goes on from the end of each address found, so no two overlap,
|
|
6739
|
-
* and from just past a start that reads nothing. Linear in the text: each prefix's next place is searched once, and
|
|
6740
|
-
* a start reads a bounded stretch. `start` and `end` count JavaScript string indexes, as `readOwLinkAt`'s do. A text
|
|
6741
|
-
* that is not a string is a TypeError.
|
|
6742
|
-
*
|
|
6743
|
-
* ```ts
|
|
6744
|
-
* findOwLinks('See ow://object/01a1d4ef-0000-7000-8000-000000000084, not elbow://object/01a1d4ef-0000-7000-8000-000000000084.');
|
|
6745
|
-
* // [{ start: 4, end: 52, reading: { type: 'object', id: '01a1d4ef-…', … } }]
|
|
6746
|
-
* ```
|
|
6747
|
-
*/
|
|
6748
|
-
declare function findOwLinks(text: string): OwAddressFound[];
|
|
6749
|
-
|
|
6750
6805
|
/** One reason a lore view leaves an element out, as the graph section names it. */
|
|
6751
6806
|
type OwElementMark = 'room' | 'hidden' | 'proposed' | 'map_space' | 'reading_aid';
|
|
6752
6807
|
|
|
@@ -8060,4 +8115,4 @@ declare class TokenResource {
|
|
|
8060
8115
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
8061
8116
|
}
|
|
8062
8117
|
|
|
8063
|
-
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, type OwAccountWorld, type OwAddress, type OwAddressAt, OwAddressError, type OwAddressForm, type OwAddressFound, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAiAskAnswer, type OwAiAskBody, type OwAiMeter, type OwAiRefusal, type OwAiSortAnswer, type OwAiSortBody, type OwAiToken, type OwAiUse, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwElementMark, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwInstant, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLanding, type OwLandingCluster, type OwLandingGap, type OwLandingGapKind, type OwLandingMember, type OwLandingMode, type OwLandingOptions, type OwLayoutAround, type OwLayoutAroundOptions, type OwLayoutAroundPoint, type OwLayoutByKind, type OwLayoutGraph, type OwLayoutOf, type OwLayoutPoint, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMapSpace, type OwMapSpaceMap, type OwMapSpaceOutReason, type OwMapSpaceOutline, type OwMapSpacePin, type OwMapSpacePoint, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedAiToken, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwOpenersOptions, type OwPage, type OwPaidBy, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRecord, type OwRecordMark, type OwRecordStory, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwReportGroup, type OwReportLint, type OwReportParentKind, type OwReportThreads, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSearchResult, type OwSearchResults, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, type OwTrailGround, type OwTrailHanger, type OwTrailInput, type OwTrailLayout, type OwTrailPin, type OwTrailPlace, type OwTrailSettings, type OwTrailSpiral, type OwTrailTier, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwView, type OwViewRow, type OwViewsTable, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldKeyMember, type OwWorldKeyRow, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, RECORD_FIELD, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, TRAIL_TIERS, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, VIEWS, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, compareInstants, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, findOwLinks, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, instantOf, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, landingOf, layoutAround, layoutByKind, layoutOf, lensesInUse, lookupWorld, mapSpace, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readOwLinkAt, readWorldFile, readingAidOf, recipientsOf, recordMarkOf, recordsOf, renderElement, reportThreadsOf, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, roundHalfEven, senderStatus, simpleCaseFold, strandOf, threadOf, trailByPlace, typeWord, unreadFor, validateCalendarConfig, viewOf, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
|
8118
|
+
export { AGENT_DOORS, ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, CHARTER_PAIRS, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, DATE_FIELD, DECLARED_LINKS, ELEMENT_FAMILIES, ELEMENT_GROUPS, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementGroup, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_ACRONYMS, FIELD_SCHEMA, FILE_EXTENSIONS, type FieldInfo, type FieldType, GROUP_COLORS, GROUP_ORDER, GameTier, type ListParams, MESSAGE_PAIR, NOTE_PAIR, ONLYWORLDS_VERSION, type OwAccountToken, type OwAccountWorld, type OwAddress, type OwAddressAt, OwAddressError, type OwAddressForm, type OwAddressFound, type OwAddressReading, type OwAddressReason, type OwAddressingOptions, type OwAgentJoined, type OwAiAskAnswer, type OwAiAskBody, type OwAiMeter, type OwAiRefusal, type OwAiSortAnswer, type OwAiSortBody, type OwAiToken, type OwAiUse, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAskContextOptions, type OwAskLeftOut, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangeDelete, type OwChangeUpsert, type OwChangesPage, type OwCharterWorld, type OwClientConfig, type OwCreateAccountWorldInput, type OwCreatedAccountWorld, type OwCreatedWorldLink, type OwDeleteReason, type OwDoor, type OwDragField, type OwDraught, type OwDraughtCompact, type OwDraughtComponent, type OwDraughtItem, type OwDraughtLens, type OwDraughtPolicy, type OwEdited, type OwElement, type OwElementBase, type OwElementMark, type OwErrorBody, type OwFileAddedBy, type OwFileDownload, type OwFileKind, type OwFileRow, type OwFileTicket, type OwFrontDoor, type OwGraphCutReason, type OwGraphEdge, type OwGraphMark, type OwGraphNode, type OwGraphOptions, type OwHiddenRow, type OwInstant, type OwJoinPreview, type OwJoined, type OwJoinedMembership, type OwKeyKind, type OwLanding, type OwLandingCluster, type OwLandingGap, type OwLandingGapKind, type OwLandingMember, type OwLandingMode, type OwLandingOptions, type OwLayoutAround, type OwLayoutAroundOptions, type OwLayoutAroundPoint, type OwLayoutByKind, type OwLayoutGraph, type OwLayoutOf, type OwLayoutPoint, type OwLensCutReason, type OwLensMail, type OwLensOptions, type OwLensReader, type OwLensReading, type OwLensWorld, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMapSpace, type OwMapSpaceMap, type OwMapSpaceOutReason, type OwMapSpaceOutline, type OwMapSpacePin, type OwMapSpacePoint, type OwMe, type OwMediaTicket, type OwMember, type OwMemberLenses, type OwMemberRole, type OwMessageMember, type OwMintedAiToken, type OwMintedKey, type OwMySeat, type OwNamesMap, OwNetworkError, type OwOpener, type OwOpenerKind, type OwOpenerState, type OwOpenerSurface, type OwOpenersOptions, type OwPage, type OwPaidBy, type OwPhotoOptions, type OwPhotoPlan, type OwPlayerJoined, OwPreconditionFailedError, type OwPreparedPhoto, type OwProposal, type OwProposalAccepted, type OwProposalConflict, type OwProposalList, type OwProposalQuery, type OwProposalState, type OwProposeInput, type OwProposed, OwProposedError, type OwProposedMark, type OwProposedNewElement, type OwReadWorldFile, type OwReadWorldFileOptions, type OwReadingAids, type OwReadingAidsCharter, type OwReadingAidsDomain, type OwReadingAidsGuide, type OwReadingAidsHub, type OwRecord, type OwRecordMark, type OwRecordStory, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwReportGroup, type OwReportLine, type OwReportLineOptions, type OwReportLint, type OwReportParentKind, type OwReportThreads, type OwResyncReason, type OwReviewInput, type OwReviewed, type OwSearchResult, type OwSearchResults, type OwSeat, type OwSeatCreated, type OwSender, type OwSenderStatus, type OwServedReadingAids, type OwSignInBegin, type OwSignInBegun, type OwSignInComplete, OwSignInError, type OwSignInReason, type OwSignInResult, type OwSignInStorage, type OwSignedIn, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, OwStaleProposalError, type OwStrand, type OwStrandSlot, type OwStrandWorld, type OwTool, type OwToolNeeds, type OwToolOpen, type OwTrailGround, type OwTrailHanger, type OwTrailInput, type OwTrailLayout, type OwTrailPin, type OwTrailPlace, type OwTrailSettings, type OwTrailSpiral, type OwTrailTier, type OwUploadedFile, type OwUploadedImage, OwV2Client, type OwView, type OwViewRow, type OwViewsTable, type OwWordPair, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldFileRow, type OwWorldFiles, type OwWorldGraph, type OwWorldIndex, type OwWorldKeyMember, type OwWorldKeyRow, type OwWorldLens, type OwWorldLensReading, type OwWorldLenses, type OwWorldLink, type OwWorldMeta, type OwWorldOrigin, type OwWorldProducer, type OwWorldProposalList, type OwWorldProposalQuery, type OwWorldProposalRow, type OwWorldPublicPage, type OwWorldSource, type OwWriteDoor, type OwWriteWorldFileOptions, type OwWriteWorldFileReport, PHOTO_MAX_BYTES, PHOTO_TYPES, PROPOSED_MARK, PUBLIC_FIELDS, type ParseError, type ParseOptions, type ParseResult, RECORD_FIELD, REVIEW_PROPOSED_LABEL, ROOM_PAIRS, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, STRAND_FIELD, type SectionInfo, type StepBreakdown, TOOLS, TRAIL_TIERS, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, VIEWS, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, WORLD_FILE_MEDIA_TYPE, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, base64url, breakdownStep, buildAskContext, buildWorldIndex, charterOf, compareInstants, dateOf, degreeOf, detectKeyKind, displayYear, domainsOf, doorWhere, doorsOf, dragField, draughtText, editedBy, elementAddress, elementColor, eraForStep, errorFromResponse, familyOf, fieldLabel, fileKindOf, findOwLinks, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, groupOf, handsOnAsProposed, hasUnseenRecipients, instantOf, intercalaryInYear, isAddressedTo, isAgentDoor, isCharterElement, isDemoKey, isKnownOf, isLeapYear, isLens, isMessage, isNote, isParseError, isRoomElement, isSentBy, isTemplate, isToEveryone, kindCanWrite, landingOf, layoutAround, layoutByKind, layoutOf, lensesInUse, lookupWorld, mapSpace, monthStartSteps, nfc, noteOf, openersFor, outDegreeOf, parseDate, parseErrorEnvelope, parseOwLink, pinExpectation, pkceChallenge, planPhoto, preparePhoto, proposedMarkOf, readCalendarConfig, readCalendarValue, readMarkOf, readOwLinkAt, readReportLine, readReportLines, readWorldFile, readingAidOf, recipientsOf, recordMarkOf, recordsOf, renderElement, reportThreadsOf, resolveCalendar, resolveCalendarLens, resolveEraDomains, resolveLens, roundHalfEven, senderStatus, simpleCaseFold, strandOf, threadOf, trailByPlace, typeWord, unreadFor, validateCalendarConfig, viewOf, weekdayForStep, worldCalendars, worldGraph, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
isHiddenMark,
|
|
37
37
|
isKnownOf,
|
|
38
38
|
isRoomElement,
|
|
39
|
+
isWhiteSpaceAt,
|
|
39
40
|
openersFor,
|
|
40
41
|
parseOwLink,
|
|
41
42
|
proposedMarkOf,
|
|
@@ -47,7 +48,7 @@ import {
|
|
|
47
48
|
trimWhiteSpace,
|
|
48
49
|
typeWord,
|
|
49
50
|
unknownKey
|
|
50
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-MLVYQ5XG.js";
|
|
51
52
|
|
|
52
53
|
// src/v2/keyed-id.ts
|
|
53
54
|
var KEYED_IDS = "0199b6a0-6f0e-7c2a-9d1e-3b5c7a8e4f21";
|
|
@@ -3957,10 +3958,63 @@ function reportThreadsOf(narratives) {
|
|
|
3957
3958
|
}
|
|
3958
3959
|
return { parents, groups, lints };
|
|
3959
3960
|
}
|
|
3961
|
+
var REPORT_LINE_KEYS = ["world"];
|
|
3962
|
+
var CLOSING = /* @__PURE__ */ new Set([".", ",", ";", ":", "!", ")", "]", "}", "'", '"', "\u2019", "\u201D", "\xBB"]);
|
|
3963
|
+
var PAIRS = /* @__PURE__ */ new Map([["(", ")"], ["[", "]"], ['"', '"'], ["'", "'"], ["\u201C", "\u201D"], ["\u2018", "\u2019"], ["\xAB", "\xBB"]]);
|
|
3964
|
+
function worldOption(fn, options) {
|
|
3965
|
+
if (options !== void 0 && (options === null || typeof options !== "object")) throw new TypeError(`${fn}: options must be an object`);
|
|
3966
|
+
refuseUnknownOptions(fn, options, REPORT_LINE_KEYS);
|
|
3967
|
+
const world = options?.world ?? null;
|
|
3968
|
+
if (world !== null && typeof world !== "string") throw new TypeError(`${fn}: world must be a string (this world's id) or null`);
|
|
3969
|
+
return world;
|
|
3970
|
+
}
|
|
3971
|
+
function trimEndWhiteSpace(text2) {
|
|
3972
|
+
let end = text2.length;
|
|
3973
|
+
while (end > 0 && isWhiteSpaceAt(text2, end - 1)) end--;
|
|
3974
|
+
return text2.slice(0, end);
|
|
3975
|
+
}
|
|
3976
|
+
function trimStartWhiteSpace(text2) {
|
|
3977
|
+
let start = 0;
|
|
3978
|
+
while (start < text2.length && isWhiteSpaceAt(text2, start)) start++;
|
|
3979
|
+
return text2.slice(start);
|
|
3980
|
+
}
|
|
3981
|
+
function readLine(line, world) {
|
|
3982
|
+
const here = findOwLinks(line).filter((f) => f.reading.type !== null && f.reading.id !== null && (f.reading.world === null || !f.reading.worldIsSlug && world !== null && f.reading.world === world));
|
|
3983
|
+
if (here.length === 0) return { line, words: line, address: null, reading: null, start: null, end: null };
|
|
3984
|
+
const { start, end, reading } = here[here.length - 1];
|
|
3985
|
+
const found = { line, words: line, address: `ow://${reading.type}/${reading.id}`, reading, start, end };
|
|
3986
|
+
if (!reading.canonical || reading.moment !== null || reading.lens !== null) return found;
|
|
3987
|
+
let from = start;
|
|
3988
|
+
let to = end;
|
|
3989
|
+
const before = start > 0 ? line[start - 1] : "";
|
|
3990
|
+
if (PAIRS.has(before)) {
|
|
3991
|
+
if (line[end] !== PAIRS.get(before)) return found;
|
|
3992
|
+
from = start - 1;
|
|
3993
|
+
to = end + 1;
|
|
3994
|
+
}
|
|
3995
|
+
const apartBefore = from === 0 || isWhiteSpaceAt(line, from - 1) || line[from - 1] === ":";
|
|
3996
|
+
const apartAfter = to === line.length || isWhiteSpaceAt(line, to) || CLOSING.has(line[to]);
|
|
3997
|
+
if (!apartBefore || !apartAfter) return found;
|
|
3998
|
+
let left = trimEndWhiteSpace(line.slice(0, from));
|
|
3999
|
+
if (left.endsWith(":")) left = trimEndWhiteSpace(left.slice(0, -1));
|
|
4000
|
+
const right = trimStartWhiteSpace(line.slice(to));
|
|
4001
|
+
if (left === "") return found;
|
|
4002
|
+
const words2 = right === "" ? left : CLOSING.has(right[0]) ? left + right : `${left} ${right}`;
|
|
4003
|
+
return { ...found, words: words2 };
|
|
4004
|
+
}
|
|
4005
|
+
function readReportLine(line, options) {
|
|
4006
|
+
if (typeof line !== "string") throw new TypeError("readReportLine: line must be a string");
|
|
4007
|
+
return readLine(line, worldOption("readReportLine", options));
|
|
4008
|
+
}
|
|
4009
|
+
function readReportLines(text2, options) {
|
|
4010
|
+
if (typeof text2 !== "string") throw new TypeError("readReportLines: text must be a string");
|
|
4011
|
+
const world = worldOption("readReportLines", options);
|
|
4012
|
+
return text2.split(/[\r\n]/).map(trimWhiteSpace).filter((l) => l !== "").map((l) => readLine(l, world));
|
|
4013
|
+
}
|
|
3960
4014
|
|
|
3961
4015
|
// src/graph.ts
|
|
3962
4016
|
var GRAPH_OPTION_KEYS = ["lens", "asOf", "clock", "rooms", "hidden", "proposed", "mapSpace", "readingAids"];
|
|
3963
|
-
var DECLARED_LINKS = ["x_lens_leads_to", "x_spine_depends_on"];
|
|
4017
|
+
var DECLARED_LINKS = Object.freeze(["x_lens_leads_to", "x_spine_depends_on"]);
|
|
3964
4018
|
var GRAPH_REASONS = [...CUT_REASONS, "room", "hidden", "proposed", "map_space", "reading_aid", "outside_lens"];
|
|
3965
4019
|
var GRAPH_OWNER_ONLY = /* @__PURE__ */ new Set([...OWNER_ONLY, "hidden", "proposed"]);
|
|
3966
4020
|
function flag(opts, key) {
|
|
@@ -7641,6 +7695,7 @@ export {
|
|
|
7641
7695
|
CALENDAR_SUPERTYPE,
|
|
7642
7696
|
CHARTER_PAIRS,
|
|
7643
7697
|
DATE_FIELD,
|
|
7698
|
+
DECLARED_LINKS,
|
|
7644
7699
|
ELEMENT_FAMILIES,
|
|
7645
7700
|
ELEMENT_GROUPS,
|
|
7646
7701
|
ELEMENT_ICONS,
|
|
@@ -7762,6 +7817,8 @@ export {
|
|
|
7762
7817
|
readCalendarValue,
|
|
7763
7818
|
readMarkOf,
|
|
7764
7819
|
readOwLinkAt,
|
|
7820
|
+
readReportLine,
|
|
7821
|
+
readReportLines,
|
|
7765
7822
|
readWorldFile,
|
|
7766
7823
|
readingAidOf,
|
|
7767
7824
|
recipientsOf,
|
package/dist/waymark.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
openersFor,
|
|
7
7
|
refuseUnknownOptions,
|
|
8
8
|
typeWord
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MLVYQ5XG.js";
|
|
10
10
|
|
|
11
11
|
// src/waymark/glyphs.ts
|
|
12
12
|
var MARK_PATH = "M100 50C100 63.261 94.732 75.979 85.355 85.355C75.979 94.732 63.261 100 50 100C36.739 100 24.021 94.732 14.645 85.355C5.268 75.979 0 63.261 0 50C0 36.739 5.268 24.021 14.645 14.645C24.021 5.268 36.739 0 50 0C63.261 0 75.979 5.268 85.355 14.645C94.732 24.021 100 36.739 100 50ZM20.479 78.74C22.377 77.765 24.322 76.884 26.306 76.102Q25.845 75.042 25.421 73.934Q24.026 70.291 23.069 66.268Q22.121 62.281 21.637 58.063Q21.252 54.707 21.171 51.3L8.82 51.3C9.144 61.572 13.298 71.363 20.479 78.74ZM91.18 51.3L78.829 51.3Q78.748 54.707 78.363 58.063Q77.879 62.281 76.931 66.268Q75.974 70.291 74.579 73.934Q74.155 75.041 73.694 76.102C75.678 76.884 77.623 77.765 79.521 78.74C86.702 71.363 90.856 61.572 91.18 51.3ZM8.82 48.7L21.154 48.7Q21.195 44.785 21.637 40.937Q22.121 36.719 23.069 32.732Q24.026 28.709 25.421 25.066Q25.676 24.401 25.943 23.754C24.085 23.008 22.262 22.176 20.479 21.26C13.298 28.637 9.144 38.428 8.82 48.7ZM79.521 21.26C77.738 22.176 75.915 23.008 74.057 23.754Q74.324 24.401 74.579 25.066Q75.974 28.709 76.931 32.732Q77.879 36.719 78.363 40.937Q78.805 44.785 78.846 48.7L91.18 48.7C90.856 38.428 86.702 28.637 79.521 21.26ZM32.455 48.7L44.2 48.7L44.2 28.139C41.714 27.915 39.253 27.548 36.827 27.043Q36.381 28.044 35.974 29.107Q34.846 32.052 34.063 35.347Q33.27 38.678 32.863 42.226Q32.495 45.432 32.455 48.7ZM63.173 27.043C60.747 27.548 58.286 27.915 55.8 28.139L55.8 48.7L67.545 48.7Q67.505 45.432 67.137 42.226Q66.73 38.678 65.937 35.347Q65.153 32.052 64.026 29.107Q63.619 28.044 63.173 27.043ZM48.7 25.786L48.7 8.82C45.82 8.911 42.977 9.303 40.215 9.979Q39.193 11.05 38.224 12.342Q36.393 14.784 34.829 17.913Q33.574 20.422 32.533 23.289C34.326 23.815 36.144 24.261 37.982 24.624C37.99 24.626 37.998 24.627 38.006 24.629C40.048 25.032 42.115 25.332 44.2 25.528C45.692 25.668 47.193 25.755 48.7 25.786ZM51.3 8.82L51.3 25.786C52.68 25.757 54.054 25.683 55.421 25.563C55.548 25.552 55.674 25.54 55.8 25.528C57.885 25.332 59.952 25.032 61.994 24.629C63.841 24.265 65.667 23.817 67.467 23.289Q66.426 20.422 65.171 17.913Q63.607 14.784 61.776 12.342Q60.807 11.05 59.785 9.979C57.023 9.303 54.18 8.911 51.3 8.82ZM48.7 91.18L48.7 74.214C47.193 74.245 45.692 74.332 44.2 74.472C42.331 74.647 40.476 74.907 38.641 75.249C38.628 75.252 38.616 75.254 38.604 75.256C38.571 75.262 38.539 75.268 38.507 75.274C36.606 75.633 34.726 76.08 32.874 76.612C32.76 76.645 32.646 76.678 32.533 76.711Q33.574 79.578 34.829 82.087Q36.393 85.216 38.224 87.658Q39.193 88.95 40.215 90.021C42.977 90.697 45.82 91.089 48.7 91.18ZM59.785 90.021Q60.807 88.95 61.776 87.658Q63.607 85.216 65.171 82.087Q66.426 79.578 67.467 76.711C65.504 76.135 63.511 75.655 61.493 75.274C59.664 74.929 57.815 74.666 55.951 74.486C55.901 74.481 55.85 74.476 55.8 74.472C54.36 74.336 52.911 74.251 51.457 74.217C51.404 74.216 51.352 74.215 51.3 74.214L51.3 91.18C54.18 91.089 57.023 90.697 59.785 90.021ZM65.602 64.989Q65.777 64.328 65.937 63.653Q66.73 60.322 67.137 56.774Q67.449 54.059 67.525 51.3L55.8 51.3L55.8 63.531C59.11 63.795 62.384 64.284 65.602 64.989ZM44.2 51.3L32.475 51.3Q32.551 54.059 32.863 56.774Q33.27 60.322 34.063 63.653Q34.223 64.328 34.398 64.989C37.615 64.284 40.89 63.795 44.2 63.531L44.2 51.3ZM35.727 88.649Q33.994 86.232 32.503 83.25Q31.159 80.562 30.052 77.497C29.162 77.799 28.279 78.122 27.403 78.464C25.727 79.12 24.08 79.849 22.467 80.649C26.368 84.154 30.875 86.857 35.727 88.649ZM77.533 80.649C75.92 79.849 74.273 79.12 72.597 78.464C71.756 78.136 70.909 77.825 70.055 77.533C70.019 77.521 69.983 77.509 69.948 77.497Q68.841 80.562 67.497 83.25Q66.006 86.232 64.273 88.649C69.125 86.857 73.632 84.154 77.533 80.649ZM64.273 11.351Q66.006 13.768 67.497 16.75Q68.841 19.438 69.948 22.503C70.921 22.173 71.886 21.818 72.841 21.439C72.895 21.418 72.95 21.396 73.004 21.375C74.54 20.761 76.051 20.086 77.533 19.351C73.632 15.846 69.125 13.143 64.273 11.351ZM22.467 19.351C23.949 20.086 25.46 20.761 26.996 21.374C28.005 21.777 29.024 22.154 30.052 22.503Q31.159 19.438 32.503 16.75Q33.994 13.768 35.727 11.351C30.875 13.143 26.368 15.846 22.467 19.351Z";
|