@tangle-network/agent-app 0.34.0 → 0.36.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/dist/chunk-DTS5TZRN.js +293 -0
- package/dist/chunk-DTS5TZRN.js.map +1 -0
- package/dist/completion-Kaqp_tWk.d.ts +41 -0
- package/dist/intakes/api.d.ts +2 -2
- package/dist/intakes/drizzle.d.ts +2 -2
- package/dist/intakes/index.d.ts +108 -32
- package/dist/intakes/index.js +66 -0
- package/dist/intakes/index.js.map +1 -1
- package/dist/intakes-react/index.d.ts +1 -1
- package/dist/intakes-react/lazy.d.ts +1 -1
- package/dist/{model-Cuj7d-xT.d.ts → model-Bzi5i63l.d.ts} +1 -1
- package/dist/studio/index.d.ts +132 -0
- package/dist/studio/index.js +59 -0
- package/dist/studio/index.js.map +1 -0
- package/dist/studio-react/index.d.ts +193 -0
- package/dist/studio-react/index.js +1216 -0
- package/dist/studio-react/index.js.map +1 -0
- package/dist/studio-react/studio.css +73 -0
- package/package.json +36 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/intakes/context-sufficiency.ts"],"sourcesContent":["/**\n * Pure context-sufficiency floor + conversational-gather scaffold — the\n * product-agnostic core of a CONVERSATIONAL intake. Where the question-graph\n * model (`./model`) runs a one-question-at-a-time interview, this leaf judges\n * whether an agent has gathered ENOUGH context to act, and renders the prompt\n * directive that tells the agent to fold the remaining gaps into its work\n * instead of running a form.\n *\n * Zero dependencies: no drizzle, no env, no react, no I/O, no product reads.\n * A product declares WHICH facts matter (`ContextFactSpec`), and its own\n * adapter resolves those facts + named substrate flags from whatever substrate\n * it owns (`ResolvedContextSignals`); this leaf only does the deterministic\n * combine and the wording. That separation is what makes the framework opt-in\n * and tree-shakeable, and what lets gtm/tax/legal/insurance share one core.\n *\n * Readiness is a two-part floor: SCOPE (every required fact has a value) AND\n * SUBSTRATE (at least one named substrate flag is true). Scope alone is not\n * enough — knowing the goal without any durable thing to act on is still\n * not-ready; substrate alone is not enough either. The product's adapter\n * decides what counts as a fact and what counts as substrate.\n */\n\n/** One fact the product treats as known context once it has a value. */\nexport interface ContextFact {\n /** Stable key the resolved-signals map is keyed on. */\n key: string\n /** Human label shown in the prompt's known/missing lists. */\n label: string\n /** When true, this fact must have a value for SCOPE to be met. */\n required?: boolean\n /** How the agent should gather this fact conversationally, if missing. */\n gatherHint?: string\n}\n\n/**\n * The product's declaration of what context matters: the facts that make up\n * scope, plus optional tool hints appended verbatim to the gather prompt (e.g.\n * a product passes the command that extracts a brand from a URL). Pure data —\n * the product supplies labels, hints, and tool lines; the framework never\n * names a product-specific concept itself.\n */\nexport interface ContextFactSpec {\n facts: ContextFact[]\n /** Lines appended after the gather directive — e.g. product tool pointers. */\n toolHints?: string[]\n}\n\n/**\n * What a product's adapter resolves from its own substrate, ready to combine.\n * `facts` carries the resolved VALUE per fact key (undefined/empty = not\n * known); `substrate` carries named boolean flags (e.g.\n * `{ brandConfirmed, configHasContext, coreKnowledgePresent }`) — any one true\n * satisfies the substrate half of the floor.\n */\nexport interface ResolvedContextSignals {\n facts: Record<string, string | undefined>\n substrate: Record<string, boolean>\n}\n\n/** A resolved fact that has a value — surfaced to the prompt as known context. */\nexport interface KnownFact {\n key: string\n label: string\n value: string\n}\n\n/** A required fact with no value — surfaced to the prompt as a gap to close. */\nexport interface MissingFact {\n key: string\n label: string\n gatherHint?: string\n}\n\n/** The deterministic verdict over the resolved signals. */\nexport interface ContextSufficiency {\n /** True when the floor is met: `hasScope && hasSubstrate`. */\n ready: boolean\n /** Every REQUIRED fact has a non-empty value. */\n hasScope: boolean\n /** At least one named substrate flag is true. */\n hasSubstrate: boolean\n /** Facts (required or not) that have a value. */\n knownFacts: KnownFact[]\n /** Required facts that have no value yet. */\n missingFacts: MissingFact[]\n /** The substrate flags as resolved, passed through for the prompt/caller. */\n substrate: Record<string, boolean>\n}\n\n/** Trim a fact value to a present string, or undefined when blank/absent. */\nfunction presentValue(value: string | undefined): string | undefined {\n if (typeof value !== 'string') return undefined\n const trimmed = value.trim()\n return trimmed.length > 0 ? trimmed : undefined\n}\n\n/**\n * Combine a fact spec with resolved signals into the readiness verdict. Pure,\n * deterministic, never throws — a missing fact key or an empty substrate map\n * reads as not-ready, not an error, so a fresh scope is honestly not-ready\n * rather than crashing the caller.\n *\n * SCOPE = every `required` fact resolves to a non-empty value.\n * SUBSTRATE = any value in `signals.substrate` is true.\n * READY = SCOPE && SUBSTRATE.\n *\n * `knownFacts` lists every fact (required or optional) that resolved to a\n * value, in spec declaration order; `missingFacts` lists every REQUIRED fact\n * that did not — optional facts never appear as missing because they never gate\n * scope.\n */\nexport function computeContextSufficiency(\n spec: ContextFactSpec,\n signals: ResolvedContextSignals,\n): ContextSufficiency {\n const facts = spec.facts ?? []\n const resolvedFacts = signals.facts ?? {}\n const substrate = signals.substrate ?? {}\n\n const knownFacts: KnownFact[] = []\n const missingFacts: MissingFact[] = []\n let hasScope = true\n\n for (const fact of facts) {\n const value = presentValue(resolvedFacts[fact.key])\n if (value !== undefined) {\n knownFacts.push({ key: fact.key, label: fact.label, value })\n } else if (fact.required) {\n hasScope = false\n missingFacts.push({ key: fact.key, label: fact.label, gatherHint: fact.gatherHint })\n }\n }\n\n const hasSubstrate = Object.values(substrate).some(Boolean)\n\n return {\n ready: hasScope && hasSubstrate,\n hasScope,\n hasSubstrate,\n knownFacts,\n missingFacts,\n substrate,\n }\n}\n\n/** The directive that turns gaps into conversational gathering, not a form. */\nconst GATHER_DIRECTIVE =\n 'Do not run an interview. Act on the message first, then fold AT MOST one or two pointed questions into the same turn to close the highest-leverage gap. Never present a form.'\n\n/** What to say when scope is met but no durable substrate exists yet. */\nconst SUBSTRATE_DIRECTIVE =\n 'You have the scope but no durable substrate to act on yet. As you work, persist what you learn — that is what makes this context-ready.'\n\n/**\n * Render the prompt section that mirrors a conversational-gather flow:\n * - \"### Context you already have\" — the known facts, as `label: value`.\n * - \"### Context still missing — gather it while you work, not as a form\" —\n * the missing facts (with their gather hints), the act-first directive, and\n * any product tool hints appended verbatim.\n *\n * When scope is met but the floor still is not (no substrate flag), it emits\n * the substrate directive instead of a missing-facts list. Returns '' when\n * there is nothing to say (no known facts, no gaps, and ready) so a caller can\n * concatenate it unconditionally. Pure: wording is product-neutral; every\n * product-specific phrase comes from the spec's labels, gather hints, and tool\n * hints.\n */\nexport function buildContextGatherPrompt(\n spec: ContextFactSpec,\n sufficiency: ContextSufficiency,\n): string {\n const lines: string[] = []\n\n if (sufficiency.knownFacts.length > 0) {\n lines.push('### Context you already have')\n lines.push(sufficiency.knownFacts.map((f) => `- ${f.label}: ${f.value}`).join('\\n'))\n }\n\n if (sufficiency.missingFacts.length > 0) {\n if (lines.length > 0) lines.push('')\n lines.push('### Context still missing — gather it while you work, not as a form')\n const gaps = sufficiency.missingFacts\n .map((f) => (f.gatherHint ? `- ${f.label} — ${f.gatherHint}` : `- ${f.label}`))\n .join('\\n')\n lines.push(`You do NOT have:\\n${gaps}`)\n lines.push(GATHER_DIRECTIVE)\n for (const hint of spec.toolHints ?? []) {\n const trimmed = hint.trim()\n if (trimmed) lines.push(trimmed)\n }\n } else if (!sufficiency.ready) {\n if (lines.length > 0) lines.push('')\n lines.push(SUBSTRATE_DIRECTIVE)\n for (const hint of spec.toolHints ?? []) {\n const trimmed = hint.trim()\n if (trimmed) lines.push(trimmed)\n }\n }\n\n if (lines.length === 0) return ''\n return `## Project Context & Sufficiency\\n${lines.join('\\n')}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0FA,SAAS,aAAa,OAA+C;AACnE,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,SAAO,QAAQ,SAAS,IAAI,UAAU;AACxC;AAiBO,SAAS,0BACd,MACA,SACoB;AACpB,QAAM,QAAQ,KAAK,SAAS,CAAC;AAC7B,QAAM,gBAAgB,QAAQ,SAAS,CAAC;AACxC,QAAM,YAAY,QAAQ,aAAa,CAAC;AAExC,QAAM,aAA0B,CAAC;AACjC,QAAM,eAA8B,CAAC;AACrC,MAAI,WAAW;AAEf,aAAW,QAAQ,OAAO;AACxB,UAAM,QAAQ,aAAa,cAAc,KAAK,GAAG,CAAC;AAClD,QAAI,UAAU,QAAW;AACvB,iBAAW,KAAK,EAAE,KAAK,KAAK,KAAK,OAAO,KAAK,OAAO,MAAM,CAAC;AAAA,IAC7D,WAAW,KAAK,UAAU;AACxB,iBAAW;AACX,mBAAa,KAAK,EAAE,KAAK,KAAK,KAAK,OAAO,KAAK,OAAO,YAAY,KAAK,WAAW,CAAC;AAAA,IACrF;AAAA,EACF;AAEA,QAAM,eAAe,OAAO,OAAO,SAAS,EAAE,KAAK,OAAO;AAE1D,SAAO;AAAA,IACL,OAAO,YAAY;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAGA,IAAM,mBACJ;AAGF,IAAM,sBACJ;AAgBK,SAAS,yBACd,MACA,aACQ;AACR,QAAM,QAAkB,CAAC;AAEzB,MAAI,YAAY,WAAW,SAAS,GAAG;AACrC,UAAM,KAAK,8BAA8B;AACzC,UAAM,KAAK,YAAY,WAAW,IAAI,CAAC,MAAM,KAAK,EAAE,KAAK,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI,CAAC;AAAA,EACrF;AAEA,MAAI,YAAY,aAAa,SAAS,GAAG;AACvC,QAAI,MAAM,SAAS,EAAG,OAAM,KAAK,EAAE;AACnC,UAAM,KAAK,0EAAqE;AAChF,UAAM,OAAO,YAAY,aACtB,IAAI,CAAC,MAAO,EAAE,aAAa,KAAK,EAAE,KAAK,WAAM,EAAE,UAAU,KAAK,KAAK,EAAE,KAAK,EAAG,EAC7E,KAAK,IAAI;AACZ,UAAM,KAAK;AAAA,EAAqB,IAAI,EAAE;AACtC,UAAM,KAAK,gBAAgB;AAC3B,eAAW,QAAQ,KAAK,aAAa,CAAC,GAAG;AACvC,YAAM,UAAU,KAAK,KAAK;AAC1B,UAAI,QAAS,OAAM,KAAK,OAAO;AAAA,IACjC;AAAA,EACF,WAAW,CAAC,YAAY,OAAO;AAC7B,QAAI,MAAM,SAAS,EAAG,OAAM,KAAK,EAAE;AACnC,UAAM,KAAK,mBAAmB;AAC9B,eAAW,QAAQ,KAAK,aAAa,CAAC,GAAG;AACvC,YAAM,UAAU,KAAK,KAAK;AAC1B,UAAI,QAAS,OAAM,KAAK,OAAO;AAAA,IACjC;AAAA,EACF;AAEA,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAAO;AAAA,EAAqC,MAAM,KAAK,IAAI,CAAC;AAC9D;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { IntakeInterview } from './index.js';
|
|
3
3
|
export { IntakeInterviewProps } from './index.js';
|
|
4
|
-
import '../model-
|
|
4
|
+
import '../model-Bzi5i63l.js';
|
|
5
5
|
|
|
6
6
|
declare const IntakeInterviewLazy: react.LazyExoticComponent<typeof IntakeInterview>;
|
|
7
7
|
|
|
@@ -113,4 +113,4 @@ declare function intakeProgress(graph: IntakeGraph, answers: IntakeAnswers): {
|
|
|
113
113
|
/** The questions reachable under the current answers, in traversal order. */
|
|
114
114
|
declare function reachableQuestions(graph: IntakeGraph, answers: IntakeAnswers): IntakeQuestion[];
|
|
115
115
|
|
|
116
|
-
export { type AnswerRejectionReason as A, type IntakeAnswerValue as I, type IntakeQuestion as a, type IntakeGraph as b, type
|
|
116
|
+
export { type AnswerRejectionReason as A, type IntakeAnswerValue as I, type IntakeQuestion as a, type IntakeGraph as b, type AnswerValidationResult as c, type IntakeAnswerType as d, type IntakeAnswers as e, type IntakeOption as f, getQuestion as g, hasAnswer as h, intakeProgress as i, isComplete as j, nextQuestion as n, reachableQuestions as r, validateAnswer as v };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
interface StudioIntegrationConnection {
|
|
2
|
+
status: string;
|
|
3
|
+
providerId: string;
|
|
4
|
+
connectorId: string;
|
|
5
|
+
}
|
|
6
|
+
type GenerationType = 'image' | 'video' | 'speech' | 'avatar' | 'transcription';
|
|
7
|
+
type GenerationStatus = 'pending' | 'running' | 'succeeded' | 'failed';
|
|
8
|
+
type MediaModelStatus = 'available' | 'limited' | 'unavailable';
|
|
9
|
+
interface Generation {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
prompt: string;
|
|
13
|
+
result: string | null;
|
|
14
|
+
model: string | null;
|
|
15
|
+
cost: number | null;
|
|
16
|
+
createdAt: Date | null;
|
|
17
|
+
metadata: Record<string, unknown> | null;
|
|
18
|
+
}
|
|
19
|
+
interface MediaModelOption {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
provider?: string;
|
|
23
|
+
type: GenerationType;
|
|
24
|
+
status: MediaModelStatus;
|
|
25
|
+
reason?: string;
|
|
26
|
+
}
|
|
27
|
+
interface MediaModelCatalogResponse {
|
|
28
|
+
defaults: Record<GenerationType, string>;
|
|
29
|
+
models: Record<GenerationType, MediaModelOption[]>;
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
interface PublishPackage {
|
|
33
|
+
caption: string;
|
|
34
|
+
description: string;
|
|
35
|
+
mentions: string[];
|
|
36
|
+
destinations: string[];
|
|
37
|
+
cadence: string;
|
|
38
|
+
workflowDraft: boolean;
|
|
39
|
+
evalContract: {
|
|
40
|
+
artifactType: string;
|
|
41
|
+
deterministicChecks: string[];
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface PublishDestination {
|
|
45
|
+
id: string;
|
|
46
|
+
label: string;
|
|
47
|
+
providerIds: string[];
|
|
48
|
+
fields: string;
|
|
49
|
+
}
|
|
50
|
+
declare const GENERATION_TYPES: readonly GenerationType[];
|
|
51
|
+
declare function isGenerationType(value: string): value is GenerationType;
|
|
52
|
+
declare const DESTINATIONS: PublishDestination[];
|
|
53
|
+
declare const CADENCES: string[];
|
|
54
|
+
declare const MIN_IMAGE_COUNT = 1;
|
|
55
|
+
declare const MAX_IMAGE_COUNT = 4;
|
|
56
|
+
declare function relativeTime(date: Date | null): string;
|
|
57
|
+
declare function outputPathFor(type: GenerationType): string;
|
|
58
|
+
declare function generationVaultPath(generation: Generation): string | null;
|
|
59
|
+
declare function buildPublishPackage({ caption, postDescription, mentions, cadence, destinations, }: {
|
|
60
|
+
caption: string;
|
|
61
|
+
postDescription: string;
|
|
62
|
+
mentions: string;
|
|
63
|
+
cadence: string;
|
|
64
|
+
destinations: string[];
|
|
65
|
+
}): PublishPackage | null;
|
|
66
|
+
declare function isPublishPackage(value: unknown): value is {
|
|
67
|
+
caption?: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
mentions?: string[];
|
|
70
|
+
destinations?: string[];
|
|
71
|
+
cadence?: string;
|
|
72
|
+
};
|
|
73
|
+
declare function isDestinationConnected(destination: PublishDestination, connections: StudioIntegrationConnection[]): boolean;
|
|
74
|
+
declare function selectedModelsWithDefaults(current: Partial<Record<GenerationType, string>>, catalog: MediaModelCatalogResponse): Partial<Record<GenerationType, string>>;
|
|
75
|
+
declare function preferredModelId(type: GenerationType, catalog: MediaModelCatalogResponse | null): string | undefined;
|
|
76
|
+
declare function modelMessage(model: MediaModelOption | undefined, loading: boolean, count: number): string | null;
|
|
77
|
+
interface GenerationRequestFields {
|
|
78
|
+
workspaceId: string;
|
|
79
|
+
clientRequestId: string;
|
|
80
|
+
type: GenerationType;
|
|
81
|
+
model: string;
|
|
82
|
+
prompt: string;
|
|
83
|
+
negativePrompt: string;
|
|
84
|
+
outputPath: string;
|
|
85
|
+
publishPackage: PublishPackage | null;
|
|
86
|
+
image: {
|
|
87
|
+
size: string;
|
|
88
|
+
quality: string;
|
|
89
|
+
count: number;
|
|
90
|
+
};
|
|
91
|
+
video: {
|
|
92
|
+
duration: string;
|
|
93
|
+
resolution: string;
|
|
94
|
+
aspectRatio: string;
|
|
95
|
+
referenceImageUrl: string;
|
|
96
|
+
};
|
|
97
|
+
speech: {
|
|
98
|
+
voice: string;
|
|
99
|
+
};
|
|
100
|
+
avatar: {
|
|
101
|
+
audioUrl: string;
|
|
102
|
+
imageUrl: string;
|
|
103
|
+
avatarId: string;
|
|
104
|
+
};
|
|
105
|
+
transcription: {
|
|
106
|
+
audioUrl: string;
|
|
107
|
+
language: string;
|
|
108
|
+
responseFormat: string;
|
|
109
|
+
temperature: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
declare function buildGenerationRequestBody(fields: GenerationRequestFields): Record<string, unknown>;
|
|
113
|
+
declare function generationStatus(generation: Generation): GenerationStatus;
|
|
114
|
+
declare function generationError(generation: Generation): string | null;
|
|
115
|
+
declare function generationMergeKey(generation: Generation): string | null;
|
|
116
|
+
declare function mergeLiveGeneration(current: Generation[], generation: Generation): Generation[];
|
|
117
|
+
declare function mergeLoaderAndLive(loader: Generation[], live: Generation[]): Generation[];
|
|
118
|
+
declare function isLocalGeneration(generation: Generation): boolean;
|
|
119
|
+
declare function latestBatchOf(generations: Generation[]): Generation[];
|
|
120
|
+
declare function userSafeGenerationMessage(message?: string): string;
|
|
121
|
+
declare function optimisticGeneration({ type, prompt, model, clientRequestId, outputIndex, outputCount, }: {
|
|
122
|
+
type: GenerationType;
|
|
123
|
+
prompt: string;
|
|
124
|
+
model?: string;
|
|
125
|
+
clientRequestId: string;
|
|
126
|
+
outputIndex?: number;
|
|
127
|
+
outputCount?: number;
|
|
128
|
+
}): Generation;
|
|
129
|
+
declare function failedOptimisticGeneration(generation: Generation): Generation;
|
|
130
|
+
declare function normalizeImageCount(value: unknown): number;
|
|
131
|
+
|
|
132
|
+
export { CADENCES, DESTINATIONS, GENERATION_TYPES, type Generation, type GenerationRequestFields, type GenerationStatus, type GenerationType, MAX_IMAGE_COUNT, MIN_IMAGE_COUNT, type MediaModelCatalogResponse, type MediaModelOption, type MediaModelStatus, type PublishDestination, type PublishPackage, type StudioIntegrationConnection, buildGenerationRequestBody, buildPublishPackage, failedOptimisticGeneration, generationError, generationMergeKey, generationStatus, generationVaultPath, isDestinationConnected, isGenerationType, isLocalGeneration, isPublishPackage, latestBatchOf, mergeLiveGeneration, mergeLoaderAndLive, modelMessage, normalizeImageCount, optimisticGeneration, outputPathFor, preferredModelId, relativeTime, selectedModelsWithDefaults, userSafeGenerationMessage };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CADENCES,
|
|
3
|
+
DESTINATIONS,
|
|
4
|
+
GENERATION_TYPES,
|
|
5
|
+
MAX_IMAGE_COUNT,
|
|
6
|
+
MIN_IMAGE_COUNT,
|
|
7
|
+
buildGenerationRequestBody,
|
|
8
|
+
buildPublishPackage,
|
|
9
|
+
failedOptimisticGeneration,
|
|
10
|
+
generationError,
|
|
11
|
+
generationMergeKey,
|
|
12
|
+
generationStatus,
|
|
13
|
+
generationVaultPath,
|
|
14
|
+
isDestinationConnected,
|
|
15
|
+
isGenerationType,
|
|
16
|
+
isLocalGeneration,
|
|
17
|
+
isPublishPackage,
|
|
18
|
+
latestBatchOf,
|
|
19
|
+
mergeLiveGeneration,
|
|
20
|
+
mergeLoaderAndLive,
|
|
21
|
+
modelMessage,
|
|
22
|
+
normalizeImageCount,
|
|
23
|
+
optimisticGeneration,
|
|
24
|
+
outputPathFor,
|
|
25
|
+
preferredModelId,
|
|
26
|
+
relativeTime,
|
|
27
|
+
selectedModelsWithDefaults,
|
|
28
|
+
userSafeGenerationMessage
|
|
29
|
+
} from "../chunk-DTS5TZRN.js";
|
|
30
|
+
export {
|
|
31
|
+
CADENCES,
|
|
32
|
+
DESTINATIONS,
|
|
33
|
+
GENERATION_TYPES,
|
|
34
|
+
MAX_IMAGE_COUNT,
|
|
35
|
+
MIN_IMAGE_COUNT,
|
|
36
|
+
buildGenerationRequestBody,
|
|
37
|
+
buildPublishPackage,
|
|
38
|
+
failedOptimisticGeneration,
|
|
39
|
+
generationError,
|
|
40
|
+
generationMergeKey,
|
|
41
|
+
generationStatus,
|
|
42
|
+
generationVaultPath,
|
|
43
|
+
isDestinationConnected,
|
|
44
|
+
isGenerationType,
|
|
45
|
+
isLocalGeneration,
|
|
46
|
+
isPublishPackage,
|
|
47
|
+
latestBatchOf,
|
|
48
|
+
mergeLiveGeneration,
|
|
49
|
+
mergeLoaderAndLive,
|
|
50
|
+
modelMessage,
|
|
51
|
+
normalizeImageCount,
|
|
52
|
+
optimisticGeneration,
|
|
53
|
+
outputPathFor,
|
|
54
|
+
preferredModelId,
|
|
55
|
+
relativeTime,
|
|
56
|
+
selectedModelsWithDefaults,
|
|
57
|
+
userSafeGenerationMessage
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, SelectHTMLAttributes } from 'react';
|
|
3
|
+
import { Generation } from '../studio/index.js';
|
|
4
|
+
import { IntegrationConnection } from '@tangle-network/sandbox-ui/integrations';
|
|
5
|
+
import { Image } from 'lucide-react';
|
|
6
|
+
|
|
7
|
+
type StudioRole = 'owner' | 'admin' | 'editor' | 'viewer';
|
|
8
|
+
interface StudioWorkspaceProps {
|
|
9
|
+
generations: Generation[];
|
|
10
|
+
totalCost: number;
|
|
11
|
+
workspaceId?: string;
|
|
12
|
+
role: StudioRole;
|
|
13
|
+
/** Polling endpoint override (default `/api/generations`). */
|
|
14
|
+
generationsEndpoint?: string;
|
|
15
|
+
/** Build a vault link, optionally to a specific file. Defaults to `/app/<workspaceId>/vault`. */
|
|
16
|
+
vaultHref?: (filePath?: string | null) => string;
|
|
17
|
+
/** Integrations page href for the publish-package "Connect" link. Defaults to `/app/<workspaceId>/integrations`. */
|
|
18
|
+
integrationsHref?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The full studio surface: header + composer + result canvas + library drawer,
|
|
22
|
+
* with the generation orchestrator (merge/poll/revalidate) wired in. The host
|
|
23
|
+
* route owns the loader (auth, RBAC, the generation query) and the server
|
|
24
|
+
* endpoints (`/api/generate`, `/api/media-models`, `/api/generations`); this
|
|
25
|
+
* shell renders that data and drives the live UI. Role gates the composer
|
|
26
|
+
* (viewers get a read-only library) and the integration-management affordances.
|
|
27
|
+
*/
|
|
28
|
+
declare function StudioWorkspace({ generations, totalCost, workspaceId, role, generationsEndpoint, vaultHref, integrationsHref, }: StudioWorkspaceProps): react.JSX.Element;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The generation orchestrator behind a studio surface: it merges the loader's
|
|
32
|
+
* rows with in-flight live generations, computes the latest batch for the
|
|
33
|
+
* canvas, polls running generations until they settle, and revalidates the
|
|
34
|
+
* route loader when a status changes.
|
|
35
|
+
*
|
|
36
|
+
* The merge keeps the canvas, the library, and the polling path looking at the
|
|
37
|
+
* same full list. Polling hits `generationsEndpoint` (default `/api/generations`,
|
|
38
|
+
* the convention both apps already serve); pass an override if a product routes
|
|
39
|
+
* it elsewhere. `onGenerated` is wired to the composer's per-result callback.
|
|
40
|
+
*/
|
|
41
|
+
declare function useStudioGenerations(loaderGenerations: Generation[], options?: {
|
|
42
|
+
workspaceId?: string;
|
|
43
|
+
generationsEndpoint?: string;
|
|
44
|
+
}): {
|
|
45
|
+
mergedGenerations: Generation[];
|
|
46
|
+
latestBatch: Generation[];
|
|
47
|
+
onGenerated: (generation: Generation) => void;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
declare function ComposerHero({ workspaceId, integrationsHref, canManageIntegrations, onGenerated, }: {
|
|
51
|
+
workspaceId?: string;
|
|
52
|
+
integrationsHref?: string;
|
|
53
|
+
canManageIntegrations: boolean;
|
|
54
|
+
onGenerated: (generation: Generation) => void;
|
|
55
|
+
}): react.JSX.Element;
|
|
56
|
+
|
|
57
|
+
declare function Field({ label, htmlFor, className, children, }: {
|
|
58
|
+
label: string;
|
|
59
|
+
htmlFor?: string;
|
|
60
|
+
className?: string;
|
|
61
|
+
children: ReactNode;
|
|
62
|
+
}): react.JSX.Element;
|
|
63
|
+
declare function ComposerDisclosure({ summary, children }: {
|
|
64
|
+
summary: ReactNode;
|
|
65
|
+
children: ReactNode;
|
|
66
|
+
}): react.JSX.Element;
|
|
67
|
+
declare function NativeSelect(props: SelectHTMLAttributes<HTMLSelectElement>): react.JSX.Element;
|
|
68
|
+
|
|
69
|
+
declare function StudioHeader({ count, onOpenLibrary, canGenerate, }: {
|
|
70
|
+
count: number;
|
|
71
|
+
onOpenLibrary: () => void;
|
|
72
|
+
canGenerate: boolean;
|
|
73
|
+
}): react.JSX.Element;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Right-side overlay sheet built on Radix Dialog — gives focus-trap, scroll-lock,
|
|
77
|
+
* and Escape-to-close for free. Slide/fade come from the studio-sheet-* classes in
|
|
78
|
+
* ./studio.css (driven by Radix data-state), not tailwindcss-animate.
|
|
79
|
+
*/
|
|
80
|
+
declare function StudioSheet({ open, onOpenChange, title, children, }: {
|
|
81
|
+
open: boolean;
|
|
82
|
+
onOpenChange: (open: boolean) => void;
|
|
83
|
+
title: string;
|
|
84
|
+
children: ReactNode;
|
|
85
|
+
}): react.JSX.Element;
|
|
86
|
+
|
|
87
|
+
declare function ResultCanvas({ batch, onOpenLibrary, onSelect, }: {
|
|
88
|
+
batch: Generation[];
|
|
89
|
+
onOpenLibrary: () => void;
|
|
90
|
+
onSelect: (generation: Generation) => void;
|
|
91
|
+
}): react.JSX.Element;
|
|
92
|
+
|
|
93
|
+
declare function LibraryDrawer({ open, onOpenChange, generations, totalCost, typeFilter, onFilterChange, vaultHref, selected, onSelect, }: {
|
|
94
|
+
open: boolean;
|
|
95
|
+
onOpenChange: (open: boolean) => void;
|
|
96
|
+
generations: Generation[];
|
|
97
|
+
totalCost: number;
|
|
98
|
+
typeFilter: string | null;
|
|
99
|
+
onFilterChange: (type: string | null) => void;
|
|
100
|
+
vaultHref?: (filePath?: string | null) => string;
|
|
101
|
+
selected: Generation | null;
|
|
102
|
+
onSelect: (generation: Generation | null) => void;
|
|
103
|
+
}): react.JSX.Element;
|
|
104
|
+
|
|
105
|
+
declare function GenerationCard({ generation, onSelect, }: {
|
|
106
|
+
generation: Generation;
|
|
107
|
+
onSelect: (generation: Generation) => void;
|
|
108
|
+
}): react.JSX.Element;
|
|
109
|
+
declare function GenerationStatusBadge({ generation, inline, }: {
|
|
110
|
+
generation: Generation;
|
|
111
|
+
inline?: boolean;
|
|
112
|
+
}): react.JSX.Element | null;
|
|
113
|
+
|
|
114
|
+
declare function GenerationDetail({ generation, vaultHref, onNavigate, }: {
|
|
115
|
+
generation: Generation;
|
|
116
|
+
vaultHref?: (filePath?: string | null) => string;
|
|
117
|
+
onNavigate?: () => void;
|
|
118
|
+
}): react.JSX.Element;
|
|
119
|
+
|
|
120
|
+
declare function PublishPackageComposer({ caption, postDescription, mentions, cadence, selectedDestinations, connections, connectionError, connectionsLoading, integrationsHref, canManageIntegrations, onCaptionChange, onDescriptionChange, onMentionsChange, onCadenceChange, onDestinationToggle, }: {
|
|
121
|
+
caption: string;
|
|
122
|
+
postDescription: string;
|
|
123
|
+
mentions: string;
|
|
124
|
+
cadence: string;
|
|
125
|
+
selectedDestinations: string[];
|
|
126
|
+
connections: IntegrationConnection[];
|
|
127
|
+
connectionError: Error | null;
|
|
128
|
+
connectionsLoading: boolean;
|
|
129
|
+
integrationsHref?: string;
|
|
130
|
+
canManageIntegrations: boolean;
|
|
131
|
+
onCaptionChange: (value: string) => void;
|
|
132
|
+
onDescriptionChange: (value: string) => void;
|
|
133
|
+
onMentionsChange: (value: string) => void;
|
|
134
|
+
onCadenceChange: (value: string) => void;
|
|
135
|
+
onDestinationToggle: (destination: string) => void;
|
|
136
|
+
}): react.JSX.Element;
|
|
137
|
+
|
|
138
|
+
interface TypeConfig {
|
|
139
|
+
label: string;
|
|
140
|
+
icon: typeof Image;
|
|
141
|
+
color: string;
|
|
142
|
+
}
|
|
143
|
+
declare const TYPE_CONFIG: Record<string, TypeConfig>;
|
|
144
|
+
declare function typeConfigFor(type: string): TypeConfig;
|
|
145
|
+
|
|
146
|
+
declare function ImageComposer({ size, quality, imageCount, onSizeChange, onQualityChange, onImageCountChange, }: {
|
|
147
|
+
size: string;
|
|
148
|
+
quality: string;
|
|
149
|
+
imageCount: number;
|
|
150
|
+
onSizeChange: (value: string) => void;
|
|
151
|
+
onQualityChange: (value: string) => void;
|
|
152
|
+
onImageCountChange: (value: number) => void;
|
|
153
|
+
}): react.JSX.Element;
|
|
154
|
+
|
|
155
|
+
declare function VideoComposer({ duration, resolution, aspectRatio, referenceImageUrl, onDurationChange, onResolutionChange, onAspectRatioChange, onReferenceImageUrlChange, }: {
|
|
156
|
+
duration: string;
|
|
157
|
+
resolution: string;
|
|
158
|
+
aspectRatio: string;
|
|
159
|
+
referenceImageUrl: string;
|
|
160
|
+
onDurationChange: (value: string) => void;
|
|
161
|
+
onResolutionChange: (value: string) => void;
|
|
162
|
+
onAspectRatioChange: (value: string) => void;
|
|
163
|
+
onReferenceImageUrlChange: (value: string) => void;
|
|
164
|
+
}): react.JSX.Element;
|
|
165
|
+
|
|
166
|
+
declare function SpeechComposer({ voice, onVoiceChange, }: {
|
|
167
|
+
voice: string;
|
|
168
|
+
onVoiceChange: (value: string) => void;
|
|
169
|
+
}): react.JSX.Element;
|
|
170
|
+
|
|
171
|
+
declare function AvatarComposer({ audioUrl, imageUrl, avatarId, onAudioUrlChange, onImageUrlChange, onAvatarIdChange, }: {
|
|
172
|
+
audioUrl: string;
|
|
173
|
+
imageUrl: string;
|
|
174
|
+
avatarId: string;
|
|
175
|
+
onAudioUrlChange: (value: string) => void;
|
|
176
|
+
onImageUrlChange: (value: string) => void;
|
|
177
|
+
onAvatarIdChange: (value: string) => void;
|
|
178
|
+
}): react.JSX.Element;
|
|
179
|
+
|
|
180
|
+
declare function TranscriptionComposer({ audioUrl, language, onAudioUrlChange, onLanguageChange, }: {
|
|
181
|
+
audioUrl: string;
|
|
182
|
+
language: string;
|
|
183
|
+
onAudioUrlChange: (value: string) => void;
|
|
184
|
+
onLanguageChange: (value: string) => void;
|
|
185
|
+
}): react.JSX.Element;
|
|
186
|
+
declare function TranscriptionOptions({ responseFormat, temperature, onResponseFormatChange, onTemperatureChange, }: {
|
|
187
|
+
responseFormat: string;
|
|
188
|
+
temperature: string;
|
|
189
|
+
onResponseFormatChange: (value: string) => void;
|
|
190
|
+
onTemperatureChange: (value: string) => void;
|
|
191
|
+
}): react.JSX.Element;
|
|
192
|
+
|
|
193
|
+
export { AvatarComposer, ComposerDisclosure, ComposerHero, Field, GenerationCard, GenerationDetail, GenerationStatusBadge, ImageComposer, LibraryDrawer, NativeSelect, PublishPackageComposer, ResultCanvas, SpeechComposer, StudioHeader, type StudioRole, StudioSheet, StudioWorkspace, type StudioWorkspaceProps, TYPE_CONFIG, TranscriptionComposer, TranscriptionOptions, type TypeConfig, VideoComposer, typeConfigFor, useStudioGenerations };
|