@orkestrel/brief 0.0.7 → 0.0.8
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 +20 -6
- package/dist/src/core/index.cjs +93 -13
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +332 -165
- package/dist/src/core/index.d.ts +332 -165
- package/dist/src/core/index.js +93 -13
- package/dist/src/core/index.js.map +1 -1
- package/package.json +15 -16
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Ambiguity } from '@orkestrel/interpret';
|
|
1
|
+
import type { Ambiguity } from '@orkestrel/interpret';
|
|
2
2
|
import { ArrayShape } from '@orkestrel/contract';
|
|
3
3
|
import { BooleanShape } from '@orkestrel/contract';
|
|
4
|
-
import { ContractInterface } from '@orkestrel/contract';
|
|
5
|
-
import { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
6
|
-
import { EmitterHooks } from '@orkestrel/emitter';
|
|
7
|
-
import { EmitterInterface } from '@orkestrel/emitter';
|
|
8
|
-
import { Entity } from '@orkestrel/interpret';
|
|
9
|
-
import { Guard } from '@orkestrel/contract';
|
|
10
|
-
import { Intent } from '@orkestrel/interpret';
|
|
11
|
-
import { Interpretation } from '@orkestrel/interpret';
|
|
12
|
-
import { InterpretInterface } from '@orkestrel/interpret';
|
|
4
|
+
import type { ContractInterface } from '@orkestrel/contract';
|
|
5
|
+
import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
6
|
+
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
7
|
+
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
8
|
+
import type { Entity } from '@orkestrel/interpret';
|
|
9
|
+
import type { Guard } from '@orkestrel/contract';
|
|
10
|
+
import type { Intent } from '@orkestrel/interpret';
|
|
11
|
+
import type { Interpretation } from '@orkestrel/interpret';
|
|
12
|
+
import type { InterpretInterface } from '@orkestrel/interpret';
|
|
13
13
|
import { LiteralShape } from '@orkestrel/contract';
|
|
14
|
-
import { LogicalDefinition } from '@orkestrel/reason';
|
|
15
|
-
import { LogicalResult } from '@orkestrel/reason';
|
|
14
|
+
import type { LogicalDefinition } from '@orkestrel/reason';
|
|
15
|
+
import type { LogicalResult } from '@orkestrel/reason';
|
|
16
16
|
import { NumberShape } from '@orkestrel/contract';
|
|
17
17
|
import { ObjectShape } from '@orkestrel/contract';
|
|
18
18
|
import { OptionalShape } from '@orkestrel/contract';
|
|
19
|
-
import { ReasonInterface } from '@orkestrel/reason';
|
|
20
|
-
import { ReasonValidationResult } from '@orkestrel/reason';
|
|
21
|
-
import { RecordOptions } from '@orkestrel/interpret';
|
|
22
|
-
import { StringShape } from '@orkestrel/contract';
|
|
23
|
-
import { Subject } from '@orkestrel/reason';
|
|
19
|
+
import type { ReasonInterface } from '@orkestrel/reason';
|
|
20
|
+
import type { ReasonValidationResult } from '@orkestrel/reason';
|
|
21
|
+
import type { RecordOptions } from '@orkestrel/interpret';
|
|
22
|
+
import type { StringShape } from '@orkestrel/contract';
|
|
23
|
+
import type { Subject } from '@orkestrel/reason';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Narrows unknown data to a `Brief`, throwing when it is off-contract.
|
|
@@ -133,7 +133,13 @@ import { Subject } from '@orkestrel/reason';
|
|
|
133
133
|
destroy(): void;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Declares the `BriefCompiler`'s push observation surface.
|
|
138
|
+
*
|
|
139
|
+
* @remarks
|
|
140
|
+
* `compile` carries the `Briefing` the call produced, `block` carries the blocking `Gap` list
|
|
141
|
+
* that stopped emission, `error` carries the thrown value, and `destroy` carries nothing.
|
|
142
|
+
*/
|
|
137
143
|
export declare type BriefCompilerEventMap = {
|
|
138
144
|
readonly compile: readonly [briefing: Briefing];
|
|
139
145
|
readonly block: readonly [questions: readonly Gap[]];
|
|
@@ -143,11 +149,39 @@ import { Subject } from '@orkestrel/reason';
|
|
|
143
149
|
|
|
144
150
|
/** Declares the compilation orchestrator contract. */
|
|
145
151
|
export declare interface BriefCompilerInterface {
|
|
152
|
+
/** Holds the typed emitter carrying `compile`, `block`, `error`, and `destroy`. */
|
|
146
153
|
readonly emitter: EmitterInterface<BriefCompilerEventMap>;
|
|
154
|
+
/** Holds the interpret pipeline the `interpret` stage delegates to, owned or borrowed. */
|
|
147
155
|
readonly interpret: InterpretInterface;
|
|
156
|
+
/** Holds the reasoner the gate evaluates its `LogicalDefinition` on, owned or borrowed. */
|
|
148
157
|
readonly reason: ReasonInterface;
|
|
158
|
+
/**
|
|
159
|
+
* Runs the `interpret` → `draft` → `gate` → `pin` pipeline over a `BriefInput`, returning a
|
|
160
|
+
* complete or visible-incomplete result.
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* Synchronous, and it never throws for a brief it cannot emit: a blocking gap, a refused
|
|
164
|
+
* gate, and a thrown stage each record their cause on `failures` and leave `brief` absent.
|
|
165
|
+
*
|
|
166
|
+
* @param input - The caller's text, interpretation, and authored sections.
|
|
167
|
+
* @returns The `Briefing` for this call, complete exactly when `brief` is present.
|
|
168
|
+
*/
|
|
149
169
|
compile(input: BriefInput): Briefing;
|
|
170
|
+
/**
|
|
171
|
+
* Evaluates one brief's readiness through the reasons gate — `briefToSubject` against
|
|
172
|
+
* `buildGateDefinition()`.
|
|
173
|
+
*
|
|
174
|
+
* @param brief - The brief to measure.
|
|
175
|
+
* @returns The reasoner's traceable verdict, whose `conclusion` is the `ready` fact.
|
|
176
|
+
*/
|
|
150
177
|
gate(brief: Brief): LogicalResult;
|
|
178
|
+
/**
|
|
179
|
+
* Tears the orchestrator down idempotently — owned engines first, the emitter last.
|
|
180
|
+
*
|
|
181
|
+
* @remarks
|
|
182
|
+
* Emits `destroy` between the two, and releases only the engines it created. Every method
|
|
183
|
+
* except this one throws `BriefError('DESTROYED', …)` afterwards.
|
|
184
|
+
*/
|
|
151
185
|
destroy(): void;
|
|
152
186
|
}
|
|
153
187
|
|
|
@@ -203,6 +237,9 @@ import { Subject } from '@orkestrel/reason';
|
|
|
203
237
|
* Represents the one error class this package throws.
|
|
204
238
|
*
|
|
205
239
|
* @remarks
|
|
240
|
+
* Extends `Error` with a readonly `code` on the `BriefErrorCode` vocabulary and an optional
|
|
241
|
+
* readonly `context` record carrying whatever the raising site can supply.
|
|
242
|
+
*
|
|
206
243
|
* Throws are reserved for caller misuse: `assertBrief`, `snapshotBrief`, and `pinBrief` on
|
|
207
244
|
* off-contract data throw `INVALID`; any method after `destroy()` throws `DESTROYED`; and `BriefCompiler.gate` throws
|
|
208
245
|
* `GATE_FAILED` when a borrowed reasoner returns a non-logical result. A stage that fails
|
|
@@ -258,7 +295,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
258
295
|
* types — import them from `@orkestrel/interpret` and `@orkestrel/reason`.
|
|
259
296
|
*
|
|
260
297
|
* `digest` identifies this OUTCOME — the brief, the questions, and the failures together — so
|
|
261
|
-
* two identical compiles share it and a refused compile has one
|
|
298
|
+
* two identical compiles share it and a refused compile has one the same way a complete one does.
|
|
262
299
|
* It is not `Brief.hash`, which identifies the brief's content alone and exists only on an
|
|
263
300
|
* emitted brief. Key a cache of compile results by `digest`; key a registry of briefs by
|
|
264
301
|
* `hash`.
|
|
@@ -340,7 +377,13 @@ import { Subject } from '@orkestrel/reason';
|
|
|
340
377
|
destroy(): void;
|
|
341
378
|
}
|
|
342
379
|
|
|
343
|
-
/**
|
|
380
|
+
/**
|
|
381
|
+
* Declares the `BriefManager`'s push observation surface.
|
|
382
|
+
*
|
|
383
|
+
* @remarks
|
|
384
|
+
* `add` and `remove` each carry the record id the store minted from the brief's content hash,
|
|
385
|
+
* and `destroy` carries nothing.
|
|
386
|
+
*/
|
|
344
387
|
export declare type BriefManagerEventMap = {
|
|
345
388
|
readonly add: readonly [id: string];
|
|
346
389
|
readonly remove: readonly [id: string];
|
|
@@ -357,15 +400,62 @@ import { Subject } from '@orkestrel/reason';
|
|
|
357
400
|
* unchanged content is a version no-op.
|
|
358
401
|
*/
|
|
359
402
|
export declare interface BriefManagerInterface {
|
|
403
|
+
/** Holds the typed emitter carrying `add`, `remove`, and `destroy`. */
|
|
360
404
|
readonly emitter: EmitterInterface<BriefManagerEventMap>;
|
|
405
|
+
/** Holds how many records are registered. */
|
|
361
406
|
readonly count: number;
|
|
407
|
+
/**
|
|
408
|
+
* Reports whether a brief with the given id is registered.
|
|
409
|
+
*
|
|
410
|
+
* @param id - The record id to look for.
|
|
411
|
+
* @returns True if a record carries that id; false otherwise.
|
|
412
|
+
*/
|
|
362
413
|
has(id: string): boolean;
|
|
414
|
+
/**
|
|
415
|
+
* Looks up one registered brief record by id.
|
|
416
|
+
*
|
|
417
|
+
* @param id - The record id to read.
|
|
418
|
+
* @returns The record, or `undefined` when no record carries that id.
|
|
419
|
+
*/
|
|
363
420
|
brief(id: string): BriefRecord | undefined;
|
|
421
|
+
/**
|
|
422
|
+
* Lists every registered brief record.
|
|
423
|
+
*
|
|
424
|
+
* @returns The records, in registration order.
|
|
425
|
+
*/
|
|
364
426
|
briefs(): readonly BriefRecord[];
|
|
427
|
+
/**
|
|
428
|
+
* Registers one brief from its data, minting the id from its content hash when none is given.
|
|
429
|
+
*
|
|
430
|
+
* @remarks
|
|
431
|
+
* Emits `add`. `version` bumps only when the content hash moves, so re-adding unchanged
|
|
432
|
+
* content is a no-op that keeps the record it already had.
|
|
433
|
+
*
|
|
434
|
+
* @param brief - The brief to register.
|
|
435
|
+
* @param options - An explicit `id` to key the record by.
|
|
436
|
+
* @returns The registered record.
|
|
437
|
+
*/
|
|
365
438
|
add(brief: Brief, options?: RecordOptions): BriefRecord;
|
|
439
|
+
/**
|
|
440
|
+
* Removes the listed briefs by id, one brief by id, or every brief.
|
|
441
|
+
*
|
|
442
|
+
* @remarks
|
|
443
|
+
* Emits `remove` once per removed id. The array overload is declared first so an id list
|
|
444
|
+
* resolves to the batch form, which reports `true` only when every listed id was present.
|
|
445
|
+
*
|
|
446
|
+
* @param ids - The record ids to remove.
|
|
447
|
+
* @returns True when every listed id was registered; false otherwise.
|
|
448
|
+
*/
|
|
366
449
|
remove(ids: readonly string[]): boolean;
|
|
367
450
|
remove(id: string): boolean;
|
|
368
451
|
remove(): void;
|
|
452
|
+
/**
|
|
453
|
+
* Tears the registry down idempotently — the collection first, the emitter last.
|
|
454
|
+
*
|
|
455
|
+
* @remarks
|
|
456
|
+
* Emits `destroy` between the two. Every method except this one throws
|
|
457
|
+
* `BriefError('DESTROYED', …)` afterwards.
|
|
458
|
+
*/
|
|
369
459
|
destroy(): void;
|
|
370
460
|
}
|
|
371
461
|
|
|
@@ -391,80 +481,80 @@ import { Subject } from '@orkestrel/reason';
|
|
|
391
481
|
* `trace` and `hash` are optional because `pinBrief` fills them; an unpinned draft is
|
|
392
482
|
* on-contract without them.
|
|
393
483
|
*/
|
|
394
|
-
export declare const briefShape: ObjectShape<{
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
484
|
+
export declare const briefShape: ObjectShape< {
|
|
485
|
+
task: ObjectShape< {
|
|
486
|
+
operation: LiteralShape<readonly TaskOperation[]>;
|
|
487
|
+
domain: LiteralShape<readonly TaskDomain[]>;
|
|
488
|
+
statement: StringShape;
|
|
489
|
+
}, false>;
|
|
490
|
+
authority: ArrayShape<ObjectShape< {
|
|
491
|
+
path: StringShape;
|
|
492
|
+
note: StringShape;
|
|
493
|
+
}, false>>;
|
|
494
|
+
manifest: ObjectShape< {
|
|
495
|
+
read: ArrayShape<ObjectShape< {
|
|
496
|
+
path: StringShape;
|
|
497
|
+
note: StringShape;
|
|
498
|
+
}, false>>;
|
|
499
|
+
edit: ArrayShape<ObjectShape< {
|
|
500
|
+
path: StringShape;
|
|
501
|
+
note: StringShape;
|
|
502
|
+
}, false>>;
|
|
503
|
+
locked: ArrayShape<ObjectShape< {
|
|
504
|
+
path: StringShape;
|
|
505
|
+
note: StringShape;
|
|
506
|
+
}, false>>;
|
|
507
|
+
forbidden: ArrayShape<ObjectShape< {
|
|
508
|
+
path: StringShape;
|
|
509
|
+
note: StringShape;
|
|
510
|
+
}, false>>;
|
|
511
|
+
}, false>;
|
|
512
|
+
outcomes: ArrayShape<ObjectShape< {
|
|
513
|
+
rank: NumberShape;
|
|
514
|
+
text: StringShape;
|
|
515
|
+
required: BooleanShape;
|
|
516
|
+
}, false>>;
|
|
517
|
+
rules: ArrayShape<StringShape>;
|
|
518
|
+
invariants: ArrayShape<StringShape>;
|
|
519
|
+
givens: ArrayShape<ObjectShape< {
|
|
520
|
+
category: StringShape;
|
|
521
|
+
name: StringShape;
|
|
522
|
+
value: StringShape;
|
|
523
|
+
}, false>>;
|
|
524
|
+
examples: ArrayShape<ObjectShape< {
|
|
525
|
+
input: StringShape;
|
|
526
|
+
output: StringShape;
|
|
527
|
+
note: OptionalShape<StringShape>;
|
|
528
|
+
}, false>>;
|
|
529
|
+
assumptions: ArrayShape<StringShape>;
|
|
530
|
+
citations: ArrayShape<ObjectShape< {
|
|
531
|
+
name: StringShape;
|
|
532
|
+
url: StringShape;
|
|
533
|
+
note: StringShape;
|
|
534
|
+
}, false>>;
|
|
535
|
+
gaps: ArrayShape<ObjectShape< {
|
|
536
|
+
field: StringShape;
|
|
537
|
+
question: StringShape;
|
|
538
|
+
blocking: BooleanShape;
|
|
539
|
+
candidates: OptionalShape<ArrayShape<StringShape>>;
|
|
540
|
+
}, false>>;
|
|
541
|
+
risks: ArrayShape<ObjectShape< {
|
|
542
|
+
severity: LiteralShape<readonly RiskSeverity[]>;
|
|
543
|
+
text: StringShape;
|
|
544
|
+
mitigation: StringShape;
|
|
545
|
+
}, false>>;
|
|
546
|
+
output: ObjectShape< {
|
|
547
|
+
format: LiteralShape<readonly OutputFormat[]>;
|
|
548
|
+
sections: OptionalShape<ArrayShape<StringShape>>;
|
|
549
|
+
include: OptionalShape<ArrayShape<StringShape>>;
|
|
550
|
+
exclude: OptionalShape<ArrayShape<StringShape>>;
|
|
551
|
+
}, false>;
|
|
552
|
+
proofs: ArrayShape<ObjectShape< {
|
|
553
|
+
text: StringShape;
|
|
554
|
+
command: StringShape;
|
|
555
|
+
}, false>>;
|
|
556
|
+
trace: OptionalShape<StringShape>;
|
|
557
|
+
hash: OptionalShape<StringShape>;
|
|
468
558
|
}, false>;
|
|
469
559
|
|
|
470
560
|
/** Names the fixed compilation phases, in pipeline order. */
|
|
@@ -511,10 +601,11 @@ import { Subject } from '@orkestrel/reason';
|
|
|
511
601
|
* Projects a brief into a subagent `Dispatch`.
|
|
512
602
|
*
|
|
513
603
|
* @remarks
|
|
514
|
-
* `edit` is exactly `manifest.edit
|
|
515
|
-
* can run concurrently under the same brief without conflict.
|
|
604
|
+
* `edit` is exactly `manifest.edit` — the owned set — so two dispatches whose `edit` sets do
|
|
605
|
+
* not intersect can run concurrently under the same brief without conflict. `locked` and
|
|
606
|
+
* `forbidden` cross unchanged as the do-not-touch sets.
|
|
516
607
|
*
|
|
517
|
-
* `authority` is exactly `brief.authority` in rank order, and it is a
|
|
608
|
+
* `authority` is exactly `brief.authority` in rank order, and it is a separate axis from the
|
|
518
609
|
* permission sets rather than a further partition — a ranked path normally also appears in
|
|
519
610
|
* `read` or `locked`, because the executor has to open what it obeys. It is projected as
|
|
520
611
|
* paths so a machine consumer never has to parse `prompt`, which is written for a model.
|
|
@@ -588,8 +679,9 @@ import { Subject } from '@orkestrel/reason';
|
|
|
588
679
|
* Projects a brief into the copy-ready agent prompt.
|
|
589
680
|
*
|
|
590
681
|
* @remarks
|
|
591
|
-
*
|
|
592
|
-
*
|
|
682
|
+
* Sections render in authority order, so the executor meets what wins a conflict before what
|
|
683
|
+
* it may touch. Paths are referenced, never inlined — the executor retrieves them. An empty
|
|
684
|
+
* section is omitted entirely, so the rendering carries no filler an executor must read past.
|
|
593
685
|
*
|
|
594
686
|
* @param input - The brief to render.
|
|
595
687
|
* @returns The markdown prompt.
|
|
@@ -837,6 +929,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
837
929
|
/**
|
|
838
930
|
* Assembles a `Reference` from a path and the note that justifies listing it.
|
|
839
931
|
*
|
|
932
|
+
* @remarks
|
|
933
|
+
* The one builder for an authority entry and a manifest entry alike: the container the record
|
|
934
|
+
* lands in is what says whether the path is ranked or permitted.
|
|
935
|
+
*
|
|
840
936
|
* @param path - The referenced path or glob.
|
|
841
937
|
* @param note - Why the path is listed.
|
|
842
938
|
* @returns A fresh `Reference`.
|
|
@@ -946,10 +1042,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
946
1042
|
}
|
|
947
1043
|
|
|
948
1044
|
/** Describes the `Citation` shape — a name, a locator, and why the source is cited. */
|
|
949
|
-
export declare const citationShape: ObjectShape<{
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1045
|
+
export declare const citationShape: ObjectShape< {
|
|
1046
|
+
name: StringShape;
|
|
1047
|
+
url: StringShape;
|
|
1048
|
+
note: StringShape;
|
|
953
1049
|
}, false>;
|
|
954
1050
|
|
|
955
1051
|
/**
|
|
@@ -998,6 +1094,45 @@ import { Subject } from '@orkestrel/reason';
|
|
|
998
1094
|
* emitter hooks.
|
|
999
1095
|
* @returns A working {@link BriefCompilerInterface}.
|
|
1000
1096
|
*
|
|
1097
|
+
* @example Compile and project a brief
|
|
1098
|
+
* ```ts
|
|
1099
|
+
* import {
|
|
1100
|
+
* briefToGoal,
|
|
1101
|
+
* briefToMarkdown,
|
|
1102
|
+
* buildOutcome,
|
|
1103
|
+
* buildProof,
|
|
1104
|
+
* buildTask,
|
|
1105
|
+
* createBriefCompiler,
|
|
1106
|
+
* } from '@orkestrel/brief'
|
|
1107
|
+
*
|
|
1108
|
+
* const compiler = createBriefCompiler()
|
|
1109
|
+
*
|
|
1110
|
+
* const briefing = compiler.compile({
|
|
1111
|
+
* task: buildTask('refactor', 'code', 'Refactor useForm to native browser form APIs.'),
|
|
1112
|
+
* authority: [{ path: 'AGENTS.md', note: 'project law; wins every conflict' }],
|
|
1113
|
+
* manifest: {
|
|
1114
|
+
* read: [
|
|
1115
|
+
* { path: 'AGENTS.md', note: 'project law; wins every conflict' },
|
|
1116
|
+
* { path: 'guides/browser.md', note: 'the composable contract' },
|
|
1117
|
+
* ],
|
|
1118
|
+
* edit: [{ path: 'src/browser/composables/useForm.ts', note: 'the composable being refactored' }],
|
|
1119
|
+
* locked: [{ path: 'src/browser/types.ts', note: 'the published contract' }],
|
|
1120
|
+
* forbidden: [{ path: 'app/**', note: 'out of scope' }],
|
|
1121
|
+
* },
|
|
1122
|
+
* outcomes: [buildOutcome(1, 'useForm uses native FormData with no behavior change')],
|
|
1123
|
+
* proofs: [buildProof('type-check and lint pass', 'npm run check')],
|
|
1124
|
+
* })
|
|
1125
|
+
*
|
|
1126
|
+
* briefing.brief !== undefined // true — the brief is present exactly when the gate passed
|
|
1127
|
+
* if (briefing.brief !== undefined) {
|
|
1128
|
+
* briefToMarkdown(briefing.brief) // the copy-ready agent prompt
|
|
1129
|
+
* briefToGoal(briefing.brief) // the /goal completion condition
|
|
1130
|
+
* }
|
|
1131
|
+
*
|
|
1132
|
+
* compiler.emitter.on('block', (questions) => questions.length)
|
|
1133
|
+
* compiler.destroy()
|
|
1134
|
+
* ```
|
|
1135
|
+
*
|
|
1001
1136
|
* @example
|
|
1002
1137
|
* ```ts
|
|
1003
1138
|
* import { createBriefCompiler } from '@orkestrel/brief'
|
|
@@ -1218,7 +1353,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1218
1353
|
*/
|
|
1219
1354
|
export declare function errorToMessage(error: unknown): string;
|
|
1220
1355
|
|
|
1221
|
-
/** Represents one input to output exemplar — the
|
|
1356
|
+
/** Represents one input to output exemplar — the ambiguity remover that leaves the least to interpret. */
|
|
1222
1357
|
export declare interface Example {
|
|
1223
1358
|
readonly input: string;
|
|
1224
1359
|
readonly output: string;
|
|
@@ -1226,10 +1361,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1226
1361
|
}
|
|
1227
1362
|
|
|
1228
1363
|
/** Describes the `Example` shape — one input to output exemplar. */
|
|
1229
|
-
export declare const exampleShape: ObjectShape<{
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1364
|
+
export declare const exampleShape: ObjectShape< {
|
|
1365
|
+
input: StringShape;
|
|
1366
|
+
output: StringShape;
|
|
1367
|
+
note: OptionalShape<StringShape>;
|
|
1233
1368
|
}, false>;
|
|
1234
1369
|
|
|
1235
1370
|
/**
|
|
@@ -1255,6 +1390,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1255
1390
|
/**
|
|
1256
1391
|
* Lists the gaps that block emission.
|
|
1257
1392
|
*
|
|
1393
|
+
* @remarks
|
|
1394
|
+
* A non-empty result means the gate must fail closed: a blocking gap has no safe default, so
|
|
1395
|
+
* the compile yields a visible incomplete `Briefing` carrying the questions instead of a brief.
|
|
1396
|
+
*
|
|
1258
1397
|
* @param source - The brief to inspect.
|
|
1259
1398
|
* @returns Every gap carrying `blocking: true`, in declaration order.
|
|
1260
1399
|
*
|
|
@@ -1317,7 +1456,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1317
1456
|
* are disjoint — `findManifestOverlaps` and the `disjoint` rule enforce it — so a forbidden
|
|
1318
1457
|
* path is in none of the grants and is reported here. An authority named in NO partition at
|
|
1319
1458
|
* all is reported for the same reason, and that is the case a forbidden-only check misses
|
|
1320
|
-
* entirely: the brief
|
|
1459
|
+
* entirely: the brief never says the executor may open what it must obey.
|
|
1321
1460
|
*
|
|
1322
1461
|
* Paths are compared as EXACT strings, matching `findManifestOverlaps`. A glob is never
|
|
1323
1462
|
* expanded, so `read: 'guides/**'` does not grant `authority: 'guides/brief.md'`. State a
|
|
@@ -1461,11 +1600,11 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1461
1600
|
}
|
|
1462
1601
|
|
|
1463
1602
|
/** Describes the `Gap` shape — an unknown, whether it blocks, and the candidates that would close it. */
|
|
1464
|
-
export declare const gapShape: ObjectShape<{
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1603
|
+
export declare const gapShape: ObjectShape< {
|
|
1604
|
+
field: StringShape;
|
|
1605
|
+
question: StringShape;
|
|
1606
|
+
blocking: BooleanShape;
|
|
1607
|
+
candidates: OptionalShape<ArrayShape<StringShape>>;
|
|
1469
1608
|
}, false>;
|
|
1470
1609
|
|
|
1471
1610
|
/** Holds `'gate'` — the id of the `buildGateDefinition()` logical definition. */
|
|
@@ -1487,10 +1626,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1487
1626
|
}
|
|
1488
1627
|
|
|
1489
1628
|
/** Describes the `Given` shape — one categorized context fact. */
|
|
1490
|
-
export declare const givenShape: ObjectShape<{
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1629
|
+
export declare const givenShape: ObjectShape< {
|
|
1630
|
+
category: StringShape;
|
|
1631
|
+
name: StringShape;
|
|
1632
|
+
value: StringShape;
|
|
1494
1633
|
}, false>;
|
|
1495
1634
|
|
|
1496
1635
|
/**
|
|
@@ -1593,6 +1732,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1593
1732
|
/**
|
|
1594
1733
|
* Checks whether the value is a non-empty string holding no line terminator.
|
|
1595
1734
|
*
|
|
1735
|
+
* @remarks
|
|
1736
|
+
* The shape of nearly every brief field: a path, a note, a statement, a rule, and a command
|
|
1737
|
+
* all narrow through it.
|
|
1738
|
+
*
|
|
1596
1739
|
* @param value - The value to inspect.
|
|
1597
1740
|
* @returns True if `value` is a non-empty string holding no line terminator; false otherwise.
|
|
1598
1741
|
*/
|
|
@@ -1707,7 +1850,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1707
1850
|
* Matches every line terminator a brief field refuses.
|
|
1708
1851
|
*
|
|
1709
1852
|
* @remarks
|
|
1710
|
-
* Every ECMAScript line terminator, not
|
|
1853
|
+
* Every ECMAScript line terminator, not only `\n`: a renderer that splits on any of them
|
|
1711
1854
|
* would let the others forge a markdown row. CRLF leads the alternation so a Windows
|
|
1712
1855
|
* exemplar splits as ONE break rather than two, which would insert a blank line the caller
|
|
1713
1856
|
* never wrote. Kept unanchored and stateless — no `g` flag — so `test` never carries
|
|
@@ -1732,24 +1875,30 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1732
1875
|
readonly forbidden: readonly Reference[];
|
|
1733
1876
|
}
|
|
1734
1877
|
|
|
1735
|
-
/**
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1878
|
+
/**
|
|
1879
|
+
* Describes the `Manifest` shape — disjoint reference partitions.
|
|
1880
|
+
*
|
|
1881
|
+
* @remarks
|
|
1882
|
+
* Each partition is an `arrayShape(referenceShape)`; disjointness is `validateBrief`'s pass
|
|
1883
|
+
* rather than the shape's.
|
|
1884
|
+
*/
|
|
1885
|
+
export declare const manifestShape: ObjectShape< {
|
|
1886
|
+
read: ArrayShape<ObjectShape< {
|
|
1887
|
+
path: StringShape;
|
|
1888
|
+
note: StringShape;
|
|
1889
|
+
}, false>>;
|
|
1890
|
+
edit: ArrayShape<ObjectShape< {
|
|
1891
|
+
path: StringShape;
|
|
1892
|
+
note: StringShape;
|
|
1893
|
+
}, false>>;
|
|
1894
|
+
locked: ArrayShape<ObjectShape< {
|
|
1895
|
+
path: StringShape;
|
|
1896
|
+
note: StringShape;
|
|
1897
|
+
}, false>>;
|
|
1898
|
+
forbidden: ArrayShape<ObjectShape< {
|
|
1899
|
+
path: StringShape;
|
|
1900
|
+
note: StringShape;
|
|
1901
|
+
}, false>>;
|
|
1753
1902
|
}, false>;
|
|
1754
1903
|
|
|
1755
1904
|
/**
|
|
@@ -1764,11 +1913,16 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1764
1913
|
readonly required: boolean;
|
|
1765
1914
|
}
|
|
1766
1915
|
|
|
1767
|
-
/**
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1916
|
+
/**
|
|
1917
|
+
* Describes the `Outcome` shape — a one-based rank, the result text, and whether it gates done.
|
|
1918
|
+
*
|
|
1919
|
+
* @remarks
|
|
1920
|
+
* `rank` is an `integerShape({ min: 1 })`, so a zero or fractional rank is off-contract.
|
|
1921
|
+
*/
|
|
1922
|
+
export declare const outcomeShape: ObjectShape< {
|
|
1923
|
+
rank: NumberShape;
|
|
1924
|
+
text: StringShape;
|
|
1925
|
+
required: BooleanShape;
|
|
1772
1926
|
}, false>;
|
|
1773
1927
|
|
|
1774
1928
|
/**
|
|
@@ -1791,11 +1945,11 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1791
1945
|
export declare type OutputFormat = 'markdown' | 'json' | 'code' | 'diff' | 'prose';
|
|
1792
1946
|
|
|
1793
1947
|
/** Describes the `Output` shape — a closed format plus its optional refinements. */
|
|
1794
|
-
export declare const outputShape: ObjectShape<{
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1948
|
+
export declare const outputShape: ObjectShape< {
|
|
1949
|
+
format: LiteralShape<readonly OutputFormat[]>;
|
|
1950
|
+
sections: OptionalShape<ArrayShape<StringShape>>;
|
|
1951
|
+
include: OptionalShape<ArrayShape<StringShape>>;
|
|
1952
|
+
exclude: OptionalShape<ArrayShape<StringShape>>;
|
|
1799
1953
|
}, false>;
|
|
1800
1954
|
|
|
1801
1955
|
/**
|
|
@@ -1875,9 +2029,9 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1875
2029
|
}
|
|
1876
2030
|
|
|
1877
2031
|
/** Describes the `Proof` shape — the claim and the command that settles it. */
|
|
1878
|
-
export declare const proofShape: ObjectShape<{
|
|
1879
|
-
|
|
1880
|
-
|
|
2032
|
+
export declare const proofShape: ObjectShape< {
|
|
2033
|
+
text: StringShape;
|
|
2034
|
+
command: StringShape;
|
|
1881
2035
|
}, false>;
|
|
1882
2036
|
|
|
1883
2037
|
/**
|
|
@@ -1900,9 +2054,9 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1900
2054
|
}
|
|
1901
2055
|
|
|
1902
2056
|
/** Describes the `Reference` shape — a path and the note that justifies listing it. */
|
|
1903
|
-
export declare const referenceShape: ObjectShape<{
|
|
1904
|
-
|
|
1905
|
-
|
|
2057
|
+
export declare const referenceShape: ObjectShape< {
|
|
2058
|
+
path: StringShape;
|
|
2059
|
+
note: StringShape;
|
|
1906
2060
|
}, false>;
|
|
1907
2061
|
|
|
1908
2062
|
/** Represents one pre-empted risk and the mitigation that answers it. */
|
|
@@ -1919,14 +2073,14 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1919
2073
|
export declare type RiskSeverity = 'low' | 'medium' | 'high';
|
|
1920
2074
|
|
|
1921
2075
|
/** Describes the `Risk` shape — a closed severity, the risk, and its mitigation. */
|
|
1922
|
-
export declare const riskShape: ObjectShape<{
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
2076
|
+
export declare const riskShape: ObjectShape< {
|
|
2077
|
+
severity: LiteralShape<readonly RiskSeverity[]>;
|
|
2078
|
+
text: StringShape;
|
|
2079
|
+
mitigation: StringShape;
|
|
1926
2080
|
}, false>;
|
|
1927
2081
|
|
|
1928
2082
|
/**
|
|
1929
|
-
* Holds the positive form of {@link LINE_BREAK_PATTERN}, for
|
|
2083
|
+
* Holds the positive form of {@link LINE_BREAK_PATTERN}, for a `stringShape` `pattern`.
|
|
1930
2084
|
*
|
|
1931
2085
|
* @remarks
|
|
1932
2086
|
* `stringShape`'s `pattern` must MATCH an accepted value, so the guard's refusal regex
|
|
@@ -1985,7 +2139,13 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1985
2139
|
/** Lists the `TaskDomain` values, frozen. */
|
|
1986
2140
|
export declare const TASK_DOMAINS: readonly TaskDomain[];
|
|
1987
2141
|
|
|
1988
|
-
/**
|
|
2142
|
+
/**
|
|
2143
|
+
* Lists the `TaskOperation` values, frozen.
|
|
2144
|
+
*
|
|
2145
|
+
* @remarks
|
|
2146
|
+
* Compose the tuple rather than restating its members: `literalOf(TASK_OPERATIONS)` builds the
|
|
2147
|
+
* guard and `parseEnum(value, TASK_OPERATIONS)` coerces a bare value against it.
|
|
2148
|
+
*/
|
|
1989
2149
|
export declare const TASK_OPERATIONS: readonly TaskOperation[];
|
|
1990
2150
|
|
|
1991
2151
|
/** Names the closed vocabulary of the subject matter a brief operates on. */
|
|
@@ -2000,14 +2160,21 @@ import { Subject } from '@orkestrel/reason';
|
|
|
2000
2160
|
*/
|
|
2001
2161
|
export declare type TaskOperation = 'create' | 'refactor' | 'debug' | 'extract' | 'migrate' | 'explain' | 'review' | 'optimize' | 'audit' | 'test' | 'document' | 'plan';
|
|
2002
2162
|
|
|
2003
|
-
/**
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2163
|
+
/**
|
|
2164
|
+
* Describes the `Task` shape — closed operation and domain vocabularies plus a non-empty
|
|
2165
|
+
* statement.
|
|
2166
|
+
*
|
|
2167
|
+
* @remarks
|
|
2168
|
+
* `literalShape(TASK_OPERATIONS)` and `literalShape(TASK_DOMAINS)` compile the same tuples the
|
|
2169
|
+
* guards read, and `statement` carries `min: 1`.
|
|
2170
|
+
*/
|
|
2171
|
+
export declare const taskShape: ObjectShape< {
|
|
2172
|
+
operation: LiteralShape<readonly TaskOperation[]>;
|
|
2173
|
+
domain: LiteralShape<readonly TaskDomain[]>;
|
|
2174
|
+
statement: StringShape;
|
|
2008
2175
|
}, false>;
|
|
2009
2176
|
|
|
2010
|
-
/** Describes a single-line string of any length, including empty
|
|
2177
|
+
/** Describes a single-line string of any length, including empty — the shape mirror of `isText`. */
|
|
2011
2178
|
export declare const textShape: StringShape;
|
|
2012
2179
|
|
|
2013
2180
|
/**
|