@skydiveai/pi-extensions 0.1.0-beta.996 → 0.1.250

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/README.md CHANGED
@@ -14,6 +14,16 @@ Extensions (load agent workspace content):
14
14
  daemon session tracking, sandbox heartbeats, OTel self-tracing. Every
15
15
  session must include these.
16
16
 
17
+ Proactive evaluation sessions additionally receive `submit_proactive_action_result`.
18
+ The tool schema comes from the authenticated sandbox API, which validates and
19
+ stores the result for the originating evaluation. Ordinary sessions do not
20
+ discover or register this tool. Submission does not deliver a message; the
21
+ worker reconciles it only after the run succeeds.
22
+
23
+ The native tool reaches agents through the normal reviewed pi-extensions
24
+ release and opt-in harness upgrade, not by rewriting their harness files.
25
+ Already-started v1/v2/v3 evaluations retain text-result compatibility.
26
+
17
27
  Platform layer:
18
28
 
19
29
  - `createHarness` — composes @skydiveai/pi-server's protocol handlers
package/dist/index.d.mts CHANGED
@@ -1,7 +1,27 @@
1
+ /// <reference types="node" />
1
2
  import { A2AOptions, Middleware, ProtocolsOptions } from "@skydiveai/pi-server";
2
3
  import { ExtensionFactory } from "@earendil-works/pi-coding-agent";
4
+ import { Type } from "typebox";
5
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
6
+ import * as _$qs from "qs";
7
+ import * as _$express from "express";
3
8
  import { Logger } from "pino";
4
9
 
10
+ //#region ../../node_modules/@types/express-serve-static-core/index.d.ts
11
+ declare global {
12
+ namespace Express {
13
+ // These open interfaces may be extended in an application-specific manner via declaration merging.
14
+ // See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts)
15
+ interface Request {}
16
+ interface Response {}
17
+ interface Locals {}
18
+ interface Application {}
19
+ }
20
+ }
21
+ interface ParamsDictionary {
22
+ [key: string]: string;
23
+ }
24
+ //#endregion
5
25
  //#region src/harness.d.ts
6
26
  type CreateHarnessOptions = ProtocolsOptions & {
7
27
  cwd: string;
@@ -24,7 +44,7 @@ declare function createHarness(options: CreateHarnessOptions): {
24
44
  };
25
45
  protocols: {
26
46
  handlers: {
27
- /** Express-style; mount at /a2a. */a2a: RequestHandler; /** GET /.well-known/agent-card.json. */
47
+ /** Express-style; mount at /a2a. */a2a: _$express.RequestHandler<ParamsDictionary, any, any, _$qs.ParsedQs, Record<string, any>>; /** GET /.well-known/agent-card.json. */
28
48
  agentCard: Middleware; /** Mirrors each vendor's API shape. */
29
49
  openai: {
30
50
  v1: {
@@ -83,6 +103,13 @@ declare const _default: ExtensionFactory;
83
103
  //#region src/extensions/memory.d.ts
84
104
  declare const memoryExtension: ExtensionFactory;
85
105
  //#endregion
106
+ //#region src/extensions/provider-api-compat.d.ts
107
+ /**
108
+ * Keep older harnesses compatible with provider-native model specs that use
109
+ * the OpenAI-compatible wire through the transparent proxy.
110
+ */
111
+ declare const providerApiCompatExtension: ExtensionFactory;
112
+ //#endregion
86
113
  //#region src/extensions/soul.d.ts
87
114
  declare const soulExtension: ExtensionFactory;
88
115
  //#endregion
@@ -112,7 +139,7 @@ declare function platformExtensions({
112
139
  }): ExtensionFactory[];
113
140
  //#endregion
114
141
  //#region src/tool-update-loop.d.ts
115
- type SessionLike = {
142
+ type SessionLike$1 = {
116
143
  reload: () => Promise<void>;
117
144
  bindExtensions: (vars: Record<string, unknown>) => Promise<void>;
118
145
  sendCustomMessage: (msg: {
@@ -126,7 +153,7 @@ type SessionLike = {
126
153
  };
127
154
  type SessionWithAgent = {
128
155
  agent: unknown;
129
- } & SessionLike;
156
+ } & SessionLike$1;
130
157
  declare function installToolUpdateAutoStop({
131
158
  session,
132
159
  log
@@ -137,9 +164,53 @@ declare function installToolUpdateAutoStop({
137
164
  declare function runToolUpdateLoop({
138
165
  session,
139
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
140
210
  }: {
141
211
  session: SessionLike;
142
212
  log: Logger;
213
+ enabled?: boolean;
143
214
  }): Promise<void>;
144
215
  //#endregion
145
- export { type CreateHarnessOptions, all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, _default as mcpExtension, memoryExtension, platformExtensions, runToolUpdateLoop, soulExtension, toolCallEnvExtension };
216
+ export { type CreateHarnessOptions, all, createHarness, createHealthHandler, createPlatformEnvMiddleware, installToolUpdateAutoStop, isPlatformConfigLoaded, loadPlatformConfig, localToolsExtension, _default as mcpExtension, memoryExtension, platformExtensions, providerApiCompatExtension, runClosingTextLoop, runToolUpdateLoop, soulExtension, toolCallEnvExtension, turnEndedWithoutVisibleText };