File size: 22,426 Bytes
096d5ee |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
/**
* universal-symbolics-schema.ts
*
* A unified schema definition for symbolic operations across all frontier language models.
* This schema maps vendor-specific symbolic grammars to a universal interface.
*/
/**
* Core symbolic primitive types supported by the universal runtime
*/
export enum SymbolicPrimitiveType {
THINKING = 'thinking', // Explicit reasoning traces
REFLECTION = 'reflection', // Self-examination of reasoning
TOOL_USE = 'tool_use', // Function/tool invocation
SYSTEM = 'system', // System-level directives
FORK = 'fork', // Multiple reasoning paths
RECURSION = 'recursion', // Self-referential operations
ATTENTION = 'attention', // Focus control
COLLAPSE = 'collapse', // Error handling
METACOGNITION = 'metacognition', // Higher-order reasoning
ATTRIBUTION = 'attribution', // Source tracking
UNCERTAINTY = 'uncertainty', // Confidence representation
CONTEXT = 'context', // Context management
HESITATION = 'hesitation', // Processing delays
MEMORY = 'memory' // State persistence
}
/**
* Vendor identification for language model providers
*/
export enum VendorType {
CLAUDE = 'claude', // Anthropic Claude models
OPENAI = 'openai', // OpenAI GPT models
QWEN = 'qwen', // Alibaba Qwen models
GEMINI = 'gemini', // Google Gemini models
DEEPSEEK = 'deepseek', // DeepSeek models
LLAMA = 'llama', // Meta Llama models
MIXTRAL = 'mixtral', // Mistral AI models
FALCON = 'falcon', // TII Falcon models
LOCAL = 'local', // Local LLM instances
UNIVERSAL = 'universal' // Vendor-agnostic representation
}
/**
* Grammar style for symbolic operations
*/
export enum GrammarStyle {
XML_TAGS = 'xml_tags', // <tag>content</tag>
SLASH_COMMANDS = 'slash_commands', // /command or /command content
FUNCTION_CALLS = 'function_calls', // function_name(params)
GLYPH_MARKERS = 'glyph_markers', // π or other special characters
DOT_COMMANDS = 'dot_commands', // .p/command{params}
SYSTEM_PROMPT = 'system_prompt', // System prompt prefixes
TEMPLATE_MARKERS = 'template_markers', // {{marker}}
PREFIX_MARKERS = 'prefix_markers', // ### marker or similar
BRACKET_SYNTAX = 'bracket_syntax' // [command:params]
}
/**
* Parameter type for symbolic operations
*/
export enum ParameterType {
STRING = 'string',
NUMBER = 'number',
BOOLEAN = 'boolean',
OBJECT = 'object',
ARRAY = 'array',
NULL = 'null'
}
/**
* Parameter definition for symbolic operations
*/
export interface ParameterDefinition {
name: string;
type: ParameterType;
description: string;
required: boolean;
default?: any;
}
/**
* Symbolic grammar representation for a specific vendor
*/
export interface VendorGrammar {
vendor: VendorType;
style: GrammarStyle;
prefix?: string;
suffix?: string;
separator?: string;
escapeSequence?: string;
parameterFormat?: 'json' | 'csv' | 'key_value' | 'positional' | 'custom';
isNative: boolean; // Whether the vendor natively supports this symbolic primitive
implementation: string; // Example of the implementation
apiForm?: string; // How it's represented in the API
notes?: string; // Additional notes on implementation
}
/**
* Complete definition of a symbolic primitive
*/
export interface SymbolicPrimitive {
type: SymbolicPrimitiveType;
name: string;
description: string;
parameters: ParameterDefinition[];
vendorGrammars: VendorGrammar[];
universalImplementation: string;
aliases?: string[];
glyphs?: string[]; // Associated glyphs/emojis
tags?: string[]; // Associated XML tags
slashes?: string[]; // Associated slash commands
}
/**
* The complete schema of all symbolic primitives
*/
export const SYMBOLIC_SCHEMA: SymbolicPrimitive[] = [
// THINKING primitive
{
type: SymbolicPrimitiveType.THINKING,
name: 'thinking',
description: 'Explicit reasoning trace for step-by-step thinking',
parameters: [
{
name: 'content',
type: ParameterType.STRING,
description: 'The thinking content',
required: false
},
{
name: 'trace',
type: ParameterType.BOOLEAN,
description: 'Whether to include thinking trace in response',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.XML_TAGS,
prefix: '<think>',
suffix: '</think>',
isNative: true,
implementation: '<think>Reasoning step by step...</think>',
apiForm: 'XML tags in prompt'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.FUNCTION_CALLS,
isNative: false,
implementation: '/* Reasoning step by step... */',
apiForm: 'tool_choice parameter or tool function',
notes: 'Not natively supported but can be emulated'
},
{
vendor: VendorType.QWEN,
style: GrammarStyle.SLASH_COMMANDS,
prefix: '/think',
isNative: true,
implementation: '/think Reasoning step by step...',
apiForm: 'slash command in prompt'
},
{
vendor: VendorType.GEMINI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Think step by step: Reasoning...',
apiForm: 'system prompt directive',
notes: 'Emulated via system prompt instructions'
},
{
vendor: VendorType.DEEPSEEK,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Rational thinking mode: Reasoning...',
apiForm: 'system prompt directive',
notes: 'Emulated via rational thinking mode'
}
],
universalImplementation: '.p/think{content}',
aliases: ['reasoning', 'thought', 'trace'],
glyphs: ['π§ ', 'π', 'π€'],
tags: ['think', 'reasoning', 'thought'],
slashes: ['/think', '/reasoning', '/thought']
},
// REFLECTION primitive
{
type: SymbolicPrimitiveType.REFLECTION,
name: 'reflection',
description: 'Self-reference and examination of reasoning processes',
parameters: [
{
name: 'target',
type: ParameterType.STRING,
description: 'What to reflect on',
required: true
},
{
name: 'depth',
type: ParameterType.NUMBER,
description: 'Depth of reflection',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.XML_TAGS,
prefix: '<reflect>',
suffix: '</reflect>',
isNative: false,
implementation: '<reflect>Reflecting on my approach...</reflect>',
apiForm: 'XML tags in prompt',
notes: 'Not officially documented but sometimes supported'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Reflect on: Analyzing my approach...',
apiForm: 'Chain-of-thought prompting',
notes: 'Emulated via system prompting'
},
{
vendor: VendorType.QWEN,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Reflect on your approach to...',
apiForm: 'System prompt directive',
notes: 'Emulated via system prompting'
}
],
universalImplementation: '.p/reflect{target, depth}',
aliases: ['introspect', 'meta', 'review'],
glyphs: ['π', 'πͺ', 'ποΈ'],
tags: ['reflect', 'introspect', 'mirror'],
slashes: ['/reflect', '/introspect', '/review']
},
// TOOL_USE primitive
{
type: SymbolicPrimitiveType.TOOL_USE,
name: 'tool',
description: 'Invoke a tool or function',
parameters: [
{
name: 'name',
type: ParameterType.STRING,
description: 'Tool name',
required: true
},
{
name: 'params',
type: ParameterType.OBJECT,
description: 'Tool parameters',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.XML_TAGS,
prefix: '<tool>',
suffix: '</tool>',
isNative: true,
implementation: '<tool>search({"query": "quantum physics"})</tool>',
apiForm: 'XML tags in prompt'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.FUNCTION_CALLS,
isNative: true,
implementation: '/command search quantum physics',
apiForm: 'function_call parameter in API',
notes: 'Native API support and slash commands in interface'
},
{
vendor: VendorType.QWEN,
style: GrammarStyle.FUNCTION_CALLS,
isNative: true,
implementation: 'MCP tool call format',
apiForm: 'MCP protocol tool calls',
notes: 'Supports multi-round collaborative protocol'
},
{
vendor: VendorType.GEMINI,
style: GrammarStyle.FUNCTION_CALLS,
isNative: true,
implementation: '@google/search quantum physics',
apiForm: 'functionDeclarations parameter in API',
notes: 'Supported through function calling API'
}
],
universalImplementation: '.p/tool{name, params}',
aliases: ['function', 'command', 'action'],
glyphs: ['π οΈ', 'βοΈ', 'π§'],
tags: ['tool', 'function', 'command'],
slashes: ['/tool', '/function', '/command']
},
// SYSTEM primitive
{
type: SymbolicPrimitiveType.SYSTEM,
name: 'system',
description: 'System-level directives',
parameters: [
{
name: 'directive',
type: ParameterType.STRING,
description: 'System directive',
required: true
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.XML_TAGS,
prefix: '<s>',
suffix: '</s>',
isNative: true,
implementation: '<s>You are a helpful assistant.</s>',
apiForm: 'XML tags in prompt or system parameter in API'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: true,
implementation: 'System: You are a helpful assistant.',
apiForm: 'system parameter in API',
notes: 'Natively supported through API'
},
{
vendor: VendorType.QWEN,
style: GrammarStyle.PREFIX_MARKERS,
prefix: '<<SYS>>',
isNative: true,
implementation: '<<SYS>> You are a helpful assistant.',
apiForm: 'system parameter in API'
},
{
vendor: VendorType.GEMINI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: true,
implementation: 'System: You are a helpful assistant.',
apiForm: 'system parameter in API'
}
],
universalImplementation: '.p/system{directive}',
aliases: ['directive', 'instruction', 'control'],
glyphs: ['βοΈ', 'π§', 'π οΈ'],
tags: ['system', 'directive', 'instruction'],
slashes: ['/system', '/directive', '/instruction']
},
// FORK primitive
{
type: SymbolicPrimitiveType.FORK,
name: 'fork',
description: 'Create parallel reasoning paths',
parameters: [
{
name: 'paths',
type: ParameterType.ARRAY,
description: 'Different paths to explore',
required: true
},
{
name: 'weights',
type: ParameterType.ARRAY,
description: 'Weights for each path',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Explore these different paths: 1) Path A, 2) Path B',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Explore these different paths: 1) Path A, 2) Path B',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
}
],
universalImplementation: '.p/fork{paths, weights}',
aliases: ['branch', 'split', 'diverge'],
glyphs: ['πΏ', 'π', 'β'],
tags: ['fork', 'branch', 'split'],
slashes: ['/fork', '/branch', '/split']
},
// COLLAPSE primitive
{
type: SymbolicPrimitiveType.COLLAPSE,
name: 'collapse',
description: 'Error handling and recovery',
parameters: [
{
name: 'trigger',
type: ParameterType.STRING,
description: 'What triggers the collapse',
required: false
},
{
name: 'threshold',
type: ParameterType.NUMBER,
description: 'Threshold for collapse',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'If you encounter an error, handle it by...',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'If you encounter an error, handle it by...',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
}
],
universalImplementation: '.p/collapse{trigger, threshold}',
aliases: ['recover', 'handle', 'fallback'],
glyphs: ['π', 'π₯', 'π'],
tags: ['collapse', 'recover', 'handle'],
slashes: ['/collapse', '/recover', '/handle']
},
// ATTENTION primitive
{
type: SymbolicPrimitiveType.ATTENTION,
name: 'attention',
description: 'Control focus on specific content',
parameters: [
{
name: 'focus',
type: ParameterType.STRING,
description: 'What to focus on',
required: true
},
{
name: 'weight',
type: ParameterType.NUMBER,
description: 'Weight of attention',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Focus specifically on: [focus]',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'Focus specifically on: [focus]',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
}
],
universalImplementation: '.p/attention{focus, weight}',
aliases: ['focus', 'highlight', 'emphasize'],
glyphs: ['π', 'ποΈ', 'π―'],
tags: ['attention', 'focus', 'highlight'],
slashes: ['/attention', '/focus', '/highlight']
},
// UNCERTAINTY primitive
{
type: SymbolicPrimitiveType.UNCERTAINTY,
name: 'uncertainty',
description: 'Express confidence levels',
parameters: [
{
name: 'level',
type: ParameterType.NUMBER,
description: 'Confidence level (0-1)',
required: false
},
{
name: 'reason',
type: ParameterType.STRING,
description: 'Reason for uncertainty',
required: false
}
],
vendorGrammars: [
{
vendor: VendorType.CLAUDE,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'My confidence level is [level]: [reason]',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
},
{
vendor: VendorType.OPENAI,
style: GrammarStyle.SYSTEM_PROMPT,
isNative: false,
implementation: 'My confidence level is [level]: [reason]',
apiForm: 'Emulated via system prompting',
notes: 'Not natively supported, emulated through prompting'
}
],
universalImplementation: '.p/uncertainty{level, reason}',
aliases: ['confidence', 'certainty', 'doubt'],
glyphs: ['β', 'β οΈ', 'π€'],
tags: ['uncertainty', 'confidence', 'certainty'],
slashes: ['/uncertainty', '/confidence', '/certainty']
}
];
/**
* Glyph to symbolic primitive mapping
*/
export const GLYPH_MAP: Record<string, SymbolicPrimitiveType> = {
// Thinking glyphs
'π§ ': SymbolicPrimitiveType.THINKING,
'π': SymbolicPrimitiveType.THINKING,
'π€': SymbolicPrimitiveType.THINKING,
// Reflection glyphs
'π': SymbolicPrimitiveType.REFLECTION,
'πͺ': SymbolicPrimitiveType.REFLECTION,
'ποΈ': SymbolicPrimitiveType.REFLECTION,
// Tool use glyphs
'π οΈ': SymbolicPrimitiveType.TOOL_USE,
'βοΈ': SymbolicPrimitiveType.TOOL_USE,
'π§': SymbolicPrimitiveType.TOOL_USE,
// System glyphs
'π±': SymbolicPrimitiveType.SYSTEM,
'π': SymbolicPrimitiveType.SYSTEM,
'π': SymbolicPrimitiveType.SYSTEM,
// Fork glyphs
'πΏ': SymbolicPrimitiveType.FORK,
'π': SymbolicPrimitiveType.FORK,
'β': SymbolicPrimitiveType.FORK,
// Collapse glyphs
'π': SymbolicPrimitiveType.COLLAPSE,
'π₯': SymbolicPrimitiveType.COLLAPSE,
'π': SymbolicPrimitiveType.ATTENTION,
// Uncertainty glyphs
'β': SymbolicPrimitiveType.UNCERTAINTY,
'β οΈ': SymbolicPrimitiveType.UNCERTAINTY,
// Recursive glyphs
'βΎοΈ': SymbolicPrimitiveType.RECURSION,
'π': SymbolicPrimitiveType.RECURSION,
// Symbolic residue shells
'π': SymbolicPrimitiveType.METACOGNITION,
'β΄': SymbolicPrimitiveType.ATTRIBUTION,
'β§': SymbolicPrimitiveType.MEMORY,
'β': SymbolicPrimitiveType.FORK,
'β': SymbolicPrimitiveType.ANCHOR
};
/**
* Tag to symbolic primitive mapping
*/
export const TAG_MAP: Record<string, SymbolicPrimitiveType> = {
'think': SymbolicPrimitiveType.THINKING,
'thinking': SymbolicPrimitiveType.THINKING,
'thought': SymbolicPrimitiveType.THINKING,
'reflect': SymbolicPrimitiveType.REFLECTION,
'reflection': SymbolicPrimitiveType.REFLECTION,
'introspect': SymbolicPrimitiveType.REFLECTION,
'tool': SymbolicPrimitiveType.TOOL_USE,
'function': SymbolicPrimitiveType.TOOL_USE,
'command': SymbolicPrimitiveType.TOOL_USE,
's': SymbolicPrimitiveType.SYSTEM,
'system': SymbolicPrimitiveType.SYSTEM,
'directive': SymbolicPrimitiveType.SYSTEM,
'fork': SymbolicPrimitiveType.FORK,
'branch': SymbolicPrimitiveType.FORK,
'split': SymbolicPrimitiveType.FORK,
'collapse': SymbolicPrimitiveType.COLLAPSE,
'recover': SymbolicPrimitiveType.COLLAPSE,
'handle': SymbolicPrimitiveType.COLLAPSE,
'attention': SymbolicPrimitiveType.ATTENTION,
'focus': SymbolicPrimitiveType.ATTENTION,
'highlight': SymbolicPrimitiveType.ATTENTION,
'uncertainty': SymbolicPrimitiveType.UNCERTAINTY,
'confidence': SymbolicPrimitiveType.UNCERTAINTY,
'certainty': SymbolicPrimitiveType.UNCERTAINTY,
'recurse': SymbolicPrimitiveType.RECURSION,
'loop': SymbolicPrimitiveType.RECURSION
};
/**
* Slash command to symbolic primitive mapping
*/
export const SLASH_MAP: Record<string, SymbolicPrimitiveType> = {
'/think': SymbolicPrimitiveType.THINKING,
'/thinking': SymbolicPrimitiveType.THINKING,
'/thought': SymbolicPrimitiveType.THINKING,
'/reflect': SymbolicPrimitiveType.REFLECTION,
'/reflection': SymbolicPrimitiveType.REFLECTION,
'/introspect': SymbolicPrimitiveType.REFLECTION,
'/tool': SymbolicPrimitiveType.TOOL_USE,
'/function': SymbolicPrimitiveType.TOOL_USE,
'/command': SymbolicPrimitiveType.TOOL_USE,
'/system': SymbolicPrimitiveType.SYSTEM,
'/directive': SymbolicPrimitiveType.SYSTEM,
'/instruction': SymbolicPrimitiveType.SYSTEM,
'/fork': SymbolicPrimitiveType.FORK,
'/branch': SymbolicPrimitiveType.FORK,
'/split': SymbolicPrimitiveType.FORK,
'/collapse': SymbolicPrimitiveType.COLLAPSE,
'/recover': SymbolicPrimitiveType.COLLAPSE,
'/handle': SymbolicPrimitiveType.COLLAPSE,
'/attention': SymbolicPrimitiveType.ATTENTION,
'/focus': SymbolicPrimitiveType.ATTENTION,
'/highlight': SymbolicPrimitiveType.ATTENTION,
'/uncertainty': SymbolicPrimitiveType.UNCERTAINTY,
'/confidence': SymbolicPrimitiveType.UNCERTAINTY,
'/certainty': SymbolicPrimitiveType.UNCERTAINTY,
'/recurse': SymbolicPrimitiveType.RECURSION,
'/loop': SymbolicPrimitiveType.RECURSION
};
/**
* Find symbolic primitive by type
*/
export function findSymbolicPrimitiveByType(type: SymbolicPrimitiveType): SymbolicPrimitive | undefined {
return SYMBOLIC_SCHEMA.find(primitive => primitive.type === type);
}
/**
* Find symbolic primitive by glyph
*/
export function findSymbolicPrimitiveByGlyph(glyph: string): SymbolicPrimitive | undefined {
const type = GLYPH_MAP[glyph];
if (!type) return undefined;
return findSymbolicPrimitiveByType(type);
}
/**
* Find symbolic primitive by tag
*/
export function findSymbolicPrimitiveByTag(tag: string): SymbolicPrimitive | undefined {
const type = TAG_MAP[tag];
if (!type) return undefined;
return findSymbolicPrimitiveByType(type);
}
/**
* Find symbolic primitive by slash command
*/
export function findSymbolicPrimitiveBySlash(slash: string): SymbolicPrimitive | undefined {
const type = SLASH_MAP[slash];
if (!type) return undefined;
return findSymbolicPrimitiveByType(type);
}
/**
* Get vendor grammar for a symbolic primitive and vendor
*/
export function getVendorGrammar(primitive: SymbolicPrimitive, vendor: VendorType): VendorGrammar | undefined {
return primitive.vendorGrammars.find(grammar => grammar.vendor === vendor);
}
/**
* Translate a symbolic operation from one vendor to another
*/
export function translateSymbolicOperation(
content: string,
sourceVendor: VendorType,
targetVendor: VendorType
): string {
// Implementation depends on specific parsing and generation logic
// This would be implemented in the runtime library
return content; // Placeholder
}
|