@adecore/agents 0.37.3 → 0.39.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.
@@ -229,6 +229,7 @@ export declare class ChatCore {
229
229
  unqueue(chatId: string, messageId: string): ChatQueuedMessage;
230
230
  sendNow(chatId: string, messageId: string): void;
231
231
  skills(chatId: string): Promise<ChatSkill[]>;
232
+ skillsIn(provider: AgentKind, cwd: string): Promise<ChatSkill[]>;
232
233
  restart(chatId: string): Promise<void>;
233
234
  compact(chatId: string): void;
234
235
  clear(chatId: string, force?: boolean): Promise<void>;
@@ -421,6 +421,11 @@ export class ChatCore {
421
421
  * read leaves its list out rather than the thread.
422
422
  */
423
423
  async attachWithBookmarks(chatId, clientId, historyLimit, since) {
424
+ // A client that only watches a chat sends no create, so a chat on disk nobody loaded since the host started is loaded for it.
425
+ await this.loaded(chatId);
426
+ if (!this.chats.has(chatId) && (await this.store?.has(chatId)) === true) {
427
+ await this.create({ chatId });
428
+ }
424
429
  this.require(chatId);
425
430
  const unreadable = (what) => (e) => {
426
431
  console.error(`The ${what} of chat ${chatId} could not be read:`, errorText(e));
@@ -722,6 +727,10 @@ export class ChatCore {
722
727
  const session = this.require(chatId);
723
728
  return session.skills(() => this.skillIndex.list(session.info.provider, session.info.cwd));
724
729
  }
730
+ /* What a CLI would run as a skill in a folder before any chat of it exists there, such as for a prompt saved to send later. */
731
+ skillsIn(provider, cwd) {
732
+ return this.skillIndex.list(provider, cwd);
733
+ }
725
734
  /* Ends the chat's CLI and keeps its conversation; the next message resumes it in a process that reads its skills and plugins again. */
726
735
  async restart(chatId) {
727
736
  const session = this.require(chatId);
@@ -191,6 +191,8 @@ export declare class ChatSession {
191
191
  taskIds: string[];
192
192
  summaryFor?: string;
193
193
  messageFrom?: string[];
194
+ mentions?: string[];
195
+ skills?: string[];
194
196
  }): string | null;
195
197
  resumeSettingChanged(): void;
196
198
  takeUpAfterLimit(turnId: string): 'opened' | 'wait' | 'lapsed';
@@ -872,7 +872,8 @@ export class ChatSession {
872
872
  * turn carrying what woke it, so a turn it opens cannot itself wake anyone. A caller passes `note`
873
873
  * only when its news is not already written in the thread. Checked and opened in one step, so null
874
874
  * means a turn (or a shutdown) was in the way. Never through `send`, which would step on a turn
875
- * with `origin: 'agent'` and close the wake it just made.
875
+ * with `origin: 'agent'` and close the wake it just made. `mentions` and `skills` reach a CLI that
876
+ * expands them itself, as a person's picks in a message do.
876
877
  */
877
878
  wake(wake) {
878
879
  if (this.frozen || this.relocating || this.thread.info.activeTurnId !== null || this.replacementWaits()) {
@@ -906,7 +907,7 @@ export class ChatSession {
906
907
  ]);
907
908
  this.options.persist();
908
909
  this.turnReady = this.checkpoint(turnId);
909
- this.submit(turnId, { text: wake.text, preamble, attachments: [], mentions: [], skills: [] });
910
+ this.submit(turnId, { text: wake.text, preamble, attachments: [], mentions: wake.mentions ?? [], skills: wake.skills ?? [] });
910
911
  return turnId;
911
912
  }
912
913
  /* The host's switch or this chat's own changed: a limit still ahead is owed a resume now, or what was owed lapses. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents",
3
- "version": "0.37.3",
3
+ "version": "0.39.0",
4
4
  "description": "Node-compatible agent chat hosts, providers, accounts, usage and durable task coordination.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -81,8 +81,8 @@
81
81
  "test": "bun --conditions=source test"
82
82
  },
83
83
  "dependencies": {
84
- "@adecore/agent-contracts": "0.37.3",
85
- "@adecore/intelligent-ui": "0.37.3",
84
+ "@adecore/agent-contracts": "0.39.0",
85
+ "@adecore/intelligent-ui": "0.39.0",
86
86
  "zod": "^4.6.5"
87
87
  },
88
88
  "devDependencies": {
@@ -625,6 +625,11 @@ export class ChatCore {
625
625
  * read leaves its list out rather than the thread.
626
626
  */
627
627
  async attachWithBookmarks(chatId: string, clientId: string, historyLimit?: number, since?: number): Promise<ChatAttachResult> {
628
+ // A client that only watches a chat sends no create, so a chat on disk nobody loaded since the host started is loaded for it.
629
+ await this.loaded(chatId);
630
+ if (!this.chats.has(chatId) && (await this.store?.has(chatId)) === true) {
631
+ await this.create({ chatId });
632
+ }
628
633
  this.require(chatId);
629
634
  const unreadable = (what: string) => (e: unknown) => {
630
635
  console.error(`The ${what} of chat ${chatId} could not be read:`, errorText(e));
@@ -960,6 +965,11 @@ export class ChatCore {
960
965
  return session.skills(() => this.skillIndex.list(session.info.provider, session.info.cwd));
961
966
  }
962
967
 
968
+ /* What a CLI would run as a skill in a folder before any chat of it exists there, such as for a prompt saved to send later. */
969
+ skillsIn(provider: AgentKind, cwd: string): Promise<ChatSkill[]> {
970
+ return this.skillIndex.list(provider, cwd);
971
+ }
972
+
963
973
  /* Ends the chat's CLI and keeps its conversation; the next message resumes it in a process that reads its skills and plugins again. */
964
974
  async restart(chatId: string): Promise<void> {
965
975
  const session = this.require(chatId);
@@ -1078,9 +1078,19 @@ export class ChatSession {
1078
1078
  * turn carrying what woke it, so a turn it opens cannot itself wake anyone. A caller passes `note`
1079
1079
  * only when its news is not already written in the thread. Checked and opened in one step, so null
1080
1080
  * means a turn (or a shutdown) was in the way. Never through `send`, which would step on a turn
1081
- * with `origin: 'agent'` and close the wake it just made.
1081
+ * with `origin: 'agent'` and close the wake it just made. `mentions` and `skills` reach a CLI that
1082
+ * expands them itself, as a person's picks in a message do.
1082
1083
  */
1083
- wake(wake: { text: string; label: string; note?: string; taskIds: string[]; summaryFor?: string; messageFrom?: string[] }): string | null {
1084
+ wake(wake: {
1085
+ text: string;
1086
+ label: string;
1087
+ note?: string;
1088
+ taskIds: string[];
1089
+ summaryFor?: string;
1090
+ messageFrom?: string[];
1091
+ mentions?: string[];
1092
+ skills?: string[];
1093
+ }): string | null {
1084
1094
  if (this.frozen || this.relocating || this.thread.info.activeTurnId !== null || this.replacementWaits()) {
1085
1095
  return null;
1086
1096
  }
@@ -1112,7 +1122,7 @@ export class ChatSession {
1112
1122
  ]);
1113
1123
  this.options.persist();
1114
1124
  this.turnReady = this.checkpoint(turnId);
1115
- this.submit(turnId, { text: wake.text, preamble, attachments: [], mentions: [], skills: [] });
1125
+ this.submit(turnId, { text: wake.text, preamble, attachments: [], mentions: wake.mentions ?? [], skills: wake.skills ?? [] });
1116
1126
  return turnId;
1117
1127
  }
1118
1128