@framers/agentos 0.10.38 → 0.10.40
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/README.md +1 -1
- package/dist/api/runtime/strategies/hierarchical.d.ts +4 -0
- package/dist/api/runtime/strategies/hierarchical.d.ts.map +1 -1
- package/dist/api/runtime/strategies/hierarchical.js +21 -28
- package/dist/api/runtime/strategies/hierarchical.js.map +1 -1
- package/dist/cognition/substrate/GMI.d.ts +2 -0
- package/dist/cognition/substrate/GMI.d.ts.map +1 -1
- package/dist/cognition/substrate/GMI.js +9 -3
- package/dist/cognition/substrate/GMI.js.map +1 -1
- package/dist/cognition/substrate/GMIManager.d.ts +1 -1
- package/dist/cognition/substrate/GMIManager.d.ts.map +1 -1
- package/dist/cognition/substrate/GMIManager.js +2 -0
- package/dist/cognition/substrate/GMIManager.js.map +1 -1
- package/dist/cognition/substrate/IGMI.d.ts +7 -0
- package/dist/cognition/substrate/IGMI.d.ts.map +1 -1
- package/dist/cognition/substrate/IGMI.js.map +1 -1
- package/dist/cognition/substrate/personas/IPersonaDefinition.d.ts +15 -0
- package/dist/cognition/substrate/personas/IPersonaDefinition.d.ts.map +1 -1
- package/dist/cognition/substrate/personas/PersonaValidation.d.ts +0 -12
- package/dist/cognition/substrate/personas/PersonaValidation.d.ts.map +1 -1
- package/dist/cognition/substrate/personas/PersonaValidation.js +40 -0
- package/dist/cognition/substrate/personas/PersonaValidation.js.map +1 -1
- package/dist/cognition/substrate/personas/SoulLoader.d.ts +5 -0
- package/dist/cognition/substrate/personas/SoulLoader.d.ts.map +1 -1
- package/dist/cognition/substrate/personas/SoulLoader.js +8 -0
- package/dist/cognition/substrate/personas/SoulLoader.js.map +1 -1
- package/dist/cognition/substrate/reasoningTraceLimits.d.ts +72 -0
- package/dist/cognition/substrate/reasoningTraceLimits.d.ts.map +1 -0
- package/dist/cognition/substrate/reasoningTraceLimits.js +105 -0
- package/dist/cognition/substrate/reasoningTraceLimits.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** Entries kept when neither the persona nor the runtime sets a limit. */
|
|
2
|
+
export const DEFAULT_REASONING_TRACE_MAX_ENTRIES = 500;
|
|
3
|
+
/** Characters kept per entry message when neither the persona nor the runtime sets a limit. */
|
|
4
|
+
export const DEFAULT_REASONING_TRACE_MAX_MESSAGE_LENGTH = 1000;
|
|
5
|
+
/**
|
|
6
|
+
* Smallest entry cap applied. The self-reflection metaprompt reads the last 20
|
|
7
|
+
* entries and error detection the last 10, so a lower setting is raised to it.
|
|
8
|
+
*/
|
|
9
|
+
export const REASONING_TRACE_MIN_ENTRIES = 20;
|
|
10
|
+
/** Largest entry cap accepted; higher settings are clamped to it. */
|
|
11
|
+
export const REASONING_TRACE_MAX_ENTRIES_CEILING = 5000;
|
|
12
|
+
/** Largest message cap accepted; higher settings are clamped to it. */
|
|
13
|
+
export const REASONING_TRACE_MAX_MESSAGE_LENGTH_CEILING = 20000;
|
|
14
|
+
/** True for an integer greater than zero. */
|
|
15
|
+
export function isPositiveInteger(value) {
|
|
16
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Makes a setting's value safe to record in a trace entry, which is cloned
|
|
20
|
+
* through JSON: finite numbers, strings, booleans and null pass through;
|
|
21
|
+
* `NaN`, `Infinity`, bigints, symbols, functions and objects become their
|
|
22
|
+
* `String()` form, or `[unserializable]` when even that throws.
|
|
23
|
+
*/
|
|
24
|
+
export function toJsonSafe(value) {
|
|
25
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
26
|
+
return value;
|
|
27
|
+
if (typeof value === 'number')
|
|
28
|
+
return Number.isFinite(value) ? value : String(value);
|
|
29
|
+
try {
|
|
30
|
+
return String(value);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return '[unserializable]';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const KEYS = ['maxEntries', 'maxMessageLength'];
|
|
37
|
+
const FLOORS = { maxEntries: REASONING_TRACE_MIN_ENTRIES, maxMessageLength: 1 };
|
|
38
|
+
const CEILINGS = {
|
|
39
|
+
maxEntries: REASONING_TRACE_MAX_ENTRIES_CEILING,
|
|
40
|
+
maxMessageLength: REASONING_TRACE_MAX_MESSAGE_LENGTH_CEILING,
|
|
41
|
+
};
|
|
42
|
+
const DEFAULTS = {
|
|
43
|
+
maxEntries: DEFAULT_REASONING_TRACE_MAX_ENTRIES,
|
|
44
|
+
maxMessageLength: DEFAULT_REASONING_TRACE_MAX_MESSAGE_LENGTH,
|
|
45
|
+
};
|
|
46
|
+
function isPlainObject(value) {
|
|
47
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Picks each limit from the persona, then the runtime config, then the
|
|
51
|
+
* defaults: the first positive integer wins, raised to its floor or clamped to
|
|
52
|
+
* its ceiling. Every setting that was defined but not usable as given is listed
|
|
53
|
+
* in `ignored`, whether or not a higher-precedence setting won: a persona field
|
|
54
|
+
* that is not an object, an unknown key, a value that is not a positive
|
|
55
|
+
* integer, and a value below the floor or above the ceiling.
|
|
56
|
+
*/
|
|
57
|
+
export function resolveReasoningTraceLimits(persona, config) {
|
|
58
|
+
const ignored = [];
|
|
59
|
+
const personaField = persona?.reasoningTraceConfig;
|
|
60
|
+
let personaValues = {};
|
|
61
|
+
if (personaField !== undefined) {
|
|
62
|
+
if (isPlainObject(personaField)) {
|
|
63
|
+
personaValues = personaField;
|
|
64
|
+
for (const name of Object.keys(personaField)) {
|
|
65
|
+
if (!KEYS.includes(name)) {
|
|
66
|
+
ignored.push({ source: 'persona', key: name, value: toJsonSafe(personaField[name]), reason: 'unknown_key' });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
ignored.push({ source: 'persona', key: 'reasoningTraceConfig', value: toJsonSafe(personaField), reason: 'not_an_object' });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const pick = (key) => {
|
|
75
|
+
const candidates = [
|
|
76
|
+
['persona', personaValues[key]],
|
|
77
|
+
['config', key === 'maxEntries' ? config?.defaultReasoningTraceMaxEntries : config?.defaultReasoningTraceMaxMessageLength],
|
|
78
|
+
];
|
|
79
|
+
let chosen;
|
|
80
|
+
for (const [source, value] of candidates) {
|
|
81
|
+
if (value === undefined)
|
|
82
|
+
continue;
|
|
83
|
+
let usable;
|
|
84
|
+
if (!isPositiveInteger(value)) {
|
|
85
|
+
ignored.push({ source, key, value: toJsonSafe(value), reason: 'not_a_positive_integer' });
|
|
86
|
+
}
|
|
87
|
+
else if (value < FLOORS[key]) {
|
|
88
|
+
ignored.push({ source, key, value, reason: 'below_floor' });
|
|
89
|
+
usable = FLOORS[key];
|
|
90
|
+
}
|
|
91
|
+
else if (value > CEILINGS[key]) {
|
|
92
|
+
ignored.push({ source, key, value, reason: 'above_ceiling' });
|
|
93
|
+
usable = CEILINGS[key];
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
usable = value;
|
|
97
|
+
}
|
|
98
|
+
if (chosen === undefined && usable !== undefined)
|
|
99
|
+
chosen = usable;
|
|
100
|
+
}
|
|
101
|
+
return chosen ?? DEFAULTS[key];
|
|
102
|
+
};
|
|
103
|
+
return { maxEntries: pick('maxEntries'), maxMessageLength: pick('maxMessageLength'), ignored };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=reasoningTraceLimits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoningTraceLimits.js","sourceRoot":"","sources":["../../../src/cognition/substrate/reasoningTraceLimits.ts"],"names":[],"mappings":"AAgBA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,CAAC;AACvD,+FAA+F;AAC/F,MAAM,CAAC,MAAM,0CAA0C,GAAG,IAAI,CAAC;AAC/D;;;GAGG;AACH,MAAM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ED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.40",
|
|
4
4
|
"description": "AgentOS: open-source TypeScript framework for autonomous AI agents. Unified graph orchestration, cognitive memory, runtime tool forging, multi-tier guardrails, voice pipeline, and 11 LLM providers.",
|
|
5
5
|
"homepage": "https://agentos.sh",
|
|
6
6
|
"repository": {
|