@framers/agentos 0.12.12 → 0.12.14
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/agency.d.ts.map +1 -1
- package/dist/api/agency.js +26 -5
- package/dist/api/agency.js.map +1 -1
- package/dist/api/agent.d.ts +35 -1
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/agent.js +8 -0
- package/dist/api/agent.js.map +1 -1
- package/dist/api/gmi.d.ts +21 -0
- package/dist/api/gmi.d.ts.map +1 -0
- package/dist/api/gmi.js +527 -0
- package/dist/api/gmi.js.map +1 -0
- package/dist/api/hitl.d.ts +3 -2
- package/dist/api/hitl.d.ts.map +1 -1
- package/dist/api/hitl.js +8 -2
- package/dist/api/hitl.js.map +1 -1
- package/dist/api/runtime/agentCognitiveMemory.d.ts +82 -0
- package/dist/api/runtime/agentCognitiveMemory.d.ts.map +1 -0
- package/dist/api/runtime/agentCognitiveMemory.js +277 -0
- package/dist/api/runtime/agentCognitiveMemory.js.map +1 -0
- package/dist/api/runtime/approval-gate.d.ts +13 -8
- package/dist/api/runtime/approval-gate.d.ts.map +1 -1
- package/dist/api/runtime/approval-gate.js +75 -25
- package/dist/api/runtime/approval-gate.js.map +1 -1
- package/dist/api/runtime/capabilityContract.d.ts +21 -1
- package/dist/api/runtime/capabilityContract.d.ts.map +1 -1
- package/dist/api/runtime/capabilityContract.js +15 -15
- package/dist/api/runtime/capabilityContract.js.map +1 -1
- package/dist/api/runtime/gmiCognition.d.ts +66 -0
- package/dist/api/runtime/gmiCognition.d.ts.map +1 -0
- package/dist/api/runtime/gmiCognition.js +58 -0
- package/dist/api/runtime/gmiCognition.js.map +1 -0
- package/dist/api/runtime/gmiPersona.d.ts +16 -0
- package/dist/api/runtime/gmiPersona.d.ts.map +1 -0
- package/dist/api/runtime/gmiPersona.js +91 -0
- package/dist/api/runtime/gmiPersona.js.map +1 -0
- package/dist/api/runtime/gmiResults.d.ts +98 -0
- package/dist/api/runtime/gmiResults.d.ts.map +1 -0
- package/dist/api/runtime/gmiResults.js +333 -0
- package/dist/api/runtime/gmiResults.js.map +1 -0
- package/dist/api/runtime/gmiSession.d.ts +85 -0
- package/dist/api/runtime/gmiSession.d.ts.map +1 -0
- package/dist/api/runtime/gmiSession.js +285 -0
- package/dist/api/runtime/gmiSession.js.map +1 -0
- package/dist/api/runtime/gmiTranscript.d.ts +48 -0
- package/dist/api/runtime/gmiTranscript.d.ts.map +1 -0
- package/dist/api/runtime/gmiTranscript.js +110 -0
- package/dist/api/runtime/gmiTranscript.js.map +1 -0
- package/dist/api/runtime/lightweightAgentDiagnostics.d.ts +6 -1
- package/dist/api/runtime/lightweightAgentDiagnostics.d.ts.map +1 -1
- package/dist/api/runtime/lightweightAgentDiagnostics.js +9 -2
- package/dist/api/runtime/lightweightAgentDiagnostics.js.map +1 -1
- package/dist/api/runtime/tool-emulation/loop.d.ts +5 -0
- package/dist/api/runtime/tool-emulation/loop.d.ts.map +1 -1
- package/dist/api/runtime/tool-emulation/loop.js +4 -4
- package/dist/api/runtime/tool-emulation/loop.js.map +1 -1
- package/dist/api/sessionHistory.d.ts +43 -1
- package/dist/api/sessionHistory.d.ts.map +1 -1
- package/dist/api/sessionHistory.js +56 -1
- package/dist/api/sessionHistory.js.map +1 -1
- package/dist/api/sessionTranscript.d.ts +8 -0
- package/dist/api/sessionTranscript.d.ts.map +1 -1
- package/dist/api/sessionTranscript.js.map +1 -1
- package/dist/api/transferStyle.d.ts +8 -0
- package/dist/api/transferStyle.d.ts.map +1 -1
- package/dist/api/transferStyle.js +4 -1
- package/dist/api/transferStyle.js.map +1 -1
- package/dist/api/types.d.ts +32 -12
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js.map +1 -1
- package/dist/cognition/substrate/GMI.d.ts.map +1 -1
- package/dist/cognition/substrate/GMI.js +54 -2
- package/dist/cognition/substrate/GMI.js.map +1 -1
- package/dist/cognition/substrate/IGMI.d.ts +23 -1
- package/dist/cognition/substrate/IGMI.d.ts.map +1 -1
- package/dist/cognition/substrate/IGMI.js.map +1 -1
- package/dist/io/vision/VisionPipeline.d.ts +5 -0
- package/dist/io/vision/VisionPipeline.d.ts.map +1 -1
- package/dist/io/vision/VisionPipeline.js +28 -13
- package/dist/io/vision/VisionPipeline.js.map +1 -1
- package/dist/io/vision/index.d.ts.map +1 -1
- package/dist/io/vision/index.js +2 -0
- package/dist/io/vision/index.js.map +1 -1
- package/dist/io/vision/types.d.ts +11 -0
- package/dist/io/vision/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/api/gmi.js
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file gmi.ts
|
|
3
|
+
* gmi(): an agent whose sessions are Generalized Mind Instances, built
|
|
4
|
+
* in-process from agent options (spec D5-D12). `agent({ runtime: 'gmi' })`
|
|
5
|
+
* returns the same handle.
|
|
6
|
+
*
|
|
7
|
+
* Construction checks what needs no environment: options the GMI path cannot
|
|
8
|
+
* honour, the cognition profile, and the `memory.embedding` settings that name
|
|
9
|
+
* their provider. The persona (with the provider and model it resolves), the
|
|
10
|
+
* prompt engine, utility AI and tool orchestrator the sessions share, and the
|
|
11
|
+
* cognitive memory are built on first use, so an agent made before its keys are
|
|
12
|
+
* set resolves them on its first call; a build that fails is not kept, and the
|
|
13
|
+
* next call builds again.
|
|
14
|
+
*/
|
|
15
|
+
import { randomUUID } from 'node:crypto';
|
|
16
|
+
import { GMI } from '../cognition/substrate/GMI.js';
|
|
17
|
+
import { InMemoryWorkingMemory } from '../cognition/substrate/memory/InMemoryWorkingMemory.js';
|
|
18
|
+
import { StatisticalUtilityAI } from '../cognition/nlp/ai_utilities/StatisticalUtilityAI.js';
|
|
19
|
+
import { PromptEngine } from '../core/llm/PromptEngine.js';
|
|
20
|
+
import { ToolPermissionManager } from '../core/tools/permissions/ToolPermissionManager.js';
|
|
21
|
+
import { ToolExecutor } from '../core/tools/ToolExecutor.js';
|
|
22
|
+
import { ToolOrchestrator } from '../core/tools/ToolOrchestrator.js';
|
|
23
|
+
import { ExtensionRegistry } from '../extensions/ExtensionRegistry.js';
|
|
24
|
+
import { EXTENSION_KIND_TOOL } from '../extensions/types.js';
|
|
25
|
+
import { createCompletionGateway } from './runtime/completionGateway.js';
|
|
26
|
+
import { GatewayProviderManager } from './runtime/gatewayProviderManager.js';
|
|
27
|
+
import { adaptTools } from './runtime/toolAdapter.js';
|
|
28
|
+
import { resolveCognition } from './runtime/gmiCognition.js';
|
|
29
|
+
import { personaFromAgentOptions } from './runtime/gmiPersona.js';
|
|
30
|
+
import { assertEmbeddingConfig, createAgentCognitiveMemory } from './runtime/agentCognitiveMemory.js';
|
|
31
|
+
import { sendGmiTurn, streamGmiTurn, TurnLock } from './runtime/gmiSession.js';
|
|
32
|
+
import { transcriptToConversation } from './runtime/gmiTranscript.js';
|
|
33
|
+
import { SessionHistoryBuffer, SESSION_HISTORY_DEFAULTS } from './sessionHistory.js';
|
|
34
|
+
import { accumulateUsage, createEmptyUsageAggregate, mergeAggregates } from './runtime/usageAccumulator.js';
|
|
35
|
+
import { exportAgentConfig, exportAgentConfigJSON } from './agentExportCore.js';
|
|
36
|
+
import { getDeferredCapabilities } from './runtime/lightweightAgentDiagnostics.js';
|
|
37
|
+
/** Options with no GMI-path implementation yet; set, they throw at construction. */
|
|
38
|
+
const UNSUPPORTED_ON_GMI = ['voice', 'avatar', 'channels'];
|
|
39
|
+
/** Per-call overrides generate() and stream() accept on the GMI path (spec D10). */
|
|
40
|
+
const ALLOWED_CALL_OVERRIDES = new Set(['temperature', 'maxTokens', 'topP', 'responseFormat', 'model', 'provider', 'maxSteps', 'usageLedger']);
|
|
41
|
+
/** Per-call overrides that pick the route, the step limit or the ledger rather than a completion option. */
|
|
42
|
+
const ROUTE_OVERRIDES = new Set(['model', 'provider', 'maxSteps', 'usageLedger']);
|
|
43
|
+
/** `agent()`'s step limit. */
|
|
44
|
+
const DEFAULT_MAX_STEPS = 5;
|
|
45
|
+
const GMI_PROMPT_ENGINE_CONFIG = {
|
|
46
|
+
defaultTemplateName: 'openai_chat',
|
|
47
|
+
availableTemplates: {},
|
|
48
|
+
tokenCounting: { strategy: 'estimated', estimationModel: 'gpt-3.5-turbo' },
|
|
49
|
+
// Truncation only: no utility AI is passed, and no summary is made by a model call.
|
|
50
|
+
historyManagement: { defaultMaxMessages: 100000, maxTokensForHistory: 120000, summarizationTriggerRatio: 0, preserveImportantMessages: true },
|
|
51
|
+
contextManagement: { maxRAGContextTokens: 1500, summarizationQualityTier: 'balanced', preserveSourceAttributionInSummary: true },
|
|
52
|
+
contextualElementSelection: { maxElementsPerType: {}, defaultMaxElementsPerType: 3, priorityResolutionStrategy: 'highest_first', conflictResolutionStrategy: 'skip_conflicting' },
|
|
53
|
+
performance: { enableCaching: false, cacheTimeoutSeconds: 60 },
|
|
54
|
+
};
|
|
55
|
+
function isSet(value) {
|
|
56
|
+
if (value == null || value === false)
|
|
57
|
+
return false;
|
|
58
|
+
if (typeof value === 'object')
|
|
59
|
+
return Object.keys(value).length > 0;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A memoised async build that is not kept when it fails: the next call after a
|
|
64
|
+
* rejection builds again, so one transient failure does not fail every later
|
|
65
|
+
* call. `reset()` drops a kept result.
|
|
66
|
+
*/
|
|
67
|
+
function retryingOnce(build) {
|
|
68
|
+
let pending;
|
|
69
|
+
return {
|
|
70
|
+
get() {
|
|
71
|
+
if (!pending) {
|
|
72
|
+
const attempt = build();
|
|
73
|
+
pending = attempt;
|
|
74
|
+
attempt.catch(() => {
|
|
75
|
+
if (pending === attempt)
|
|
76
|
+
pending = undefined;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return pending;
|
|
80
|
+
},
|
|
81
|
+
peek: () => pending,
|
|
82
|
+
reset() {
|
|
83
|
+
pending = undefined;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/** `target` with some members replaced; every other method runs on `target` itself. */
|
|
88
|
+
function withMembers(target, members) {
|
|
89
|
+
return new Proxy(target, {
|
|
90
|
+
get(t, prop) {
|
|
91
|
+
if (Object.prototype.hasOwnProperty.call(members, prop))
|
|
92
|
+
return members[prop];
|
|
93
|
+
const value = Reflect.get(t, prop, t);
|
|
94
|
+
return typeof value === 'function' ? value.bind(t) : value;
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The agent's memory manager as one GMI sees it. `GMI.shutdown()` shuts down
|
|
100
|
+
* the cognitive memory it was given; the agent's sessions share one manager, so
|
|
101
|
+
* a session's shutdown must leave it to the others, and `agent.close()` closes it.
|
|
102
|
+
*/
|
|
103
|
+
function sharedMemoryView(manager) {
|
|
104
|
+
return withMembers(manager, { shutdown: async () => undefined });
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* A tool registry that leaves out the tools ToolExecutor registers from its own
|
|
108
|
+
* constructor (the built-in getCurrentDateTime), so a tool-less agent offers the
|
|
109
|
+
* model no tools (spec D4j) and an agent tool of the same name is the only one.
|
|
110
|
+
* The constructor starts that registration without waiting for it; skipping it
|
|
111
|
+
* here needs no wait, and no later registration can be overtaken by it.
|
|
112
|
+
*/
|
|
113
|
+
class AgentToolRegistry extends ExtensionRegistry {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(...arguments);
|
|
116
|
+
/** False while the executor's constructor registers its built-ins. */
|
|
117
|
+
this.acceptsRegistrations = false;
|
|
118
|
+
}
|
|
119
|
+
async register(...args) {
|
|
120
|
+
if (!this.acceptsRegistrations)
|
|
121
|
+
return;
|
|
122
|
+
return super.register(...args);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function toolExecutorWithoutBuiltIns() {
|
|
126
|
+
const registry = new AgentToolRegistry(EXTENSION_KIND_TOOL);
|
|
127
|
+
const executor = new ToolExecutor(undefined, undefined, registry);
|
|
128
|
+
registry.acceptsRegistrations = true;
|
|
129
|
+
return executor;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The agent's `onBeforeToolExecution` around the shared orchestrator, for one
|
|
133
|
+
* GMI: `null` skips the tool as `generateText` skips it, returned arguments
|
|
134
|
+
* replace the call's, and a hook that throws is warned about and the tool runs.
|
|
135
|
+
*/
|
|
136
|
+
function hookTools(base, hook, step) {
|
|
137
|
+
if (!hook)
|
|
138
|
+
return base;
|
|
139
|
+
const processToolCall = async (details) => {
|
|
140
|
+
const req = details.toolCallRequest;
|
|
141
|
+
let info = {
|
|
142
|
+
name: req.name,
|
|
143
|
+
args: (req.arguments ?? {}),
|
|
144
|
+
id: req.id,
|
|
145
|
+
step: step.index,
|
|
146
|
+
};
|
|
147
|
+
try {
|
|
148
|
+
info = await hook(info);
|
|
149
|
+
}
|
|
150
|
+
catch (hookError) {
|
|
151
|
+
console.warn('[agentos] onBeforeToolExecution hook error:', hookError);
|
|
152
|
+
}
|
|
153
|
+
if (info === null) {
|
|
154
|
+
return {
|
|
155
|
+
toolCallId: req.id,
|
|
156
|
+
toolName: req.name,
|
|
157
|
+
output: { skipped: true },
|
|
158
|
+
isError: true,
|
|
159
|
+
errorDetails: { message: 'Skipped by onBeforeToolExecution hook' },
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return base.processToolCall({ ...details, toolCallRequest: { ...req, arguments: info.args } });
|
|
163
|
+
};
|
|
164
|
+
return withMembers(base, { processToolCall });
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The agent's completion gateway. The GMI's route carries its own `onFallback`
|
|
168
|
+
* (a trace entry), which replaces a gateway default, so the agent's
|
|
169
|
+
* `onFallback` is called beside it, as `onFallback(error, provider)`; a
|
|
170
|
+
* listener that throws is warned about and never fails the hop.
|
|
171
|
+
*/
|
|
172
|
+
function gatewayFor(opts) {
|
|
173
|
+
const base = createCompletionGateway({
|
|
174
|
+
apiKey: opts.apiKey,
|
|
175
|
+
baseUrl: opts.baseUrl,
|
|
176
|
+
fallbackProviders: opts.fallbackProviders,
|
|
177
|
+
policyTier: opts.policyTier,
|
|
178
|
+
router: opts.router,
|
|
179
|
+
routerParams: opts.routerParams,
|
|
180
|
+
hostPolicy: opts.hostPolicy,
|
|
181
|
+
});
|
|
182
|
+
const listener = opts.onFallback;
|
|
183
|
+
if (!listener)
|
|
184
|
+
return base;
|
|
185
|
+
return {
|
|
186
|
+
stream: base.stream,
|
|
187
|
+
resolve: (route, after) => base.resolve({
|
|
188
|
+
...route,
|
|
189
|
+
onFallback: (info) => {
|
|
190
|
+
route.onFallback?.(info);
|
|
191
|
+
try {
|
|
192
|
+
listener(info.error, info.to);
|
|
193
|
+
}
|
|
194
|
+
catch (listenerError) {
|
|
195
|
+
console.warn('[agentos] onFallback listener error:', listenerError);
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
}, after),
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
function mergeLedger(...parts) {
|
|
202
|
+
const merged = Object.assign({}, ...parts.filter(Boolean));
|
|
203
|
+
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
204
|
+
}
|
|
205
|
+
async function recordedUsage(ledger, sessionId) {
|
|
206
|
+
// Imported on use, as agent() imports it: the ledger reads files.
|
|
207
|
+
const { getRecordedAgentOSUsage } = await import('./runtime/usageLedger.js');
|
|
208
|
+
return getRecordedAgentOSUsage({ enabled: ledger?.enabled, path: ledger?.path, sessionId });
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* An agent whose sessions are GMIs (docs/GMI.md, "GMIs from agent()").
|
|
212
|
+
*
|
|
213
|
+
* @param opts - The options of `agent()`. `voice`, `avatar` and `channels` throw.
|
|
214
|
+
* @returns The `Agent` surface: `generate`, `stream`, `session`, `usage`, `close`, `export`.
|
|
215
|
+
* @throws {Error} At construction, naming the option: an option the GMI path
|
|
216
|
+
* cannot honour, an unknown cognition profile or metaprompt preset, or a
|
|
217
|
+
* `memory.embedding` that names a provider without embeddings, a model that
|
|
218
|
+
* does not resolve, or a dimension that is not a positive integer or not known.
|
|
219
|
+
* No environment is read here: the provider and model resolve on the first
|
|
220
|
+
* call, which rejects with the error `agent()` gives when nothing resolves.
|
|
221
|
+
*/
|
|
222
|
+
export function gmi(opts) {
|
|
223
|
+
for (const key of UNSUPPORTED_ON_GMI) {
|
|
224
|
+
if (isSet(opts[key])) {
|
|
225
|
+
throw new Error(`gmi(): '${key}' is not available on the GMI path; remove it or use runtime: 'legacy'.`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const deferred = getDeferredCapabilities(opts, 'gmi');
|
|
229
|
+
if (deferred.length > 0) {
|
|
230
|
+
console.warn(`[AgentOS] gmi() accepted config it does not enforce yet: ${deferred.join(', ')}.`);
|
|
231
|
+
}
|
|
232
|
+
const cognition = resolveCognition(opts);
|
|
233
|
+
const lightCognition = resolveCognition({ cognition: 'light' });
|
|
234
|
+
if (cognition.memory)
|
|
235
|
+
assertEmbeddingConfig(cognition.memory);
|
|
236
|
+
if (cognition.memory && opts.memoryProvider?.getContext) {
|
|
237
|
+
console.warn('[agentos] gmi(): cognitive memory supplies the memory context; memoryProvider.getContext is skipped (observe still runs).');
|
|
238
|
+
}
|
|
239
|
+
const tools = adaptTools(opts.tools);
|
|
240
|
+
const ledger = mergeLedger(opts.observability?.usageLedger ?? opts.usageLedger);
|
|
241
|
+
const maxSteps = opts.maxSteps ?? DEFAULT_MAX_STEPS;
|
|
242
|
+
const gateway = gatewayFor(opts);
|
|
243
|
+
const shared = retryingOnce(async () => {
|
|
244
|
+
// Throws, as generateText throws, when no provider or model resolves.
|
|
245
|
+
const persona = personaFromAgentOptions(opts, cognition, tools);
|
|
246
|
+
const lightPersona = personaFromAgentOptions(opts, lightCognition, tools);
|
|
247
|
+
const promptEngine = new PromptEngine();
|
|
248
|
+
await promptEngine.initialize(GMI_PROMPT_ENGINE_CONFIG);
|
|
249
|
+
const utilityAI = new StatisticalUtilityAI(`gmi-utility-${persona.id}`);
|
|
250
|
+
await utilityAI.initialize({ utilityId: `gmi-utility-${persona.id}` });
|
|
251
|
+
const permissions = new ToolPermissionManager();
|
|
252
|
+
await permissions.initialize({ strictCapabilityChecking: false, logToolCalls: false, toolToSubscriptionFeatures: {} });
|
|
253
|
+
const orchestrator = new ToolOrchestrator();
|
|
254
|
+
await orchestrator.initialize({ orchestratorId: `gmi-tools-${persona.id}`, defaultToolCallTimeoutMs: 30000, maxConcurrentToolCalls: 10, logToolCalls: false, globalDisabledTools: [] }, permissions, toolExecutorWithoutBuiltIns(), tools);
|
|
255
|
+
return { persona, lightPersona, promptEngine, utilityAI, tools: orchestrator };
|
|
256
|
+
});
|
|
257
|
+
const memory = retryingOnce(async () => {
|
|
258
|
+
if (!cognition.memory)
|
|
259
|
+
return undefined;
|
|
260
|
+
const { persona } = await shared.get();
|
|
261
|
+
// Reads the environment for the embedding provider when memory.embedding names none.
|
|
262
|
+
return createAgentCognitiveMemory({ persona, memory: cognition.memory, mechanisms: cognition.mechanisms });
|
|
263
|
+
});
|
|
264
|
+
async function buildGmi(id, persona, mem, steps) {
|
|
265
|
+
const s = await shared.get();
|
|
266
|
+
const step = { index: 0 };
|
|
267
|
+
let turn = { prompt: undefined, memoryContext: undefined };
|
|
268
|
+
const instance = new GMI(id);
|
|
269
|
+
const config = {
|
|
270
|
+
workingMemory: new InMemoryWorkingMemory(),
|
|
271
|
+
promptEngine: s.promptEngine,
|
|
272
|
+
llmProviderManager: new GatewayProviderManager().asProviderManager(),
|
|
273
|
+
utilityAI: s.utilityAI,
|
|
274
|
+
toolOrchestrator: hookTools(s.tools, opts.onBeforeToolExecution, step),
|
|
275
|
+
...(mem ? { cognitiveMemory: sharedMemoryView(mem.manager) } : {}),
|
|
276
|
+
completionGateway: gateway,
|
|
277
|
+
maxToolLoopIterations: steps,
|
|
278
|
+
defaultLlmProviderId: persona.defaultProviderId,
|
|
279
|
+
defaultLlmModelId: persona.defaultModelId,
|
|
280
|
+
// Every model call: the memoryProvider block after the leading system
|
|
281
|
+
// messages (where the legacy path puts it), then onBeforeGeneration.
|
|
282
|
+
beforeModelCall: async (ctx) => {
|
|
283
|
+
step.index = ctx.stepIndex;
|
|
284
|
+
let messages = ctx.messages;
|
|
285
|
+
let changed = false;
|
|
286
|
+
if (turn.memoryContext) {
|
|
287
|
+
let insertAt = 0;
|
|
288
|
+
while (insertAt < messages.length && messages[insertAt].role === 'system')
|
|
289
|
+
insertAt += 1;
|
|
290
|
+
messages = [...messages.slice(0, insertAt), { role: 'system', content: turn.memoryContext }, ...messages.slice(insertAt)];
|
|
291
|
+
changed = true;
|
|
292
|
+
}
|
|
293
|
+
if (opts.onBeforeGeneration) {
|
|
294
|
+
try {
|
|
295
|
+
const modified = await opts.onBeforeGeneration({
|
|
296
|
+
messages: messages,
|
|
297
|
+
system: typeof persona.baseSystemPrompt === 'string' ? persona.baseSystemPrompt : undefined,
|
|
298
|
+
tools,
|
|
299
|
+
model: ctx.modelId,
|
|
300
|
+
provider: ctx.providerId,
|
|
301
|
+
step: ctx.stepIndex,
|
|
302
|
+
prompt: turn.prompt,
|
|
303
|
+
});
|
|
304
|
+
if (modified?.messages) {
|
|
305
|
+
messages = modified.messages;
|
|
306
|
+
changed = true;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch (hookError) {
|
|
310
|
+
console.warn('[agentos] onBeforeGeneration hook error:', hookError);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return changed ? messages : undefined;
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
await instance.initialize(persona, config);
|
|
317
|
+
return {
|
|
318
|
+
gmi: instance,
|
|
319
|
+
prepare: (context) => {
|
|
320
|
+
turn = context;
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/** A GMI for one turn only, shut down once the turn ends. */
|
|
325
|
+
function forOneTurn(built) {
|
|
326
|
+
return { ...built, release: () => built.gmi.shutdown() };
|
|
327
|
+
}
|
|
328
|
+
const sessions = new Map();
|
|
329
|
+
const sessionTallies = new Map();
|
|
330
|
+
const agentTally = createEmptyUsageAggregate();
|
|
331
|
+
/** The per-call overrides as completion options; throws naming an override the GMI path does not take. */
|
|
332
|
+
function overridesOf(extra) {
|
|
333
|
+
const out = {};
|
|
334
|
+
for (const [k, v] of Object.entries(extra ?? {})) {
|
|
335
|
+
if (v === undefined)
|
|
336
|
+
continue;
|
|
337
|
+
if (!ALLOWED_CALL_OVERRIDES.has(k))
|
|
338
|
+
throw new Error(`gmi(): the per-call option '${k}' is not supported on the GMI path.`);
|
|
339
|
+
if (!ROUTE_OVERRIDES.has(k))
|
|
340
|
+
out[k] = v;
|
|
341
|
+
}
|
|
342
|
+
return out;
|
|
343
|
+
}
|
|
344
|
+
function oneShotDeps(source, extra) {
|
|
345
|
+
const callId = `${source === 'agent.generate' ? 'generate' : 'stream'}-${randomUUID()}`;
|
|
346
|
+
return {
|
|
347
|
+
sessionId: callId,
|
|
348
|
+
opts,
|
|
349
|
+
userId: callId,
|
|
350
|
+
useMemoryProviderContext: true,
|
|
351
|
+
history: null,
|
|
352
|
+
ledger: mergeLedger(ledger, extra?.usageLedger, { source: extra?.usageLedger?.source ?? source }),
|
|
353
|
+
onUsage: (u) => accumulateUsage(agentTally, u),
|
|
354
|
+
lock: new TurnLock(),
|
|
355
|
+
// generate() and stream() keep no history and run the light profile whatever the agent's (spec D10).
|
|
356
|
+
gmiFor: async () => {
|
|
357
|
+
const s = await shared.get();
|
|
358
|
+
const persona = extra && (extra.model || extra.provider)
|
|
359
|
+
? personaFromAgentOptions({ ...opts, model: extra.model ?? opts.model, provider: extra.provider ?? opts.provider }, lightCognition, tools)
|
|
360
|
+
: s.lightPersona;
|
|
361
|
+
return forOneTurn(await buildGmi(`gmi-${persona.id}-${callId}`, persona, undefined, extra?.maxSteps ?? maxSteps));
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const handle = {
|
|
366
|
+
async generate(prompt, extra) {
|
|
367
|
+
const options = overridesOf(extra);
|
|
368
|
+
return sendGmiTurn(oneShotDeps('agent.generate', extra), prompt, { options });
|
|
369
|
+
},
|
|
370
|
+
stream(prompt, extra) {
|
|
371
|
+
const options = overridesOf(extra);
|
|
372
|
+
return streamGmiTurn(oneShotDeps('agent.stream', extra), prompt, { options });
|
|
373
|
+
},
|
|
374
|
+
session(id, sessionOptions) {
|
|
375
|
+
const sessionId = id ?? randomUUID();
|
|
376
|
+
const existing = sessions.get(sessionId);
|
|
377
|
+
if (existing) {
|
|
378
|
+
if (sessionOptions?.userId !== undefined && sessionOptions.userId !== existing.userId) {
|
|
379
|
+
throw new Error(`gmi(): session '${sessionId}' already runs as user '${existing.userId}'; close it to open it for another user.`);
|
|
380
|
+
}
|
|
381
|
+
return existing.session;
|
|
382
|
+
}
|
|
383
|
+
// Each session's memory scope is its own unless the caller names the user:
|
|
384
|
+
// sessions are often different people, and one person's facts must not
|
|
385
|
+
// reach another's replies.
|
|
386
|
+
const userId = sessionOptions?.userId ?? sessionId;
|
|
387
|
+
const history = opts.history === false ? null : new SessionHistoryBuffer({ ...SESSION_HISTORY_DEFAULTS, ...(opts.history ?? {}) });
|
|
388
|
+
if (!sessionTallies.has(sessionId))
|
|
389
|
+
sessionTallies.set(sessionId, createEmptyUsageAggregate(sessionId));
|
|
390
|
+
const tally = sessionTallies.get(sessionId);
|
|
391
|
+
const lock = new TurnLock();
|
|
392
|
+
let closing;
|
|
393
|
+
const buildSessionGmi = async (gmiId) => {
|
|
394
|
+
const { persona } = await shared.get();
|
|
395
|
+
return buildGmi(gmiId, persona, await memory.get(), maxSteps);
|
|
396
|
+
};
|
|
397
|
+
// The session's own GMI, when it keeps history; a GMI per turn otherwise.
|
|
398
|
+
const own = retryingOnce(() => buildSessionGmi(`gmi-${sessionId}`));
|
|
399
|
+
let ownBuilt;
|
|
400
|
+
// A send made after close() fails; one made before it runs, and close() waits for it.
|
|
401
|
+
const gmiFor = (closedAtCall) => async () => {
|
|
402
|
+
if (closedAtCall)
|
|
403
|
+
throw new Error(`gmi(): session '${sessionId}' is closed; agent.session('${sessionId}') opens a new one.`);
|
|
404
|
+
if (!history)
|
|
405
|
+
return forOneTurn(await buildSessionGmi(`gmi-${sessionId}-${randomUUID()}`));
|
|
406
|
+
ownBuilt = await own.get();
|
|
407
|
+
return ownBuilt;
|
|
408
|
+
};
|
|
409
|
+
/** Brings the session GMI's own history in line with the store once the running turn ends, so a cleared fact never reaches its sentiment tracker or metaprompts. */
|
|
410
|
+
const syncGmiHistory = () => {
|
|
411
|
+
void lock
|
|
412
|
+
.acquire()
|
|
413
|
+
.then((release) => {
|
|
414
|
+
try {
|
|
415
|
+
ownBuilt?.gmi.replaceHistory?.(transcriptToConversation(history?.messages() ?? []));
|
|
416
|
+
}
|
|
417
|
+
finally {
|
|
418
|
+
release();
|
|
419
|
+
}
|
|
420
|
+
})
|
|
421
|
+
.catch((error) => console.warn('[agentos] gmi(): could not clear the session GMI history:', error));
|
|
422
|
+
};
|
|
423
|
+
const deps = (source) => ({
|
|
424
|
+
sessionId,
|
|
425
|
+
opts,
|
|
426
|
+
userId,
|
|
427
|
+
history,
|
|
428
|
+
lock,
|
|
429
|
+
ledger: mergeLedger(ledger, { sessionId, source }),
|
|
430
|
+
useMemoryProviderContext: !cognition.memory,
|
|
431
|
+
gmiFor: gmiFor(closing !== undefined),
|
|
432
|
+
onUsage: (u) => {
|
|
433
|
+
accumulateUsage(tally, u);
|
|
434
|
+
accumulateUsage(agentTally, u);
|
|
435
|
+
},
|
|
436
|
+
});
|
|
437
|
+
const session = {
|
|
438
|
+
id: sessionId,
|
|
439
|
+
send: (input, sendOpts) => {
|
|
440
|
+
const options = Object.fromEntries(Object.entries({
|
|
441
|
+
toolChoice: sendOpts?.toolChoice,
|
|
442
|
+
requestTimeout: sendOpts?.requestTimeout,
|
|
443
|
+
cacheDiagnostics: sendOpts?.cacheDiagnostics,
|
|
444
|
+
cache: sendOpts?.cache,
|
|
445
|
+
maxTokens: sendOpts?.maxTokens,
|
|
446
|
+
}).filter(([, v]) => v !== undefined));
|
|
447
|
+
return sendGmiTurn(deps('agent.session.send'), input, {
|
|
448
|
+
options,
|
|
449
|
+
responseSchema: sendOpts?.responseSchema,
|
|
450
|
+
schemaName: sendOpts?.schemaName,
|
|
451
|
+
blockLabel: sendOpts?.blockLabel,
|
|
452
|
+
});
|
|
453
|
+
},
|
|
454
|
+
stream: (input) => streamGmiTurn(deps('agent.session.stream'), input, {}),
|
|
455
|
+
messages: () => history?.messages() ?? [],
|
|
456
|
+
reseed: (snapshot) => {
|
|
457
|
+
if (!history)
|
|
458
|
+
throw new Error('reseed requires session history (history: false is set on this agent)');
|
|
459
|
+
history.reseed(snapshot);
|
|
460
|
+
syncGmiHistory();
|
|
461
|
+
},
|
|
462
|
+
drainHistoryEvents: () => history?.drainHistoryEvents() ?? [],
|
|
463
|
+
usage: async () => {
|
|
464
|
+
const persisted = await recordedUsage(ledger, sessionId);
|
|
465
|
+
return ledger?.enabled ? persisted : mergeAggregates(tally, persisted);
|
|
466
|
+
},
|
|
467
|
+
clear: () => {
|
|
468
|
+
history?.reseed([]);
|
|
469
|
+
syncGmiHistory();
|
|
470
|
+
},
|
|
471
|
+
// A turn still running ends first and is returned to its caller, but the
|
|
472
|
+
// reseed keeps it out of the history; then the session's GMI is shut down.
|
|
473
|
+
close: () => (closing ?? (closing = (async () => {
|
|
474
|
+
if (sessions.get(sessionId) === entry)
|
|
475
|
+
sessions.delete(sessionId);
|
|
476
|
+
history?.reseed([]);
|
|
477
|
+
const release = await lock.acquire();
|
|
478
|
+
try {
|
|
479
|
+
const built = await own.peek()?.catch(() => undefined);
|
|
480
|
+
await built?.gmi.shutdown();
|
|
481
|
+
}
|
|
482
|
+
finally {
|
|
483
|
+
release();
|
|
484
|
+
}
|
|
485
|
+
})())),
|
|
486
|
+
};
|
|
487
|
+
const entry = { session, userId };
|
|
488
|
+
sessions.set(sessionId, entry);
|
|
489
|
+
return session;
|
|
490
|
+
},
|
|
491
|
+
async usage(sessionId) {
|
|
492
|
+
const persisted = await recordedUsage(ledger, sessionId);
|
|
493
|
+
const inMemory = sessionId ? sessionTallies.get(sessionId) ?? createEmptyUsageAggregate(sessionId) : agentTally;
|
|
494
|
+
return ledger?.enabled ? persisted : mergeAggregates(inMemory, persisted);
|
|
495
|
+
},
|
|
496
|
+
/**
|
|
497
|
+
* Closes every session (each after its running turn), then the cognitive
|
|
498
|
+
* memory; a session opened from now on builds a new one. The tools stay as
|
|
499
|
+
* the caller passed them: the orchestrator is not shut down, because
|
|
500
|
+
* shutting it down would shut down the caller's tools.
|
|
501
|
+
*/
|
|
502
|
+
async close() {
|
|
503
|
+
const pending = memory.peek();
|
|
504
|
+
memory.reset();
|
|
505
|
+
await Promise.all([...sessions.values()].map(({ session }) => session.close()));
|
|
506
|
+
const mem = await pending?.catch(() => undefined);
|
|
507
|
+
await mem?.close();
|
|
508
|
+
},
|
|
509
|
+
export(metadata, options) {
|
|
510
|
+
return exportAgentConfig(handle, metadata, options);
|
|
511
|
+
},
|
|
512
|
+
exportJSON(metadata, options) {
|
|
513
|
+
return exportAgentConfigJSON(handle, metadata, options);
|
|
514
|
+
},
|
|
515
|
+
getAvatarBindings() {
|
|
516
|
+
return {};
|
|
517
|
+
},
|
|
518
|
+
setAvatarBindingOverrides() {
|
|
519
|
+
// avatar is not available on the GMI path
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
Object.defineProperty(handle, '__config', { value: opts, enumerable: false, configurable: true });
|
|
523
|
+
return handle;
|
|
524
|
+
}
|
|
525
|
+
/** Alias of {@link gmi}. */
|
|
526
|
+
export const createGmi = gmi;
|
|
527
|
+
//# sourceMappingURL=gmi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gmi.js","sourceRoot":"","sources":["../../src/api/gmi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,G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AC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC1D,CAAC;QACD,iBAAiB;YACf,OAAO,EAA4C,CAAC;QACtD,CAAC;QACD,yBAAyB;YACvB,0CAA0C;QAC5C,CAAC;KACF,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC"}
|
package/dist/api/hitl.d.ts
CHANGED
|
@@ -81,8 +81,9 @@ export declare const hitl: {
|
|
|
81
81
|
* Returns a handler that pauses execution and prompts the user interactively
|
|
82
82
|
* via `stdin`/`stdout`.
|
|
83
83
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
84
|
+
* Prints the request's description, agent, action, type and details (for a
|
|
85
|
+
* tool call, the arguments it will run with), then waits for the user to
|
|
86
|
+
* type `y` (approve) or `n` (reject).
|
|
86
87
|
*
|
|
87
88
|
* **Important**: This handler reads from `process.stdin`, so it must only be
|
|
88
89
|
* used in interactive terminal environments (not in CI/CD pipelines or
|
package/dist/api/hitl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl.d.ts","sourceRoot":"","sources":["../../src/api/hitl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAMzE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAMlF;;;;;;GAMG;AACH,e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CAAC,EAAE,MAAM,CAAC;KACjB,GAAQ,WAAW;CAuErB,CAAC"}
|
package/dist/api/hitl.js
CHANGED
|
@@ -94,8 +94,9 @@ export const hitl = {
|
|
|
94
94
|
* Returns a handler that pauses execution and prompts the user interactively
|
|
95
95
|
* via `stdin`/`stdout`.
|
|
96
96
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* Prints the request's description, agent, action, type and details (for a
|
|
98
|
+
* tool call, the arguments it will run with), then waits for the user to
|
|
99
|
+
* type `y` (approve) or `n` (reject).
|
|
99
100
|
*
|
|
100
101
|
* **Important**: This handler reads from `process.stdin`, so it must only be
|
|
101
102
|
* used in interactive terminal environments (not in CI/CD pipelines or
|
|
@@ -111,6 +112,7 @@ export const hitl = {
|
|
|
111
112
|
cli() {
|
|
112
113
|
return async (request) => {
|
|
113
114
|
const readline = await import('node:readline');
|
|
115
|
+
const { inspect } = await import('node:util');
|
|
114
116
|
const rl = readline.createInterface({
|
|
115
117
|
input: process.stdin,
|
|
116
118
|
output: process.stdout,
|
|
@@ -119,6 +121,10 @@ export const hitl = {
|
|
|
119
121
|
console.log(`\n[APPROVAL NEEDED] ${request.description}`);
|
|
120
122
|
console.log(`Agent: ${request.agent} | Action: ${request.action}`);
|
|
121
123
|
console.log(`Type: ${request.type}`);
|
|
124
|
+
// What is being approved: for a tool call, the arguments it will run
|
|
125
|
+
// with, in full. They are printed here and kept out of the
|
|
126
|
+
// description, which hitl.slack posts to a channel.
|
|
127
|
+
console.log(`Details: ${inspect(request.details, { depth: null, maxArrayLength: null, maxStringLength: null, breakLength: 100 })}`);
|
|
122
128
|
rl.question('Approve? (y/n): ', (answer) => {
|
|
123
129
|
rl.close();
|
|
124
130
|
resolve({ approved: answer.toLowerCase().startsWith('y') });
|
package/dist/api/hitl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hitl.js","sourceRoot":"","sources":["../../src/api/hitl.ts"],"names":[],"mappings":"AAAA;;;;;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