@skydiveai/pi-extensions 0.1.0-beta.2106 → 0.1.0-beta.2111

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
@@ -114,7 +114,7 @@ declare function platformExtensions({
114
114
  }): ExtensionFactory[];
115
115
  //#endregion
116
116
  //#region src/tool-update-loop.d.ts
117
- type SessionLike = {
117
+ type SessionLike$1 = {
118
118
  reload: () => Promise<void>;
119
119
  bindExtensions: (vars: Record<string, unknown>) => Promise<void>;
120
120
  sendCustomMessage: (msg: {
@@ -128,7 +128,7 @@ type SessionLike = {
128
128
  };
129
129
  type SessionWithAgent = {
130
130
  agent: unknown;
131
- } & SessionLike;
131
+ } & SessionLike$1;
132
132
  declare function installToolUpdateAutoStop({
133
133
  session,
134
134
  log
@@ -139,9 +139,53 @@ declare function installToolUpdateAutoStop({
139
139
  declare function runToolUpdateLoop({
140
140
  session,
141
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
142
185
  }: {
143
186
  session: SessionLike;
144
187
  log: Logger;
188
+ enabled?: boolean;
145
189
  }): Promise<void>;
146
190
  //#endregion
147
- 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 };