@sprucelabs/spruce-agent-plugin 0.0.3 → 0.0.4

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.
@@ -2,9 +2,11 @@ import { BootCallback, HealthCheckItem, Skill, SkillFeature } from '@sprucelabs/
2
2
  export declare class AgentFeature implements SkillFeature {
3
3
  private skill;
4
4
  private log;
5
+ private onBootHandler?;
5
6
  constructor(skill: Skill);
6
7
  static doesFileExist(path: string): boolean;
7
8
  execute(): Promise<void>;
9
+ private triggerOnBoot;
8
10
  private registerPlatformAgent;
9
11
  private connectToApi;
10
12
  private parseName;
@@ -15,7 +17,7 @@ export declare class AgentFeature implements SkillFeature {
15
17
  isInstalled(): Promise<boolean>;
16
18
  destroy(): Promise<void>;
17
19
  isBooted(): boolean;
18
- onBoot(_cb: BootCallback): void;
20
+ onBoot(cb: BootCallback): void;
19
21
  }
20
22
  declare const _default: (skill: Skill) => void;
21
23
  export default _default;
@@ -21,10 +21,18 @@ export class AgentFeature {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const prompt = this.readSystemPromptFile();
23
23
  if (!prompt) {
24
+ yield this.triggerOnBoot();
24
25
  return;
25
26
  }
26
27
  const name = this.parseName(prompt);
27
28
  yield this.registerPlatformAgent(name, prompt);
29
+ yield this.triggerOnBoot();
30
+ });
31
+ }
32
+ triggerOnBoot() {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ var _a;
35
+ yield ((_a = this.onBootHandler) === null || _a === void 0 ? void 0 : _a.call(this));
28
36
  });
29
37
  }
30
38
  registerPlatformAgent(name, prompt) {
@@ -122,7 +130,9 @@ export class AgentFeature {
122
130
  isBooted() {
123
131
  return true;
124
132
  }
125
- onBoot(_cb) { }
133
+ onBoot(cb) {
134
+ this.onBootHandler = cb;
135
+ }
126
136
  }
127
137
  export default (skill) => {
128
138
  skill.registerFeature('agent', new AgentFeature(skill));
@@ -2,9 +2,11 @@ import { BootCallback, HealthCheckItem, Skill, SkillFeature } from '@sprucelabs/
2
2
  export declare class AgentFeature implements SkillFeature {
3
3
  private skill;
4
4
  private log;
5
+ private onBootHandler?;
5
6
  constructor(skill: Skill);
6
7
  static doesFileExist(path: string): boolean;
7
8
  execute(): Promise<void>;
9
+ private triggerOnBoot;
8
10
  private registerPlatformAgent;
9
11
  private connectToApi;
10
12
  private parseName;
@@ -15,7 +17,7 @@ export declare class AgentFeature implements SkillFeature {
15
17
  isInstalled(): Promise<boolean>;
16
18
  destroy(): Promise<void>;
17
19
  isBooted(): boolean;
18
- onBoot(_cb: BootCallback): void;
20
+ onBoot(cb: BootCallback): void;
19
21
  }
20
22
  declare const _default: (skill: Skill) => void;
21
23
  export default _default;
@@ -17,10 +17,15 @@ class AgentFeature {
17
17
  async execute() {
18
18
  const prompt = this.readSystemPromptFile();
19
19
  if (!prompt) {
20
+ await this.triggerOnBoot();
20
21
  return;
21
22
  }
22
23
  const name = this.parseName(prompt);
23
24
  await this.registerPlatformAgent(name, prompt);
25
+ await this.triggerOnBoot();
26
+ }
27
+ async triggerOnBoot() {
28
+ await this.onBootHandler?.();
24
29
  }
25
30
  async registerPlatformAgent(name, prompt) {
26
31
  const client = await this.connectToApi();
@@ -106,7 +111,9 @@ class AgentFeature {
106
111
  isBooted() {
107
112
  return true;
108
113
  }
109
- onBoot(_cb) { }
114
+ onBoot(cb) {
115
+ this.onBootHandler = cb;
116
+ }
110
117
  }
111
118
  exports.AgentFeature = AgentFeature;
112
119
  exports.default = (skill) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-agent-plugin",
3
3
  "description": "Allow your skill to register AI agents!",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "skill": {
6
6
  "namespace": "spruce-agent-plugin"
7
7
  },