@framers/agentos 0.1.97 → 0.1.99
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 +58 -13
- package/dist/api/agency.d.ts +51 -0
- package/dist/api/agency.d.ts.map +1 -0
- package/dist/api/agency.js +645 -0
- package/dist/api/agency.js.map +1 -0
- package/dist/api/agent.d.ts +15 -54
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/agent.js +14 -7
- package/dist/api/agent.js.map +1 -1
- package/dist/api/generateText.d.ts +16 -0
- package/dist/api/generateText.d.ts.map +1 -1
- package/dist/api/generateText.js.map +1 -1
- package/dist/api/hitl.d.ts +139 -0
- package/dist/api/hitl.d.ts.map +1 -0
- package/dist/api/hitl.js +211 -0
- package/dist/api/hitl.js.map +1 -0
- package/dist/api/strategies/debate.d.ts +16 -0
- package/dist/api/strategies/debate.d.ts.map +1 -0
- package/dist/api/strategies/debate.js +118 -0
- package/dist/api/strategies/debate.js.map +1 -0
- package/dist/api/strategies/hierarchical.d.ts +20 -0
- package/dist/api/strategies/hierarchical.d.ts.map +1 -0
- package/dist/api/strategies/hierarchical.js +140 -0
- package/dist/api/strategies/hierarchical.js.map +1 -0
- package/dist/api/strategies/index.d.ts +41 -0
- package/dist/api/strategies/index.d.ts.map +1 -0
- package/dist/api/strategies/index.js +95 -0
- package/dist/api/strategies/index.js.map +1 -0
- package/dist/api/strategies/parallel.d.ts +17 -0
- package/dist/api/strategies/parallel.d.ts.map +1 -0
- package/dist/api/strategies/parallel.js +122 -0
- package/dist/api/strategies/parallel.js.map +1 -0
- package/dist/api/strategies/review-loop.d.ts +18 -0
- package/dist/api/strategies/review-loop.d.ts.map +1 -0
- package/dist/api/strategies/review-loop.js +153 -0
- package/dist/api/strategies/review-loop.js.map +1 -0
- package/dist/api/strategies/sequential.d.ts +15 -0
- package/dist/api/strategies/sequential.d.ts.map +1 -0
- package/dist/api/strategies/sequential.js +94 -0
- package/dist/api/strategies/sequential.js.map +1 -0
- package/dist/api/strategies/shared.d.ts +36 -0
- package/dist/api/strategies/shared.d.ts.map +1 -0
- package/dist/api/strategies/shared.js +82 -0
- package/dist/api/strategies/shared.js.map +1 -0
- package/dist/api/types.d.ts +806 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +25 -0
- package/dist/api/types.js.map +1 -0
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts +7 -0
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts.map +1 -1
- package/dist/discovery/CapabilityDiscoveryEngine.js +21 -0
- package/dist/discovery/CapabilityDiscoveryEngine.js.map +1 -1
- package/dist/discovery/types.d.ts +2 -0
- package/dist/discovery/types.d.ts.map +1 -1
- package/dist/emergent/EmergentCapabilityEngine.d.ts +16 -0
- package/dist/emergent/EmergentCapabilityEngine.d.ts.map +1 -1
- package/dist/emergent/EmergentCapabilityEngine.js +51 -0
- package/dist/emergent/EmergentCapabilityEngine.js.map +1 -1
- package/dist/emergent/EmergentToolRegistry.d.ts +8 -0
- package/dist/emergent/EmergentToolRegistry.d.ts.map +1 -1
- package/dist/emergent/EmergentToolRegistry.js +42 -1
- package/dist/emergent/EmergentToolRegistry.js.map +1 -1
- package/dist/emergent/ToolPackage.d.ts +57 -0
- package/dist/emergent/ToolPackage.d.ts.map +1 -0
- package/dist/emergent/ToolPackage.js +145 -0
- package/dist/emergent/ToolPackage.js.map +1 -0
- package/dist/emergent/index.d.ts +2 -0
- package/dist/emergent/index.d.ts.map +1 -1
- package/dist/emergent/index.js +1 -0
- package/dist/emergent/index.js.map +1 -1
- package/dist/emergent/types.d.ts +27 -0
- package/dist/emergent/types.d.ts.map +1 -1
- package/dist/emergent/types.js +2 -0
- package/dist/emergent/types.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/api/agent.d.ts
CHANGED
|
@@ -4,68 +4,27 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Wraps {@link generateText} and {@link streamText} with per-session conversation
|
|
6
6
|
* history, optional HEXACO-inspired personality shaping, and a named-agent system
|
|
7
|
-
* prompt builder.
|
|
8
|
-
*
|
|
7
|
+
* prompt builder. Guardrail identifiers are accepted and stored in config but
|
|
8
|
+
* are not actively enforced in this lightweight layer — use the full AgentOS
|
|
9
|
+
* runtime (`AgentOSOrchestrator`) or `agency()` for guardrail enforcement.
|
|
9
10
|
*/
|
|
10
11
|
import { type GenerateTextOptions, type GenerateTextResult, type Message } from './generateText.js';
|
|
11
12
|
import { type StreamTextResult } from './streamText.js';
|
|
12
|
-
import type { ToolDefinitionMap } from './toolAdapter.js';
|
|
13
13
|
import { type AgentOSUsageAggregate, type AgentOSUsageLedgerOptions } from './usageLedger.js';
|
|
14
|
+
import type { BaseAgentConfig } from './types.js';
|
|
14
15
|
/**
|
|
15
16
|
* Configuration options for the {@link agent} factory function.
|
|
17
|
+
*
|
|
18
|
+
* Extends {@link BaseAgentConfig} with backward-compatible convenience fields.
|
|
19
|
+
* All `BaseAgentConfig` fields (rag, discovery, permissions, emergent, voice,
|
|
20
|
+
* etc.) are accepted and stored in config but are not actively wired in the
|
|
21
|
+
* lightweight agent — they will be consumed by `agency()` and the full runtime.
|
|
16
22
|
*/
|
|
17
|
-
export interface AgentOptions {
|
|
18
|
-
/**
|
|
19
|
-
* Provider name. When supplied without `model`, the default text model for
|
|
20
|
-
* the provider is resolved automatically from the built-in defaults registry.
|
|
21
|
-
*
|
|
22
|
-
* @example `"openai"`, `"anthropic"`, `"ollama"`
|
|
23
|
-
*/
|
|
24
|
-
provider?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Model used for every call made by this agent. Accepted in two formats:
|
|
27
|
-
* - `"provider:model"` — legacy format (e.g. `"openai:gpt-4o"`), still fully supported.
|
|
28
|
-
* - Plain model name (e.g. `"gpt-4o-mini"`) when `provider` is also set.
|
|
29
|
-
*
|
|
30
|
-
* Either `provider` or `model` (or an API key env var for auto-detection) is required.
|
|
31
|
-
*/
|
|
32
|
-
model?: string;
|
|
33
|
-
/** Display name injected into the system prompt (e.g. `"Aria"`). */
|
|
34
|
-
name?: string;
|
|
35
|
-
/** Free-form system instructions prepended before personality and name lines. */
|
|
36
|
-
instructions?: string;
|
|
37
|
-
/** Named tools available to the agent on every call. */
|
|
38
|
-
tools?: ToolDefinitionMap;
|
|
39
|
-
/**
|
|
40
|
-
* Enable in-memory conversation history for sessions.
|
|
41
|
-
* When `false`, each `send` / `stream` call is stateless. Defaults to `true`.
|
|
42
|
-
*/
|
|
43
|
-
memory?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* HEXACO-inspired personality trait overrides (0–1 scale).
|
|
46
|
-
* Encoded as a human-readable trait string appended to the system prompt.
|
|
47
|
-
*/
|
|
48
|
-
personality?: Partial<{
|
|
49
|
-
honesty: number;
|
|
50
|
-
emotionality: number;
|
|
51
|
-
extraversion: number;
|
|
52
|
-
agreeableness: number;
|
|
53
|
-
conscientiousness: number;
|
|
54
|
-
openness: number;
|
|
55
|
-
}>;
|
|
23
|
+
export interface AgentOptions extends BaseAgentConfig {
|
|
56
24
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* Use `AgentOSOrchestrator` for real guardrail enforcement.
|
|
25
|
+
* Top-level usage ledger shorthand for backward compatibility.
|
|
26
|
+
* When present, forwarded to `observability.usageLedger` internally.
|
|
60
27
|
*/
|
|
61
|
-
guardrails?: string[];
|
|
62
|
-
/** Override the provider API key instead of reading from environment variables. */
|
|
63
|
-
apiKey?: string;
|
|
64
|
-
/** Override the provider base URL (useful for local proxies or Ollama). */
|
|
65
|
-
baseUrl?: string;
|
|
66
|
-
/** Maximum agentic steps per call. Defaults to `5`. */
|
|
67
|
-
maxSteps?: number;
|
|
68
|
-
/** Optional durable usage ledger configuration for helper-level accounting. */
|
|
69
28
|
usageLedger?: AgentOSUsageLedgerOptions;
|
|
70
29
|
}
|
|
71
30
|
/**
|
|
@@ -138,8 +97,10 @@ export interface Agent {
|
|
|
138
97
|
* Multiple independent sessions can be opened via {@link Agent.session}.
|
|
139
98
|
*
|
|
140
99
|
* @param opts - Agent configuration including model, instructions, and optional tools.
|
|
100
|
+
* All {@link BaseAgentConfig} fields are accepted; advanced fields (rag, discovery,
|
|
101
|
+
* permissions, emergent, voice, guardrails, etc.) are stored but not actively
|
|
102
|
+
* wired in the lightweight layer — they are consumed by `agency()` and the full runtime.
|
|
141
103
|
* @returns An {@link Agent} instance with `generate`, `stream`, `session`, and `close` methods.
|
|
142
|
-
* @throws {Error} If `opts.guardrails` contains any entries (not supported in the lightweight API).
|
|
143
104
|
*
|
|
144
105
|
* @example
|
|
145
106
|
* ```ts
|
package/dist/api/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/api/agent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/api/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAgB,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAClH,OAAO,EAAc,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC/B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD;;;OAGG;IACH,WAAW,CAAC,EAAE,yBAAyB,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,wFAAwF;IACxF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChD;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvC,+EAA+E;IAC/E,QAAQ,IAAI,OAAO,EAAE,CAAC;IACtB,wFAAwF;IACxF,KAAK,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxC,uDAAuD;IACvD,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC3F;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;IAC9E;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACnC,8EAA8E;IAC9E,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC1D,+DAA+D;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAgCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,KAAK,CA+H/C"}
|
package/dist/api/agent.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Wraps {@link generateText} and {@link streamText} with per-session conversation
|
|
6
6
|
* history, optional HEXACO-inspired personality shaping, and a named-agent system
|
|
7
|
-
* prompt builder.
|
|
8
|
-
*
|
|
7
|
+
* prompt builder. Guardrail identifiers are accepted and stored in config but
|
|
8
|
+
* are not actively enforced in this lightweight layer — use the full AgentOS
|
|
9
|
+
* runtime (`AgentOSOrchestrator`) or `agency()` for guardrail enforcement.
|
|
9
10
|
*/
|
|
10
11
|
import { generateText } from './generateText.js';
|
|
11
12
|
import { streamText } from './streamText.js';
|
|
@@ -40,8 +41,10 @@ function buildSystemPrompt(opts) {
|
|
|
40
41
|
* Multiple independent sessions can be opened via {@link Agent.session}.
|
|
41
42
|
*
|
|
42
43
|
* @param opts - Agent configuration including model, instructions, and optional tools.
|
|
44
|
+
* All {@link BaseAgentConfig} fields are accepted; advanced fields (rag, discovery,
|
|
45
|
+
* permissions, emergent, voice, guardrails, etc.) are stored but not actively
|
|
46
|
+
* wired in the lightweight layer — they are consumed by `agency()` and the full runtime.
|
|
43
47
|
* @returns An {@link Agent} instance with `generate`, `stream`, `session`, and `close` methods.
|
|
44
|
-
* @throws {Error} If `opts.guardrails` contains any entries (not supported in the lightweight API).
|
|
45
48
|
*
|
|
46
49
|
* @example
|
|
47
50
|
* ```ts
|
|
@@ -52,11 +55,15 @@ function buildSystemPrompt(opts) {
|
|
|
52
55
|
* ```
|
|
53
56
|
*/
|
|
54
57
|
export function agent(opts) {
|
|
55
|
-
if (opts.guardrails && opts.guardrails.length > 0) {
|
|
56
|
-
throw new Error('agent({ guardrails }) is not supported in the lightweight high-level API. Use the full AgentOS runtime for real guardrail enforcement.');
|
|
57
|
-
}
|
|
58
58
|
const sessions = new Map();
|
|
59
59
|
const useMemory = opts.memory !== false;
|
|
60
|
+
/*
|
|
61
|
+
* Resolve the effective usage ledger config. The top-level `usageLedger`
|
|
62
|
+
* field is a backward-compat alias — if it is present we forward it to
|
|
63
|
+
* `observability.usageLedger`. An explicit `observability.usageLedger`
|
|
64
|
+
* takes precedence when both are supplied.
|
|
65
|
+
*/
|
|
66
|
+
const effectiveLedger = opts.observability?.usageLedger ?? opts.usageLedger;
|
|
60
67
|
const baseOpts = {
|
|
61
68
|
provider: opts.provider,
|
|
62
69
|
model: opts.model,
|
|
@@ -65,7 +72,7 @@ export function agent(opts) {
|
|
|
65
72
|
maxSteps: opts.maxSteps ?? 5,
|
|
66
73
|
apiKey: opts.apiKey,
|
|
67
74
|
baseUrl: opts.baseUrl,
|
|
68
|
-
usageLedger:
|
|
75
|
+
usageLedger: effectiveLedger,
|
|
69
76
|
};
|
|
70
77
|
return {
|
|
71
78
|
async generate(prompt, extra) {
|
package/dist/api/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/api/agent.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/api/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,YAAY,EAAmE,MAAM,mBAAmB,CAAC;AAClH,OAAO,EAAE,UAAU,EAAyB,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EACL,uBAAuB,GAGxB,MAAM,kBAAkB,CAAC;AAmF1B,SAAS,uBAAuB,CAC9B,GAAG,KAAmD;IAEtD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAkB;IAC3C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE,CAAC;QAC9B,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,mBAAmB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,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AI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;oBAC3F,CAAC;oBACD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,QAAQ;oBACN,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;gBACtB,CAAC;gBAED,KAAK,CAAC,KAAK;oBACT,OAAO,uBAAuB,CAAC;wBAC7B,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO;wBACtC,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,IAAI;wBAChC,SAAS;qBACV,CAAC,CAAC;gBACL,CAAC;gBAED,KAAK;oBACH,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;gBACrB,CAAC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,KAAK,CAAC,SAAkB;YAC5B,OAAO,uBAAuB,CAAC;gBAC7B,OAAO,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO;gBACtC,IAAI,EAAE,QAAQ,CAAC,WAAW,EAAE,IAAI;gBAChC,SAAS;aACV,CAAC,CAAC;QACL,CAAC;QAED,KAAK,CAAC,KAAK;YACT,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ToolDefinitionMap } from './toolAdapter.js';
|
|
2
2
|
import { type AgentOSUsageLedgerOptions } from './usageLedger.js';
|
|
3
|
+
import type { AgentCallRecord, AgencyTraceEvent } from './types.js';
|
|
3
4
|
/**
|
|
4
5
|
* A single chat message in a conversation history.
|
|
5
6
|
* Mirrors the OpenAI / Anthropic message shape accepted by provider adapters.
|
|
@@ -104,6 +105,21 @@ export interface GenerateTextResult {
|
|
|
104
105
|
* - `"error"` — provider returned an error.
|
|
105
106
|
*/
|
|
106
107
|
finishReason: 'stop' | 'length' | 'tool-calls' | 'error';
|
|
108
|
+
/**
|
|
109
|
+
* Ordered records of every sub-agent call made during an `agency()` run.
|
|
110
|
+
* `undefined` for plain `generateText` / `agent()` calls.
|
|
111
|
+
*/
|
|
112
|
+
agentCalls?: AgentCallRecord[];
|
|
113
|
+
/**
|
|
114
|
+
* Structured trace events emitted during the run.
|
|
115
|
+
* Populated by the agency orchestrator; `undefined` for single-agent calls.
|
|
116
|
+
*/
|
|
117
|
+
trace?: AgencyTraceEvent[];
|
|
118
|
+
/**
|
|
119
|
+
* Parsed structured output produced when `BaseAgentConfig.output` is a Zod
|
|
120
|
+
* schema. `undefined` when no output schema is configured.
|
|
121
|
+
*/
|
|
122
|
+
parsed?: unknown;
|
|
107
123
|
}
|
|
108
124
|
/**
|
|
109
125
|
* Stateless text generation with optional multi-step tool calling.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateText.d.ts","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAWA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"generateText.d.ts","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAWA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAsB,KAAK,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,kCAAkC;IAClC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,yDAAy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nE,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,EAAE,UAAU,CAAC;IAClB,2DAA2D;IAC3D,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,OAAO,CAAC;IACzD;;;OAGG;IACH,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAqMzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateText.js","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAkC,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"generateText.js","sourceRoot":"","sources":["../../src/api/generateText.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAA0B,MAAM,kBAAkB,CAAC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
|
2
|
+
* @file hitl.ts
|
|
3
|
+
* Human-in-the-loop (HITL) approval handler factories for the AgentOS API.
|
|
4
|
+
*
|
|
5
|
+
* The `hitl` object provides a set of composable handler factories that conform
|
|
6
|
+
* to the `HitlHandler` function signature expected by `HitlConfig.handler`.
|
|
7
|
+
* Handlers are async functions that receive an {@link ApprovalRequest} and must
|
|
8
|
+
* resolve to an {@link ApprovalDecision}.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { agency, hitl } from '@framers/agentos';
|
|
13
|
+
*
|
|
14
|
+
* // Auto-approve everything (useful in tests and CI environments)
|
|
15
|
+
* const testAgency = agency({
|
|
16
|
+
* agents: { worker: { model: 'openai:gpt-4o-mini' } },
|
|
17
|
+
* hitl: {
|
|
18
|
+
* approvals: { beforeTool: ['delete-file'] },
|
|
19
|
+
* handler: hitl.autoApprove(),
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Interactive CLI approval for local development
|
|
24
|
+
* const devAgency = agency({
|
|
25
|
+
* agents: { worker: { model: 'openai:gpt-4o' } },
|
|
26
|
+
* hitl: {
|
|
27
|
+
* approvals: { beforeTool: ['delete-file'], beforeReturn: true },
|
|
28
|
+
* handler: hitl.cli(),
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
import type { ApprovalRequest, ApprovalDecision } from './types.js';
|
|
34
|
+
/**
|
|
35
|
+
* An async function that receives an {@link ApprovalRequest} and resolves to
|
|
36
|
+
* an {@link ApprovalDecision}. Assign to `HitlConfig.handler`.
|
|
37
|
+
*/
|
|
38
|
+
export type HitlHandler = (request: ApprovalRequest) => Promise<ApprovalDecision>;
|
|
39
|
+
/**
|
|
40
|
+
* A collection of factory functions that produce {@link HitlHandler} instances
|
|
41
|
+
* for common approval patterns.
|
|
42
|
+
*
|
|
43
|
+
* All handlers are composable: you can wrap any factory result in your own
|
|
44
|
+
* function to add logging, fallback logic, or conditional routing.
|
|
45
|
+
*/
|
|
46
|
+
export declare const hitl: {
|
|
47
|
+
/**
|
|
48
|
+
* Returns a handler that approves every request immediately without any
|
|
49
|
+
* human interaction.
|
|
50
|
+
*
|
|
51
|
+
* Intended for use in automated tests and CI pipelines where human review
|
|
52
|
+
* is not required.
|
|
53
|
+
*
|
|
54
|
+
* @returns A {@link HitlHandler} that always resolves `{ approved: true }`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* handler: hitl.autoApprove()
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
autoApprove(): HitlHandler;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a handler that rejects every request immediately without any
|
|
64
|
+
* human interaction.
|
|
65
|
+
*
|
|
66
|
+
* Useful for dry-run or read-only execution modes where you want to confirm
|
|
67
|
+
* which actions would have been triggered without actually permitting any.
|
|
68
|
+
*
|
|
69
|
+
* @param reason - Optional human-readable rejection reason appended to the
|
|
70
|
+
* decision. Defaults to `"Auto-rejected"`.
|
|
71
|
+
* @returns A {@link HitlHandler} that always resolves `{ approved: false, reason }`.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* handler: hitl.autoReject('dry-run mode — no side effects permitted')
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
autoReject(reason?: string): HitlHandler;
|
|
79
|
+
/**
|
|
80
|
+
* Returns a handler that pauses execution and prompts the user interactively
|
|
81
|
+
* via `stdin`/`stdout`.
|
|
82
|
+
*
|
|
83
|
+
* Displays the approval request summary (description, agent, action, type)
|
|
84
|
+
* and waits for the user to type `y` (approve) or `n` (reject).
|
|
85
|
+
*
|
|
86
|
+
* **Important**: This handler reads from `process.stdin`, so it must only be
|
|
87
|
+
* used in interactive terminal environments (not in CI/CD pipelines or
|
|
88
|
+
* serverless functions).
|
|
89
|
+
*
|
|
90
|
+
* @returns A {@link HitlHandler} that waits for interactive CLI input.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* handler: hitl.cli()
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
cli(): HitlHandler;
|
|
98
|
+
/**
|
|
99
|
+
* Returns a handler that POSTs the {@link ApprovalRequest} as JSON to the
|
|
100
|
+
* provided URL and expects the server to respond with an {@link ApprovalDecision}.
|
|
101
|
+
*
|
|
102
|
+
* The server must respond with `Content-Type: application/json` containing an
|
|
103
|
+
* object with at least an `approved: boolean` field. Non-2xx responses are
|
|
104
|
+
* treated as a rejection with the HTTP status code as the reason.
|
|
105
|
+
*
|
|
106
|
+
* @param url - The full URL to POST approval requests to.
|
|
107
|
+
* @returns A {@link HitlHandler} that delegates decisions to an HTTP endpoint.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* handler: hitl.webhook('https://my-approval-service.example.com/approve')
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
webhook(url: string): HitlHandler;
|
|
115
|
+
/**
|
|
116
|
+
* Returns a handler that posts a notification to a Slack channel when an
|
|
117
|
+
* approval is requested.
|
|
118
|
+
*
|
|
119
|
+
* **v1 behaviour**: The message is sent to the configured Slack channel, then
|
|
120
|
+
* the handler immediately auto-approves. A future version will poll for
|
|
121
|
+
* emoji reactions (`:white_check_mark:` / `:x:`) on the posted message before
|
|
122
|
+
* resolving.
|
|
123
|
+
*
|
|
124
|
+
* @param opts.channel - Slack channel ID or name (e.g. `"#approvals"` or
|
|
125
|
+
* `"C0123456789"`).
|
|
126
|
+
* @param opts.token - Slack Bot OAuth token with `chat:write` scope.
|
|
127
|
+
* @returns A {@link HitlHandler} that posts to Slack and auto-approves for v1.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* handler: hitl.slack({ channel: '#approvals', token: process.env.SLACK_BOT_TOKEN! })
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
slack(opts: {
|
|
135
|
+
channel: string;
|
|
136
|
+
token: string;
|
|
137
|
+
}): HitlHandler;
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=hitl.d.ts.map
|
|
@@ -0,0 +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;AAMpE;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAMlF;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;IAKf;;;;;;;;;;;;;OAaG;mBACY,WAAW;IAQ1B;;;;;;;;;;;;;;;OAeG;wBACiB,MAAM,GAAG,WAAW;IAWxC;;;;;;;;;;;;;;;;;OAiBG;WACI,WAAW;IAwBlB;;;;;;;;;;;;;;;OAeG;iBACU,MAAM,GAAG,WAAW;IAoBjC;;;;;;;;;;;;;;;;;;OAkBG;gBACS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,WAAW;CA6B7D,CAAC"}
|
package/dist/api/hitl.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file hitl.ts
|
|
3
|
+
* Human-in-the-loop (HITL) approval handler factories for the AgentOS API.
|
|
4
|
+
*
|
|
5
|
+
* The `hitl` object provides a set of composable handler factories that conform
|
|
6
|
+
* to the `HitlHandler` function signature expected by `HitlConfig.handler`.
|
|
7
|
+
* Handlers are async functions that receive an {@link ApprovalRequest} and must
|
|
8
|
+
* resolve to an {@link ApprovalDecision}.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { agency, hitl } from '@framers/agentos';
|
|
13
|
+
*
|
|
14
|
+
* // Auto-approve everything (useful in tests and CI environments)
|
|
15
|
+
* const testAgency = agency({
|
|
16
|
+
* agents: { worker: { model: 'openai:gpt-4o-mini' } },
|
|
17
|
+
* hitl: {
|
|
18
|
+
* approvals: { beforeTool: ['delete-file'] },
|
|
19
|
+
* handler: hitl.autoApprove(),
|
|
20
|
+
* },
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* // Interactive CLI approval for local development
|
|
24
|
+
* const devAgency = agency({
|
|
25
|
+
* agents: { worker: { model: 'openai:gpt-4o' } },
|
|
26
|
+
* hitl: {
|
|
27
|
+
* approvals: { beforeTool: ['delete-file'], beforeReturn: true },
|
|
28
|
+
* handler: hitl.cli(),
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Handler factory namespace
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/**
|
|
37
|
+
* A collection of factory functions that produce {@link HitlHandler} instances
|
|
38
|
+
* for common approval patterns.
|
|
39
|
+
*
|
|
40
|
+
* All handlers are composable: you can wrap any factory result in your own
|
|
41
|
+
* function to add logging, fallback logic, or conditional routing.
|
|
42
|
+
*/
|
|
43
|
+
export const hitl = {
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// autoApprove
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
/**
|
|
48
|
+
* Returns a handler that approves every request immediately without any
|
|
49
|
+
* human interaction.
|
|
50
|
+
*
|
|
51
|
+
* Intended for use in automated tests and CI pipelines where human review
|
|
52
|
+
* is not required.
|
|
53
|
+
*
|
|
54
|
+
* @returns A {@link HitlHandler} that always resolves `{ approved: true }`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* handler: hitl.autoApprove()
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
autoApprove() {
|
|
62
|
+
return async () => ({ approved: true });
|
|
63
|
+
},
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// autoReject
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* Returns a handler that rejects every request immediately without any
|
|
69
|
+
* human interaction.
|
|
70
|
+
*
|
|
71
|
+
* Useful for dry-run or read-only execution modes where you want to confirm
|
|
72
|
+
* which actions would have been triggered without actually permitting any.
|
|
73
|
+
*
|
|
74
|
+
* @param reason - Optional human-readable rejection reason appended to the
|
|
75
|
+
* decision. Defaults to `"Auto-rejected"`.
|
|
76
|
+
* @returns A {@link HitlHandler} that always resolves `{ approved: false, reason }`.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* handler: hitl.autoReject('dry-run mode — no side effects permitted')
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
autoReject(reason) {
|
|
84
|
+
return async () => ({
|
|
85
|
+
approved: false,
|
|
86
|
+
reason: reason ?? 'Auto-rejected',
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// cli
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
/**
|
|
93
|
+
* Returns a handler that pauses execution and prompts the user interactively
|
|
94
|
+
* via `stdin`/`stdout`.
|
|
95
|
+
*
|
|
96
|
+
* Displays the approval request summary (description, agent, action, type)
|
|
97
|
+
* and waits for the user to type `y` (approve) or `n` (reject).
|
|
98
|
+
*
|
|
99
|
+
* **Important**: This handler reads from `process.stdin`, so it must only be
|
|
100
|
+
* used in interactive terminal environments (not in CI/CD pipelines or
|
|
101
|
+
* serverless functions).
|
|
102
|
+
*
|
|
103
|
+
* @returns A {@link HitlHandler} that waits for interactive CLI input.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* handler: hitl.cli()
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
cli() {
|
|
111
|
+
return async (request) => {
|
|
112
|
+
const readline = await import('node:readline');
|
|
113
|
+
const rl = readline.createInterface({
|
|
114
|
+
input: process.stdin,
|
|
115
|
+
output: process.stdout,
|
|
116
|
+
});
|
|
117
|
+
return new Promise((resolve) => {
|
|
118
|
+
console.log(`\n[APPROVAL NEEDED] ${request.description}`);
|
|
119
|
+
console.log(`Agent: ${request.agent} | Action: ${request.action}`);
|
|
120
|
+
console.log(`Type: ${request.type}`);
|
|
121
|
+
rl.question('Approve? (y/n): ', (answer) => {
|
|
122
|
+
rl.close();
|
|
123
|
+
resolve({ approved: answer.toLowerCase().startsWith('y') });
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
// webhook
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
/**
|
|
132
|
+
* Returns a handler that POSTs the {@link ApprovalRequest} as JSON to the
|
|
133
|
+
* provided URL and expects the server to respond with an {@link ApprovalDecision}.
|
|
134
|
+
*
|
|
135
|
+
* The server must respond with `Content-Type: application/json` containing an
|
|
136
|
+
* object with at least an `approved: boolean` field. Non-2xx responses are
|
|
137
|
+
* treated as a rejection with the HTTP status code as the reason.
|
|
138
|
+
*
|
|
139
|
+
* @param url - The full URL to POST approval requests to.
|
|
140
|
+
* @returns A {@link HitlHandler} that delegates decisions to an HTTP endpoint.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* handler: hitl.webhook('https://my-approval-service.example.com/approve')
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
webhook(url) {
|
|
148
|
+
return async (request) => {
|
|
149
|
+
const resp = await fetch(url, {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
headers: { 'Content-Type': 'application/json' },
|
|
152
|
+
body: JSON.stringify(request),
|
|
153
|
+
});
|
|
154
|
+
if (!resp.ok) {
|
|
155
|
+
return { approved: false, reason: `Webhook returned ${resp.status}` };
|
|
156
|
+
}
|
|
157
|
+
return (await resp.json());
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
// slack
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
/**
|
|
164
|
+
* Returns a handler that posts a notification to a Slack channel when an
|
|
165
|
+
* approval is requested.
|
|
166
|
+
*
|
|
167
|
+
* **v1 behaviour**: The message is sent to the configured Slack channel, then
|
|
168
|
+
* the handler immediately auto-approves. A future version will poll for
|
|
169
|
+
* emoji reactions (`:white_check_mark:` / `:x:`) on the posted message before
|
|
170
|
+
* resolving.
|
|
171
|
+
*
|
|
172
|
+
* @param opts.channel - Slack channel ID or name (e.g. `"#approvals"` or
|
|
173
|
+
* `"C0123456789"`).
|
|
174
|
+
* @param opts.token - Slack Bot OAuth token with `chat:write` scope.
|
|
175
|
+
* @returns A {@link HitlHandler} that posts to Slack and auto-approves for v1.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* handler: hitl.slack({ channel: '#approvals', token: process.env.SLACK_BOT_TOKEN! })
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
slack(opts) {
|
|
183
|
+
return async (request) => {
|
|
184
|
+
// Post the approval request to the configured Slack channel.
|
|
185
|
+
await fetch('https://slack.com/api/chat.postMessage', {
|
|
186
|
+
method: 'POST',
|
|
187
|
+
headers: {
|
|
188
|
+
Authorization: `Bearer ${opts.token}`,
|
|
189
|
+
'Content-Type': 'application/json',
|
|
190
|
+
},
|
|
191
|
+
body: JSON.stringify({
|
|
192
|
+
channel: opts.channel,
|
|
193
|
+
text: [
|
|
194
|
+
'[APPROVAL NEEDED]',
|
|
195
|
+
request.description,
|
|
196
|
+
`Agent: ${request.agent}`,
|
|
197
|
+
`Action: ${request.action}`,
|
|
198
|
+
`Type: ${request.type}`,
|
|
199
|
+
'React with :white_check_mark: to approve or :x: to reject.',
|
|
200
|
+
].join('\n'),
|
|
201
|
+
}),
|
|
202
|
+
});
|
|
203
|
+
// v1: auto-approve after notifying; real reaction polling is a future enhancement.
|
|
204
|
+
return {
|
|
205
|
+
approved: true,
|
|
206
|
+
reason: 'Slack notification sent — auto-approved for v1',
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=hitl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitl.js","sourceRoot":"","sources":["../../src/api/hitl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAcH,8EAA8E;AAC9E,4BAA4B;AAC5B,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,8EAA8E;IAC9E,cAAc;IACd,8EAA8E;IAE9E;;;;;;;;;;;;;OAaG;IACH,WAAW;QACT,OAAO,KAAK,IAA+B,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,8EAA8E;IAC9E,aAAa;IACb,8EAA8E;IAE9E;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,MAAe;QACxB,OAAO,KAAK,IAA+B,EAAE,CAAC,CAAC;YAC7C,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,MAAM,IAAI,eAAe;SAClC,CAAC,CAAC;IACL,CAAC;IAED,8EAA8E;IAC9E,MAAM;IACN,8EAA8E;IAE9E;;;;;;;;;;;;;;;;;OAiBG;IACH,GAAG;QACD,OAAO,KAAK,EAAE,OAAwB,EAA6B,EAAE;YACnE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;YAC/C,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;g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AAI,EAAE,CAAqB,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC;IAED,8EAA8E;IAC9E,QAAQ;IACR,8EAA8E;IAE9E;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,IAAwC;QAC5C,OAAO,KAAK,EAAE,OAAwB,EAA6B,EAAE;YACnE,6DAA6D;YAC7D,MAAM,KAAK,CAAC,wCAAwC,EAAE;gBACpD,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE;oBACrC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,IAAI,EAAE;wBACJ,mBAAmB;wBACnB,OAAO,CAAC,WAAW;wBACnB,UAAU,OAAO,CAAC,KAAK,EAAE;wBACzB,WAAW,OAAO,CAAC,MAAM,EAAE;wBAC3B,SAAS,OAAO,CAAC,IAAI,EAAE;wBACvB,4DAA4D;qBAC7D,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb,CAAC;aACH,CAAC,CAAC;YAEH,mFAAmF;YACnF,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,gDAAgD;aACzD,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgencyOptions, CompiledStrategy, Agent, BaseAgentConfig } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compiles a debate execution strategy.
|
|
4
|
+
*
|
|
5
|
+
* Agents are iterated in rounds. During each round, every agent receives the
|
|
6
|
+
* original task plus all previously collected arguments, and contributes its
|
|
7
|
+
* own perspective. After `maxRounds` complete, a synthesizer agent (using the
|
|
8
|
+
* agency-level model) distils all arguments into a final answer.
|
|
9
|
+
*
|
|
10
|
+
* @param agents - Named roster of agent configs or pre-built `Agent` instances.
|
|
11
|
+
* @param agencyConfig - Agency-level configuration providing fallback model/provider/tools.
|
|
12
|
+
* @returns A {@link CompiledStrategy} with `execute` and `stream` methods.
|
|
13
|
+
* @throws {AgencyConfigError} When no agency-level model/provider is available for synthesis.
|
|
14
|
+
*/
|
|
15
|
+
export declare function compileDebate(agents: Record<string, BaseAgentConfig | Agent>, agencyConfig: AgencyOptions): CompiledStrategy;
|
|
16
|
+
//# sourceMappingURL=debate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debate.d.ts","sourceRoot":"","sources":["../../../src/api/strategies/debate.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,eAAe,EAEhB,MAAM,aAAa,CAAC;AAKrB;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,KAAK,CAAC,EAC/C,YAAY,EAAE,aAAa,GAC1B,gBAAgB,CAiHlB"}
|