@cat-factory/agents 0.85.0 → 0.86.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LanguageModel } from 'ai';
|
|
2
|
-
import type { InlineObservabilityContext, LlmTraceSink, Logger, ModelProvider, ModelRef, StoreAgentContextGate } from '@cat-factory/kernel';
|
|
2
|
+
import type { InlineLlmCallRecorder, InlineObservabilityContext, LlmTraceSink, Logger, ModelProvider, ModelRef, StoreAgentContextGate } from '@cat-factory/kernel';
|
|
3
3
|
import { catFactoryObservability } from '@cat-factory/kernel';
|
|
4
4
|
/**
|
|
5
5
|
* Whether prompt/response BODIES may leave this workspace for a trace sink — the
|
|
@@ -19,20 +19,34 @@ export type WorkspaceBodiesGate = StoreAgentContextGate;
|
|
|
19
19
|
export { catFactoryObservability };
|
|
20
20
|
export type { InlineObservabilityContext };
|
|
21
21
|
/**
|
|
22
|
-
* A {@link ModelProvider} that wraps every resolved model so inline LLM calls surface
|
|
23
|
-
*
|
|
24
|
-
* unwrapped provider behaves exactly as before.
|
|
22
|
+
* A {@link ModelProvider} that wraps every resolved model so inline LLM calls surface on the
|
|
23
|
+
* telemetry store and/or the external trace sink. Build it only when at least one of those
|
|
24
|
+
* exits is wired AND the deployment opts in; an unwrapped provider behaves exactly as before.
|
|
25
25
|
*/
|
|
26
26
|
export declare class InstrumentedModelProvider implements ModelProvider {
|
|
27
27
|
private readonly inner;
|
|
28
|
-
private readonly traceSink
|
|
28
|
+
private readonly traceSink?;
|
|
29
|
+
private readonly recordCall?;
|
|
29
30
|
private readonly recordPrompts;
|
|
30
31
|
private readonly workspaceBodiesEnabled;
|
|
31
32
|
private readonly now;
|
|
32
33
|
private readonly log;
|
|
33
34
|
constructor(deps: {
|
|
34
35
|
inner: ModelProvider;
|
|
35
|
-
|
|
36
|
+
/**
|
|
37
|
+
* The external trace sink (Langfuse / OTel). Used for a call {@link recordCall} cannot
|
|
38
|
+
* take, and as the sole exit on a deployment with a sink but no metric store. When both
|
|
39
|
+
* are wired this MUST be the same instance the recorder's service fans out to, or the
|
|
40
|
+
* two exits describe the same generation to the sink differently.
|
|
41
|
+
*/
|
|
42
|
+
traceSink?: LlmTraceSink;
|
|
43
|
+
/**
|
|
44
|
+
* Persist each workspace-scoped inline call to `llm_call_metrics` (and, through the
|
|
45
|
+
* service behind it, to the trace sink). Wired wherever the facade has a metric store —
|
|
46
|
+
* without it the inline half of the platform's model activity is invisible to every
|
|
47
|
+
* in-app observability surface, which is the gap this exists to close.
|
|
48
|
+
*/
|
|
49
|
+
recordCall?: InlineLlmCallRecorder;
|
|
36
50
|
/** Honour the same `LLM_RECORD_PROMPTS` switch as the local store; default true. */
|
|
37
51
|
recordPrompts?: boolean;
|
|
38
52
|
/**
|
|
@@ -43,6 +57,10 @@ export declare class InstrumentedModelProvider implements ModelProvider {
|
|
|
43
57
|
* not a coverage gap (observability-logging-gaps.md, C2). An absent optional gate is
|
|
44
58
|
* open by definition, which is exactly the failure mode; requiring it makes forgetting
|
|
45
59
|
* one a typecheck failure instead of a silent leak.
|
|
60
|
+
*
|
|
61
|
+
* Applies to the {@link traceSink} exit only: a call taken by {@link recordCall} is
|
|
62
|
+
* gated INSIDE the service, by the very same rule from the very same kernel factory, so
|
|
63
|
+
* re-applying it here would only create a second place for the rule to drift.
|
|
46
64
|
*/
|
|
47
65
|
workspaceBodiesEnabled: WorkspaceBodiesGate;
|
|
48
66
|
/** Injectable clock (tests); defaults to `Date.now`. */
|
|
@@ -53,6 +71,18 @@ export declare class InstrumentedModelProvider implements ModelProvider {
|
|
|
53
71
|
resolve(ref: ModelRef): LanguageModel;
|
|
54
72
|
private middlewareFor;
|
|
55
73
|
private emit;
|
|
74
|
+
/**
|
|
75
|
+
* Hand a workspace-scoped call to the metric recorder. Bodies are passed through
|
|
76
|
+
* UNGATED on purpose: the service behind the recorder scrubs them and applies the same
|
|
77
|
+
* `LLM_RECORD_PROMPTS` + `storeAgentContext` double gate this class applies to the sink
|
|
78
|
+
* exit — gating here as well would drop a body the service is entitled to store and put
|
|
79
|
+
* the rule in two places, which is how the sink half drifted open in the first place.
|
|
80
|
+
* They are handed over as THUNKS so keeping the gate on the far side costs nothing: a
|
|
81
|
+
* deployment with recording off never pays to serialise the prompt array.
|
|
82
|
+
*
|
|
83
|
+
* Best-effort and off the response path, exactly like the sink exit.
|
|
84
|
+
*/
|
|
85
|
+
private record;
|
|
56
86
|
/**
|
|
57
87
|
* The double gate on prompt/response bodies: the deployment-wide `LLM_RECORD_PROMPTS`
|
|
58
88
|
* switch AND the workspace's own `storeAgentContext` opt-out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumented.d.ts","sourceRoot":"","sources":["../../src/providers/instrumented.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,KAAK,EACV,0BAA0B,EAE1B,YAAY,EACZ,MAAM,EACN,aAAa,EACb,QAAQ,EACR,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,uBAAuB,EAKxB,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAKvD,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAClC,YAAY,EAAE,0BAA0B,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"instrumented.d.ts","sourceRoot":"","sources":["../../src/providers/instrumented.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAE1B,YAAY,EACZ,MAAM,EACN,aAAa,EACb,QAAQ,EACR,qBAAqB,EACtB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,uBAAuB,EAKxB,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAKvD,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAClC,YAAY,EAAE,0BAA0B,EAAE,CAAA;AAmJ1C;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,aAAa;IAC7D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAuB;IACnD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAqB;IAC5D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,YAAY,IAAI,EAAE;QAChB,KAAK,EAAE,aAAa,CAAA;QACpB;;;;;WAKG;QACH,SAAS,CAAC,EAAE,YAAY,CAAA;QACxB;;;;;WAKG;QACH,UAAU,CAAC,EAAE,qBAAqB,CAAA;QAClC,oFAAoF;QACpF,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB;;;;;;;;;;;;WAYG;QACH,sBAAsB,EAAE,mBAAmB,CAAA;QAC3C,wDAAwD;QACxD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;QAClB,2EAA2E;QAC3E,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,EAgBA;IAED,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,CAWpC;IAED,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,IAAI;IA4EZ;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM;IAiDd;;;;;;;;;OASG;YACW,aAAa;CAY5B"}
|
|
@@ -4,14 +4,27 @@ import { catFactoryObservability, describeError, noopLogger, readInlineObservabi
|
|
|
4
4
|
// observability tag from here; the canonical, dependency-free definition lives in the
|
|
5
5
|
// kernel so any caller layer can build the tag without depending on this package.
|
|
6
6
|
export { catFactoryObservability };
|
|
7
|
-
// Instruments the INLINE (non-proxied) LLM calls so they reach the SAME
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
7
|
+
// Instruments the INLINE (non-proxied) LLM calls so they reach the SAME sinks as the
|
|
8
|
+
// container-agent calls. Container calls go through the LLM proxy (or, on a subscription
|
|
9
|
+
// harness, the harness's own stream), and both feed the orchestration
|
|
10
|
+
// `LlmObservabilityService`, which persists the call to `llm_call_metrics` and fans it out
|
|
11
|
+
// to the external trace sink. Inline calls (requirements review/rework, the document
|
|
12
|
+
// researcher/outliner/interviewer, the judges, consensus, the fragment selector, the inline
|
|
13
|
+
// agent executor) call the AI SDK directly. This decorator wraps every resolved model with an
|
|
14
|
+
// AI SDK middleware that, after each generate, feeds the same telemetry through one of two
|
|
15
|
+
// exits — so adding the inline feeder never means a second sink OR a second store:
|
|
16
|
+
//
|
|
17
|
+
// - `recordCall` (preferred) — the {@link InlineLlmCallRecorder} the facade builds off
|
|
18
|
+
// `LlmObservabilityService`. It persists the row AND owns the trace-sink fan-out, so an
|
|
19
|
+
// inline call recorded this way is visible to `ObservabilityPanel`, the per-step token
|
|
20
|
+
// rollups and `/api/v1/debug/*` exactly like a proxied one. Requires a workspace to file
|
|
21
|
+
// the row under.
|
|
22
|
+
// - `traceSink` — the direct emit, for a deployment that wires a sink but no metric store,
|
|
23
|
+
// and for the un-tagged call `recordCall` structurally cannot take (see below).
|
|
24
|
+
//
|
|
25
|
+
// EXACTLY ONE of the two runs per call. `recordCall`'s service already fans out to the sink
|
|
26
|
+
// it was built with, so calling both would double every inline generation on Langfuse/OTel;
|
|
27
|
+
// the facade therefore hands the SAME sink instance to both.
|
|
15
28
|
//
|
|
16
29
|
// The middleware is transparent: callers keep calling `generateText({ model })`
|
|
17
30
|
// unchanged. To group a call under its run's trace and label it, a caller passes
|
|
@@ -72,25 +85,78 @@ function readOutputText(result) {
|
|
|
72
85
|
}
|
|
73
86
|
return '';
|
|
74
87
|
}
|
|
88
|
+
/** Extract the model's reasoning/thinking trace from a generate result, when it came separately. */
|
|
89
|
+
function readReasoningText(result) {
|
|
90
|
+
const content = result?.content;
|
|
91
|
+
if (!Array.isArray(content))
|
|
92
|
+
return '';
|
|
93
|
+
return content
|
|
94
|
+
.filter((part) => part?.type === 'reasoning')
|
|
95
|
+
.map((part) => String(part.text ?? ''))
|
|
96
|
+
.join('');
|
|
97
|
+
}
|
|
98
|
+
/** How many chat messages the request carried (the store's chain uses this as the turn size). */
|
|
99
|
+
function readMessageCount(params) {
|
|
100
|
+
const prompt = params?.prompt;
|
|
101
|
+
return Array.isArray(prompt) ? prompt.length : 0;
|
|
102
|
+
}
|
|
103
|
+
/** How many tools the request offered, across the SDK's array and record `tools` shapes. */
|
|
104
|
+
function readToolCount(params) {
|
|
105
|
+
const tools = params?.tools;
|
|
106
|
+
if (Array.isArray(tools))
|
|
107
|
+
return tools.length;
|
|
108
|
+
if (tools && typeof tools === 'object')
|
|
109
|
+
return Object.keys(tools).length;
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
/** The output ceiling the request asked for, or null when it named none. */
|
|
113
|
+
function readRequestMaxTokens(params) {
|
|
114
|
+
const max = params?.maxOutputTokens;
|
|
115
|
+
return typeof max === 'number' ? max : null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The call's finish reason, across the SDK's two shapes.
|
|
119
|
+
*
|
|
120
|
+
* The current (v3) spec reports an OBJECT — `{ unified, raw? }` — where `unified` is the
|
|
121
|
+
* provider-independent reason and `raw` whatever the vendor called it; only the older flat
|
|
122
|
+
* spec reports the bare string. Reading the string alone silently answered `null` for every
|
|
123
|
+
* real call, which is invisible in telemetry (a null finish reason reads as "the provider
|
|
124
|
+
* didn't say") and is why this has a test driving the SDK's own mock model rather than a
|
|
125
|
+
* hand-rolled stand-in that returned the shape the reader wanted.
|
|
126
|
+
*
|
|
127
|
+
* `unified` is the one stored: it is what makes `length` comparable across providers, which
|
|
128
|
+
* is the whole reason a truncated-output signal can be computed at all.
|
|
129
|
+
*/
|
|
75
130
|
function readFinishReason(result) {
|
|
76
131
|
const reason = result?.finishReason;
|
|
77
|
-
|
|
132
|
+
if (typeof reason === 'string')
|
|
133
|
+
return reason;
|
|
134
|
+
const unified = reason?.unified;
|
|
135
|
+
return typeof unified === 'string' ? unified : null;
|
|
78
136
|
}
|
|
79
137
|
/**
|
|
80
|
-
* A {@link ModelProvider} that wraps every resolved model so inline LLM calls surface
|
|
81
|
-
*
|
|
82
|
-
* unwrapped provider behaves exactly as before.
|
|
138
|
+
* A {@link ModelProvider} that wraps every resolved model so inline LLM calls surface on the
|
|
139
|
+
* telemetry store and/or the external trace sink. Build it only when at least one of those
|
|
140
|
+
* exits is wired AND the deployment opts in; an unwrapped provider behaves exactly as before.
|
|
83
141
|
*/
|
|
84
142
|
export class InstrumentedModelProvider {
|
|
85
143
|
inner;
|
|
86
144
|
traceSink;
|
|
145
|
+
recordCall;
|
|
87
146
|
recordPrompts;
|
|
88
147
|
workspaceBodiesEnabled;
|
|
89
148
|
now;
|
|
90
149
|
log;
|
|
91
150
|
constructor(deps) {
|
|
151
|
+
if (!deps.traceSink && !deps.recordCall) {
|
|
152
|
+
// A provider that instruments nothing is a wiring mistake wearing the instrumented
|
|
153
|
+
// wrapper's clothes: every call would pay the middleware and reach no sink, and the
|
|
154
|
+
// facade's `instanceof InstrumentedModelProvider` wiring assertions would still pass.
|
|
155
|
+
throw new Error('InstrumentedModelProvider needs at least one exit: a traceSink, a recordCall, or both.');
|
|
156
|
+
}
|
|
92
157
|
this.inner = deps.inner;
|
|
93
158
|
this.traceSink = deps.traceSink;
|
|
159
|
+
this.recordCall = deps.recordCall;
|
|
94
160
|
this.recordPrompts = deps.recordPrompts ?? true;
|
|
95
161
|
this.workspaceBodiesEnabled = deps.workspaceBodiesEnabled;
|
|
96
162
|
this.now = deps.now ?? (() => Date.now());
|
|
@@ -131,11 +197,36 @@ export class InstrumentedModelProvider {
|
|
|
131
197
|
const context = readInlineObservabilityContext(params);
|
|
132
198
|
const usage = readUsage(result?.usage);
|
|
133
199
|
const workspaceId = context.workspaceId ?? null;
|
|
200
|
+
const executionId = context.executionId ?? null;
|
|
201
|
+
const finishReason = ok ? readFinishReason(result) : null;
|
|
202
|
+
// The recorder is the richer exit AND owns the sink fan-out, so a workspace-scoped call
|
|
203
|
+
// takes it and stops. An un-tagged call (`workspaceId: null`) has no workspace to file a
|
|
204
|
+
// row under, so it falls through to the sink — which is also the whole story on a
|
|
205
|
+
// deployment that wires a sink but retains no metrics.
|
|
206
|
+
if (this.recordCall && workspaceId) {
|
|
207
|
+
this.record(this.recordCall, {
|
|
208
|
+
workspaceId,
|
|
209
|
+
executionId,
|
|
210
|
+
agentKind: context.agentKind,
|
|
211
|
+
ref,
|
|
212
|
+
params,
|
|
213
|
+
result,
|
|
214
|
+
usage,
|
|
215
|
+
durationMs: Math.max(0, endedAt - startedAt),
|
|
216
|
+
finishReason,
|
|
217
|
+
ok,
|
|
218
|
+
errMessage,
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (!this.traceSink)
|
|
223
|
+
return;
|
|
224
|
+
const traceSink = this.traceSink;
|
|
134
225
|
// Numeric telemetry + timing are recorded unconditionally, exactly as on the proxy
|
|
135
226
|
// path; only the BODIES answer to the privacy gate below.
|
|
136
227
|
const event = {
|
|
137
228
|
workspaceId,
|
|
138
|
-
executionId
|
|
229
|
+
executionId,
|
|
139
230
|
agentKind: context.agentKind,
|
|
140
231
|
provider: ref.provider,
|
|
141
232
|
model: ref.model,
|
|
@@ -146,7 +237,7 @@ export class InstrumentedModelProvider {
|
|
|
146
237
|
cacheWriteTokens: usage.cacheWrite,
|
|
147
238
|
completionTokens: usage.completion,
|
|
148
239
|
totalTokens: usage.total,
|
|
149
|
-
finishReason
|
|
240
|
+
finishReason,
|
|
150
241
|
ok,
|
|
151
242
|
errorMessage: errMessage,
|
|
152
243
|
};
|
|
@@ -158,13 +249,51 @@ export class InstrumentedModelProvider {
|
|
|
158
249
|
// turns `storeAgentContext` off stops shipping bodies on its very next inline
|
|
159
250
|
// call rather than when its scoped provider is next rebuilt.
|
|
160
251
|
const recordBodies = await this.bodiesAllowed(workspaceId);
|
|
161
|
-
await
|
|
252
|
+
await traceSink.recordGeneration({
|
|
162
253
|
...event,
|
|
163
254
|
input: recordBodies ? safeJson(params?.prompt) : '',
|
|
164
255
|
output: recordBodies && ok ? readOutputText(result) : '',
|
|
165
256
|
});
|
|
166
257
|
}, { workspaceId, executionId: event.executionId, source: 'inline' });
|
|
167
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Hand a workspace-scoped call to the metric recorder. Bodies are passed through
|
|
261
|
+
* UNGATED on purpose: the service behind the recorder scrubs them and applies the same
|
|
262
|
+
* `LLM_RECORD_PROMPTS` + `storeAgentContext` double gate this class applies to the sink
|
|
263
|
+
* exit — gating here as well would drop a body the service is entitled to store and put
|
|
264
|
+
* the rule in two places, which is how the sink half drifted open in the first place.
|
|
265
|
+
* They are handed over as THUNKS so keeping the gate on the far side costs nothing: a
|
|
266
|
+
* deployment with recording off never pays to serialise the prompt array.
|
|
267
|
+
*
|
|
268
|
+
* Best-effort and off the response path, exactly like the sink exit.
|
|
269
|
+
*/
|
|
270
|
+
record(recordCall, call) {
|
|
271
|
+
const { workspaceId, executionId, ref, params, result, usage, ok } = call;
|
|
272
|
+
void runBestEffort(this.log, 'llmObservability.recordInlineCall', () => recordCall({
|
|
273
|
+
workspaceId,
|
|
274
|
+
executionId,
|
|
275
|
+
agentKind: call.agentKind,
|
|
276
|
+
provider: ref.provider,
|
|
277
|
+
model: ref.model,
|
|
278
|
+
messageCount: readMessageCount(params),
|
|
279
|
+
toolCount: readToolCount(params),
|
|
280
|
+
requestMaxTokens: readRequestMaxTokens(params),
|
|
281
|
+
promptTokens: usage.prompt,
|
|
282
|
+
cacheReadTokens: usage.cacheRead,
|
|
283
|
+
cacheWriteTokens: usage.cacheWrite,
|
|
284
|
+
completionTokens: usage.completion,
|
|
285
|
+
totalTokens: usage.total,
|
|
286
|
+
finishReason: call.finishReason,
|
|
287
|
+
durationMs: call.durationMs,
|
|
288
|
+
ok,
|
|
289
|
+
errorMessage: call.errMessage,
|
|
290
|
+
// Thunks: the service resolves a body only after its gate says it will be stored,
|
|
291
|
+
// so a prompts-off deployment never serialises a prompt array it then drops.
|
|
292
|
+
promptText: () => safeJson(params?.prompt),
|
|
293
|
+
responseText: () => (ok ? readOutputText(result) : ''),
|
|
294
|
+
reasoningText: () => (ok ? readReasoningText(result) : ''),
|
|
295
|
+
}), { workspaceId, executionId, source: 'inline' });
|
|
296
|
+
}
|
|
168
297
|
/**
|
|
169
298
|
* The double gate on prompt/response bodies: the deployment-wide `LLM_RECORD_PROMPTS`
|
|
170
299
|
* switch AND the workspace's own `storeAgentContext` opt-out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumented.js","sourceRoot":"","sources":["../../src/providers/instrumented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgC,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"instrumented.js","sourceRoot":"","sources":["../../src/providers/instrumented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgC,MAAM,IAAI,CAAA;AAYpE,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,UAAU,EACV,8BAA8B,EAC9B,aAAa,GACd,MAAM,qBAAqB,CAAA;AAkB5B,oFAAoF;AACpF,sFAAsF;AACtF,kFAAkF;AAClF,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAGlC,qFAAqF;AACrF,yFAAyF;AACzF,sEAAsE;AACtE,2FAA2F;AAC3F,qFAAqF;AACrF,4FAA4F;AAC5F,8FAA8F;AAC9F,2FAA2F;AAC3F,mFAAmF;AACnF,EAAE;AACF,yFAA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AC9B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC,CAAA;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"description": "Agent catalog, routing, prompts and fragment library for the Agent Architecture Board.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"p-map": "^7.0.6",
|
|
34
34
|
"valibot": "^1.4.2",
|
|
35
35
|
"@cat-factory/contracts": "0.194.0",
|
|
36
|
-
"@cat-factory/kernel": "0.
|
|
36
|
+
"@cat-factory/kernel": "0.190.0",
|
|
37
37
|
"@cat-factory/prompt-fragments": "0.15.17"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"typescript": "7.0.2",
|
|
41
41
|
"vitest": "^4.1.10",
|
|
42
|
-
"@cat-factory/caching": "0.11.
|
|
42
|
+
"@cat-factory/caching": "0.11.19"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc -b tsconfig.build.json",
|