@pixerate/editor 0.80.0 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -3
- package/dist/agent/index.cjs +102 -6
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +4 -2
- package/dist/agent/index.d.ts +4 -2
- package/dist/agent/index.js +101 -5
- package/dist/agent/index.js.map +1 -1
- package/dist/{builtins-BKYlHH1s.d.ts → builtins-CV1fDj64.d.ts} +5 -1
- package/dist/{builtins-1kqwLUnb.d.cts → builtins-c4w0eAYl.d.cts} +5 -1
- package/dist/{chunk-2CJ3LPYQ.js → chunk-424H3P4I.js} +13 -295
- package/dist/chunk-424H3P4I.js.map +1 -0
- package/dist/{chunk-UN33YOXW.cjs → chunk-PA5S7KPC.cjs} +293 -2
- package/dist/chunk-PA5S7KPC.cjs.map +1 -0
- package/dist/{chunk-IB3ZHQAX.js → chunk-PTYWCFFW.js} +29 -4
- package/dist/chunk-PTYWCFFW.js.map +1 -0
- package/dist/{chunk-JQ3BB3E6.js → chunk-PXDEFEG2.js} +293 -2
- package/dist/chunk-PXDEFEG2.js.map +1 -0
- package/dist/{chunk-YU4WQE5M.cjs → chunk-TAPXWP2B.cjs} +95 -377
- package/dist/chunk-TAPXWP2B.cjs.map +1 -0
- package/dist/{chunk-HXDMZQTD.cjs → chunk-TPOT575P.cjs} +29 -4
- package/dist/{chunk-IB3ZHQAX.js.map → chunk-TPOT575P.cjs.map} +1 -1
- package/dist/commands/index.cjs +2 -2
- package/dist/commands/index.d.cts +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/generation/index.cjs +932 -791
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +266 -240
- package/dist/generation/index.d.ts +266 -240
- package/dist/generation/index.js +926 -785
- package/dist/generation/index.js.map +1 -1
- package/dist/image-editor/index.cjs +266 -2
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +12 -1
- package/dist/image-editor/index.d.ts +12 -1
- package/dist/image-editor/index.js +265 -1
- package/dist/image-editor/index.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -16
- package/dist/spreadsheet/index.cjs +3 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.js +16 -16
- package/package.json +2 -1
- package/skills/README.md +55 -0
- package/skills/pixerate-agent-tools/SKILL.md +75 -0
- package/skills/pixerate-animation-editor/SKILL.md +155 -0
- package/skills/pixerate-animation-editor/references/commands.md +123 -0
- package/skills/pixerate-canvas/SKILL.md +230 -0
- package/skills/pixerate-chart/SKILL.md +190 -0
- package/skills/pixerate-diagram/SKILL.md +134 -0
- package/skills/pixerate-generation/SKILL.md +109 -0
- package/skills/pixerate-image-editor/SKILL.md +139 -0
- package/skills/pixerate-parameters/SKILL.md +83 -0
- package/skills/pixerate-rich-text/SKILL.md +160 -0
- package/skills/pixerate-spreadsheet/SKILL.md +146 -0
- package/skills/pixerate-vector/SKILL.md +191 -0
- package/skills/pixerate-vector/references/commands.md +138 -0
- package/skills/pixerate-video-editor/SKILL.md +173 -0
- package/dist/chunk-2CJ3LPYQ.js.map +0 -1
- package/dist/chunk-HXDMZQTD.cjs.map +0 -1
- package/dist/chunk-JQ3BB3E6.js.map +0 -1
- package/dist/chunk-UN33YOXW.cjs.map +0 -1
- package/dist/chunk-YU4WQE5M.cjs.map +0 -1
|
@@ -2,9 +2,9 @@ import { J as JsonSchema } from '../schema-Di0CS6Pe.js';
|
|
|
2
2
|
export { S as SchemaValidationError, v as validateJsonSchema } from '../schema-Di0CS6Pe.js';
|
|
3
3
|
import { A as AgentToolProvider } from '../registry-7AZFuand.js';
|
|
4
4
|
export { b as AgentTool, M as McpToolDefinition, a as McpToolResult } from '../registry-7AZFuand.js';
|
|
5
|
-
import { S as SourceMapSegment } from '../sourcemap-DA1Evhrv.js';
|
|
6
5
|
import { T as Template, P as PromptValues } from '../tokens-D7yXvUU6.js';
|
|
7
6
|
import { S as StorageAdapter } from '../storage-BpFfspHm.js';
|
|
7
|
+
import { S as SourceMapSegment } from '../sourcemap-DA1Evhrv.js';
|
|
8
8
|
export { a as MentionRoleSyntax, T as TextMention, f as findTextMentions, b as formatMentionText, s as setMentionRoleInText } from '../mention-text-CDnCFd3c.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -399,244 +399,6 @@ interface GenerationToolProvider extends AgentToolProvider {
|
|
|
399
399
|
*/
|
|
400
400
|
declare function createGenerationToolProvider(options: GenerationToolProviderOptions): GenerationToolProvider;
|
|
401
401
|
|
|
402
|
-
declare const PROVENANCE_FORMAT = "pixerate.generation-provenance";
|
|
403
|
-
declare const PROVENANCE_VERSION = 1;
|
|
404
|
-
/** The exact template body a generation used. */
|
|
405
|
-
interface PinnedTemplate {
|
|
406
|
-
name: string;
|
|
407
|
-
templateId?: string;
|
|
408
|
-
/** Version id or version label the body came from (absent for unversioned templates). */
|
|
409
|
-
versionId?: string;
|
|
410
|
-
version?: string | number;
|
|
411
|
-
body: string;
|
|
412
|
-
}
|
|
413
|
-
/** Everything needed to explain and reproduce one generation. */
|
|
414
|
-
interface GenerationProvenance {
|
|
415
|
-
format: typeof PROVENANCE_FORMAT;
|
|
416
|
-
version: typeof PROVENANCE_VERSION;
|
|
417
|
-
/** Raw prompt as typed, with `{{templates}}` and `{variables}`. */
|
|
418
|
-
rawPrompt: string;
|
|
419
|
-
/** Every template the prompt reached (recursively), pinned to the body used. */
|
|
420
|
-
templates: PinnedTemplate[];
|
|
421
|
-
/** Version bindings in effect (`{ templateName: versionId }`) for every pinned versioned template. */
|
|
422
|
-
bindings: Record<string, string>;
|
|
423
|
-
/** Variable values, or `null` when variables were left unresolved. */
|
|
424
|
-
values: PromptValues | null;
|
|
425
|
-
resolvedPrompt: string;
|
|
426
|
-
sourceMap: SourceMapSegment[];
|
|
427
|
-
modelId: string;
|
|
428
|
-
/** The planned (adjusted) request that was sent. */
|
|
429
|
-
request: GenerationRequest;
|
|
430
|
-
adjustments: PlanAdjustment[];
|
|
431
|
-
references: {
|
|
432
|
-
id: string;
|
|
433
|
-
role: ReferenceRole;
|
|
434
|
-
}[];
|
|
435
|
-
/** ISO timestamps. */
|
|
436
|
-
createdAt: string;
|
|
437
|
-
startedAt?: string;
|
|
438
|
-
completedAt?: string;
|
|
439
|
-
/** Ids of the outputs this generation produced. */
|
|
440
|
-
outputIds?: string[];
|
|
441
|
-
meta?: Record<string, unknown>;
|
|
442
|
-
}
|
|
443
|
-
interface CreateProvenanceOptions {
|
|
444
|
-
rawPrompt: string;
|
|
445
|
-
templates?: Template[];
|
|
446
|
-
/** Template version bindings (`{ templateName: versionIdOrVersion }`). */
|
|
447
|
-
bindings?: Record<string, string>;
|
|
448
|
-
values?: PromptValues;
|
|
449
|
-
model: string | ModelCapabilities;
|
|
450
|
-
/** The plan the request came from (its request and adjustments are recorded) … */
|
|
451
|
-
plan?: GenerationPlan;
|
|
452
|
-
/** … or the request that was sent. */
|
|
453
|
-
request?: GenerationRequest;
|
|
454
|
-
adjustments?: PlanAdjustment[];
|
|
455
|
-
/** Creation time (default `Date.now()`). */
|
|
456
|
-
createdAt?: Date | number | string;
|
|
457
|
-
startedAt?: Date | number | string;
|
|
458
|
-
completedAt?: Date | number | string;
|
|
459
|
-
outputIds?: string[];
|
|
460
|
-
meta?: Record<string, unknown>;
|
|
461
|
-
maxDepth?: number;
|
|
462
|
-
}
|
|
463
|
-
declare class ProvenanceParseError extends Error {
|
|
464
|
-
constructor(message: string);
|
|
465
|
-
}
|
|
466
|
-
/** Templates that reproduce the pinned bodies exactly (one single-version template each). */
|
|
467
|
-
declare function pinnedTemplatesToTemplates(pinned: readonly PinnedTemplate[]): Template[];
|
|
468
|
-
/**
|
|
469
|
-
* Records what produced an output: the raw prompt, the exact template bodies
|
|
470
|
-
* and versions it reached, variable values, the resolved prompt and its
|
|
471
|
-
* source map, the model, the planned settings and adjustments, and the
|
|
472
|
-
* references by role.
|
|
473
|
-
*/
|
|
474
|
-
declare function createProvenance(options: CreateProvenanceOptions): GenerationProvenance;
|
|
475
|
-
/** Versioned JSON for storage next to an output. */
|
|
476
|
-
declare function serializeProvenance(provenance: GenerationProvenance): string;
|
|
477
|
-
/** Parses and checks serialized provenance. Throws {@link ProvenanceParseError}. */
|
|
478
|
-
declare function parseProvenance(input: string | unknown): GenerationProvenance;
|
|
479
|
-
/**
|
|
480
|
-
* Re-resolves the raw prompt against the pinned template bodies and values,
|
|
481
|
-
* e.g. to check a record or to open it in an editor with its source map.
|
|
482
|
-
*/
|
|
483
|
-
declare function replayProvenancePrompt(provenance: GenerationProvenance): {
|
|
484
|
-
text: string;
|
|
485
|
-
map: SourceMapSegment[];
|
|
486
|
-
matches: boolean;
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
interface BatchResolverOptions<K, V> {
|
|
490
|
-
/** Loads many keys at once. Keys missing from the map resolve to `undefined`. */
|
|
491
|
-
fetch: (keys: K[]) => Promise<Map<K, V>>;
|
|
492
|
-
/** Largest batch passed to `fetch` (default 50). */
|
|
493
|
-
maxBatch?: number;
|
|
494
|
-
/** How long to collect keys before fetching, in ms (default 0: the same tick). */
|
|
495
|
-
delayMs?: number;
|
|
496
|
-
/** Called once per failed batch. The batch's keys are recorded as resolved-empty. */
|
|
497
|
-
onError?: (error: unknown, keys: K[]) => void;
|
|
498
|
-
}
|
|
499
|
-
interface BatchResolver<K, V> {
|
|
500
|
-
/** Resolves one key, batched with other loads in the same window. Never rejects. */
|
|
501
|
-
load(key: K): Promise<V | undefined>;
|
|
502
|
-
loadMany(keys: readonly K[]): Promise<(V | undefined)[]>;
|
|
503
|
-
/** The settled value for a key, if it has been resolved. */
|
|
504
|
-
peek(key: K): V | undefined;
|
|
505
|
-
/** Whether a key has settled (found, missing or failed). */
|
|
506
|
-
has(key: K): boolean;
|
|
507
|
-
/** Whether a key's last fetch failed. */
|
|
508
|
-
failed(key: K): boolean;
|
|
509
|
-
/** Seeds a value without fetching. */
|
|
510
|
-
prime(key: K, value: V): void;
|
|
511
|
-
/** Forgets one key (or all) so the next `load` fetches again. */
|
|
512
|
-
clear(key?: K): void;
|
|
513
|
-
/** Fetches anything still waiting now, without waiting for `delayMs`. */
|
|
514
|
-
flush(): void;
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Coalesces lookups (e.g. asset ids → thumbnails, template ids → bodies) into
|
|
518
|
-
* batched `fetch` calls: keys requested within `delayMs` share a batch of at
|
|
519
|
-
* most `maxBatch`, duplicate keys are fetched once, and results are cached.
|
|
520
|
-
* A failed batch resolves its keys to `undefined` and records them as
|
|
521
|
-
* resolved-empty (`failed(key)` is `true`) so one bad response does not cause
|
|
522
|
-
* a retry storm; `clear(key)` allows a retry.
|
|
523
|
-
*/
|
|
524
|
-
declare function createBatchResolver<K, V>(options: BatchResolverOptions<K, V>): BatchResolver<K, V>;
|
|
525
|
-
|
|
526
|
-
interface JobProgressInput {
|
|
527
|
-
/** Start time (ms since epoch, `Date` or ISO string). */
|
|
528
|
-
startedAt: number | Date | string;
|
|
529
|
-
/** Current time (default `Date.now()`). */
|
|
530
|
-
now?: number | Date | string;
|
|
531
|
-
/** Expected total duration in ms. Without it progress eases towards 95%. */
|
|
532
|
-
expectedMs?: number;
|
|
533
|
-
/** The job finished. */
|
|
534
|
-
done?: boolean;
|
|
535
|
-
}
|
|
536
|
-
interface JobProgressEstimate {
|
|
537
|
-
/** 0–100. Never above 95 until `done`. */
|
|
538
|
-
percent: number;
|
|
539
|
-
/** E.g. `~2m left`, `~40s left`, `Almost done…`, `Starting…`, `Done`. */
|
|
540
|
-
label: string;
|
|
541
|
-
elapsedMs: number;
|
|
542
|
-
/** Estimated ms left (`undefined` without `expectedMs`). */
|
|
543
|
-
remainingMs?: number;
|
|
544
|
-
/** Running longer than expected. */
|
|
545
|
-
overdue: boolean;
|
|
546
|
-
}
|
|
547
|
-
/** Highest percentage shown before a job reports completion. */
|
|
548
|
-
declare const MAX_PENDING_PERCENT = 95;
|
|
549
|
-
/** `~45s left`, `~2m left`, `~1h 5m left`. Minutes and seconds round up. */
|
|
550
|
-
declare function formatRemaining(ms: number): string;
|
|
551
|
-
/**
|
|
552
|
-
* Progress for a job that reports no progress of its own: linear in elapsed
|
|
553
|
-
* time over `expectedMs`, held at 95% until `done` (so the bar never sits at
|
|
554
|
-
* 100% while still waiting), with a "~2m left" style label that turns into
|
|
555
|
-
* "Almost done…" near or past the expected end. Pure: pass `now` to test.
|
|
556
|
-
*/
|
|
557
|
-
declare function estimateJobProgress(input: JobProgressInput): JobProgressEstimate;
|
|
558
|
-
/**
|
|
559
|
-
* Expected duration of a request from the model's `timing`: `baseMs`, plus
|
|
560
|
-
* `perItemMs` per output beyond the first, `perSecondMs` per second of
|
|
561
|
-
* duration and `perMegapixelMs` per megapixel of resolution. `undefined` when
|
|
562
|
-
* the model has no timing.
|
|
563
|
-
*/
|
|
564
|
-
declare function expectedDurationFor(caps: ModelCapabilities, request?: GenerationRequest): number | undefined;
|
|
565
|
-
|
|
566
|
-
interface GenerationControlOption {
|
|
567
|
-
value: string | number;
|
|
568
|
-
label: string;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* A UI control derived from capabilities. `key` is a request path:
|
|
572
|
-
* `aspectRatio`, `count`, `params.guidance`, …
|
|
573
|
-
*/
|
|
574
|
-
interface GenerationControl {
|
|
575
|
-
key: string;
|
|
576
|
-
label: string;
|
|
577
|
-
/** `select` for choices, `range` for bounded numbers, `number` for open numbers. */
|
|
578
|
-
kind: 'select' | 'range' | 'number' | 'textarea' | 'checkbox';
|
|
579
|
-
valueType: 'string' | 'number' | 'boolean';
|
|
580
|
-
options?: GenerationControlOption[];
|
|
581
|
-
min?: number;
|
|
582
|
-
max?: number;
|
|
583
|
-
step?: number;
|
|
584
|
-
maxLength?: number;
|
|
585
|
-
defaultValue?: string | number | boolean;
|
|
586
|
-
description?: string;
|
|
587
|
-
}
|
|
588
|
-
interface ReferenceSlot {
|
|
589
|
-
role: ReferenceRole;
|
|
590
|
-
label: string;
|
|
591
|
-
description?: string;
|
|
592
|
-
min: number;
|
|
593
|
-
max: number;
|
|
594
|
-
/** Media accepted for this role (see `ReferenceRoleCapability.accepts`). */
|
|
595
|
-
accepts?: string[];
|
|
596
|
-
references: GenerationReference[];
|
|
597
|
-
/** More references of this role fit (per role and in total). */
|
|
598
|
-
canAdd: boolean;
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* The settings controls a model supports, in display order. Excludes the
|
|
602
|
-
* prompt (edited by the prompt editor) and references (see
|
|
603
|
-
* {@link getReferenceSlots}).
|
|
604
|
-
*/
|
|
605
|
-
declare function getGenerationControls(caps: ModelCapabilities): GenerationControl[];
|
|
606
|
-
/** Reads a request value by control key (`params.x` reads a param). */
|
|
607
|
-
declare function getRequestValue(request: GenerationRequest, key: string): unknown;
|
|
608
|
-
/** Returns a copy of `request` with `key` set (`undefined` or `''` removes it). */
|
|
609
|
-
declare function setRequestValue(request: GenerationRequest, key: string, value: unknown): GenerationRequest;
|
|
610
|
-
/** Parses a DOM control's string value into the control's value type. */
|
|
611
|
-
declare function parseControlValue(control: GenerationControl, raw: string | boolean): string | number | boolean | undefined;
|
|
612
|
-
/** Reference slots for every role the model accepts, filled from `request`. */
|
|
613
|
-
declare function getReferenceSlots(caps: ModelCapabilities, request?: GenerationRequest): ReferenceSlot[];
|
|
614
|
-
/** Returns a copy of `request` with a reference appended. */
|
|
615
|
-
declare function addReference(request: GenerationRequest, reference: GenerationReference): GenerationRequest;
|
|
616
|
-
/** Returns a copy of `request` without the reference `id` in `role`. */
|
|
617
|
-
declare function removeReference(request: GenerationRequest, role: ReferenceRole, id: string): GenerationRequest;
|
|
618
|
-
|
|
619
|
-
/**
|
|
620
|
-
* Stable JSON: object keys sorted, `undefined` members left out, so equal
|
|
621
|
-
* values always give the same string regardless of key order.
|
|
622
|
-
*/
|
|
623
|
-
declare function stableStringify(value: unknown): string;
|
|
624
|
-
/**
|
|
625
|
-
* A short, stable, synchronous content hash (two independent 32-bit FNV-1a
|
|
626
|
-
* lanes over the UTF-16 code units, 16 hex digits, prefixed with `h1-`).
|
|
627
|
-
* It detects changes; it is not cryptographic, so do not use it to
|
|
628
|
-
* authenticate content.
|
|
629
|
-
*/
|
|
630
|
-
declare function hashText(text: string): string;
|
|
631
|
-
/** {@link hashText} of the {@link stableStringify} form of `value`. */
|
|
632
|
-
declare function hashValue(value: unknown): string;
|
|
633
|
-
/**
|
|
634
|
-
* Hash of what a model accepts. Presentation fields (`name`, `description`,
|
|
635
|
-
* `badges`, `icon`, `group`) and `timing` are left out, so renaming a model or
|
|
636
|
-
* changing its progress estimate is not reported as a capability change.
|
|
637
|
-
*/
|
|
638
|
-
declare function hashCapabilities(caps: ModelCapabilities): string;
|
|
639
|
-
|
|
640
402
|
/** A role a model accepts for asset mentions / references, for pickers. */
|
|
641
403
|
interface AssetRoleOption {
|
|
642
404
|
role: ReferenceRole;
|
|
@@ -733,6 +495,93 @@ declare function describeAssetMentions(mentions: readonly {
|
|
|
733
495
|
start?: number;
|
|
734
496
|
}[], assets: readonly AssetInfo[], caps?: ModelCapabilities): AssetMentionChip[];
|
|
735
497
|
|
|
498
|
+
declare const PROVENANCE_FORMAT = "pixerate.generation-provenance";
|
|
499
|
+
declare const PROVENANCE_VERSION = 1;
|
|
500
|
+
/** The exact template body a generation used. */
|
|
501
|
+
interface PinnedTemplate {
|
|
502
|
+
name: string;
|
|
503
|
+
templateId?: string;
|
|
504
|
+
/** Version id or version label the body came from (absent for unversioned templates). */
|
|
505
|
+
versionId?: string;
|
|
506
|
+
version?: string | number;
|
|
507
|
+
body: string;
|
|
508
|
+
}
|
|
509
|
+
/** Everything needed to explain and reproduce one generation. */
|
|
510
|
+
interface GenerationProvenance {
|
|
511
|
+
format: typeof PROVENANCE_FORMAT;
|
|
512
|
+
version: typeof PROVENANCE_VERSION;
|
|
513
|
+
/** Raw prompt as typed, with `{{templates}}` and `{variables}`. */
|
|
514
|
+
rawPrompt: string;
|
|
515
|
+
/** Every template the prompt reached (recursively), pinned to the body used. */
|
|
516
|
+
templates: PinnedTemplate[];
|
|
517
|
+
/** Version bindings in effect (`{ templateName: versionId }`) for every pinned versioned template. */
|
|
518
|
+
bindings: Record<string, string>;
|
|
519
|
+
/** Variable values, or `null` when variables were left unresolved. */
|
|
520
|
+
values: PromptValues | null;
|
|
521
|
+
resolvedPrompt: string;
|
|
522
|
+
sourceMap: SourceMapSegment[];
|
|
523
|
+
modelId: string;
|
|
524
|
+
/** The planned (adjusted) request that was sent. */
|
|
525
|
+
request: GenerationRequest;
|
|
526
|
+
adjustments: PlanAdjustment[];
|
|
527
|
+
references: {
|
|
528
|
+
id: string;
|
|
529
|
+
role: ReferenceRole;
|
|
530
|
+
}[];
|
|
531
|
+
/** ISO timestamps. */
|
|
532
|
+
createdAt: string;
|
|
533
|
+
startedAt?: string;
|
|
534
|
+
completedAt?: string;
|
|
535
|
+
/** Ids of the outputs this generation produced. */
|
|
536
|
+
outputIds?: string[];
|
|
537
|
+
meta?: Record<string, unknown>;
|
|
538
|
+
}
|
|
539
|
+
interface CreateProvenanceOptions {
|
|
540
|
+
rawPrompt: string;
|
|
541
|
+
templates?: Template[];
|
|
542
|
+
/** Template version bindings (`{ templateName: versionIdOrVersion }`). */
|
|
543
|
+
bindings?: Record<string, string>;
|
|
544
|
+
values?: PromptValues;
|
|
545
|
+
model: string | ModelCapabilities;
|
|
546
|
+
/** The plan the request came from (its request and adjustments are recorded) … */
|
|
547
|
+
plan?: GenerationPlan;
|
|
548
|
+
/** … or the request that was sent. */
|
|
549
|
+
request?: GenerationRequest;
|
|
550
|
+
adjustments?: PlanAdjustment[];
|
|
551
|
+
/** Creation time (default `Date.now()`). */
|
|
552
|
+
createdAt?: Date | number | string;
|
|
553
|
+
startedAt?: Date | number | string;
|
|
554
|
+
completedAt?: Date | number | string;
|
|
555
|
+
outputIds?: string[];
|
|
556
|
+
meta?: Record<string, unknown>;
|
|
557
|
+
maxDepth?: number;
|
|
558
|
+
}
|
|
559
|
+
declare class ProvenanceParseError extends Error {
|
|
560
|
+
constructor(message: string);
|
|
561
|
+
}
|
|
562
|
+
/** Templates that reproduce the pinned bodies exactly (one single-version template each). */
|
|
563
|
+
declare function pinnedTemplatesToTemplates(pinned: readonly PinnedTemplate[]): Template[];
|
|
564
|
+
/**
|
|
565
|
+
* Records what produced an output: the raw prompt, the exact template bodies
|
|
566
|
+
* and versions it reached, variable values, the resolved prompt and its
|
|
567
|
+
* source map, the model, the planned settings and adjustments, and the
|
|
568
|
+
* references by role.
|
|
569
|
+
*/
|
|
570
|
+
declare function createProvenance(options: CreateProvenanceOptions): GenerationProvenance;
|
|
571
|
+
/** Versioned JSON for storage next to an output. */
|
|
572
|
+
declare function serializeProvenance(provenance: GenerationProvenance): string;
|
|
573
|
+
/** Parses and checks serialized provenance. Throws {@link ProvenanceParseError}. */
|
|
574
|
+
declare function parseProvenance(input: string | unknown): GenerationProvenance;
|
|
575
|
+
/**
|
|
576
|
+
* Re-resolves the raw prompt against the pinned template bodies and values,
|
|
577
|
+
* e.g. to check a record or to open it in an editor with its source map.
|
|
578
|
+
*/
|
|
579
|
+
declare function replayProvenancePrompt(provenance: GenerationProvenance): {
|
|
580
|
+
text: string;
|
|
581
|
+
map: SourceMapSegment[];
|
|
582
|
+
matches: boolean;
|
|
583
|
+
};
|
|
584
|
+
|
|
736
585
|
declare const GENERATION_RECORD_FORMAT = "pixerate.generation-record";
|
|
737
586
|
declare const GENERATION_RECORD_VERSION = 1;
|
|
738
587
|
/** How a record came about. */
|
|
@@ -1012,4 +861,181 @@ declare function matchesRecordFilter(summary: GenerationRecordSummary, filter?:
|
|
|
1012
861
|
*/
|
|
1013
862
|
declare function createGenerationRecordStore(options: GenerationRecordStoreOptions): GenerationRecordStore;
|
|
1014
863
|
|
|
1015
|
-
|
|
864
|
+
interface GenerationHistoryToolProviderOptions {
|
|
865
|
+
/** Provider id (default `generation-history`). */
|
|
866
|
+
id?: string;
|
|
867
|
+
namespace?: string;
|
|
868
|
+
/** Where the generation records live. */
|
|
869
|
+
store: GenerationRecordStore;
|
|
870
|
+
/** Current models, to re-plan recreated requests and report drift (as `recreateRequest`'s `capabilities`). */
|
|
871
|
+
models?: readonly ModelCapabilities[] | (() => readonly ModelCapabilities[]);
|
|
872
|
+
/** Current templates, to report edits and resolve in `latest` mode. */
|
|
873
|
+
templates?: readonly Template[] | (() => readonly Template[]);
|
|
874
|
+
/** Current assets, to report missing or changed references (a lookup function stays live). */
|
|
875
|
+
assets?: AssetLookup;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Agent tools over a `GenerationRecordStore`, the history behind the generation history
|
|
879
|
+
* panel. All are read-only: `recreate_generation` and `vary_generation` return a request to
|
|
880
|
+
* pass to `generate` (from `createGenerationToolProvider`), so spending stays behind its
|
|
881
|
+
* idempotency key.
|
|
882
|
+
*
|
|
883
|
+
* - `list_generations {model?, template?, text?, kind?, limit?, offset?}`: summaries, newest first.
|
|
884
|
+
* - `get_generation {id}`: the full record (prompt, settings, seed, assets, templates).
|
|
885
|
+
* - `recreate_generation {id, mode?}`: the request that reproduces a record, with drift.
|
|
886
|
+
* - `vary_generation {id, seed?, values?, settings?}`: the same request with a new seed or changes.
|
|
887
|
+
*/
|
|
888
|
+
declare function createGenerationHistoryToolProvider(options: GenerationHistoryToolProviderOptions): AgentToolProvider;
|
|
889
|
+
|
|
890
|
+
interface BatchResolverOptions<K, V> {
|
|
891
|
+
/** Loads many keys at once. Keys missing from the map resolve to `undefined`. */
|
|
892
|
+
fetch: (keys: K[]) => Promise<Map<K, V>>;
|
|
893
|
+
/** Largest batch passed to `fetch` (default 50). */
|
|
894
|
+
maxBatch?: number;
|
|
895
|
+
/** How long to collect keys before fetching, in ms (default 0: the same tick). */
|
|
896
|
+
delayMs?: number;
|
|
897
|
+
/** Called once per failed batch. The batch's keys are recorded as resolved-empty. */
|
|
898
|
+
onError?: (error: unknown, keys: K[]) => void;
|
|
899
|
+
}
|
|
900
|
+
interface BatchResolver<K, V> {
|
|
901
|
+
/** Resolves one key, batched with other loads in the same window. Never rejects. */
|
|
902
|
+
load(key: K): Promise<V | undefined>;
|
|
903
|
+
loadMany(keys: readonly K[]): Promise<(V | undefined)[]>;
|
|
904
|
+
/** The settled value for a key, if it has been resolved. */
|
|
905
|
+
peek(key: K): V | undefined;
|
|
906
|
+
/** Whether a key has settled (found, missing or failed). */
|
|
907
|
+
has(key: K): boolean;
|
|
908
|
+
/** Whether a key's last fetch failed. */
|
|
909
|
+
failed(key: K): boolean;
|
|
910
|
+
/** Seeds a value without fetching. */
|
|
911
|
+
prime(key: K, value: V): void;
|
|
912
|
+
/** Forgets one key (or all) so the next `load` fetches again. */
|
|
913
|
+
clear(key?: K): void;
|
|
914
|
+
/** Fetches anything still waiting now, without waiting for `delayMs`. */
|
|
915
|
+
flush(): void;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Coalesces lookups (e.g. asset ids → thumbnails, template ids → bodies) into
|
|
919
|
+
* batched `fetch` calls: keys requested within `delayMs` share a batch of at
|
|
920
|
+
* most `maxBatch`, duplicate keys are fetched once, and results are cached.
|
|
921
|
+
* A failed batch resolves its keys to `undefined` and records them as
|
|
922
|
+
* resolved-empty (`failed(key)` is `true`) so one bad response does not cause
|
|
923
|
+
* a retry storm; `clear(key)` allows a retry.
|
|
924
|
+
*/
|
|
925
|
+
declare function createBatchResolver<K, V>(options: BatchResolverOptions<K, V>): BatchResolver<K, V>;
|
|
926
|
+
|
|
927
|
+
interface JobProgressInput {
|
|
928
|
+
/** Start time (ms since epoch, `Date` or ISO string). */
|
|
929
|
+
startedAt: number | Date | string;
|
|
930
|
+
/** Current time (default `Date.now()`). */
|
|
931
|
+
now?: number | Date | string;
|
|
932
|
+
/** Expected total duration in ms. Without it progress eases towards 95%. */
|
|
933
|
+
expectedMs?: number;
|
|
934
|
+
/** The job finished. */
|
|
935
|
+
done?: boolean;
|
|
936
|
+
}
|
|
937
|
+
interface JobProgressEstimate {
|
|
938
|
+
/** 0–100. Never above 95 until `done`. */
|
|
939
|
+
percent: number;
|
|
940
|
+
/** E.g. `~2m left`, `~40s left`, `Almost done…`, `Starting…`, `Done`. */
|
|
941
|
+
label: string;
|
|
942
|
+
elapsedMs: number;
|
|
943
|
+
/** Estimated ms left (`undefined` without `expectedMs`). */
|
|
944
|
+
remainingMs?: number;
|
|
945
|
+
/** Running longer than expected. */
|
|
946
|
+
overdue: boolean;
|
|
947
|
+
}
|
|
948
|
+
/** Highest percentage shown before a job reports completion. */
|
|
949
|
+
declare const MAX_PENDING_PERCENT = 95;
|
|
950
|
+
/** `~45s left`, `~2m left`, `~1h 5m left`. Minutes and seconds round up. */
|
|
951
|
+
declare function formatRemaining(ms: number): string;
|
|
952
|
+
/**
|
|
953
|
+
* Progress for a job that reports no progress of its own: linear in elapsed
|
|
954
|
+
* time over `expectedMs`, held at 95% until `done` (so the bar never sits at
|
|
955
|
+
* 100% while still waiting), with a "~2m left" style label that turns into
|
|
956
|
+
* "Almost done…" near or past the expected end. Pure: pass `now` to test.
|
|
957
|
+
*/
|
|
958
|
+
declare function estimateJobProgress(input: JobProgressInput): JobProgressEstimate;
|
|
959
|
+
/**
|
|
960
|
+
* Expected duration of a request from the model's `timing`: `baseMs`, plus
|
|
961
|
+
* `perItemMs` per output beyond the first, `perSecondMs` per second of
|
|
962
|
+
* duration and `perMegapixelMs` per megapixel of resolution. `undefined` when
|
|
963
|
+
* the model has no timing.
|
|
964
|
+
*/
|
|
965
|
+
declare function expectedDurationFor(caps: ModelCapabilities, request?: GenerationRequest): number | undefined;
|
|
966
|
+
|
|
967
|
+
interface GenerationControlOption {
|
|
968
|
+
value: string | number;
|
|
969
|
+
label: string;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* A UI control derived from capabilities. `key` is a request path:
|
|
973
|
+
* `aspectRatio`, `count`, `params.guidance`, …
|
|
974
|
+
*/
|
|
975
|
+
interface GenerationControl {
|
|
976
|
+
key: string;
|
|
977
|
+
label: string;
|
|
978
|
+
/** `select` for choices, `range` for bounded numbers, `number` for open numbers. */
|
|
979
|
+
kind: 'select' | 'range' | 'number' | 'textarea' | 'checkbox';
|
|
980
|
+
valueType: 'string' | 'number' | 'boolean';
|
|
981
|
+
options?: GenerationControlOption[];
|
|
982
|
+
min?: number;
|
|
983
|
+
max?: number;
|
|
984
|
+
step?: number;
|
|
985
|
+
maxLength?: number;
|
|
986
|
+
defaultValue?: string | number | boolean;
|
|
987
|
+
description?: string;
|
|
988
|
+
}
|
|
989
|
+
interface ReferenceSlot {
|
|
990
|
+
role: ReferenceRole;
|
|
991
|
+
label: string;
|
|
992
|
+
description?: string;
|
|
993
|
+
min: number;
|
|
994
|
+
max: number;
|
|
995
|
+
/** Media accepted for this role (see `ReferenceRoleCapability.accepts`). */
|
|
996
|
+
accepts?: string[];
|
|
997
|
+
references: GenerationReference[];
|
|
998
|
+
/** More references of this role fit (per role and in total). */
|
|
999
|
+
canAdd: boolean;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* The settings controls a model supports, in display order. Excludes the
|
|
1003
|
+
* prompt (edited by the prompt editor) and references (see
|
|
1004
|
+
* {@link getReferenceSlots}).
|
|
1005
|
+
*/
|
|
1006
|
+
declare function getGenerationControls(caps: ModelCapabilities): GenerationControl[];
|
|
1007
|
+
/** Reads a request value by control key (`params.x` reads a param). */
|
|
1008
|
+
declare function getRequestValue(request: GenerationRequest, key: string): unknown;
|
|
1009
|
+
/** Returns a copy of `request` with `key` set (`undefined` or `''` removes it). */
|
|
1010
|
+
declare function setRequestValue(request: GenerationRequest, key: string, value: unknown): GenerationRequest;
|
|
1011
|
+
/** Parses a DOM control's string value into the control's value type. */
|
|
1012
|
+
declare function parseControlValue(control: GenerationControl, raw: string | boolean): string | number | boolean | undefined;
|
|
1013
|
+
/** Reference slots for every role the model accepts, filled from `request`. */
|
|
1014
|
+
declare function getReferenceSlots(caps: ModelCapabilities, request?: GenerationRequest): ReferenceSlot[];
|
|
1015
|
+
/** Returns a copy of `request` with a reference appended. */
|
|
1016
|
+
declare function addReference(request: GenerationRequest, reference: GenerationReference): GenerationRequest;
|
|
1017
|
+
/** Returns a copy of `request` without the reference `id` in `role`. */
|
|
1018
|
+
declare function removeReference(request: GenerationRequest, role: ReferenceRole, id: string): GenerationRequest;
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Stable JSON: object keys sorted, `undefined` members left out, so equal
|
|
1022
|
+
* values always give the same string regardless of key order.
|
|
1023
|
+
*/
|
|
1024
|
+
declare function stableStringify(value: unknown): string;
|
|
1025
|
+
/**
|
|
1026
|
+
* A short, stable, synchronous content hash (two independent 32-bit FNV-1a
|
|
1027
|
+
* lanes over the UTF-16 code units, 16 hex digits, prefixed with `h1-`).
|
|
1028
|
+
* It detects changes; it is not cryptographic, so do not use it to
|
|
1029
|
+
* authenticate content.
|
|
1030
|
+
*/
|
|
1031
|
+
declare function hashText(text: string): string;
|
|
1032
|
+
/** {@link hashText} of the {@link stableStringify} form of `value`. */
|
|
1033
|
+
declare function hashValue(value: unknown): string;
|
|
1034
|
+
/**
|
|
1035
|
+
* Hash of what a model accepts. Presentation fields (`name`, `description`,
|
|
1036
|
+
* `badges`, `icon`, `group`) and `timing` are left out, so renaming a model or
|
|
1037
|
+
* changing its progress estimate is not reported as a capability change.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function hashCapabilities(caps: ModelCapabilities): string;
|
|
1040
|
+
|
|
1041
|
+
export { AgentToolProvider, type AssetInfo, type AssetLookup, type AssetMentionChip, type AssetMentionIssue, type AssetMentionIssueCode, type AssetMentionValidation, type AssetRoleOption, type BatchResolver, type BatchResolverOptions, type BooleanParamSpec, type BuiltinReferenceRole, type CapabilityOverlay, type CapabilityPresentation, type CountCapability, type CreateGenerationRecordOptions, type CreateProvenanceOptions, DRIFT_TYPE_LABELS, type DriftItem, type DriftType, type DurationCapability, type EnumCapability, type EnumParamSpec, type EstimateContext, type ExtraParamSpec, GENERATION_RECORD_FORMAT, GENERATION_RECORD_VERSION, GENERATION_REQUEST_FIELDS, type GenerateContext, type GenerationControl, type GenerationControlOption, type GenerationHistoryToolProviderOptions, type GenerationMediaKind, type GenerationMode, type GenerationParamValue, type GenerationPlan, type GenerationProvenance, type GenerationRecord, type GenerationRecordFilter, type GenerationRecordKind, type GenerationRecordStore, type GenerationRecordStoreOptions, type GenerationRecordSummary, type GenerationReference, type GenerationRequest, type GenerationToolProvider, type GenerationToolProviderOptions, type JobProgressEstimate, type JobProgressInput, JsonSchema, MAX_PENDING_PERCENT, type ModelCapabilities, type NumberParamSpec, PROVENANCE_FORMAT, PROVENANCE_VERSION, type PinnedTemplate, type PlanAdjustment, type PlanAdjustmentKind, type PlanAssetMention, type PlanError, type PlanOptions, type PlanStrategy, type PromptCapability, ProvenanceParseError, type PruneOptions, QUALITY_LADDER, REFERENCE_ROLES, REFERENCE_ROLE_ALIASES, REFERENCE_ROLE_LABELS, REFERENCE_ROLE_NAME_REGEX, type RecordedAsset, type RecordedTemplate, type RecreateMode, type RecreateOptions, type RecreateResult, type ReferenceCapability, type ReferenceRole, type ReferenceRoleCapability, type ReferenceSlot, type SeedCapability, type TextFieldCapability, type TimingCapability, type VariationOverrides, addReference, aspectRatioRank, blockingDrift, capabilitiesToJsonSchema, completeGenerationRecord, createBatchResolver, createGenerationHistoryToolProvider, createGenerationRecord, createGenerationRecordId, createGenerationRecordStore, createGenerationToolProvider, createProvenance, defaultAssetRoleOptions, describeAssetMentions, estimateJobProgress, expectedDurationFor, formatRemaining, getAssetRoleOptions, getGenerationControls, getReferenceSlots, getRequestValue, hashCapabilities, hashText, hashValue, isGenerationRecord, isReferenceRoleName, matchesRecordFilter, mediaTypeMatches, mergeCapabilities, normalizeReferenceRole, parseControlValue, parseGenerationRecord, parseProvenance, pinnedTemplatesToTemplates, planGenerationRequest, qualityRank, recreateRequest, referenceRoleLabel, removeReference, replayProvenancePrompt, resolutionMegapixels, resolutionRank, resolveAssetMentions, seedCapability, serializeGenerationRecord, serializeProvenance, setRequestValue, snapToOption, stableStringify, summarizeGenerationRecord, supportedModes, supportedReferenceRoles, textFieldCapability, toAssetResolver, validateAssetMentions, variationRequest };
|