@astrosheep/keiyaku 4.6.12 → 4.6.13

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.
@@ -1,6 +1,6 @@
1
1
  import { abortable } from "../../abort.js";
2
2
  import { akumaExecutionEnvironment } from "../execution-environment.js";
3
- import { AgentEventChannel, createProviderAttempt, launchPrompt, modelEvent, tellRegistry, } from "../../provider.js";
3
+ import { AgentEventChannel, createProviderAttempt, launchPrompt, modelEvent, noteEvent, tellRegistry, } from "../../provider.js";
4
4
  import { piSessionModel, piTerminalFailure, translatePiEvent } from "./events.js";
5
5
  const PI_THINKING_LEVELS = new Set(["minimal", "low", "medium", "high", "xhigh", "max"]);
6
6
  const MODEL_PATTERN = /^[^/\s]+\/[^\s]+$/u;
@@ -70,9 +70,13 @@ async function createPiSession(sdk, execution, input) {
70
70
  : { systemPromptOverride: () => input.options.systemPrompt },
71
71
  }),
72
72
  });
73
+ const extensionErrors = services.resourceLoader.getExtensions().errors ?? [];
74
+ for (const failure of extensionErrors)
75
+ console.error(`Pi extension load failed: ${failure.path}\n${failure.error}`);
73
76
  try {
74
77
  input.signal?.throwIfAborted();
75
- return await sdk.createAgentSessionFromServices(piCreateOptions(sdk, input, services));
78
+ const created = await sdk.createAgentSessionFromServices(piCreateOptions(sdk, input, services));
79
+ return { created, extensionErrors };
76
80
  }
