@plurnk/plurnk-schemes 1.10.1 → 1.12.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/README.md +3 -4
- package/SPEC.md +59 -47
- package/dist/Manifest.d.ts.map +1 -1
- package/dist/Manifest.js +10 -18
- package/dist/Manifest.js.map +1 -1
- package/dist/Matcher.d.ts +1 -1
- package/dist/Matcher.d.ts.map +1 -1
- package/dist/Matcher.js +5 -2
- package/dist/Matcher.js.map +1 -1
- package/dist/OutputScheme.d.ts +2 -2
- package/dist/OutputScheme.d.ts.map +1 -1
- package/dist/OutputScheme.js +1 -1
- package/dist/OutputScheme.js.map +1 -1
- package/dist/Slicer.d.ts +31 -1
- package/dist/Slicer.d.ts.map +1 -1
- package/dist/Slicer.js +145 -33
- package/dist/Slicer.js.map +1 -1
- package/dist/ctx.d.ts +1 -0
- package/dist/ctx.d.ts.map +1 -1
- package/dist/edit-receipt.d.ts +5 -1
- package/dist/edit-receipt.d.ts.map +1 -1
- package/dist/handler.d.ts +1 -0
- package/dist/handler.d.ts.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -3
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/dist/SchemeResolver.d.ts +0 -5
- package/dist/SchemeResolver.d.ts.map +0 -1
- package/dist/SchemeResolver.js +0 -29
- package/dist/SchemeResolver.js.map +0 -1
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ static manifest: SchemeManifest = {
|
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
- **`example`** — the scheme's concise **hot-path** operation example set, rendered in the live resource catalogue every turn (like an execs runtime's `example`). Use one or more complete operations separated by blank lines; depth goes in `documentation`. Omit → not advertised.
|
|
94
|
-
- **`documentation`** — the **deep doc** (ops, channels, edge cases) with an exact H2 `Summary`. The consumer materializes it as a pull-able `worker://~/_plurnk/
|
|
94
|
+
- **`documentation`** — the **deep doc** (ops, channels, edge cases) with an exact H2 `Summary`. The consumer materializes it as a pull-able `worker://~/_plurnk/plurnk/<name>.md` entry: FIND catalogs the summary and the model READs the body on demand, off the hot path. It is analogous to executor supplemental `details`. **Convention:** keep it in a **`docs/<name>.md`** file (root) and load it at module init with the snippet above — `../` resolves the same from `src/` (test) and `dist/` (built); add `docs/**/*` to `files`. A missing file fails-hard at import.
|
|
95
95
|
- **`glyph`** — optional opaque client display metadata. It is discoverable through the client capability wire and never rendered into model teaching; clients choose fallback, fonts, and theme.
|
|
96
96
|
|
|
97
97
|
Declare `lineAnchors: true` when stable textual representations should publish
|
|
@@ -105,7 +105,7 @@ collision guard.
|
|
|
105
105
|
|
|
106
106
|
### 4. Self-doc: terse pushes, depth pulls
|
|
107
107
|
|
|
108
|
-
`example` renders every turn — keep it terse. `documentation` is the deep prose; the consumer materializes it at `worker://~/_plurnk/
|
|
108
|
+
`example` renders every turn — keep it terse. `documentation` is the deep prose; the consumer materializes it at `worker://~/_plurnk/plurnk/<name>.md` for catalog discovery and on-demand READ. Don't dump prose into `example` (it floods the hot path) — put it in `documentation`.
|
|
109
109
|
|
|
110
110
|
That's the whole contract: declare, `implements SchemeHandler`, manifest with self-doc. Publish, install, discovered.
|
|
111
111
|
|
|
@@ -113,14 +113,13 @@ That's the whole contract: declare, `implements SchemeHandler`, manifest with se
|
|
|
113
113
|
|
|
114
114
|
### Types
|
|
115
115
|
|
|
116
|
-
- Manifest
|
|
116
|
+
- Manifest: `SchemeManifest` (including capability `traits`, `example` / `documentation` self-doc, and client-only `glyph`) and `WriterTier`; contracts-owned `LoopPolicy` / `DEFAULT_LOOP_POLICY` are re-exported.
|
|
117
117
|
- Behavior contract: `SchemeHandler`, numeric-only `ResolvedEditStatement` (also exported as `EditStatement`), and optional `PacketSectionTransformer` (`PacketSectionDraft`); the remaining re-exported scheme-facing grammar types (`PlurnkStatement` + per-op statements + `ParsedPath` / `LocalPath` / `UrlPath`).
|
|
118
118
|
- Results: universal `SchemeResult` plus RFC 9457 `ProblemDetails`, optional `EntryResult` / `ProposalResult` / `PassthroughResult` authoring shapes, `SchemeResultBase`, matcher navigation `MatchEvidence`, and target-shaped standard `EntryFindResult` pagination/count metadata.
|
|
119
119
|
- Capability ctx: `SchemeCtx` and its entry, channel, notification, projection, and subscription domains. Entry schemes can reuse typed standard operations with semantic commons/worker ownership.
|
|
120
120
|
|
|
121
121
|
### Helpers (`export default class`, static methods)
|
|
122
122
|
|
|
123
|
-
- `SchemeResolver.forLoop(handlers, flags)` — active-scheme resolution under loop flags.
|
|
124
123
|
- `MimetypeClassifier.isBinary` / `.isJson` / `.normalizeAutoText` (+ `TEXT_PRIMITIVE_MIMETYPE` named export) - registry-free mimetype taxonomy and scheme-local helpers. Configured consumers use `Mimetypes.classify()` for handler-aware binary decisions.
|
|
125
124
|
- `Slicer.lines` / `.linesRaw` / `.textReplacement` / `.lineMarkerEdit` / `.lineMarkerEditBatch` - universal text-region projection and same-snapshot replacement; `Slicer.page` handles ordered results, and `.coversAvailable` derives complete coverage from their compact `RangeExtent`.
|
|
126
125
|
- `PathMimetype.resolve(pathname, default, mimetypes)` — path-extension mimetype resolver.
|
package/SPEC.md
CHANGED
|
@@ -29,7 +29,7 @@ class Notes {
|
|
|
29
29
|
volatile: false,
|
|
30
30
|
modelVisible: true,
|
|
31
31
|
textEditScopes: true,
|
|
32
|
-
|
|
32
|
+
traits: ["web"],
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
```
|
|
@@ -49,9 +49,10 @@ class Notes {
|
|
|
49
49
|
| `folderScopes?` | `true` declares that a trailing slash on FIND is a collection scope. Absent/false means `/` is ordinary resource syntax. |
|
|
50
50
|
| `lineAnchors?` | `true` publishes and accepts shared line anchors for stable textual representations without declaring EDIT support. |
|
|
51
51
|
| `textEditScopes?` | `true` declares the shared textual EDIT coordinate and collision contract. For model-writable schemes it implies `lineAnchors`; handlers receive only numeric coordinates and route standard entry mutation through `ctx.entries.operations.editBatch`. |
|
|
52
|
-
| `
|
|
52
|
+
| §manifest-metadata-modifier `metadataModifier?` | `true` declares that the scheme owns the opaque, ordered `{metadata}` modifier. Absent/false rejects it before handler invocation. |
|
|
53
|
+
| §manifest-capability-traits `traits?` | Unique lowercase capability facts (for example `web` or `interaction`). The scheme declares facts only; the consumer's general capability-policy cascade decides admission. |
|
|
53
54
|
| `example?` | The scheme's concise **hot-path** operation example set (e.g. `"## READ0 (foo://thing/42)"`) — renders in the live resource catalogue every turn. One or more complete operations may be separated by blank lines; keep semantics in `documentation`. Omit → not advertised. |
|
|
54
|
-
| `documentation?` | The **deep doc** (semantics / channels / edge cases), with an exact H2 `Summary` for discovery. Consumer materializes it as a pull-able `worker://~/_plurnk/
|
|
55
|
+
| `documentation?` | The **deep doc** (semantics / channels / edge cases), with an exact H2 `Summary` for discovery. Consumer materializes it as a pull-able `worker://~/_plurnk/plurnk/<name>.md` entry READ on demand; never hits the hot path. Analogous to executor supplemental `details`. |
|
|
55
56
|
| §manifest-client-display `glyph?` | Non-empty opaque client presentation glyph. It is projected through {§client-display-capabilities}; omission delegates identity fallback to the client. It never enters model teaching. |
|
|
56
57
|
| `foldedByDefault?` | Entries land FOLDED, off the ranked manifest surface (READable via address, not poured into the ranked view). For executor-output streams (`<tag>://`) — containment one level up. Absent/false → ranked/first-class. |
|
|
57
58
|
| `storedScheme?` | Value persisted to `entries.scheme`, which may differ from the addressing `name`. Absent defaults to `name`. It must be a non-null string because every persisted identity component is non-null. |
|
|
@@ -62,30 +63,27 @@ it through the entry principal. `entryOwner` and `inherit` are independent: a
|
|
|
62
63
|
Worker-owned entry may be private and inheritable, while copying an entry into
|
|
63
64
|
a child is distinct from permitting an actor to address an ancestor's entry.
|
|
64
65
|
|
|
65
|
-
§manifest-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
{§manifest-metadata-modifier} is the scheme's explicit opt-in to
|
|
67
|
+
{§scheme-metadata-modifier}. Core never parses or moves metadata into the
|
|
68
|
+
target. Direct operation methods receive it on `statement.metadata`; exact
|
|
69
|
+
resource preparation receives the same ordered raw blocks on
|
|
70
|
+
`request.metadata`. A present modifier on any scheme that did not opt in is a
|
|
71
|
+
non-retryable `400 scheme-metadata-unsupported`, and the handler is not called.
|
|
69
72
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
{§manifest-capability-traits} `traits` are closed manifest data, not a policy
|
|
74
|
+
channel. Names match `^[a-z][a-z0-9-]*$`, are unique, and carry through a
|
|
75
|
+
synthesized runtime-output scheme. A handler never interprets policy or a named
|
|
76
|
+
client mode. The consumer combines operation, access class, scheme, runtime,
|
|
77
|
+
tool, and these declared facts into its general capability descriptor; the
|
|
78
|
+
same decision governs dispatch and teaching visibility.
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
gating and directory teaching fall out together (e.g. the `question` runtime
|
|
80
|
-
declares `requiresInteraction`).
|
|
80
|
+
Proposal behavior is orthogonal to capabilities. A handler proposes by
|
|
81
|
+
returning 202; the consumer's proposal lifecycle decides whether the client or
|
|
82
|
+
the loop's proposal disposition resolves it, with timeout as a lifecycle bound.
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
the consumer's proposal lifecycle decides whether a client, loop auto,
|
|
84
|
-
`noProposals`, or a timeout resolves it.
|
|
84
|
+
§manifest-self-doc **Self-doc split (terse pushes, depth pulls).** `example` is the hot-path operation example set rendered every turn — keep it terse. `documentation` is the deep prose (every op, channel, status code, gotcha); the consumer materializes it as a pull-able **`worker://~/_plurnk/plurnk/<name>.md`** entry whose exact H2 `Summary` is catalogued and whose body the model READs on demand, off the hot path. Both live on the manifest; the consumer decides what's pushed vs pulled. `glyph` is client display metadata under {§manifest-client-display}, not self-documentation.
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
**Authoring convention — `docs/<name>.md`.** The contract field stays a plain `string`, but a sibling SHOULD keep the deep doc in a **`docs/<name>.md`** file at the package root rather than inline, and load it into the manifest at module init — e.g. `documentation: await readFile(new URL("../docs/<name>.md", import.meta.url), "utf-8")` (top-level await; `../` resolves identically from `src/` in test and `dist/` once built). Ship it by adding `docs/**/*` to `files`. This keeps prose out of the handler source and gives editors real Markdown; the consumer materializes it at `worker://~/_plurnk/skills/plurnk/<name>.md`. A missing file fails-hard at import (no silent empty doc).
|
|
86
|
+
**Authoring convention — `docs/<name>.md`.** The contract field stays a plain `string`, but a sibling SHOULD keep the deep doc in a **`docs/<name>.md`** file at the package root rather than inline, and load it into the manifest at module init — e.g. `documentation: await readFile(new URL("../docs/<name>.md", import.meta.url), "utf-8")` (top-level await; `../` resolves identically from `src/` in test and `dist/` once built). Ship it by adding `docs/**/*` to `files`. This keeps prose out of the handler source and gives editors real Markdown; the consumer materializes it at `worker://~/_plurnk/plurnk/<name>.md`. A missing file fails-hard at import (no silent empty doc).
|
|
89
87
|
|
|
90
88
|
## §2 Interface
|
|
91
89
|
|
|
@@ -138,8 +136,10 @@ their mutation adapter.
|
|
|
138
136
|
acquisition seam for one exact resource. Core first resolves its canonical
|
|
139
137
|
authority, pathname, and owner, binds `ctx.entries`/channels/subscriptions to
|
|
140
138
|
that exact coordinate and owner, and removes the channel fragment. The request
|
|
141
|
-
is exactly `{ target, authority, pathname }`:
|
|
142
|
-
|
|
139
|
+
is exactly `{ target, metadata, authority, pathname }`: the target remains pure
|
|
140
|
+
resource identity while `metadata` is the exact opaque modifier or `null`.
|
|
141
|
+
READ coordinates, FIND matchers, the selected channel, and operation intent are
|
|
142
|
+
structurally unavailable.
|
|
143
143
|
|
|
144
144
|
A stored scheme omits the hook. An acquired scheme writes its complete channel
|
|
145
145
|
topology through `ctx.entries` and returns `200` readiness. A live scheme first
|
|
@@ -240,12 +240,17 @@ interface EditEffectReceipt {
|
|
|
240
240
|
readonly context: string;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
+
interface ParseIssueTransition {
|
|
244
|
+
readonly before: number;
|
|
245
|
+
readonly after: number;
|
|
246
|
+
}
|
|
247
|
+
|
|
243
248
|
interface AppliedEditBatchReceipt {
|
|
244
249
|
readonly revision: string;
|
|
245
250
|
readonly unit: EditReceiptUnit;
|
|
246
251
|
readonly before: number;
|
|
247
252
|
readonly after: number;
|
|
248
|
-
readonly parseIssues?:
|
|
253
|
+
readonly parseIssues?: ParseIssueTransition;
|
|
249
254
|
readonly effects: readonly EditEffectReceipt[];
|
|
250
255
|
}
|
|
251
256
|
|
|
@@ -254,7 +259,7 @@ interface ReviewerReplacementEditBatchReceipt {
|
|
|
254
259
|
readonly unit: EditReceiptUnit;
|
|
255
260
|
readonly before: number;
|
|
256
261
|
readonly after: number;
|
|
257
|
-
readonly parseIssues?:
|
|
262
|
+
readonly parseIssues?: ParseIssueTransition;
|
|
258
263
|
readonly disposition: "reviewer-replaced";
|
|
259
264
|
readonly superseded: readonly string[];
|
|
260
265
|
readonly replacement: EditEffectReceipt;
|
|
@@ -288,16 +293,17 @@ contains up to `C` lines on each side of its join.
|
|
|
288
293
|
|
|
289
294
|
The engine validates that receipt and owns the ordered COPY/MOVE resource
|
|
290
295
|
effects shown to consumers; plugins do not invent a second effect envelope.
|
|
291
|
-
`parseIssues`, when present,
|
|
292
|
-
complete resulting
|
|
293
|
-
hint is advisory: inspection failure
|
|
296
|
+
`parseIssues`, when present, carries nonnegative parser-recovery counts for the
|
|
297
|
+
complete source and resulting revisions. It is omitted when both are clean or
|
|
298
|
+
either inspection is unavailable. The hint is advisory: inspection failure
|
|
299
|
+
does not reverse a landed mutation.
|
|
294
300
|
|
|
295
301
|
## §3 Helpers exported by this repo
|
|
296
302
|
|
|
297
303
|
### Types
|
|
298
304
|
|
|
299
|
-
- Manifest
|
|
300
|
-
- Mutation receipts: `EditBatchResult`, `EditBatchReceipt`, `EditReceipt`, `EditEffectReceipt`, and `
|
|
305
|
+
- Manifest: `SchemeManifest`, `SchemeAuthority`, `EntryCoordinate`, and `WriterTier`.
|
|
306
|
+
- Mutation receipts: `EditBatchResult`, `EditBatchReceipt`, `EditReceipt`, `EditEffectReceipt`, `EditReceiptUnit`, and `ParseIssueTransition`.
|
|
301
307
|
- §scheme-packet-transform **Packet-section transformation.** A scheme may implement `transformSections(sections: PacketSectionDraft[]) → PacketSectionDraft[] | Promise<…>` to add, remove, or reorder sections before core measures the packet. The exact draft shape is `{ name; slot: "system"|"user"; header: string|null; content }`; no token measurement exists at this boundary. Core invokes implementations in registration order and applies `PacketSections.assertDrafts` to the initial list and every returned list. Names are non-empty and unique within the packet.
|
|
302
308
|
- Behavior contract: `SchemeHandler` (§2). Scheme-facing grammar types re-exported here so siblings pin only this package: `PlurnkStatement` + the per-op statement types (`ReadStatement`, `FindStatement`, `OpenStatement`, `FoldStatement`, `CopyStatement`, `MoveStatement`, `SendStatement`, `ExecStatement`, `WorkStatement`, `ForkStatement`, `KillStatement`, `PlanStatement`) and path types (`ParsedPath` = `LocalPath` | `UrlPath`). EDIT uses `ResolvedEditStatement`, also exported under the compatibility name `EditStatement`, under {§resolved-edit-statement}.
|
|
303
309
|
- Target syntax: contracts-owned `PathSyntax` is re-exported for the shared exact-versus-path-glob classifier {§path-glob}.
|
|
@@ -308,7 +314,7 @@ hint is advisory: inspection failure does not reverse a landed mutation.
|
|
|
308
314
|
- §scheme-catalog-parse-issues An `EntryCatalogChannel` may carry a positive `parseIssues` count when its exact content projection reported parser recovery sites. Zero and unavailable evidence are omitted. This is advisory metadata and never a validity gate or operation failure.
|
|
309
315
|
- Capability ctx (see §3.bis): `SchemeCtx`, `StreamSubscription`, and the domain capabilities. Entry authors additionally receive `EntryOperationCaps`, semantic `EntryOwner`/`EntryAddress`, and typed standard-operation results. `editBatch` receives every same-turn EDIT for one canonical resource and channel; it validates against one snapshot and commits one revision or none. There is no sequential single-EDIT fallback.
|
|
310
316
|
|
|
311
|
-
Behavior ships as `export default class` (one class per file, static methods) — the ecosystem class paradigm. Type-only modules, the barrel, and the frozen `
|
|
317
|
+
Behavior ships as `export default class` (one class per file, static methods) — the ecosystem class paradigm. Type-only modules, the barrel, and the frozen `DEFAULT_LOOP_POLICY` constant are the only non-class files.
|
|
312
318
|
|
|
313
319
|
### §network-address Network address identity
|
|
314
320
|
|
|
@@ -325,7 +331,7 @@ entry `authority` and `pathname`, a fragmentless and credential-free transport
|
|
|
325
331
|
| Path | Canonical pathname | Yes | No |
|
|
326
332
|
| Query | Serialized order, duplicates, and explicit empty `?` | Yes | No |
|
|
327
333
|
| Fragment | No | No | Yes |
|
|
328
|
-
| Userinfo
|
|
334
|
+
| Userinfo | No | No | No |
|
|
329
335
|
|
|
330
336
|
The canonical storage coordinate is authority `<host>[:<port>]` plus pathname
|
|
331
337
|
`<path>[?<query>]`, keyed together with workspace, owner, and the exact
|
|
@@ -334,10 +340,8 @@ its model-facing inverse: it applies the Plurnk lexical target spelling
|
|
|
334
340
|
{§path-parentheses} after reconstructing the exact address. Transport URLs and
|
|
335
341
|
storage identity never carry that syntax layer. Routing aliases select a
|
|
336
342
|
handler; they do not collapse resource identity.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
- `SchemeResolver.forLoop(handlers: ReadonlyMap<string, object>, flags: LoopFlags): Set<string>` — applies `manifest.flags` affinity to each handler and returns names of schemes active under the loop's flags.
|
|
343
|
+
Scheme metadata is statement-level input under {§scheme-metadata-modifier}; it
|
|
344
|
+
is never a `NetworkAddress` component.
|
|
341
345
|
|
|
342
346
|
### §mimetype-classifier Mimetype classification — `MimetypeClassifier`
|
|
343
347
|
|
|
@@ -359,15 +363,16 @@ entry channels beyond Unicode text.
|
|
|
359
363
|
| `readableBytes(chunks, mimetype)` | Project one async byte source under the mimetype family's bounded-input policy. |
|
|
360
364
|
| `identity(mimetype)` | Return the opaque identity of configured projection behavior for cache and materialization freshness. |
|
|
361
365
|
| `isBinary(mimetype)` | Classify through the configured registry; installed handler declarations remain authoritative. |
|
|
362
|
-
| `parseIssues(content, mimetype)` | Return
|
|
366
|
+
| `parseIssues(content, mimetype)` | Return a nonnegative parser-recovery count, or omit unavailable evidence, under {§mimetype-parse-issues}. |
|
|
363
367
|
| `ProjectedText` | Derived Unicode plus its output mimetype, source mimetype, and opaque projection identity. |
|
|
364
368
|
|
|
365
369
|
A returned object is present even when its `content` is `""`; only `null`
|
|
366
370
|
denotes absence. Consumers must not infer projection presence from content
|
|
367
371
|
length. Thrown readable, identity, and classification calls are execution
|
|
368
372
|
failures whose causes propagate; they must never be converted to `null`.
|
|
369
|
-
Parser-recovery inspection is deliberately non-gating:
|
|
370
|
-
|
|
373
|
+
Parser-recovery inspection is deliberately non-gating: successful clean
|
|
374
|
+
inspection returns `0`; tooling failure or structural degradation surfaces a
|
|
375
|
+
Notice where available and returns `undefined`.
|
|
371
376
|
`ProjectionInputLimitError` is the projection boundary's exported name for the
|
|
372
377
|
configured mimetype family's typed bounded-input failure.
|
|
373
378
|
|
|
@@ -402,11 +407,18 @@ start-column overshoots remain 416 errors.
|
|
|
402
407
|
snapshot.
|
|
403
408
|
- `Slicer.lineMarkerEdit` applies one replacement.
|
|
404
409
|
- `Slicer.lineMarkerEditBatch` validates all replacements against one snapshot,
|
|
405
|
-
|
|
410
|
+
resolves an identical twin, two insertions at one point, and an evidenced one-line shared
|
|
411
|
+
endpoint (reported in `merges`, receipts from `applied`), rejects every other overlap, and
|
|
412
|
+
applies all or none. An overlap Problem states the
|
|
413
|
+
failure once for the whole batch: every conflicting pair with its relation in
|
|
414
|
+
`conflicts`, the regions that conflict with nothing in `cleanRegions`, the
|
|
415
|
+
first pair in `conflictingRegions`, plus `editCount` and `applied: 0`. The
|
|
416
|
+
prose states counts only; it does not duplicate the coordinate arrays or add a
|
|
417
|
+
second line-only representation.
|
|
406
418
|
- `Slicer.page(items, marker, options?)` is the separate ordered-result
|
|
407
419
|
pagination helper; it accepts only one or two integer positions and can name
|
|
408
|
-
an operation-owned range unit.
|
|
409
|
-
|
|
420
|
+
an operation-owned range unit. An empty result set satisfies any well-formed
|
|
421
|
+
request as an empty page; only an inverted range fails.
|
|
410
422
|
- `Slicer.coversAvailable(range)` derives whether a successful range selected
|
|
411
423
|
the complete available extent; that fact is never serialized separately.
|
|
412
424
|
|
|
@@ -441,7 +453,7 @@ entries and channels never return a bare failure status.
|
|
|
441
453
|
|
|
442
454
|
### Matcher dispatch - `Matcher` {§matcher-dispatch}
|
|
443
455
|
|
|
444
|
-
- `Matcher.matchAgainstContent(body, content, mimetype, mimetypes)` is the body-matcher adapter over `Mimetypes.query` (glob/regex/jsonpath/xpath).
|
|
456
|
+
- `Matcher.matchAgainstContent(body, content, mimetype, mimetypes, diagnostic?)` is the body-matcher adapter over `Mimetypes.query` (glob/regex/jsonpath/xpath). The optional projector supplies one bounded caught-parser `diagnostic` extension without transferring error-formatting policy into this package or splicing implementation text into Problem prose.
|
|
445
457
|
- A match returns status 200 and `matches: MatchEvidence[]`.
|
|
446
458
|
`MatchEvidence` is `{locator?, region?, matched?}`. `locator` preserves a structural locator;
|
|
447
459
|
`matched` is the matched text itself, present for the regex and glob dialects so a match row
|
|
@@ -451,7 +463,7 @@ entries and channels never return a bare failure status.
|
|
|
451
463
|
Each item must contain at least one of `locator` or `region`; other fields violate
|
|
452
464
|
the shared evidence contract.
|
|
453
465
|
- The matcher is a boolean resource selector. It does not replace content with matched values or choose a retrieval window. FIND owns selection and pagination; exact READ owns text projection.
|
|
454
|
-
- Empty results return 204 with `matches: []`; `UnsupportedDialectError` maps to 415; `InvalidExpressionError` maps to 400; `QueryParseFailureError` maps to 203 with raw content, text/markdown, and `reason`.
|
|
466
|
+
- Empty results return 204 with `matches: []`; `UnsupportedDialectError` maps to 415; `InvalidExpressionError` maps to 400 with the bounded native parser cause when one was projected; `QueryParseFailureError` maps to 203 with raw content, text/markdown, and `reason`.
|
|
455
467
|
- A multi-resource matcher omits candidates that return 415 when at least one candidate supports the dialect. If no candidate supports it, the matcher returns the first exact 415 Problem. An unreadable binary marker therefore cannot poison a repository-wide text search or masquerade as a match.
|
|
456
468
|
|
|
457
469
|
### §capability-ctx §3.bis Capability ctx — the stable trusted-extension surface
|
|
@@ -525,7 +537,7 @@ after the handler returns. A streaming handler may retain only the exact
|
|
|
525
537
|
that subscription's identity without retaining the general context. Other
|
|
526
538
|
retained handler-owned resources follow {§handler-lifecycle}.
|
|
527
539
|
|
|
528
|
-
**Proposals are not a capability.** A side-effecting scheme proposes by *returning* a `ProposalResult` (status 202); the engine owns the resolution lifecycle. On acceptance it calls the handler's optional `applyResolution({ attrs, body }, ctx)` hook. `attrs` is the payload returned by the proposing operation and `body` is the resolver-approved body, when present. The hook returns a `ProposalApplyResult`: a status below 400 completes the accept; a failure preserves the applying scheme's Problem Details as the proposal's final result.
|
|
540
|
+
**Proposals are not a capability.** A side-effecting scheme proposes by *returning* a `ProposalResult` (status 202); the engine owns the resolution lifecycle. On acceptance it calls the handler's optional `applyResolution({ attrs, metadata, body }, ctx)` hook. `attrs` is the payload returned by the proposing operation, `metadata` is the exact statement-level scheme metadata retained only across the live proposal pause, and `body` is the resolver-approved body, when present. Metadata is never added to proposal attrs or client projection. The hook returns a `ProposalApplyResult`: a status below 400 completes the accept; a failure preserves the applying scheme's Problem Details as the proposal's final result.
|
|
529
541
|
|
|
530
542
|
§scheme-edit-proposal-receipt An accepted EDIT proposal may return its final
|
|
531
543
|
aggregate `editReceipt` alongside its per-row model-facing `result`. A resolver
|
package/dist/Manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Manifest.d.ts","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6D,cAAc,EAAc,MAAM,YAAY,CAAC;AA+BxH,MAAM,CAAC,OAAO,OAAO,QAAQ;;IACzB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,cAAc,CA+DjE;CAwCJ"}
|
package/dist/Manifest.js
CHANGED
|
@@ -16,16 +16,16 @@ const MANIFEST_FIELD_NAMES = new Set(Object.keys({
|
|
|
16
16
|
modelVisible: true,
|
|
17
17
|
folderScopes: true,
|
|
18
18
|
textEditScopes: true,
|
|
19
|
+
metadataModifier: true,
|
|
19
20
|
lineAnchors: true,
|
|
20
21
|
foldedByDefault: true,
|
|
21
|
-
|
|
22
|
+
traits: true,
|
|
22
23
|
example: true,
|
|
23
24
|
documentation: true,
|
|
24
25
|
glyph: true,
|
|
25
26
|
storedScheme: true,
|
|
26
27
|
}));
|
|
27
|
-
const
|
|
28
|
-
const FLAG_AFFINITY_NAMES = new Set(FLAG_AFFINITIES);
|
|
28
|
+
const TRAIT = /^[a-z][a-z0-9-]*$/;
|
|
29
29
|
export default class Manifest {
|
|
30
30
|
static of(handler, expectedName) {
|
|
31
31
|
if (typeof handler !== "object" || handler === null) {
|
|
@@ -86,12 +86,12 @@ export default class Manifest {
|
|
|
86
86
|
}
|
|
87
87
|
Manifest.#boolean(manifest, "volatile");
|
|
88
88
|
Manifest.#boolean(manifest, "modelVisible");
|
|
89
|
-
for (const field of ["folderScopes", "textEditScopes", "lineAnchors", "foldedByDefault"])
|
|
89
|
+
for (const field of ["folderScopes", "textEditScopes", "metadataModifier", "lineAnchors", "foldedByDefault"])
|
|
90
90
|
Manifest.#optionalBoolean(manifest, field);
|
|
91
91
|
for (const field of ["example", "documentation", "storedScheme"])
|
|
92
92
|
Manifest.#optionalString(manifest, field);
|
|
93
93
|
Manifest.#optionalNonemptyString(manifest, "glyph");
|
|
94
|
-
Manifest.#
|
|
94
|
+
Manifest.#traits(manifest.traits, name);
|
|
95
95
|
return value;
|
|
96
96
|
}
|
|
97
97
|
static #string(record, field, emptyAllowed = false) {
|
|
@@ -120,21 +120,13 @@ export default class Manifest {
|
|
|
120
120
|
throw new Error(`scheme manifest.${field} must be a non-empty string when present`);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
static #
|
|
123
|
+
static #traits(value, name) {
|
|
124
124
|
if (value === undefined)
|
|
125
125
|
return;
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const unknown = Object.keys(flags).find((field) => !FLAG_AFFINITY_NAMES.has(field));
|
|
131
|
-
if (unknown !== undefined) {
|
|
132
|
-
throw new Error(`scheme '${name}' manifest.flags has unknown field '${unknown}'`);
|
|
133
|
-
}
|
|
134
|
-
for (const field of FLAG_AFFINITIES) {
|
|
135
|
-
if (flags[field] !== undefined && typeof flags[field] !== "boolean") {
|
|
136
|
-
throw new Error(`scheme '${name}' manifest.flags.${field} must be boolean`);
|
|
137
|
-
}
|
|
126
|
+
if (!Array.isArray(value)
|
|
127
|
+
|| !value.every((trait) => typeof trait === "string" && TRAIT.test(trait))
|
|
128
|
+
|| new Set(value).size !== value.length) {
|
|
129
|
+
throw new Error(`scheme '${name}' manifest.traits must contain unique lowercase trait names`);
|
|
138
130
|
}
|
|
139
131
|
}
|
|
140
132
|
}
|
package/dist/Manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.js","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,IAAI,GAAG,CAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC9E,MAAM,UAAU,GAAG,IAAI,GAAG,CAA6B,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AACvF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC;AACjF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAmB,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAA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CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;eACvE,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,6DAA6D,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;CACJ"}
|
package/dist/Matcher.d.ts
CHANGED
|
@@ -9,6 +9,6 @@ export interface MatchResult extends SchemeResult {
|
|
|
9
9
|
}
|
|
10
10
|
export default class Matcher {
|
|
11
11
|
#private;
|
|
12
|
-
static matchAgainstContent(body: MatcherBody, content: string, mimetype: string, mimetypes: Mimetypes): Promise<MatchResult>;
|
|
12
|
+
static matchAgainstContent(body: MatcherBody, content: string, mimetype: string, mimetypes: Mimetypes, diagnostic?: (cause: unknown) => string): Promise<MatchResult>;
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=Matcher.d.ts.map
|
package/dist/Matcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matcher.d.ts","sourceRoot":"","sources":["../src/Matcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAiC,MAAM,0BAA0B,CAAC;AAOzF,OAAgB,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,OAAO,OAAO;;IAkDxB,OAAa,mBAAmB,CAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Matcher.d.ts","sourceRoot":"","sources":["../src/Matcher.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAiC,MAAM,0BAA0B,CAAC;AAOzF,OAAgB,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,OAAO,OAAO;;IAkDxB,OAAa,mBAAmB,CAC5B,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,SAAS,EACpB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GACxC,OAAO,CAAC,WAAW,CAAC,CAwEtB;CACJ"}
|
package/dist/Matcher.js
CHANGED
|
@@ -58,7 +58,7 @@ export default class Matcher {
|
|
|
58
58
|
default: return body.raw;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
static async matchAgainstContent(body, content, mimetype, mimetypes) {
|
|
61
|
+
static async matchAgainstContent(body, content, mimetype, mimetypes, diagnostic) {
|
|
62
62
|
try {
|
|
63
63
|
// Pass the parsed matcher (declared dialect authoritative) + `hint`
|
|
64
64
|
// (source mimetype, so the framework picks the right per-mimetype
|
|
@@ -91,10 +91,13 @@ export default class Matcher {
|
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
if (name === "InvalidExpressionError" || err instanceof InvalidExpressionError) {
|
|
94
|
+
const cause = err instanceof Error ? err.cause : undefined;
|
|
95
|
+
const causeDetail = cause === undefined || diagnostic === undefined ? "" : diagnostic(cause).trim();
|
|
94
96
|
return Results.failure("schemes:matcher", "invalid-expression", 400, `The ${body.dialect} matcher expression is invalid.`, {}, {
|
|
95
97
|
stage: "matcher",
|
|
96
98
|
dialect: body.dialect,
|
|
97
|
-
|
|
99
|
+
...(causeDetail === "" ? {} : { diagnostic: causeDetail }),
|
|
100
|
+
recovery: "Revise the matcher expression.",
|
|
98
101
|
retryable: false,
|
|
99
102
|
});
|
|
100
103
|
}
|
package/dist/Matcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Matcher.js","sourceRoot":"","sources":["../src/Matcher.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yEAAyE;AACzE,4EAA4E;AAC5E,0EAA0E;AAC1E,kBAAkB;AAClB,EAAE;AACF,sEAAsE;AACtE,gFAAgF;AAIhF,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,OAAkD,MAAM,cAAc,CAAC;AAS9E,MAAM,CAAC,OAAO,OAAO,OAAO;IACxB,MAAM,CAAC,SAAS,CAAC,OAA8B,EAAE,OAA+B;QAC5E,MAAM,QAAQ,GAAoB,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;YACpC,0FAA0F;YAC1F,MAAM,OAAO,GAAG,CAAC,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAA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,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC;oBAC1D,QAAQ,EAAE,gCAAgC;oBAC1C,SAAS,EAAE,KAAK;iBACnB,CACJ,CAAC;YACN,CAAC;YACD,IAAI,IAAI,KAAK,wBAAwB,IAAI,GAAG,YAAY,sBAAsB,EAAE,CAAC;gBAC7E,6DAA6D;gBAC7D,2DAA2D;gBAC3D,OAAO;oBACH,MAAM,EAAE,GAAG;oBACX,IAAI,EAAE,OAAO;oBACb,QAAQ,EAAE,uBAAuB;oBACjC,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBAC3D,CAAC;YACN,CAAC;YACD,gEAAgE;YAChE,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;CACJ"}
|
package/dist/OutputScheme.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SchemeManifest } from "./types.ts";
|
|
2
2
|
export interface RuntimeDecl {
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly glyph?: string;
|
|
5
5
|
readonly example?: string;
|
|
6
6
|
readonly channels: Record<string, string>;
|
|
7
7
|
readonly defaultChannel: string;
|
|
8
|
-
readonly
|
|
8
|
+
readonly traits?: ReadonlyArray<string>;
|
|
9
9
|
}
|
|
10
10
|
export default class OutputScheme {
|
|
11
11
|
static manifestFromRuntime(decl: RuntimeDecl): SchemeManifest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutputScheme.d.ts","sourceRoot":"","sources":["../src/OutputScheme.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"OutputScheme.d.ts","sourceRoot":"","sources":["../src/OutputScheme.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,MAAM,WAAW,WAAW;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,CAAC,OAAO,OAAO,YAAY;IAO7B,MAAM,CAAC,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,CAkB5D;CACJ"}
|
package/dist/OutputScheme.js
CHANGED
package/dist/OutputScheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutputScheme.js","sourceRoot":"","sources":["../src/OutputScheme.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,kCAAkC;AAClC,4EAA4E;AAC5E,sFAAsF;AACtF,wFAAwF;AACxF,gDAAgD;
|
|
1
|
+
{"version":3,"file":"OutputScheme.js","sourceRoot":"","sources":["../src/OutputScheme.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,kCAAkC;AAClC,4EAA4E;AAC5E,sFAAsF;AACtF,wFAAwF;AACxF,gDAAgD;AAehD,MAAM,CAAC,OAAO,OAAO,YAAY;IAC7B,uEAAuE;IACvE,wEAAwE;IACxE,6EAA6E;IAC7E,wEAAwE;IACxE,qEAAqE;IACrE,0EAA0E;IAC1E,MAAM,CAAC,mBAAmB,CAAC,IAAiB;QACxC,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,OAAO;YAClB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,CAAC,QAAQ,CAAC;YACtB,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,IAAI;YAClB,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,IAAI;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;SACtB,CAAC;IACN,CAAC;CACJ"}
|
package/dist/Slicer.d.ts
CHANGED
|
@@ -19,9 +19,40 @@ export interface PageResult<T> extends SchemeResult {
|
|
|
19
19
|
items?: T[];
|
|
20
20
|
range?: RangeExtent;
|
|
21
21
|
}
|
|
22
|
+
export type EditMerge = {
|
|
23
|
+
readonly index: number;
|
|
24
|
+
readonly rule: "duplicate-of";
|
|
25
|
+
readonly of: number;
|
|
26
|
+
readonly whitespaceOnly?: true;
|
|
27
|
+
} | {
|
|
28
|
+
readonly index: number;
|
|
29
|
+
readonly rule: "shared-endpoint";
|
|
30
|
+
readonly line: number;
|
|
31
|
+
readonly text: string;
|
|
32
|
+
readonly authored: readonly number[];
|
|
33
|
+
readonly applied: readonly number[];
|
|
34
|
+
readonly claimedBy: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly index: number;
|
|
37
|
+
readonly rule: "same-insertion-point";
|
|
38
|
+
readonly after: number;
|
|
39
|
+
} | {
|
|
40
|
+
readonly index: number;
|
|
41
|
+
readonly rule: "contained-relocated";
|
|
42
|
+
readonly outer: number;
|
|
43
|
+
readonly at: number;
|
|
44
|
+
readonly authored: readonly number[];
|
|
45
|
+
readonly originalLines: number;
|
|
46
|
+
} | {
|
|
47
|
+
readonly index: number;
|
|
48
|
+
readonly rule: "contained-already-applied";
|
|
49
|
+
readonly outer: number;
|
|
50
|
+
};
|
|
22
51
|
export interface EditResult extends SchemeResult {
|
|
23
52
|
result?: string;
|
|
24
53
|
range?: RangeExtent;
|
|
54
|
+
merges?: readonly EditMerge[];
|
|
55
|
+
applied?: readonly BatchEdit[];
|
|
25
56
|
}
|
|
26
57
|
export interface BatchEdit {
|
|
27
58
|
readonly marker: LineMarker;
|
|
@@ -36,7 +67,6 @@ export default class Slicer {
|
|
|
36
67
|
static lines(content: string, marker: LineMarker): SliceResult;
|
|
37
68
|
static page<T>(items: readonly T[], marker: LineMarker, options?: {
|
|
38
69
|
readonly unit?: RangeUnit;
|
|
39
|
-
readonly allowEmpty?: boolean;
|
|
40
70
|
}): PageResult<T>;
|
|
41
71
|
static linesRaw(content: string, marker: LineMarker): SliceResult;
|
|
42
72
|
static lineMarkerEdit(content: string, marker: LineMarker, body: string): EditResult;
|
package/dist/Slicer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slicer.d.ts","sourceRoot":"","sources":["../src/Slicer.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAQnF,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC;CAC/C;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAC5C,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;CACvB;A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