@rowan-agent/agent 0.21.0 → 0.22.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.d.ts +13 -26
- package/dist/index.js +24 -99
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -289,10 +289,12 @@ declare class InMemoryExtensionHost implements ExtensionHost {
|
|
|
289
289
|
private readonly agentState;
|
|
290
290
|
private readonly globalState;
|
|
291
291
|
private readonly listeners;
|
|
292
|
+
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
292
293
|
constructor(options?: {
|
|
293
294
|
configs?: Record<string, Record<string, JsonObject>>;
|
|
294
295
|
agentState?: Record<string, Record<string, Record<string, JsonValue>>>;
|
|
295
296
|
globalState?: Record<string, Record<string, JsonValue>>;
|
|
297
|
+
extendApi?: (extensionId: string) => HostApiExtension | undefined;
|
|
296
298
|
});
|
|
297
299
|
setConfig(extensionId: string, config: JsonObject | null, scope?: ScopeRef): void;
|
|
298
300
|
getConfig(extensionId: string, scope?: ScopeRef): JsonObject | null;
|
|
@@ -370,7 +372,6 @@ declare class ExtensionRunner {
|
|
|
370
372
|
private bound;
|
|
371
373
|
private readonly errorListeners;
|
|
372
374
|
private readonly capabilityListeners;
|
|
373
|
-
private readonly hostContributionListeners;
|
|
374
375
|
/** Current agent context — set by the agent before each phase */
|
|
375
376
|
currentContext?: AgentContext;
|
|
376
377
|
constructor(options?: ExtensionRunnerOptions);
|
|
@@ -436,13 +437,6 @@ declare class ExtensionRunner {
|
|
|
436
437
|
* Returns an unsubscribe function.
|
|
437
438
|
*/
|
|
438
439
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
439
|
-
/** Get all contributed host elements across all extensions. */
|
|
440
|
-
getHostContributions(): readonly HostContribution[];
|
|
441
|
-
/**
|
|
442
|
-
* Subscribe to host contribution changes (contributions added, removed, or extensions disposed).
|
|
443
|
-
* Returns an unsubscribe function.
|
|
444
|
-
*/
|
|
445
|
-
onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
|
|
446
440
|
triggerUiAction(event: {
|
|
447
441
|
contributionId: string;
|
|
448
442
|
actionId: string;
|
|
@@ -517,8 +511,6 @@ declare class ExtensionRunner {
|
|
|
517
511
|
private unregisterTool;
|
|
518
512
|
private contributeCapability;
|
|
519
513
|
private notifyCapabilitiesChanged;
|
|
520
|
-
private contributeToHost;
|
|
521
|
-
private notifyHostContributionsChanged;
|
|
522
514
|
private registerPhase;
|
|
523
515
|
private registerPhaseDefinition;
|
|
524
516
|
private unregisterPhase;
|
|
@@ -1276,8 +1268,6 @@ interface AgentRuntime$1 {
|
|
|
1276
1268
|
}): Promise<DurableConsumer>;
|
|
1277
1269
|
listCapabilities(): readonly ExtensionCapability[];
|
|
1278
1270
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
1279
|
-
listHostContributions(): readonly HostContribution[];
|
|
1280
|
-
onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
|
|
1281
1271
|
triggerUiAction(event: {
|
|
1282
1272
|
contributionId: string;
|
|
1283
1273
|
actionId: string;
|
|
@@ -1290,12 +1280,6 @@ type ConsumerRegistration = Readonly<{
|
|
|
1290
1280
|
waterline: EventCursor;
|
|
1291
1281
|
}>;
|
|
1292
1282
|
|
|
1293
|
-
type HostContribution = {
|
|
1294
|
-
readonly kind: string;
|
|
1295
|
-
readonly id: string;
|
|
1296
|
-
} & {
|
|
1297
|
-
readonly [key: string]: JsonValue;
|
|
1298
|
-
};
|
|
1299
1283
|
interface ExtensionStateStore {
|
|
1300
1284
|
get(key: string): Promise<JsonValue | undefined>;
|
|
1301
1285
|
set(key: string, value: JsonValue): Promise<void>;
|
|
@@ -1310,6 +1294,16 @@ interface ExtensionHost {
|
|
|
1310
1294
|
getGlobalState(extensionId: string, key: string): Promise<JsonValue | undefined> | JsonValue | undefined;
|
|
1311
1295
|
setGlobalState(extensionId: string, key: string, value: JsonValue): Promise<void> | void;
|
|
1312
1296
|
deleteGlobalState(extensionId: string, key: string): Promise<void> | void;
|
|
1297
|
+
/**
|
|
1298
|
+
* Called once per extension load. The returned namespaces are merged into that extension's `api`
|
|
1299
|
+
* (a name already used by Rowan's own API is an error). `dispose` runs when the extension is
|
|
1300
|
+
* unloaded, reloaded or fails activation, so the host can drop everything that extension registered.
|
|
1301
|
+
*/
|
|
1302
|
+
extendApi?(extensionId: string): HostApiExtension | undefined;
|
|
1303
|
+
}
|
|
1304
|
+
interface HostApiExtension {
|
|
1305
|
+
readonly namespaces: Readonly<Record<string, unknown>>;
|
|
1306
|
+
dispose?(): void;
|
|
1313
1307
|
}
|
|
1314
1308
|
type ExtensionToolContribution = {
|
|
1315
1309
|
kind: "tool";
|
|
@@ -1538,11 +1532,6 @@ interface ExtensionAPI {
|
|
|
1538
1532
|
/** Get the message set by setMessage */
|
|
1539
1533
|
getMessage(): string | undefined;
|
|
1540
1534
|
};
|
|
1541
|
-
/** Declarative host contributions. */
|
|
1542
|
-
host: {
|
|
1543
|
-
/** Contribute a declarative declaration to the host. Returns a disposer to remove the contribution. */
|
|
1544
|
-
contribute<T extends HostContribution>(contribution: T): () => void;
|
|
1545
|
-
};
|
|
1546
1535
|
/** Extension manifest from package.json `rowan` field. */
|
|
1547
1536
|
manifest?: ExtensionManifest;
|
|
1548
1537
|
/** Utility functions. */
|
|
@@ -2524,8 +2513,6 @@ declare class AgentRuntime implements AgentRuntime$1 {
|
|
|
2524
2513
|
}): Promise<DurableConsumer>;
|
|
2525
2514
|
listCapabilities(): readonly ExtensionCapability[];
|
|
2526
2515
|
onCapabilitiesChanged(listener: (capabilities: readonly ExtensionCapability[]) => void): () => void;
|
|
2527
|
-
listHostContributions(): readonly HostContribution[];
|
|
2528
|
-
onHostContributionsChanged(listener: (contributions: readonly HostContribution[]) => void): () => void;
|
|
2529
2516
|
triggerUiAction(event: {
|
|
2530
2517
|
contributionId: string;
|
|
2531
2518
|
actionId: string;
|
|
@@ -3344,4 +3331,4 @@ declare function parseFrontmatter<T = Record<string, unknown>>(raw: string): Fro
|
|
|
3344
3331
|
|
|
3345
3332
|
declare function createCoreTools(input?: CoreToolContext): Tool$1[];
|
|
3346
3333
|
|
|
3347
|
-
export { type AfterToolCall, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, COMPACT_PHASE_ID, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type ContextCompactionRecord, type ContextStatus, type CoreToolContext, DEFAULT_PHASE_ID, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EntryPhaseSpec, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionCapability, type ExtensionCapabilityContribution, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionHost, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type ExtensionStateStore, type ExtensionToolContribution, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, type
|
|
3334
|
+
export { type AfterToolCall, type AgentConfiguration, type AgentDefinition, type AgentId, type AgentListCursor, type AgentRecord, type AgentRun, AgentRuntime, type AgentRuntimeOptions, type AgentSummary, type AnyRuntimeError, type AssistantContent, type AssistantMessage, type BeforeToolCall, COMPACT_PHASE_ID, type ConfigProvider, type ConfigPutResult, type ConfigResolution, type ConfigToken, type ConfigurationSnapshot, type ContextCandidate, type ContextCompactionRecord, type ContextStatus, type CoreToolContext, DEFAULT_PHASE_ID, type DefinitionLayer, type DurableConsumer, type DurableRunEvent, type DurableStore, type DurableToolResult, type EntryPhaseSpec, type EventCursor, type EventId, type ExecutionCheckpoint, type ExecutionId, type ExecutionToken, type ExtensionAPI, type ExtensionActivationError, type ExtensionActivationResult, type ExtensionCapability, type ExtensionCapabilityContribution, type ExtensionContribution, type ExtensionDisposer, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionHost, ExtensionLifetimeError, type ExtensionLifetimeErrorCode, type ExtensionLoadInput, type ExtensionStateStore, type ExtensionToolContribution, type FrontmatterResult, type HistorySeed, type HookEvent, type HookEventType, type HookHandler, type HostApiExtension, InMemoryConfigProvider, InMemoryExtensionHost, InMemoryStore, type InteractionRecord, type InvocationCatalogEntry, type InvocationSource, type JsonObject, type JsonPrimitive, type JsonValue, type LiveInteractionEvent, type LoadExtensionsResult, type LoadInput, type LoadResult, type LoadedExtension, type Message, type MessageBase, type MessageCommitted, type MessageContent, type MessageDelta, type MessageId, type MessageRevised, type MessageRevisionResult, type Metadata, type ModelRetry, type OpaqueId, type Outcome$1 as Outcome, type OwnerLease, type OwnerToken, type Page, type Phase, type PhaseContext, type PhaseContribution, type PhaseExecution, type PhaseExecutionIdentity, type PhaseInput, type PhaseInvocation, type PhaseMessageManager, type PhaseOutput, type PhaseRegistry, type PhaseRegistrySelection, type PhaseState, type PhaseStatus, type PhaseStatusState, type ResolvedResourceView, type ResourceDiagnostic, type ResourceKind, type ResourceRef, ResourceRegistry, ResourceRegistryError, type ResourceRegistryErrorCode, type ResourceSourceId, type ResourceView, type RetentionResult, type RunBoundary, type RunClaim, type RunEndEvent, type RunEvent, type RunFailure, type RunId, type RunInteraction, RunInteractionBoundary, RunInteractionCancelledError, type RunInteractionDriver, type RunInteractionKind, type RunInteractionRequest, type RunInteractionState, type RunInteractionStatus, type RunListCursor, type RunRecord, type RunSnapshot, type RunStartEvent, type RunState, type RunStateChanged, type RunSummary, RuntimeBootstrapRegistry, RuntimeError, type RuntimeErrorCode, type RuntimeErrorDetails, RuntimeExtensionLifetime, STOP_PHASE_ID, type SettingsBadge, type SettingsControl, type SettingsDefinition, type SettingsItem, type SettingsOption, type SettingsSection, type Skill, SqliteStore, type TextContent, type ThinkingContent, type ThinkingDelta, type Tool$1 as Tool, type ToolCallContext, type ToolCallDelta, type ToolCallId, type ToolCallPresentationInput, type ToolCallPresentationOutput, type ToolCallSnapshot, type ToolCallState, type ToolContribution, type ToolDefinition, type ToolExecutionResult, type ToolInvocationContext, type ToolMessage, type ToolMessageContent, type ToolResultContent, type ToolStateChanged, type ToolUseContent, type UserContent, type UserInput, type UserMessage, type WithdrawnUserInput, brandConfigToken, createCompactPhase, createCorePhases, createCoreTools, createDefaultPhase, createStopPhase, isConfigurationSnapshot, isRuntimeError, loadExtensionsFromPath as loadExtensions, loadPhase, loadPhases, loadSkill, loadSkills, mergeToolCall, parseAgentDefinition, parseFrontmatter, resolveConfigurationSnapshot };
|
package/dist/index.js
CHANGED
|
@@ -1620,7 +1620,7 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
|
|
|
1620
1620
|
let outputPayload = phaseIn?.state?.payload;
|
|
1621
1621
|
let nextPhase;
|
|
1622
1622
|
let outputMessage;
|
|
1623
|
-
|
|
1623
|
+
const api = {
|
|
1624
1624
|
hooks: {
|
|
1625
1625
|
on: (eventType, handler) => {
|
|
1626
1626
|
assertActive();
|
|
@@ -1783,27 +1783,17 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
|
|
|
1783
1783
|
},
|
|
1784
1784
|
getNextPhase: () => nextPhase,
|
|
1785
1785
|
getMessage: () => outputMessage
|
|
1786
|
-
},
|
|
1787
|
-
host: {
|
|
1788
|
-
contribute: (contribution) => {
|
|
1789
|
-
assertActive();
|
|
1790
|
-
if (!contribution || typeof contribution !== "object" || Array.isArray(contribution)) {
|
|
1791
|
-
throw new TypeError("Host contribution must be an object.");
|
|
1792
|
-
}
|
|
1793
|
-
if (typeof contribution.kind !== "string" || contribution.kind.trim() === "") {
|
|
1794
|
-
throw new TypeError("Host contribution requires a non-empty kind.");
|
|
1795
|
-
}
|
|
1796
|
-
if (typeof contribution.id !== "string" || contribution.id.trim() === "") {
|
|
1797
|
-
throw new TypeError("Host contribution requires a non-empty id.");
|
|
1798
|
-
}
|
|
1799
|
-
assertJsonValue(contribution, "Host contribution");
|
|
1800
|
-
const dispose = options?.contributeToHost ? options.contributeToHost(contribution) : () => {
|
|
1801
|
-
};
|
|
1802
|
-
trackCleanup?.(dispose);
|
|
1803
|
-
return dispose;
|
|
1804
|
-
}
|
|
1805
1786
|
}
|
|
1806
1787
|
};
|
|
1788
|
+
if (options?.namespaces) {
|
|
1789
|
+
for (const [key, value] of Object.entries(options.namespaces)) {
|
|
1790
|
+
if (key in api) {
|
|
1791
|
+
throw new Error(`Host API namespace collision: "${key}" is a built-in API key.`);
|
|
1792
|
+
}
|
|
1793
|
+
Object.defineProperty(api, key, { value, enumerable: true });
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return api;
|
|
1807
1797
|
}
|
|
1808
1798
|
|
|
1809
1799
|
// src/harness/phases/interactions.ts
|
|
@@ -5836,6 +5826,9 @@ var InMemoryExtensionHost = class {
|
|
|
5836
5826
|
globalState = /* @__PURE__ */ new Map();
|
|
5837
5827
|
listeners = /* @__PURE__ */ new Set();
|
|
5838
5828
|
constructor(options = {}) {
|
|
5829
|
+
if (options.extendApi) {
|
|
5830
|
+
this.extendApi = options.extendApi;
|
|
5831
|
+
}
|
|
5839
5832
|
if (options.configs) {
|
|
5840
5833
|
for (const [scopeKey, extMap] of Object.entries(options.configs)) {
|
|
5841
5834
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -6121,8 +6114,6 @@ var ExtensionRunner = class {
|
|
|
6121
6114
|
errorListeners = /* @__PURE__ */ new Set();
|
|
6122
6115
|
// Capability change listeners
|
|
6123
6116
|
capabilityListeners = /* @__PURE__ */ new Set();
|
|
6124
|
-
// Host contribution change listeners
|
|
6125
|
-
hostContributionListeners = /* @__PURE__ */ new Set();
|
|
6126
6117
|
/** Current agent context — set by the agent before each phase */
|
|
6127
6118
|
currentContext;
|
|
6128
6119
|
constructor(options) {
|
|
@@ -6220,18 +6211,19 @@ var ExtensionRunner = class {
|
|
|
6220
6211
|
async loadExtensions(extensions) {
|
|
6221
6212
|
for (const ext of extensions) {
|
|
6222
6213
|
const extensionId = ext.id ?? ext.manifest?.id ?? ext.name;
|
|
6214
|
+
const hostApi = this.host.extendApi?.(extensionId);
|
|
6223
6215
|
const extension = {
|
|
6224
6216
|
id: extensionId,
|
|
6225
6217
|
path: ext.path,
|
|
6226
6218
|
tools: /* @__PURE__ */ new Map(),
|
|
6227
6219
|
phases: /* @__PURE__ */ new Set(),
|
|
6228
6220
|
capabilities: /* @__PURE__ */ new Map(),
|
|
6229
|
-
hostContributions: /* @__PURE__ */ new Map(),
|
|
6230
6221
|
cleanup: [],
|
|
6231
|
-
runtime: createExtensionRuntime()
|
|
6222
|
+
runtime: createExtensionRuntime(),
|
|
6223
|
+
hostApi
|
|
6232
6224
|
};
|
|
6233
6225
|
try {
|
|
6234
|
-
const api = this.createExtensionAPI(extension, ext.manifest);
|
|
6226
|
+
const api = this.createExtensionAPI(extension, ext.manifest, hostApi?.namespaces);
|
|
6235
6227
|
const disposer = await ext.factory(api);
|
|
6236
6228
|
if (typeof disposer === "function") extension.disposer = disposer;
|
|
6237
6229
|
this.extensions.push(extension);
|
|
@@ -6239,9 +6231,6 @@ var ExtensionRunner = class {
|
|
|
6239
6231
|
if (extension.capabilities.size > 0) {
|
|
6240
6232
|
this.notifyCapabilitiesChanged();
|
|
6241
6233
|
}
|
|
6242
|
-
if (extension.hostContributions.size > 0) {
|
|
6243
|
-
this.notifyHostContributionsChanged();
|
|
6244
|
-
}
|
|
6245
6234
|
} catch (error) {
|
|
6246
6235
|
await this.rollbackExtension(extension);
|
|
6247
6236
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -6370,24 +6359,6 @@ var ExtensionRunner = class {
|
|
|
6370
6359
|
this.capabilityListeners.add(listener);
|
|
6371
6360
|
return () => this.capabilityListeners.delete(listener);
|
|
6372
6361
|
}
|
|
6373
|
-
/** Get all contributed host elements across all extensions. */
|
|
6374
|
-
getHostContributions() {
|
|
6375
|
-
const result = [];
|
|
6376
|
-
for (const ext of this.extensions) {
|
|
6377
|
-
for (const contrib of ext.hostContributions.values()) {
|
|
6378
|
-
result.push(contrib);
|
|
6379
|
-
}
|
|
6380
|
-
}
|
|
6381
|
-
return Object.freeze(result);
|
|
6382
|
-
}
|
|
6383
|
-
/**
|
|
6384
|
-
* Subscribe to host contribution changes (contributions added, removed, or extensions disposed).
|
|
6385
|
-
* Returns an unsubscribe function.
|
|
6386
|
-
*/
|
|
6387
|
-
onHostContributionsChanged(listener) {
|
|
6388
|
-
this.hostContributionListeners.add(listener);
|
|
6389
|
-
return () => this.hostContributionListeners.delete(listener);
|
|
6390
|
-
}
|
|
6391
6362
|
triggerUiAction(event) {
|
|
6392
6363
|
this.events.emit("ui.action", event);
|
|
6393
6364
|
}
|
|
@@ -6548,7 +6519,7 @@ var ExtensionRunner = class {
|
|
|
6548
6519
|
* Registration methods write to the extension tracking object.
|
|
6549
6520
|
* Action methods delegate to the shared runtime.
|
|
6550
6521
|
*/
|
|
6551
|
-
createExtensionAPI(extension, manifest) {
|
|
6522
|
+
createExtensionAPI(extension, manifest, namespaces) {
|
|
6552
6523
|
const runner = this;
|
|
6553
6524
|
const extContext = {
|
|
6554
6525
|
get cwd() {
|
|
@@ -6605,9 +6576,9 @@ var ExtensionRunner = class {
|
|
|
6605
6576
|
registerTool: (tool) => this.registerTool(extension, tool),
|
|
6606
6577
|
unregisterTool: (toolName) => this.unregisterTool(extension, toolName),
|
|
6607
6578
|
contributeCapability: (contribution) => this.contributeCapability(extension, contribution),
|
|
6608
|
-
contributeToHost: (contribution) => this.contributeToHost(extension, contribution),
|
|
6609
6579
|
context: extContext,
|
|
6610
6580
|
manifest,
|
|
6581
|
+
namespaces,
|
|
6611
6582
|
trackCleanup: (cleanup) => extension.cleanup.push(cleanup),
|
|
6612
6583
|
config: {
|
|
6613
6584
|
get: async (scope) => {
|
|
@@ -6715,44 +6686,6 @@ var ExtensionRunner = class {
|
|
|
6715
6686
|
}
|
|
6716
6687
|
}
|
|
6717
6688
|
}
|
|
6718
|
-
contributeToHost(extension, contribution) {
|
|
6719
|
-
const key = `${contribution.kind}:${contribution.id}`;
|
|
6720
|
-
const entry = {
|
|
6721
|
-
...contribution
|
|
6722
|
-
};
|
|
6723
|
-
extension.hostContributions.set(key, entry);
|
|
6724
|
-
if (this.extensions.includes(extension)) {
|
|
6725
|
-
this.notifyHostContributionsChanged();
|
|
6726
|
-
}
|
|
6727
|
-
let disposed = false;
|
|
6728
|
-
const dispose = () => {
|
|
6729
|
-
if (disposed) return;
|
|
6730
|
-
disposed = true;
|
|
6731
|
-
if (extension.hostContributions.get(key) === entry) {
|
|
6732
|
-
extension.hostContributions.delete(key);
|
|
6733
|
-
if (this.extensions.includes(extension)) {
|
|
6734
|
-
this.notifyHostContributionsChanged();
|
|
6735
|
-
}
|
|
6736
|
-
}
|
|
6737
|
-
};
|
|
6738
|
-
extension.cleanup.push(dispose);
|
|
6739
|
-
return dispose;
|
|
6740
|
-
}
|
|
6741
|
-
notifyHostContributionsChanged() {
|
|
6742
|
-
const contributions = this.getHostContributions();
|
|
6743
|
-
for (const listener of this.hostContributionListeners) {
|
|
6744
|
-
try {
|
|
6745
|
-
listener(contributions);
|
|
6746
|
-
} catch (error) {
|
|
6747
|
-
this.emitError({
|
|
6748
|
-
extensionPath: "<runtime>",
|
|
6749
|
-
event: "host_contributions_changed",
|
|
6750
|
-
error: error instanceof Error ? error.message : String(error),
|
|
6751
|
-
stack: error instanceof Error ? error.stack : void 0
|
|
6752
|
-
});
|
|
6753
|
-
}
|
|
6754
|
-
}
|
|
6755
|
-
}
|
|
6756
6689
|
async registerPhase(extension, registration) {
|
|
6757
6690
|
if (typeof registration === "string") {
|
|
6758
6691
|
if (registration.length === 0) {
|
|
@@ -6841,21 +6774,21 @@ var ExtensionRunner = class {
|
|
|
6841
6774
|
for (const name of extension.phases) this.phases.delete(name);
|
|
6842
6775
|
const hadCapabilities = extension.capabilities.size > 0;
|
|
6843
6776
|
extension.capabilities.clear();
|
|
6844
|
-
const hadHostContributions = extension.hostContributions.size > 0;
|
|
6845
|
-
extension.hostContributions.clear();
|
|
6846
6777
|
for (const cleanup of [...extension.cleanup].reverse()) {
|
|
6847
6778
|
await Promise.resolve().then(() => cleanup()).catch(() => void 0);
|
|
6848
6779
|
}
|
|
6849
6780
|
if (extension.disposer) {
|
|
6850
6781
|
await Promise.resolve().then(() => extension.disposer()).catch(() => void 0);
|
|
6851
6782
|
}
|
|
6783
|
+
if (extension.hostApi?.dispose) {
|
|
6784
|
+
const hostDispose = extension.hostApi.dispose;
|
|
6785
|
+
extension.hostApi = { ...extension.hostApi, dispose: void 0 };
|
|
6786
|
+
await Promise.resolve().then(() => hostDispose()).catch(() => void 0);
|
|
6787
|
+
}
|
|
6852
6788
|
this._phaseCache = null;
|
|
6853
6789
|
if (hadCapabilities) {
|
|
6854
6790
|
this.notifyCapabilitiesChanged();
|
|
6855
6791
|
}
|
|
6856
|
-
if (hadHostContributions) {
|
|
6857
|
-
this.notifyHostContributionsChanged();
|
|
6858
|
-
}
|
|
6859
6792
|
}
|
|
6860
6793
|
};
|
|
6861
6794
|
function createExtensionRunner(options) {
|
|
@@ -7978,14 +7911,6 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
7978
7911
|
this.assertOpen();
|
|
7979
7912
|
return this.resources.extensionRunner.onCapabilitiesChanged(listener);
|
|
7980
7913
|
}
|
|
7981
|
-
listHostContributions() {
|
|
7982
|
-
this.assertOpen();
|
|
7983
|
-
return this.resources.extensionRunner.getHostContributions();
|
|
7984
|
-
}
|
|
7985
|
-
onHostContributionsChanged(listener) {
|
|
7986
|
-
this.assertOpen();
|
|
7987
|
-
return this.resources.extensionRunner.onHostContributionsChanged(listener);
|
|
7988
|
-
}
|
|
7989
7914
|
triggerUiAction(event) {
|
|
7990
7915
|
this.assertOpen();
|
|
7991
7916
|
this.resources.extensionRunner.triggerUiAction(event);
|