@stratusagent/channels 0.11.2 → 0.11.3

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 CHANGED
@@ -1,4 +1,4 @@
1
- import type { AgentDefinition, ApprovalAnswer, EventBus, JsonObject, Session } from '@stratusagent/core';
1
+ import type { AgentDefinition, ApprovalAnswer, EventBus, ImageAttachment, JsonObject, Session } from '@stratusagent/core';
2
2
  /**
3
3
  * One message arriving from a chat platform, normalized. Adapters translate
4
4
  * their platform's event shape into this before anything else happens.
@@ -80,12 +80,35 @@ export interface SessionRouting {
80
80
  * agent had actually answered, and the Slack adapter orders the agents
81
81
  * sharing a thread by this to decide whose an untagged follow-up is.
82
82
  *
83
+ * A file counts: a turn whose tool result carried one (`filePathsOf` in
84
+ * `@stratusagent/core`) put something in the thread, whether or not it
85
+ * said a word beside it.
86
+ *
83
87
  * Still routing, not transcript: it says *when* an agent spoke, never
84
88
  * what was said. Optional because a host may not track it; a caller that
85
89
  * needs to order two sessions checks for it rather than assuming, and
86
90
  * says what it gives up without it.
87
91
  */
88
92
  lastSpokeAt?: string;
93
+ /**
94
+ * When the agent last answered a message that ADDRESSED it — its newest
95
+ * reply to a turn somebody asked for, ISO-8601 — and absent when it never
96
+ * has. The anchor of an attention window: an agent that judges whether
97
+ * to speak does so for a bounded stretch after being spoken to, and a
98
+ * reply it chose to give on a turn nobody asked for does not move the
99
+ * anchor, or a talkative judge would keep itself attentive for good.
100
+ * `lastSpokeAt` stays the thread rule's answer, which counts every reply.
101
+ */
102
+ lastAnsweredAt?: string;
103
+ /**
104
+ * How many user messages the session holds after that answer — heard,
105
+ * judged, or asked and left unanswered — and every one of them when it
106
+ * never has. With `lastAnsweredAt`, the two halves of the window, both
107
+ * read from the session rather than remembered in-process, so a restart
108
+ * forgets nothing about who is still listening. Absent from a host that
109
+ * does not count.
110
+ */
111
+ heardSinceAnswered?: number;
89
112
  /**
90
113
  * The text the session's latest turn produced (`latestTurnReply` in
91
114
  * `@stratusagent/core`, the same rule an adapter finalizes its own turns
@@ -96,12 +119,31 @@ export interface SessionRouting {
96
119
  * this, the approval survived the restart and the reply went nowhere.
97
120
  */
98
121
  reply?: string;
122
+ /**
123
+ * Whether the turn the session is on is one nobody asked for — its
124
+ * newest user message was dispatched `addressed: false`
125
+ * (`isUnaddressedTurn` in `@stratusagent/core`). Read for a turn the
126
+ * adapter did not render: a judged turn the daemon died inside is
127
+ * failed at the next start by a process with no renderer for it, and
128
+ * an error note posted for a turn nobody asked for, that said nothing,
129
+ * is the interruption the turn existed to avoid.
130
+ */
131
+ unaddressed?: boolean;
99
132
  }
100
133
  export interface GatewayLike {
101
134
  dispatch(input: {
102
135
  sessionId: string;
103
136
  agentId?: string;
104
137
  userMessage: string;
138
+ /** Images sent with the message — see `Message.images` in `@stratusagent/core`. */
139
+ images?: ImageAttachment[];
140
+ /**
141
+ * Whether the message was said to the agent — see `RunInput.addressed`
142
+ * in `@stratusagent/core`. `false` runs a turn the agent may answer
143
+ * with nothing: the session completes with no reply, and the adapter
144
+ * posts nothing for it.
145
+ */
146
+ addressed?: boolean;
105
147
  metadata?: JsonObject;
106
148
  signal?: AbortSignal;
107
149
  /**
@@ -132,6 +174,28 @@ export interface GatewayLike {
132
174
  * whose process is gone — nothing else.
133
175
  */
134
176
  sessionRouting?(sessionId: string): Promise<SessionRouting | undefined>;
177
+ /**
178
+ * A message that reaches a session without running a turn: something
179
+ * said in a conversation the agent is in, to somebody else. The next
180
+ * turn the agent takes has it in hand; nothing is posted now.
181
+ *
182
+ * Resolves `undefined` when there is no such session: an agent hears
183
+ * only conversations it is already in, and the host is the one to say
184
+ * so — on the session's own chain, behind any turn queued ahead, which
185
+ * is what an adapter cannot do from outside. An adapter that checked
186
+ * membership itself first would find nothing for an agent whose
187
+ * invitation is still being written, and drop the message for good.
188
+ *
189
+ * Optional, like `sessionRouting`. A host that omits it gives up
190
+ * overhearing: its agents hear only what they answer, which is what
191
+ * every agent did before this existed.
192
+ */
193
+ observe?(input: {
194
+ sessionId: string;
195
+ agentId?: string;
196
+ message: string;
197
+ metadata?: JsonObject;
198
+ }): Promise<Session | undefined>;
135
199
  /**
136
200
  * Settles a call parked on `tool.approval-requested`. False means the
137
201
  * request is no longer pending — decided already, expired, or its turn
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,QAAQ,EACR,UAAU,EACV,OAAO,EACR,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,aAAa,EAAE,OAAO,CAAC;IACvB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,8EAA8E;IAC9E,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,O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CAAC;IACb,KAAK,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,sBAAsB;IACrC,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,KAAG,MAMjE,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8NA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAU,EAAE;IACzE,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChF,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+RA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAU,EAAE;IACzE,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAChF,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratusagent/channels",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "node": ">=22.13 <23 || >=23.4"
18
18
  },
19
19
  "dependencies": {
20
- "@stratusagent/core": "0.11.2"
20
+ "@stratusagent/core": "0.11.3"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^24.6.0",