agentfootprint 6.40.0 → 6.42.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/adapters/llm/BrowserOpenAIProvider.js +37 -13
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +49 -20
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/memory/agentcore.js +176 -156
- package/dist/adapters/memory/agentcore.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +6 -2
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +6 -2
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/memoryRecallInjections.js +59 -0
- package/dist/core/agent/memoryRecallInjections.js.map +1 -0
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +37 -13
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.js +49 -20
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/memory/agentcore.js +176 -156
- package/dist/esm/adapters/memory/agentcore.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.js +6 -2
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +6 -2
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/memoryRecallInjections.js +54 -0
- package/dist/esm/core/agent/memoryRecallInjections.js.map +1 -0
- package/dist/esm/observability/contextError/finders/compareFinders.js +22 -0
- package/dist/esm/observability/contextError/finders/compareFinders.js.map +1 -0
- package/dist/esm/observability/contextError/finders/index.js +7 -0
- package/dist/esm/observability/contextError/finders/index.js.map +1 -0
- package/dist/esm/observability/contextError/finders/rankSuspects.js +50 -0
- package/dist/esm/observability/contextError/finders/rankSuspects.js.map +1 -0
- package/dist/esm/observability/contextError/finders/removeAndRetry.js +43 -0
- package/dist/esm/observability/contextError/finders/removeAndRetry.js.map +1 -0
- package/dist/esm/observability/contextError/finders/shrinkToCause.js +87 -0
- package/dist/esm/observability/contextError/finders/shrinkToCause.js.map +1 -0
- package/dist/esm/observability/contextError/finders/testManyCombos.js +94 -0
- package/dist/esm/observability/contextError/finders/testManyCombos.js.map +1 -0
- package/dist/esm/observability/contextError/finders/traceSteps.js +62 -0
- package/dist/esm/observability/contextError/finders/traceSteps.js.map +1 -0
- package/dist/esm/observability/contextError/finders/types.js +2 -0
- package/dist/esm/observability/contextError/finders/types.js.map +1 -0
- package/dist/observability/contextError/finders/compareFinders.js +26 -0
- package/dist/observability/contextError/finders/compareFinders.js.map +1 -0
- package/dist/observability/contextError/finders/index.js +16 -0
- package/dist/observability/contextError/finders/index.js.map +1 -0
- package/dist/observability/contextError/finders/rankSuspects.js +53 -0
- package/dist/observability/contextError/finders/rankSuspects.js.map +1 -0
- package/dist/observability/contextError/finders/removeAndRetry.js +46 -0
- package/dist/observability/contextError/finders/removeAndRetry.js.map +1 -0
- package/dist/observability/contextError/finders/shrinkToCause.js +90 -0
- package/dist/observability/contextError/finders/shrinkToCause.js.map +1 -0
- package/dist/observability/contextError/finders/testManyCombos.js +97 -0
- package/dist/observability/contextError/finders/testManyCombos.js.map +1 -0
- package/dist/observability/contextError/finders/traceSteps.js +65 -0
- package/dist/observability/contextError/finders/traceSteps.js.map +1 -0
- package/dist/observability/contextError/finders/types.js +3 -0
- package/dist/observability/contextError/finders/types.js.map +1 -0
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts +7 -0
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +24 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/memory/agentcore.d.ts +74 -86
- package/dist/types/adapters/memory/agentcore.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/buildDynamicAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/memoryRecallInjections.d.ts +9 -0
- package/dist/types/core/agent/memoryRecallInjections.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/compareFinders.d.ts +20 -0
- package/dist/types/observability/contextError/finders/compareFinders.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/index.d.ts +23 -0
- package/dist/types/observability/contextError/finders/index.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/rankSuspects.d.ts +3 -0
- package/dist/types/observability/contextError/finders/rankSuspects.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/removeAndRetry.d.ts +12 -0
- package/dist/types/observability/contextError/finders/removeAndRetry.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/shrinkToCause.d.ts +12 -0
- package/dist/types/observability/contextError/finders/shrinkToCause.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/testManyCombos.d.ts +12 -0
- package/dist/types/observability/contextError/finders/testManyCombos.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/traceSteps.d.ts +3 -0
- package/dist/types/observability/contextError/finders/traceSteps.d.ts.map +1 -0
- package/dist/types/observability/contextError/finders/types.d.ts +89 -0
- package/dist/types/observability/contextError/finders/types.d.ts.map +1 -0
- package/package.json +11 -2
|
@@ -1,121 +1,100 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentCoreStore — AWS Bedrock AgentCore Memory adapter
|
|
3
|
-
* `@aws-sdk/client-bedrock-
|
|
4
|
-
*
|
|
5
|
-
* Import from the canonical subpath (the `agentfootprint/memory-agentcore`
|
|
6
|
-
* alias was removed in 4.0.0):
|
|
2
|
+
* AgentCoreStore — AWS Bedrock **AgentCore Memory** adapter
|
|
3
|
+
* (peer-dep `@aws-sdk/client-bedrock-agentcore`).
|
|
7
4
|
*
|
|
8
5
|
* import { AgentCoreStore } from 'agentfootprint/memory-providers';
|
|
9
6
|
*
|
|
10
7
|
* const store = new AgentCoreStore({
|
|
11
|
-
* memoryId: 'arn:aws:bedrock:us-
|
|
12
|
-
* region: 'us-
|
|
8
|
+
* memoryId: 'arn:aws:bedrock-agentcore:us-west-2:...:memory/my-mem',
|
|
9
|
+
* region: 'us-west-2',
|
|
13
10
|
* });
|
|
14
11
|
*
|
|
15
|
-
* Pattern: Adapter (GoF) —
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* doesn't expose a feedback metric API)
|
|
27
|
-
* search ↔ NOT exposed in v2.3 — AgentCore's
|
|
28
|
-
* retrieve API is opaque (server-side
|
|
29
|
-
* retrieval pipeline). Will land as
|
|
30
|
-
* `agentcoreRetrieve()` in a later release.
|
|
12
|
+
* Pattern: Adapter (GoF) — maps the `MemoryStore` interface onto AgentCore Memory's
|
|
13
|
+
* data-plane **event** model (`CreateEvent` / `GetEvent` / `ListEvents` /
|
|
14
|
+
* `DeleteEvent`, `@aws-sdk/client-bedrock-agentcore`):
|
|
15
|
+
* MemoryIdentity.{tenant,principal} ↔ AgentCore `actorId`
|
|
16
|
+
* MemoryIdentity.conversationId ↔ AgentCore `sessionId`
|
|
17
|
+
* MemoryEntry ↔ one event whose `payload` is a single
|
|
18
|
+
* `blob` document holding the entry
|
|
19
|
+
*
|
|
20
|
+
* **AgentCore Memory is an append-only event log, not a key-value store.** The server
|
|
21
|
+
* assigns each event's `eventId` on `CreateEvent` (you cannot choose it), and there is no
|
|
22
|
+
* "delete the whole session" call. This shapes the adapter:
|
|
31
23
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
24
|
+
* • `put` → `CreateEvent` (append; `actorId` + `eventTimestamp` are required). O(1)
|
|
25
|
+
* • `list` → `ListEvents` (paginated, `includePayloads`). ← window / episodic memory. O(page)
|
|
26
|
+
* • `get(id)` / `delete(id)` → list-then-find by the entry id stored in the blob, since
|
|
27
|
+
* AgentCore's ids are server-assigned. **O(events in session)** — fine for typical
|
|
28
|
+
* window sizes; if you need O(1) keyed access at scale, use RedisStore.
|
|
29
|
+
* • `forget` → `ListEvents` + `DeleteEvent` per event (no `DeleteSession` on AgentCore).
|
|
30
|
+
* • `search` → still unwired (AgentCore's `RetrieveMemoryRecords` lands as a later helper).
|
|
31
|
+
* • `putIfVersion` / `seen` / `feedback` → in-process emulation (AgentCore has no native
|
|
32
|
+
* CAS / dedup / feedback primitive; these don't survive process restart).
|
|
36
33
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* Mixing `defineMemory({ strategy: SUMMARIZE })` on top will
|
|
40
|
-
* double-compress. Pick one summarizer.
|
|
41
|
-
* 2. Optimistic-concurrency `putIfVersion` is emulated; under high
|
|
42
|
-
* concurrent write rates the CAS window is wider than RedisStore.
|
|
43
|
-
* Single-writer scenarios (one server process per session) are
|
|
44
|
-
* fine.
|
|
45
|
-
* 3. seen/feedback are in-process — they don't survive process restart.
|
|
46
|
-
* For durable recognition, implement at a higher layer or use Redis.
|
|
47
|
-
* 4. AWS rate limits apply. Production deployments should wrap with
|
|
48
|
-
* `withRetry` and budget calls per session.
|
|
34
|
+
* Role: Outer ring. Lazy-requires the AWS SDK; zero runtime cost when another adapter is
|
|
35
|
+
* in use. Emits: N/A (storage adapters don't emit).
|
|
49
36
|
*/
|
|
50
37
|
import type { ListOptions, ListResult, MemoryStore, PutIfVersionResult } from '../../memory/store/types.js';
|
|
51
38
|
import type { MemoryEntry } from '../../memory/entry/index.js';
|
|
52
39
|
import type { MemoryIdentity } from '../../memory/identity/index.js';
|
|
40
|
+
/** One event as the adapter cares about it: AgentCore's id + the decoded entry. */
|
|
41
|
+
export interface AgentCoreEvent {
|
|
42
|
+
/** AgentCore server-assigned event id (needed to delete it). */
|
|
43
|
+
readonly eventId: string;
|
|
44
|
+
/** The MemoryEntry decoded from the event's blob payload (null if unparseable). */
|
|
45
|
+
readonly entry: MemoryEntry | null;
|
|
46
|
+
}
|
|
53
47
|
/**
|
|
54
|
-
* Minimal surface
|
|
55
|
-
*
|
|
56
|
-
*
|
|
48
|
+
* Minimal, entry-semantic surface the store uses. The real implementation
|
|
49
|
+
* (`createAgentCoreClient`) maps these onto `CreateEvent` / `ListEvents` /
|
|
50
|
+
* `DeleteEvent`; tests inject a mock via `_client`.
|
|
57
51
|
*/
|
|
58
52
|
export interface AgentCoreLikeClient {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
sessionId: string;
|
|
62
|
-
eventId: string;
|
|
63
|
-
payload: string;
|
|
64
|
-
}): Promise<unknown>;
|
|
65
|
-
getEvent(input: {
|
|
53
|
+
/** Append one entry as an event (server assigns the eventId). */
|
|
54
|
+
createEvent(input: {
|
|
66
55
|
memoryId: string;
|
|
56
|
+
actorId: string;
|
|
67
57
|
sessionId: string;
|
|
68
|
-
|
|
69
|
-
}): Promise<
|
|
70
|
-
|
|
71
|
-
} | null>;
|
|
58
|
+
entry: MemoryEntry;
|
|
59
|
+
}): Promise<void>;
|
|
60
|
+
/** One page of the session's events (newest-first is AgentCore's default). */
|
|
72
61
|
listEvents(input: {
|
|
73
62
|
memoryId: string;
|
|
63
|
+
actorId: string;
|
|
74
64
|
sessionId: string;
|
|
75
|
-
nextToken?: string;
|
|
76
65
|
maxResults?: number;
|
|
66
|
+
nextToken?: string;
|
|
77
67
|
}): Promise<{
|
|
78
|
-
events:
|
|
79
|
-
eventId: string;
|
|
80
|
-
payload: string;
|
|
81
|
-
}>;
|
|
68
|
+
events: readonly AgentCoreEvent[];
|
|
82
69
|
nextToken?: string;
|
|
83
70
|
}>;
|
|
71
|
+
/** Delete one event by its AgentCore eventId. */
|
|
84
72
|
deleteEvent(input: {
|
|
85
73
|
memoryId: string;
|
|
74
|
+
actorId: string;
|
|
86
75
|
sessionId: string;
|
|
87
76
|
eventId: string;
|
|
88
|
-
}): Promise<
|
|
89
|
-
deleteSession(input: {
|
|
90
|
-
memoryId: string;
|
|
91
|
-
sessionId: string;
|
|
92
|
-
}): Promise<unknown>;
|
|
77
|
+
}): Promise<void>;
|
|
93
78
|
}
|
|
94
79
|
export interface AgentCoreStoreOptions {
|
|
95
80
|
/** AgentCore Memory ARN or id. Required. */
|
|
96
81
|
readonly memoryId: string;
|
|
97
82
|
/** AWS region. Required when constructing the SDK client internally. */
|
|
98
83
|
readonly region?: string;
|
|
99
|
-
/**
|
|
100
|
-
* Pre-built AgentCore client. Use this to share a single SDK
|
|
101
|
-
* configuration (credentials, retry policy) across the host app.
|
|
102
|
-
* Adapter does NOT call any close lifecycle on a borrowed client.
|
|
103
|
-
*/
|
|
84
|
+
/** Pre-built AgentCore client (shares one SDK config across the host app). */
|
|
104
85
|
readonly client?: AgentCoreLikeClient;
|
|
105
|
-
/** Page size for `listEvents
|
|
86
|
+
/** Page size for `listEvents`. Default 100. */
|
|
106
87
|
readonly pageSize?: number;
|
|
107
|
-
/**
|
|
108
|
-
* @internal Test injection point. Skips SDK require entirely.
|
|
109
|
-
*/
|
|
88
|
+
/** @internal Test injection — skips the SDK require entirely. */
|
|
110
89
|
readonly _client?: AgentCoreLikeClient;
|
|
90
|
+
/** @internal Test injection — the AWS SDK module (to exercise the real shim with a mock SDK). */
|
|
91
|
+
readonly _sdk?: BedrockAgentCoreSdkModule;
|
|
111
92
|
}
|
|
112
93
|
/**
|
|
113
|
-
* AgentCore Memory-backed `MemoryStore`. Implements every method
|
|
114
|
-
* except `search()`. Vector retrieval via AgentCore's native API
|
|
115
|
-
* lands as a separate read-side helper in a later release.
|
|
94
|
+
* AgentCore Memory-backed `MemoryStore`. Implements every method except `search()`.
|
|
116
95
|
*
|
|
117
|
-
* @throws when `@aws-sdk/client-bedrock-
|
|
118
|
-
*
|
|
96
|
+
* @throws when `@aws-sdk/client-bedrock-agentcore` is not installed and no `_client`/`_sdk`
|
|
97
|
+
* is supplied.
|
|
119
98
|
*/
|
|
120
99
|
export declare class AgentCoreStore implements MemoryStore {
|
|
121
100
|
private readonly client;
|
|
@@ -125,17 +104,19 @@ export declare class AgentCoreStore implements MemoryStore {
|
|
|
125
104
|
private readonly signatures;
|
|
126
105
|
private readonly feedbackBag;
|
|
127
106
|
constructor(options: AgentCoreStoreOptions);
|
|
107
|
+
private actorId;
|
|
128
108
|
private sessionId;
|
|
109
|
+
private scope;
|
|
129
110
|
private shadowKey;
|
|
130
111
|
private feedbackKey;
|
|
112
|
+
/** Walk every event in the session (paginated). */
|
|
113
|
+
private eachEvent;
|
|
131
114
|
get<T = unknown>(identity: MemoryIdentity, id: string): Promise<MemoryEntry<T> | null>;
|
|
132
115
|
put<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>): Promise<void>;
|
|
133
116
|
putMany<T = unknown>(identity: MemoryIdentity, entries: readonly MemoryEntry<T>[]): Promise<void>;
|
|
134
117
|
/**
|
|
135
|
-
* Emulated optimistic concurrency. AgentCore
|
|
136
|
-
*
|
|
137
|
-
* — adequate for single-writer-per-session deployments. For multi-
|
|
138
|
-
* writer correctness on AgentCore, layer your own coordination.
|
|
118
|
+
* Emulated optimistic concurrency. AgentCore appends unconditionally; we read-then-write
|
|
119
|
+
* inside a JS critical section — adequate for single-writer-per-session deployments.
|
|
139
120
|
*/
|
|
140
121
|
putIfVersion<T = unknown>(identity: MemoryIdentity, entry: MemoryEntry<T>, expectedVersion: number): Promise<PutIfVersionResult>;
|
|
141
122
|
list<T = unknown>(identity: MemoryIdentity, options?: ListOptions): Promise<ListResult<T>>;
|
|
@@ -147,13 +128,20 @@ export declare class AgentCoreStore implements MemoryStore {
|
|
|
147
128
|
average: number;
|
|
148
129
|
count: number;
|
|
149
130
|
} | null>;
|
|
131
|
+
/** GDPR "everything for this identity, gone." No DeleteSession on AgentCore → delete every event. */
|
|
150
132
|
forget(identity: MemoryIdentity): Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
* Mark the store closed. Subsequent calls throw cleanly. Idempotent.
|
|
153
|
-
* AgentCore is stateless from the client perspective so there's no
|
|
154
|
-
* connection to tear down — the close gate is purely defensive.
|
|
155
|
-
*/
|
|
156
133
|
close(): Promise<void>;
|
|
157
134
|
private ensureOpen;
|
|
158
135
|
}
|
|
136
|
+
/** The slice of `@aws-sdk/client-bedrock-agentcore` the shim touches. */
|
|
137
|
+
export interface BedrockAgentCoreSdkModule {
|
|
138
|
+
readonly BedrockAgentCoreClient?: new (config: {
|
|
139
|
+
region?: string;
|
|
140
|
+
}) => {
|
|
141
|
+
send(cmd: unknown): Promise<unknown>;
|
|
142
|
+
};
|
|
143
|
+
readonly CreateEventCommand?: new (input: unknown) => unknown;
|
|
144
|
+
readonly ListEventsCommand?: new (input: unknown) => unknown;
|
|
145
|
+
readonly DeleteEventCommand?: new (input: unknown) => unknown;
|
|
146
|
+
}
|
|
159
147
|
//# sourceMappingURL=agentcore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentcore.d.ts","sourceRoot":"","sources":["../../../../src/adapters/memory/agentcore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agentcore.d.ts","sourceRoot":"","sources":["../../../../src/adapters/memory/agentcore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CACpC;AAED;;;;GAIG;AACH,MAA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../../../src/core/agent/buildAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAc,MAAM,aAAa,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"buildAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAc,MAAM,aAAa,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAOxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAUrE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAE/C;;;8DAG0D;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,OAAO,yCAAyC,EAAE,WAAW,CAAC;IAEpG;uEACmE;IACnE,QAAQ,CAAC,uBAAuB,EAAE,WAAW,CAAC;IAE9C;kDAC8C;IAC9C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAG/B,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,YAAY,GAAG,OAAO,CAAC;IAChE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,aAAa,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;IAGxE,QAAQ,CAAC,sBAAsB,EAAE,SAAS,CAAC;IAC3C;;yDAEqD;IACrD,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC;IAMrC,QAAQ,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEzD;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAG3C;;;;0CAIsC;IACtC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAoW/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildDynamicAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"buildDynamicAgentChart.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/buildDynamicAgentChart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAgD3D;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,cAAc,GAAG,SAAS,CAwWtE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ActiveInjection } from '../../lib/injection-engine/types.js';
|
|
2
|
+
/** Build `'memory'`-flavored ActiveInjections from the per-id recall keys in `parent`. */
|
|
3
|
+
export declare function memoryRecallInjections(parent: Record<string, unknown>, memoryIds: readonly string[]): ActiveInjection[];
|
|
4
|
+
/**
|
|
5
|
+
* Append memory recalls to the active-injection set a slot-fork inputMapper hands to
|
|
6
|
+
* the system / messages slot subflows. No-op when the agent has no memories.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withMemoryRecall(activeInjections: readonly ActiveInjection[] | undefined, parent: Record<string, unknown>, memoryIds: readonly string[]): readonly ActiveInjection[];
|
|
9
|
+
//# sourceMappingURL=memoryRecallInjections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryRecallInjections.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/memoryRecallInjections.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAO3E,0FAA0F;AAC1F,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,eAAe,EAAE,CAyBnB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,gBAAgB,EAAE,SAAS,eAAe,EAAE,GAAG,SAAS,EACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,SAAS,eAAe,EAAE,CAK5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compareFinders — run several finders on the same case and collect their answers
|
|
3
|
+
* side by side (a leaderboard row per finder). PARAMETRIC: you pass the finders to
|
|
4
|
+
* compare, so nothing is auto-discovered or retained — unused finders stay
|
|
5
|
+
* tree-shakeable.
|
|
6
|
+
*/
|
|
7
|
+
import type { Finder, FindInput, FindResult } from './types.js';
|
|
8
|
+
/** One finder's result in a comparison (or the error it threw). */
|
|
9
|
+
export interface CompareRow {
|
|
10
|
+
readonly finder: string;
|
|
11
|
+
readonly result: FindResult | null;
|
|
12
|
+
readonly error?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Run each finder on `input`; a finder that throws (e.g. missing a dep it needs)
|
|
16
|
+
* becomes a row with `result: null` and `error` set, so one finder cannot abort
|
|
17
|
+
* the comparison.
|
|
18
|
+
*/
|
|
19
|
+
export declare function compareFinders(finders: readonly Finder[], input: FindInput): Promise<CompareRow[]>;
|
|
20
|
+
//# sourceMappingURL=compareFinders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compareFinders.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/compareFinders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEhE,mEAAmE;AACnE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,KAAK,EAAE,SAAS,GACf,OAAO,CAAC,UAAU,EAAE,CAAC,CAcvB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* observability / contextError / finders — pluggable context-bug localization.
|
|
3
|
+
*
|
|
4
|
+
* "Which piece of context made the agent's answer wrong?" Pick a finder and call
|
|
5
|
+
* `find(input)`. Each finder is a thin, self-explaining adapter over the engines in
|
|
6
|
+
* `src/lib/context-bisect` + `src/lib/influence-core`; the academic method + citation
|
|
7
|
+
* live in `meta`, never in the import name.
|
|
8
|
+
*
|
|
9
|
+
* import { rankSuspects } from 'agentfootprint/observability/contextError/finders';
|
|
10
|
+
* const r = await rankSuspects.find(input); // r.lead, r.evidence ('guessed'|'proven')
|
|
11
|
+
*
|
|
12
|
+
* Tree-shakeable: one finder = one file = one named export. Importing one finder does
|
|
13
|
+
* not pull the others (or the heavy ablation path behind removeAndRetry). This barrel
|
|
14
|
+
* is re-export-only — no runtime code, no registry.
|
|
15
|
+
*/
|
|
16
|
+
export type { ContextPiece, Evidence, Finder, FinderMeta, FindInput, FindResult, Granularity, ScoredSuspect, StepInput, } from './types.js';
|
|
17
|
+
export { rankSuspects } from './rankSuspects.js';
|
|
18
|
+
export { removeAndRetry } from './removeAndRetry.js';
|
|
19
|
+
export { traceSteps } from './traceSteps.js';
|
|
20
|
+
export { testManyCombos } from './testManyCombos.js';
|
|
21
|
+
export { shrinkToCause } from './shrinkToCause.js';
|
|
22
|
+
export { compareFinders, type CompareRow } from './compareFinders.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rankSuspects.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/rankSuspects.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,YAAY,EAAE,MAsC1B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* removeAndRetry — the thorough finder. Removes each context piece, re-runs the
|
|
3
|
+
* agent, and a piece is the cause iff its removal flips the outcome back. No
|
|
4
|
+
* embedder, no heuristic: pure counterfactual. Exact, but pays one re-run per
|
|
5
|
+
* piece (`checks`), and on multi-loop runs it can over-attribute (several pieces
|
|
6
|
+
* each flip) — narrow with a slice first when that happens.
|
|
7
|
+
*
|
|
8
|
+
* Method: leave-one-out ablation (counterfactual necessity).
|
|
9
|
+
*/
|
|
10
|
+
import type { Finder } from './types.js';
|
|
11
|
+
export declare const removeAndRetry: Finder;
|
|
12
|
+
//# sourceMappingURL=removeAndRetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeAndRetry.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/removeAndRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,cAAc,EAAE,MAwC5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shrinkToCause — keeps cutting the suspect set down until the smallest subset whose
|
|
3
|
+
* removal still fixes the answer. For a single dominant cause it converges in fewer
|
|
4
|
+
* re-runs than leave-one-out (delta-debugging minimization); for co-necessary causes it
|
|
5
|
+
* still returns the minimal recovering set, but may cost more probes than leave-one-out.
|
|
6
|
+
* The returned set is verified to recover by construction.
|
|
7
|
+
*
|
|
8
|
+
* Method: delta-debugging minimization (ddmin) over the removal set that recovers.
|
|
9
|
+
*/
|
|
10
|
+
import type { Finder } from './types.js';
|
|
11
|
+
export declare const shrinkToCause: Finder;
|
|
12
|
+
//# sourceMappingURL=shrinkToCause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shrinkToCause.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/shrinkToCause.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,MAwF3B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* testManyCombos — turns context pieces on and off in many combinations, re-runs each,
|
|
3
|
+
* and learns which pieces drive the wrong answer (a linear-surrogate attribution), then
|
|
4
|
+
* confirms the top candidate with one clean ablation. The sampling one: it estimates an
|
|
5
|
+
* influence weight per piece from counterfactual data rather than ranking by similarity.
|
|
6
|
+
*
|
|
7
|
+
* Method: random-subset ablation + linear-surrogate attribution. Deterministic
|
|
8
|
+
* pseudo-random masking (a reproducible reimplementation of ContextCite's random subsets).
|
|
9
|
+
*/
|
|
10
|
+
import type { Finder } from './types.js';
|
|
11
|
+
export declare const testManyCombos: Finder;
|
|
12
|
+
//# sourceMappingURL=testManyCombos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testManyCombos.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/testManyCombos.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAWhE,eAAO,MAAM,cAAc,EAAE,MAkF5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceSteps.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/traceSteps.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,UAAU,EAAE,MAkDxB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context-error finders — the plain, pluggable public surface for context-bug
|
|
3
|
+
* localization. A `Finder` answers one question: "which piece of context made the
|
|
4
|
+
* agent's answer wrong?" Each finder is a thin, named adapter over the engines in
|
|
5
|
+
* `src/lib/context-bisect` + `src/lib/influence-core`; the academic method + citation
|
|
6
|
+
* live in `meta`, never in the import name.
|
|
7
|
+
*
|
|
8
|
+
* Taxonomy (area / category / thing): observability / contextError / finders.
|
|
9
|
+
* Tree-shakeable: one finder = one file = one named export; import only what you use.
|
|
10
|
+
*/
|
|
11
|
+
import type { Embedder } from '../../../lib/influence-core/index.js';
|
|
12
|
+
/** How sure the finder is. `guessed` = ranked by a similarity proxy only;
|
|
13
|
+
* `proven` = a removal/re-run actually flipped the outcome (counterfactual). */
|
|
14
|
+
export type Evidence = 'guessed' | 'proven';
|
|
15
|
+
/** What the finder points at. `piece` = a context element; `step` = an agent step. */
|
|
16
|
+
export type Granularity = 'piece' | 'step';
|
|
17
|
+
/** A removable piece of context the finder can suspect. */
|
|
18
|
+
export interface ContextPiece {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
}
|
|
22
|
+
/** One agent step (a tool-call), for finders that work at step granularity. */
|
|
23
|
+
export interface StepInput {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
/** Human-readable label, e.g. `get_promo@L1`. */
|
|
26
|
+
readonly label: string;
|
|
27
|
+
readonly text: string;
|
|
28
|
+
}
|
|
29
|
+
/** Everything a finder may need. Light finders use `embedder`; counterfactual
|
|
30
|
+
* finders use `rerun`; step finders use `steps`. A finder throws if a field it
|
|
31
|
+
* needs is missing. */
|
|
32
|
+
export interface FindInput {
|
|
33
|
+
/** The removable context pieces to consider. */
|
|
34
|
+
readonly suspects: readonly ContextPiece[];
|
|
35
|
+
/** The wrong answer to explain. */
|
|
36
|
+
readonly wrongOutput: string;
|
|
37
|
+
/** Embedder for similarity-ranking finders. */
|
|
38
|
+
readonly embedder?: Embedder;
|
|
39
|
+
/** Re-run with the given pieces removed; `recovered` = the outcome flipped back. */
|
|
40
|
+
readonly rerun?: (removedIds: readonly string[]) => Promise<{
|
|
41
|
+
recovered: boolean;
|
|
42
|
+
outcome?: string;
|
|
43
|
+
}>;
|
|
44
|
+
/** The agent's steps, for step-granularity finders. */
|
|
45
|
+
readonly steps?: readonly StepInput[];
|
|
46
|
+
/** For testManyCombos: how many on/off combinations to sample (default ~4×#suspects). */
|
|
47
|
+
readonly samples?: number;
|
|
48
|
+
}
|
|
49
|
+
/** One suspect in the finder's ranked output. */
|
|
50
|
+
export interface ScoredSuspect {
|
|
51
|
+
readonly id: string;
|
|
52
|
+
/** Higher = more suspicious. Absent for finders that don't score. */
|
|
53
|
+
readonly score?: number;
|
|
54
|
+
}
|
|
55
|
+
/** What a finder returns. Plain fields, namespace-independent. */
|
|
56
|
+
export interface FindResult {
|
|
57
|
+
/** Which finder produced this. */
|
|
58
|
+
readonly finder: string;
|
|
59
|
+
/** Suspects, most-to-least suspicious. */
|
|
60
|
+
readonly suspects: readonly ScoredSuspect[];
|
|
61
|
+
/** The single top suspect, if any. */
|
|
62
|
+
readonly lead?: string;
|
|
63
|
+
/** The small set worth confirming when there is no clear single winner. */
|
|
64
|
+
readonly shortlist: readonly string[];
|
|
65
|
+
/** `guessed` (proxy) vs `proven` (counterfactual). */
|
|
66
|
+
readonly evidence: Evidence;
|
|
67
|
+
/** `piece` vs `step`. */
|
|
68
|
+
readonly granularity: Granularity;
|
|
69
|
+
/** How many times the finder re-ran the agent (the honest cost). 0 = free. */
|
|
70
|
+
readonly checks: number;
|
|
71
|
+
/** A self-explaining narrative of how the finder reached its answer. */
|
|
72
|
+
readonly explanation: string;
|
|
73
|
+
}
|
|
74
|
+
/** Attribution — kept off the import name, surfaced in docs / leaderboards. */
|
|
75
|
+
export interface FinderMeta {
|
|
76
|
+
/** Plain one-liner for a leaderboard row. */
|
|
77
|
+
readonly label: string;
|
|
78
|
+
/** The precise technique, for experts. */
|
|
79
|
+
readonly method: string;
|
|
80
|
+
/** Citation, if the finder reimplements a published method. */
|
|
81
|
+
readonly paper?: string;
|
|
82
|
+
}
|
|
83
|
+
/** A pluggable context-error finder. */
|
|
84
|
+
export interface Finder {
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly meta: FinderMeta;
|
|
87
|
+
find(input: FindInput): Promise<FindResult>;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/observability/contextError/finders/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAErE;iFACiF;AACjF,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE5C,sFAAsF;AACtF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,+EAA+E;AAC/E,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,QAAQ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AClC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,+EAA+E;AAC/E,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wCAAwC;AACxC,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC7C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "6.
|
|
4
|
-
"description": "The explainable agent framework —
|
|
3
|
+
"version": "6.42.0",
|
|
4
|
+
"description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Sanjay Krishna Anbalagan",
|
|
7
7
|
"repository": {
|
|
@@ -122,6 +122,11 @@
|
|
|
122
122
|
"import": "./dist/esm/observe.js",
|
|
123
123
|
"require": "./dist/observe.js"
|
|
124
124
|
},
|
|
125
|
+
"./observability/contextError/finders": {
|
|
126
|
+
"types": "./dist/types/observability/contextError/finders/index.d.ts",
|
|
127
|
+
"import": "./dist/esm/observability/contextError/finders/index.js",
|
|
128
|
+
"require": "./dist/observability/contextError/finders/index.js"
|
|
129
|
+
},
|
|
125
130
|
"./resilience": {
|
|
126
131
|
"types": "./dist/types/resilience/index.d.ts",
|
|
127
132
|
"import": "./dist/esm/resilience/index.js",
|
|
@@ -180,6 +185,7 @@
|
|
|
180
185
|
],
|
|
181
186
|
"peerDependencies": {
|
|
182
187
|
"@anthropic-ai/sdk": "*",
|
|
188
|
+
"@aws-sdk/client-bedrock-agentcore": "*",
|
|
183
189
|
"@aws-sdk/client-bedrock-agent-runtime": "*",
|
|
184
190
|
"@aws-sdk/client-bedrock-runtime": "*",
|
|
185
191
|
"@aws-sdk/client-cloudwatch-logs": "*",
|
|
@@ -201,6 +207,9 @@
|
|
|
201
207
|
"@aws-sdk/client-bedrock-runtime": {
|
|
202
208
|
"optional": true
|
|
203
209
|
},
|
|
210
|
+
"@aws-sdk/client-bedrock-agentcore": {
|
|
211
|
+
"optional": true
|
|
212
|
+
},
|
|
204
213
|
"@aws-sdk/client-bedrock-agent-runtime": {
|
|
205
214
|
"optional": true
|
|
206
215
|
},
|