@freecallai/pro 0.0.0-stage → 0.0.2

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.
Files changed (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/dist/FkpRichText.vue_vue_type_script_setup_true_lang-BuMz8Tyy.js +4416 -0
  4. package/dist/KnowledgeArea-BkRVWFrg.js +1224 -0
  5. package/dist/ToolForm-BSJxTJ7U.js +185 -0
  6. package/dist/choice-DDg5gNtS.js +29 -0
  7. package/dist/index-BVHYCLDv.js +5 -0
  8. package/dist/index-BnFTr8u9.js +49 -0
  9. package/dist/index-CG2j9Znw.js +41 -0
  10. package/dist/index-CJlAseSN.js +15 -0
  11. package/dist/index-CzpY61Qj.js +6 -0
  12. package/dist/index-D8bcFtWR.js +6 -0
  13. package/dist/index-DSgEWJGP.js +6 -0
  14. package/dist/index-DxxX09iY.js +6 -0
  15. package/dist/index-kOPLn4DD.js +5 -0
  16. package/dist/index-nnvfy5q0.js +31 -0
  17. package/dist/index-urNonkMH.js +6 -0
  18. package/dist/index.js +16 -0
  19. package/dist/inline-TT_dl8Y3.js +17 -0
  20. package/dist/knowledge-BZCmalF_.js +6 -0
  21. package/dist/knowledge-DnYGicjn.js +13 -0
  22. package/dist/media-extensions-ZoxmhIhH.js +276 -0
  23. package/dist/media-migration-Cj-3xrxd.js +59 -0
  24. package/dist/media-upload-D7DpMJYx.js +69 -0
  25. package/dist/operations-JgnjGx3H.js +19 -0
  26. package/dist/question-D1--acV8.js +10 -0
  27. package/dist/question-DGC6JHy5.js +6 -0
  28. package/dist/rich-text/index.js +224 -0
  29. package/dist/rich-text/legacy-converter/index.js +930 -0
  30. package/dist/rules-CC6NoltX.js +811 -0
  31. package/dist/selection-state-D47jhx0U.js +20 -0
  32. package/dist/state-KfOqha3d.js +16 -0
  33. package/dist/style.css +1 -0
  34. package/dist/types/index.d.ts +10 -0
  35. package/dist/types/rich-text/FkpRichText.vue.d.ts +253 -0
  36. package/dist/types/rich-text/MediaView.vue.d.ts +92 -0
  37. package/dist/types/rich-text/__demo__/conversion-fixtures.d.ts +35 -0
  38. package/dist/types/rich-text/__demo__/reasoning-template-examples.d.ts +12 -0
  39. package/dist/types/rich-text/config/catalog.d.ts +3 -0
  40. package/dist/types/rich-text/config/descriptor.d.ts +58 -0
  41. package/dist/types/rich-text/config/media-options.d.ts +6 -0
  42. package/dist/types/rich-text/config/resolve.d.ts +17 -0
  43. package/dist/types/rich-text/config/selection-options.d.ts +6 -0
  44. package/dist/types/rich-text/extensions.d.ts +6 -0
  45. package/dist/types/rich-text/index.d.ts +17 -0
  46. package/dist/types/rich-text/legacy-converter/business-attribute.d.ts +32 -0
  47. package/dist/types/rich-text/legacy-converter/index.d.ts +46 -0
  48. package/dist/types/rich-text/legacy-converter/tool-contract.d.ts +5 -0
  49. package/dist/types/rich-text/media-extensions.d.ts +4 -0
  50. package/dist/types/rich-text/media-id.d.ts +2 -0
  51. package/dist/types/rich-text/model/agent-context.d.ts +7 -0
  52. package/dist/types/rich-text/model/capability-diff.d.ts +14 -0
  53. package/dist/types/rich-text/model/condition-contract.d.ts +10 -0
  54. package/dist/types/rich-text/model/convert.d.ts +6 -0
  55. package/dist/types/rich-text/model/guard.d.ts +7 -0
  56. package/dist/types/rich-text/model/json-value.d.ts +2 -0
  57. package/dist/types/rich-text/model/media-migration.d.ts +8 -0
  58. package/dist/types/rich-text/model/node-contract.d.ts +10 -0
  59. package/dist/types/rich-text/model/node-identity.d.ts +8 -0
  60. package/dist/types/rich-text/model/persistence-contract.d.ts +25 -0
  61. package/dist/types/rich-text/model/preview.d.ts +2 -0
  62. package/dist/types/rich-text/model/question-text.d.ts +15 -0
  63. package/dist/types/rich-text/model/reasoning-context.d.ts +24 -0
  64. package/dist/types/rich-text/model/scene-snapshot.d.ts +4 -0
  65. package/dist/types/rich-text/model/validate.d.ts +19 -0
  66. package/dist/types/rich-text/model/web-url.d.ts +2 -0
  67. package/dist/types/rich-text/plugins/agentSelect/descriptor.d.ts +2 -0
  68. package/dist/types/rich-text/plugins/attribute/descriptor.d.ts +2 -0
  69. package/dist/types/rich-text/plugins/attribute/index.d.ts +2 -0
  70. package/dist/types/rich-text/plugins/block.d.ts +3 -0
  71. package/dist/types/rich-text/plugins/choice.d.ts +4 -0
  72. package/dist/types/rich-text/plugins/image/descriptor.d.ts +2 -0
  73. package/dist/types/rich-text/plugins/image/index.d.ts +2 -0
  74. package/dist/types/rich-text/plugins/inline.d.ts +3 -0
  75. package/dist/types/rich-text/plugins/media-upload.d.ts +3 -0
  76. package/dist/types/rich-text/plugins/memory/descriptor.d.ts +2 -0
  77. package/dist/types/rich-text/plugins/memory/index.d.ts +2 -0
  78. package/dist/types/rich-text/plugins/operations.d.ts +86 -0
  79. package/dist/types/rich-text/plugins/originalReply/descriptor.d.ts +2 -0
  80. package/dist/types/rich-text/plugins/originalReply/knowledge.d.ts +2 -0
  81. package/dist/types/rich-text/plugins/originalReply/question.d.ts +2 -0
  82. package/dist/types/rich-text/plugins/reasoningPolish/descriptor.d.ts +2 -0
  83. package/dist/types/rich-text/plugins/reasoningPolish/index.d.ts +3 -0
  84. package/dist/types/rich-text/plugins/reasoningTemplate/descriptor.d.ts +2 -0
  85. package/dist/types/rich-text/plugins/reasoningTemplate/index.d.ts +3 -0
  86. package/dist/types/rich-text/plugins/registry.d.ts +14 -0
  87. package/dist/types/rich-text/plugins/selection-state.d.ts +4 -0
  88. package/dist/types/rich-text/plugins/separator/descriptor.d.ts +2 -0
  89. package/dist/types/rich-text/plugins/separator/index.d.ts +2 -0
  90. package/dist/types/rich-text/plugins/state.d.ts +3 -0
  91. package/dist/types/rich-text/plugins/tagged/descriptor.d.ts +2 -0
  92. package/dist/types/rich-text/plugins/tagged/index.d.ts +2 -0
  93. package/dist/types/rich-text/plugins/ticket/descriptor.d.ts +2 -0
  94. package/dist/types/rich-text/plugins/ticket/index.d.ts +2 -0
  95. package/dist/types/rich-text/plugins/todo/descriptor.d.ts +2 -0
  96. package/dist/types/rich-text/plugins/todo/knowledge.d.ts +2 -0
  97. package/dist/types/rich-text/plugins/todo/question.d.ts +2 -0
  98. package/dist/types/rich-text/plugins/tool/descriptor.d.ts +2 -0
  99. package/dist/types/rich-text/plugins/tool/index.d.ts +2 -0
  100. package/dist/types/rich-text/plugins/tool/operations.d.ts +4 -0
  101. package/dist/types/rich-text/plugins/tool/presentation.d.ts +7 -0
  102. package/dist/types/rich-text/plugins/tool/rules.d.ts +34 -0
  103. package/dist/types/rich-text/plugins/variable/descriptor.d.ts +2 -0
  104. package/dist/types/rich-text/plugins/variable/index.d.ts +2 -0
  105. package/dist/types/rich-text/plugins/video/descriptor.d.ts +2 -0
  106. package/dist/types/rich-text/plugins/video/index.d.ts +2 -0
  107. package/dist/types/rich-text/public/types.d.ts +598 -0
  108. package/dist/types/rich-text/runtime/action-ports.d.ts +15 -0
  109. package/dist/types/rich-text/runtime/file-drop-guard.d.ts +2 -0
  110. package/dist/types/rich-text/runtime/media-policy.d.ts +15 -0
  111. package/dist/types/rich-text/runtime/media-state.d.ts +6 -0
  112. package/dist/types/rich-text/runtime/media-target.d.ts +9 -0
  113. package/dist/types/rich-text/runtime/media-upload-session.d.ts +63 -0
  114. package/dist/types/rich-text/runtime/media-upload-slots.d.ts +4 -0
  115. package/dist/types/rich-text/runtime/operations.d.ts +48 -0
  116. package/dist/types/rich-text/runtime/option-menu-session.d.ts +28 -0
  117. package/dist/types/rich-text/runtime/option-source.d.ts +10 -0
  118. package/dist/types/rich-text/runtime/port-result.d.ts +21 -0
  119. package/dist/types/rich-text/runtime/schema-plan.d.ts +17 -0
  120. package/dist/types/rich-text/runtime/tool-form-session.d.ts +39 -0
  121. package/dist/types/rich-text/runtime/tool-params.d.ts +5 -0
  122. package/dist/types/rich-text/types.d.ts +40 -0
  123. package/dist/types/rich-text/ui/CapabilityHelp.vue.d.ts +9 -0
  124. package/dist/types/rich-text/ui/KnowledgeArea.vue.d.ts +124 -0
  125. package/dist/types/rich-text/ui/ToolForm.vue.d.ts +14 -0
  126. package/dist/types/rich-text/ui/VariableOptionList.vue.d.ts +15 -0
  127. package/package.json +70 -3
@@ -0,0 +1,58 @@
1
+ import { CapabilityId, CapabilitySlot, KnowledgeType, RichTextHostPorts } from '../public/types';
2
+ export declare const optionSourcePort: {
3
+ readonly agents: "searchAgents";
4
+ readonly variables: "listVariables";
5
+ readonly flatTags: "listCapabilityOptions";
6
+ readonly capabilities: "listCapabilityOptions";
7
+ };
8
+ export declare const hostActions: {
9
+ readonly agentOpenConfig: {
10
+ readonly id: "agentSelect.openConfig";
11
+ readonly requiredPorts: readonly ["openAgentConfig"];
12
+ };
13
+ readonly imageUpload: {
14
+ readonly id: "image.upload";
15
+ readonly requiredPorts: readonly ["uploadMedia"];
16
+ };
17
+ readonly videoUpload: {
18
+ readonly id: "video.upload";
19
+ readonly requiredPorts: readonly ["uploadMedia"];
20
+ };
21
+ readonly reasoningPolishPropose: {
22
+ readonly id: "reasoningPolish.propose";
23
+ readonly requiredPorts: readonly ["proposeReasoning"];
24
+ };
25
+ readonly reasoningTemplateLoad: {
26
+ readonly id: "reasoningTemplate.load";
27
+ readonly requiredPorts: readonly ["getReasoningTemplate"];
28
+ };
29
+ };
30
+ export interface CapabilityDescriptor {
31
+ id: CapabilityId;
32
+ apiVersion: 1;
33
+ dataVersion: number;
34
+ implementation: 'plugin' | 'host';
35
+ label: string;
36
+ slot: CapabilitySlot;
37
+ order: number;
38
+ types: readonly KnowledgeType[];
39
+ icon: string;
40
+ actions?: readonly {
41
+ id: string;
42
+ requiredPorts: readonly (keyof RichTextHostPorts)[];
43
+ }[];
44
+ /** Read-only view data dependencies; they do not execute editor operations. */
45
+ readPorts?: readonly (keyof RichTextHostPorts)[];
46
+ primaryActionId?: string;
47
+ optionKind?: 'media' | 'selection';
48
+ optionSource?: keyof typeof optionSourcePort;
49
+ /** Selection menu opens on pointer hover instead of click. */
50
+ optionTrigger?: 'click' | 'hover';
51
+ /** Selection options can contain category entries that load child pages. */
52
+ optionHierarchy?: 'flat' | 'tree';
53
+ /** Ports used by host-owned selection UI before the plugin action runs. */
54
+ uiPorts?: readonly (keyof RichTextHostPorts)[];
55
+ questionTag?: {
56
+ kind: 'todo' | 'default';
57
+ };
58
+ }
@@ -0,0 +1,6 @@
1
+ export interface MediaOptions {
2
+ maxBytes?: number;
3
+ mimeTypes?: string[];
4
+ }
5
+ export declare function parseMediaOptions(value: unknown, kind: 'image' | 'video'): MediaOptions | null;
6
+ export declare function narrowMediaOptions(layers: readonly (MediaOptions | undefined)[], onWiden: () => void): MediaOptions;
@@ -0,0 +1,17 @@
1
+ import { CapabilityDescriptor } from './catalog';
2
+ import { MediaOptions } from './media-options';
3
+ import { SelectionOptions } from './selection-options';
4
+ import { EditorDiagnostic, FkpRichTextProps, KnowledgeType } from '../public/types';
5
+ export interface ResolvedCapability extends CapabilityDescriptor {
6
+ canInsert: boolean;
7
+ visible: boolean;
8
+ options?: MediaOptions | SelectionOptions;
9
+ }
10
+ export interface ResolvedSceneConfig {
11
+ type: KnowledgeType;
12
+ mode: 'editable' | 'readonly';
13
+ capabilities: ResolvedCapability[];
14
+ diagnostics: EditorDiagnostic[];
15
+ fingerprint: string;
16
+ }
17
+ export declare function resolveSceneConfig(type: KnowledgeType, input: Pick<FkpRichTextProps, 'config' | 'policy' | 'ports' | 'readonly' | 'disabled'>, now?: number): ResolvedSceneConfig;
@@ -0,0 +1,6 @@
1
+ export interface SelectionOptions {
2
+ pageSize?: number;
3
+ }
4
+ /** Parse options for paged variable, attribute, tool, Agent and template lists. */
5
+ export declare function parseSelectionOptions(value: unknown): SelectionOptions | null;
6
+ export declare function narrowSelectionOptions(layers: readonly (SelectionOptions | undefined)[], onWiden: () => void): Required<SelectionOptions>;
@@ -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, AddKnowledgeSceneRequest, 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,32 @@
1
+ /** csr-webui's bizAttributeCatalog response; IDs, keys and names are stable protocol data. */
2
+ declare const catalog: readonly [{
3
+ readonly id: 1;
4
+ readonly key: "focus_goods_name";
5
+ readonly name: "焦点商品名称";
6
+ }, {
7
+ readonly id: 2;
8
+ readonly key: "focus_goods_info";
9
+ readonly name: "焦点商品信息";
10
+ }, {
11
+ readonly id: 3;
12
+ readonly key: "focus_goods_sku";
13
+ readonly name: "焦点商品sku信息";
14
+ }, {
15
+ readonly id: 4;
16
+ readonly key: "focus_order_amount";
17
+ readonly name: "焦点订单实付金额";
18
+ }, {
19
+ readonly id: 5;
20
+ readonly key: "focus_order_status";
21
+ readonly name: "焦点订单状态";
22
+ }, {
23
+ readonly id: 6;
24
+ readonly key: "shop_name";
25
+ readonly name: "店铺名称";
26
+ }];
27
+ export type LegacyBusinessAttribute = (typeof catalog)[number];
28
+ export declare const LEGACY_BUSINESS_ATTRIBUTES: readonly LegacyBusinessAttribute[];
29
+ export declare function legacyBusinessAttributeByName(name: string): LegacyBusinessAttribute | undefined;
30
+ export declare function legacyBusinessAttributeByKey(key: string): LegacyBusinessAttribute | undefined;
31
+ export declare function legacyBusinessAttributeToken(name: string): string;
32
+ export {};
@@ -0,0 +1,46 @@
1
+ import { KnowledgeSceneV1 } from '../public/types';
2
+ export { LEGACY_BUSINESS_ATTRIBUTES } from './business-attribute';
3
+ /** The old knowledge item. Unrelated backend fields are copied through on export. */
4
+ export interface LegacyKnowledgeItem {
5
+ web_content?: string;
6
+ content?: string;
7
+ [key: string]: unknown;
8
+ }
9
+ export interface LegacyReferenceResolver {
10
+ selection?: (kind: 'todo' | 'tagged', label: string) => {
11
+ id: string;
12
+ label: string;
13
+ } | null;
14
+ variable?: (name: string) => {
15
+ key: string;
16
+ label: string;
17
+ } | null;
18
+ agent?: (name: string) => {
19
+ id: string;
20
+ name: string;
21
+ } | null;
22
+ }
23
+ export interface LegacyImportOptions {
24
+ /** The parent condition owns the question when it is absent from web_content. */
25
+ questionText?: string;
26
+ }
27
+ export interface LegacyExportOptions {
28
+ /** Real updateCondition content items normally store the question outside web_content. */
29
+ questionStorage?: 'external' | 'inline';
30
+ }
31
+ export interface ConversionIssue {
32
+ path: string;
33
+ message: string;
34
+ }
35
+ export type ConversionResult<T> = {
36
+ ok: true;
37
+ value: T;
38
+ } | {
39
+ ok: false;
40
+ issues: ConversionIssue[];
41
+ raw: unknown;
42
+ };
43
+ /** Convert a legacy HTML item to the editor's structured scene. Never mutates the input. */
44
+ export declare function legacyItemToScene(item: LegacyKnowledgeItem, sourceRecordKey: string, resolver?: LegacyReferenceResolver, options?: LegacyImportOptions): ConversionResult<KnowledgeSceneV1>;
45
+ /** Export a supported structured scene to both legacy fields. Unrelated fields pass through. */
46
+ export declare function sceneToLegacyItem(scene: KnowledgeSceneV1, baseline?: LegacyKnowledgeItem, options?: LegacyExportOptions): ConversionResult<LegacyKnowledgeItem>;
@@ -0,0 +1,5 @@
1
+ import { JSONContent } from '@tiptap/core';
2
+ export declare function parseLegacyToolText(text: string): JSONContent | null;
3
+ export declare function formatLegacyToolText(node: JSONContent): string | null;
4
+ /** Older csr-webui drafts stored encoded JSON before the explicit span protocol. */
5
+ export declare function parseEncodedOrderRemark(value: string): JSONContent | null;
@@ -0,0 +1,4 @@
1
+ import { Node } from '@tiptap/core';
2
+ export declare const MediaBlock: Node<{
3
+ sceneStyle: boolean;
4
+ }, any>;
@@ -0,0 +1,2 @@
1
+ /** Media node IDs must also work on HTTP origins where randomUUID is unavailable. */
2
+ export declare function createMediaId(): string;
@@ -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,6 @@
1
+ import { KnowledgeSceneV1, KnowledgeType } from '../public/types';
2
+ export interface SceneConversion {
3
+ scene: KnowledgeSceneV1;
4
+ removed: string[];
5
+ }
6
+ export declare function convertScene(source: KnowledgeSceneV1, targetType: KnowledgeType): SceneConversion;
@@ -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,2 @@
1
+ /** Find values that JSON serialization would drop or change before editing them. */
2
+ export declare function findNonJsonValue(value: unknown, rootPath?: string): 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,2 @@
1
+ /** Readable fallback for unknown JSON. Never inserts raw attributes or HTML. */
2
+ export declare function buildSafePreview(doc: unknown): string;
@@ -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,2 @@
1
+ /** Only browser-safe web URLs are accepted in persisted rich-text links and media. */
2
+ export declare function isWebUrl(value: unknown): value is string;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const agentSelectDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const attributeDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { SharedCapabilityImplementation } from './operations';
2
+ declare const module: SharedCapabilityImplementation;
3
+ export default module;
@@ -0,0 +1,4 @@
1
+ import { SharedCapabilityImplementation } from './operations';
2
+ /** Keep insert and in-place replacement behind the same capability action. */
3
+ declare const choice: SharedCapabilityImplementation;
4
+ export default choice;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const imageDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { SharedCapabilityImplementation } from './operations';
2
+ declare const module: SharedCapabilityImplementation;
3
+ export default module;
@@ -0,0 +1,3 @@
1
+ import { CapabilityModule } from './operations';
2
+ /** The host owns the file and pending node; the plugin only requests an asset. */
3
+ export declare function createMediaUploadModule(kind: 'image' | 'video'): CapabilityModule;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const memoryDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -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,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const originalReplyDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const reasoningPolishDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,3 @@
1
+ import { CapabilityModule } from '../operations';
2
+ declare const module: CapabilityModule;
3
+ export default module;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const reasoningTemplateDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,3 @@
1
+ import { CapabilityModule } from '../operations';
2
+ declare const module: CapabilityModule;
3
+ export default module;
@@ -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,4 @@
1
+ import { SharedCapabilityImplementation } from './operations';
2
+ /** An option selection enables the switch; toggling it preserves the selected option. */
3
+ declare const selectionState: SharedCapabilityImplementation;
4
+ export default selectionState;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const separatorDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { SharedCapabilityImplementation } from './operations';
2
+ declare const module: SharedCapabilityImplementation;
3
+ export default module;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const taggedDescriptors: readonly CapabilityDescriptor[];
@@ -0,0 +1,2 @@
1
+ declare const _default: import('../operations').CapabilityModule;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import { CapabilityDescriptor } from '../../config/descriptor';
2
+ export declare const ticketDescriptors: readonly CapabilityDescriptor[];