@freecallai/pro 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +16 -2
- package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-DnknqQTh.js +4115 -0
- package/dist/KnowledgeArea-OPR7smbt.js +923 -0
- package/dist/ToolForm-CWpUIVTl.js +185 -0
- package/dist/choice-DDg5gNtS.js +29 -0
- package/dist/guard-BCatAeT4.js +749 -0
- package/dist/index-5a9mHHzg.js +41 -0
- package/dist/index-BsQLwz91.js +5 -0
- package/dist/index-CJlAseSN.js +15 -0
- package/dist/index-CzpY61Qj.js +6 -0
- package/dist/index-D8bcFtWR.js +6 -0
- package/dist/index-DOEijEGU.js +49 -0
- package/dist/index-DSgEWJGP.js +6 -0
- package/dist/index-DxxX09iY.js +6 -0
- package/dist/index-nnvfy5q0.js +31 -0
- package/dist/index-urNonkMH.js +6 -0
- package/dist/index-xAjlBylT.js +5 -0
- package/dist/index.js +16 -0
- package/dist/inline-TT_dl8Y3.js +17 -0
- package/dist/knowledge-BZCmalF_.js +6 -0
- package/dist/knowledge-DnYGicjn.js +13 -0
- package/dist/media-extensions-ZoxmhIhH.js +276 -0
- package/dist/media-migration-CGOFwdYm.js +59 -0
- package/dist/media-upload-Dx45yv6a.js +69 -0
- package/dist/operations-JgnjGx3H.js +19 -0
- package/dist/question-D1--acV8.js +10 -0
- package/dist/question-DGC6JHy5.js +6 -0
- package/dist/rich-text/index.js +224 -0
- package/dist/rich-text/legacy-converter/index.js +485 -0
- package/dist/selection-state-D47jhx0U.js +20 -0
- package/dist/state-KfOqha3d.js +16 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/rich-text/FkpRichText.vue.d.ts +242 -0
- package/dist/types/rich-text/MediaView.vue.d.ts +92 -0
- package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +35 -0
- package/dist/types/rich-text/config/catalog.d.ts +3 -0
- package/dist/types/rich-text/config/descriptor.d.ts +58 -0
- package/dist/types/rich-text/config/media-options.d.ts +6 -0
- package/dist/types/rich-text/config/resolve.d.ts +17 -0
- package/dist/types/rich-text/config/selection-options.d.ts +6 -0
- package/dist/types/rich-text/extensions.d.ts +6 -0
- package/dist/types/rich-text/index.d.ts +17 -0
- package/dist/types/rich-text/legacy-converter/index.d.ts +45 -0
- package/dist/types/rich-text/media-extensions.d.ts +4 -0
- package/dist/types/rich-text/media-id.d.ts +2 -0
- package/dist/types/rich-text/model/agent-context.d.ts +7 -0
- package/dist/types/rich-text/model/capability-diff.d.ts +14 -0
- package/dist/types/rich-text/model/condition-contract.d.ts +10 -0
- package/dist/types/rich-text/model/convert.d.ts +6 -0
- package/dist/types/rich-text/model/guard.d.ts +7 -0
- package/dist/types/rich-text/model/json-value.d.ts +2 -0
- package/dist/types/rich-text/model/media-migration.d.ts +8 -0
- package/dist/types/rich-text/model/node-contract.d.ts +10 -0
- package/dist/types/rich-text/model/node-identity.d.ts +8 -0
- package/dist/types/rich-text/model/persistence-contract.d.ts +25 -0
- package/dist/types/rich-text/model/preview.d.ts +2 -0
- package/dist/types/rich-text/model/question-text.d.ts +15 -0
- package/dist/types/rich-text/model/reasoning-context.d.ts +24 -0
- package/dist/types/rich-text/model/scene-snapshot.d.ts +4 -0
- package/dist/types/rich-text/model/validate.d.ts +19 -0
- package/dist/types/rich-text/model/web-url.d.ts +2 -0
- package/dist/types/rich-text/plugins/agentSelect/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/attribute/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/block.d.ts +3 -0
- package/dist/types/rich-text/plugins/choice.d.ts +4 -0
- package/dist/types/rich-text/plugins/image/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/image/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/inline.d.ts +3 -0
- package/dist/types/rich-text/plugins/media-upload.d.ts +3 -0
- package/dist/types/rich-text/plugins/memory/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/memory/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/operations.d.ts +86 -0
- package/dist/types/rich-text/plugins/originalReply/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/originalReply/knowledge.d.ts +2 -0
- package/dist/types/rich-text/plugins/originalReply/question.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningPolish/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningPolish/index.d.ts +3 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/reasoningTemplate/index.d.ts +3 -0
- package/dist/types/rich-text/plugins/registry.d.ts +14 -0
- package/dist/types/rich-text/plugins/selection-state.d.ts +4 -0
- package/dist/types/rich-text/plugins/separator/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/separator/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/state.d.ts +3 -0
- package/dist/types/rich-text/plugins/tagged/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tagged/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/ticket/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/ticket/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/knowledge.d.ts +2 -0
- package/dist/types/rich-text/plugins/todo/question.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/tool/operations.d.ts +4 -0
- package/dist/types/rich-text/plugins/tool/presentation.d.ts +7 -0
- package/dist/types/rich-text/plugins/variable/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/variable/index.d.ts +2 -0
- package/dist/types/rich-text/plugins/video/descriptor.d.ts +2 -0
- package/dist/types/rich-text/plugins/video/index.d.ts +2 -0
- package/dist/types/rich-text/public/types.d.ts +588 -0
- package/dist/types/rich-text/runtime/action-ports.d.ts +15 -0
- package/dist/types/rich-text/runtime/media-state.d.ts +6 -0
- package/dist/types/rich-text/runtime/media-target.d.ts +8 -0
- package/dist/types/rich-text/runtime/media-upload-session.d.ts +59 -0
- package/dist/types/rich-text/runtime/operations.d.ts +48 -0
- package/dist/types/rich-text/runtime/option-menu-session.d.ts +28 -0
- package/dist/types/rich-text/runtime/option-source.d.ts +10 -0
- package/dist/types/rich-text/runtime/port-result.d.ts +21 -0
- package/dist/types/rich-text/runtime/schema-plan.d.ts +17 -0
- package/dist/types/rich-text/runtime/tool-form-session.d.ts +39 -0
- package/dist/types/rich-text/runtime/tool-params.d.ts +5 -0
- package/dist/types/rich-text/types.d.ts +40 -0
- package/dist/types/rich-text/ui/CapabilityHelp.vue.d.ts +9 -0
- package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +117 -0
- package/dist/types/rich-text/ui/ToolForm.vue.d.ts +14 -0
- package/dist/types/rich-text/ui/VariableOptionList.vue.d.ts +15 -0
- package/package.json +70 -3
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Extension, Node } from '@tiptap/core';
|
|
2
|
+
/** Keep copied extension nodes distinct without changing later original IDs. */
|
|
3
|
+
export declare const UniqueExtensionNodeIds: Extension<any, any>;
|
|
4
|
+
export declare const BusinessToken: Node<any, any>;
|
|
5
|
+
export declare const OriginalReply: Node<any, any>;
|
|
6
|
+
export declare const MessageSeparator: Node<any, any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { default } from './FkpRichText.vue';
|
|
2
|
+
export { default as FkpRichText } from './FkpRichText.vue';
|
|
3
|
+
export type { FkpRichTextProps, FkpRichTextHandle, KnowledgeSceneV1, KnowledgeConditionV1, MigrationIssueV1, LoadedConditionV1, LegacyReadonlyConditionV1, ConditionLoadV1, SaveConditionInputV1, SavedConditionV1, KnowledgePersistenceAdapterV1, KnowledgeType, CapabilityId, CapabilitySlot, CapabilityRuleV1, SceneConfigInputV1, RichTextHostPorts, PortRequestContext, PortResult, PortErrorCode, Page, CapabilityOption, ToolFormField, ToolFormDefinition, VariableOption, AgentSummary, AgentPrompt, MediaAsset, SceneConfigLayersV1, HostPolicySnapshotV1, EditorDiagnostic, ChangeMeta, } from './public/types';
|
|
4
|
+
export { emptyScene, emptyDoc } from './public/types';
|
|
5
|
+
export { resolveSceneConfig } from './config/resolve';
|
|
6
|
+
export { validateKnowledgeScenes } from './model/validate';
|
|
7
|
+
export { parseKnowledgeConditionV1 } from './model/condition-contract';
|
|
8
|
+
export type { ConditionParseResult } from './model/condition-contract';
|
|
9
|
+
export { parseConditionLoadResult, parseLoadedConditionResult, parseSaveConditionInput, parseSavedConditionResult, verifySavedConditionEcho, } from './model/persistence-contract';
|
|
10
|
+
export type { SavedConditionEchoResult } from './model/persistence-contract';
|
|
11
|
+
export { assignLegacyExtensionIds, assignLegacyMediaIds, } from './model/media-migration';
|
|
12
|
+
export { buildReasoningReferenceContext } from './model/reasoning-context';
|
|
13
|
+
export type { ReasoningReferenceContext } from './model/reasoning-context';
|
|
14
|
+
export { buildAgentInvocationContext } from './model/agent-context';
|
|
15
|
+
export type { AgentInvocationContext } from './model/agent-context';
|
|
16
|
+
export { serializeQuestionForModel, serializeQuestionTagsForModel, } from './model/question-text';
|
|
17
|
+
export type { SceneValidationResult, SceneValidationIssue, } from './model/validate';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
2
|
+
/** The old knowledge item. Unrelated backend fields are copied through on export. */
|
|
3
|
+
export interface LegacyKnowledgeItem {
|
|
4
|
+
web_content?: string;
|
|
5
|
+
content?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface LegacyReferenceResolver {
|
|
9
|
+
selection?: (kind: 'todo' | 'tagged', label: string) => {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
} | null;
|
|
13
|
+
variable?: (name: string) => {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
} | null;
|
|
17
|
+
agent?: (name: string) => {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
} | null;
|
|
21
|
+
}
|
|
22
|
+
export interface LegacyImportOptions {
|
|
23
|
+
/** The parent condition owns the question when it is absent from web_content. */
|
|
24
|
+
questionText?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface LegacyExportOptions {
|
|
27
|
+
/** Real updateCondition content items normally store the question outside web_content. */
|
|
28
|
+
questionStorage?: 'external' | 'inline';
|
|
29
|
+
}
|
|
30
|
+
export interface ConversionIssue {
|
|
31
|
+
path: string;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
export type ConversionResult<T> = {
|
|
35
|
+
ok: true;
|
|
36
|
+
value: T;
|
|
37
|
+
} | {
|
|
38
|
+
ok: false;
|
|
39
|
+
issues: ConversionIssue[];
|
|
40
|
+
raw: unknown;
|
|
41
|
+
};
|
|
42
|
+
/** Convert a legacy HTML item to the editor's structured scene. Never mutates the input. */
|
|
43
|
+
export declare function legacyItemToScene(item: LegacyKnowledgeItem, sourceRecordKey: string, resolver?: LegacyReferenceResolver, options?: LegacyImportOptions): ConversionResult<KnowledgeSceneV1>;
|
|
44
|
+
/** Export a supported structured scene to both legacy fields. Unrelated fields pass through. */
|
|
45
|
+
export declare function sceneToLegacyItem(scene: KnowledgeSceneV1, baseline?: LegacyKnowledgeItem, options?: LegacyExportOptions): ConversionResult<LegacyKnowledgeItem>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
2
|
+
export interface AgentInvocationContext {
|
|
3
|
+
knowledgeType: 'agent';
|
|
4
|
+
agentId: string;
|
|
5
|
+
}
|
|
6
|
+
/** Backend-neutral Agent identity for the consumer's algorithm request adapter. */
|
|
7
|
+
export declare function buildAgentInvocationContext(scene: KnowledgeSceneV1): AgentInvocationContext;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { CapabilityId, CapabilitySlot } from '../public/types';
|
|
3
|
+
interface CapabilityAccess {
|
|
4
|
+
id: CapabilityId;
|
|
5
|
+
slot: CapabilitySlot;
|
|
6
|
+
canInsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
type CapabilityUse = {
|
|
9
|
+
id: CapabilityId;
|
|
10
|
+
slot: CapabilitySlot;
|
|
11
|
+
};
|
|
12
|
+
/** Existing disabled nodes may survive edits; new instances may not be inserted. */
|
|
13
|
+
export declare function findAddedDisabledCapability(previous: JSONContent | null, next: JSONContent | null, capabilities: readonly CapabilityAccess[]): CapabilityUse | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { KnowledgeConditionV1 } from '../public/types';
|
|
2
|
+
export type ConditionParseResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
data: KnowledgeConditionV1;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
/** Parse a complete, backend-neutral condition without discarding unknown fields. */
|
|
10
|
+
export declare function parseKnowledgeConditionV1(input: unknown): ConditionParseResult;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
3
|
+
export declare const isKnownNodeType: (type: string) => boolean;
|
|
4
|
+
export declare function findUnsupportedContent(doc: JSONContent | null, rootPath?: string): string | null;
|
|
5
|
+
/** The minimum shape required for the scene shell to render safely. */
|
|
6
|
+
export declare function isRenderableSceneShell(value: unknown): value is KnowledgeSceneV1;
|
|
7
|
+
export declare function findUnsupportedScene(value: unknown): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
/** Assign stable IDs and missing node versions before saving legacy JSON. */
|
|
3
|
+
export declare function assignLegacyExtensionIds(source: JSONContent, sourceRecordKey: string): {
|
|
4
|
+
doc: JSONContent;
|
|
5
|
+
changed: boolean;
|
|
6
|
+
};
|
|
7
|
+
/** Kept for existing media migration callers; now reserves all extension IDs. */
|
|
8
|
+
export declare const assignLegacyMediaIds: typeof assignLegacyExtensionIds;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Persisted node kinds. A new kind must be added here before it can enter a scene. */
|
|
2
|
+
export declare const BUSINESS_TOKEN_KINDS: readonly ["todo", "ticket", "variable", "attribute", "tool", "separator"];
|
|
3
|
+
export type BusinessTokenKind = (typeof BUSINESS_TOKEN_KINDS)[number];
|
|
4
|
+
export declare const CHOICE_TOKEN_KINDS: readonly ["todo", "ticket", "attribute"];
|
|
5
|
+
export type ChoiceTokenKind = (typeof CHOICE_TOKEN_KINDS)[number];
|
|
6
|
+
export declare const MEDIA_KINDS: readonly ["image", "video"];
|
|
7
|
+
export type MediaKind = (typeof MEDIA_KINDS)[number];
|
|
8
|
+
export declare const isBusinessTokenKind: (value: unknown) => value is BusinessTokenKind;
|
|
9
|
+
export declare const isChoiceTokenKind: (value: unknown) => value is ChoiceTokenKind;
|
|
10
|
+
export declare const isMediaKind: (value: unknown) => value is MediaKind;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
export declare const isIdentifiedNodeType: (type: string) => boolean;
|
|
3
|
+
export declare function ownerOfIdentifiedNode(type: string, attrs?: Record<string, unknown>): string | null;
|
|
4
|
+
export declare function hasNestedIdentifiedNode(node: JSONContent): boolean;
|
|
5
|
+
export declare const trustedNodeIdsMeta = "fkpTrustedNodeIds";
|
|
6
|
+
export declare function collectIdentifiedNodeIds(content: JSONContent | JSONContent[]): string[];
|
|
7
|
+
/** Avoid an unbounded loop if the ID source repeatedly collides. */
|
|
8
|
+
export declare function allocateUniqueNodeId(reserved: ReadonlySet<string>, createId: () => string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConditionLoadV1, LoadedConditionV1, PortResult, SaveConditionInputV1, SavedConditionV1 } from '../public/types';
|
|
2
|
+
type SaveInputParseResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
data: SaveConditionInputV1;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
/** Validate a save request before a consumer adapter maps it to HTTP fields. */
|
|
10
|
+
export declare function parseSaveConditionInput(input: unknown): SaveInputParseResult;
|
|
11
|
+
/** Keep transport errors while rejecting incomplete structured load payloads. */
|
|
12
|
+
export declare function parseLoadedConditionResult(raw: unknown): PortResult<LoadedConditionV1>;
|
|
13
|
+
/** Preserve unconvertible legacy conditions without passing them to the new editor. */
|
|
14
|
+
export declare function parseConditionLoadResult(raw: unknown): PortResult<ConditionLoadV1>;
|
|
15
|
+
/** A successful save must return a complete condition and opaque revision. */
|
|
16
|
+
export declare function parseSavedConditionResult(raw: unknown): PortResult<SavedConditionV1>;
|
|
17
|
+
export type SavedConditionEchoResult = {
|
|
18
|
+
ok: true;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
path: string;
|
|
22
|
+
};
|
|
23
|
+
/** Check that readback preserved every submitted scene and its order. */
|
|
24
|
+
export declare function verifySavedConditionEcho(input: unknown, response: unknown): SavedConditionEchoResult;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
2
|
+
type SelectionCapability = 'todo' | 'tagged';
|
|
3
|
+
/** Historical/current brackets and line breaks are reserved intent delimiters. */
|
|
4
|
+
export declare function hasQuestionDelimiter(text: string): boolean;
|
|
5
|
+
/** Plan labels must remain one unambiguous model-protocol token. */
|
|
6
|
+
export declare function hasPlanLabelDelimiter(label: string): boolean;
|
|
7
|
+
export declare function selectedQuestionOption(scene: KnowledgeSceneV1, id: SelectionCapability): {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
} | null;
|
|
11
|
+
/** Serialize display-only question selections for the model request boundary. */
|
|
12
|
+
export declare function serializeQuestionTagsForModel(scene: KnowledgeSceneV1): string;
|
|
13
|
+
/** Produces the complete intent line when the host sends a prompt to the model. */
|
|
14
|
+
export declare function serializeQuestionForModel(scene: KnowledgeSceneV1): string;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
2
|
+
export interface ReasoningReferenceContext {
|
|
3
|
+
/** The consumer maps this field to its real algorithm request contract. */
|
|
4
|
+
knowledgeType: 'reasoning';
|
|
5
|
+
tickets: Array<{
|
|
6
|
+
nodeId: string;
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}>;
|
|
10
|
+
attributes: Array<{
|
|
11
|
+
nodeId: string;
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
value: unknown;
|
|
15
|
+
}>;
|
|
16
|
+
tools: Array<{
|
|
17
|
+
nodeId: string;
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
params: Record<string, unknown>;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/** Build backend-neutral reference data; the host resolves attribute values. */
|
|
24
|
+
export declare function buildReasoningReferenceContext(scene: KnowledgeSceneV1, attributeValues: Record<string, unknown>): ReasoningReferenceContext;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
2
|
+
/** Compare semantic JSON values independently of object key insertion order. */
|
|
3
|
+
export declare function canonicalJsonSnapshot(value: unknown): string;
|
|
4
|
+
export declare function canonicalSceneSnapshot(scene: KnowledgeSceneV1): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { KnowledgeSceneV1 } from '../public/types';
|
|
3
|
+
export type SceneValidationCode = 'EMPTY_CONTENT' | 'AGENT_REQUIRED' | 'EMPTY_CONTENT_AND_AGENT' | 'DUPLICATE_INTENT' | 'INVALID_INTENT_BRACKET' | 'TOO_LONG' | 'MEDIA_PENDING' | 'UNSUPPORTED_CONTENT' | 'SCHEMA_VERSION';
|
|
4
|
+
export interface SceneValidationIssue {
|
|
5
|
+
code: SceneValidationCode;
|
|
6
|
+
sceneIndex: number | null;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SceneValidationResult {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
characterCount: number;
|
|
12
|
+
issues: SceneValidationIssue[];
|
|
13
|
+
}
|
|
14
|
+
export declare function hasPendingMedia(scene: KnowledgeSceneV1): boolean;
|
|
15
|
+
export declare function hasKnowledgeContent(doc: JSONContent | null): boolean;
|
|
16
|
+
/** Validate the complete condition before the host submits it to its backend. */
|
|
17
|
+
export declare function validateKnowledgeScenes(scenes: readonly KnowledgeSceneV1[], options?: {
|
|
18
|
+
maxCharacters?: number;
|
|
19
|
+
}): SceneValidationResult;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { CapabilityId, CapabilitySlot, KnowledgeSceneV1, PortRequestContext, PortResult, RichTextHostPorts } from '../public/types';
|
|
3
|
+
export type PluginOperation = {
|
|
4
|
+
kind: 'setOwnState';
|
|
5
|
+
capabilityId: CapabilityId;
|
|
6
|
+
data: Record<string, unknown>;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'insertOwnToken';
|
|
9
|
+
capabilityId: CapabilityId;
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
token?: string;
|
|
13
|
+
params?: Record<string, unknown>;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'insertOwnBlock';
|
|
16
|
+
capabilityId: CapabilityId;
|
|
17
|
+
block: 'originalReply';
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'replaceSceneDoc';
|
|
20
|
+
capabilityId: CapabilityId;
|
|
21
|
+
doc: JSONContent;
|
|
22
|
+
question?: string;
|
|
23
|
+
confirmation: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'updateOwnNode';
|
|
26
|
+
capabilityId: CapabilityId;
|
|
27
|
+
nodeId: string;
|
|
28
|
+
expectedNodeVersion: number;
|
|
29
|
+
node: JSONContent;
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'removeOwnNode';
|
|
32
|
+
capabilityId: CapabilityId;
|
|
33
|
+
nodeId: string;
|
|
34
|
+
expectedNodeVersion: number;
|
|
35
|
+
};
|
|
36
|
+
interface OptionInput {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
token?: string;
|
|
40
|
+
params?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
/** An edit always has a replacement choice; media uploads cannot carry menu data. */
|
|
43
|
+
export type PluginInput = {
|
|
44
|
+
option: OptionInput;
|
|
45
|
+
edit?: {
|
|
46
|
+
nodeId: string;
|
|
47
|
+
nodeVersion: number;
|
|
48
|
+
};
|
|
49
|
+
upload?: never;
|
|
50
|
+
} | {
|
|
51
|
+
upload: {
|
|
52
|
+
file: File;
|
|
53
|
+
nodeId: string;
|
|
54
|
+
expectedNodeVersion: number;
|
|
55
|
+
};
|
|
56
|
+
option?: never;
|
|
57
|
+
edit?: never;
|
|
58
|
+
} | {
|
|
59
|
+
option?: never;
|
|
60
|
+
edit?: never;
|
|
61
|
+
upload?: never;
|
|
62
|
+
};
|
|
63
|
+
export interface PluginActionContext {
|
|
64
|
+
scene: Readonly<KnowledgeSceneV1>;
|
|
65
|
+
sceneKey: string;
|
|
66
|
+
revision: number;
|
|
67
|
+
options: unknown;
|
|
68
|
+
request: PortRequestContext;
|
|
69
|
+
ports: Readonly<Partial<RichTextHostPorts>>;
|
|
70
|
+
}
|
|
71
|
+
export interface CapabilityAction {
|
|
72
|
+
execute(input: PluginInput, context: PluginActionContext): Promise<PortResult<readonly PluginOperation[]>>;
|
|
73
|
+
}
|
|
74
|
+
export interface CapabilityModule {
|
|
75
|
+
id: CapabilityId;
|
|
76
|
+
slot: CapabilitySlot;
|
|
77
|
+
apiVersion: 1;
|
|
78
|
+
dataVersion: number;
|
|
79
|
+
actions: Readonly<Record<string, CapabilityAction>>;
|
|
80
|
+
}
|
|
81
|
+
/** Shared behavior used by individual, identity-bound plugin modules. */
|
|
82
|
+
export interface SharedCapabilityImplementation {
|
|
83
|
+
execute(id: CapabilityId, input: PluginInput, scene: Readonly<KnowledgeSceneV1>): readonly PluginOperation[];
|
|
84
|
+
}
|
|
85
|
+
export declare function bindCapability(id: CapabilityId, slot: CapabilitySlot, implementation: SharedCapabilityImplementation): CapabilityModule;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CapabilityDescriptor } from '../config/descriptor';
|
|
2
|
+
import { CapabilityModule } from './operations';
|
|
3
|
+
export type CapabilityLoader = () => Promise<{
|
|
4
|
+
default: CapabilityModule;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function validateCapabilityModule(descriptor: CapabilityDescriptor, value: unknown): value is CapabilityModule;
|
|
7
|
+
export type CapabilityLoadResult = {
|
|
8
|
+
ok: true;
|
|
9
|
+
module: CapabilityModule;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
reason: 'NOT_REGISTERED' | 'VERSION_MISMATCH';
|
|
13
|
+
};
|
|
14
|
+
export declare function loadCapability(descriptor: CapabilityDescriptor): Promise<CapabilityLoadResult>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ToolTokenPresentation {
|
|
2
|
+
label: string;
|
|
3
|
+
iconGlyph: string;
|
|
4
|
+
summary: string;
|
|
5
|
+
}
|
|
6
|
+
/** Built-in tool display rules live with the tool plugin, not the editor schema. */
|
|
7
|
+
export declare function getToolTokenPresentation(key: unknown, params: unknown): ToolTokenPresentation | null;
|