@axiom-lattice/core 2.1.99 → 2.1.100
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/index.d.mts +257 -1
- package/dist/index.d.ts +257 -1
- package/dist/index.js +240 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +238 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1626,13 +1626,16 @@ __export(index_exports, {
|
|
|
1626
1626
|
DaytonaInstance: () => DaytonaInstance,
|
|
1627
1627
|
DaytonaProvider: () => DaytonaProvider,
|
|
1628
1628
|
DefaultScheduleClient: () => DefaultScheduleClient,
|
|
1629
|
+
DependencyResolver: () => DependencyResolver,
|
|
1629
1630
|
E2BInstance: () => E2BInstance,
|
|
1630
1631
|
E2BProvider: () => E2BProvider,
|
|
1631
1632
|
EMPTY_CONTENT_WARNING: () => EMPTY_CONTENT_WARNING,
|
|
1632
1633
|
EmbeddingsLatticeManager: () => EmbeddingsLatticeManager,
|
|
1634
|
+
ExportableEntityRegistry: () => ExportableEntityRegistry,
|
|
1633
1635
|
FileSystemSkillStore: () => FileSystemSkillStore,
|
|
1634
1636
|
FilesystemBackend: () => FilesystemBackend,
|
|
1635
1637
|
HumanMessage: () => import_messages6.HumanMessage,
|
|
1638
|
+
IdRemapper: () => IdRemapper,
|
|
1636
1639
|
InMemoryA2AApiKeyStore: () => InMemoryA2AApiKeyStore,
|
|
1637
1640
|
InMemoryAssistantStore: () => InMemoryAssistantStore,
|
|
1638
1641
|
InMemoryBindingStore: () => InMemoryBindingStore,
|
|
@@ -12004,17 +12007,18 @@ var InMemoryChunkBuffer = class extends ChunkBuffer {
|
|
|
12004
12007
|
import_protocols4.MessageChunkTypes.THREAD_IDLE
|
|
12005
12008
|
];
|
|
12006
12009
|
const typesToStop = stopTypes ?? defaultStopTypes;
|
|
12007
|
-
let
|
|
12008
|
-
|
|
12010
|
+
let startIndex = 0;
|
|
12011
|
+
for (let i = buffer2.chunks.length - 1; i >= 0; i--) {
|
|
12012
|
+
if (buffer2.chunks[i].data?.id === messageId) {
|
|
12013
|
+
startIndex = i;
|
|
12014
|
+
break;
|
|
12015
|
+
}
|
|
12016
|
+
}
|
|
12017
|
+
const stopSet = new Set(typesToStop);
|
|
12009
12018
|
const filtered$ = buffer2.chunks$.pipe(
|
|
12010
12019
|
(0, import_rxjs.observeOn)(import_rxjs.asyncScheduler),
|
|
12011
|
-
|
|
12012
|
-
(0, import_operators.
|
|
12013
|
-
if (chunk2.data?.id === messageId) startYieldChunk = true;
|
|
12014
|
-
return startYieldChunk;
|
|
12015
|
-
}),
|
|
12016
|
-
// 2. 包含指定的停止类型,但收到后停止
|
|
12017
|
-
(0, import_operators.takeWhile)((chunk2) => !typesToStop.includes(chunk2.type), true)
|
|
12020
|
+
(0, import_operators.skip)(startIndex),
|
|
12021
|
+
(0, import_operators.takeWhile)((chunk2) => !stopSet.has(chunk2.type), true)
|
|
12018
12022
|
);
|
|
12019
12023
|
yield* (0, import_rxjs_for_await.eachValueFrom)(filtered$);
|
|
12020
12024
|
}
|
|
@@ -28551,6 +28555,230 @@ var PersonalAssistantConfig = class {
|
|
|
28551
28555
|
};
|
|
28552
28556
|
PersonalAssistantConfig._config = deepClone(DEFAULT_CONFIG);
|
|
28553
28557
|
|
|
28558
|
+
// src/export_import/ExportableEntityRegistry.ts
|
|
28559
|
+
var ExportableEntityRegistry = class _ExportableEntityRegistry {
|
|
28560
|
+
constructor() {
|
|
28561
|
+
this.definitions = /* @__PURE__ */ new Map();
|
|
28562
|
+
}
|
|
28563
|
+
/**
|
|
28564
|
+
* Returns the singleton registry instance, creating it if necessary.
|
|
28565
|
+
*
|
|
28566
|
+
* @returns The singleton {@link ExportableEntityRegistry} instance.
|
|
28567
|
+
*/
|
|
28568
|
+
static getInstance() {
|
|
28569
|
+
if (!_ExportableEntityRegistry.instance) {
|
|
28570
|
+
_ExportableEntityRegistry.instance = new _ExportableEntityRegistry();
|
|
28571
|
+
}
|
|
28572
|
+
return _ExportableEntityRegistry.instance;
|
|
28573
|
+
}
|
|
28574
|
+
/**
|
|
28575
|
+
* Registers an exportable entity type definition.
|
|
28576
|
+
*
|
|
28577
|
+
* @param def - The entity definition to register.
|
|
28578
|
+
*
|
|
28579
|
+
* @throws If an entity type with the same `entityType` is already registered.
|
|
28580
|
+
*/
|
|
28581
|
+
register(def) {
|
|
28582
|
+
if (this.definitions.has(def.entityType)) {
|
|
28583
|
+
throw new Error(
|
|
28584
|
+
`Exportable entity type "${def.entityType}" is already registered`
|
|
28585
|
+
);
|
|
28586
|
+
}
|
|
28587
|
+
this.definitions.set(def.entityType, def);
|
|
28588
|
+
}
|
|
28589
|
+
/**
|
|
28590
|
+
* Retrieves a registered entity definition by type name.
|
|
28591
|
+
*
|
|
28592
|
+
* @param entityType - The entity type identifier (e.g. `'skill'`, `'agent'`).
|
|
28593
|
+
*
|
|
28594
|
+
* @returns The registered {@link ExportableEntityDefinition}.
|
|
28595
|
+
*
|
|
28596
|
+
* @throws If no definition is registered for the given type.
|
|
28597
|
+
*/
|
|
28598
|
+
get(entityType) {
|
|
28599
|
+
const def = this.definitions.get(entityType);
|
|
28600
|
+
if (!def) {
|
|
28601
|
+
throw new Error(`Exportable entity type "${entityType}" not found`);
|
|
28602
|
+
}
|
|
28603
|
+
return def;
|
|
28604
|
+
}
|
|
28605
|
+
/**
|
|
28606
|
+
* Returns lightweight metadata for all registered types (for the frontend).
|
|
28607
|
+
*
|
|
28608
|
+
* @returns An array of {@link ExportableTypeInfo} objects.
|
|
28609
|
+
*/
|
|
28610
|
+
listTypes() {
|
|
28611
|
+
return [...this.definitions.values()].map((d) => ({
|
|
28612
|
+
entityType: d.entityType,
|
|
28613
|
+
label: d.label,
|
|
28614
|
+
category: d.category,
|
|
28615
|
+
dependsOn: d.dependsOn,
|
|
28616
|
+
cascadeParents: d.cascadeParents
|
|
28617
|
+
}));
|
|
28618
|
+
}
|
|
28619
|
+
/**
|
|
28620
|
+
* Returns all registered entity definitions.
|
|
28621
|
+
*
|
|
28622
|
+
* @returns An array of all registered {@link ExportableEntityDefinition} objects.
|
|
28623
|
+
*/
|
|
28624
|
+
getAll() {
|
|
28625
|
+
return [...this.definitions.values()];
|
|
28626
|
+
}
|
|
28627
|
+
/**
|
|
28628
|
+
* Removes a registered entity type definition.
|
|
28629
|
+
*
|
|
28630
|
+
* @param entityType - The entity type identifier to remove.
|
|
28631
|
+
*/
|
|
28632
|
+
unregister(entityType) {
|
|
28633
|
+
this.definitions.delete(entityType);
|
|
28634
|
+
}
|
|
28635
|
+
};
|
|
28636
|
+
|
|
28637
|
+
// src/export_import/DependencyResolver.ts
|
|
28638
|
+
var DependencyResolver = class {
|
|
28639
|
+
/**
|
|
28640
|
+
* Topological sort of entity types based on their {@link ExportableEntityDefinition.dependsOn}
|
|
28641
|
+
* declarations. Entities with no dependencies come first.
|
|
28642
|
+
*
|
|
28643
|
+
* @param defs - All registered exportable entity definitions.
|
|
28644
|
+
* @returns Entity type names in dependency-first order.
|
|
28645
|
+
*/
|
|
28646
|
+
static resolveOrder(defs) {
|
|
28647
|
+
const typeMap = new Map(defs.map((d) => [d.entityType, d]));
|
|
28648
|
+
const visited = /* @__PURE__ */ new Set();
|
|
28649
|
+
const result = [];
|
|
28650
|
+
function visit(type) {
|
|
28651
|
+
if (visited.has(type)) return;
|
|
28652
|
+
visited.add(type);
|
|
28653
|
+
const def = typeMap.get(type);
|
|
28654
|
+
if (def) {
|
|
28655
|
+
for (const dep of def.dependsOn) {
|
|
28656
|
+
if (typeMap.has(dep)) {
|
|
28657
|
+
visit(dep);
|
|
28658
|
+
}
|
|
28659
|
+
}
|
|
28660
|
+
}
|
|
28661
|
+
result.push(type);
|
|
28662
|
+
}
|
|
28663
|
+
for (const def of defs) {
|
|
28664
|
+
visit(def.entityType);
|
|
28665
|
+
}
|
|
28666
|
+
return result;
|
|
28667
|
+
}
|
|
28668
|
+
/**
|
|
28669
|
+
* Given a set of selected entity types, expand to include all CASCADE
|
|
28670
|
+
* parents. Only walks **upward** (parents), never downward (children).
|
|
28671
|
+
*
|
|
28672
|
+
* @param defs - All registered exportable entity definitions.
|
|
28673
|
+
* @param selected - Entity type names the user explicitly chose.
|
|
28674
|
+
* @returns The original selection plus every reachable cascade parent.
|
|
28675
|
+
*/
|
|
28676
|
+
static expandCascade(defs, selected) {
|
|
28677
|
+
const typeMap = new Map(defs.map((d) => [d.entityType, d]));
|
|
28678
|
+
const result = new Set(selected);
|
|
28679
|
+
let changed = true;
|
|
28680
|
+
while (changed) {
|
|
28681
|
+
changed = false;
|
|
28682
|
+
for (const type of [...result]) {
|
|
28683
|
+
const def = typeMap.get(type);
|
|
28684
|
+
if (def) {
|
|
28685
|
+
for (const parent of def.cascadeParents) {
|
|
28686
|
+
if (!result.has(parent)) {
|
|
28687
|
+
result.add(parent);
|
|
28688
|
+
changed = true;
|
|
28689
|
+
}
|
|
28690
|
+
}
|
|
28691
|
+
}
|
|
28692
|
+
}
|
|
28693
|
+
}
|
|
28694
|
+
return [...result];
|
|
28695
|
+
}
|
|
28696
|
+
/**
|
|
28697
|
+
* Compute which required dependencies are missing from the selected types.
|
|
28698
|
+
*
|
|
28699
|
+
* Only considers dependencies that are themselves registered as exportable
|
|
28700
|
+
* entity types. Unregistered dependencies (e.g. `Workspace`, `Project` —
|
|
28701
|
+
* infrastructure types) are silently excluded.
|
|
28702
|
+
*
|
|
28703
|
+
* @param defs - All registered exportable entity definitions.
|
|
28704
|
+
* @param selected - Entity type names the user has selected.
|
|
28705
|
+
* @returns The list of entity types that must also be selected (or
|
|
28706
|
+
* auto-included).
|
|
28707
|
+
*/
|
|
28708
|
+
static computeDependencies(defs, selected) {
|
|
28709
|
+
const typeMap = new Map(defs.map((d) => [d.entityType, d]));
|
|
28710
|
+
const selectedSet = new Set(selected);
|
|
28711
|
+
const missing = /* @__PURE__ */ new Set();
|
|
28712
|
+
function collectMissing(type) {
|
|
28713
|
+
if (selectedSet.has(type)) return;
|
|
28714
|
+
const def = typeMap.get(type);
|
|
28715
|
+
if (!def) return;
|
|
28716
|
+
missing.add(type);
|
|
28717
|
+
for (const dep of def.dependsOn) {
|
|
28718
|
+
collectMissing(dep);
|
|
28719
|
+
}
|
|
28720
|
+
}
|
|
28721
|
+
for (const type of selected) {
|
|
28722
|
+
const def = typeMap.get(type);
|
|
28723
|
+
if (def) {
|
|
28724
|
+
for (const dep of def.dependsOn) {
|
|
28725
|
+
collectMissing(dep);
|
|
28726
|
+
}
|
|
28727
|
+
}
|
|
28728
|
+
}
|
|
28729
|
+
return { missing: [...missing] };
|
|
28730
|
+
}
|
|
28731
|
+
};
|
|
28732
|
+
|
|
28733
|
+
// src/export_import/IdRemapper.ts
|
|
28734
|
+
var REF_PATTERN = /^@(\w+)\/(.+)$/;
|
|
28735
|
+
var IdRemapper = class {
|
|
28736
|
+
constructor(idMap) {
|
|
28737
|
+
this.idMap = idMap;
|
|
28738
|
+
}
|
|
28739
|
+
/**
|
|
28740
|
+
* Deep-traverse an object/array and replace all @type/exportId string values
|
|
28741
|
+
* with their corresponding real IDs from the idMap.
|
|
28742
|
+
* Values not matching the @type/exportId pattern are returned unchanged.
|
|
28743
|
+
*/
|
|
28744
|
+
remapReferences(value) {
|
|
28745
|
+
if (value === null || value === void 0) return value;
|
|
28746
|
+
if (typeof value === "string") {
|
|
28747
|
+
const match = value.match(REF_PATTERN);
|
|
28748
|
+
if (match) {
|
|
28749
|
+
const exportId = match[2];
|
|
28750
|
+
if (this.idMap[exportId] !== void 0) {
|
|
28751
|
+
return this.idMap[exportId];
|
|
28752
|
+
}
|
|
28753
|
+
}
|
|
28754
|
+
return value;
|
|
28755
|
+
}
|
|
28756
|
+
if (Array.isArray(value)) {
|
|
28757
|
+
return value.map((item) => this.remapReferences(item));
|
|
28758
|
+
}
|
|
28759
|
+
if (typeof value === "object") {
|
|
28760
|
+
const result = {};
|
|
28761
|
+
for (const [key4, val] of Object.entries(value)) {
|
|
28762
|
+
result[key4] = this.remapReferences(val);
|
|
28763
|
+
}
|
|
28764
|
+
return result;
|
|
28765
|
+
}
|
|
28766
|
+
return value;
|
|
28767
|
+
}
|
|
28768
|
+
/**
|
|
28769
|
+
* Replace raw skill IDs in an agent's graphDefinition.skillIds array.
|
|
28770
|
+
* This handles the implicit agent->skill reference that uses raw skill IDs
|
|
28771
|
+
* (not @type/exportId format). Agents reference skills by their string ID.
|
|
28772
|
+
*/
|
|
28773
|
+
remapSkillIds(graphDefinition, skillRemap) {
|
|
28774
|
+
const cloned = structuredClone(graphDefinition);
|
|
28775
|
+
if (Array.isArray(cloned.skillIds)) {
|
|
28776
|
+
cloned.skillIds = cloned.skillIds.map((id) => skillRemap[id] ?? id);
|
|
28777
|
+
}
|
|
28778
|
+
return cloned;
|
|
28779
|
+
}
|
|
28780
|
+
};
|
|
28781
|
+
|
|
28554
28782
|
// src/index.ts
|
|
28555
28783
|
registerBuiltinPlugins();
|
|
28556
28784
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -28574,13 +28802,16 @@ registerBuiltinPlugins();
|
|
|
28574
28802
|
DaytonaInstance,
|
|
28575
28803
|
DaytonaProvider,
|
|
28576
28804
|
DefaultScheduleClient,
|
|
28805
|
+
DependencyResolver,
|
|
28577
28806
|
E2BInstance,
|
|
28578
28807
|
E2BProvider,
|
|
28579
28808
|
EMPTY_CONTENT_WARNING,
|
|
28580
28809
|
EmbeddingsLatticeManager,
|
|
28810
|
+
ExportableEntityRegistry,
|
|
28581
28811
|
FileSystemSkillStore,
|
|
28582
28812
|
FilesystemBackend,
|
|
28583
28813
|
HumanMessage,
|
|
28814
|
+
IdRemapper,
|
|
28584
28815
|
InMemoryA2AApiKeyStore,
|
|
28585
28816
|
InMemoryAssistantStore,
|
|
28586
28817
|
InMemoryBindingStore,
|