@orkestrel/brief 0.0.6 → 0.0.7
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 +6 -6
- package/dist/src/core/index.cjs +380 -274
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +594 -485
- package/dist/src/core/index.d.ts +594 -485
- package/dist/src/core/index.js +369 -263
- package/dist/src/core/index.js.map +1 -1
- package/package.json +16 -15
|
@@ -13,20 +13,20 @@ import { InterpretInterface } from '@orkestrel/interpret';
|
|
|
13
13
|
import { LiteralShape } from '@orkestrel/contract';
|
|
14
14
|
import { LogicalDefinition } from '@orkestrel/reason';
|
|
15
15
|
import { LogicalResult } from '@orkestrel/reason';
|
|
16
|
-
import { ManagerAddOptions } from '@orkestrel/interpret';
|
|
17
16
|
import { NumberShape } from '@orkestrel/contract';
|
|
18
17
|
import { ObjectShape } from '@orkestrel/contract';
|
|
19
18
|
import { OptionalShape } from '@orkestrel/contract';
|
|
20
19
|
import { ReasonInterface } from '@orkestrel/reason';
|
|
21
20
|
import { ReasonValidationResult } from '@orkestrel/reason';
|
|
21
|
+
import { RecordOptions } from '@orkestrel/interpret';
|
|
22
22
|
import { StringShape } from '@orkestrel/contract';
|
|
23
23
|
import { Subject } from '@orkestrel/reason';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Narrows unknown data to a `Brief`, throwing when it is off-contract.
|
|
27
27
|
*
|
|
28
28
|
* @remarks
|
|
29
|
-
* The throwing half of the intake pair: this returns its argument by IDENTITY
|
|
29
|
+
* The throwing half of the intake pair: this returns its argument by IDENTITY after the
|
|
30
30
|
* guard passes, while `parseBrief` returns `undefined` for bad input. It constructs
|
|
31
31
|
* nothing, so it is an assertion rather than a factory. Reserve it for programmer-error
|
|
32
32
|
* contexts where invalidity is a bug.
|
|
@@ -40,22 +40,22 @@ import { Subject } from '@orkestrel/reason';
|
|
|
40
40
|
* `briefToTrace` read the value they are handed instead, so a caller reaching one of those
|
|
41
41
|
* directly owns that reading. Pass `assertBrief` a value you already own.
|
|
42
42
|
*
|
|
43
|
-
* @param
|
|
43
|
+
* @param value - The candidate brief value.
|
|
44
44
|
* @returns The same value, now known to satisfy {@link Brief}.
|
|
45
|
-
* @throws {@link BriefError} `INVALID` when `
|
|
45
|
+
* @throws {@link BriefError} `INVALID` when `value` fails `isBrief`.
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* ```ts
|
|
49
|
-
* import { assertBrief,
|
|
49
|
+
* import { assertBrief, buildBrief, buildProof, buildTask } from '@orkestrel/brief'
|
|
50
50
|
*
|
|
51
|
-
* assertBrief(
|
|
51
|
+
* assertBrief(buildBrief(buildTask('plan', 'ops', 'Plan the release.'), { proofs: [buildProof('x', 'y')] }))
|
|
52
52
|
* assertBrief({ task: { operation: 'plan', domain: 'ops', statement: 'x.' } }) // throws INVALID
|
|
53
53
|
* ```
|
|
54
54
|
*/
|
|
55
|
-
export declare function assertBrief(
|
|
55
|
+
export declare function assertBrief(value: unknown): Brief;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Matches a string of one or more spaces and nothing else.
|
|
59
59
|
*
|
|
60
60
|
* @remarks
|
|
61
61
|
* The one exemplar side `exampleToLines` must NOT pad. CommonMark strips a fully-blank code
|
|
@@ -68,10 +68,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
68
68
|
export declare const BLANK_PATTERN: RegExp;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* Represents the closed execution contract — a rough request with every implicit decision resolved.
|
|
72
72
|
*
|
|
73
73
|
* @remarks
|
|
74
|
-
* `trace` and `hash` are DERIVED by `pinBrief`. The `
|
|
74
|
+
* `trace` and `hash` are DERIVED by `pinBrief`. The `buildBrief` builder cannot set them, so
|
|
75
75
|
* nothing this package produces authors them.
|
|
76
76
|
*
|
|
77
77
|
* They are still SHAPE-checked rather than verified on the way in: `isBrief` and `parseBrief`
|
|
@@ -100,28 +100,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @param subject - The task the brief is about.
|
|
106
|
-
* @param overrides - Any sections to fill; every absent collection defaults to `[]`,
|
|
107
|
-
* `output` defaults to `output('markdown')`, and `trace` / `hash` stay OMITTED so
|
|
108
|
-
* `pinBrief` can fill them.
|
|
109
|
-
* @returns A fresh, unpinned `Brief`.
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```ts
|
|
113
|
-
* import { brief, outcome, proof, task } from '@orkestrel/brief'
|
|
114
|
-
*
|
|
115
|
-
* brief(task('audit', 'code', 'Audit the barrel for undocumented exports.'), {
|
|
116
|
-
* outcomes: [outcome(1, 'every export appears in the guide')],
|
|
117
|
-
* proofs: [proof('parity passes', 'npm run test:guides')],
|
|
118
|
-
* })
|
|
119
|
-
* ```
|
|
120
|
-
*/
|
|
121
|
-
export declare function brief(subject: Task, overrides?: Partial<Omit<Brief, 'task' | 'trace' | 'hash'>>): Brief;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* The compilation orchestrator — the four-stage `[interpret, draft, gate, pin]` pipeline.
|
|
103
|
+
* Implements the compilation orchestrator — the `[interpret, draft, gate, pin]` pipeline.
|
|
125
104
|
*
|
|
126
105
|
* @remarks
|
|
127
106
|
* `compile` is genuinely SYNCHRONOUS and never throws for a brief it cannot emit: a
|
|
@@ -131,13 +110,13 @@ import { Subject } from '@orkestrel/reason';
|
|
|
131
110
|
*
|
|
132
111
|
* @example
|
|
133
112
|
* ```ts
|
|
134
|
-
* import { BriefCompiler,
|
|
113
|
+
* import { BriefCompiler, buildProof, buildTask } from '@orkestrel/brief'
|
|
135
114
|
*
|
|
136
115
|
* const compiler = new BriefCompiler()
|
|
137
116
|
* const briefing = compiler.compile({
|
|
138
|
-
* task:
|
|
117
|
+
* task: buildTask('audit', 'code', 'Audit the barrel for undocumented exports.'),
|
|
139
118
|
* outcomes: [{ rank: 1, text: 'every export appears in the guide', required: true }],
|
|
140
|
-
* proofs: [
|
|
119
|
+
* proofs: [buildProof('parity passes', 'npm run test:guides')],
|
|
141
120
|
* })
|
|
142
121
|
* briefing.brief !== undefined // true — the presence of the brief IS the completeness test
|
|
143
122
|
* compiler.destroy()
|
|
@@ -150,19 +129,19 @@ import { Subject } from '@orkestrel/reason';
|
|
|
150
129
|
get interpret(): InterpretInterface;
|
|
151
130
|
get reason(): ReasonInterface;
|
|
152
131
|
compile(input: BriefInput): Briefing;
|
|
153
|
-
gate(
|
|
132
|
+
gate(brief: Brief): LogicalResult;
|
|
154
133
|
destroy(): void;
|
|
155
134
|
}
|
|
156
135
|
|
|
157
|
-
/**
|
|
136
|
+
/** Declares the `BriefCompiler`'s push observation surface. */
|
|
158
137
|
export declare type BriefCompilerEventMap = {
|
|
159
|
-
compile: readonly [briefing: Briefing];
|
|
160
|
-
block: readonly [questions: readonly Gap[]];
|
|
161
|
-
error: readonly [error: unknown];
|
|
162
|
-
destroy: readonly [];
|
|
138
|
+
readonly compile: readonly [briefing: Briefing];
|
|
139
|
+
readonly block: readonly [questions: readonly Gap[]];
|
|
140
|
+
readonly error: readonly [error: unknown];
|
|
141
|
+
readonly destroy: readonly [];
|
|
163
142
|
};
|
|
164
143
|
|
|
165
|
-
/**
|
|
144
|
+
/** Declares the compilation orchestrator contract. */
|
|
166
145
|
export declare interface BriefCompilerInterface {
|
|
167
146
|
readonly emitter: EmitterInterface<BriefCompilerEventMap>;
|
|
168
147
|
readonly interpret: InterpretInterface;
|
|
@@ -173,7 +152,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
173
152
|
}
|
|
174
153
|
|
|
175
154
|
/**
|
|
176
|
-
*
|
|
155
|
+
* Represents the input to `createBriefCompiler`.
|
|
177
156
|
*
|
|
178
157
|
* @remarks
|
|
179
158
|
* `interpret` and `reason` are BORROWED when supplied — the compiler destroys only
|
|
@@ -221,7 +200,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
221
200
|
}
|
|
222
201
|
|
|
223
202
|
/**
|
|
224
|
-
*
|
|
203
|
+
* Represents the one error class this package throws.
|
|
225
204
|
*
|
|
226
205
|
* @remarks
|
|
227
206
|
* Throws are reserved for caller misuse: `assertBrief`, `snapshotBrief`, and `pinBrief` on
|
|
@@ -247,26 +226,26 @@ import { Subject } from '@orkestrel/reason';
|
|
|
247
226
|
}
|
|
248
227
|
|
|
249
228
|
/**
|
|
250
|
-
*
|
|
229
|
+
* Names the machine-readable reasons a {@link BriefError} carries.
|
|
251
230
|
*
|
|
252
231
|
* @remarks
|
|
253
|
-
* Inside `compile` every stage failure is CONTAINED: the
|
|
254
|
-
*
|
|
232
|
+
* Inside `compile` every stage failure is CONTAINED: the `*_FAILED` codes and `BLOCKED`
|
|
233
|
+
* mark it on the {@link Briefing} rather than throwing.
|
|
255
234
|
*
|
|
256
235
|
* `INTERPRET_FAILED` needs a FOREIGN `InterpretInterface`. `@orkestrel/interpret` contains
|
|
257
236
|
* its own stage failures and returns a degraded `Interpretation` rather than throwing, so
|
|
258
237
|
* the default engine never raises it; `BriefCompilerOptions.interpret` is the seam a caller
|
|
259
|
-
* reaches it through.
|
|
260
|
-
*
|
|
261
|
-
* `
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
238
|
+
* reaches it through. Other codes also reach a throw, from methods outside that containment —
|
|
239
|
+
* `INVALID` from `assertBrief`, `snapshotBrief`, and `pinBrief`; `DESTROYED` from any method
|
|
240
|
+
* after `destroy()`; and `GATE_FAILED` from `BriefCompiler.gate` when a borrowed reasoner
|
|
241
|
+
* returns a non-logical result OR throws its own error, which is translated rather than
|
|
242
|
+
* leaked so that every throw out of this module stays a `BriefError` an `isBriefError` catch
|
|
243
|
+
* can narrow.
|
|
265
244
|
*/
|
|
266
245
|
export declare type BriefErrorCode = 'INTERPRET_FAILED' | 'DRAFT_FAILED' | 'GATE_FAILED' | 'PIN_FAILED' | 'BLOCKED' | 'INVALID' | 'DESTROYED';
|
|
267
246
|
|
|
268
247
|
/**
|
|
269
|
-
*
|
|
248
|
+
* Represents the full, replayable outcome of one `compile()` call.
|
|
270
249
|
*
|
|
271
250
|
* @remarks
|
|
272
251
|
* `brief` is present exactly when the compile completed, so it is ALSO the completeness
|
|
@@ -295,14 +274,15 @@ import { Subject } from '@orkestrel/reason';
|
|
|
295
274
|
}
|
|
296
275
|
|
|
297
276
|
/**
|
|
298
|
-
*
|
|
277
|
+
* Represents one `compile()` input.
|
|
299
278
|
*
|
|
300
279
|
* @remarks
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* `deriveGivens`, and `deriveGaps` without
|
|
304
|
-
* `text` present it is also the FALLBACK the
|
|
305
|
-
* Every remaining key is a caller-authored
|
|
280
|
+
* `text`, `interpretation`, and the caller-authored sections are SEPARATE classes of input.
|
|
281
|
+
* `text` selects the interpret stage. `interpretation` supplies that stage's result
|
|
282
|
+
* directly: with no `text` it drives `deriveTask`, `deriveGivens`, and `deriveGaps` without
|
|
283
|
+
* running the language pipeline at all, and with `text` present it is also the FALLBACK the
|
|
284
|
+
* draft uses when the interpret engine throws. Every remaining key is a caller-authored
|
|
285
|
+
* section merged OVER whatever the draft derived.
|
|
306
286
|
*
|
|
307
287
|
* Supplying both `text` and `interpretation` is therefore meaningful: the engine's result
|
|
308
288
|
* wins when it succeeds, and the supplied one carries the compile when it does not.
|
|
@@ -327,7 +307,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
327
307
|
}
|
|
328
308
|
|
|
329
309
|
/**
|
|
330
|
-
*
|
|
310
|
+
* Implements the self-owning, versioned and content-hashed brief registry.
|
|
331
311
|
*
|
|
332
312
|
* @remarks
|
|
333
313
|
* Record ids are MINTED from each brief's own content hash unless the caller names one,
|
|
@@ -337,10 +317,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
337
317
|
*
|
|
338
318
|
* @example
|
|
339
319
|
* ```ts
|
|
340
|
-
* import { BriefManager,
|
|
320
|
+
* import { BriefManager, buildBrief, buildTask } from '@orkestrel/brief'
|
|
341
321
|
*
|
|
342
322
|
* const briefs = new BriefManager()
|
|
343
|
-
* const record = briefs.add(
|
|
323
|
+
* const record = briefs.add(buildBrief(buildTask('document', 'writing', 'Write the brief guide.')))
|
|
344
324
|
* record.id === record.hash // true
|
|
345
325
|
* briefs.destroy()
|
|
346
326
|
* ```
|
|
@@ -349,54 +329,54 @@ import { Subject } from '@orkestrel/reason';
|
|
|
349
329
|
#private;
|
|
350
330
|
constructor(options?: BriefManagerOptions);
|
|
351
331
|
get emitter(): EmitterInterface<BriefManagerEventMap>;
|
|
352
|
-
get
|
|
332
|
+
get count(): number;
|
|
353
333
|
has(id: string): boolean;
|
|
354
334
|
brief(id: string): BriefRecord | undefined;
|
|
355
335
|
briefs(): readonly BriefRecord[];
|
|
356
|
-
add(
|
|
336
|
+
add(brief: Brief, options?: RecordOptions): BriefRecord;
|
|
357
337
|
remove(ids: readonly string[]): boolean;
|
|
358
338
|
remove(id: string): boolean;
|
|
359
339
|
remove(): void;
|
|
360
340
|
destroy(): void;
|
|
361
341
|
}
|
|
362
342
|
|
|
363
|
-
/**
|
|
343
|
+
/** Declares the `BriefManager`'s push observation surface. */
|
|
364
344
|
export declare type BriefManagerEventMap = {
|
|
365
|
-
add: readonly [id: string];
|
|
366
|
-
remove: readonly [id: string];
|
|
367
|
-
destroy: readonly [];
|
|
345
|
+
readonly add: readonly [id: string];
|
|
346
|
+
readonly remove: readonly [id: string];
|
|
347
|
+
readonly destroy: readonly [];
|
|
368
348
|
};
|
|
369
349
|
|
|
370
350
|
/**
|
|
371
|
-
*
|
|
351
|
+
* Declares the brief registry contract.
|
|
372
352
|
*
|
|
373
353
|
* @remarks
|
|
374
354
|
* The array overload of `remove` is declared FIRST so an id list resolves to the batch
|
|
375
|
-
* form. `add` takes the fleet's own `
|
|
355
|
+
* form. `add` takes the fleet's own `RecordOptions` from `@orkestrel/interpret`;
|
|
376
356
|
* omit its `id` and the record is keyed by the brief's own content hash, so re-adding
|
|
377
357
|
* unchanged content is a version no-op.
|
|
378
358
|
*/
|
|
379
359
|
export declare interface BriefManagerInterface {
|
|
380
360
|
readonly emitter: EmitterInterface<BriefManagerEventMap>;
|
|
381
|
-
readonly
|
|
361
|
+
readonly count: number;
|
|
382
362
|
has(id: string): boolean;
|
|
383
363
|
brief(id: string): BriefRecord | undefined;
|
|
384
364
|
briefs(): readonly BriefRecord[];
|
|
385
|
-
add(brief: Brief, options?:
|
|
365
|
+
add(brief: Brief, options?: RecordOptions): BriefRecord;
|
|
386
366
|
remove(ids: readonly string[]): boolean;
|
|
387
367
|
remove(id: string): boolean;
|
|
388
368
|
remove(): void;
|
|
389
369
|
destroy(): void;
|
|
390
370
|
}
|
|
391
371
|
|
|
392
|
-
/**
|
|
372
|
+
/** Represents the input to `createBriefManager`. */
|
|
393
373
|
export declare interface BriefManagerOptions {
|
|
394
374
|
readonly briefs?: readonly Brief[];
|
|
395
375
|
readonly on?: EmitterHooks<BriefManagerEventMap>;
|
|
396
376
|
readonly error?: EmitterErrorHandler;
|
|
397
377
|
}
|
|
398
378
|
|
|
399
|
-
/**
|
|
379
|
+
/** Represents a versioned, content-hashed `Brief` inside a {@link BriefManagerInterface}. */
|
|
400
380
|
export declare interface BriefRecord {
|
|
401
381
|
readonly id: string;
|
|
402
382
|
readonly brief: Brief;
|
|
@@ -405,7 +385,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
405
385
|
}
|
|
406
386
|
|
|
407
387
|
/**
|
|
408
|
-
*
|
|
388
|
+
* Describes the whole `Brief` shape, section shapes composed.
|
|
409
389
|
*
|
|
410
390
|
* @remarks
|
|
411
391
|
* `trace` and `hash` are optional because `pinBrief` fills them; an unpinned draft is
|
|
@@ -487,10 +467,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
487
467
|
hash: OptionalShape<StringShape>;
|
|
488
468
|
}, false>;
|
|
489
469
|
|
|
490
|
-
/**
|
|
470
|
+
/** Names the fixed compilation phases, in pipeline order. */
|
|
491
471
|
export declare type BriefStage = 'interpret' | 'draft' | 'gate' | 'pin';
|
|
492
472
|
|
|
493
|
-
/**
|
|
473
|
+
/** Represents a visible marker for a phase that failed. */
|
|
494
474
|
export declare interface BriefStageFailure {
|
|
495
475
|
readonly stage: BriefStage;
|
|
496
476
|
readonly code: BriefErrorCode;
|
|
@@ -498,7 +478,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
498
478
|
}
|
|
499
479
|
|
|
500
480
|
/**
|
|
501
|
-
*
|
|
481
|
+
* Represents one pipeline phase, discriminated by `stage`.
|
|
502
482
|
*
|
|
503
483
|
* @remarks
|
|
504
484
|
* Narrowing on `stage` types both payloads exactly, so a consumer reads a replay without
|
|
@@ -507,7 +487,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
507
487
|
export declare type BriefStageRecord = InterpretStageRecord | DraftStageRecord | GateStageRecord | PinStageRecord;
|
|
508
488
|
|
|
509
489
|
/**
|
|
510
|
-
*
|
|
490
|
+
* Renders the canonical text of exactly what a brief's hash describes.
|
|
511
491
|
*
|
|
512
492
|
* @remarks
|
|
513
493
|
* `trace` and `hash` are stripped, then interprets `canonicalize` renders the rest in a
|
|
@@ -519,36 +499,42 @@ import { Subject } from '@orkestrel/reason';
|
|
|
519
499
|
*
|
|
520
500
|
* @example
|
|
521
501
|
* ```ts
|
|
522
|
-
* import {
|
|
502
|
+
* import { briefToContent, buildBrief, buildTask, pinBrief } from '@orkestrel/brief'
|
|
523
503
|
*
|
|
524
|
-
* const draft =
|
|
504
|
+
* const draft = buildBrief(buildTask('plan', 'ops', 'Plan the release.'))
|
|
525
505
|
* briefToContent(draft) === briefToContent(pinBrief(draft)) // true — pinning adds no content
|
|
526
506
|
* ```
|
|
527
507
|
*/
|
|
528
508
|
export declare function briefToContent(source: Brief): string;
|
|
529
509
|
|
|
530
510
|
/**
|
|
531
|
-
*
|
|
511
|
+
* Projects a brief into a subagent `Dispatch`.
|
|
532
512
|
*
|
|
533
513
|
* @remarks
|
|
534
514
|
* `edit` is exactly `manifest.edit`, so two dispatches whose `edit` sets do not intersect
|
|
535
515
|
* can run concurrently under the same brief without conflict.
|
|
536
516
|
*
|
|
537
517
|
* `authority` is exactly `brief.authority` in rank order, and it is a SEPARATE axis from the
|
|
538
|
-
*
|
|
518
|
+
* permission sets rather than a further partition — a ranked path normally also appears in
|
|
539
519
|
* `read` or `locked`, because the executor has to open what it obeys. It is projected as
|
|
540
520
|
* paths so a machine consumer never has to parse `prompt`, which is written for a model.
|
|
541
521
|
*
|
|
542
|
-
* @param
|
|
543
|
-
* @returns The dispatch — the rendered prompt, the ranked authority, and the
|
|
522
|
+
* @param input - The brief to project.
|
|
523
|
+
* @returns The dispatch — the rendered prompt, the ranked authority, and the path sets.
|
|
544
524
|
*
|
|
545
525
|
* @example
|
|
546
526
|
* ```ts
|
|
547
|
-
* import {
|
|
548
|
-
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
551
|
-
*
|
|
527
|
+
* import {
|
|
528
|
+
* briefToDispatch,
|
|
529
|
+
* buildBrief,
|
|
530
|
+
* buildManifest,
|
|
531
|
+
* buildReference,
|
|
532
|
+
* buildTask,
|
|
533
|
+
* } from '@orkestrel/brief'
|
|
534
|
+
*
|
|
535
|
+
* const draft = buildBrief(buildTask('migrate', 'code', 'Migrate the stores.'), {
|
|
536
|
+
* authority: [buildReference('AGENTS.md', 'project law')],
|
|
537
|
+
* manifest: buildManifest({ edit: [buildReference('src/core/stores/**', 'the legacy stores')] }),
|
|
552
538
|
* })
|
|
553
539
|
* briefToDispatch(draft).edit // ['src/core/stores/**']
|
|
554
540
|
* briefToDispatch(draft).authority // ['AGENTS.md']
|
|
@@ -557,28 +543,28 @@ import { Subject } from '@orkestrel/reason';
|
|
|
557
543
|
export declare function briefToDispatch(input: Brief): Dispatch;
|
|
558
544
|
|
|
559
545
|
/**
|
|
560
|
-
*
|
|
546
|
+
* Projects a brief into a `/goal` completion condition.
|
|
561
547
|
*
|
|
562
548
|
* @remarks
|
|
563
549
|
* The proofs' commands VERBATIM plus a turn cap — the goal never adds a condition the
|
|
564
550
|
* brief does not carry.
|
|
565
551
|
*
|
|
566
|
-
* @param
|
|
567
|
-
* @param turns - The turn cap
|
|
552
|
+
* @param input - The brief to render.
|
|
553
|
+
* @param turns - The turn cap. Default: `DEFAULT_BRIEF_TURNS`.
|
|
568
554
|
* @returns The one-line completion condition.
|
|
569
555
|
*
|
|
570
556
|
* @example
|
|
571
557
|
* ```ts
|
|
572
|
-
* import {
|
|
558
|
+
* import { briefToGoal, buildBrief, buildProof, buildTask } from '@orkestrel/brief'
|
|
573
559
|
*
|
|
574
|
-
* briefToGoal(
|
|
560
|
+
* briefToGoal(buildBrief(buildTask('test', 'code', 'Cover the gate.'), { proofs: [buildProof('x', 'npm test')] }))
|
|
575
561
|
* // 'Done when every proof passes: npm test exits 0. Cap: 16 turns.'
|
|
576
562
|
* ```
|
|
577
563
|
*/
|
|
578
564
|
export declare function briefToGoal(input: Brief, turns?: number): string;
|
|
579
565
|
|
|
580
566
|
/**
|
|
581
|
-
*
|
|
567
|
+
* Computes the canonical structural digest of a brief's content.
|
|
582
568
|
*
|
|
583
569
|
* @remarks
|
|
584
570
|
* `trace` and `hash` are stripped before digesting, so the value is the identity of what
|
|
@@ -590,52 +576,52 @@ import { Subject } from '@orkestrel/reason';
|
|
|
590
576
|
*
|
|
591
577
|
* @example
|
|
592
578
|
* ```ts
|
|
593
|
-
* import {
|
|
579
|
+
* import { briefToHash, buildBrief, buildTask, pinBrief } from '@orkestrel/brief'
|
|
594
580
|
*
|
|
595
|
-
* const draft =
|
|
581
|
+
* const draft = buildBrief(buildTask('plan', 'ops', 'Plan the release.'))
|
|
596
582
|
* briefToHash(draft) === briefToHash(pinBrief(draft)) // true — pinning does not move it
|
|
597
583
|
* ```
|
|
598
584
|
*/
|
|
599
585
|
export declare function briefToHash(source: Brief): string;
|
|
600
586
|
|
|
601
587
|
/**
|
|
602
|
-
*
|
|
588
|
+
* Projects a brief into the copy-ready agent prompt.
|
|
603
589
|
*
|
|
604
590
|
* @remarks
|
|
605
591
|
* Paths are REFERENCED, never inlined — the executor retrieves them. An empty section is
|
|
606
592
|
* omitted entirely, so the rendering carries no filler an executor must read past.
|
|
607
593
|
*
|
|
608
|
-
* @param
|
|
594
|
+
* @param input - The brief to render.
|
|
609
595
|
* @returns The markdown prompt.
|
|
610
596
|
*
|
|
611
597
|
* @example
|
|
612
598
|
* ```ts
|
|
613
|
-
* import {
|
|
599
|
+
* import { briefToMarkdown, buildBrief, buildTask } from '@orkestrel/brief'
|
|
614
600
|
*
|
|
615
|
-
* briefToMarkdown(
|
|
601
|
+
* briefToMarkdown(buildBrief(buildTask('review', 'code', 'Review the gate rules.')))
|
|
616
602
|
* // '# Brief: Review the gate rules.\n\nreview · code\n\n## Output\n\n- format: markdown\n'
|
|
617
603
|
* ```
|
|
618
604
|
*/
|
|
619
605
|
export declare function briefToMarkdown(input: Brief): string;
|
|
620
606
|
|
|
621
607
|
/**
|
|
622
|
-
*
|
|
608
|
+
* Projects a brief into the reasons `Subject` of readiness measures the gate reads.
|
|
623
609
|
*
|
|
624
610
|
* @param source - The brief to measure.
|
|
625
|
-
* @returns A flat record of counts plus the task's
|
|
611
|
+
* @returns A flat record of counts plus the task's vocabulary values.
|
|
626
612
|
*
|
|
627
613
|
* @example
|
|
628
614
|
* ```ts
|
|
629
|
-
* import {
|
|
615
|
+
* import { briefToSubject, buildBrief, buildProof, buildTask } from '@orkestrel/brief'
|
|
630
616
|
*
|
|
631
|
-
* briefToSubject(
|
|
617
|
+
* briefToSubject(buildBrief(buildTask('test', 'code', 'Cover the gate.'), { proofs: [buildProof('x', 'y')] }))
|
|
632
618
|
* // { operation: 'test', domain: 'code', sentences: 1, proofs: 1, … }
|
|
633
619
|
* ```
|
|
634
620
|
*/
|
|
635
621
|
export declare function briefToSubject(source: Brief): Subject;
|
|
636
622
|
|
|
637
623
|
/**
|
|
638
|
-
*
|
|
624
|
+
* Renders the one-line census `pinBrief` stamps onto a brief.
|
|
639
625
|
*
|
|
640
626
|
* @remarks
|
|
641
627
|
* Extracted so it has ONE implementation. `pinBrief` derives it and `BriefManager` re-derives
|
|
@@ -648,14 +634,256 @@ import { Subject } from '@orkestrel/reason';
|
|
|
648
634
|
*
|
|
649
635
|
* @example
|
|
650
636
|
* ```ts
|
|
651
|
-
* import {
|
|
637
|
+
* import { briefToTrace, buildBrief, buildTask } from '@orkestrel/brief'
|
|
652
638
|
*
|
|
653
|
-
* briefToTrace(
|
|
639
|
+
* briefToTrace(buildBrief(buildTask('document', 'writing', 'Write the guide.')))
|
|
654
640
|
* // 'document/writing · outcomes:0 · gaps:0/0 · proofs:0'
|
|
655
641
|
* ```
|
|
656
642
|
*/
|
|
657
643
|
export declare function briefToTrace(source: Brief): string;
|
|
658
644
|
|
|
645
|
+
/**
|
|
646
|
+
* Assembles a `Brief` from a `Task` plus section overrides.
|
|
647
|
+
*
|
|
648
|
+
* @param subject - The task the brief is about.
|
|
649
|
+
* @param overrides - Any sections to fill; `trace` / `hash` stay OMITTED so `pinBrief` can
|
|
650
|
+
* fill them. Default: `[]` for every absent collection and `buildOutput('markdown')` for
|
|
651
|
+
* `output`.
|
|
652
|
+
* @returns A fresh, unpinned `Brief`.
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* ```ts
|
|
656
|
+
* import { buildBrief, buildOutcome, buildProof, buildTask } from '@orkestrel/brief'
|
|
657
|
+
*
|
|
658
|
+
* buildBrief(buildTask('audit', 'code', 'Audit the barrel for undocumented exports.'), {
|
|
659
|
+
* outcomes: [buildOutcome(1, 'every export appears in the guide')],
|
|
660
|
+
* proofs: [buildProof('parity passes', 'npm run test:guides')],
|
|
661
|
+
* })
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
export declare function buildBrief(subject: Task, overrides?: Partial<Omit<Brief, 'task' | 'trace' | 'hash'>>): Brief;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Assembles a `Citation` from a name, a URL, and the note that justifies citing it.
|
|
668
|
+
*
|
|
669
|
+
* @param name - The source's display name.
|
|
670
|
+
* @param url - Where the source lives.
|
|
671
|
+
* @param note - Why the source is cited.
|
|
672
|
+
* @returns A fresh `Citation`.
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* ```ts
|
|
676
|
+
* import { buildCitation } from '@orkestrel/brief'
|
|
677
|
+
*
|
|
678
|
+
* buildCitation(
|
|
679
|
+
* 'MDN Constraint Validation',
|
|
680
|
+
* 'https://developer.mozilla.org/',
|
|
681
|
+
* 'the native validity behavior being adopted',
|
|
682
|
+
* )
|
|
683
|
+
* ```
|
|
684
|
+
*/
|
|
685
|
+
export declare function buildCitation(name: string, url: string, note: string): Citation;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* Assembles an `Example` from an exemplar input and its expected output.
|
|
689
|
+
*
|
|
690
|
+
* @param input - The exemplar input.
|
|
691
|
+
* @param output - The expected output for that input.
|
|
692
|
+
* @param note - Optional detail; the key is OMITTED when absent.
|
|
693
|
+
* @returns A fresh `Example`.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* ```ts
|
|
697
|
+
* import { buildExample } from '@orkestrel/brief'
|
|
698
|
+
*
|
|
699
|
+
* buildExample('<input required>', 'validity read from el.validity')
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
export declare function buildExample(input: string, output: string, note?: string): Example;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Assembles a `Gap` from the section it belongs to and the question that would close it.
|
|
706
|
+
*
|
|
707
|
+
* @param field - The brief section the unknown belongs to.
|
|
708
|
+
* @param question - The question that would close it.
|
|
709
|
+
* @param overrides - Optional `blocking` and `candidates`; an absent `candidates` key is
|
|
710
|
+
* OMITTED entirely. Default: `blocking: false`.
|
|
711
|
+
* @returns A fresh `Gap`.
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* ```ts
|
|
715
|
+
* import { buildGap } from '@orkestrel/brief'
|
|
716
|
+
*
|
|
717
|
+
* buildGap('rules', 'Does validation message wording need to change?') // blocking: false
|
|
718
|
+
* buildGap('output', 'Diff or full files?', { blocking: true, candidates: ['diff', 'code'] })
|
|
719
|
+
* ```
|
|
720
|
+
*/
|
|
721
|
+
export declare function buildGap(field: string, question: string, overrides?: Partial<Omit<Gap, 'field' | 'question'>>): Gap;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Assembles the fail-closed readiness gate as a reasons `LogicalDefinition`.
|
|
725
|
+
*
|
|
726
|
+
* @remarks
|
|
727
|
+
* Each readiness rule derives one named fact from `briefToSubject`'s measures, and a final
|
|
728
|
+
* `ready` rule conjoins them all. Forward chaining reports the LAST rule's conclusion, so
|
|
729
|
+
* `LogicalResult.conclusion` is exactly `ready`.
|
|
730
|
+
*
|
|
731
|
+
* The gate takes NO parameters, and that is deliberate rather than unfinished. The
|
|
732
|
+
* reasoner overlays every derived fact into one flat namespace, so a caller rule named
|
|
733
|
+
* for a readiness fact overwrites it and `ready` then conjoins a fact no base rule
|
|
734
|
+
* proved — a refusal silently becomes a pass. Readiness is this package's contract, not
|
|
735
|
+
* a caller setting. A caller who needs different readiness composes their own
|
|
736
|
+
* `LogicalDefinition` over `briefToSubject` and evaluates it on their own reasoner; both
|
|
737
|
+
* are exported for exactly that, and neither can reach this definition.
|
|
738
|
+
*
|
|
739
|
+
* @returns A fresh `LogicalDefinition` with id `GATE_ID`.
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```ts
|
|
743
|
+
* import { briefToSubject, buildGateDefinition } from '@orkestrel/brief'
|
|
744
|
+
* import { createLogicalReasoner, createReason } from '@orkestrel/reason'
|
|
745
|
+
*
|
|
746
|
+
* const reason = createReason({ reasoners: [createLogicalReasoner()] })
|
|
747
|
+
* const verdict = reason.reason(briefToSubject(pinned), buildGateDefinition())
|
|
748
|
+
* reason.destroy()
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
|
+
export declare function buildGateDefinition(): LogicalDefinition;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Assembles a `Given` from a category, a name, and a value.
|
|
755
|
+
*
|
|
756
|
+
* @param category - The kind of fact — a convention, a version, a constraint.
|
|
757
|
+
* @param name - The fact's name.
|
|
758
|
+
* @param value - The fact's value, already rendered as text.
|
|
759
|
+
* @returns A fresh `Given`.
|
|
760
|
+
*
|
|
761
|
+
* @example
|
|
762
|
+
* ```ts
|
|
763
|
+
* import { buildGiven } from '@orkestrel/brief'
|
|
764
|
+
*
|
|
765
|
+
* buildGiven('convention', 'indentation', 'tabs')
|
|
766
|
+
* ```
|
|
767
|
+
*/
|
|
768
|
+
export declare function buildGiven(category: string, name: string, value: string): Given;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Assembles a `Manifest`, defaulting every absent partition to an empty list.
|
|
772
|
+
*
|
|
773
|
+
* @param partitions - The partitions to fill; a partial literal is enough.
|
|
774
|
+
* @returns A fresh `Manifest` with every partition present.
|
|
775
|
+
*
|
|
776
|
+
* @example
|
|
777
|
+
* ```ts
|
|
778
|
+
* import { buildManifest, buildReference } from '@orkestrel/brief'
|
|
779
|
+
*
|
|
780
|
+
* buildManifest({ edit: [buildReference('src/core/helpers.ts', 'implementation')] })
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
export declare function buildManifest(partitions?: Partial<Manifest>): Manifest;
|
|
784
|
+
|
|
785
|
+
/**
|
|
786
|
+
* Assembles an `Outcome` from a rank and its result text.
|
|
787
|
+
*
|
|
788
|
+
* @param rank - The one-based rank; lower ranks matter more.
|
|
789
|
+
* @param text - The result, never a step.
|
|
790
|
+
* @param required - If `true`, the outcome gates "done"; if `false`, it is desirable but not
|
|
791
|
+
* blocking. Default: `true`.
|
|
792
|
+
* @returns A fresh `Outcome`.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```ts
|
|
796
|
+
* import { buildOutcome } from '@orkestrel/brief'
|
|
797
|
+
*
|
|
798
|
+
* buildOutcome(1, 'useForm uses native FormData with no behavior change') // required: true
|
|
799
|
+
* buildOutcome(2, 'the diff stays under 200 lines', false)
|
|
800
|
+
* ```
|
|
801
|
+
*/
|
|
802
|
+
export declare function buildOutcome(rank: number, text: string, required?: boolean): Outcome;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Assembles an `Output` from a format plus its optional refinements.
|
|
806
|
+
*
|
|
807
|
+
* @param format - The closed deliverable format.
|
|
808
|
+
* @param overrides - Optional `sections` / `include` / `exclude`; absent keys are OMITTED.
|
|
809
|
+
* @returns A fresh `Output`.
|
|
810
|
+
*
|
|
811
|
+
* @example
|
|
812
|
+
* ```ts
|
|
813
|
+
* import { buildOutput } from '@orkestrel/brief'
|
|
814
|
+
*
|
|
815
|
+
* buildOutput('markdown') // { format: 'markdown' }
|
|
816
|
+
* buildOutput('diff', { include: ['updated useForm.ts'] })
|
|
817
|
+
* ```
|
|
818
|
+
*/
|
|
819
|
+
export declare function buildOutput(format: OutputFormat, overrides?: Partial<Omit<Output, 'format'>>): Output;
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* Assembles a `Proof` from what the check settles and the command that settles it.
|
|
823
|
+
*
|
|
824
|
+
* @param text - What the check settles.
|
|
825
|
+
* @param command - The command whose exit signal settles it.
|
|
826
|
+
* @returns A fresh `Proof`.
|
|
827
|
+
*
|
|
828
|
+
* @example
|
|
829
|
+
* ```ts
|
|
830
|
+
* import { buildProof } from '@orkestrel/brief'
|
|
831
|
+
*
|
|
832
|
+
* buildProof('type-check and lint pass', 'npm run check')
|
|
833
|
+
* ```
|
|
834
|
+
*/
|
|
835
|
+
export declare function buildProof(text: string, command: string): Proof;
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Assembles a `Reference` from a path and the note that justifies listing it.
|
|
839
|
+
*
|
|
840
|
+
* @param path - The referenced path or glob.
|
|
841
|
+
* @param note - Why the path is listed.
|
|
842
|
+
* @returns A fresh `Reference`.
|
|
843
|
+
*
|
|
844
|
+
* @example
|
|
845
|
+
* ```ts
|
|
846
|
+
* import { buildReference } from '@orkestrel/brief'
|
|
847
|
+
*
|
|
848
|
+
* buildReference('AGENTS.md', 'project law') // { path: 'AGENTS.md', note: 'project law' }
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
export declare function buildReference(path: string, note: string): Reference;
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* Assembles a `Risk` from a severity, what could go wrong, and the mitigation that answers it.
|
|
855
|
+
*
|
|
856
|
+
* @param severity - The closed severity.
|
|
857
|
+
* @param text - What could go wrong.
|
|
858
|
+
* @param mitigation - What answers it.
|
|
859
|
+
* @returns A fresh `Risk`.
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* ```ts
|
|
863
|
+
* import { buildRisk } from '@orkestrel/brief'
|
|
864
|
+
*
|
|
865
|
+
* buildRisk('medium', 'native validation differs subtly', 'assert message and state in tests')
|
|
866
|
+
* ```
|
|
867
|
+
*/
|
|
868
|
+
export declare function buildRisk(severity: RiskSeverity, text: string, mitigation: string): Risk;
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Assembles a `Task` from an operation, a domain, and a statement.
|
|
872
|
+
*
|
|
873
|
+
* @param operation - What the brief asks for, from the closed operation vocabulary.
|
|
874
|
+
* @param domain - The subject matter, from the closed domain vocabulary.
|
|
875
|
+
* @param statement - One imperative sentence naming the object of the work.
|
|
876
|
+
* @returns A fresh `Task`.
|
|
877
|
+
*
|
|
878
|
+
* @example
|
|
879
|
+
* ```ts
|
|
880
|
+
* import { buildTask } from '@orkestrel/brief'
|
|
881
|
+
*
|
|
882
|
+
* buildTask('refactor', 'code', 'Refactor useForm to native browser form APIs.')
|
|
883
|
+
* ```
|
|
884
|
+
*/
|
|
885
|
+
export declare function buildTask(operation: TaskOperation, domain: TaskDomain, statement: string): Task;
|
|
886
|
+
|
|
659
887
|
/**
|
|
660
888
|
* Captures one stable, frozen view of a foreign contract value.
|
|
661
889
|
*
|
|
@@ -683,7 +911,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
683
911
|
export declare function captureValue(source: unknown, members: readonly string[]): unknown;
|
|
684
912
|
|
|
685
913
|
/**
|
|
686
|
-
*
|
|
914
|
+
* Represents one external source — what it is called, where it lives, and why it is cited.
|
|
687
915
|
*
|
|
688
916
|
* @remarks
|
|
689
917
|
* List ORDER is the trust order; there is no per-entry weight.
|
|
@@ -703,12 +931,13 @@ import { Subject } from '@orkestrel/reason';
|
|
|
703
931
|
* and the shape DSL's seeded generator builds a random alphanumeric string and throws when it
|
|
704
932
|
* fails the pattern — so any pattern requiring a scheme's colon makes `createBriefContract()`
|
|
705
933
|
* ungeneratable for the whole brief. Constraining only the guard would leave the guard and the
|
|
706
|
-
* compiled shape disagreeing, which is the parity this package holds in lockstep.
|
|
707
|
-
*
|
|
934
|
+
* compiled shape disagreeing, which is the parity this package holds in lockstep. Keeping the
|
|
935
|
+
* guard, the compiled shape, the generator, and `createBriefContract()` working beats one
|
|
936
|
+
* stricter member.
|
|
708
937
|
*
|
|
709
|
-
* The cost lands on one migration: `
|
|
710
|
-
* `(name, role, url)` —
|
|
711
|
-
* passes the guard, and only renders wrong.
|
|
938
|
+
* The cost lands on one migration: `buildCitation` takes `(name, url, note)` where the 0.0.6
|
|
939
|
+
* release took `(name, role, url)` — strings in the same positions either way, so a stale call
|
|
940
|
+
* still compiles and still passes the guard, and only renders wrong.
|
|
712
941
|
*/
|
|
713
942
|
export declare interface Citation {
|
|
714
943
|
readonly name: string;
|
|
@@ -716,28 +945,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
716
945
|
readonly note: string;
|
|
717
946
|
}
|
|
718
947
|
|
|
719
|
-
/**
|
|
720
|
-
* Build a `Citation`.
|
|
721
|
-
*
|
|
722
|
-
* @param name - The source's display name.
|
|
723
|
-
* @param url - Where the source lives.
|
|
724
|
-
* @param note - Why the source is cited.
|
|
725
|
-
* @returns A fresh `Citation`.
|
|
726
|
-
*
|
|
727
|
-
* @example
|
|
728
|
-
* ```ts
|
|
729
|
-
* import { citation } from '@orkestrel/brief'
|
|
730
|
-
*
|
|
731
|
-
* citation(
|
|
732
|
-
* 'MDN Constraint Validation',
|
|
733
|
-
* 'https://developer.mozilla.org/',
|
|
734
|
-
* 'the native validity behavior being adopted',
|
|
735
|
-
* )
|
|
736
|
-
* ```
|
|
737
|
-
*/
|
|
738
|
-
export declare function citation(name: string, url: string, note: string): Citation;
|
|
739
|
-
|
|
740
|
-
/** The `Citation` shape — a name, a locator, and why the source is cited. */
|
|
948
|
+
/** Describes the `Citation` shape — a name, a locator, and why the source is cited. */
|
|
741
949
|
export declare const citationShape: ObjectShape<{
|
|
742
950
|
name: StringShape;
|
|
743
951
|
url: StringShape;
|
|
@@ -745,7 +953,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
745
953
|
}, false>;
|
|
746
954
|
|
|
747
955
|
/**
|
|
748
|
-
*
|
|
956
|
+
* Counts the sentences a statement holds.
|
|
749
957
|
*
|
|
750
958
|
* @remarks
|
|
751
959
|
* A terminator run (`.`, `!`, `?`) followed by whitespace or the end of the text closes one
|
|
@@ -778,7 +986,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
778
986
|
export declare function countSentences(statement: string): number;
|
|
779
987
|
|
|
780
988
|
/**
|
|
781
|
-
*
|
|
989
|
+
* Creates a compilation orchestrator.
|
|
782
990
|
*
|
|
783
991
|
* @remarks
|
|
784
992
|
* With no engines supplied the compiler wires its own: a default `createInterpret()`
|
|
@@ -786,7 +994,8 @@ import { Subject } from '@orkestrel/reason';
|
|
|
786
994
|
* `createReason` carrying one `LogicalReasoner` for the gate. Pass your own to share
|
|
787
995
|
* instances or observe their emitters — the compiler destroys ONLY what it created.
|
|
788
996
|
*
|
|
789
|
-
* @param options - Engines to borrow, the
|
|
997
|
+
* @param options - Engines to borrow, the `actions` and `domains` intent vocabularies, and
|
|
998
|
+
* emitter hooks.
|
|
790
999
|
* @returns A working {@link BriefCompilerInterface}.
|
|
791
1000
|
*
|
|
792
1001
|
* @example
|
|
@@ -800,7 +1009,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
800
1009
|
export declare function createBriefCompiler(options?: BriefCompilerOptions): BriefCompilerInterface;
|
|
801
1010
|
|
|
802
1011
|
/**
|
|
803
|
-
*
|
|
1012
|
+
* Compiles `briefShape` into a guard, parser, JSON Schema, and seeded generator bundle.
|
|
804
1013
|
*
|
|
805
1014
|
* @remarks
|
|
806
1015
|
* The schema is what a tool boundary needs — hand it to `schemaToParameters` — and
|
|
@@ -823,7 +1032,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
823
1032
|
export declare function createBriefContract(): ContractInterface<Brief>;
|
|
824
1033
|
|
|
825
1034
|
/**
|
|
826
|
-
*
|
|
1035
|
+
* Creates a brief registry.
|
|
827
1036
|
*
|
|
828
1037
|
* @param options - An optional seed collection plus emitter hooks.
|
|
829
1038
|
* @returns A working {@link BriefManagerInterface}.
|
|
@@ -833,14 +1042,14 @@ import { Subject } from '@orkestrel/reason';
|
|
|
833
1042
|
* import { createBriefManager } from '@orkestrel/brief'
|
|
834
1043
|
*
|
|
835
1044
|
* const briefs = createBriefManager()
|
|
836
|
-
* briefs.
|
|
1045
|
+
* briefs.count // 0
|
|
837
1046
|
* briefs.destroy()
|
|
838
1047
|
* ```
|
|
839
1048
|
*/
|
|
840
1049
|
export declare function createBriefManager(options?: BriefManagerOptions): BriefManagerInterface;
|
|
841
1050
|
|
|
842
1051
|
/**
|
|
843
|
-
* `16` — the default turn cap `briefToGoal` renders.
|
|
1052
|
+
* Holds `16` — the default turn cap `briefToGoal` renders.
|
|
844
1053
|
*
|
|
845
1054
|
* @remarks
|
|
846
1055
|
* Domain-qualified so the barrel stays collision-free as sibling modules add their own
|
|
@@ -849,7 +1058,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
849
1058
|
export declare const DEFAULT_BRIEF_TURNS = 16;
|
|
850
1059
|
|
|
851
1060
|
/**
|
|
852
|
-
*
|
|
1061
|
+
* Derives `Gap[]` from an interprets `Ambiguity[]`.
|
|
853
1062
|
*
|
|
854
1063
|
* @remarks
|
|
855
1064
|
* A REQUIRED ambiguity becomes a BLOCKING gap — the gate must fail closed on it. The
|
|
@@ -870,7 +1079,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
870
1079
|
export declare function deriveGaps(ambiguities: readonly Ambiguity[]): readonly Gap[];
|
|
871
1080
|
|
|
872
1081
|
/**
|
|
873
|
-
*
|
|
1082
|
+
* Derives `Given[]` from an interprets `Entity[]`.
|
|
874
1083
|
*
|
|
875
1084
|
* @remarks
|
|
876
1085
|
* Every extracted entity becomes one `extracted` fact. A nameless entity is dropped; an
|
|
@@ -891,32 +1100,35 @@ import { Subject } from '@orkestrel/reason';
|
|
|
891
1100
|
export declare function deriveGivens(entities: readonly Entity[]): readonly Given[];
|
|
892
1101
|
|
|
893
1102
|
/**
|
|
894
|
-
*
|
|
1103
|
+
* Derives one imperative statement from free text.
|
|
895
1104
|
*
|
|
896
1105
|
* @remarks
|
|
897
1106
|
* Whitespace collapses, the first character uppercases, and a terminator is appended
|
|
898
1107
|
* when the text carries none. Nothing else is invented.
|
|
899
1108
|
*
|
|
900
1109
|
* @param text - The raw request text.
|
|
901
|
-
* @returns The statement, or `
|
|
1110
|
+
* @returns The statement, or `undefined` for empty or whitespace-only text.
|
|
902
1111
|
*
|
|
903
1112
|
* @example
|
|
904
1113
|
* ```ts
|
|
905
1114
|
* import { deriveStatement } from '@orkestrel/brief'
|
|
906
1115
|
*
|
|
907
1116
|
* deriveStatement(' clean up useForm ') // 'Clean up useForm.'
|
|
908
|
-
* deriveStatement('') //
|
|
1117
|
+
* deriveStatement('') // undefined
|
|
909
1118
|
* ```
|
|
910
1119
|
*/
|
|
911
|
-
export declare function deriveStatement(text: string): string;
|
|
1120
|
+
export declare function deriveStatement(text: string): string | undefined;
|
|
912
1121
|
|
|
913
1122
|
/**
|
|
914
|
-
*
|
|
1123
|
+
* Derives a `Task` from an interprets `Intent` through the caller's vocabularies.
|
|
915
1124
|
*
|
|
916
1125
|
* @remarks
|
|
917
1126
|
* The vocabularies are the CALLER's policy: this maps and never guesses. An action or
|
|
918
1127
|
* domain the caller did not map — or mapped to an off-vocabulary value — yields
|
|
919
|
-
* `undefined` rather than an invented task. Inherited keys never resolve.
|
|
1128
|
+
* `undefined` rather than an invented task. Inherited keys never resolve. `Intent.action`
|
|
1129
|
+
* and `Intent.domain` are optional, because `classifyIntent` leaves an unmatched axis
|
|
1130
|
+
* absent, and an absent axis is unmapped by definition: it yields `undefined` before
|
|
1131
|
+
* either vocabulary is read.
|
|
920
1132
|
*
|
|
921
1133
|
* @param intent - The classified intent from an interpret pipeline.
|
|
922
1134
|
* @param text - The text the statement derives from.
|
|
@@ -937,23 +1149,24 @@ import { Subject } from '@orkestrel/reason';
|
|
|
937
1149
|
export declare function deriveTask(intent: Intent, text: string, actions: Readonly<Record<string, TaskOperation>>, domains: Readonly<Record<string, TaskDomain>>): Task | undefined;
|
|
938
1150
|
|
|
939
1151
|
/**
|
|
940
|
-
*
|
|
1152
|
+
* Represents the subagent projection of a brief.
|
|
941
1153
|
*
|
|
942
1154
|
* @remarks
|
|
943
|
-
*
|
|
944
|
-
* `forbidden`, with `edit` the owned set two
|
|
945
|
-
* `locked` and `forbidden` do-not-touch.
|
|
946
|
-
* winning every conflict.
|
|
1155
|
+
* PERMISSION and PRECEDENCE are orthogonal axes rather than one flat partition set.
|
|
1156
|
+
* PERMISSION is `read`, `edit`, `locked`, and `forbidden`, with `edit` the owned set two
|
|
1157
|
+
* concurrent dispatches must not intersect on and `locked` and `forbidden` do-not-touch.
|
|
1158
|
+
* PRECEDENCE is `authority`, in ranked order, index 0 winning every conflict.
|
|
947
1159
|
*
|
|
948
1160
|
* `authority` therefore OVERLAPS the permission arrays by design: a ranked path ALWAYS also
|
|
949
1161
|
* sits in `read`, `edit`, or `locked`, because the executor has to open what it obeys, and
|
|
950
|
-
* the `granted` gate rule refuses a brief where it does not. Read the
|
|
951
|
-
* be touched and `authority` to decide what wins. Never union
|
|
952
|
-
*
|
|
1162
|
+
* the `granted` gate rule refuses a brief where it does not. Read the permission arrays to
|
|
1163
|
+
* decide what may be touched and `authority` to decide what wins. Never union the permission
|
|
1164
|
+
* arrays with `authority` — that was already wrong before `authority` existed, because
|
|
1165
|
+
* `forbidden` is an exclusion rather than a grant.
|
|
953
1166
|
* `authority` is a path list rather than a rendered section because a machine consumer must
|
|
954
1167
|
* reach mandatory authority without parsing `prompt`, which is written for a model.
|
|
955
1168
|
*
|
|
956
|
-
* The
|
|
1169
|
+
* The permission arrays are mutually disjoint in a GATED brief — `findManifestOverlaps`
|
|
957
1170
|
* measures it and the `disjoint` rule refuses on it. `briefToDispatch` is a pure projection
|
|
958
1171
|
* and runs no gate, so projecting an unvetted draft can produce arrays that intersect. Gate
|
|
959
1172
|
* before you dispatch, or treat disjointness as unproven.
|
|
@@ -967,7 +1180,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
967
1180
|
readonly forbidden: readonly string[];
|
|
968
1181
|
}
|
|
969
1182
|
|
|
970
|
-
/**
|
|
1183
|
+
/** Records the `draft` phase snapshot — the caller's input in, an unpinned `Brief` out. */
|
|
971
1184
|
export declare interface DraftStageRecord {
|
|
972
1185
|
readonly stage: 'draft';
|
|
973
1186
|
readonly input: BriefInput;
|
|
@@ -976,7 +1189,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
976
1189
|
}
|
|
977
1190
|
|
|
978
1191
|
/**
|
|
979
|
-
*
|
|
1192
|
+
* Renders a value thrown by a stage into a message.
|
|
980
1193
|
*
|
|
981
1194
|
* @remarks
|
|
982
1195
|
* TOTAL: it never throws, for any input. That is load-bearing rather than tidy, because this
|
|
@@ -985,7 +1198,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
985
1198
|
* falsifies the package's central promise that a failing stage yields an incomplete
|
|
986
1199
|
* `Briefing` rather than an exception.
|
|
987
1200
|
*
|
|
988
|
-
*
|
|
1201
|
+
* Real inputs used to throw: an `Error` subclass whose `message` getter throws, a value
|
|
989
1202
|
* whose string conversion throws, and a null-prototype object, which has no inherited
|
|
990
1203
|
* conversion for String() to reach. Each is wrapped, and an unreadable value degrades to its
|
|
991
1204
|
* type rather than propagating.
|
|
@@ -1005,31 +1218,14 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1005
1218
|
*/
|
|
1006
1219
|
export declare function errorToMessage(error: unknown): string;
|
|
1007
1220
|
|
|
1008
|
-
/**
|
|
1221
|
+
/** Represents one input to output exemplar — the highest-leverage ambiguity remover. */
|
|
1009
1222
|
export declare interface Example {
|
|
1010
1223
|
readonly input: string;
|
|
1011
1224
|
readonly output: string;
|
|
1012
1225
|
readonly note?: string;
|
|
1013
1226
|
}
|
|
1014
1227
|
|
|
1015
|
-
/**
|
|
1016
|
-
* Build an `Example`.
|
|
1017
|
-
*
|
|
1018
|
-
* @param input - The exemplar input.
|
|
1019
|
-
* @param result - The expected output for that input.
|
|
1020
|
-
* @param note - Optional detail; the key is OMITTED when absent.
|
|
1021
|
-
* @returns A fresh `Example`.
|
|
1022
|
-
*
|
|
1023
|
-
* @example
|
|
1024
|
-
* ```ts
|
|
1025
|
-
* import { example } from '@orkestrel/brief'
|
|
1026
|
-
*
|
|
1027
|
-
* example('<input required>', 'validity read from el.validity')
|
|
1028
|
-
* ```
|
|
1029
|
-
*/
|
|
1030
|
-
export declare function example(input: string, result: string, note?: string): Example;
|
|
1031
|
-
|
|
1032
|
-
/** The `Example` shape — one input to output exemplar. */
|
|
1228
|
+
/** Describes the `Example` shape — one input to output exemplar. */
|
|
1033
1229
|
export declare const exampleShape: ObjectShape<{
|
|
1034
1230
|
input: StringShape;
|
|
1035
1231
|
output: StringShape;
|
|
@@ -1037,7 +1233,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1037
1233
|
}, false>;
|
|
1038
1234
|
|
|
1039
1235
|
/**
|
|
1040
|
-
*
|
|
1236
|
+
* Renders one exemplar as markdown lines.
|
|
1041
1237
|
*
|
|
1042
1238
|
* @remarks
|
|
1043
1239
|
* An `Example`'s two sides are the only brief members permitted to span lines, so a
|
|
@@ -1049,25 +1245,25 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1049
1245
|
*
|
|
1050
1246
|
* @example
|
|
1051
1247
|
* ```ts
|
|
1052
|
-
* import {
|
|
1248
|
+
* import { buildExample, exampleToLines } from '@orkestrel/brief'
|
|
1053
1249
|
*
|
|
1054
|
-
* exampleToLines(
|
|
1250
|
+
* exampleToLines(buildExample('<input required>', 'el.validity')) // ['- ` <input required> ` → ` el.validity `']
|
|
1055
1251
|
* ```
|
|
1056
1252
|
*/
|
|
1057
1253
|
export declare function exampleToLines(entry: Example): readonly string[];
|
|
1058
1254
|
|
|
1059
1255
|
/**
|
|
1060
|
-
*
|
|
1256
|
+
* Lists the gaps that block emission.
|
|
1061
1257
|
*
|
|
1062
1258
|
* @param source - The brief to inspect.
|
|
1063
1259
|
* @returns Every gap carrying `blocking: true`, in declaration order.
|
|
1064
1260
|
*
|
|
1065
1261
|
* @example
|
|
1066
1262
|
* ```ts
|
|
1067
|
-
* import {
|
|
1263
|
+
* import { buildBrief, buildGap, buildTask, findBlockingGaps } from '@orkestrel/brief'
|
|
1068
1264
|
*
|
|
1069
|
-
* const draft =
|
|
1070
|
-
* gaps: [
|
|
1265
|
+
* const draft = buildBrief(buildTask('plan', 'ops', 'Plan the release.'), {
|
|
1266
|
+
* gaps: [buildGap('output', 'Diff or files?', { blocking: true })],
|
|
1071
1267
|
* })
|
|
1072
1268
|
* findBlockingGaps(draft).length // 1
|
|
1073
1269
|
* ```
|
|
@@ -1075,10 +1271,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1075
1271
|
export declare function findBlockingGaps(source: Brief): readonly Gap[];
|
|
1076
1272
|
|
|
1077
1273
|
/**
|
|
1078
|
-
*
|
|
1274
|
+
* Lists the paths appearing in more than one manifest partition.
|
|
1079
1275
|
*
|
|
1080
1276
|
* @remarks
|
|
1081
|
-
* Duplicates WITHIN one partition are not an overlap; the
|
|
1277
|
+
* Duplicates WITHIN one partition are not an overlap; the partitions must be
|
|
1082
1278
|
* mutually disjoint, which is what `validateBrief` errors on.
|
|
1083
1279
|
*
|
|
1084
1280
|
* Paths are compared as EXACT strings. A glob is never expanded, so `edit: 'app/file.ts'`
|
|
@@ -1090,12 +1286,18 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1090
1286
|
*
|
|
1091
1287
|
* @example
|
|
1092
1288
|
* ```ts
|
|
1093
|
-
* import {
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
*
|
|
1097
|
-
*
|
|
1098
|
-
*
|
|
1289
|
+
* import {
|
|
1290
|
+
* buildBrief,
|
|
1291
|
+
* buildManifest,
|
|
1292
|
+
* buildReference,
|
|
1293
|
+
* buildTask,
|
|
1294
|
+
* findManifestOverlaps,
|
|
1295
|
+
* } from '@orkestrel/brief'
|
|
1296
|
+
*
|
|
1297
|
+
* const draft = buildBrief(buildTask('debug', 'code', 'Fix the leak.'), {
|
|
1298
|
+
* manifest: buildManifest({
|
|
1299
|
+
* edit: [buildReference('src/core/BriefCompiler.ts', 'the leaking pipeline')],
|
|
1300
|
+
* locked: [buildReference('src/core/BriefCompiler.ts', 'the published contract')],
|
|
1099
1301
|
* }),
|
|
1100
1302
|
* })
|
|
1101
1303
|
* findManifestOverlaps(draft) // ['src/core/BriefCompiler.ts']
|
|
@@ -1104,18 +1306,18 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1104
1306
|
export declare function findManifestOverlaps(source: Brief): readonly string[];
|
|
1105
1307
|
|
|
1106
1308
|
/**
|
|
1107
|
-
*
|
|
1309
|
+
* Lists the authority paths the manifest never grants access to.
|
|
1108
1310
|
*
|
|
1109
1311
|
* @remarks
|
|
1110
1312
|
* An authority the executor cannot open is an instruction it cannot follow, so every ranked
|
|
1111
|
-
* path must appear in `read`, `edit`, or `locked`. Those
|
|
1313
|
+
* path must appear in `read`, `edit`, or `locked`. Those are the grants: `locked` is a
|
|
1112
1314
|
* grant, because read-only is exactly what obeying a file requires.
|
|
1113
1315
|
*
|
|
1114
|
-
* This subsumes the narrower question of an authority sitting in `forbidden`. The
|
|
1115
|
-
*
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
1316
|
+
* This subsumes the narrower question of an authority sitting in `forbidden`. The partitions
|
|
1317
|
+
* are disjoint — `findManifestOverlaps` and the `disjoint` rule enforce it — so a forbidden
|
|
1318
|
+
* path is in none of the grants and is reported here. An authority named in NO partition at
|
|
1319
|
+
* all is reported for the same reason, and that is the case a forbidden-only check misses
|
|
1320
|
+
* entirely: the brief simply never says the executor may open what it must obey.
|
|
1119
1321
|
*
|
|
1120
1322
|
* Paths are compared as EXACT strings, matching `findManifestOverlaps`. A glob is never
|
|
1121
1323
|
* expanded, so `read: 'guides/**'` does not grant `authority: 'guides/brief.md'`. State a
|
|
@@ -1126,11 +1328,17 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1126
1328
|
*
|
|
1127
1329
|
* @example
|
|
1128
1330
|
* ```ts
|
|
1129
|
-
* import {
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1331
|
+
* import {
|
|
1332
|
+
* buildBrief,
|
|
1333
|
+
* buildManifest,
|
|
1334
|
+
* buildReference,
|
|
1335
|
+
* buildTask,
|
|
1336
|
+
* findUngrantedAuthority,
|
|
1337
|
+
* } from '@orkestrel/brief'
|
|
1338
|
+
*
|
|
1339
|
+
* const draft = buildBrief(buildTask('debug', 'code', 'Fix the leak.'), {
|
|
1340
|
+
* authority: [buildReference('AGENTS.md', 'project law')],
|
|
1341
|
+
* manifest: buildManifest(),
|
|
1134
1342
|
* })
|
|
1135
1343
|
* findUngrantedAuthority(draft) // ['AGENTS.md'] — ranked, but no partition opens it
|
|
1136
1344
|
* ```
|
|
@@ -1138,30 +1346,30 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1138
1346
|
export declare function findUngrantedAuthority(source: Brief): readonly string[];
|
|
1139
1347
|
|
|
1140
1348
|
/**
|
|
1141
|
-
*
|
|
1349
|
+
* Lists the readiness rules a brief fails, computed directly from its own measures.
|
|
1142
1350
|
*
|
|
1143
1351
|
* @remarks
|
|
1144
|
-
* The gate's decision, in code. `
|
|
1352
|
+
* The gate's decision, in code. `buildGateDefinition()` states the same rules as data for a
|
|
1145
1353
|
* reasoner to narrate, and a narration is not a decision: `BriefCompilerOptions.reason` lets a
|
|
1146
1354
|
* caller supply the engine, and an engine that answers "met" to everything would otherwise
|
|
1147
1355
|
* emit a brief with no proofs. `compile` refuses on THIS and keeps the verdict for its
|
|
1148
1356
|
* trace, so a supplied engine can add detail and never remove a refusal.
|
|
1149
1357
|
*
|
|
1150
|
-
* The
|
|
1151
|
-
* is what stops
|
|
1358
|
+
* The data and the code must agree. `tests/src/core/helpers.test.ts` drives both over one
|
|
1359
|
+
* value set, which is what stops them from drifting apart.
|
|
1152
1360
|
*
|
|
1153
1361
|
* @param source - The brief to measure.
|
|
1154
1362
|
* @returns The unmet rule ids, in gate order; empty when the brief is ready.
|
|
1155
1363
|
*
|
|
1156
1364
|
* @example
|
|
1157
1365
|
* ```ts
|
|
1158
|
-
* import {
|
|
1366
|
+
* import { buildBrief, buildOutcome, buildProof, buildTask, findUnmetRules } from '@orkestrel/brief'
|
|
1159
1367
|
*
|
|
1160
|
-
* findUnmetRules(
|
|
1368
|
+
* findUnmetRules(buildBrief(buildTask('plan', 'ops', 'Plan the release.'))) // ['aimed', 'proven']
|
|
1161
1369
|
* findUnmetRules(
|
|
1162
|
-
*
|
|
1163
|
-
* outcomes: [
|
|
1164
|
-
* proofs: [
|
|
1370
|
+
* buildBrief(buildTask('plan', 'ops', 'Plan the release.'), {
|
|
1371
|
+
* outcomes: [buildOutcome(1, 'shipped')],
|
|
1372
|
+
* proofs: [buildProof('x', 'npm test')],
|
|
1165
1373
|
* }),
|
|
1166
1374
|
* ) // []
|
|
1167
1375
|
* ```
|
|
@@ -1169,7 +1377,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1169
1377
|
export declare function findUnmetRules(source: Brief): readonly string[];
|
|
1170
1378
|
|
|
1171
1379
|
/**
|
|
1172
|
-
*
|
|
1380
|
+
* Lists the open gaps with no assumption to stand on.
|
|
1173
1381
|
*
|
|
1174
1382
|
* @remarks
|
|
1175
1383
|
* The discipline is exactly one recorded assumption per open gap, so the open gaps past
|
|
@@ -1181,10 +1389,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1181
1389
|
*
|
|
1182
1390
|
* @example
|
|
1183
1391
|
* ```ts
|
|
1184
|
-
* import {
|
|
1392
|
+
* import { buildBrief, buildGap, buildTask, findUnpairedGaps } from '@orkestrel/brief'
|
|
1185
1393
|
*
|
|
1186
|
-
* const draft =
|
|
1187
|
-
* gaps: [
|
|
1394
|
+
* const draft = buildBrief(buildTask('plan', 'ops', 'Plan the release.'), {
|
|
1395
|
+
* gaps: [buildGap('rules', 'Keep the wording?'), buildGap('output', 'Diff or files?')],
|
|
1188
1396
|
* assumptions: ['Wording is preserved.'],
|
|
1189
1397
|
* })
|
|
1190
1398
|
* findUnpairedGaps(draft).length // 1
|
|
@@ -1193,7 +1401,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1193
1401
|
export declare function findUnpairedGaps(source: Brief): readonly Gap[];
|
|
1194
1402
|
|
|
1195
1403
|
/**
|
|
1196
|
-
*
|
|
1404
|
+
* Freezes one branch of a value graph, skipping what the visited set already holds.
|
|
1197
1405
|
*
|
|
1198
1406
|
* @param value - The branch to freeze.
|
|
1199
1407
|
* @param seen - The objects already frozen on this walk; what makes a cycle terminate.
|
|
@@ -1209,7 +1417,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1209
1417
|
export declare function freezeBranch<T>(value: T, seen: WeakSet<object>): T;
|
|
1210
1418
|
|
|
1211
1419
|
/**
|
|
1212
|
-
*
|
|
1420
|
+
* Freezes a value and everything reachable from it.
|
|
1213
1421
|
*
|
|
1214
1422
|
* @remarks
|
|
1215
1423
|
* `Object.freeze` is SHALLOW, so freezing a record leaves every nested array and object
|
|
@@ -1223,7 +1431,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1223
1431
|
* Reaches PLAIN objects and arrays, which is the whole of a `Brief` — it is JSON-serializable
|
|
1224
1432
|
* by contract. A `Map`, `Set`, or typed array is frozen as an object and its CONTENTS are left
|
|
1225
1433
|
* writable, and `Object.isFrozen` reports `true` for it either way. Nothing this package
|
|
1226
|
-
* produces contains one; a caller freezing their own value
|
|
1434
|
+
* produces contains one; the limit lands on a caller freezing their own value.
|
|
1227
1435
|
*
|
|
1228
1436
|
* @param value - The value to freeze in place; returned for convenience.
|
|
1229
1437
|
* @returns The same value, now deeply frozen.
|
|
@@ -1239,7 +1447,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1239
1447
|
export declare function freezeDeep<T>(value: T): T;
|
|
1240
1448
|
|
|
1241
1449
|
/**
|
|
1242
|
-
*
|
|
1450
|
+
* Represents one unknown the brief has not resolved.
|
|
1243
1451
|
*
|
|
1244
1452
|
* @remarks
|
|
1245
1453
|
* `blocking: true` means no safe default exists and the gate must fail closed. An
|
|
@@ -1252,26 +1460,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1252
1460
|
readonly candidates?: readonly string[];
|
|
1253
1461
|
}
|
|
1254
1462
|
|
|
1255
|
-
/**
|
|
1256
|
-
* Build a `Gap`.
|
|
1257
|
-
*
|
|
1258
|
-
* @param field - The brief section the unknown belongs to.
|
|
1259
|
-
* @param question - The question that would close it.
|
|
1260
|
-
* @param overrides - Optional `blocking` (defaults `false`) and `candidates`; an absent
|
|
1261
|
-
* `candidates` key is OMITTED entirely.
|
|
1262
|
-
* @returns A fresh `Gap`.
|
|
1263
|
-
*
|
|
1264
|
-
* @example
|
|
1265
|
-
* ```ts
|
|
1266
|
-
* import { gap } from '@orkestrel/brief'
|
|
1267
|
-
*
|
|
1268
|
-
* gap('rules', 'Should validation message wording change?') // blocking: false
|
|
1269
|
-
* gap('output', 'Diff or full files?', { blocking: true, candidates: ['diff', 'code'] })
|
|
1270
|
-
* ```
|
|
1271
|
-
*/
|
|
1272
|
-
export declare function gap(field: string, question: string, overrides?: Partial<Omit<Gap, 'field' | 'question'>>): Gap;
|
|
1273
|
-
|
|
1274
|
-
/** The `Gap` shape — an unknown, whether it blocks, and the candidates that would close it. */
|
|
1463
|
+
/** Describes the `Gap` shape — an unknown, whether it blocks, and the candidates that would close it. */
|
|
1275
1464
|
export declare const gapShape: ObjectShape<{
|
|
1276
1465
|
field: StringShape;
|
|
1277
1466
|
question: StringShape;
|
|
@@ -1279,40 +1468,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1279
1468
|
candidates: OptionalShape<ArrayShape<StringShape>>;
|
|
1280
1469
|
}, false>;
|
|
1281
1470
|
|
|
1282
|
-
/** `'gate'` — the id of the `
|
|
1471
|
+
/** Holds `'gate'` — the id of the `buildGateDefinition()` logical definition. */
|
|
1283
1472
|
export declare const GATE_ID = "gate";
|
|
1284
1473
|
|
|
1285
|
-
/**
|
|
1286
|
-
* Build the fail-closed readiness gate as a reasons `LogicalDefinition`.
|
|
1287
|
-
*
|
|
1288
|
-
* @remarks
|
|
1289
|
-
* Six readiness rules each derive one named fact from `briefToSubject`'s measures, and a
|
|
1290
|
-
* final `ready` rule conjoins all six. Forward chaining reports the LAST rule's
|
|
1291
|
-
* conclusion, so `LogicalResult.conclusion` is exactly `ready`.
|
|
1292
|
-
*
|
|
1293
|
-
* The gate takes NO parameters, and that is deliberate rather than unfinished. The
|
|
1294
|
-
* reasoner overlays every derived fact into one flat namespace, so a caller rule named
|
|
1295
|
-
* for a readiness fact overwrites it and `ready` then conjoins a fact no base rule
|
|
1296
|
-
* proved — a refusal silently becomes a pass. Readiness is this package's contract, not
|
|
1297
|
-
* a caller setting. A caller who needs different readiness composes their own
|
|
1298
|
-
* `LogicalDefinition` over `briefToSubject` and evaluates it on their own reasoner; both
|
|
1299
|
-
* are exported for exactly that, and neither can reach this definition.
|
|
1300
|
-
*
|
|
1301
|
-
* @returns A fresh `LogicalDefinition` with id `GATE_ID`.
|
|
1302
|
-
*
|
|
1303
|
-
* @example
|
|
1304
|
-
* ```ts
|
|
1305
|
-
* import { briefToSubject, gateDefinition } from '@orkestrel/brief'
|
|
1306
|
-
* import { createLogicalReasoner, createReason } from '@orkestrel/reason'
|
|
1307
|
-
*
|
|
1308
|
-
* const reason = createReason({ reasoners: [createLogicalReasoner()] })
|
|
1309
|
-
* const verdict = reason.reason(briefToSubject(pinned), gateDefinition())
|
|
1310
|
-
* reason.destroy()
|
|
1311
|
-
* ```
|
|
1312
|
-
*/
|
|
1313
|
-
export declare function gateDefinition(): LogicalDefinition;
|
|
1314
|
-
|
|
1315
|
-
/** The `gate` phase snapshot — the readiness `Subject` in, the reasoner's verdict out. */
|
|
1474
|
+
/** Records the `gate` phase snapshot — the readiness `Subject` in, the reasoner's verdict out. */
|
|
1316
1475
|
export declare interface GateStageRecord {
|
|
1317
1476
|
readonly stage: 'gate';
|
|
1318
1477
|
readonly input: Subject;
|
|
@@ -1320,31 +1479,14 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1320
1479
|
readonly error?: string;
|
|
1321
1480
|
}
|
|
1322
1481
|
|
|
1323
|
-
/**
|
|
1482
|
+
/** Represents one context fact handed to the executor — a convention, a version, a constraint value. */
|
|
1324
1483
|
export declare interface Given {
|
|
1325
1484
|
readonly category: string;
|
|
1326
1485
|
readonly name: string;
|
|
1327
1486
|
readonly value: string;
|
|
1328
1487
|
}
|
|
1329
1488
|
|
|
1330
|
-
/**
|
|
1331
|
-
* Build a `Given`.
|
|
1332
|
-
*
|
|
1333
|
-
* @param category - The kind of fact — a convention, a version, a constraint.
|
|
1334
|
-
* @param name - The fact's name.
|
|
1335
|
-
* @param value - The fact's value, already rendered as text.
|
|
1336
|
-
* @returns A fresh `Given`.
|
|
1337
|
-
*
|
|
1338
|
-
* @example
|
|
1339
|
-
* ```ts
|
|
1340
|
-
* import { given } from '@orkestrel/brief'
|
|
1341
|
-
*
|
|
1342
|
-
* given('convention', 'indentation', 'tabs')
|
|
1343
|
-
* ```
|
|
1344
|
-
*/
|
|
1345
|
-
export declare function given(category: string, name: string, value: string): Given;
|
|
1346
|
-
|
|
1347
|
-
/** The `Given` shape — one categorized context fact. */
|
|
1489
|
+
/** Describes the `Given` shape — one categorized context fact. */
|
|
1348
1490
|
export declare const givenShape: ObjectShape<{
|
|
1349
1491
|
category: StringShape;
|
|
1350
1492
|
name: StringShape;
|
|
@@ -1352,7 +1494,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1352
1494
|
}, false>;
|
|
1353
1495
|
|
|
1354
1496
|
/**
|
|
1355
|
-
*
|
|
1497
|
+
* Lists every published `Interpretation` member name, frozen.
|
|
1356
1498
|
*
|
|
1357
1499
|
* @remarks
|
|
1358
1500
|
* The capture list `BriefCompiler` hands `captureValue` at each interpret door — the borrowed
|
|
@@ -1365,10 +1507,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1365
1507
|
* equality assertion beside the capture cases refuse a list that has fallen short of the
|
|
1366
1508
|
* published shape.
|
|
1367
1509
|
*/
|
|
1368
|
-
export declare const INTERPRETATION_MEMBERS: readonly ("text" | "normalized" | "intent" | "entities" | "subject" | "definition" | "mappings" | "ambiguities" | "prompt" | "stages" | "failures" | "
|
|
1510
|
+
export declare const INTERPRETATION_MEMBERS: readonly ("text" | "normalized" | "intent" | "entities" | "subject" | "definition" | "mappings" | "ambiguities" | "prompt" | "stages" | "failures" | "confidence" | "digest")[];
|
|
1369
1511
|
|
|
1370
1512
|
/**
|
|
1371
|
-
*
|
|
1513
|
+
* Records the `interpret` phase snapshot — raw text in, an `Interpretation` out.
|
|
1372
1514
|
*
|
|
1373
1515
|
* @remarks
|
|
1374
1516
|
* `output` is absent exactly when `error` is present, which is what makes the phase
|
|
@@ -1382,19 +1524,22 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1382
1524
|
}
|
|
1383
1525
|
|
|
1384
1526
|
/**
|
|
1385
|
-
*
|
|
1527
|
+
* Checks whether the value satisfies the whole exact-record `Brief` contract.
|
|
1386
1528
|
*
|
|
1387
1529
|
* @remarks
|
|
1388
1530
|
* Every section must be present; an extra key fails. `trace` and `hash` are the only
|
|
1389
1531
|
* optional members, because `pinBrief` rather than the author fills them.
|
|
1532
|
+
*
|
|
1533
|
+
* @param value - The value to inspect.
|
|
1534
|
+
* @returns True if `value` satisfies the whole exact-record `Brief` contract; false otherwise.
|
|
1390
1535
|
*/
|
|
1391
1536
|
export declare const isBrief: Guard<Brief>;
|
|
1392
1537
|
|
|
1393
1538
|
/**
|
|
1394
|
-
*
|
|
1539
|
+
* Narrows a caught value to a {@link BriefError}.
|
|
1395
1540
|
*
|
|
1396
1541
|
* @param value - The caught value to inspect.
|
|
1397
|
-
* @returns
|
|
1542
|
+
* @returns True if `value` is a `BriefError`; false otherwise.
|
|
1398
1543
|
*
|
|
1399
1544
|
* @example
|
|
1400
1545
|
* ```ts
|
|
@@ -1409,92 +1554,172 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1409
1554
|
*/
|
|
1410
1555
|
export declare function isBriefError(value: unknown): value is BriefError;
|
|
1411
1556
|
|
|
1412
|
-
/**
|
|
1557
|
+
/**
|
|
1558
|
+
* Checks whether the value is a well-formed `Citation` — every member single-line.
|
|
1559
|
+
*
|
|
1560
|
+
* @param value - The value to inspect.
|
|
1561
|
+
* @returns True if `value` is a well-formed `Citation`; false otherwise.
|
|
1562
|
+
*/
|
|
1413
1563
|
export declare const isCitation: Guard<Citation>;
|
|
1414
1564
|
|
|
1415
1565
|
/**
|
|
1416
|
-
*
|
|
1566
|
+
* Checks whether the value is a well-formed `Example`.
|
|
1417
1567
|
*
|
|
1418
1568
|
* @remarks
|
|
1419
1569
|
* An exemplar's two sides are the ONLY members a brief lets span lines, because they
|
|
1420
1570
|
* carry code. `briefToMarkdown` fences them rather than rendering them as a row.
|
|
1571
|
+
*
|
|
1572
|
+
* @param value - The value to inspect.
|
|
1573
|
+
* @returns True if `value` is a well-formed `Example`; false otherwise.
|
|
1421
1574
|
*/
|
|
1422
1575
|
export declare const isExample: Guard<Example>;
|
|
1423
1576
|
|
|
1424
|
-
/**
|
|
1577
|
+
/**
|
|
1578
|
+
* Checks whether the value is a well-formed `Gap`.
|
|
1579
|
+
*
|
|
1580
|
+
* @param value - The value to inspect.
|
|
1581
|
+
* @returns True if `value` is a well-formed `Gap`; false otherwise.
|
|
1582
|
+
*/
|
|
1425
1583
|
export declare const isGap: Guard<Gap>;
|
|
1426
1584
|
|
|
1427
|
-
/**
|
|
1585
|
+
/**
|
|
1586
|
+
* Checks whether the value is a well-formed `Given` — its `value` may be empty but stays one line.
|
|
1587
|
+
*
|
|
1588
|
+
* @param value - The value to inspect.
|
|
1589
|
+
* @returns True if `value` is a well-formed `Given`; false otherwise.
|
|
1590
|
+
*/
|
|
1428
1591
|
export declare const isGiven: Guard<Given>;
|
|
1429
1592
|
|
|
1430
|
-
/**
|
|
1593
|
+
/**
|
|
1594
|
+
* Checks whether the value is a non-empty string holding no line terminator.
|
|
1595
|
+
*
|
|
1596
|
+
* @param value - The value to inspect.
|
|
1597
|
+
* @returns True if `value` is a non-empty string holding no line terminator; false otherwise.
|
|
1598
|
+
*/
|
|
1431
1599
|
export declare const isLine: Guard<string>;
|
|
1432
1600
|
|
|
1433
1601
|
/**
|
|
1434
|
-
*
|
|
1602
|
+
* Checks whether the value is a well-formed `Manifest`.
|
|
1435
1603
|
*
|
|
1436
1604
|
* @remarks
|
|
1437
1605
|
* Partition presence only — disjointness is `validateBrief`'s semantic pass.
|
|
1606
|
+
*
|
|
1607
|
+
* @param value - The value to inspect.
|
|
1608
|
+
* @returns True if `value` is a well-formed `Manifest`; false otherwise.
|
|
1438
1609
|
*/
|
|
1439
1610
|
export declare const isManifest: Guard<Manifest>;
|
|
1440
1611
|
|
|
1441
|
-
/**
|
|
1612
|
+
/**
|
|
1613
|
+
* Checks whether the value is a well-formed `Outcome` — `rank` a positive integer.
|
|
1614
|
+
*
|
|
1615
|
+
* @param value - The value to inspect.
|
|
1616
|
+
* @returns True if `value` is a well-formed `Outcome`; false otherwise.
|
|
1617
|
+
*/
|
|
1442
1618
|
export declare const isOutcome: Guard<Outcome>;
|
|
1443
1619
|
|
|
1444
|
-
/**
|
|
1620
|
+
/**
|
|
1621
|
+
* Checks whether the value is a well-formed `Output` — `format` on the closed vocabulary.
|
|
1622
|
+
*
|
|
1623
|
+
* @param value - The value to inspect.
|
|
1624
|
+
* @returns True if `value` is a well-formed `Output`; false otherwise.
|
|
1625
|
+
*/
|
|
1445
1626
|
export declare const isOutput: Guard<Output>;
|
|
1446
1627
|
|
|
1447
|
-
/**
|
|
1628
|
+
/**
|
|
1629
|
+
* Checks whether the value is one of the `OutputFormat` literals.
|
|
1630
|
+
*
|
|
1631
|
+
* @param value - The value to inspect.
|
|
1632
|
+
* @returns True if `value` is one of the `OutputFormat` literals; false otherwise.
|
|
1633
|
+
*/
|
|
1448
1634
|
export declare const isOutputFormat: Guard<OutputFormat>;
|
|
1449
1635
|
|
|
1450
|
-
/**
|
|
1636
|
+
/**
|
|
1637
|
+
* Checks whether the value is a well-formed `Proof`.
|
|
1638
|
+
*
|
|
1639
|
+
* @param value - The value to inspect.
|
|
1640
|
+
* @returns True if `value` is a well-formed `Proof`; false otherwise.
|
|
1641
|
+
*/
|
|
1451
1642
|
export declare const isProof: Guard<Proof>;
|
|
1452
1643
|
|
|
1453
|
-
/**
|
|
1644
|
+
/**
|
|
1645
|
+
* Checks whether the value is a well-formed `Reference` — both members required, both single-line.
|
|
1646
|
+
*
|
|
1647
|
+
* @param value - The value to inspect.
|
|
1648
|
+
* @returns True if `value` is a well-formed `Reference`; false otherwise.
|
|
1649
|
+
*/
|
|
1454
1650
|
export declare const isReference: Guard<Reference>;
|
|
1455
1651
|
|
|
1456
|
-
/**
|
|
1652
|
+
/**
|
|
1653
|
+
* Checks whether the value is a well-formed `Risk` — `severity` on the closed vocabulary.
|
|
1654
|
+
*
|
|
1655
|
+
* @param value - The value to inspect.
|
|
1656
|
+
* @returns True if `value` is a well-formed `Risk`; false otherwise.
|
|
1657
|
+
*/
|
|
1457
1658
|
export declare const isRisk: Guard<Risk>;
|
|
1458
1659
|
|
|
1459
|
-
/**
|
|
1660
|
+
/**
|
|
1661
|
+
* Checks whether the value is one of the `RiskSeverity` literals.
|
|
1662
|
+
*
|
|
1663
|
+
* @param value - The value to inspect.
|
|
1664
|
+
* @returns True if `value` is one of the `RiskSeverity` literals; false otherwise.
|
|
1665
|
+
*/
|
|
1460
1666
|
export declare const isRiskSeverity: Guard<RiskSeverity>;
|
|
1461
1667
|
|
|
1462
|
-
/**
|
|
1668
|
+
/**
|
|
1669
|
+
* Checks whether the value is a well-formed `Task` — both vocabularies closed, statement one line.
|
|
1670
|
+
*
|
|
1671
|
+
* @param value - The value to inspect.
|
|
1672
|
+
* @returns True if `value` is a well-formed `Task`; false otherwise.
|
|
1673
|
+
*/
|
|
1463
1674
|
export declare const isTask: Guard<Task>;
|
|
1464
1675
|
|
|
1465
|
-
/**
|
|
1676
|
+
/**
|
|
1677
|
+
* Checks whether the value is one of the `TaskDomain` literals.
|
|
1678
|
+
*
|
|
1679
|
+
* @param value - The value to inspect.
|
|
1680
|
+
* @returns True if `value` is one of the `TaskDomain` literals; false otherwise.
|
|
1681
|
+
*/
|
|
1466
1682
|
export declare const isTaskDomain: Guard<TaskDomain>;
|
|
1467
1683
|
|
|
1468
|
-
/**
|
|
1684
|
+
/**
|
|
1685
|
+
* Checks whether the value is one of the `TaskOperation` literals.
|
|
1686
|
+
*
|
|
1687
|
+
* @param value - The value to inspect.
|
|
1688
|
+
* @returns True if `value` is one of the `TaskOperation` literals; false otherwise.
|
|
1689
|
+
*/
|
|
1469
1690
|
export declare const isTaskOperation: Guard<TaskOperation>;
|
|
1470
1691
|
|
|
1471
1692
|
/**
|
|
1472
|
-
*
|
|
1693
|
+
* Checks whether the value is a string holding no line terminator, empty included.
|
|
1473
1694
|
*
|
|
1474
1695
|
* @remarks
|
|
1475
1696
|
* `briefToMarkdown` renders each brief field as ONE markdown row, so a field carrying a
|
|
1476
1697
|
* line break would forge a heading or an extra manifest row — which is how a rendered
|
|
1477
1698
|
* prompt and `briefToDispatch`'s path sets could disagree about the same brief.
|
|
1699
|
+
*
|
|
1700
|
+
* @param value - The value to inspect.
|
|
1701
|
+
* @returns True if `value` is a string holding no line terminator, empty included; false
|
|
1702
|
+
* otherwise.
|
|
1478
1703
|
*/
|
|
1479
1704
|
export declare const isText: Guard<string>;
|
|
1480
1705
|
|
|
1481
1706
|
/**
|
|
1482
|
-
*
|
|
1707
|
+
* Matches every line terminator a brief field refuses.
|
|
1483
1708
|
*
|
|
1484
1709
|
* @remarks
|
|
1485
|
-
*
|
|
1486
|
-
*
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1710
|
+
* Every ECMAScript line terminator, not just `\n`: a renderer that splits on any of them
|
|
1711
|
+
* would let the others forge a markdown row. CRLF leads the alternation so a Windows
|
|
1712
|
+
* exemplar splits as ONE break rather than two, which would insert a blank line the caller
|
|
1713
|
+
* never wrote. Kept unanchored and stateless — no `g` flag — so `test` never carries
|
|
1489
1714
|
* `lastIndex` between calls.
|
|
1490
1715
|
*/
|
|
1491
1716
|
export declare const LINE_BREAK_PATTERN: RegExp;
|
|
1492
1717
|
|
|
1493
|
-
/**
|
|
1718
|
+
/** Describes a non-empty single-line string — the shape mirror of `isLine`. */
|
|
1494
1719
|
export declare const lineShape: StringShape;
|
|
1495
1720
|
|
|
1496
1721
|
/**
|
|
1497
|
-
*
|
|
1722
|
+
* Represents the disjoint file partitions of a brief.
|
|
1498
1723
|
*
|
|
1499
1724
|
* @remarks
|
|
1500
1725
|
* `read` order is the reading order. A path in more than one partition is a
|
|
@@ -1507,22 +1732,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1507
1732
|
readonly forbidden: readonly Reference[];
|
|
1508
1733
|
}
|
|
1509
1734
|
|
|
1510
|
-
/**
|
|
1511
|
-
* Build a `Manifest`, defaulting every absent partition to an empty list.
|
|
1512
|
-
*
|
|
1513
|
-
* @param partitions - The partitions to fill; a partial literal is enough.
|
|
1514
|
-
* @returns A fresh `Manifest` with all four partitions present.
|
|
1515
|
-
*
|
|
1516
|
-
* @example
|
|
1517
|
-
* ```ts
|
|
1518
|
-
* import { manifest, reference } from '@orkestrel/brief'
|
|
1519
|
-
*
|
|
1520
|
-
* manifest({ edit: [reference('src/core/helpers.ts', 'implementation')] })
|
|
1521
|
-
* ```
|
|
1522
|
-
*/
|
|
1523
|
-
export declare function manifest(partitions?: Partial<Manifest>): Manifest;
|
|
1524
|
-
|
|
1525
|
-
/** The `Manifest` shape — four disjoint reference partitions. */
|
|
1735
|
+
/** Describes the `Manifest` shape — disjoint reference partitions. */
|
|
1526
1736
|
export declare const manifestShape: ObjectShape<{
|
|
1527
1737
|
read: ArrayShape<ObjectShape<{
|
|
1528
1738
|
path: StringShape;
|
|
@@ -1543,7 +1753,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1543
1753
|
}, false>;
|
|
1544
1754
|
|
|
1545
1755
|
/**
|
|
1546
|
-
*
|
|
1756
|
+
* Represents one ranked outcome — a result, never a step.
|
|
1547
1757
|
*
|
|
1548
1758
|
* @remarks
|
|
1549
1759
|
* `required: true` gates "done"; a demoted outcome is desirable but not blocking.
|
|
@@ -1554,25 +1764,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1554
1764
|
readonly required: boolean;
|
|
1555
1765
|
}
|
|
1556
1766
|
|
|
1557
|
-
/**
|
|
1558
|
-
* Build an `Outcome`.
|
|
1559
|
-
*
|
|
1560
|
-
* @param rank - The one-based rank; lower ranks matter more.
|
|
1561
|
-
* @param text - The result, never a step.
|
|
1562
|
-
* @param required - Whether the outcome gates "done"; defaults to `true`.
|
|
1563
|
-
* @returns A fresh `Outcome`.
|
|
1564
|
-
*
|
|
1565
|
-
* @example
|
|
1566
|
-
* ```ts
|
|
1567
|
-
* import { outcome } from '@orkestrel/brief'
|
|
1568
|
-
*
|
|
1569
|
-
* outcome(1, 'useForm uses native FormData with no behavior change') // required: true
|
|
1570
|
-
* outcome(2, 'the diff stays under 200 lines', false)
|
|
1571
|
-
* ```
|
|
1572
|
-
*/
|
|
1573
|
-
export declare function outcome(rank: number, text: string, required?: boolean): Outcome;
|
|
1574
|
-
|
|
1575
|
-
/** The `Outcome` shape — a one-based rank, the result text, and whether it gates done. */
|
|
1767
|
+
/** Describes the `Outcome` shape — a one-based rank, the result text, and whether it gates done. */
|
|
1576
1768
|
export declare const outcomeShape: ObjectShape<{
|
|
1577
1769
|
rank: NumberShape;
|
|
1578
1770
|
text: StringShape;
|
|
@@ -1580,7 +1772,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1580
1772
|
}, false>;
|
|
1581
1773
|
|
|
1582
1774
|
/**
|
|
1583
|
-
*
|
|
1775
|
+
* Represents the closed shape of the deliverable.
|
|
1584
1776
|
*
|
|
1585
1777
|
* @remarks
|
|
1586
1778
|
* `format` is required; `sections` / `include` / `exclude` refine it.
|
|
@@ -1592,30 +1784,13 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1592
1784
|
readonly exclude?: readonly string[];
|
|
1593
1785
|
}
|
|
1594
1786
|
|
|
1595
|
-
/**
|
|
1596
|
-
* Build an `Output`.
|
|
1597
|
-
*
|
|
1598
|
-
* @param format - The closed deliverable format.
|
|
1599
|
-
* @param overrides - Optional `sections` / `include` / `exclude`; absent keys are OMITTED.
|
|
1600
|
-
* @returns A fresh `Output`.
|
|
1601
|
-
*
|
|
1602
|
-
* @example
|
|
1603
|
-
* ```ts
|
|
1604
|
-
* import { output } from '@orkestrel/brief'
|
|
1605
|
-
*
|
|
1606
|
-
* output('markdown') // { format: 'markdown' }
|
|
1607
|
-
* output('diff', { include: ['updated useForm.ts'] })
|
|
1608
|
-
* ```
|
|
1609
|
-
*/
|
|
1610
|
-
export declare function output(format: OutputFormat, overrides?: Partial<Omit<Output, 'format'>>): Output;
|
|
1611
|
-
|
|
1612
|
-
/** The five `OutputFormat` values, frozen. */
|
|
1787
|
+
/** Lists the `OutputFormat` values, frozen. */
|
|
1613
1788
|
export declare const OUTPUT_FORMATS: readonly OutputFormat[];
|
|
1614
1789
|
|
|
1615
|
-
/**
|
|
1790
|
+
/** Names the closed vocabulary of deliverable shapes. */
|
|
1616
1791
|
export declare type OutputFormat = 'markdown' | 'json' | 'code' | 'diff' | 'prose';
|
|
1617
1792
|
|
|
1618
|
-
/**
|
|
1793
|
+
/** Describes the `Output` shape — a closed format plus its optional refinements. */
|
|
1619
1794
|
export declare const outputShape: ObjectShape<{
|
|
1620
1795
|
format: LiteralShape<readonly OutputFormat[]>;
|
|
1621
1796
|
sections: OptionalShape<ArrayShape<StringShape>>;
|
|
@@ -1624,7 +1799,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1624
1799
|
}, false>;
|
|
1625
1800
|
|
|
1626
1801
|
/**
|
|
1627
|
-
*
|
|
1802
|
+
* Parses a JSON string into a `Brief`.
|
|
1628
1803
|
*
|
|
1629
1804
|
* @remarks
|
|
1630
1805
|
* The parse-then-trust boundary for a stored brief, a tool argument, or an agent's
|
|
@@ -1655,7 +1830,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1655
1830
|
export declare function parseBrief(value: string): Brief | undefined;
|
|
1656
1831
|
|
|
1657
1832
|
/**
|
|
1658
|
-
*
|
|
1833
|
+
* Returns a fresh brief with `trace` and `hash` derived from its own content.
|
|
1659
1834
|
*
|
|
1660
1835
|
* @remarks
|
|
1661
1836
|
* Deterministic: no clock, no randomness, no run-specific data. Any existing `trace` /
|
|
@@ -1671,16 +1846,16 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1671
1846
|
*
|
|
1672
1847
|
* @example
|
|
1673
1848
|
* ```ts
|
|
1674
|
-
* import {
|
|
1849
|
+
* import { buildBrief, buildTask, pinBrief } from '@orkestrel/brief'
|
|
1675
1850
|
*
|
|
1676
|
-
* const pinned = pinBrief(
|
|
1851
|
+
* const pinned = pinBrief(buildBrief(buildTask('document', 'writing', 'Write the brief guide.')))
|
|
1677
1852
|
* pinned.hash // an 8-hex-digit structural digest
|
|
1678
1853
|
* pinned.trace // 'document/writing · outcomes:0 · gaps:0/0 · proofs:0'
|
|
1679
1854
|
* ```
|
|
1680
1855
|
*/
|
|
1681
1856
|
export declare function pinBrief(source: Brief): Brief;
|
|
1682
1857
|
|
|
1683
|
-
/**
|
|
1858
|
+
/** Records the `pin` phase snapshot — the drafted `Brief` in, the pinned `Brief` out. */
|
|
1684
1859
|
export declare interface PinStageRecord {
|
|
1685
1860
|
readonly stage: 'pin';
|
|
1686
1861
|
readonly input: Brief;
|
|
@@ -1689,40 +1864,24 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1689
1864
|
}
|
|
1690
1865
|
|
|
1691
1866
|
/**
|
|
1692
|
-
*
|
|
1867
|
+
* Represents one mechanical, transcript-provable check.
|
|
1693
1868
|
*
|
|
1694
1869
|
* @remarks
|
|
1695
|
-
* `command`
|
|
1870
|
+
* Give `command` a clear exit signal; it becomes the `/goal` condition verbatim.
|
|
1696
1871
|
*/
|
|
1697
1872
|
export declare interface Proof {
|
|
1698
1873
|
readonly text: string;
|
|
1699
1874
|
readonly command: string;
|
|
1700
1875
|
}
|
|
1701
1876
|
|
|
1702
|
-
/**
|
|
1703
|
-
* Build a `Proof`.
|
|
1704
|
-
*
|
|
1705
|
-
* @param text - What the check settles.
|
|
1706
|
-
* @param command - The command whose exit signal settles it.
|
|
1707
|
-
* @returns A fresh `Proof`.
|
|
1708
|
-
*
|
|
1709
|
-
* @example
|
|
1710
|
-
* ```ts
|
|
1711
|
-
* import { proof } from '@orkestrel/brief'
|
|
1712
|
-
*
|
|
1713
|
-
* proof('type-check and lint pass', 'npm run check')
|
|
1714
|
-
* ```
|
|
1715
|
-
*/
|
|
1716
|
-
export declare function proof(text: string, command: string): Proof;
|
|
1717
|
-
|
|
1718
|
-
/** The `Proof` shape — the claim and the command that settles it. */
|
|
1877
|
+
/** Describes the `Proof` shape — the claim and the command that settles it. */
|
|
1719
1878
|
export declare const proofShape: ObjectShape<{
|
|
1720
1879
|
text: StringShape;
|
|
1721
1880
|
command: StringShape;
|
|
1722
1881
|
}, false>;
|
|
1723
1882
|
|
|
1724
1883
|
/**
|
|
1725
|
-
*
|
|
1884
|
+
* Represents one referenced path and why it is listed.
|
|
1726
1885
|
*
|
|
1727
1886
|
* @remarks
|
|
1728
1887
|
* The ONE path record. A reference means different things in different containers, and the
|
|
@@ -1740,59 +1899,26 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1740
1899
|
readonly note: string;
|
|
1741
1900
|
}
|
|
1742
1901
|
|
|
1743
|
-
/**
|
|
1744
|
-
* Build a `Reference`.
|
|
1745
|
-
*
|
|
1746
|
-
* @param path - The referenced path or glob.
|
|
1747
|
-
* @param note - Why the path is listed.
|
|
1748
|
-
* @returns A fresh `Reference`.
|
|
1749
|
-
*
|
|
1750
|
-
* @example
|
|
1751
|
-
* ```ts
|
|
1752
|
-
* import { reference } from '@orkestrel/brief'
|
|
1753
|
-
*
|
|
1754
|
-
* reference('AGENTS.md', 'project law') // { path: 'AGENTS.md', note: 'project law' }
|
|
1755
|
-
* ```
|
|
1756
|
-
*/
|
|
1757
|
-
export declare function reference(path: string, note: string): Reference;
|
|
1758
|
-
|
|
1759
|
-
/** The `Reference` shape — a path and the note that justifies listing it. */
|
|
1902
|
+
/** Describes the `Reference` shape — a path and the note that justifies listing it. */
|
|
1760
1903
|
export declare const referenceShape: ObjectShape<{
|
|
1761
1904
|
path: StringShape;
|
|
1762
1905
|
note: StringShape;
|
|
1763
1906
|
}, false>;
|
|
1764
1907
|
|
|
1765
|
-
/**
|
|
1908
|
+
/** Represents one pre-empted risk and the mitigation that answers it. */
|
|
1766
1909
|
export declare interface Risk {
|
|
1767
1910
|
readonly severity: RiskSeverity;
|
|
1768
1911
|
readonly text: string;
|
|
1769
1912
|
readonly mitigation: string;
|
|
1770
1913
|
}
|
|
1771
1914
|
|
|
1772
|
-
/**
|
|
1773
|
-
* Build a `Risk`.
|
|
1774
|
-
*
|
|
1775
|
-
* @param severity - The closed severity.
|
|
1776
|
-
* @param text - What could go wrong.
|
|
1777
|
-
* @param mitigation - What answers it.
|
|
1778
|
-
* @returns A fresh `Risk`.
|
|
1779
|
-
*
|
|
1780
|
-
* @example
|
|
1781
|
-
* ```ts
|
|
1782
|
-
* import { risk } from '@orkestrel/brief'
|
|
1783
|
-
*
|
|
1784
|
-
* risk('medium', 'native validation differs subtly', 'assert message and state in tests')
|
|
1785
|
-
* ```
|
|
1786
|
-
*/
|
|
1787
|
-
export declare function risk(severity: RiskSeverity, text: string, mitigation: string): Risk;
|
|
1788
|
-
|
|
1789
|
-
/** The three `RiskSeverity` values, frozen. */
|
|
1915
|
+
/** Lists the `RiskSeverity` values, frozen. */
|
|
1790
1916
|
export declare const RISK_SEVERITIES: readonly RiskSeverity[];
|
|
1791
1917
|
|
|
1792
|
-
/**
|
|
1918
|
+
/** Names the closed vocabulary of risk severities. */
|
|
1793
1919
|
export declare type RiskSeverity = 'low' | 'medium' | 'high';
|
|
1794
1920
|
|
|
1795
|
-
/**
|
|
1921
|
+
/** Describes the `Risk` shape — a closed severity, the risk, and its mitigation. */
|
|
1796
1922
|
export declare const riskShape: ObjectShape<{
|
|
1797
1923
|
severity: LiteralShape<readonly RiskSeverity[]>;
|
|
1798
1924
|
text: StringShape;
|
|
@@ -1800,7 +1926,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1800
1926
|
}, false>;
|
|
1801
1927
|
|
|
1802
1928
|
/**
|
|
1803
|
-
*
|
|
1929
|
+
* Holds the positive form of {@link LINE_BREAK_PATTERN}, for the shape DSL.
|
|
1804
1930
|
*
|
|
1805
1931
|
* @remarks
|
|
1806
1932
|
* `stringShape`'s `pattern` must MATCH an accepted value, so the guard's refusal regex
|
|
@@ -1810,7 +1936,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1810
1936
|
export declare const SINGLE_LINE_PATTERN: RegExp;
|
|
1811
1937
|
|
|
1812
1938
|
/**
|
|
1813
|
-
*
|
|
1939
|
+
* Returns a deeply owned, deeply frozen copy of a brief, refusing anything off-contract.
|
|
1814
1940
|
*
|
|
1815
1941
|
* @remarks
|
|
1816
1942
|
* The one reading boundary this package has, used by the pin, the registry, and every
|
|
@@ -1834,10 +1960,10 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1834
1960
|
*
|
|
1835
1961
|
* @example
|
|
1836
1962
|
* ```ts
|
|
1837
|
-
* import {
|
|
1963
|
+
* import { buildBrief, buildOutcome, buildTask, snapshotBrief } from '@orkestrel/brief'
|
|
1838
1964
|
*
|
|
1839
|
-
* const outcomes = [
|
|
1840
|
-
* const owned = snapshotBrief(
|
|
1965
|
+
* const outcomes = [buildOutcome(1, 'shipped')]
|
|
1966
|
+
* const owned = snapshotBrief(buildBrief(buildTask('plan', 'ops', 'Plan the release.'), { outcomes }))
|
|
1841
1967
|
* owned.outcomes === outcomes // false — the alias is broken
|
|
1842
1968
|
* Object.isFrozen(owned.outcomes) // true
|
|
1843
1969
|
* ```
|
|
@@ -1845,7 +1971,7 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1845
1971
|
export declare function snapshotBrief(source: Brief): Brief;
|
|
1846
1972
|
|
|
1847
1973
|
/**
|
|
1848
|
-
*
|
|
1974
|
+
* States what the brief asks for, in one imperative sentence.
|
|
1849
1975
|
*
|
|
1850
1976
|
* @remarks
|
|
1851
1977
|
* A compound `statement` is two briefs — `validateBrief` errors on more than one sentence.
|
|
@@ -1856,53 +1982,36 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1856
1982
|
readonly statement: string;
|
|
1857
1983
|
}
|
|
1858
1984
|
|
|
1859
|
-
/**
|
|
1860
|
-
* Build a `Task`.
|
|
1861
|
-
*
|
|
1862
|
-
* @param operation - What the brief asks for, from the closed operation vocabulary.
|
|
1863
|
-
* @param domain - The subject matter, from the closed domain vocabulary.
|
|
1864
|
-
* @param statement - One imperative sentence naming the object of the work.
|
|
1865
|
-
* @returns A fresh `Task`.
|
|
1866
|
-
*
|
|
1867
|
-
* @example
|
|
1868
|
-
* ```ts
|
|
1869
|
-
* import { task } from '@orkestrel/brief'
|
|
1870
|
-
*
|
|
1871
|
-
* task('refactor', 'code', 'Refactor useForm to native browser form APIs.')
|
|
1872
|
-
* ```
|
|
1873
|
-
*/
|
|
1874
|
-
export declare function task(operation: TaskOperation, domain: TaskDomain, statement: string): Task;
|
|
1875
|
-
|
|
1876
|
-
/** The eight `TaskDomain` values, frozen. */
|
|
1985
|
+
/** Lists the `TaskDomain` values, frozen. */
|
|
1877
1986
|
export declare const TASK_DOMAINS: readonly TaskDomain[];
|
|
1878
1987
|
|
|
1879
|
-
/**
|
|
1988
|
+
/** Lists the `TaskOperation` values, frozen. */
|
|
1880
1989
|
export declare const TASK_OPERATIONS: readonly TaskOperation[];
|
|
1881
1990
|
|
|
1882
|
-
/**
|
|
1991
|
+
/** Names the closed vocabulary of the subject matter a brief operates on. */
|
|
1883
1992
|
export declare type TaskDomain = 'code' | 'writing' | 'research' | 'analysis' | 'design' | 'data' | 'ops' | 'other';
|
|
1884
1993
|
|
|
1885
1994
|
/**
|
|
1886
|
-
*
|
|
1995
|
+
* Names the closed vocabulary of what a brief asks for.
|
|
1887
1996
|
*
|
|
1888
1997
|
* @remarks
|
|
1889
|
-
* A request that fits none of these
|
|
1890
|
-
*
|
|
1998
|
+
* A request that fits none of these is mis-scoped rather than a missing literal. Compose
|
|
1999
|
+
* with `literalOf(TASK_OPERATIONS)` or `parseEnum(value, TASK_OPERATIONS)`.
|
|
1891
2000
|
*/
|
|
1892
2001
|
export declare type TaskOperation = 'create' | 'refactor' | 'debug' | 'extract' | 'migrate' | 'explain' | 'review' | 'optimize' | 'audit' | 'test' | 'document' | 'plan';
|
|
1893
2002
|
|
|
1894
|
-
/**
|
|
2003
|
+
/** Describes the `Task` shape — closed operation and domain vocabularies plus a non-empty statement. */
|
|
1895
2004
|
export declare const taskShape: ObjectShape<{
|
|
1896
2005
|
operation: LiteralShape<readonly TaskOperation[]>;
|
|
1897
2006
|
domain: LiteralShape<readonly TaskDomain[]>;
|
|
1898
2007
|
statement: StringShape;
|
|
1899
2008
|
}, false>;
|
|
1900
2009
|
|
|
1901
|
-
/**
|
|
2010
|
+
/** Describes a single-line string of any length, including empty. */
|
|
1902
2011
|
export declare const textShape: StringShape;
|
|
1903
2012
|
|
|
1904
2013
|
/**
|
|
1905
|
-
*
|
|
2014
|
+
* Runs the semantic pass over an already-shape-valid brief.
|
|
1906
2015
|
*
|
|
1907
2016
|
* @remarks
|
|
1908
2017
|
* ERRORS are the structural violations no assumption can paper over: a manifest
|
|
@@ -1916,11 +2025,11 @@ import { Subject } from '@orkestrel/reason';
|
|
|
1916
2025
|
*
|
|
1917
2026
|
* @example
|
|
1918
2027
|
* ```ts
|
|
1919
|
-
* import {
|
|
2028
|
+
* import { buildBrief, buildProof, buildTask, validateBrief } from '@orkestrel/brief'
|
|
1920
2029
|
*
|
|
1921
|
-
* validateBrief(
|
|
2030
|
+
* validateBrief(buildBrief(buildTask('plan', 'ops', 'Plan the release.'))) // valid: false — no proofs
|
|
1922
2031
|
* validateBrief(
|
|
1923
|
-
*
|
|
2032
|
+
* buildBrief(buildTask('plan', 'ops', 'Plan the release.'), { proofs: [buildProof('ok', 'npm test')] }),
|
|
1924
2033
|
* ) // valid: true
|
|
1925
2034
|
* ```
|
|
1926
2035
|
*/
|