@serene-pub/sdk 0.6.0-pr-4 โ 0.6.0-pr-6
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 +23 -19
- package/dist/actions.d.ts +178 -69
- package/dist/actions.js +109 -40
- package/dist/annexFields.d.ts +12 -5
- package/dist/annexFields.js +6 -2
- package/dist/announce.d.ts +220 -30
- package/dist/announce.js +212 -7
- package/dist/attributes.d.ts +290 -11
- package/dist/attributes.js +317 -32
- package/dist/bands.d.ts +41 -6
- package/dist/bands.js +83 -33
- package/dist/bridges.d.ts +61 -0
- package/dist/bridges.js +112 -0
- package/dist/builder.d.ts +436 -106
- package/dist/builder.js +389 -46
- package/dist/cadences.d.ts +578 -0
- package/dist/cadences.js +1111 -0
- package/dist/candidates.d.ts +5 -3
- package/dist/candidates.js +3 -2
- package/dist/capabilities.d.ts +93 -15
- package/dist/capabilities.js +57 -6
- package/dist/checkMethods.d.ts +240 -0
- package/dist/checkMethods.js +362 -0
- package/dist/clauses.d.ts +2 -1
- package/dist/clauses.js +2 -1
- package/dist/component.d.ts +24 -7
- package/dist/component.js +16 -6
- package/dist/componentBuild.d.ts +16 -5
- package/dist/componentBuild.js +14 -5
- package/dist/componentClient.d.ts +61 -30
- package/dist/componentClient.js +11 -1
- package/dist/componentImports.d.ts +8 -5
- package/dist/componentImports.js +23 -4
- package/dist/componentModule.js +2 -1
- package/dist/componentWire.d.ts +2 -1
- package/dist/componentWire.js +34 -2
- package/dist/composerStates.d.ts +96 -0
- package/dist/composerStates.js +190 -0
- package/dist/conditions.d.ts +424 -0
- package/dist/conditions.js +521 -0
- package/dist/config.d.ts +69 -19
- package/dist/config.js +64 -26
- package/dist/connections.d.ts +9 -4
- package/dist/connections.js +7 -4
- package/dist/conversions.d.ts +41 -0
- package/dist/conversions.js +50 -0
- package/dist/declarations.d.ts +70 -18
- package/dist/declarations.js +194 -24
- package/dist/descriptors.d.ts +427 -100
- package/dist/descriptors.js +344 -59
- package/dist/dev.d.ts +6 -5
- package/dist/dev.js +6 -5
- package/dist/document.d.ts +121 -27
- package/dist/document.js +77 -24
- package/dist/dowry.d.ts +241 -0
- package/dist/dowry.js +315 -0
- package/dist/engines.d.ts +16 -7
- package/dist/engines.js +6 -4
- package/dist/entities.d.ts +156 -0
- package/dist/entities.js +259 -0
- package/dist/eventMapLaws.d.ts +19 -8
- package/dist/eventMapLaws.js +9 -6
- package/dist/events.d.ts +648 -40
- package/dist/events.js +451 -34
- package/dist/executor.d.ts +123 -41
- package/dist/executor.js +210 -103
- package/dist/exposure.d.ts +128 -0
- package/dist/exposure.js +168 -0
- package/dist/extension.d.ts +99 -35
- package/dist/extension.js +43 -9
- package/dist/facets.d.ts +2 -1
- package/dist/facets.js +4 -2
- package/dist/fit.d.ts +198 -0
- package/dist/fit.js +351 -0
- package/dist/foldedSections.d.ts +4 -2
- package/dist/foldedSections.js +2 -1
- package/dist/functions.d.ts +554 -0
- package/dist/functions.js +712 -0
- package/dist/genres.d.ts +408 -130
- package/dist/genres.js +412 -108
- package/dist/guardedConnection.d.ts +4 -3
- package/dist/guardedConnection.js +4 -3
- package/dist/handlebarsReach.d.ts +1 -1
- package/dist/handlebarsReach.js +1 -1
- package/dist/hash.d.ts +16 -5
- package/dist/hash.js +14 -4
- package/dist/hookGrants.d.ts +4 -3
- package/dist/hookGrants.js +7 -5
- package/dist/hooks.d.ts +42 -21
- package/dist/hooks.js +17 -12
- package/dist/hostElements.d.ts +47 -17
- package/dist/hostElements.js +62 -17
- package/dist/hostState.d.ts +110 -0
- package/dist/hostState.js +140 -0
- package/dist/i18n.d.ts +5 -3
- package/dist/i18n.js +5 -3
- package/dist/identity.d.ts +5 -4
- package/dist/identity.js +5 -4
- package/dist/index.d.ts +26 -0
- package/dist/index.js +55 -0
- package/dist/jsonSchema.d.ts +178 -0
- package/dist/jsonSchema.js +558 -0
- package/dist/layout.d.ts +36 -15
- package/dist/layout.js +2 -2
- package/dist/loadouts.d.ts +97 -0
- package/dist/loadouts.js +81 -0
- package/dist/media.d.ts +153 -16
- package/dist/media.js +47 -2
- package/dist/messageBlocks.d.ts +223 -37
- package/dist/messageBlocks.js +231 -24
- package/dist/migration.d.ts +16 -8
- package/dist/migration.js +14 -8
- package/dist/names.d.ts +2 -1
- package/dist/names.js +2 -1
- package/dist/nodeInput.d.ts +2 -1
- package/dist/nodeInput.js +2 -1
- package/dist/participants.d.ts +54 -24
- package/dist/participants.js +27 -14
- package/dist/personGate.d.ts +2 -1
- package/dist/personGate.js +2 -1
- package/dist/pluginHarness.d.ts +22 -35
- package/dist/pluginHarness.js +18 -143
- package/dist/pluginPermissions.d.ts +2 -1
- package/dist/pluginPermissions.js +13 -2
- package/dist/pluginRuleRef.d.ts +2 -2
- package/dist/pluginRuleRef.js +1 -1
- package/dist/predicates.d.ts +16 -11
- package/dist/predicates.js +7 -6
- package/dist/preview.d.ts +53 -7
- package/dist/preview.js +54 -13
- package/dist/primers.d.ts +177 -0
- package/dist/primers.js +265 -0
- package/dist/promptBlocks.d.ts +5 -3
- package/dist/promptBlocks.js +5 -3
- package/dist/rankingDecisions.d.ts +2 -1
- package/dist/rankingDecisions.js +2 -1
- package/dist/receipt.d.ts +76 -29
- package/dist/receipt.js +9 -4
- package/dist/receiverRules.js +3 -2
- package/dist/refs.d.ts +42 -9
- package/dist/refs.js +45 -13
- package/dist/registrations.d.ts +384 -0
- package/dist/registrations.js +625 -0
- package/dist/registry.d.ts +42 -23
- package/dist/registry.js +7 -5
- package/dist/repertoires.d.ts +502 -0
- package/dist/repertoires.js +666 -0
- package/dist/review.d.ts +16 -5
- package/dist/review.js +11 -4
- package/dist/rulesetDocument.d.ts +95 -0
- package/dist/rulesetDocument.js +190 -0
- package/dist/rulesetSections.d.ts +597 -0
- package/dist/rulesetSections.js +1249 -0
- package/dist/rulesetTemplates.d.ts +161 -0
- package/dist/rulesetTemplates.js +242 -0
- package/dist/rulesets.d.ts +899 -0
- package/dist/rulesets.js +1378 -0
- package/dist/sampling.d.ts +54 -0
- package/dist/sampling.js +95 -3
- package/dist/sceneSettings.d.ts +320 -0
- package/dist/sceneSettings.js +433 -0
- package/dist/scope.d.ts +50 -7
- package/dist/scope.js +22 -3
- package/dist/scripts.d.ts +112 -22
- package/dist/scripts.js +135 -19
- package/dist/sessionDossier.d.ts +638 -0
- package/dist/sessionDossier.js +33 -0
- package/dist/sessionLayout.d.ts +492 -55
- package/dist/sessionLayout.js +697 -90
- package/dist/sessionSettings.d.ts +32 -5
- package/dist/settings.d.ts +66 -20
- package/dist/settings.js +19 -12
- package/dist/settingsSlot.d.ts +11 -8
- package/dist/settingsSlot.js +11 -8
- package/dist/shapes.d.ts +139 -37
- package/dist/shapes.js +152 -38
- package/dist/sheets.d.ts +4 -2
- package/dist/sheets.js +6 -3
- package/dist/statShapes.d.ts +10 -2
- package/dist/statShapes.js +10 -2
- package/dist/status.d.ts +27 -9
- package/dist/status.js +20 -6
- package/dist/storage.d.ts +11 -67
- package/dist/storage.js +9 -13
- package/dist/storyTime.d.ts +13 -7
- package/dist/storyTime.js +11 -6
- package/dist/strokes.d.ts +176 -0
- package/dist/strokes.js +281 -0
- package/dist/surfaces.d.ts +54 -25
- package/dist/surfaces.js +3 -3
- package/dist/template.d.ts +9 -5
- package/dist/template.js +5 -3
- package/dist/templateCheck.d.ts +2 -2
- package/dist/templateCheck.js +2 -2
- package/dist/templateFit.d.ts +37 -8
- package/dist/templateFit.js +92 -8
- package/dist/templateIds.d.ts +3 -3
- package/dist/templateIds.js +3 -3
- package/dist/templateScopeAt.d.ts +22 -12
- package/dist/templateScopeAt.js +32 -19
- package/dist/testing.d.ts +11 -4
- package/dist/testing.js +13 -5
- package/dist/ties.d.ts +210 -0
- package/dist/ties.js +300 -0
- package/dist/tokenizers.d.ts +2 -2
- package/dist/tokenizers.js +2 -2
- package/dist/turnLock.d.ts +4 -2
- package/dist/turnLock.js +2 -1
- package/dist/turnOrder.d.ts +39 -22
- package/dist/turnOrder.js +30 -13
- package/dist/validate.d.ts +11 -8
- package/dist/validate.js +195 -29
- package/dist/values.d.ts +17 -8
- package/dist/values.js +11 -6
- package/dist/variables.d.ts +46 -7
- package/dist/variables.js +87 -6
- package/dist/verdicts.d.ts +20 -13
- package/dist/verdicts.js +17 -11
- package/dist/vocabularies.d.ts +192 -0
- package/dist/vocabularies.js +326 -0
- package/dist/widgetDecls.d.ts +20 -4
- package/dist/widgetDecls.js +6 -2
- package/dist/widgets.d.ts +1580 -111
- package/dist/widgets.js +113 -18
- package/dist/wire.d.ts +13 -6
- package/dist/wire.js +3 -3
- package/dist/worldinfo.d.ts +11 -6
- package/dist/worldinfo.js +8 -4
- package/host-elements.d.ts +101 -0
- package/package.json +1 -1
package/dist/layout.d.ts
CHANGED
|
@@ -9,20 +9,23 @@
|
|
|
9
9
|
* `descriptors.ts` can name `WidgetDecl` without a cycle.
|
|
10
10
|
*
|
|
11
11
|
* The file kept its name when the retired layout document (LayoutDoc v2) and
|
|
12
|
-
* its machinery left it
|
|
13
|
-
*
|
|
12
|
+
* its machinery left it: the widget half is what stayed.
|
|
13
|
+
* @ruling PLAN-layout-one-format-2026-09-28 brief 1
|
|
14
14
|
*/
|
|
15
15
|
import type { I18n } from './i18n.js';
|
|
16
16
|
import type { SettingsSchema } from './settings.js';
|
|
17
|
-
import type { WidgetBaseSection, WidgetSectionScope } from './widgets.js';
|
|
17
|
+
import type { WidgetBaseSection, WidgetSectionScope, WidgetWriteGrant } from './widgets.js';
|
|
18
18
|
/**
|
|
19
19
|
* Data a widget requests access to (grant-gated, host-enforced at
|
|
20
20
|
* projection): a scope that delivers a scoped section โ the SDK's one table,
|
|
21
21
|
* `WidgetScopedSections` (`session:full`, `session:state`, `persona`,
|
|
22
|
-
* `characters`, `lore`) โ or a `channel:<slug
|
|
22
|
+
* `characters`, `lore`) โ or a `channel:<slug>`; or a **write grant** on one
|
|
23
|
+
* (`session:state:write`, `channel:<slug>:write`, {@link WidgetWriteGrant}),
|
|
24
|
+
* a permission apart from the read that lets a plugin's widget ask the
|
|
25
|
+
* request kinds that change it (`set-attribute-value`, `send`, `draft`).
|
|
23
26
|
* @experimental
|
|
24
27
|
*/
|
|
25
|
-
export type WidgetScope = WidgetSectionScope | `channel:${string}
|
|
28
|
+
export type WidgetScope = WidgetSectionScope | `channel:${string}` | WidgetWriteGrant;
|
|
26
29
|
/** An external plugin dependency; the CLI captures pkg/range from the imports. @experimental */
|
|
27
30
|
export interface WidgetDependency {
|
|
28
31
|
/** The depended-on plugin's stable manifest id. */
|
|
@@ -71,10 +74,11 @@ export declare function systemStyleSlug(widgetId: string, presetSlug: string): s
|
|
|
71
74
|
/**
|
|
72
75
|
* What a widget renders, resolved โ the host's switch. `remote` is a
|
|
73
76
|
* component running in its owner's UI worker, mirrored through the
|
|
74
|
-
* vocabulary
|
|
77
|
+
* vocabulary โ core's own components as much as a plugin's.
|
|
75
78
|
* A real document goes INSIDE the component, as an `sp-frame`; a widget is
|
|
76
79
|
* never a bare frame (the `surface` shortcut retired 2026-10-02).
|
|
77
80
|
* @experimental
|
|
81
|
+
* @ruling ยง3.5, R79
|
|
78
82
|
*/
|
|
79
83
|
export type WidgetSurface = {
|
|
80
84
|
kind: 'remote';
|
|
@@ -91,18 +95,22 @@ export type WidgetSurface = {
|
|
|
91
95
|
export declare function resolveWidgetSurface(decl: Pick<WidgetDecl, 'component'>, owner: string): WidgetSurface | null;
|
|
92
96
|
/**
|
|
93
97
|
* One **widget** a session offers: the conversation, a portrait column, a
|
|
94
|
-
* plugin's board. Every widget names a component
|
|
98
|
+
* plugin's board. Every widget names a component; a plugin that needs a
|
|
95
99
|
* real document places an `sp-frame` inside that component.
|
|
96
100
|
*
|
|
97
101
|
* Declaring a widget makes it *addable*. Where an instance of it sits is the
|
|
98
102
|
* **session layout**'s business (`SessionLayoutV1`): any widget may sit in any
|
|
99
103
|
* zone, as many times as the layout places it (`maxInstances` aside).
|
|
100
104
|
* @experimental
|
|
105
|
+
* @ruling R25
|
|
101
106
|
*/
|
|
102
107
|
export interface WidgetDecl {
|
|
103
108
|
/** Stable id โ a layout's widget instance ids and `surface:open` intents key on this. */
|
|
104
109
|
id: string;
|
|
105
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Human title shown in the widget's chrome and the tray โ a string or a locale map.
|
|
112
|
+
* @ruling R-20
|
|
113
|
+
*/
|
|
106
114
|
title: I18n;
|
|
107
115
|
/** Optional icon name (the app maps it to its icon set). */
|
|
108
116
|
icon?: string;
|
|
@@ -115,28 +123,34 @@ export interface WidgetDecl {
|
|
|
115
123
|
*/
|
|
116
124
|
role?: 'primary' | 'secondary';
|
|
117
125
|
/**
|
|
118
|
-
* The genres whose sessions offer it
|
|
126
|
+
* The genres whose sessions offer it, by id โ `widget()` reads
|
|
119
127
|
* genre values down to these. Absent = every genre. A genre may still
|
|
120
128
|
* withhold it (`GenreDecl.omitWidgets`).
|
|
129
|
+
* @ruling R71
|
|
121
130
|
*/
|
|
122
131
|
genres?: string[];
|
|
123
132
|
/**
|
|
124
133
|
* What renders inside: the slug of a {@link ComponentDecl} in the same
|
|
125
|
-
* package
|
|
134
|
+
* package. Core's widgets name core components. A document the
|
|
126
135
|
* widget needs goes inside that component, as an `sp-frame`.
|
|
136
|
+
* @ruling R25
|
|
127
137
|
*/
|
|
128
138
|
component: string;
|
|
129
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Which channels feed it. A widget is a view onto its channels.
|
|
141
|
+
* @ruling 20 ยง4/ยง7
|
|
142
|
+
*/
|
|
130
143
|
channels?: string[];
|
|
131
144
|
/** Data the widget requests; each entry is a grant an admin can deny. */
|
|
132
145
|
scopes?: WidgetScope[];
|
|
133
146
|
/**
|
|
134
|
-
* The BASE sections this widget reads
|
|
147
|
+
* The BASE sections this widget reads โ `messages`, `settings`, โฆ โ
|
|
135
148
|
* and so the only ones its host sends it: a widget that does not read
|
|
136
149
|
* `messages` is never handed the log again on every token. Absent means
|
|
137
|
-
* every base section, which is what a widget declared before
|
|
150
|
+
* every base section, which is what a widget declared before `reads` existed reads.
|
|
138
151
|
* A name outside `WIDGET_BASE_SECTIONS` is refused where the widget is
|
|
139
152
|
* declared. Scoped sections are not named here โ `scopes` asks for them.
|
|
153
|
+
* @ruling R75
|
|
140
154
|
*/
|
|
141
155
|
reads?: WidgetBaseSection[];
|
|
142
156
|
/** External plugin dependencies (CLI-captured into the manifest). */
|
|
@@ -173,7 +187,7 @@ export interface WidgetDecl {
|
|
|
173
187
|
* reads: the column span a widget asks for, its minimum box, whether it may
|
|
174
188
|
* collapse or close, and whether it prefers the drawer. The layout
|
|
175
189
|
* document's replacements for them (`placement`, `cells`, `fold`) retired
|
|
176
|
-
* with it (owner
|
|
190
|
+
* with it (owner ruling 2026-09-28), so these stand until the session layout
|
|
177
191
|
* states sizes of its own.
|
|
178
192
|
*/
|
|
179
193
|
layout?: {
|
|
@@ -188,7 +202,14 @@ export interface WidgetDecl {
|
|
|
188
202
|
closable?: boolean;
|
|
189
203
|
prefer?: 'grid' | 'drawer';
|
|
190
204
|
};
|
|
191
|
-
/**
|
|
205
|
+
/**
|
|
206
|
+
* โณ Read by nothing since 2026-10-10: whether a widget
|
|
207
|
+
* starts on is a LAYOUT fact โ it is on in a session exactly when that
|
|
208
|
+
* session's layout draws it, so a genre that wants it on places it in its
|
|
209
|
+
* layout (`GenreDecl.layouts`). Kept so a declaration that carries it still
|
|
210
|
+
* type-checks; it goes in 0.7.0.
|
|
211
|
+
* @ruling widget consolidation C2
|
|
212
|
+
*/
|
|
192
213
|
defaultActive?: boolean;
|
|
193
214
|
}
|
|
194
215
|
//# sourceMappingURL=layout.d.ts.map
|
package/dist/layout.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* `descriptors.ts` can name `WidgetDecl` without a cycle.
|
|
10
10
|
*
|
|
11
11
|
* The file kept its name when the retired layout document (LayoutDoc v2) and
|
|
12
|
-
* its machinery left it
|
|
13
|
-
*
|
|
12
|
+
* its machinery left it: the widget half is what stayed.
|
|
13
|
+
* @ruling PLAN-layout-one-format-2026-09-28 brief 1
|
|
14
14
|
*/
|
|
15
15
|
/**
|
|
16
16
|
* The globally-unique, reseed-stable slug for a widget's built-in style. This is
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Loadouts** โ the third model layer.
|
|
3
|
+
*
|
|
4
|
+
* A loadout says what an ENGINE is and how it is driven: the pair
|
|
5
|
+
* `(connection, model)`, a sampling config by reference, and โ when the pair's
|
|
6
|
+
* drawing sheet takes a template payload โ a workflow. It never says what a
|
|
7
|
+
* step MEANS (prompts, parameters, template, settings stay on the node).
|
|
8
|
+
*
|
|
9
|
+
* A package ships a loadout as a **declaration** โ never a pair (plugins never
|
|
10
|
+
* see connections: the pair is the one blank a person fills). At boot the instance turns it into a row
|
|
11
|
+
* with an empty pair: **unfilled**. A node names one on its oracle's `loadout`
|
|
12
|
+
* slot, and the host resolves per value:
|
|
13
|
+
*
|
|
14
|
+
* node's explicit slot โ its loadout (following merges to the root) โ
|
|
15
|
+
* if that loadout is unfilled, the transform's default loadout.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* .preset('default', { label: 'Default', default: true }, (p) =>
|
|
19
|
+
* p.loadout('summarize', slot.loadout('core:loadout/extraction@1')))
|
|
20
|
+
* ```
|
|
21
|
+
* @experimental
|
|
22
|
+
* @ruling DESIGN-image-generation ยง13 (2026-10-12)
|
|
23
|
+
*/
|
|
24
|
+
import type { TransformId } from './capabilities.js';
|
|
25
|
+
/**
|
|
26
|
+
* The grammar, one kind segment over from a template id:
|
|
27
|
+
* `core:loadout/extraction@1` ยท `acme.rp:loadout/extract@1`.
|
|
28
|
+
* A person's own loadout reads `pub:loadout/<slug>` and carries no major.
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
31
|
+
export declare const LOADOUT_ID: RegExp;
|
|
32
|
+
/**
|
|
33
|
+
* A loadout id as a type. Shipped ids carry `@N`; a pub loadout does not.
|
|
34
|
+
* @experimental
|
|
35
|
+
*/
|
|
36
|
+
export type LoadoutId = `${string}:loadout/${string}`;
|
|
37
|
+
/** `fast` ยท `cheap` ยท `best` โ a soft preference, never a gate. @experimental */
|
|
38
|
+
export type LoadoutTier = 'fast' | 'cheap' | 'best';
|
|
39
|
+
/** @experimental */
|
|
40
|
+
export declare const LOADOUT_TIERS: readonly LoadoutTier[];
|
|
41
|
+
/**
|
|
42
|
+
* The value a `loadout-ref` control holds and a `loadout` slot resolves to.
|
|
43
|
+
* @experimental
|
|
44
|
+
*/
|
|
45
|
+
export interface LoadoutRef {
|
|
46
|
+
id: LoadoutId;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A shipped loadout. **Never a pair** โ the pair is the one field a person
|
|
50
|
+
* fills. `sampling` names a seeded sampling preset by seed key (the row's id
|
|
51
|
+
* differs per install); `workflow` names a starter workflow the same way.
|
|
52
|
+
* @experimental
|
|
53
|
+
*/
|
|
54
|
+
export interface LoadoutDecl {
|
|
55
|
+
/** `<owner>:loadout/<kebab-name>@<major>`. */
|
|
56
|
+
id: string;
|
|
57
|
+
/** The title a person sees (*Extraction*). */
|
|
58
|
+
name: string;
|
|
59
|
+
/** Free prose: what is recommended and why. */
|
|
60
|
+
description: string;
|
|
61
|
+
/** The transform this loadout does โ which default an unfilled one falls back to. */
|
|
62
|
+
transform: TransformId;
|
|
63
|
+
/** A seeded sampling preset, by seed key (`sampling-extraction`). */
|
|
64
|
+
sampling?: string;
|
|
65
|
+
tier?: LoadoutTier;
|
|
66
|
+
/** A starter workflow, by seed key โ only meaningful on a `text->image` loadout. */
|
|
67
|
+
workflow?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* What a step would run best on โ the soft twin of `requires`. Grades and
|
|
71
|
+
* suggestions read it; nothing refuses on it. Everything else (schema door,
|
|
72
|
+
* native tools, vision, references) is DERIVED from wiring, so it is not here.
|
|
73
|
+
* @experimental
|
|
74
|
+
* @ruling DESIGN-image-generation ยง12 suggestion 1
|
|
75
|
+
*/
|
|
76
|
+
export interface Prefers {
|
|
77
|
+
/** A seeded sampling preset, by seed key. */
|
|
78
|
+
sampling?: string;
|
|
79
|
+
tier?: LoadoutTier;
|
|
80
|
+
}
|
|
81
|
+
/** Type guard: a well-formed loadout id. @experimental */
|
|
82
|
+
export declare function isLoadoutId(value: unknown): value is LoadoutId;
|
|
83
|
+
/** Split a loadout id, or `null` when it is not one. @experimental */
|
|
84
|
+
export declare function parseLoadoutId(value: unknown): {
|
|
85
|
+
owner: string;
|
|
86
|
+
name: string;
|
|
87
|
+
major: number | null;
|
|
88
|
+
} | null;
|
|
89
|
+
/** Is this a `loadout-ref` value? @experimental */
|
|
90
|
+
export declare function isLoadoutRef(value: unknown): value is LoadoutRef;
|
|
91
|
+
/**
|
|
92
|
+
* Why a shipped loadout declaration would be refused, one sentence each.
|
|
93
|
+
* `owner` is the declaring package (`core` for core's own set).
|
|
94
|
+
* @experimental
|
|
95
|
+
*/
|
|
96
|
+
export declare function loadoutDeclProblems(d: LoadoutDecl, owner: string): string[];
|
|
97
|
+
//# sourceMappingURL=loadouts.d.ts.map
|
package/dist/loadouts.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Loadouts** โ the third model layer.
|
|
3
|
+
*
|
|
4
|
+
* A loadout says what an ENGINE is and how it is driven: the pair
|
|
5
|
+
* `(connection, model)`, a sampling config by reference, and โ when the pair's
|
|
6
|
+
* drawing sheet takes a template payload โ a workflow. It never says what a
|
|
7
|
+
* step MEANS (prompts, parameters, template, settings stay on the node).
|
|
8
|
+
*
|
|
9
|
+
* A package ships a loadout as a **declaration** โ never a pair (plugins never
|
|
10
|
+
* see connections: the pair is the one blank a person fills). At boot the instance turns it into a row
|
|
11
|
+
* with an empty pair: **unfilled**. A node names one on its oracle's `loadout`
|
|
12
|
+
* slot, and the host resolves per value:
|
|
13
|
+
*
|
|
14
|
+
* node's explicit slot โ its loadout (following merges to the root) โ
|
|
15
|
+
* if that loadout is unfilled, the transform's default loadout.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* .preset('default', { label: 'Default', default: true }, (p) =>
|
|
19
|
+
* p.loadout('summarize', slot.loadout('core:loadout/extraction@1')))
|
|
20
|
+
* ```
|
|
21
|
+
* @experimental
|
|
22
|
+
* @ruling DESIGN-image-generation ยง13 (2026-10-12)
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The grammar, one kind segment over from a template id:
|
|
26
|
+
* `core:loadout/extraction@1` ยท `acme.rp:loadout/extract@1`.
|
|
27
|
+
* A person's own loadout reads `pub:loadout/<slug>` and carries no major.
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
|
+
export const LOADOUT_ID = /^[a-z0-9]+(?:[.-][a-z0-9]+)*:loadout\/[a-z0-9]+(?:-[a-z0-9]+)*(?:@\d+)?$/;
|
|
31
|
+
/** @experimental */
|
|
32
|
+
export const LOADOUT_TIERS = ['fast', 'cheap', 'best'];
|
|
33
|
+
/** Type guard: a well-formed loadout id. @experimental */
|
|
34
|
+
export function isLoadoutId(value) {
|
|
35
|
+
return typeof value === 'string' && LOADOUT_ID.test(value);
|
|
36
|
+
}
|
|
37
|
+
/** Split a loadout id, or `null` when it is not one. @experimental */
|
|
38
|
+
export function parseLoadoutId(value) {
|
|
39
|
+
if (!isLoadoutId(value))
|
|
40
|
+
return null;
|
|
41
|
+
const [owner, rest] = value.split(':');
|
|
42
|
+
const [name, major] = rest.slice('loadout/'.length).split('@');
|
|
43
|
+
return { owner, name, major: major === undefined ? null : Number(major) };
|
|
44
|
+
}
|
|
45
|
+
/** Is this a `loadout-ref` value? @experimental */
|
|
46
|
+
export function isLoadoutRef(value) {
|
|
47
|
+
return (typeof value === 'object' &&
|
|
48
|
+
value !== null &&
|
|
49
|
+
isLoadoutId(value.id));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Why a shipped loadout declaration would be refused, one sentence each.
|
|
53
|
+
* `owner` is the declaring package (`core` for core's own set).
|
|
54
|
+
* @experimental
|
|
55
|
+
*/
|
|
56
|
+
export function loadoutDeclProblems(d, owner) {
|
|
57
|
+
const problems = [];
|
|
58
|
+
const parts = parseLoadoutId(d.id);
|
|
59
|
+
if (!parts || parts.major === null) {
|
|
60
|
+
problems.push(`loadout id '${d.id}' is not a loadout id โ it must read ` +
|
|
61
|
+
`'${owner}:loadout/<kebab-name>@<major>' (e.g. '${owner}:loadout/extract@1').`);
|
|
62
|
+
}
|
|
63
|
+
else if (parts.owner !== owner) {
|
|
64
|
+
problems.push(parts.owner === 'core' || parts.owner === 'pub'
|
|
65
|
+
? `loadout '${d.id}' claims the '${parts.owner}' namespace, which is reserved. ` +
|
|
66
|
+
`Name it '${owner}:loadout/${parts.name}@${parts.major}'.`
|
|
67
|
+
: `loadout '${d.id}' sits under namespace '${parts.owner}', not '${owner}'.`);
|
|
68
|
+
}
|
|
69
|
+
if (typeof d.name !== 'string' || !d.name.trim())
|
|
70
|
+
problems.push(`loadout '${d.id}' has no name โ the name is the title a person picks it by.`);
|
|
71
|
+
if (typeof d.description !== 'string')
|
|
72
|
+
problems.push(`loadout '${d.id}' has no description โ say what is recommended and why.`);
|
|
73
|
+
if (typeof d.transform !== 'string' || !d.transform.includes('->'))
|
|
74
|
+
problems.push(`loadout '${d.id}' names no transform โ an unfilled loadout falls back to its transform's default.`);
|
|
75
|
+
if (d.tier !== undefined && !LOADOUT_TIERS.includes(d.tier))
|
|
76
|
+
problems.push(`loadout '${d.id}' tier '${String(d.tier)}' is not one of ${LOADOUT_TIERS.join(', ')}.`);
|
|
77
|
+
if ('connection' in d || 'model' in d)
|
|
78
|
+
problems.push(`loadout '${d.id}' carries a pair โ a shipped loadout never does; the pair is the field a person fills.`);
|
|
79
|
+
return problems;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=loadouts.js.map
|
package/dist/media.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* โ the combinatorial growth this SDK avoids everywhere else by declaring data
|
|
11
11
|
* rather than switching on it. The contracts file opens by noting that the LLM,
|
|
12
12
|
* TTS and image-gen providers are structurally identical precisely *because*
|
|
13
|
-
* nothing switches on modality
|
|
13
|
+
* nothing switches on modality; sibling media shapes would undo that.
|
|
14
14
|
*
|
|
15
15
|
* ## Why not simply "file", either
|
|
16
16
|
*
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* accept stays specific (a real check). This is the same split the app's own
|
|
25
25
|
* `files` table already makes โ a coarse `kind` derived from the mime and
|
|
26
26
|
* stored, so "every document" is an index scan rather than a string parse.
|
|
27
|
+
* @ruling 17 ยง1
|
|
27
28
|
*/
|
|
28
29
|
/**
|
|
29
30
|
* The coarse classification, matching the app's `files.kind` exactly so a blob
|
|
@@ -35,10 +36,28 @@
|
|
|
35
36
|
* @experimental
|
|
36
37
|
*/
|
|
37
38
|
export declare const MEDIA_KINDS: readonly ['image', 'audio', 'video', 'document'];
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
/**
|
|
40
|
+
* ๐ง A media kind core knows by name โ one of `MEDIA_KINDS`, the KNOWN list.
|
|
41
|
+
* @experimental
|
|
42
|
+
* @ruling O1, LS4, R41
|
|
43
|
+
*/
|
|
44
|
+
export type KnownMediaKind = (typeof MEDIA_KINDS)[number];
|
|
45
|
+
/**
|
|
46
|
+
* A media kind: one core knows (`MEDIA_KINDS`), or any other a plugin or a
|
|
47
|
+
* later release introduces (O1, LS4 โ owner, 2026-10-20: "nothing in 1.0 may
|
|
48
|
+
* assume the list of media kinds is closed"). Autocomplete still offers the
|
|
49
|
+
* known ones; an unknown kind passes through every SDK table untouched, and
|
|
50
|
+
* a table keyed by kind falls back where it has no row for one.
|
|
51
|
+
* @experimental
|
|
52
|
+
* @ruling O1, LS4, R41
|
|
53
|
+
*/
|
|
54
|
+
export type MediaKind = KnownMediaKind | (string & {});
|
|
55
|
+
/**
|
|
56
|
+
* Is this a media kind core KNOWS โ one of `MEDIA_KINDS`? Still "known", not
|
|
57
|
+
* "well-formed": an unknown kind is a valid `MediaKind` and answers false here.
|
|
58
|
+
* @experimental
|
|
59
|
+
*/
|
|
60
|
+
export declare const isMediaKind: (v: unknown) => v is KnownMediaKind;
|
|
42
61
|
/**
|
|
43
62
|
* A reference to stored media, as it travels on a port.
|
|
44
63
|
*
|
|
@@ -83,7 +102,26 @@ export interface MediaRef {
|
|
|
83
102
|
text?: string;
|
|
84
103
|
}
|
|
85
104
|
/**
|
|
86
|
-
* ๐ง One
|
|
105
|
+
* ๐ง One picture an image step is asked for โ an entry of
|
|
106
|
+
* `core:shape/image-series@1`, the `series` in-port of
|
|
107
|
+
* `core:oracle/generate-image@1`.
|
|
108
|
+
*
|
|
109
|
+
* `key` names the picture on the way out: every media item the step returns
|
|
110
|
+
* for this entry carries it, so a consumer (a sprite set's label, a
|
|
111
|
+
* candidate's slot) never has to guess which picture is which from its
|
|
112
|
+
* order or its pixels. Keys are sanitised by the host before rendering
|
|
113
|
+
* (trimmed, case-folded, spaces to `-`, collisions suffixed). `vars` are in
|
|
114
|
+
* scope when the prompt rows render for this entry โ the phrase a template
|
|
115
|
+
* reads comes from here, never from the key.
|
|
116
|
+
* @experimental
|
|
117
|
+
* @ruling DESIGN-image-generation ยง4.7, ยง4.11
|
|
118
|
+
*/
|
|
119
|
+
export interface ImageSeriesItemV1 {
|
|
120
|
+
key: string;
|
|
121
|
+
vars?: Record<string, unknown>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* ๐ง One file attached to one history message
|
|
87
125
|
* โ an entry of `core:shape/media-by-message@1`, which
|
|
88
126
|
* `core:query/history-attachments@1` publishes keyed by message id.
|
|
89
127
|
*
|
|
@@ -93,37 +131,116 @@ export interface MediaRef {
|
|
|
93
131
|
* a text file, its **body**, because a text file reaches every model as text
|
|
94
132
|
* and a pure placement step cannot read a disk.
|
|
95
133
|
* @experimental
|
|
134
|
+
* @ruling PLAN-composer-attachments ยง3.5
|
|
96
135
|
*/
|
|
97
136
|
export interface HistoryAttachmentV1 extends MediaRef {
|
|
98
|
-
/** `image` / `text` / `pdf`, decided from the stored
|
|
99
|
-
* other file, which every call is shown as a name.
|
|
100
|
-
|
|
137
|
+
/** `image` / `text` / `pdf` / `audio` / `video`, decided from the stored
|
|
138
|
+
* mime; `null` for any other file, which every call is shown as a name.
|
|
139
|
+
* `audio` and `video` since O2/O4 (2026-10-21). */
|
|
140
|
+
attachmentKind: 'image' | 'text' | 'pdf' | 'audio' | 'video' | null;
|
|
141
|
+
/**
|
|
142
|
+
* ๐ง What an audio (or video) file says, when a transcription step has
|
|
143
|
+
* heard it โ cached on the file, so it is heard once (O9). Placement
|
|
144
|
+
* writes it into the name a call that cannot hear the file is shown:
|
|
145
|
+
* `[audio: note.mp3 โ "โฆ"]`. `text` carries the same words when the
|
|
146
|
+
* person gave no description of their own.
|
|
147
|
+
* @ruling O9
|
|
148
|
+
*/
|
|
149
|
+
transcript?: string;
|
|
101
150
|
/** A text file's body, read up to the query's cap. Absent for other files. */
|
|
102
151
|
body?: string;
|
|
103
152
|
/** True when `body` stopped at the query's cap rather than at the file's end. */
|
|
104
153
|
bodyTruncated?: boolean;
|
|
105
154
|
}
|
|
106
155
|
/**
|
|
107
|
-
* ๐ง What the pair behind a connection slot reads
|
|
108
|
-
*
|
|
156
|
+
* ๐ง What the pair behind a connection slot reads โ
|
|
157
|
+
* `metadata.reads` on a resolved connection descriptor, computed by the
|
|
109
158
|
* host's ONE reading predicate (the same answer the composer's readers line
|
|
110
159
|
* shows). A placement step reads it the way `assemble` reads
|
|
111
160
|
* `metadata.promptFormat`, so it stays pure.
|
|
112
161
|
* @experimental
|
|
162
|
+
* @ruling PLAN-composer-attachments ยง5.2
|
|
113
163
|
*/
|
|
114
164
|
export interface ConnectionReadsV1 {
|
|
115
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* ๐ง What the pair reads, **by media kind** (O2, evolved in place
|
|
167
|
+
* 2026-10-20): for each kind the host has an answer for, whether the pair
|
|
168
|
+
* sends it to its model on its wire mode, why not (a sentence that names
|
|
169
|
+
* no connection), and what one placed item is estimated to cost. A kind
|
|
170
|
+
* with no row is not read โ `connectionReadsKind` answers that for you.
|
|
171
|
+
* Open by kind (O1): audio, video, and kinds a later release brings.
|
|
172
|
+
* @ruling O2, O1, O10
|
|
173
|
+
*/
|
|
174
|
+
kinds: Partial<Record<MediaKind, ConnectionKindReadV1>>;
|
|
175
|
+
/**
|
|
176
|
+
* The pair sends images to its model on its wire mode.
|
|
177
|
+
* @deprecated โณ Read `kinds.image.reads` (O2). Kept readable for one release; hosts still write it.
|
|
178
|
+
*/
|
|
116
179
|
image: boolean;
|
|
117
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* The pair sends PDFs to its model on its wire mode.
|
|
182
|
+
* @deprecated โณ Read `kinds.document.reads` (O2). Kept readable for one release; hosts still write it.
|
|
183
|
+
*/
|
|
118
184
|
pdf: boolean;
|
|
119
|
-
/**
|
|
185
|
+
/**
|
|
186
|
+
* Why not, per kind โ a sentence that names no connection.
|
|
187
|
+
* @deprecated โณ Read `kinds.<kind>.why` (O2). Kept readable for one release.
|
|
188
|
+
*/
|
|
120
189
|
why?: {
|
|
121
190
|
image?: string;
|
|
122
191
|
pdf?: string;
|
|
123
192
|
};
|
|
124
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Estimated prompt tokens one placed image costs. An estimate, never a cap.
|
|
195
|
+
* @deprecated โณ Read `kinds.image.cost.perItem` (O2, O10). Kept readable for one release.
|
|
196
|
+
*/
|
|
125
197
|
tokensPerImage?: number;
|
|
126
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* ๐ง What a pair reads of one media kind โ a row of `ConnectionReadsV1.kinds`.
|
|
201
|
+
* @experimental
|
|
202
|
+
* @ruling O2, O10
|
|
203
|
+
*/
|
|
204
|
+
export interface ConnectionKindReadV1 {
|
|
205
|
+
/** The pair sends this kind to its model on its wire mode. */
|
|
206
|
+
reads: boolean;
|
|
207
|
+
/** Why not โ a sentence that names no connection. Absent when it reads. */
|
|
208
|
+
why?: string;
|
|
209
|
+
/**
|
|
210
|
+
* Estimated prompt tokens one placed item costs: `perItem` for a picture
|
|
211
|
+
* or a page, `perSecond` for audio or video. An estimate, never a cap.
|
|
212
|
+
*/
|
|
213
|
+
cost?: {
|
|
214
|
+
perItem?: number;
|
|
215
|
+
perSecond?: number;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* ๐ง The pair also takes this kind back on the MODEL's own turns โ a
|
|
219
|
+
* spoken reply sent back as audio rather than as its transcript (O13).
|
|
220
|
+
* Absent: only on a person's turns, and a model's earlier audio goes
|
|
221
|
+
* back as the words it said.
|
|
222
|
+
* @ruling O13
|
|
223
|
+
*/
|
|
224
|
+
assistantTurns?: boolean;
|
|
225
|
+
/**
|
|
226
|
+
* ๐ง The formats the pair takes of this kind, when it names them and
|
|
227
|
+
* nothing converts to them โ audio and video today (O4). A file of
|
|
228
|
+
* another format is not sent: placement names it, and a transcribe step
|
|
229
|
+
* hears it instead. Absent: every format of a read kind is sent.
|
|
230
|
+
* @ruling O4
|
|
231
|
+
*/
|
|
232
|
+
accepts?: string[];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* ๐ง The one reading of `ConnectionReadsV1` per kind (O2): the `kinds` row
|
|
236
|
+
* when there is one; else, for a value written before `kinds` existed, the
|
|
237
|
+
* deprecated `image` / `pdf` booleans (a PDF is the `document` kind); else
|
|
238
|
+
* not read. Placement, the composer line and fit ask this โ never the
|
|
239
|
+
* fields directly โ so the deprecated ones can leave without a hunt.
|
|
240
|
+
* @experimental
|
|
241
|
+
* @ruling O2
|
|
242
|
+
*/
|
|
243
|
+
export declare function connectionReadsKind(reads: Partial<ConnectionReadsV1> | null | undefined, kind: MediaKind): ConnectionKindReadV1;
|
|
127
244
|
/**
|
|
128
245
|
* What a node, provider or connection will handle.
|
|
129
246
|
*
|
|
@@ -137,7 +254,7 @@ export interface ConnectionReadsV1 {
|
|
|
137
254
|
export interface MediaCapability {
|
|
138
255
|
/** Kinds this can take as input. Absent or empty: text only. */
|
|
139
256
|
accepts?: readonly MediaKind[];
|
|
140
|
-
/** Kinds this can produce. Absent or empty: text only. */
|
|
257
|
+
/** Kinds this can produce. Absent or empty: text only. Open by kind (O1). */
|
|
141
258
|
emits?: readonly MediaKind[];
|
|
142
259
|
/** Mime allow-list, when a kind is too coarse โ e.g. a model that reads
|
|
143
260
|
* `image/png` and `image/jpeg` but not `image/gif`. Absent means every
|
|
@@ -199,4 +316,24 @@ export type OutputPart = {
|
|
|
199
316
|
export declare function partsToText(parts: readonly OutputPart[]): string;
|
|
200
317
|
/** Every media reference in a part list, in order. @experimental */
|
|
201
318
|
export declare function partsToMedia(parts: readonly OutputPart[]): MediaRef[];
|
|
319
|
+
/**
|
|
320
|
+
* ๐ง The message part types that show one stored file, by media kind (O5):
|
|
321
|
+
* a picture is `core:image`, a sound `core:audio`, a moving picture
|
|
322
|
+
* `core:video`, and every other kind โ a PDF, a text file, a kind a later
|
|
323
|
+
* release brings โ `core:file`. Every part carries `data.assetId`.
|
|
324
|
+
* @experimental
|
|
325
|
+
* @ruling O5
|
|
326
|
+
*/
|
|
327
|
+
export declare const MEDIA_PART_TYPES: readonly ['core:image', 'core:audio', 'core:video', 'core:file'];
|
|
328
|
+
/** @experimental */
|
|
329
|
+
export type MediaPartType = (typeof MEDIA_PART_TYPES)[number];
|
|
330
|
+
/**
|
|
331
|
+
* ๐ง The part type a file of this kind is shown with โ unknown kinds are
|
|
332
|
+
* `core:file` (O1: a kind passes through, it is never refused here).
|
|
333
|
+
* @experimental
|
|
334
|
+
* @ruling O5
|
|
335
|
+
*/
|
|
336
|
+
export declare function mediaPartTypeFor(kind: MediaKind | null | undefined): MediaPartType;
|
|
337
|
+
/** ๐ง Is this a part type that shows one stored file? @experimental */
|
|
338
|
+
export declare const isMediaPartType: (type: unknown) => type is MediaPartType;
|
|
202
339
|
//# sourceMappingURL=media.d.ts.map
|
package/dist/media.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* โ the combinatorial growth this SDK avoids everywhere else by declaring data
|
|
11
11
|
* rather than switching on it. The contracts file opens by noting that the LLM,
|
|
12
12
|
* TTS and image-gen providers are structurally identical precisely *because*
|
|
13
|
-
* nothing switches on modality
|
|
13
|
+
* nothing switches on modality; sibling media shapes would undo that.
|
|
14
14
|
*
|
|
15
15
|
* ## Why not simply "file", either
|
|
16
16
|
*
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* accept stays specific (a real check). This is the same split the app's own
|
|
25
25
|
* `files` table already makes โ a coarse `kind` derived from the mime and
|
|
26
26
|
* stored, so "every document" is an index scan rather than a string parse.
|
|
27
|
+
* @ruling 17 ยง1
|
|
27
28
|
*/
|
|
28
29
|
/**
|
|
29
30
|
* The coarse classification, matching the app's `files.kind` exactly so a blob
|
|
@@ -35,8 +36,32 @@
|
|
|
35
36
|
* @experimental
|
|
36
37
|
*/
|
|
37
38
|
export const MEDIA_KINDS = ['image', 'audio', 'video', 'document'];
|
|
38
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Is this a media kind core KNOWS โ one of `MEDIA_KINDS`? Still "known", not
|
|
41
|
+
* "well-formed": an unknown kind is a valid `MediaKind` and answers false here.
|
|
42
|
+
* @experimental
|
|
43
|
+
*/
|
|
39
44
|
export const isMediaKind = (v) => typeof v === 'string' && MEDIA_KINDS.includes(v);
|
|
45
|
+
/**
|
|
46
|
+
* ๐ง The one reading of `ConnectionReadsV1` per kind (O2): the `kinds` row
|
|
47
|
+
* when there is one; else, for a value written before `kinds` existed, the
|
|
48
|
+
* deprecated `image` / `pdf` booleans (a PDF is the `document` kind); else
|
|
49
|
+
* not read. Placement, the composer line and fit ask this โ never the
|
|
50
|
+
* fields directly โ so the deprecated ones can leave without a hunt.
|
|
51
|
+
* @experimental
|
|
52
|
+
* @ruling O2
|
|
53
|
+
*/
|
|
54
|
+
export function connectionReadsKind(reads, kind) {
|
|
55
|
+
const row = reads?.kinds?.[kind];
|
|
56
|
+
if (row)
|
|
57
|
+
return row;
|
|
58
|
+
const legacy = kind === 'image' ? reads?.image : kind === 'document' ? reads?.pdf : undefined;
|
|
59
|
+
if (legacy === undefined)
|
|
60
|
+
return { reads: false };
|
|
61
|
+
const why = kind === 'image' ? reads?.why?.image : reads?.why?.pdf;
|
|
62
|
+
const cost = kind === 'image' && reads?.tokensPerImage !== undefined ? { cost: { perItem: reads.tokensPerImage } } : {};
|
|
63
|
+
return { reads: legacy === true, ...(why && legacy !== true ? { why } : {}), ...cost };
|
|
64
|
+
}
|
|
40
65
|
/** Does `cap` accept this reference? The check a picker and a wire adapter
|
|
41
66
|
* both need, written once so they cannot disagree.
|
|
42
67
|
* @experimental
|
|
@@ -67,4 +92,24 @@ export function partsToMedia(parts) {
|
|
|
67
92
|
.filter((p) => p.t === 'media')
|
|
68
93
|
.map((p) => p.ref);
|
|
69
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* ๐ง The message part types that show one stored file, by media kind (O5):
|
|
97
|
+
* a picture is `core:image`, a sound `core:audio`, a moving picture
|
|
98
|
+
* `core:video`, and every other kind โ a PDF, a text file, a kind a later
|
|
99
|
+
* release brings โ `core:file`. Every part carries `data.assetId`.
|
|
100
|
+
* @experimental
|
|
101
|
+
* @ruling O5
|
|
102
|
+
*/
|
|
103
|
+
export const MEDIA_PART_TYPES = ['core:image', 'core:audio', 'core:video', 'core:file'];
|
|
104
|
+
/**
|
|
105
|
+
* ๐ง The part type a file of this kind is shown with โ unknown kinds are
|
|
106
|
+
* `core:file` (O1: a kind passes through, it is never refused here).
|
|
107
|
+
* @experimental
|
|
108
|
+
* @ruling O5
|
|
109
|
+
*/
|
|
110
|
+
export function mediaPartTypeFor(kind) {
|
|
111
|
+
return kind === 'image' ? 'core:image' : kind === 'audio' ? 'core:audio' : kind === 'video' ? 'core:video' : 'core:file';
|
|
112
|
+
}
|
|
113
|
+
/** ๐ง Is this a part type that shows one stored file? @experimental */
|
|
114
|
+
export const isMediaPartType = (type) => typeof type === 'string' && MEDIA_PART_TYPES.includes(type);
|
|
70
115
|
//# sourceMappingURL=media.js.map
|