@skydiveai/pi-extensions 0.1.0-beta.217 → 0.1.0-beta.2173

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.mts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { A2AOptions, Middleware, ProtocolsOptions } from "@skydiveai/pi-server";
2
+ import { Type } from "typebox";
3
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
4
  import { ExtensionFactory } from "@earendil-works/pi-coding-agent";
3
5
  import { Logger } from "pino";
4
6
 
@@ -112,7 +114,7 @@ declare function platformExtensions({
112
114
  }): ExtensionFactory[];
113
115
  //#endregion
114
116
  //#region src/tool-update-loop.d.ts
115
- type SessionLike = {
117
+ type SessionLike$1 = {
116
118
  reload: () => Promise<void>;
117
119
  bindExtensions: (vars: Record<string, unknown>) => Promise<void>;
118
120
  sendCustomMessage: (msg: {
@@ -126,7 +128,7 @@ type SessionLike = {
126
128
  };
127
129
  type SessionWithAgent = {
128
130
  agent: unknown;
129
- } & SessionLike;
131
+ } & SessionLike$1;
130
132
  declare function installToolUpdateAutoStop({
131
133
  session,
132
134
  log
@@ -137,9 +139,53 @@ declare function installToolUpdateAutoStop({
137
139
  declare function runToolUpdateLoop({
138
140
  session,
139
141
  log
142
+ }: {
143
+ session: SessionLike$1;
144
+ log: Logger;
145
+ }): Promise<void>;
146
+ //#endregion
147
+ //#region src/closing-text-loop.d.ts
148
+ type TextBlock = {
149
+ type: 'text';
150
+ text?: string;
151
+ };
152
+ type ContentBlock = TextBlock | {
153
+ type: string;
154
+ };
155
+ type SessionMessage = {
156
+ role: string;
157
+ content?: string | ContentBlock[];
158
+ stopReason?: string;
159
+ };
160
+ type SessionLike = {
161
+ messages: SessionMessage[];
162
+ sendCustomMessage: (msg: {
163
+ customType: string;
164
+ content: string;
165
+ display: boolean;
166
+ details: Record<string, unknown>;
167
+ }, options: {
168
+ triggerTurn: boolean;
169
+ }) => Promise<void>;
170
+ };
171
+ /**
172
+ * True when the assistant produced no visible text since the human's last
173
+ * message this turn — i.e. the turn ended on tool calls / thinking only.
174
+ *
175
+ * We scan from the end back to the most recent `user` message (the human turn
176
+ * that triggered this run) and inspect every `assistant` message after it.
177
+ * A string-content assistant message (rare, but pi allows it) counts as text
178
+ * when non-blank. `toolResult` and custom messages are ignored.
179
+ */
180
+ declare function turnEndedWithoutVisibleText(messages: readonly SessionMessage[]): boolean;
181
+ declare function runClosingTextLoop({
182
+ session,
183
+ log,
184
+ enabled
140
185
  }: {
141
186
  session: SessionLike;
142
187
  log: Logger;
188
+ enabled?: boolean;
143
189
  }): Promise<void>;
144
190
  //#endregion
145
- export { type CreateHarnessOptions, all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, _default as mcpExtension, memoryExtension, platformExtensions, runToolUpdateLoop, soulExtension, toolCallEnvExtension };
191
+ export { type CreateHarnessOptions, all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, _default as mcpExtension, memoryExtension, platformExtensions, runClosingTextLoop, runToolUpdateLoop, soulExtension, toolCallEnvExtension, turnEndedWithoutVisibleText };