@rowan-agent/agent 0.9.20 → 0.9.22
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 +20 -8
- package/dist/index.js +58 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -596,12 +596,14 @@ interface SourceInfo {
|
|
|
596
596
|
baseDir?: string;
|
|
597
597
|
displayName?: string;
|
|
598
598
|
}
|
|
599
|
+
/** Register a Phase by directory path or Phase object; PHASE.md and direct child Skills are loaded atomically when a path is supplied. */
|
|
600
|
+
type PhaseRegistration = string | Phase;
|
|
599
601
|
/**
|
|
600
|
-
* Tool definition for registering LLM-callable tools via `api.
|
|
602
|
+
* Tool definition for registering LLM-callable tools via `api.tool.register()`.
|
|
601
603
|
*
|
|
602
604
|
* @example
|
|
603
605
|
* ```typescript
|
|
604
|
-
* api.
|
|
606
|
+
* api.tool.register({
|
|
605
607
|
* name: "search_docs",
|
|
606
608
|
* description: "Search documentation",
|
|
607
609
|
* parameters: { type: "object", properties: { query: { type: "string" } } },
|
|
@@ -854,10 +856,13 @@ interface ExtensionAPI {
|
|
|
854
856
|
on<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
855
857
|
/** Unsubscribe from a hook event. */
|
|
856
858
|
off<K extends HookEventType>(eventType: K, handler: HookHandler<K>): void;
|
|
857
|
-
/**
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
859
|
+
/** Tool capabilities — register and unregister custom tools. */
|
|
860
|
+
tool: {
|
|
861
|
+
/** Register a custom LLM-callable tool. */
|
|
862
|
+
register(tool: ToolDefinition): void;
|
|
863
|
+
/** Unregister a previously registered tool by name. */
|
|
864
|
+
unregister(toolName: string): void;
|
|
865
|
+
};
|
|
861
866
|
/** Register a model provider. */
|
|
862
867
|
registerProvider(config: _rowan_agent_models.ProviderConfig): void;
|
|
863
868
|
/** Unregister a model provider. */
|
|
@@ -870,8 +875,12 @@ interface ExtensionAPI {
|
|
|
870
875
|
context: ExtensionContext;
|
|
871
876
|
/** Shared event bus for inter-extension communication. */
|
|
872
877
|
events: EventBus;
|
|
873
|
-
/** Phase execution capabilities —
|
|
878
|
+
/** Phase execution capabilities — provides Phase In/Out, phase identity, phase routing, and registration. */
|
|
874
879
|
phase: {
|
|
880
|
+
/** Register a Phase directory bundle or Phase object. */
|
|
881
|
+
register(phase: PhaseRegistration): Promise<void>;
|
|
882
|
+
/** Unregister a previously registered phase by name. */
|
|
883
|
+
unregister(phaseName: string): void;
|
|
875
884
|
/** Phase In: get payload from previous phase */
|
|
876
885
|
getPayload(): unknown;
|
|
877
886
|
/** Phase Out: set payload for next phase */
|
|
@@ -1409,7 +1418,10 @@ declare class ExtensionRunner {
|
|
|
1409
1418
|
*/
|
|
1410
1419
|
private createExtensionAPI;
|
|
1411
1420
|
private registerTool;
|
|
1421
|
+
private unregisterTool;
|
|
1412
1422
|
private registerPhase;
|
|
1423
|
+
private registerPhaseDefinition;
|
|
1424
|
+
private unregisterPhase;
|
|
1413
1425
|
private loadRegisteredPhase;
|
|
1414
1426
|
private registerProvider;
|
|
1415
1427
|
private unregisterProvider;
|
|
@@ -1637,7 +1649,7 @@ type AgentRecord = Readonly<{
|
|
|
1637
1649
|
type AgentDeletionRequest = Readonly<{
|
|
1638
1650
|
agentId: AgentId;
|
|
1639
1651
|
expectedRunIds: readonly RunId[];
|
|
1640
|
-
confirmation: "
|
|
1652
|
+
confirmation: "agent-delete-v1";
|
|
1641
1653
|
}>;
|
|
1642
1654
|
type ExecutionToken = Readonly<{
|
|
1643
1655
|
runId: RunId;
|
package/dist/index.js
CHANGED
|
@@ -1208,13 +1208,15 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
|
|
|
1208
1208
|
assertActive();
|
|
1209
1209
|
hooks?.off(eventType, handler);
|
|
1210
1210
|
},
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1211
|
+
tool: {
|
|
1212
|
+
register: (tool) => {
|
|
1213
|
+
assertActive();
|
|
1214
|
+
options?.registerTool?.(tool);
|
|
1215
|
+
},
|
|
1216
|
+
unregister: (toolName) => {
|
|
1217
|
+
assertActive();
|
|
1218
|
+
options?.unregisterTool?.(toolName);
|
|
1219
|
+
}
|
|
1218
1220
|
},
|
|
1219
1221
|
registerProvider: (config) => {
|
|
1220
1222
|
assertActive();
|
|
@@ -1246,6 +1248,14 @@ function createExtensionAPI(hooks, options, runtime, eventBus) {
|
|
|
1246
1248
|
}, emit: () => {
|
|
1247
1249
|
}, has: () => false, count: () => 0 },
|
|
1248
1250
|
phase: {
|
|
1251
|
+
register: async (registration) => {
|
|
1252
|
+
assertActive();
|
|
1253
|
+
await options?.registerPhase?.(registration);
|
|
1254
|
+
},
|
|
1255
|
+
unregister: (phaseName) => {
|
|
1256
|
+
assertActive();
|
|
1257
|
+
options?.unregisterPhase?.(phaseName);
|
|
1258
|
+
},
|
|
1249
1259
|
getPayload: () => outputPayload,
|
|
1250
1260
|
setPayload: (p) => {
|
|
1251
1261
|
outputPayload = p;
|
|
@@ -4925,9 +4935,11 @@ var ExtensionRunner = class {
|
|
|
4925
4935
|
};
|
|
4926
4936
|
return createExtensionAPI(this.hooks, {
|
|
4927
4937
|
registerPhase: (registration) => this.registerPhase(extension, registration),
|
|
4938
|
+
unregisterPhase: (phaseName) => this.unregisterPhase(extension, phaseName),
|
|
4928
4939
|
registerProvider: (config) => this.registerProvider(config),
|
|
4929
4940
|
unregisterProvider: (name) => this.unregisterProvider(name),
|
|
4930
4941
|
registerTool: (tool) => this.registerTool(extension, tool),
|
|
4942
|
+
unregisterTool: (toolName) => this.unregisterTool(extension, toolName),
|
|
4931
4943
|
context: extContext,
|
|
4932
4944
|
manifest,
|
|
4933
4945
|
trackCleanup: (cleanup) => extension.cleanup.push(cleanup)
|
|
@@ -4954,11 +4966,43 @@ var ExtensionRunner = class {
|
|
|
4954
4966
|
sourceInfo
|
|
4955
4967
|
});
|
|
4956
4968
|
}
|
|
4957
|
-
|
|
4958
|
-
if (
|
|
4959
|
-
|
|
4969
|
+
unregisterTool(extension, toolName) {
|
|
4970
|
+
if (extension.tools.has(toolName)) {
|
|
4971
|
+
extension.tools.delete(toolName);
|
|
4972
|
+
}
|
|
4973
|
+
}
|
|
4974
|
+
async registerPhase(extension, registration) {
|
|
4975
|
+
if (typeof registration === "string") {
|
|
4976
|
+
if (registration.length === 0) {
|
|
4977
|
+
throw new Error(`Phase registration requires a directory path.`);
|
|
4978
|
+
}
|
|
4979
|
+
return this.loadRegisteredPhase(extension, registration);
|
|
4980
|
+
}
|
|
4981
|
+
if (typeof registration === "object" && registration !== null && "name" in registration) {
|
|
4982
|
+
return this.registerPhaseDefinition(extension, registration);
|
|
4983
|
+
}
|
|
4984
|
+
throw new Error(`Phase registration requires a directory path or Phase object.`);
|
|
4985
|
+
}
|
|
4986
|
+
registerPhaseDefinition(extension, phase) {
|
|
4987
|
+
const name = phase.name;
|
|
4988
|
+
if (this.phases.has(name)) {
|
|
4989
|
+
throw new Error(`Duplicate phase name: ${name}`);
|
|
4990
|
+
}
|
|
4991
|
+
const registered = {
|
|
4992
|
+
definition: phase,
|
|
4993
|
+
source: { extensionPath: extension.path }
|
|
4994
|
+
};
|
|
4995
|
+
this.phases.set(name, registered);
|
|
4996
|
+
extension.phases.add(name);
|
|
4997
|
+
this._phaseCache = null;
|
|
4998
|
+
}
|
|
4999
|
+
unregisterPhase(extension, phaseName) {
|
|
5000
|
+
const registered = this.phases.get(phaseName);
|
|
5001
|
+
if (registered && registered.source.extensionPath === extension.path) {
|
|
5002
|
+
this.phases.delete(phaseName);
|
|
5003
|
+
extension.phases.delete(phaseName);
|
|
5004
|
+
this._phaseCache = null;
|
|
4960
5005
|
}
|
|
4961
|
-
return this.loadRegisteredPhase(extension, registration);
|
|
4962
5006
|
}
|
|
4963
5007
|
async loadRegisteredPhase(extension, registration) {
|
|
4964
5008
|
const extensionBase = extension.path.startsWith("<") ? this.cwd : dirname5(extension.path);
|
|
@@ -5912,7 +5956,7 @@ var AgentRuntime = class _AgentRuntime {
|
|
|
5912
5956
|
const runs = await this.owned.listRuns({ agentId: input.agentId });
|
|
5913
5957
|
for (const run of runs) {
|
|
5914
5958
|
if (["queued", "running", "input_required"].includes(run.state)) {
|
|
5915
|
-
await this.cancel(run.id, "
|
|
5959
|
+
await this.cancel(run.id, "Agent deleted.");
|
|
5916
5960
|
}
|
|
5917
5961
|
}
|
|
5918
5962
|
await this.owned.deleteAgent(input);
|
|
@@ -7009,8 +7053,8 @@ var InMemoryStore = class _InMemoryStore {
|
|
|
7009
7053
|
}
|
|
7010
7054
|
deleteAgent(lease, input) {
|
|
7011
7055
|
this.assertOwner(lease);
|
|
7012
|
-
if (input.confirmation !== "
|
|
7013
|
-
throw new TypeError("Agent deletion requires the
|
|
7056
|
+
if (input.confirmation !== "agent-delete-v1") {
|
|
7057
|
+
throw new TypeError("Agent deletion requires the agent-delete-v1 confirmation token");
|
|
7014
7058
|
}
|
|
7015
7059
|
const agent = this.requireAgent(input.agentId);
|
|
7016
7060
|
const runs = [...this.runs.values()].filter((run) => run.agentId === agent.id);
|