@almadar/std 3.10.0 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/behaviors/exports-reader.d.ts +4 -31
- package/dist/behaviors/exports-reader.js +21267 -40
- package/dist/behaviors/exports-reader.js.map +1 -1
- package/dist/behaviors/functions/index.js.map +1 -1
- package/dist/behaviors/index.js +1042 -617
- package/dist/behaviors/index.js.map +1 -1
- package/dist/behaviors/query.d.ts +6 -5
- package/dist/behaviors/query.js +21293 -29
- package/dist/behaviors/query.js.map +1 -1
- package/dist/behaviors/types.d.ts +7 -14
- package/dist/behaviors/types.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1367 -616
- package/dist/index.js.map +1 -1
- package/dist/modules/agent.d.ts +21 -0
- package/dist/modules/agent.js +322 -0
- package/dist/modules/agent.js.map +1 -0
- package/dist/modules/array.d.ts +1 -1
- package/dist/modules/async.d.ts +1 -1
- package/dist/modules/contract.d.ts +1 -1
- package/dist/modules/data.d.ts +1 -1
- package/dist/modules/format.d.ts +1 -1
- package/dist/modules/graph.d.ts +1 -1
- package/dist/modules/index.d.ts +2 -1
- package/dist/modules/index.js +320 -1
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/math.d.ts +1 -1
- package/dist/modules/nn.d.ts +1 -1
- package/dist/modules/object.d.ts +1 -1
- package/dist/modules/os.d.ts +1 -1
- package/dist/modules/prob.d.ts +1 -1
- package/dist/modules/str.d.ts +1 -1
- package/dist/modules/tensor.d.ts +1 -1
- package/dist/modules/time.d.ts +1 -1
- package/dist/modules/train.d.ts +1 -1
- package/dist/modules/validate.d.ts +1 -1
- package/dist/registry.d.ts +1 -1
- package/dist/registry.js +321 -2
- package/dist/registry.js.map +1 -1
- package/dist/{types-DOeGXRCm.d.ts → types-BjP5nVQd.d.ts} +3 -3
- package/package.json +2 -2
package/dist/modules/math.d.ts
CHANGED
package/dist/modules/nn.d.ts
CHANGED
package/dist/modules/object.d.ts
CHANGED
package/dist/modules/os.d.ts
CHANGED
package/dist/modules/prob.d.ts
CHANGED
package/dist/modules/str.d.ts
CHANGED
package/dist/modules/tensor.d.ts
CHANGED
package/dist/modules/time.d.ts
CHANGED
package/dist/modules/train.d.ts
CHANGED
package/dist/registry.d.ts
CHANGED
package/dist/registry.js
CHANGED
|
@@ -13,6 +13,7 @@ var STD_MODULES = [
|
|
|
13
13
|
"train",
|
|
14
14
|
"prob",
|
|
15
15
|
"os",
|
|
16
|
+
"agent",
|
|
16
17
|
"graph",
|
|
17
18
|
"contract",
|
|
18
19
|
"data"
|
|
@@ -3483,6 +3484,322 @@ var OS_OPERATORS = {
|
|
|
3483
3484
|
}
|
|
3484
3485
|
};
|
|
3485
3486
|
|
|
3487
|
+
// modules/agent.ts
|
|
3488
|
+
var AGENT_OPERATORS = {
|
|
3489
|
+
// ==========================================================================
|
|
3490
|
+
// Memory (Pure)
|
|
3491
|
+
// ==========================================================================
|
|
3492
|
+
"agent/recall": {
|
|
3493
|
+
module: "agent",
|
|
3494
|
+
category: "std-agent",
|
|
3495
|
+
minArity: 1,
|
|
3496
|
+
maxArity: 2,
|
|
3497
|
+
description: "Search memories by semantic query. Returns matching AgentMemoryRecord array.",
|
|
3498
|
+
hasSideEffects: false,
|
|
3499
|
+
returnType: "array",
|
|
3500
|
+
params: [
|
|
3501
|
+
{ name: "query", type: "string", description: "Semantic search query" },
|
|
3502
|
+
{ name: "limit", type: "number", description: "Max results to return", optional: true }
|
|
3503
|
+
],
|
|
3504
|
+
example: '["agent/recall", "user prefers dark mode"] => [{id, content, strength, ...}]'
|
|
3505
|
+
},
|
|
3506
|
+
"agent/memories": {
|
|
3507
|
+
module: "agent",
|
|
3508
|
+
category: "std-agent",
|
|
3509
|
+
minArity: 0,
|
|
3510
|
+
maxArity: 1,
|
|
3511
|
+
description: "List all memories, optionally filtered by category.",
|
|
3512
|
+
hasSideEffects: false,
|
|
3513
|
+
returnType: "array",
|
|
3514
|
+
params: [
|
|
3515
|
+
{ name: "category", type: "string", description: "Memory category filter", optional: true }
|
|
3516
|
+
],
|
|
3517
|
+
example: '["agent/memories", "preference"] => [{id, content, category, ...}]'
|
|
3518
|
+
},
|
|
3519
|
+
"agent/memory-strength": {
|
|
3520
|
+
module: "agent",
|
|
3521
|
+
category: "std-agent",
|
|
3522
|
+
minArity: 1,
|
|
3523
|
+
maxArity: 1,
|
|
3524
|
+
description: "Get the strength value (0-1) of a specific memory.",
|
|
3525
|
+
hasSideEffects: false,
|
|
3526
|
+
returnType: "number",
|
|
3527
|
+
params: [
|
|
3528
|
+
{ name: "id", type: "string", description: "Memory record ID" }
|
|
3529
|
+
],
|
|
3530
|
+
example: '["agent/memory-strength", "mem_abc123"] => 0.85'
|
|
3531
|
+
},
|
|
3532
|
+
"agent/is-pinned": {
|
|
3533
|
+
module: "agent",
|
|
3534
|
+
category: "std-agent",
|
|
3535
|
+
minArity: 1,
|
|
3536
|
+
maxArity: 1,
|
|
3537
|
+
description: "Check if a memory is pinned (immune to decay).",
|
|
3538
|
+
hasSideEffects: false,
|
|
3539
|
+
returnType: "boolean",
|
|
3540
|
+
params: [
|
|
3541
|
+
{ name: "id", type: "string", description: "Memory record ID" }
|
|
3542
|
+
],
|
|
3543
|
+
example: '["agent/is-pinned", "mem_abc123"] => true'
|
|
3544
|
+
},
|
|
3545
|
+
// ==========================================================================
|
|
3546
|
+
// LLM (Pure)
|
|
3547
|
+
// ==========================================================================
|
|
3548
|
+
"agent/provider": {
|
|
3549
|
+
module: "agent",
|
|
3550
|
+
category: "std-agent",
|
|
3551
|
+
minArity: 0,
|
|
3552
|
+
maxArity: 0,
|
|
3553
|
+
description: "Get the name of the current LLM provider.",
|
|
3554
|
+
hasSideEffects: false,
|
|
3555
|
+
returnType: "string",
|
|
3556
|
+
params: [],
|
|
3557
|
+
example: '["agent/provider"] => "deepseek"'
|
|
3558
|
+
},
|
|
3559
|
+
"agent/model": {
|
|
3560
|
+
module: "agent",
|
|
3561
|
+
category: "std-agent",
|
|
3562
|
+
minArity: 0,
|
|
3563
|
+
maxArity: 0,
|
|
3564
|
+
description: "Get the name of the current LLM model.",
|
|
3565
|
+
hasSideEffects: false,
|
|
3566
|
+
returnType: "string",
|
|
3567
|
+
params: [],
|
|
3568
|
+
example: '["agent/model"] => "deepseek-chat"'
|
|
3569
|
+
},
|
|
3570
|
+
// ==========================================================================
|
|
3571
|
+
// Tools (Pure)
|
|
3572
|
+
// ==========================================================================
|
|
3573
|
+
"agent/tools": {
|
|
3574
|
+
module: "agent",
|
|
3575
|
+
category: "std-agent",
|
|
3576
|
+
minArity: 0,
|
|
3577
|
+
maxArity: 0,
|
|
3578
|
+
description: "Get the list of available tool names.",
|
|
3579
|
+
hasSideEffects: false,
|
|
3580
|
+
returnType: "array",
|
|
3581
|
+
params: [],
|
|
3582
|
+
example: '["agent/tools"] => ["execute", "validate-schema", "generate-schema"]'
|
|
3583
|
+
},
|
|
3584
|
+
// ==========================================================================
|
|
3585
|
+
// Context (Pure)
|
|
3586
|
+
// ==========================================================================
|
|
3587
|
+
"agent/token-count": {
|
|
3588
|
+
module: "agent",
|
|
3589
|
+
category: "std-agent",
|
|
3590
|
+
minArity: 0,
|
|
3591
|
+
maxArity: 0,
|
|
3592
|
+
description: "Get the current token count in the context window.",
|
|
3593
|
+
hasSideEffects: false,
|
|
3594
|
+
returnType: "number",
|
|
3595
|
+
params: [],
|
|
3596
|
+
example: '["agent/token-count"] => 12450'
|
|
3597
|
+
},
|
|
3598
|
+
"agent/context-usage": {
|
|
3599
|
+
module: "agent",
|
|
3600
|
+
category: "std-agent",
|
|
3601
|
+
minArity: 0,
|
|
3602
|
+
maxArity: 0,
|
|
3603
|
+
description: "Get context window usage as a ratio (0-1).",
|
|
3604
|
+
hasSideEffects: false,
|
|
3605
|
+
returnType: "number",
|
|
3606
|
+
params: [],
|
|
3607
|
+
example: '["agent/context-usage"] => 0.62'
|
|
3608
|
+
},
|
|
3609
|
+
// ==========================================================================
|
|
3610
|
+
// Session (Pure)
|
|
3611
|
+
// ==========================================================================
|
|
3612
|
+
"agent/session-id": {
|
|
3613
|
+
module: "agent",
|
|
3614
|
+
category: "std-agent",
|
|
3615
|
+
minArity: 0,
|
|
3616
|
+
maxArity: 0,
|
|
3617
|
+
description: "Get the current session identifier.",
|
|
3618
|
+
hasSideEffects: false,
|
|
3619
|
+
returnType: "string",
|
|
3620
|
+
params: [],
|
|
3621
|
+
example: '["agent/session-id"] => "sess_a3f2k"'
|
|
3622
|
+
},
|
|
3623
|
+
// ==========================================================================
|
|
3624
|
+
// Memory (Effects)
|
|
3625
|
+
// ==========================================================================
|
|
3626
|
+
"agent/memorize": {
|
|
3627
|
+
module: "agent",
|
|
3628
|
+
category: "std-agent",
|
|
3629
|
+
minArity: 2,
|
|
3630
|
+
maxArity: 3,
|
|
3631
|
+
description: "Store a new memory. Returns the new memory ID.",
|
|
3632
|
+
hasSideEffects: true,
|
|
3633
|
+
returnType: "string",
|
|
3634
|
+
params: [
|
|
3635
|
+
{ name: "content", type: "string", description: "Memory content to store" },
|
|
3636
|
+
{ name: "category", type: "string", description: "Category: preference, correction, pattern-affinity, entity-template, error-resolution" },
|
|
3637
|
+
{ name: "scope", type: "string", description: "Scope: global or project", optional: true, defaultValue: "global" }
|
|
3638
|
+
],
|
|
3639
|
+
example: '["agent/memorize", "user prefers PascalCase", "preference"]'
|
|
3640
|
+
},
|
|
3641
|
+
"agent/forget": {
|
|
3642
|
+
module: "agent",
|
|
3643
|
+
category: "std-agent",
|
|
3644
|
+
minArity: 1,
|
|
3645
|
+
maxArity: 1,
|
|
3646
|
+
description: "Remove a memory by ID.",
|
|
3647
|
+
hasSideEffects: true,
|
|
3648
|
+
returnType: "void",
|
|
3649
|
+
params: [
|
|
3650
|
+
{ name: "id", type: "string", description: "Memory record ID to remove" }
|
|
3651
|
+
],
|
|
3652
|
+
example: '["agent/forget", "mem_abc123"]'
|
|
3653
|
+
},
|
|
3654
|
+
"agent/pin": {
|
|
3655
|
+
module: "agent",
|
|
3656
|
+
category: "std-agent",
|
|
3657
|
+
minArity: 1,
|
|
3658
|
+
maxArity: 1,
|
|
3659
|
+
description: "Pin a memory to prevent decay.",
|
|
3660
|
+
hasSideEffects: true,
|
|
3661
|
+
returnType: "void",
|
|
3662
|
+
params: [
|
|
3663
|
+
{ name: "id", type: "string", description: "Memory record ID to pin" }
|
|
3664
|
+
],
|
|
3665
|
+
example: '["agent/pin", "mem_abc123"]'
|
|
3666
|
+
},
|
|
3667
|
+
"agent/reinforce": {
|
|
3668
|
+
module: "agent",
|
|
3669
|
+
category: "std-agent",
|
|
3670
|
+
minArity: 1,
|
|
3671
|
+
maxArity: 1,
|
|
3672
|
+
description: "Increase a memory's strength (reinforcement learning signal).",
|
|
3673
|
+
hasSideEffects: true,
|
|
3674
|
+
returnType: "void",
|
|
3675
|
+
params: [
|
|
3676
|
+
{ name: "id", type: "string", description: "Memory record ID to reinforce" }
|
|
3677
|
+
],
|
|
3678
|
+
example: '["agent/reinforce", "mem_abc123"]'
|
|
3679
|
+
},
|
|
3680
|
+
"agent/decay": {
|
|
3681
|
+
module: "agent",
|
|
3682
|
+
category: "std-agent",
|
|
3683
|
+
minArity: 0,
|
|
3684
|
+
maxArity: 0,
|
|
3685
|
+
description: "Apply strength decay to all unpinned memories. Returns count of forgotten memories.",
|
|
3686
|
+
hasSideEffects: true,
|
|
3687
|
+
returnType: "number",
|
|
3688
|
+
params: [],
|
|
3689
|
+
example: '["agent/decay"] => 15'
|
|
3690
|
+
},
|
|
3691
|
+
// ==========================================================================
|
|
3692
|
+
// LLM (Effects)
|
|
3693
|
+
// ==========================================================================
|
|
3694
|
+
"agent/generate": {
|
|
3695
|
+
module: "agent",
|
|
3696
|
+
category: "std-agent",
|
|
3697
|
+
minArity: 1,
|
|
3698
|
+
maxArity: 2,
|
|
3699
|
+
description: "Generate text from the LLM. Returns generated string.",
|
|
3700
|
+
hasSideEffects: true,
|
|
3701
|
+
returnType: "string",
|
|
3702
|
+
params: [
|
|
3703
|
+
{ name: "prompt", type: "string", description: "Prompt text to send to LLM" },
|
|
3704
|
+
{ name: "options", type: "object", description: "Options: { provider?, model?, maxTokens? }", optional: true }
|
|
3705
|
+
],
|
|
3706
|
+
example: '["agent/generate", "Summarize the user request"]'
|
|
3707
|
+
},
|
|
3708
|
+
"agent/switch-provider": {
|
|
3709
|
+
module: "agent",
|
|
3710
|
+
category: "std-agent",
|
|
3711
|
+
minArity: 1,
|
|
3712
|
+
maxArity: 2,
|
|
3713
|
+
description: "Switch the active LLM provider and optionally the model.",
|
|
3714
|
+
hasSideEffects: true,
|
|
3715
|
+
returnType: "void",
|
|
3716
|
+
params: [
|
|
3717
|
+
{ name: "provider", type: "string", description: 'Provider name (e.g., "deepseek", "openai", "anthropic")' },
|
|
3718
|
+
{ name: "model", type: "string", description: "Model name override", optional: true }
|
|
3719
|
+
],
|
|
3720
|
+
example: '["agent/switch-provider", "openai", "gpt-4o"]'
|
|
3721
|
+
},
|
|
3722
|
+
// ==========================================================================
|
|
3723
|
+
// Tools (Effects)
|
|
3724
|
+
// ==========================================================================
|
|
3725
|
+
"agent/invoke": {
|
|
3726
|
+
module: "agent",
|
|
3727
|
+
category: "std-agent",
|
|
3728
|
+
minArity: 2,
|
|
3729
|
+
maxArity: 2,
|
|
3730
|
+
description: "Invoke a tool by name with arguments. Returns tool result.",
|
|
3731
|
+
hasSideEffects: true,
|
|
3732
|
+
returnType: "any",
|
|
3733
|
+
params: [
|
|
3734
|
+
{ name: "toolName", type: "string", description: "Name of the tool to invoke" },
|
|
3735
|
+
{ name: "args", type: "object", description: "Arguments to pass to the tool" }
|
|
3736
|
+
],
|
|
3737
|
+
example: '["agent/invoke", "validate-schema", {"schema": "@entity"}]'
|
|
3738
|
+
},
|
|
3739
|
+
// ==========================================================================
|
|
3740
|
+
// Context (Effects)
|
|
3741
|
+
// ==========================================================================
|
|
3742
|
+
"agent/compact": {
|
|
3743
|
+
module: "agent",
|
|
3744
|
+
category: "std-agent",
|
|
3745
|
+
minArity: 0,
|
|
3746
|
+
maxArity: 1,
|
|
3747
|
+
description: "Compact the context window. Returns { before, after, strategy, summary? }.",
|
|
3748
|
+
hasSideEffects: true,
|
|
3749
|
+
returnType: "object",
|
|
3750
|
+
params: [
|
|
3751
|
+
{ name: "strategy", type: "string", description: "Strategy: hybrid, summarize, truncate, extract", optional: true, defaultValue: "hybrid" }
|
|
3752
|
+
],
|
|
3753
|
+
example: '["agent/compact", "summarize"] => {before: 50000, after: 12000, ...}'
|
|
3754
|
+
},
|
|
3755
|
+
// ==========================================================================
|
|
3756
|
+
// Session (Effects)
|
|
3757
|
+
// ==========================================================================
|
|
3758
|
+
"agent/fork": {
|
|
3759
|
+
module: "agent",
|
|
3760
|
+
category: "std-agent",
|
|
3761
|
+
minArity: 0,
|
|
3762
|
+
maxArity: 1,
|
|
3763
|
+
description: "Fork the current session. Returns new session ID.",
|
|
3764
|
+
hasSideEffects: true,
|
|
3765
|
+
returnType: "string",
|
|
3766
|
+
params: [
|
|
3767
|
+
{ name: "label", type: "string", description: "Optional label for the fork point", optional: true }
|
|
3768
|
+
],
|
|
3769
|
+
example: '["agent/fork", "before-refactor"] => "sess_fork_x7k2m"'
|
|
3770
|
+
},
|
|
3771
|
+
"agent/label": {
|
|
3772
|
+
module: "agent",
|
|
3773
|
+
category: "std-agent",
|
|
3774
|
+
minArity: 1,
|
|
3775
|
+
maxArity: 1,
|
|
3776
|
+
description: "Label the current session checkpoint for later reference.",
|
|
3777
|
+
hasSideEffects: true,
|
|
3778
|
+
returnType: "void",
|
|
3779
|
+
params: [
|
|
3780
|
+
{ name: "text", type: "string", description: "Label text for the checkpoint" }
|
|
3781
|
+
],
|
|
3782
|
+
example: '["agent/label", "schema-v2-complete"]'
|
|
3783
|
+
},
|
|
3784
|
+
// ==========================================================================
|
|
3785
|
+
// Search (Effects)
|
|
3786
|
+
// ==========================================================================
|
|
3787
|
+
"agent/search-code": {
|
|
3788
|
+
module: "agent",
|
|
3789
|
+
category: "std-agent",
|
|
3790
|
+
minArity: 1,
|
|
3791
|
+
maxArity: 2,
|
|
3792
|
+
description: "Search code repositories. Returns array of { repo, path, url }.",
|
|
3793
|
+
hasSideEffects: true,
|
|
3794
|
+
returnType: "array",
|
|
3795
|
+
params: [
|
|
3796
|
+
{ name: "query", type: "string", description: "Code search query" },
|
|
3797
|
+
{ name: "language", type: "string", description: "Programming language filter", optional: true }
|
|
3798
|
+
],
|
|
3799
|
+
example: '["agent/search-code", "orbital schema validation", "typescript"]'
|
|
3800
|
+
}
|
|
3801
|
+
};
|
|
3802
|
+
|
|
3486
3803
|
// registry.ts
|
|
3487
3804
|
var STD_OPERATORS = {
|
|
3488
3805
|
...MATH_OPERATORS,
|
|
@@ -3497,7 +3814,8 @@ var STD_OPERATORS = {
|
|
|
3497
3814
|
...TENSOR_OPERATORS,
|
|
3498
3815
|
...TRAIN_OPERATORS,
|
|
3499
3816
|
...PROB_OPERATORS,
|
|
3500
|
-
...OS_OPERATORS
|
|
3817
|
+
...OS_OPERATORS,
|
|
3818
|
+
...AGENT_OPERATORS
|
|
3501
3819
|
};
|
|
3502
3820
|
var STD_OPERATORS_BY_MODULE = {
|
|
3503
3821
|
math: MATH_OPERATORS,
|
|
@@ -3512,7 +3830,8 @@ var STD_OPERATORS_BY_MODULE = {
|
|
|
3512
3830
|
tensor: TENSOR_OPERATORS,
|
|
3513
3831
|
train: TRAIN_OPERATORS,
|
|
3514
3832
|
prob: PROB_OPERATORS,
|
|
3515
|
-
os: OS_OPERATORS
|
|
3833
|
+
os: OS_OPERATORS,
|
|
3834
|
+
agent: AGENT_OPERATORS
|
|
3516
3835
|
};
|
|
3517
3836
|
function getStdOperatorMeta(operator) {
|
|
3518
3837
|
return STD_OPERATORS[operator];
|