@rowan-agent/agent 0.32.0 → 0.33.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/{index-BNGbx6JB.d.ts → index-OBJCF_CO.d.ts} +7 -55
- package/dist/index.d.ts +1 -1
- package/dist/runtime.d.ts +2 -9
- package/dist/runtime.js +5 -139
- package/package.json +1 -1
|
@@ -154,12 +154,6 @@ interface EventBus {
|
|
|
154
154
|
on(event: string, listener: Listener): () => void;
|
|
155
155
|
/** Emit an event to all subscribers. */
|
|
156
156
|
emit(event: string, ...args: unknown[]): void;
|
|
157
|
-
/** Remove all listeners for an event, or all listeners if no event specified. */
|
|
158
|
-
off(event?: string): void;
|
|
159
|
-
/** Check if there are listeners for an event. */
|
|
160
|
-
has(event: string): boolean;
|
|
161
|
-
/** Get listener count for an event. */
|
|
162
|
-
count(event: string): number;
|
|
163
157
|
}
|
|
164
158
|
|
|
165
159
|
/**
|
|
@@ -349,7 +343,6 @@ declare class ExtensionRunner {
|
|
|
349
343
|
private readonly pendingProviders;
|
|
350
344
|
private bound;
|
|
351
345
|
private readonly errorListeners;
|
|
352
|
-
private readonly capabilityListeners;
|
|
353
346
|
private readonly resourceChangeListeners;
|
|
354
347
|
private runtimeAgents?;
|
|
355
348
|
private readonly activeExtensionPhases;
|
|
@@ -416,24 +409,12 @@ declare class ExtensionRunner {
|
|
|
416
409
|
* Get a tool definition by name. Returns undefined if not found.
|
|
417
410
|
*/
|
|
418
411
|
getToolDefinition(toolName: string): RegisteredTool["definition"] | undefined;
|
|
419
|
-
/** Get all contributed capabilities across all extensions. */
|
|
420
|
-
getCapabilities(): readonly ExtensionCapability[];
|
|
421
|
-
/**
|
|
422
|
-
* Subscribe to capability changes (contributions added, removed, or extensions disposed).
|
|
423
|
-
* Returns an unsubscribe function.
|
|
424
|
-
*/
|
|
425
|
-
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
426
412
|
/**
|
|
427
413
|
* Subscribe to resource changes (tools, phases, skills registered, unregistered, or disposed).
|
|
428
414
|
* Used by RuntimeBootstrapRegistry to re-commit implicit sources after activation.
|
|
429
415
|
*/
|
|
430
416
|
onResourceChange(listener: (kind: "tool" | "phase" | "skill") => Promise<void> | void): () => void;
|
|
431
417
|
private notifyResourceChange;
|
|
432
|
-
triggerUiAction(event: {
|
|
433
|
-
contributionId: string;
|
|
434
|
-
actionId: string;
|
|
435
|
-
scope?: ScopeRef;
|
|
436
|
-
}): void;
|
|
437
418
|
getPhase(name: string): Phase | undefined;
|
|
438
419
|
getPhases(): Phase[];
|
|
439
420
|
getRegisteredPhases(): readonly RegisteredPhase[];
|
|
@@ -507,8 +488,6 @@ declare class ExtensionRunner {
|
|
|
507
488
|
private createExtensionAPI;
|
|
508
489
|
private registerTool;
|
|
509
490
|
private unregisterTool;
|
|
510
|
-
private contributeCapability;
|
|
511
|
-
private notifyCapabilitiesChanged;
|
|
512
491
|
private registerPhase;
|
|
513
492
|
private registerPhaseDefinition;
|
|
514
493
|
private unregisterPhase;
|
|
@@ -1288,13 +1267,6 @@ interface AgentRuntime {
|
|
|
1288
1267
|
signal: AbortSignal;
|
|
1289
1268
|
}>): void | Promise<void>;
|
|
1290
1269
|
}): Promise<DurableConsumer>;
|
|
1291
|
-
listCapabilities(): readonly ExtensionCapability[];
|
|
1292
|
-
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
1293
|
-
triggerUiAction(event: {
|
|
1294
|
-
contributionId: string;
|
|
1295
|
-
actionId: string;
|
|
1296
|
-
scope?: ScopeRef;
|
|
1297
|
-
}): void;
|
|
1298
1270
|
close(): Promise<void>;
|
|
1299
1271
|
}
|
|
1300
1272
|
type ConsumerRegistration = Readonly<{
|
|
@@ -1437,18 +1409,6 @@ interface HostApiExtension {
|
|
|
1437
1409
|
readonly namespaces: Readonly<Record<string, unknown>>;
|
|
1438
1410
|
dispose?(): void;
|
|
1439
1411
|
}
|
|
1440
|
-
type ExtensionToolContribution = {
|
|
1441
|
-
kind: "tool";
|
|
1442
|
-
name: string;
|
|
1443
|
-
description: string;
|
|
1444
|
-
};
|
|
1445
|
-
type ExtensionCapabilityContribution = ExtensionToolContribution;
|
|
1446
|
-
type ExtensionCapability = {
|
|
1447
|
-
extensionId: string;
|
|
1448
|
-
kind: "tool";
|
|
1449
|
-
name: string;
|
|
1450
|
-
description: string;
|
|
1451
|
-
};
|
|
1452
1412
|
interface SourceInfo {
|
|
1453
1413
|
source: string;
|
|
1454
1414
|
baseDir?: string;
|
|
@@ -1630,17 +1590,15 @@ interface ExtensionAgentsRuntimeDelegate {
|
|
|
1630
1590
|
* ```
|
|
1631
1591
|
*/
|
|
1632
1592
|
interface ExtensionAPI {
|
|
1633
|
-
/** Hook events — subscribe
|
|
1593
|
+
/** Hook events — subscribe; Rowan removes subscriptions when the Extension is disposed. */
|
|
1634
1594
|
hooks: {
|
|
1635
1595
|
/**
|
|
1636
|
-
* Subscribe to a hook event.
|
|
1596
|
+
* Subscribe to a hook event. Returns an unsubscribe function.
|
|
1637
1597
|
*
|
|
1638
1598
|
* @param eventType - Hook type, e.g. "before_tool_call"
|
|
1639
1599
|
* @param handler - Hook handler, can return result to modify behavior
|
|
1640
1600
|
*/
|
|
1641
|
-
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
1642
|
-
/** Unsubscribe from a hook event. */
|
|
1643
|
-
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
1601
|
+
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): () => void;
|
|
1644
1602
|
};
|
|
1645
1603
|
/** Extension configuration — read own layered config or listen for changes. */
|
|
1646
1604
|
config: {
|
|
@@ -1692,21 +1650,15 @@ interface ExtensionAPI {
|
|
|
1692
1650
|
agents: ExtensionAgentsAPI;
|
|
1693
1651
|
/** Shared event bus for inter-extension communication. */
|
|
1694
1652
|
events: EventBus;
|
|
1695
|
-
/** Capability contributions — advertise tools or features to the host. */
|
|
1696
|
-
capabilities: {
|
|
1697
|
-
/** Contribute a capability to the host. Returns a disposer to remove the contribution. */
|
|
1698
|
-
contribute(contribution: ExtensionCapabilityContribution): () => void;
|
|
1699
|
-
};
|
|
1700
1653
|
/** Runtime context — cwd, signal, exec. */
|
|
1701
1654
|
context: ExtensionContext;
|
|
1702
1655
|
}
|
|
1703
1656
|
/**
|
|
1704
1657
|
* Extension factory function.
|
|
1705
|
-
* Receives ExtensionAPI for registering hooks, phases, and providers.
|
|
1658
|
+
* Receives ExtensionAPI for registering hooks, phases, and providers. Return a cleanup
|
|
1659
|
+
* function only for resources the Extension owns itself; Rowan removes every registration.
|
|
1706
1660
|
*/
|
|
1707
|
-
type
|
|
1708
|
-
type ExtensionFactoryResult = void | ExtensionDisposer;
|
|
1709
|
-
type ExtensionFactory = (api: ExtensionAPI) => ExtensionFactoryResult | Promise<ExtensionFactoryResult>;
|
|
1661
|
+
type ExtensionFactory = (api: ExtensionAPI) => void | (() => void | Promise<void>) | Promise<void | (() => void | Promise<void>)>;
|
|
1710
1662
|
|
|
1711
1663
|
type PhaseStatusState = "running" | "completed";
|
|
1712
1664
|
/** Normalized status event exposed to Runtime consumers. */
|
|
@@ -2257,4 +2209,4 @@ declare class RunInteractionBoundary extends Error {
|
|
|
2257
2209
|
constructor(state: ExecutionState, interactions: readonly RunInteraction[]);
|
|
2258
2210
|
}
|
|
2259
2211
|
|
|
2260
|
-
export { type
|
|
2212
|
+
export { type ExecutionCheckpoint as $, type AgentRuntime as A, type DurableStore as B, type ContextStatus as C, type DurableRunEvent as D, type ExtensionHost as E, type AgentRecord as F, type RunRecord as G, type HostApiExtension as H, type InvocationSource as I, type ToolCallSnapshot as J, type ContextCompactionRecord as K, type LoadInput as L, type MessageId as M, type OwnedStore as N, type OwnerLease as O, type Phase as P, type ConfigToken as Q, type ResourceKind as R, type Skill as S, type Tool as T, type UserContent as U, type ExecutionId as V, type ContextCandidate as W, type RunClaim as X, type RunFailure as Y, type ExecutionToken as Z, type AssistantMessage as _, type AgentRuntimeOptions as a, type MessageRevised as a$, type RunInteraction as a0, type ToolCommit as a1, type ToolCallReservation as a2, type ToolBatchCommit as a3, type Outcome as a4, type ConsumerRegistration as a5, type RetentionResult as a6, type ConfigProvider as a7, type ConfigurationSnapshot as a8, type ConfigPutResult as a9, isConfigurationSnapshot as aA, mergeToolCall as aB, parseAgentDefinition as aC, resolveConfigurationSnapshot as aD, type AfterToolCall as aE, type AssistantContent as aF, type BeforeToolCall as aG, type EventBus as aH, type EventId as aI, type ExecOptions as aJ, type ExecResult as aK, type ExtensionAPI as aL, type ExtensionAgentConsumerDisposer as aM, type ExtensionAgentsAPI as aN, type ExtensionContext as aO, type ExtensionFactory as aP, type ExtensionStateStore as aQ, type HookEvent as aR, type HookEventType as aS, type HookHandler as aT, type InteractionRecord as aU, type InternalModelLoopOptions as aV, type LiveInteractionEvent as aW, type MessageBase as aX, type MessageCommitted as aY, type MessageContent as aZ, type MessageDelta as a_, type ConfigResolution as aa, type PhaseRegistry as ab, type LoadedExtension as ac, type DefinitionLayer as ad, type ExtensionActivationError as ae, type ExtensionActivationResult as af, type ExtensionContribution as ag, ExtensionLifetimeError as ah, type ExtensionLifetimeErrorCode as ai, type ExtensionLoadInput as aj, type LoadExtensionsResult as ak, type ModelRetry as al, type OpaqueId as am, type OwnerToken as an, type PhaseRegistrySelection as ao, type ResolvedResourceView as ap, type ResourceDiagnostic as aq, type ResourceRef as ar, ResourceRegistry as as, ResourceRegistryError as at, type ResourceRegistryErrorCode as au, type ResourceSourceId as av, type ResourceView as aw, RuntimeBootstrapRegistry as ax, RuntimeExtensionLifetime as ay, extensionSourceId as az, type AgentDefinition as b, type ModelInvokeOutput as b0, type PhaseContext as b1, type PhaseExecution as b2, type PhaseExecutionIdentity as b3, type PhaseInput as b4, type PhaseInvocation as b5, type PhaseMessageManager as b6, type PhaseOutput as b7, type PhaseRegistration as b8, type PhaseRunHandler as b9, type ToolMessageContent as bA, type ToolResultBlock as bB, type ToolResultRecord as bC, type ToolStateChanged as bD, type ToolUseBlock as bE, type UserMessage as bF, type WithdrawnUserInput as bG, type PhaseState as ba, type PhaseStatus as bb, type PhaseStatusState as bc, type RunEndEvent as bd, RunInteractionBoundary as be, RunInteractionCancelledError as bf, type RunInteractionDriver as bg, type RunInteractionState as bh, type RunInteractionStatus as bi, type RunStartEvent as bj, type RunStateChanged as bk, type SettingsBadge as bl, type SettingsControl as bm, type SettingsDefinition as bn, type SettingsItem as bo, type SettingsOption as bp, type SettingsSection as bq, type SkillRegistration as br, type ThinkingDelta as bs, type ToolCallContext as bt, type ToolCallDelta as bu, type ToolCallPhase as bv, type ToolCallPresentationInput as bw, type ToolCallPresentationOutput as bx, type ToolInvocationContext as by, type ToolMessage as bz, type LoadResult as c, type AgentConfiguration as d, type HistorySeed as e, type AgentId as f, type AgentDeletionRequest as g, type MessageRevisionResult as h, type RunId as i, type ToolCallId as j, type EventCursor as k, type UserInput as l, type AgentRun as m, type EntryPhaseSpec as n, type AgentListCursor as o, type Page as p, type AgentSummary as q, type RunState as r, type RunListCursor as s, type RunSummary as t, type InvocationCatalogEntry as u, type DurableConsumer as v, type RunSnapshot as w, type Message as x, type RunBoundary as y, type RunEvent as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
2
2
|
export { _rowan_agent_models as models };
|
|
3
3
|
export { AudioBlock, ContentBlock, ImageBlock, JsonObject, JsonPrimitive, JsonValue, ResourceBlock, ResourceLinkBlock, RunInteractionKind, RunInteractionRequest, ScopeRef, StreamBlock, TextBlock, ThinkingBlock, ToolResult } from '@rowan-agent/models';
|
|
4
|
-
export {
|
|
4
|
+
export { aE as AfterToolCall, f as AgentId, o as AgentListCursor, m as AgentRun, q as AgentSummary, aF as AssistantContent, _ as AssistantMessage, aG as BeforeToolCall, W as ContextCandidate, K as ContextCompactionRecord, C as ContextStatus, v as DurableConsumer, D as DurableRunEvent, aH as EventBus, k as EventCursor, aI as EventId, aJ as ExecOptions, aK as ExecResult, aL as ExtensionAPI, aM as ExtensionAgentConsumerDisposer, aN as ExtensionAgentsAPI, aO as ExtensionContext, aP as ExtensionFactory, aQ as ExtensionStateStore, aR as HookEvent, aS as HookEventType, aT as HookHandler, aU as InteractionRecord, aV as InternalModelLoopOptions, aW as LiveInteractionEvent, x as Message, aX as MessageBase, aY as MessageCommitted, aZ as MessageContent, a_ as MessageDelta, M as MessageId, a$ as MessageRevised, h as MessageRevisionResult, b0 as ModelInvokeOutput, p as Page, P as Phase, b1 as PhaseContext, b2 as PhaseExecution, b3 as PhaseExecutionIdentity, b4 as PhaseInput, b5 as PhaseInvocation, b6 as PhaseMessageManager, b7 as PhaseOutput, b8 as PhaseRegistration, b9 as PhaseRunHandler, ba as PhaseState, bb as PhaseStatus, bc as PhaseStatusState, y as RunBoundary, bd as RunEndEvent, z as RunEvent, Y as RunFailure, i as RunId, a0 as RunInteraction, be as RunInteractionBoundary, bf as RunInteractionCancelledError, bg as RunInteractionDriver, bh as RunInteractionState, bi as RunInteractionStatus, s as RunListCursor, w as RunSnapshot, bj as RunStartEvent, r as RunState, bk as RunStateChanged, t as RunSummary, bl as SettingsBadge, bm as SettingsControl, bn as SettingsDefinition, bo as SettingsItem, bp as SettingsOption, bq as SettingsSection, br as SkillRegistration, bs as ThinkingDelta, T as Tool, bt as ToolCallContext, bu as ToolCallDelta, j as ToolCallId, bv as ToolCallPhase, bw as ToolCallPresentationInput, bx as ToolCallPresentationOutput, J as ToolCallSnapshot, by as ToolInvocationContext, bz as ToolMessage, bA as ToolMessageContent, bB as ToolResultBlock, bC as ToolResultRecord, bD as ToolStateChanged, bE as ToolUseBlock, U as UserContent, l as UserInput, bF as UserMessage, bG as WithdrawnUserInput } from './index-OBJCF_CO.js';
|
|
5
5
|
import 'typebox';
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExtensionHost, H as HostApiExtension, A as AgentRuntime$1, a as AgentRuntimeOptions, L as LoadInput, b as AgentDefinition, c as LoadResult, S as Skill, P as Phase, T as Tool, R as ResourceKind, d as AgentConfiguration, e as HistorySeed, f as AgentId, g as AgentDeletionRequest, M as MessageId, U as UserContent, h as MessageRevisionResult, i as RunId, j as ToolCallId, k as EventCursor, C as ContextStatus, l as UserInput, m as AgentRun, n as EntryPhaseSpec, o as AgentListCursor, p as Page, q as AgentSummary, r as RunState, s as RunListCursor, t as RunSummary, I as InvocationSource, u as InvocationCatalogEntry, D as DurableRunEvent, v as DurableConsumer, w as
|
|
2
|
-
export {
|
|
1
|
+
import { E as ExtensionHost, H as HostApiExtension, A as AgentRuntime$1, a as AgentRuntimeOptions, L as LoadInput, b as AgentDefinition, c as LoadResult, S as Skill, P as Phase, T as Tool, R as ResourceKind, d as AgentConfiguration, e as HistorySeed, f as AgentId, g as AgentDeletionRequest, M as MessageId, U as UserContent, h as MessageRevisionResult, i as RunId, j as ToolCallId, k as EventCursor, C as ContextStatus, l as UserInput, m as AgentRun, n as EntryPhaseSpec, o as AgentListCursor, p as Page, q as AgentSummary, r as RunState, s as RunListCursor, t as RunSummary, I as InvocationSource, u as InvocationCatalogEntry, D as DurableRunEvent, v as DurableConsumer, w as RunSnapshot, x as Message, y as RunBoundary, z as RunEvent, B as DurableStore, F as AgentRecord, G as RunRecord, J as ToolCallSnapshot, K as ContextCompactionRecord, O as OwnerLease, N as OwnedStore, Q as ConfigToken, V as ExecutionId, W as ContextCandidate, X as RunClaim, Y as RunFailure, Z as ExecutionToken, _ as AssistantMessage, $ as ExecutionCheckpoint, a0 as RunInteraction, a1 as ToolCommit, a2 as ToolCallReservation, a3 as ToolBatchCommit, a4 as Outcome, a5 as ConsumerRegistration, a6 as RetentionResult, a7 as ConfigProvider, a8 as ConfigurationSnapshot, a9 as ConfigPutResult, aa as ConfigResolution, ab as PhaseRegistry, ac as LoadedExtension } from './index-OBJCF_CO.js';
|
|
2
|
+
export { ad as DefinitionLayer, ae as ExtensionActivationError, af as ExtensionActivationResult, ag as ExtensionContribution, ah as ExtensionLifetimeError, ai as ExtensionLifetimeErrorCode, aj as ExtensionLoadInput, ak as LoadExtensionsResult, al as ModelRetry, am as OpaqueId, an as OwnerToken, ao as PhaseRegistrySelection, ap as ResolvedResourceView, aq as ResourceDiagnostic, ar as ResourceRef, as as ResourceRegistry, at as ResourceRegistryError, au as ResourceRegistryErrorCode, av as ResourceSourceId, aw as ResourceView, ax as RuntimeBootstrapRegistry, ay as RuntimeExtensionLifetime, az as extensionSourceId, aA as isConfigurationSnapshot, aB as mergeToolCall, aC as parseAgentDefinition, aD as resolveConfigurationSnapshot } from './index-OBJCF_CO.js';
|
|
3
3
|
import * as _rowan_agent_models from '@rowan-agent/models';
|
|
4
4
|
import { JsonObject, JsonValue, ScopeRef, ModelRef, LlmTokenUsage, StreamBlock, ToolKind, ToolCallLocation, ToolCallContent, ToolResult, ToolCall, ToolCallUpdate } from '@rowan-agent/models';
|
|
5
5
|
import 'typebox';
|
|
@@ -135,13 +135,6 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
135
135
|
signal: AbortSignal;
|
|
136
136
|
}>): void | Promise<void>;
|
|
137
137
|
}): Promise<DurableConsumer>;
|
|
138
|
-
listCapabilities(): readonly ExtensionCapability[];
|
|
139
|
-
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
140
|
-
triggerUiAction(event: {
|
|
141
|
-
contributionId: string;
|
|
142
|
-
actionId: string;
|
|
143
|
-
scope?: ScopeRef;
|
|
144
|
-
}): void;
|
|
145
138
|
private liveInteract;
|
|
146
139
|
close(): Promise<void>;
|
|
147
140
|
snapshot(runId: RunId): Promise<RunSnapshot>;
|
package/dist/runtime.js
CHANGED
|
@@ -7300,11 +7300,9 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
|
|
|
7300
7300
|
on: (eventType, handler) => {
|
|
7301
7301
|
assertActive();
|
|
7302
7302
|
hooks?.on(eventType, handler);
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
assertActive();
|
|
7307
|
-
hooks?.off(eventType, handler);
|
|
7303
|
+
const unsubscribe = () => hooks?.off(eventType, handler);
|
|
7304
|
+
trackCleanup?.(unsubscribe);
|
|
7305
|
+
return unsubscribe;
|
|
7308
7306
|
}
|
|
7309
7307
|
},
|
|
7310
7308
|
config: {
|
|
@@ -7488,33 +7486,10 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
|
|
|
7488
7486
|
trackCleanup?.(unsubscribe);
|
|
7489
7487
|
return unsubscribe;
|
|
7490
7488
|
},
|
|
7491
|
-
|
|
7492
|
-
emit: (event, ...args) => eventBus.emit(event, ...args),
|
|
7493
|
-
has: (event) => eventBus.has(event),
|
|
7494
|
-
count: (event) => eventBus.count(event)
|
|
7489
|
+
emit: (event, ...args) => eventBus.emit(event, ...args)
|
|
7495
7490
|
} : { on: () => () => {
|
|
7496
|
-
}, off: () => {
|
|
7497
7491
|
}, emit: () => {
|
|
7498
|
-
}
|
|
7499
|
-
capabilities: {
|
|
7500
|
-
contribute: (contribution) => {
|
|
7501
|
-
assertActive();
|
|
7502
|
-
if (!contribution || typeof contribution !== "object") {
|
|
7503
|
-
throw new TypeError("Capability contribution must be an object.");
|
|
7504
|
-
}
|
|
7505
|
-
if (contribution.kind !== "tool") {
|
|
7506
|
-
throw new TypeError(`Unsupported capability contribution kind: "${contribution.kind}".`);
|
|
7507
|
-
}
|
|
7508
|
-
if (typeof contribution.name !== "string" || contribution.name.trim() === "") {
|
|
7509
|
-
throw new TypeError("Capability contribution requires a non-empty name.");
|
|
7510
|
-
}
|
|
7511
|
-
if (typeof contribution.description !== "string") {
|
|
7512
|
-
throw new TypeError("Capability contribution requires a description string.");
|
|
7513
|
-
}
|
|
7514
|
-
return options?.contributeCapability ? options.contributeCapability(contribution) : () => {
|
|
7515
|
-
};
|
|
7516
|
-
}
|
|
7517
|
-
},
|
|
7492
|
+
} },
|
|
7518
7493
|
context: ctx
|
|
7519
7494
|
};
|
|
7520
7495
|
if (options?.namespaces) {
|
|
@@ -7769,20 +7744,6 @@ function createEventBus() {
|
|
|
7769
7744
|
console.error(`[event-bus] Listener error for "${event}":`, err);
|
|
7770
7745
|
}
|
|
7771
7746
|
}
|
|
7772
|
-
},
|
|
7773
|
-
off(event) {
|
|
7774
|
-
if (event) {
|
|
7775
|
-
listeners.delete(event);
|
|
7776
|
-
} else {
|
|
7777
|
-
listeners.clear();
|
|
7778
|
-
}
|
|
7779
|
-
},
|
|
7780
|
-
has(event) {
|
|
7781
|
-
const set = listeners.get(event);
|
|
7782
|
-
return set !== void 0 && set.size > 0;
|
|
7783
|
-
},
|
|
7784
|
-
count(event) {
|
|
7785
|
-
return listeners.get(event)?.size ?? 0;
|
|
7786
7747
|
}
|
|
7787
7748
|
};
|
|
7788
7749
|
}
|
|
@@ -7881,8 +7842,6 @@ var ExtensionRunner = class {
|
|
|
7881
7842
|
bound = false;
|
|
7882
7843
|
// Error listeners
|
|
7883
7844
|
errorListeners = /* @__PURE__ */ new Set();
|
|
7884
|
-
// Capability change listeners
|
|
7885
|
-
capabilityListeners = /* @__PURE__ */ new Set();
|
|
7886
7845
|
// Resource change listeners (for Registry live sync)
|
|
7887
7846
|
resourceChangeListeners = /* @__PURE__ */ new Set();
|
|
7888
7847
|
runtimeAgents;
|
|
@@ -7994,7 +7953,6 @@ var ExtensionRunner = class {
|
|
|
7994
7953
|
tools: /* @__PURE__ */ new Map(),
|
|
7995
7954
|
phases: /* @__PURE__ */ new Set(),
|
|
7996
7955
|
skills: /* @__PURE__ */ new Set(),
|
|
7997
|
-
capabilities: /* @__PURE__ */ new Map(),
|
|
7998
7956
|
cleanup: [],
|
|
7999
7957
|
runtime: createExtensionRuntime(),
|
|
8000
7958
|
hostApi
|
|
@@ -8005,9 +7963,6 @@ var ExtensionRunner = class {
|
|
|
8005
7963
|
if (typeof disposer === "function") extension.disposer = disposer;
|
|
8006
7964
|
this.extensions.push(extension);
|
|
8007
7965
|
this._phaseCache = null;
|
|
8008
|
-
if (extension.capabilities.size > 0) {
|
|
8009
|
-
this.notifyCapabilitiesChanged();
|
|
8010
|
-
}
|
|
8011
7966
|
} catch (error) {
|
|
8012
7967
|
await this.rollbackExtension(extension);
|
|
8013
7968
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -8031,7 +7986,6 @@ var ExtensionRunner = class {
|
|
|
8031
7986
|
tools: /* @__PURE__ */ new Map(),
|
|
8032
7987
|
phases: /* @__PURE__ */ new Set(),
|
|
8033
7988
|
skills: /* @__PURE__ */ new Set(),
|
|
8034
|
-
capabilities: /* @__PURE__ */ new Map(),
|
|
8035
7989
|
cleanup: [],
|
|
8036
7990
|
runtime: createExtensionRuntime(),
|
|
8037
7991
|
hostApi: this.host.extendApi?.(phase.name)
|
|
@@ -8097,7 +8051,6 @@ var ExtensionRunner = class {
|
|
|
8097
8051
|
}
|
|
8098
8052
|
this.extensions.length = 0;
|
|
8099
8053
|
this.activeExtensionPhases.clear();
|
|
8100
|
-
this.capabilityListeners.clear();
|
|
8101
8054
|
this.resourceChangeListeners.clear();
|
|
8102
8055
|
this.phases.clear();
|
|
8103
8056
|
this._phaseCache = null;
|
|
@@ -8174,32 +8127,6 @@ var ExtensionRunner = class {
|
|
|
8174
8127
|
}
|
|
8175
8128
|
return void 0;
|
|
8176
8129
|
}
|
|
8177
|
-
// ---------------------------------------------------------------------------
|
|
8178
|
-
// Capability management
|
|
8179
|
-
// ---------------------------------------------------------------------------
|
|
8180
|
-
/** Get all contributed capabilities across all extensions. */
|
|
8181
|
-
getCapabilities() {
|
|
8182
|
-
const result = [];
|
|
8183
|
-
for (const ext of this.extensions) {
|
|
8184
|
-
for (const contrib of ext.capabilities.values()) {
|
|
8185
|
-
result.push({
|
|
8186
|
-
extensionId: ext.id,
|
|
8187
|
-
kind: contrib.kind,
|
|
8188
|
-
name: contrib.name,
|
|
8189
|
-
description: contrib.description
|
|
8190
|
-
});
|
|
8191
|
-
}
|
|
8192
|
-
}
|
|
8193
|
-
return Object.freeze(result);
|
|
8194
|
-
}
|
|
8195
|
-
/**
|
|
8196
|
-
* Subscribe to capability changes (contributions added, removed, or extensions disposed).
|
|
8197
|
-
* Returns an unsubscribe function.
|
|
8198
|
-
*/
|
|
8199
|
-
onCapabilitiesChanged(listener) {
|
|
8200
|
-
this.capabilityListeners.add(listener);
|
|
8201
|
-
return () => this.capabilityListeners.delete(listener);
|
|
8202
|
-
}
|
|
8203
8130
|
/**
|
|
8204
8131
|
* Subscribe to resource changes (tools, phases, skills registered, unregistered, or disposed).
|
|
8205
8132
|
* Used by RuntimeBootstrapRegistry to re-commit implicit sources after activation.
|
|
@@ -8214,9 +8141,6 @@ var ExtensionRunner = class {
|
|
|
8214
8141
|
await listener(kind);
|
|
8215
8142
|
}
|
|
8216
8143
|
}
|
|
8217
|
-
triggerUiAction(event) {
|
|
8218
|
-
this.events.emit("ui.action", event);
|
|
8219
|
-
}
|
|
8220
8144
|
// ---------------------------------------------------------------------------
|
|
8221
8145
|
// Phase management
|
|
8222
8146
|
// ---------------------------------------------------------------------------
|
|
@@ -8412,7 +8336,6 @@ var ExtensionRunner = class {
|
|
|
8412
8336
|
unregisterProvider: (name) => this.unregisterProvider(name),
|
|
8413
8337
|
registerTool: (tool, scope) => this.registerTool(extension, tool, scope),
|
|
8414
8338
|
unregisterTool: (toolName, scope) => this.unregisterTool(extension, toolName, scope),
|
|
8415
|
-
contributeCapability: (contribution) => this.contributeCapability(extension, contribution),
|
|
8416
8339
|
context: extContext,
|
|
8417
8340
|
namespaces,
|
|
8418
8341
|
runtimeAgents: this.runtimeAgents,
|
|
@@ -8493,46 +8416,6 @@ var ExtensionRunner = class {
|
|
|
8493
8416
|
if (!extension.tools.delete(regKey)) return Promise.resolve();
|
|
8494
8417
|
return this.notifyResourceChange("tool");
|
|
8495
8418
|
}
|
|
8496
|
-
contributeCapability(extension, contribution) {
|
|
8497
|
-
const key = `${contribution.kind}:${contribution.name}`;
|
|
8498
|
-
const entry = {
|
|
8499
|
-
kind: contribution.kind,
|
|
8500
|
-
name: contribution.name,
|
|
8501
|
-
description: contribution.description
|
|
8502
|
-
};
|
|
8503
|
-
extension.capabilities.set(key, entry);
|
|
8504
|
-
if (this.extensions.includes(extension)) {
|
|
8505
|
-
this.notifyCapabilitiesChanged();
|
|
8506
|
-
}
|
|
8507
|
-
let disposed = false;
|
|
8508
|
-
const dispose = () => {
|
|
8509
|
-
if (disposed) return;
|
|
8510
|
-
disposed = true;
|
|
8511
|
-
if (extension.capabilities.get(key) === entry) {
|
|
8512
|
-
extension.capabilities.delete(key);
|
|
8513
|
-
if (this.extensions.includes(extension)) {
|
|
8514
|
-
this.notifyCapabilitiesChanged();
|
|
8515
|
-
}
|
|
8516
|
-
}
|
|
8517
|
-
};
|
|
8518
|
-
extension.cleanup.push(dispose);
|
|
8519
|
-
return dispose;
|
|
8520
|
-
}
|
|
8521
|
-
notifyCapabilitiesChanged() {
|
|
8522
|
-
const capabilities = this.getCapabilities();
|
|
8523
|
-
for (const listener of this.capabilityListeners) {
|
|
8524
|
-
try {
|
|
8525
|
-
listener(capabilities);
|
|
8526
|
-
} catch (error) {
|
|
8527
|
-
this.emitError({
|
|
8528
|
-
extensionPath: "<runtime>",
|
|
8529
|
-
event: "capabilities_changed",
|
|
8530
|
-
error: error instanceof Error ? error.message : String(error),
|
|
8531
|
-
stack: error instanceof Error ? error.stack : void 0
|
|
8532
|
-
});
|
|
8533
|
-
}
|
|
8534
|
-
}
|
|
8535
|
-
}
|
|
8536
8419
|
async registerPhase(extension, registration, scope) {
|
|
8537
8420
|
if (typeof registration === "string") {
|
|
8538
8421
|
if (registration.length === 0) {
|
|
@@ -8681,8 +8564,6 @@ var ExtensionRunner = class {
|
|
|
8681
8564
|
}
|
|
8682
8565
|
}
|
|
8683
8566
|
extension.skills.clear();
|
|
8684
|
-
const hadCapabilities = extension.capabilities.size > 0;
|
|
8685
|
-
extension.capabilities.clear();
|
|
8686
8567
|
for (const cleanup of [...extension.cleanup].reverse()) {
|
|
8687
8568
|
await Promise.resolve().then(() => cleanup()).catch(() => void 0);
|
|
8688
8569
|
}
|
|
@@ -8695,9 +8576,6 @@ var ExtensionRunner = class {
|
|
|
8695
8576
|
await Promise.resolve().then(() => hostDispose()).catch(() => void 0);
|
|
8696
8577
|
}
|
|
8697
8578
|
this._phaseCache = null;
|
|
8698
|
-
if (hadCapabilities) {
|
|
8699
|
-
this.notifyCapabilitiesChanged();
|
|
8700
|
-
}
|
|
8701
8579
|
if (this.bound) {
|
|
8702
8580
|
if (hadTools) await this.notifyResourceChange("tool");
|
|
8703
8581
|
if (hadPhases) await this.notifyResourceChange("phase");
|
|
@@ -9864,18 +9742,6 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
9864
9742
|
});
|
|
9865
9743
|
return { caughtUp: subscription.caughtUp.promise, done: subscription.done.promise, stop: () => controller.abort() };
|
|
9866
9744
|
}
|
|
9867
|
-
listCapabilities() {
|
|
9868
|
-
this.assertOpen();
|
|
9869
|
-
return this.resources.extensionRunner.getCapabilities();
|
|
9870
|
-
}
|
|
9871
|
-
onCapabilitiesChanged(listener) {
|
|
9872
|
-
this.assertOpen();
|
|
9873
|
-
return this.resources.extensionRunner.onCapabilitiesChanged(listener);
|
|
9874
|
-
}
|
|
9875
|
-
triggerUiAction(event) {
|
|
9876
|
-
this.assertOpen();
|
|
9877
|
-
this.resources.extensionRunner.triggerUiAction(event);
|
|
9878
|
-
}
|
|
9879
9745
|
liveInteract(runId, request, signal) {
|
|
9880
9746
|
if (signal.aborted) {
|
|
9881
9747
|
return Promise.reject(signal.reason ?? new Error("Run aborted"));
|