77
81
  catch (error) {
78
82
  // Before a session owns the extension runtime, failed selection/setup must
@@ -139,7 +143,7 @@ async function retirePiSession(native) {
139
143
  throw failure;
140
144
  }
141
145
  async function drivePi(sdk, execution, input, signal, custody) {
142
- const created = await createPiSession(sdk, execution, input);
146
+ const { created, extensionErrors } = await createPiSession(sdk, execution, input);
143
147
  const native = created.session;
144
148
  let settleRetired;
145
149
  let failRetired;
@@ -248,6 +252,9 @@ async function drivePi(sdk, execution, input, signal, custody) {
248
252
  await abortable(binding, signal);
249
253
  signal.throwIfAborted();
250
254
  events.emit({ type: "session", coordinate: { sessionFile: native.sessionFile, sessionId: native.sessionId } });
255
+ for (const failure of extensionErrors) {
256
+ events.emit(noteEvent(`Pi extension load failed: ${failure.path}: ${failure.error}`));
257
+ }
251
258
  const sessionModel = piSessionModel(native.model);
252
259
  if (sessionModel !== undefined)
253
260
  events.emit(modelEvent(sessionModel));
@@ -42,7 +42,7 @@ export declare function actionReceipt(input: Readonly<{
42
42
  */
43
43
  type RowLayout = Readonly<{
44
44
  head: (time: string | undefined, glyph: string, verb: string, columns: number) => string;
45
- continuation: () => string;
45
+ continuation: (verb: string) => string;
46
46
  marker: (count: number) => string;
47
47
  history?: true;
48
48
  compactRun?: true;
@@ -67,7 +67,7 @@ function clock(at) {
67
67
  }
68
68
  function label(row, tool) {
69
69
  if (row.kind === "said")
70
- return "say";
70
+ return "";
71
71
  if (row.kind === "thought")
72
72
  return "think";
73
73
  if (row.kind === "note")
@@ -141,12 +141,14 @@ function verbColumn(verb) {
141
141
  */
142
142
  function actionCell(head, verb, columns) {
143
143
  const prefix = `${head} `;
144
+ if (verb === "")
145
+ return prefix;
144
146
  const available = Math.max(0, columns - displayColumns(prefix) - 1);
145
147
  const width = Math.min(verbColumn(verb), available);
146
148
  return `${prefix}${padToDisplay(truncateDisplayText(verb, width), width)} `;
147
149
  }
148
- function continuationPrefix() {
149
- return " ".repeat(TIME_WIDTH) + " │ " + " ".repeat(VERB_WIDTH) + " ";
150
+ function continuationPrefix(verb) {
151
+ return " ".repeat(TIME_WIDTH) + " │ " + (verb === "" ? "" : " ".repeat(VERB_WIDTH + 1));
150
152
  }
151
153
  function timelineMarker(text) {
152
154
  return `${" ".repeat(TIME_WIDTH)} ⋮ ${text}`;
@@ -165,10 +167,7 @@ function historyLayout() {
165
167
  return { ...compactLayout(), history: true };
166
168
  }
167
169
  function quotedBody(row) {
168
- return (row.kind === "said" ||
169
- row.kind === "thought" ||
170
- row.kind === "tell" ||
171
- (row.kind === "outcome" && row.outcome.kind === "answered"));
170
+ return row.kind === "thought" || row.kind === "tell" || (row.kind === "outcome" && row.outcome.kind === "answered");
172
171
  }
173
172
  function pathTail(path, maximum) {
174
173
  if (displayColumns(path) <= maximum)
@@ -258,7 +257,7 @@ function toolOverflowPreview(options, value, columns) {
258
257
  ];
259
258
  }
260
259
  function renderRow(row, context, options) {
261
- const { layout, first, continuation, tool, inFlightSay = false } = options;
260
+ const { layout, first, continuation, tool } = options;
262
261
  const value = rowText(row, tool);
263
262
  const overflow = toolOverflowPreview(options, value, context.columns);
264
263
  if (overflow !== undefined)
@@ -278,8 +277,7 @@ function renderRow(row, context, options) {
278
277
  : layout.history === true
279
278
  ? Number.MAX_SAFE_INTEGER
280
279
  : value.lines,
281
- quote: quotedBody(row) ? (layout.singleLine === true && row.kind !== "said" ? '"' : "“") : "",
282
- openQuote: row.kind === "said" && inFlightSay,
280
+ quote: quotedBody(row) ? (layout.singleLine === true ? '"' : "“") : "",
283
281
  truncated: "truncated" in row && row.truncated === true,
284
282
  });
285
283
  }
@@ -287,12 +285,12 @@ function renderTimelineRow(row, context, layout, time, options = {}) {
287
285
  const { inFlightSay = false, live = false, unsettled = false } = options;
288
286
  const tool = row.kind === "tool" ? toolRepr(row) : undefined;
289
287
  const glyph = inFlightSay ? (live ? "●" : "?") : unsettled ? "?" : mark(row, live);
288
+ const verb = label(row, tool);
290
289
  return renderRow(row, context, {
291
290
  layout,
292
- first: layout.head(time, glyph, label(row, tool), context.columns),
293
- continuation: layout.continuation(),
291
+ first: layout.head(time, glyph, verb, context.columns),
292
+ continuation: layout.continuation(verb),
294
293
  tool,
295
- inFlightSay,
296
294
  });
297
295
  }
298
296
  function groupedEntries(entries, context, layout = plainLayout(), options = {}) {
@@ -949,7 +947,6 @@ export function tellPayloadLines(text, context) {
949
947
  columns: context.columns,
950
948
  maxLines: 1,
951
949
  quote: '"',
952
- openQuote: false,
953
950
  truncated: false,
954
951
  });
955
952
  }
@@ -64,7 +64,6 @@ export function renderContractCatalogue(list) {
64
64
  columns: 100,
65
65
  maxLines: 3,
66
66
  quote: "“",
67
- openQuote: false,
68
67
  truncated: false,
69
68
  })),
70
69
  ];
@@ -100,7 +100,6 @@ function payload(label, text, context) {
100
100
  columns: context.columns,
101
101
  maxLines: 3,
102
102
  quote: "“",
103
- openQuote: false,
104
103
  truncated: false,
105
104
  });
106
105
  }
@@ -38,7 +38,6 @@ export declare function renderBoundedPayload(input: Readonly<{
38
38
  columns: number;
39
39
  maxLines: number;
40
40
  quote: string;
41
- openQuote: boolean;
42
41
  truncated: boolean;
43
42
  }>): readonly string[];
44
43
  export declare function quotedText(value: string): string;
@@ -186,7 +186,7 @@ export function renderBoundedPayload(input) {
186
186
  if (rest.length === 0 && !input.quote && index === 0)
187
187
  return [prefix.trimEnd()];
188
188
  const opening = input.quote && index === 0 ? input.quote : "";
189
- const closing = input.quote && !input.openQuote ? (input.quote === "“" ? "”" : input.quote) : "";
189
+ const closing = input.quote === "“" ? "”" : input.quote;
190
190
  const budget = Math.max(0, input.columns - displayColumns(prefix + opening + closing));
191
191
  if (budget === 0)
192
192
  return lines.length === 0 ? [prefix.trimEnd()] : lines;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrosheep/keiyaku",
3
- "version": "4.6.12",
3
+ "version": "4.6.13",
4
4
  "workspaces": [
5
5
  "plugins/square",
6
6
  "plugins/paseo/forwarder"
@@ -64,7 +64,7 @@
64
64
  "@earendil-works/pi-coding-agent": "*"
65
65
  },
66
66
  "devDependencies": {
67
- "@earendil-works/pi-coding-agent": "^1.0.0",
67
+ "@earendil-works/pi-coding-agent": "^1.4.0",
68
68
  "@getpaseo/plugin": "0.11.2",
69
69
  "@getpaseo/server": "0.11.2",
70
70
  "@types/cross-spawn": "^6.0.6",