@ironflow/browser 0.20.0 → 0.20.2
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/LICENSE +181 -0
- package/package.json +9 -9
- package/dist/agents/index.d.ts +0 -34
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -24
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/invoke.d.ts +0 -16
- package/dist/agents/invoke.d.ts.map +0 -1
- package/dist/agents/invoke.js +0 -222
- package/dist/agents/invoke.js.map +0 -1
- package/dist/agents/readMemory.d.ts +0 -18
- package/dist/agents/readMemory.d.ts.map +0 -1
- package/dist/agents/readMemory.js +0 -87
- package/dist/agents/readMemory.js.map +0 -1
- package/dist/agents/subscribe.d.ts +0 -23
- package/dist/agents/subscribe.d.ts.map +0 -1
- package/dist/agents/subscribe.js +0 -117
- package/dist/agents/subscribe.js.map +0 -1
- package/dist/agents/types.d.ts +0 -156
- package/dist/agents/types.d.ts.map +0 -1
- package/dist/agents/types.js +0 -7
- package/dist/agents/types.js.map +0 -1
- package/dist/client.d.ts +0 -844
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -2243
- package/dist/client.js.map +0 -1
- package/dist/config-client.d.ts +0 -43
- package/dist/config-client.d.ts.map +0 -1
- package/dist/config-client.js +0 -134
- package/dist/config-client.js.map +0 -1
- package/dist/config.d.ts +0 -91
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -55
- package/dist/config.js.map +0 -1
- package/dist/index.d.ts +0 -53
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -53
- package/dist/index.js.map +0 -1
- package/dist/kv.d.ts +0 -79
- package/dist/kv.d.ts.map +0 -1
- package/dist/kv.js +0 -289
- package/dist/kv.js.map +0 -1
- package/dist/projection-stream.d.ts +0 -42
- package/dist/projection-stream.d.ts.map +0 -1
- package/dist/projection-stream.js +0 -48
- package/dist/projection-stream.js.map +0 -1
- package/dist/subscription.d.ts +0 -107
- package/dist/subscription.d.ts.map +0 -1
- package/dist/subscription.js +0 -450
- package/dist/subscription.js.map +0 -1
- package/dist/transport/connectrpc.d.ts +0 -74
- package/dist/transport/connectrpc.d.ts.map +0 -1
- package/dist/transport/connectrpc.js +0 -393
- package/dist/transport/connectrpc.js.map +0 -1
- package/dist/transport/index.d.ts +0 -7
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js +0 -6
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/types.d.ts +0 -69
- package/dist/transport/types.d.ts.map +0 -1
- package/dist/transport/types.js +0 -5
- package/dist/transport/types.js.map +0 -1
- package/dist/transport/websocket.d.ts +0 -38
- package/dist/transport/websocket.d.ts.map +0 -1
- package/dist/transport/websocket.js +0 -276
- package/dist/transport/websocket.js.map +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ironflow.agents.subscribe()` — typed wrapper over `client.subscribe()`
|
|
3
|
-
* for an agent run's event stream.
|
|
4
|
-
*
|
|
5
|
-
* Spec: see ./spec.md
|
|
6
|
-
*/
|
|
7
|
-
import { type Subscription } from "@ironflow/core";
|
|
8
|
-
import type { AgentClientLike, AgentSubscribeCallbacks } from "./types.js";
|
|
9
|
-
/**
|
|
10
|
-
* Promise-returning wrapper. Returns a Subscription whose `unsubscribe()`
|
|
11
|
-
* is idempotent.
|
|
12
|
-
*
|
|
13
|
-
* Topic dispatch:
|
|
14
|
-
* system.run.{runId}.completed → onComplete
|
|
15
|
-
* system.run.{runId}.failed → onFailed
|
|
16
|
-
* system.run.{runId}.cancelled → onCancelled
|
|
17
|
-
* system.run.{runId}.{created|updated|resumed} → onProgress
|
|
18
|
-
* system.run.{runId}.step.{stepId}.{type} → onStep
|
|
19
|
-
*/
|
|
20
|
-
export declare function subscribe(client: AgentClientLike, runId: string, callbacks: AgentSubscribeCallbacks, opts?: {
|
|
21
|
-
replay?: number;
|
|
22
|
-
}): Promise<Subscription>;
|
|
23
|
-
//# sourceMappingURL=subscribe.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../src/agents/subscribe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,eAAe,EAGf,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAiCpB;;;;;;;;;;GAUG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,eAAe,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,uBAAuB,EAClC,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,OAAO,CAAC,YAAY,CAAC,CAiCvB"}
|
package/dist/agents/subscribe.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `ironflow.agents.subscribe()` — typed wrapper over `client.subscribe()`
|
|
3
|
-
* for an agent run's event stream.
|
|
4
|
-
*
|
|
5
|
-
* Spec: see ./spec.md
|
|
6
|
-
*/
|
|
7
|
-
import { ValidationError, } from "@ironflow/core";
|
|
8
|
-
const MAX_RUN_ID_LENGTH = 128;
|
|
9
|
-
// Permits server-issued runIds (e.g., `run_<uuid>`, `run-2025-...`) but
|
|
10
|
-
// rejects NATS subject metacharacters that would widen the subscribe to
|
|
11
|
-
// other runs (`*`, `>`, `.`) or break the topic shape.
|
|
12
|
-
const RUN_ID_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
13
|
-
function validateRunId(runId) {
|
|
14
|
-
if (typeof runId !== "string" || runId.length === 0) {
|
|
15
|
-
throw new ValidationError("agents.subscribe: runId must be a non-empty string");
|
|
16
|
-
}
|
|
17
|
-
if (runId.length > MAX_RUN_ID_LENGTH) {
|
|
18
|
-
throw new ValidationError(`agents.subscribe: runId exceeds ${MAX_RUN_ID_LENGTH} chars`);
|
|
19
|
-
}
|
|
20
|
-
if (!RUN_ID_PATTERN.test(runId)) {
|
|
21
|
-
throw new ValidationError("agents.subscribe: runId may only contain [A-Za-z0-9_-] (no NATS metacharacters)");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Promise-returning wrapper. Returns a Subscription whose `unsubscribe()`
|
|
26
|
-
* is idempotent.
|
|
27
|
-
*
|
|
28
|
-
* Topic dispatch:
|
|
29
|
-
* system.run.{runId}.completed → onComplete
|
|
30
|
-
* system.run.{runId}.failed → onFailed
|
|
31
|
-
* system.run.{runId}.cancelled → onCancelled
|
|
32
|
-
* system.run.{runId}.{created|updated|resumed} → onProgress
|
|
33
|
-
* system.run.{runId}.step.{stepId}.{type} → onStep
|
|
34
|
-
*/
|
|
35
|
-
export async function subscribe(client, runId, callbacks, opts = {}) {
|
|
36
|
-
validateRunId(runId);
|
|
37
|
-
const sub = await client.subscribe(`system.run.${runId}.>`, {
|
|
38
|
-
// Default replay 1000 covers events emitted between `agents.invoke`
|
|
39
|
-
// returning a runId via `onRunStarted` and this subscribe attaching.
|
|
40
|
-
replay: opts.replay ?? 1000,
|
|
41
|
-
onEvent: (event) => dispatch(event, runId, callbacks),
|
|
42
|
-
onError: callbacks.onError,
|
|
43
|
-
});
|
|
44
|
-
// Wrap the underlying unsubscribe to make it idempotent.
|
|
45
|
-
let unsubscribed = false;
|
|
46
|
-
const wrapped = {
|
|
47
|
-
id: sub.id ?? "",
|
|
48
|
-
pattern: sub.pattern ?? `system.run.${runId}.>`,
|
|
49
|
-
connectionState: sub.connectionState ?? "connected",
|
|
50
|
-
unsubscribe() {
|
|
51
|
-
if (unsubscribed)
|
|
52
|
-
return;
|
|
53
|
-
unsubscribed = true;
|
|
54
|
-
try {
|
|
55
|
-
sub.unsubscribe();
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
/* swallow — idempotent */
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
return wrapped;
|
|
63
|
-
}
|
|
64
|
-
function dispatch(event, runId, callbacks) {
|
|
65
|
-
const topic = event.topic;
|
|
66
|
-
const stepPrefix = `system.run.${runId}.step.`;
|
|
67
|
-
if (topic.startsWith(stepPrefix)) {
|
|
68
|
-
if (!callbacks.onStep)
|
|
69
|
-
return;
|
|
70
|
-
const remainder = topic.slice(stepPrefix.length); // "{stepId}.{type}"
|
|
71
|
-
const dotIdx = remainder.indexOf(".");
|
|
72
|
-
const stepId = dotIdx === -1 ? remainder : remainder.slice(0, dotIdx);
|
|
73
|
-
const type = dotIdx === -1 ? "" : remainder.slice(dotIdx + 1);
|
|
74
|
-
const stepEvent = {
|
|
75
|
-
topic,
|
|
76
|
-
stepId,
|
|
77
|
-
type,
|
|
78
|
-
data: event.data,
|
|
79
|
-
};
|
|
80
|
-
callbacks.onStep(stepEvent);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
if (topic.endsWith(".completed")) {
|
|
84
|
-
callbacks.onComplete?.({ output: event.data?.output });
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (topic.endsWith(".failed")) {
|
|
88
|
-
const err = event.data?.error;
|
|
89
|
-
if (typeof err === "string") {
|
|
90
|
-
callbacks.onFailed?.({ message: err });
|
|
91
|
-
}
|
|
92
|
-
else if (err && typeof err === "object") {
|
|
93
|
-
callbacks.onFailed?.({
|
|
94
|
-
message: err.message ?? "Run failed",
|
|
95
|
-
code: err.code,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
callbacks.onFailed?.({ message: "Run failed" });
|
|
100
|
-
}
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (topic.endsWith(".cancelled")) {
|
|
104
|
-
callbacks.onCancelled?.();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
// Non-terminal: created / updated / resumed.
|
|
108
|
-
if (callbacks.onProgress) {
|
|
109
|
-
const progressEvent = {
|
|
110
|
-
topic,
|
|
111
|
-
status: event.data?.status,
|
|
112
|
-
data: event.data,
|
|
113
|
-
};
|
|
114
|
-
callbacks.onProgress(progressEvent);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=subscribe.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../../src/agents/subscribe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,eAAe,GAGhB,MAAM,gBAAgB,CAAC;AASxB,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,wEAAwE;AACxE,wEAAwE;AACxE,uDAAuD;AACvD,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAE1C,SAAS,aAAa,CAAC,KAAa;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,eAAe,CACvB,oDAAoD,CACrD,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,GAAG,iBAAiB,EAAE,CAAC;QACrC,MAAM,IAAI,eAAe,CACvB,mCAAmC,iBAAiB,QAAQ,CAC7D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,eAAe,CACvB,iFAAiF,CAClF,CAAC;IACJ,CAAC;AACH,CAAC;AAQD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAuB,EACvB,KAAa,EACb,SAAkC,EAClC,OAA4B,EAAE;IAE9B,aAAa,CAAC,KAAK,CAAC,CAAC;IAErB,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAChC,cAAc,KAAK,IAAI,EACvB;QACE,oEAAoE;QACpE,qEAAqE;QACrE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI;QAC3B,OAAO,EAAE,CAAC,KAAsC,EAAE,EAAE,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a,GAAuB;YACxC,KAAK;YACL,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM;YAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC;QACF,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
package/dist/agents/types.d.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public types for `ironflow.agents.{invoke, subscribe, readMemory}`.
|
|
3
|
-
*
|
|
4
|
-
* Spec: see ./spec.md
|
|
5
|
-
*/
|
|
6
|
-
import type { InvokeResult, ProjectionStateResult, Run, Subscription, SubscriptionCallbacks, SubscriptionErrorInfo, WaitResult } from "@ironflow/core";
|
|
7
|
-
/**
|
|
8
|
-
* Options for `ironflow.agents.invoke()`.
|
|
9
|
-
*/
|
|
10
|
-
export interface AgentInvokeOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Local timeout in milliseconds. When elapsed, throws
|
|
13
|
-
* `AgentInvokeTimeoutError` and best-effort calls
|
|
14
|
-
* `cancelRun(runId)` server-side. Default: 30000.
|
|
15
|
-
*/
|
|
16
|
-
timeoutMs?: number;
|
|
17
|
-
/**
|
|
18
|
-
* Caller cancellation. When the signal aborts, throws an `AbortError`
|
|
19
|
-
* (DOMException) and best-effort calls `cancelRun(runId)`.
|
|
20
|
-
*/
|
|
21
|
-
signal?: AbortSignal;
|
|
22
|
-
/**
|
|
23
|
-
* Server-side dedup. Same key → same `runId` returned across retries.
|
|
24
|
-
* Wires to existing event-idempotency path.
|
|
25
|
-
*/
|
|
26
|
-
idempotencyKey?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Number of historical events to replay on subscribe. Default: 100.
|
|
29
|
-
* Replay covers the race window between Trigger return and subscribe attach.
|
|
30
|
-
*/
|
|
31
|
-
replay?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Called once with the runId as soon as `Trigger` returns and before
|
|
34
|
-
* the wait begins. Lets callers attach a separate progress subscription
|
|
35
|
-
* (e.g., `agents.subscribe(runId)`) without waiting for the terminal
|
|
36
|
-
* event. May return a Promise; the SDK awaits it so any async setup
|
|
37
|
-
* (subscription attach) completes before terminal events dispatch.
|
|
38
|
-
*/
|
|
39
|
-
onRunStarted?: (runId: string) => void | Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Result returned from a successful `ironflow.agents.invoke()`.
|
|
43
|
-
*/
|
|
44
|
-
export interface AgentInvokeResult<TOutput = unknown> {
|
|
45
|
-
runId: string;
|
|
46
|
-
output: TOutput | undefined;
|
|
47
|
-
durationMs: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Callbacks for `ironflow.agents.subscribe()`.
|
|
51
|
-
*/
|
|
52
|
-
export interface AgentSubscribeCallbacks {
|
|
53
|
-
/** Non-terminal run lifecycle events (created, updated, resumed). */
|
|
54
|
-
onProgress?: (event: AgentProgressEvent) => void;
|
|
55
|
-
/** Step lifecycle events (created, completed, etc.). */
|
|
56
|
-
onStep?: (event: AgentStepEvent) => void;
|
|
57
|
-
/** Terminal `run.completed`. */
|
|
58
|
-
onComplete?: (result: {
|
|
59
|
-
output: unknown;
|
|
60
|
-
}) => void;
|
|
61
|
-
/** Terminal `run.failed`. */
|
|
62
|
-
onFailed?: (error: {
|
|
63
|
-
message: string;
|
|
64
|
-
code?: string;
|
|
65
|
-
}) => void;
|
|
66
|
-
/** Terminal `run.cancelled`. */
|
|
67
|
-
onCancelled?: () => void;
|
|
68
|
-
/** Transport / parse error. */
|
|
69
|
-
onError?: (err: SubscriptionErrorInfo) => void;
|
|
70
|
-
}
|
|
71
|
-
export interface AgentProgressEvent {
|
|
72
|
-
topic: string;
|
|
73
|
-
status?: string;
|
|
74
|
-
data?: unknown;
|
|
75
|
-
}
|
|
76
|
-
export interface AgentStepEvent {
|
|
77
|
-
topic: string;
|
|
78
|
-
stepId: string;
|
|
79
|
-
type: string;
|
|
80
|
-
data?: unknown;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Options for `ironflow.agents.readMemory()`.
|
|
84
|
-
*/
|
|
85
|
-
export interface AgentReadMemoryOptions {
|
|
86
|
-
/**
|
|
87
|
-
* Sequence number returned by an earlier `streams.append`. When set,
|
|
88
|
-
* `readMemory` calls `waitForProjectionCatchup` before reading state
|
|
89
|
-
* so the result reflects events up to and including `minSeq`
|
|
90
|
-
* (read-your-writes).
|
|
91
|
-
*
|
|
92
|
-
* If `minSeq` exceeds the projection's eventual `last_event_seq`, the
|
|
93
|
-
* catchup blocks until `timeoutMs` and throws
|
|
94
|
-
* `MemoryCatchupTimeoutError`.
|
|
95
|
-
*/
|
|
96
|
-
minSeq?: number | bigint;
|
|
97
|
-
/**
|
|
98
|
-
* Catchup timeout in milliseconds. Default 30000. Ignored when
|
|
99
|
-
* `minSeq` is not provided.
|
|
100
|
-
*/
|
|
101
|
-
timeoutMs?: number;
|
|
102
|
-
/**
|
|
103
|
-
* Caller cancellation. Throws an `AbortError` (DOMException) if the
|
|
104
|
-
* signal aborts before the call completes.
|
|
105
|
-
*/
|
|
106
|
-
signal?: AbortSignal;
|
|
107
|
-
/**
|
|
108
|
-
* Partition key for partitioned projections. Passed through to both
|
|
109
|
-
* the catchup wait and the state read.
|
|
110
|
-
*/
|
|
111
|
-
partition?: string;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Result returned from a successful `ironflow.agents.readMemory()`.
|
|
115
|
-
*/
|
|
116
|
-
export interface AgentMemoryResult<TState = unknown> {
|
|
117
|
-
/** Materialized projection state. */
|
|
118
|
-
state: TState;
|
|
119
|
-
/** Projection version. */
|
|
120
|
-
version: number;
|
|
121
|
-
/** Last event id applied to the state, if any. */
|
|
122
|
-
lastEventId?: string;
|
|
123
|
-
/**
|
|
124
|
-
* `true` when `minSeq` was honored or skipped (no `minSeq` provided).
|
|
125
|
-
* Always `true` on a successful return — the catchup throws on timeout.
|
|
126
|
-
*/
|
|
127
|
-
caughtUp: boolean;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Minimum surface that `ironflow.agents.{invoke, subscribe, readMemory}`
|
|
131
|
-
* need from the client. Defining it as an interface lets the helpers be
|
|
132
|
-
* unit-tested with a mock client and keeps the public client surface
|
|
133
|
-
* tight.
|
|
134
|
-
*/
|
|
135
|
-
export interface AgentClientLike {
|
|
136
|
-
invoke<T = unknown>(functionId: string, options: {
|
|
137
|
-
data: T;
|
|
138
|
-
idempotencyKey?: string;
|
|
139
|
-
}): Promise<InvokeResult>;
|
|
140
|
-
subscribe<T = unknown>(pattern: string | string[], callbacks: SubscriptionCallbacks<T> & {
|
|
141
|
-
replay?: number;
|
|
142
|
-
includeMetadata?: boolean;
|
|
143
|
-
}): Promise<Subscription | {
|
|
144
|
-
unsubscribe(): void;
|
|
145
|
-
}>;
|
|
146
|
-
cancelRun(runId: string, reason?: string): Promise<Run>;
|
|
147
|
-
getProjection<TState = unknown>(name: string, options?: {
|
|
148
|
-
partition?: string;
|
|
149
|
-
}): Promise<ProjectionStateResult<TState>>;
|
|
150
|
-
waitForProjectionCatchup(name: string, opts: {
|
|
151
|
-
minSeq: number | bigint;
|
|
152
|
-
timeoutMs?: number;
|
|
153
|
-
partition?: string;
|
|
154
|
-
}): Promise<WaitResult>;
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,GAAG,EACH,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,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AAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC/B,OAAO,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1C,wBAAwB,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GACxE,OAAO,CAAC,UAAU,CAAC,CAAC;CACxB"}
|
package/dist/agents/types.js
DELETED
package/dist/agents/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|