@skydiveai/pi-extensions 0.1.254-beta.56 → 0.1.254-beta.57

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
@@ -139,7 +139,7 @@ declare function platformExtensions({
139
139
  }): ExtensionFactory[];
140
140
  //#endregion
141
141
  //#region src/tool-update-loop.d.ts
142
- type SessionLike$1 = {
142
+ type SessionLike = {
143
143
  reload: () => Promise<void>;
144
144
  bindExtensions: (vars: Record<string, unknown>) => Promise<void>;
145
145
  sendCustomMessage: (msg: {
@@ -153,7 +153,7 @@ type SessionLike$1 = {
153
153
  };
154
154
  type SessionWithAgent = {
155
155
  agent: unknown;
156
- } & SessionLike$1;
156
+ } & SessionLike;
157
157
  declare function installToolUpdateAutoStop({
158
158
  session,
159
159
  log
@@ -164,53 +164,9 @@ declare function installToolUpdateAutoStop({
164
164
  declare function runToolUpdateLoop({
165
165
  session,
166
166
  log
167
- }: {
168
- session: SessionLike$1;
169
- log: Logger;
170
- }): Promise<void>;
171
- //#endregion
172
- //#region src/closing-text-loop.d.ts
173
- type TextBlock = {
174
- type: 'text';
175
- text?: string;
176
- };
177
- type ContentBlock = TextBlock | {
178
- type: string;
179
- };
180
- type SessionMessage = {
181
- role: string;
182
- content?: string | ContentBlock[];
183
- stopReason?: string;
184
- };
185
- type SessionLike = {
186
- messages: SessionMessage[];
187
- sendCustomMessage: (msg: {
188
- customType: string;
189
- content: string;
190
- display: boolean;
191
- details: Record<string, unknown>;
192
- }, options: {
193
- triggerTurn: boolean;
194
- }) => Promise<void>;
195
- };
196
- /**
197
- * True when the assistant produced no visible text since the human's last
198
- * message this turn — i.e. the turn ended on tool calls / thinking only.
199
- *
200
- * We scan from the end back to the most recent `user` message (the human turn
201
- * that triggered this run) and inspect every `assistant` message after it.
202
- * A string-content assistant message (rare, but pi allows it) counts as text
203
- * when non-blank. `toolResult` and custom messages are ignored.
204
- */
205
- declare function turnEndedWithoutVisibleText(messages: readonly SessionMessage[]): boolean;
206
- declare function runClosingTextLoop({
207
- session,
208
- log,
209
- enabled
210
167
  }: {
211
168
  session: SessionLike;
212
169
  log: Logger;
213
- enabled?: boolean;
214
170
  }): Promise<void>;
215
171
  //#endregion
216
- export { type CreateHarnessOptions, all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, _default as mcpExtension, memoryExtension, platformExtensions, providerApiCompatExtension, runClosingTextLoop, runToolUpdateLoop, soulExtension, toolCallEnvExtension, turnEndedWithoutVisibleText };
172
+ export { type CreateHarnessOptions, all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, _default as mcpExtension, memoryExtension, platformExtensions, providerApiCompatExtension, runToolUpdateLoop, soulExtension, toolCallEnvExtension };
package/dist/index.mjs CHANGED
@@ -3944,61 +3944,6 @@ function startFeatureFlagPoller() {
3944
3944
  setInterval(() => void pollOnce(), FLAG_POLL_INTERVAL_MS).unref?.();
3945
3945
  }
3946
3946
  //#endregion
3947
- //#region src/closing-text-loop.ts
3948
- const CLOSING_TEXT_NUDGE = "<system_notification>You ended that turn without writing any reply to the user. Write a brief reply now: what you did and the outcome, or the answer to their question. Do not call any more tools unless you genuinely still need to.</system_notification>";
3949
- function isNonEmptyText(block) {
3950
- return block.type === "text" && typeof block.text === "string" && block.text.trim().length > 0;
3951
- }
3952
- /**
3953
- * True when the assistant produced no visible text since the human's last
3954
- * message this turn — i.e. the turn ended on tool calls / thinking only.
3955
- *
3956
- * We scan from the end back to the most recent `user` message (the human turn
3957
- * that triggered this run) and inspect every `assistant` message after it.
3958
- * A string-content assistant message (rare, but pi allows it) counts as text
3959
- * when non-blank. `toolResult` and custom messages are ignored.
3960
- */
3961
- function turnEndedWithoutVisibleText(messages) {
3962
- let sawAssistant = false;
3963
- for (let i = messages.length - 1; i >= 0; i--) {
3964
- const m = messages[i];
3965
- if (!m || m.role === "user") break;
3966
- if (m.role !== "assistant") continue;
3967
- sawAssistant = true;
3968
- if (typeof m.content === "string") {
3969
- if (m.content.trim().length > 0) return false;
3970
- continue;
3971
- }
3972
- if (Array.isArray(m.content) && m.content.some(isNonEmptyText)) return false;
3973
- }
3974
- return sawAssistant;
3975
- }
3976
- /**
3977
- * True when the last assistant message this turn ended in a way we must not
3978
- * nudge: a user abort or a provider error. Both already surface their own
3979
- * terminal signal to the client; a closing-text prompt on top would be noise.
3980
- */
3981
- function turnEndedAbnormally(messages) {
3982
- for (let i = messages.length - 1; i >= 0; i--) {
3983
- const m = messages[i];
3984
- if (!m || m.role !== "assistant") continue;
3985
- return m.stopReason === "aborted" || m.stopReason === "error";
3986
- }
3987
- return false;
3988
- }
3989
- async function runClosingTextLoop({ session, log, enabled = getPolledFlag("closingText") === true }) {
3990
- if (!enabled) return;
3991
- if (turnEndedAbnormally(session.messages)) return;
3992
- if (!turnEndedWithoutVisibleText(session.messages)) return;
3993
- log.info({ event: "closing_text_continuation_injected" }, "turn produced no visible reply; injecting a closing-text continuation");
3994
- await session.sendCustomMessage({
3995
- customType: "closing-text-nudge",
3996
- content: CLOSING_TEXT_NUDGE,
3997
- display: false,
3998
- details: {}
3999
- }, { triggerTurn: true });
4000
- }
4001
- //#endregion
4002
3947
  //#region src/tracing.ts
4003
3948
  const SERVICE_NAME = "skydive-agent-harness";
4004
3949
  const DAEMON_TRACES_URL = "http://localhost:38994/v1/traces";
@@ -4073,10 +4018,6 @@ function createHarness(options) {
4073
4018
  options.onSteer?.(args);
4074
4019
  await notifyBashSteerArrival(args);
4075
4020
  },
4076
- postPrompt: options.postPrompt ?? (async (args) => {
4077
- await runToolUpdateLoop(args);
4078
- await runClosingTextLoop(args);
4079
- }),
4080
4021
  passthroughHeaderPrefixes: options.passthroughHeaderPrefixes ?? PASSTHROUGH_HEADER_PREFIXES,
4081
4022
  prewarmPaths: options.prewarmPaths ?? PREWARM_PATHS
4082
4023
  };
@@ -6397,4 +6338,4 @@ function platformExtensions({ sessionId, channelContext }) {
6397
6338
  ];
6398
6339
  }
6399
6340
  //#endregion
6400
- export { all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, mcp_default as mcpExtension, memoryExtension, platformExtensions, providerApiCompatExtension, runClosingTextLoop, runToolUpdateLoop, soulExtension, toolCallEnvExtension, turnEndedWithoutVisibleText };
6341
+ export { all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, mcp_default as mcpExtension, memoryExtension, platformExtensions, providerApiCompatExtension, runToolUpdateLoop, soulExtension, toolCallEnvExtension };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skydiveai/pi-extensions",
3
- "version": "0.1.254-beta.56",
3
+ "version": "0.1.254-beta.57",
4
4
  "homepage": "https://skydive.com",
5
5
  "license": "MIT",
6
6
  "author": "Create, Inc.",