@orkestrel/scaffold 0.0.115 → 0.0.117
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/dist/bin/main.js +138 -16
- package/dist/bin/main.js.map +1 -1
- package/dist/host/agents/skills/orkestrel-publish/references/wave.md +1 -1
- package/dist/host/claude/agents/orkestrel.md +2 -2
- package/dist/host/claude/rules/names.md +3 -1
- package/dist/host/guides/abort.md +17 -17
- package/dist/host/guides/agent.md +445 -445
- package/dist/host/guides/brief.md +143 -143
- package/dist/host/guides/browser.md +731 -731
- package/dist/host/guides/budget.md +39 -39
- package/dist/host/guides/capture.md +298 -298
- package/dist/host/guides/console.md +109 -109
- package/dist/host/guides/contract.md +335 -335
- package/dist/host/guides/csv.md +30 -30
- package/dist/host/guides/database.md +163 -163
- package/dist/host/guides/emitter.md +17 -17
- package/dist/host/guides/form.md +99 -99
- package/dist/host/guides/guide.md +368 -183
- package/dist/host/guides/html.md +49 -49
- package/dist/host/guides/indexeddb.md +40 -40
- package/dist/host/guides/interpret.md +139 -139
- package/dist/host/guides/lsp.md +114 -114
- package/dist/host/guides/markdown.md +68 -68
- package/dist/host/guides/mcp.md +3745 -3745
- package/dist/host/guides/middleware.md +170 -170
- package/dist/host/guides/msg.md +95 -95
- package/dist/host/guides/ndjson.md +8 -8
- package/dist/host/guides/ollama.md +56 -56
- package/dist/host/guides/pool.md +21 -21
- package/dist/host/guides/probe.md +82 -82
- package/dist/host/guides/process.md +99 -99
- package/dist/host/guides/program.md +98 -96
- package/dist/host/guides/qualifier.md +70 -70
- package/dist/host/guides/queue.md +37 -37
- package/dist/host/guides/rater.md +38 -38
- package/dist/host/guides/reason.md +308 -308
- package/dist/host/guides/relation.md +50 -50
- package/dist/host/guides/router.md +58 -58
- package/dist/host/guides/scaffold.md +558 -419
- package/dist/host/guides/sea.md +128 -128
- package/dist/host/guides/server.md +100 -100
- package/dist/host/guides/sqlite.md +28 -28
- package/dist/host/guides/sse.md +20 -20
- package/dist/host/guides/study.md +444 -444
- package/dist/host/guides/table.md +82 -82
- package/dist/host/guides/template.md +41 -41
- package/dist/host/guides/terminal.md +121 -121
- package/dist/host/guides/test.md +273 -273
- package/dist/host/guides/timeout.md +18 -18
- package/dist/host/guides/tool.md +27 -27
- package/dist/host/guides/toolbox.md +166 -166
- package/dist/host/guides/websocket.md +54 -54
- package/dist/host/guides/worker.md +24 -24
- package/dist/host/guides/workflow.md +187 -187
- package/dist/host/guides/workspace.md +55 -55
- package/dist/host/manifest.json +55 -55
- package/dist/host/tests/setupPolicy.ts +5 -3
- package/dist/src/core/index.cjs +90 -4
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +229 -144
- package/dist/src/core/index.d.ts +229 -144
- package/dist/src/core/index.js +88 -5
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +295 -66
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +193 -6
- package/dist/src/server/index.d.ts +193 -6
- package/dist/src/server/index.js +290 -69
- package/dist/src/server/index.js.map +1 -1
- package/package.json +5 -4
|
@@ -27,64 +27,64 @@ budget.consume(7_000) // crosses 10_000 — fires `signal`
|
|
|
27
27
|
|
|
28
28
|
### Factories
|
|
29
29
|
|
|
30
|
-
|
|
|
31
|
-
| --------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
32
|
-
| `createBudget` | function | Creates a cumulative budget as a `BudgetInterface<T>` over a `max` ceiling and a `consumer`, whose native signal aborts the moment the tally reaches that ceiling. |
|
|
33
|
-
| `createTokenConsumer` | function | Creates a validated unary consumer that charges one selected `TokenUsage` field. |
|
|
34
|
-
| `createTokenBudget` | function | Creates a token budget as a `BudgetInterface<TokenUsage>` charging one validated `scope` field per provider call. |
|
|
35
|
-
| `createTokenMeter` | function | Creates a token meter as a `MeterInterface` that charges a token budget each growth of a streamed answer's estimated token count as completion tokens. |
|
|
30
|
+
| Name | Kind | Signature | Summary |
|
|
31
|
+
| --------------------- | -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
32
|
+
| `createBudget` | function | `<T>(options: BudgetOptions<T>) => BudgetInterface<T>` | Creates a cumulative budget as a `BudgetInterface<T>` over a `max` ceiling and a `consumer`, whose native signal aborts the moment the tally reaches that ceiling. |
|
|
33
|
+
| `createTokenConsumer` | function | `(scope: TokenScope) => BudgetOptions<TokenUsage>['consumer']` | Creates a validated unary consumer that charges one selected `TokenUsage` field. |
|
|
34
|
+
| `createTokenBudget` | function | `(options: TokenBudgetOptions) => BudgetInterface<TokenUsage>` | Creates a token budget as a `BudgetInterface<TokenUsage>` charging one validated `scope` field per provider call. |
|
|
35
|
+
| `createTokenMeter` | function | `(options: TokenMeterOptions) => MeterInterface` | Creates a token meter as a `MeterInterface` that charges a token budget each growth of a streamed answer's estimated token count as completion tokens. |
|
|
36
36
|
|
|
37
37
|
### Validators
|
|
38
38
|
|
|
39
39
|
In a guard table a `Shape` cell holds the type the guard narrows to.
|
|
40
40
|
|
|
41
|
-
|
|
|
42
|
-
| ---------------- | -------- |
|
|
43
|
-
| `isBudget` | function | `BudgetInterface<unknown>` | Determines whether a value implements `BudgetInterface`, returning `false` rather than throwing on hostile input. |
|
|
44
|
-
| `isBudgetError` | function | `BudgetError` | Checks whether an unknown value is a `BudgetError` built by any copy of this package, so an abort reason can be read as a budget's exhaustion. |
|
|
45
|
-
| `isBudgetAmount` | function | `number` | Determines whether a value is a finite nonnegative budget amount. |
|
|
46
|
-
| `isBudgetSignal` | function | `AbortSignal` | Determines whether a value is a genuine native `AbortSignal`, returning `false` rather than throwing on hostile input. |
|
|
47
|
-
| `isTokenScope` | function | `TokenScope` | Determines whether a value is a supported `TokenScope` field selector. |
|
|
48
|
-
| `isTokenUsage` | function | `TokenUsage` | Determines whether a value is readable token usage carrying three finite nonnegative counts, returning `false` rather than throwing. |
|
|
41
|
+
| Name | Kind | Signature | Summary |
|
|
42
|
+
| ---------------- | -------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `isBudget` | function | `(value: unknown) => value is BudgetInterface<unknown>` | Determines whether a value implements `BudgetInterface`, returning `false` rather than throwing on hostile input. |
|
|
44
|
+
| `isBudgetError` | function | `(value: unknown) => value is BudgetError` | Checks whether an unknown value is a `BudgetError` built by any copy of this package, so an abort reason can be read as a budget's exhaustion. |
|
|
45
|
+
| `isBudgetAmount` | function | `(value: unknown) => value is number` | Determines whether a value is a finite nonnegative budget amount. |
|
|
46
|
+
| `isBudgetSignal` | function | `(value: unknown) => value is AbortSignal` | Determines whether a value is a genuine native `AbortSignal`, returning `false` rather than throwing on hostile input. |
|
|
47
|
+
| `isTokenScope` | function | `(value: unknown) => value is TokenScope` | Determines whether a value is a supported `TokenScope` field selector. |
|
|
48
|
+
| `isTokenUsage` | function | `(value: unknown) => value is TokenUsage` | Determines whether a value is readable token usage carrying three finite nonnegative counts, returning `false` rather than throwing. |
|
|
49
49
|
|
|
50
50
|
### Helpers
|
|
51
51
|
|
|
52
|
-
|
|
|
53
|
-
| ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
|
|
54
|
-
| `validateBudgetOptions` | function | Validates and normalizes budget construction options into a fresh copy that omits absent optional keys. |
|
|
55
|
-
| `validateTokenBudgetOptions` | function | Validates and normalizes token-budget construction options into a fresh copy that omits absent optional keys. |
|
|
56
|
-
| `validateMeterOptions` | function | Validates and normalizes meter construction options into a fresh copy. |
|
|
57
|
-
| `validateTokenMeterOptions` | function | Validates and normalizes token-meter construction options into a fresh copy. |
|
|
52
|
+
| Name | Kind | Signature | Summary |
|
|
53
|
+
| ---------------------------- | -------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
54
|
+
| `validateBudgetOptions` | function | `<T>(options: BudgetOptions<T>) => BudgetOptions<T>` | Validates and normalizes budget construction options into a fresh copy that omits absent optional keys. |
|
|
55
|
+
| `validateTokenBudgetOptions` | function | `(options: TokenBudgetOptions) => TokenBudgetOptions` | Validates and normalizes token-budget construction options into a fresh copy that omits absent optional keys. |
|
|
56
|
+
| `validateMeterOptions` | function | `<T>(options: MeterOptions<T>) => MeterOptions<T>` | Validates and normalizes meter construction options into a fresh copy. |
|
|
57
|
+
| `validateTokenMeterOptions` | function | `(options: TokenMeterOptions) => TokenMeterOptions` | Validates and normalizes token-meter construction options into a fresh copy. |
|
|
58
58
|
|
|
59
59
|
### Classes
|
|
60
60
|
|
|
61
|
-
|
|
|
62
|
-
| ------------- | ----- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
-
| `Budget` | class | Implements `BudgetInterface` over a private `AbortController` the instance owns, aborting the composed signal the moment `consumed` reaches the `max` ceiling. |
|
|
64
|
-
| `Meter` | class | Implements `MeterInterface` for one stream, charging a budget the growth of the streamed text's estimated cost as each delta arrives. |
|
|
65
|
-
| `BudgetError` | class | Reports a budget whose cumulative tally reached its ceiling — the abort reason of the budget's own `signal`, carrying the machine-readable `code` `'exhaust'` and the budget's `id`, `max`, and `consumed` readings. |
|
|
61
|
+
| Name | Kind | Signature | Summary |
|
|
62
|
+
| ------------- | ----- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `Budget` | class | `new <T>(options: BudgetOptions<T>) => BudgetInterface<T>` | Implements `BudgetInterface` over a private `AbortController` the instance owns, aborting the composed signal the moment `consumed` reaches the `max` ceiling. |
|
|
64
|
+
| `Meter` | class | `new <T>(options: MeterOptions<T>) => MeterInterface` | Implements `MeterInterface` for one stream, charging a budget the growth of the streamed text's estimated cost as each delta arrives. |
|
|
65
|
+
| `BudgetError` | class | `new (context: BudgetErrorContext) => BudgetError` | Reports a budget whose cumulative tally reached its ceiling — the abort reason of the budget's own `signal`, carrying the machine-readable `code` `'exhaust'` and the budget's `id`, `max`, and `consumed` readings. |
|
|
66
66
|
|
|
67
67
|
### Constants
|
|
68
68
|
|
|
69
|
-
|
|
|
70
|
-
| -------------------- | ----- | ------------------------------------------------------------------------------------------- |
|
|
71
|
-
| `BUDGET_ERROR_BRAND` | const | Holds the registry-global key used to recognize `BudgetError` values across package copies. |
|
|
69
|
+
| Name | Kind | Signature | Summary |
|
|
70
|
+
| -------------------- | ----- | --------------- | ------------------------------------------------------------------------------------------- |
|
|
71
|
+
| `BUDGET_ERROR_BRAND` | const | `unique symbol` | Holds the registry-global key used to recognize `BudgetError` values across package copies. |
|
|
72
72
|
|
|
73
73
|
### Types
|
|
74
74
|
|
|
75
75
|
A `Shape` cell holds an interface's data members as bare names in braces, `?` marking an optional member and `plus` introducing its call-signature members, and a type alias's own type literal with a union's arms escaped as `\|`.
|
|
76
76
|
|
|
77
|
-
|
|
|
78
|
-
| -------------------- | --------- |
|
|
79
|
-
| `BudgetOptions` | interface | `{ id?, max, consumer, signal? }`
|
|
80
|
-
| `TokenBudgetOptions` | interface | `{ id?, max, scope?, signal? }`
|
|
81
|
-
| `BudgetInterface` | interface | `{ id, signal, max, consumed, remaining, exhausted
|
|
82
|
-
| `TokenScope` | type | `'completion' \| 'total' \| 'prompt'`
|
|
83
|
-
| `TokenUsage` | interface | `{ prompt, completion, total }`
|
|
84
|
-
| `MeterOptions` | interface | `{ budget, estimator, producer }`
|
|
85
|
-
| `TokenMeterOptions` | interface | `{ budget, estimator }`
|
|
86
|
-
| `MeterInterface` | interface | `{ charged }
|
|
87
|
-
| `BudgetErrorContext` | interface | `{ id, max, consumed }`
|
|
77
|
+
| Name | Kind | Signature | Summary |
|
|
78
|
+
| -------------------- | --------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
79
|
+
| `BudgetOptions` | interface | `{ id?, max, consumer, signal? }` | Represents the options for constructing a cumulative budget, accepted by the `createBudget` function and the `Budget` constructor. |
|
|
80
|
+
| `TokenBudgetOptions` | interface | `{ id?, max, scope?, signal? }` | Represents the options for constructing a token budget, accepted by the `createTokenBudget` function. |
|
|
81
|
+
| `BudgetInterface` | interface | `{ id, signal, max, consumed, remaining, exhausted, start(), consume(), clear() }` | Represents the cumulative cost handle contract: a lifetime tally, its validated ceiling, and the native signal that aborts when the tally reaches that ceiling. |
|
|
82
|
+
| `TokenScope` | type | `'completion' \| 'total' \| 'prompt'` | Names the token-usage field selected as the charge for a token budget. |
|
|
83
|
+
| `TokenUsage` | interface | `{ prompt, completion, total }` | Represents the canonical LLM cost unit: the finite nonnegative token counts reported for one provider call, and the typical `T` for an agent budget. |
|
|
84
|
+
| `MeterOptions` | interface | `{ budget, estimator, producer }` | Represents the options for constructing a meter, accepted by the `Meter` constructor. |
|
|
85
|
+
| `TokenMeterOptions` | interface | `{ budget, estimator }` | Represents the options for constructing a token meter, accepted by the `createTokenMeter` function. |
|
|
86
|
+
| `MeterInterface` | interface | `{ charged, charge() }` | Represents the stream meter contract: it measures text as it streams and charges a budget the growth of the text's estimated cost, keeping the cost already charged so a later reported total can be reconciled against it. |
|
|
87
|
+
| `BudgetErrorContext` | interface | `{ id, max, consumed }` | Represents the readings a `BudgetError` carries: the exhausted budget's trace `id`, its `max` ceiling, and its `consumed` tally at the moment the ceiling was reached. |
|
|
88
88
|
|
|
89
89
|
The `id`, `signal`, `max`, `consumed`, `remaining`, and `exhausted` members of `BudgetInterface` are `readonly` data members (the preceding Surface rows) — its call-signature methods are documented under [Methods](#methods). The `charged` member of `MeterInterface` is a `readonly` data member; its call-signature method is documented under [Methods](#methods).
|
|
90
90
|
|