@rowan-agent/agent 0.4.11 → 0.5.1
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 +25 -21
- package/dist/index.d.ts +207 -273
- package/dist/index.js +2292 -1725
- package/package.json +1 -1
- package/dist/chunk-2FIII4GP.js +0 -142
- package/dist/chunk-FTIS43EE.js +0 -504
- package/dist/loader-HCYCHPGT.js +0 -13
- package/dist/path-XORRK2EC.js +0 -28
package/README.md
CHANGED
|
@@ -50,6 +50,11 @@ class Agent {
|
|
|
50
50
|
waitForIdle(): Promise<void>;
|
|
51
51
|
flushEvents(): Promise<void>;
|
|
52
52
|
readonly status: AgentStatus;
|
|
53
|
+
|
|
54
|
+
// Resource loading — replaces standalone loadSkills/loadPhases/loadExtensions
|
|
55
|
+
static loadSkills(targetPath: string): Promise<Skill[]>;
|
|
56
|
+
static loadPhases(targetPath: string): Promise<PhaseRegistry>;
|
|
57
|
+
static loadExtensions(targetPath: string): Promise<LoadExtensionsResult>;
|
|
53
58
|
}
|
|
54
59
|
```
|
|
55
60
|
|
|
@@ -60,12 +65,8 @@ type AgentOptions = {
|
|
|
60
65
|
context: AgentContext;
|
|
61
66
|
model: LlmModelRef;
|
|
62
67
|
stream: StreamFn;
|
|
63
|
-
|
|
64
|
-
rowanDir?: string; // project-local Rowan directory, default: ".rowan"
|
|
68
|
+
extensions?: LoadedExtension[];
|
|
65
69
|
sessionId?: string;
|
|
66
|
-
phases?: PhaseRegistry;
|
|
67
|
-
extensions?: ExtensionRunnerRef;
|
|
68
|
-
signal?: AbortSignal;
|
|
69
70
|
maxAttempts?: number;
|
|
70
71
|
|
|
71
72
|
// Lifecycle hooks
|
|
@@ -99,6 +100,8 @@ type AgentContext = {
|
|
|
99
100
|
messages: AgentMessage[];
|
|
100
101
|
tools: Tool[];
|
|
101
102
|
skills: Skill[];
|
|
103
|
+
// Optional custom phases; Agent merges them with its built-in "default" phase.
|
|
104
|
+
phases?: PhaseRegistry;
|
|
102
105
|
};
|
|
103
106
|
```
|
|
104
107
|
|
|
@@ -239,12 +242,9 @@ await session.branch(entryId);
|
|
|
239
242
|
Skills are `SKILL.md` knowledge bundles that get injected into the agent context, extending its domain knowledge without changing code.
|
|
240
243
|
|
|
241
244
|
```ts
|
|
242
|
-
import {
|
|
245
|
+
import { Agent } from "@rowan-agent/agent";
|
|
243
246
|
|
|
244
|
-
const skills = await loadSkills(
|
|
245
|
-
const skill = await loadSkill(path, workspace);
|
|
246
|
-
const path = resolveSkillPath("example", workspace);
|
|
247
|
-
// → <rowanDir>/skills/example/SKILL.md
|
|
247
|
+
const skills = await Agent.loadSkills("/User/Skills");
|
|
248
248
|
```
|
|
249
249
|
|
|
250
250
|
## Phases
|
|
@@ -257,13 +257,15 @@ Each phase's `PHASE.md` content is injected as a system message, giving the LLM
|
|
|
257
257
|
|
|
258
258
|
```
|
|
259
259
|
Per iteration:
|
|
260
|
-
1.
|
|
260
|
+
1. Read Agent-normalized `context.phases`
|
|
261
261
|
2. Inject phase instructions as system message
|
|
262
262
|
3. Execute phase (factory | run | LLM fallback)
|
|
263
263
|
4. Extract routing decision from route tool call
|
|
264
264
|
5. Transition, continue, or stop
|
|
265
265
|
```
|
|
266
266
|
|
|
267
|
+
**`entryPhaseId`** specifies which phase the loop enters first. When phases are loaded from `.rowan/phases/`, the first discovered phase becomes the entry. When none are configured, the Agent normalises to `"default"`. This field is an internal routing hint for the phase loop — it is **not** exposed to the LLM, since the agent does not need to know which phase is the entry point to make routing decisions.
|
|
268
|
+
|
|
267
269
|
### Example Phase Flow
|
|
268
270
|
|
|
269
271
|
```
|
|
@@ -377,7 +379,7 @@ interface PhaseContext {
|
|
|
377
379
|
messages: AgentMessage[];
|
|
378
380
|
tools: Tool[];
|
|
379
381
|
skills: Skill[];
|
|
380
|
-
state: PhaseState; // { current, available, iterations, payload }
|
|
382
|
+
state: PhaseState; // { current, available, entryPhaseId, iterations, payload }
|
|
381
383
|
}
|
|
382
384
|
|
|
383
385
|
type PhaseOutput = {
|
|
@@ -402,15 +404,17 @@ Each target gets a forked copy of the current messages (or empty if `isolated: t
|
|
|
402
404
|
The extension system lets plugins register lifecycle hooks, tools, phases, model providers, and cross-plugin events. Plugins are discovered from `<workspace>/.rowan/extensions`.
|
|
403
405
|
|
|
404
406
|
```ts
|
|
405
|
-
import {
|
|
407
|
+
import { Agent } from "@rowan-agent/agent";
|
|
406
408
|
|
|
407
|
-
const { extensions } = await
|
|
408
|
-
|
|
409
|
-
|
|
409
|
+
const { extensions } = await Agent.loadExtensions(`${cwd}/.rowan/extensions`);
|
|
410
|
+
// Pass extensions to the Agent constructor — they are loaded and bound internally
|
|
411
|
+
const agent = new Agent({ context, model, stream, extensions });
|
|
410
412
|
```
|
|
411
413
|
|
|
412
414
|
### ExtensionRunner
|
|
413
415
|
|
|
416
|
+
`ExtensionRunner` is used internally by Agent when extensions are passed via the constructor or `run()`. The Agent manages the runner lifecycle — load, bind, invalidate — automatically.
|
|
417
|
+
|
|
414
418
|
```ts
|
|
415
419
|
class ExtensionRunner {
|
|
416
420
|
readonly hooks: HooksManager; // 19 lifecycle hook types
|
|
@@ -462,7 +466,7 @@ export default function myPlugin(rowan: ExtensionAPI) {
|
|
|
462
466
|
|
|
463
467
|
Multi-provider model configuration via `.rowan/config.yaml`. Supports multiple API providers, per-model settings, environment variable interpolation, and per-phase model overrides.
|
|
464
468
|
|
|
465
|
-
Config is loaded from the runtime Rowan directory, which defaults to `.rowan
|
|
469
|
+
Config is loaded from the runtime Rowan directory, which defaults to `.rowan`.
|
|
466
470
|
|
|
467
471
|
### Config File
|
|
468
472
|
|
|
@@ -636,13 +640,13 @@ const request = buildModelRequest({ systemPrompt, messages, tools });
|
|
|
636
640
|
|
|
637
641
|
## Workspace
|
|
638
642
|
|
|
639
|
-
Workspace resolution uses the current project
|
|
643
|
+
Workspace resolution uses the current project root. The project Rowan directory defaults to `<cwd>/.rowan`; pass `rowanDir` to resolve another project-local directory.
|
|
640
644
|
|
|
641
645
|
```ts
|
|
642
646
|
import { resolveWorkspacePaths, resolveInWorkspace } from "@rowan-agent/agent";
|
|
643
647
|
|
|
644
648
|
const workspace = resolveWorkspacePaths();
|
|
645
|
-
// → {
|
|
649
|
+
// → { cwd: string, rowanDir: string }
|
|
646
650
|
|
|
647
651
|
const custom = resolveWorkspacePaths({ rowanDir: ".rowan-project" });
|
|
648
652
|
// → custom.rowanDir is <cwd>/.rowan-project
|
|
@@ -666,7 +670,7 @@ type LoopMetrics = {
|
|
|
666
670
|
| Type | Description |
|
|
667
671
|
|------|-------------|
|
|
668
672
|
| `Agent` | Main agent facade |
|
|
669
|
-
| `AgentContext` | System prompt, messages, tools, skills |
|
|
673
|
+
| `AgentContext` | System prompt, messages, tools, skills, phases |
|
|
670
674
|
| `AgentMessage` | Typed message with role, content, metadata |
|
|
671
675
|
| `AgentEvent` | Discriminated union of 13 event types |
|
|
672
676
|
| `Tool` / `ToolResult` | Tool definition and execution result |
|
|
@@ -694,4 +698,4 @@ type LoopMetrics = {
|
|
|
694
698
|
|
|
695
699
|
## Version
|
|
696
700
|
|
|
697
|
-
Current version: **0.4.
|
|
701
|
+
Current version: **0.4.11**
|