agent-tempo 1.6.2 → 1.7.0-beta.0

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,7 +1,7 @@
1
1
  {
2
2
  "name": "agent-tempo-dashboard",
3
3
  "private": true,
4
- "version": "1.6.2",
4
+ "version": "1.7.0-beta.0",
5
5
  "type": "module",
6
6
  "description": "Web dashboard for agent-tempo. Bundled into the npm package; served by the daemon at /dashboard/*.",
7
7
  "scripts": {
@@ -188,6 +188,34 @@ function createPiExtension(options = {}) {
188
188
  };
189
189
  (0, render_tools_1.renderToPi)(pi, (0, server_tools_1.buildAllTempoTools)(toolOpts));
190
190
  log(`registered tools (player=${currentPlayerId}, conductor=${isConductor}, mode=${mode})`);
191
+ // ── #698 — FULL server-instruction preamble into the Pi system prompt ──
192
+ // The Pi equivalent of MCP players' `buildServerInstructions` (#695 S2 seeded
193
+ // this hook with just the 4 yield-norms; #698 widens it to the WHOLE preamble —
194
+ // identity, cue/report/recruit guidance, Communication-discipline, and the
195
+ // conductor/player operational rules). SINGLE-SOURCED off `buildServerInstructions`
196
+ // so MCP + Pi guidance can't drift; the yield-norms now arrive FOLDED IN (they
197
+ // live inside that builder since #695 S1), so there is no separate const.
198
+ // `before_agent_start` exposes the fully-assembled systemPrompt and accepts a
199
+ // replacement (chained across extensions), so we APPEND — injected into the
200
+ // model's system prompt every turn, invisibly (NOT a sendMessage, which would
201
+ // spam the transcript). Applies to ALL Pi players (interactive + headless).
202
+ //
203
+ // Opts are built PER FIRE (before_agent_start fires every turn): playerId and
204
+ // hasRequestedName must reflect CURRENT state, so a `set_name`-renamed player
205
+ // gets the right identity rather than the boot-time one.
206
+ const piInstructionOpts = () => ({
207
+ ensemble: config.ensemble,
208
+ playerId: toolOpts.getPlayerId(),
209
+ isConductor,
210
+ playerType: process.env[config_1.ENV.PLAYER_TYPE] || undefined,
211
+ // playerTypeDescription omitted (MVP — not threaded into the Pi runtime).
212
+ hasRequestedName: Boolean(process.env[config_1.ENV.PLAYER_NAME]),
213
+ });
214
+ // Cast mirrors the tool_call returning-handler pattern (the shim's `on` is
215
+ // void-typed; the real ExtensionAPI before_agent_start handler returns a result).
216
+ pi.on('before_agent_start', (ev) => ({
217
+ systemPrompt: `${ev.systemPrompt ?? ''}\n\n${(0, server_tools_1.buildServerInstructions)(piInstructionOpts())}`,
218
+ }));
191
219
  // ── #677 PART B — interactive-only `/tempo-reset` command ──
192
220
  // Pi's `newSession` (clean-wipe) is ExtensionCommandContext-ONLY (not on the
193
221
  // SDK session), so an interactive Pi conductor can ONLY be reset by the operator
@@ -191,6 +191,24 @@ export interface PiToolCallResult {
191
191
  block?: boolean;
192
192
  reason?: string;
193
193
  }
194
+ /**
195
+ * `before_agent_start` payload (#695). Pi fires this after the user prompt is
196
+ * assembled but before the agent loop; it carries the fully-built `systemPrompt`.
197
+ * A handler returns {@link PiBeforeAgentStartResult} to replace it. We read only
198
+ * `systemPrompt` (to append the yield norms); kept open for forward-compat.
199
+ */
200
+ export interface PiBeforeAgentStartEvent {
201
+ /** The fully-assembled system prompt string for this turn. */
202
+ systemPrompt?: string;
203
+ }
204
+ /**
205
+ * Result of a `before_agent_start` handler (#695). Returning `systemPrompt`
206
+ * REPLACES the system prompt for the turn ("If multiple extensions return this,
207
+ * they are chained" — Pi 0.78). We append the yield norms and return it.
208
+ */
209
+ export interface PiBeforeAgentStartResult {
210
+ systemPrompt?: string;
211
+ }
194
212
  /**
195
213
  * Pi tool result — a Pi-free structural mirror of the real `AgentToolResult`
196
214
  * (#653, 1.4.2). The Phase-0 `{ output, isError }` guess was WRONG: Pi's real
@@ -138,6 +138,11 @@ function buildServerInstructions(opts) {
138
138
  `Use \`report\` to notify the conductor of task completion, blockers, or questions — always report when you finish a recruited task.` +
139
139
  `\n\nCommunication discipline:\n` +
140
140
  `- Drafting a response in your turn is not the same as sending one. The conductor and other players cannot read your reasoning — only your \`cue\` and \`report\` tool calls cross the channel boundary. If you reach a decision, ruling, or status update, fire the appropriate tool before moving on. If you find yourself thinking "I already answered that," verify the tool was actually invoked.` +
141
+ // #695 — yield-don't-poll norms (apply to all MCP players).
142
+ `\n- Yield after dispatch — after cueing a player and expecting a reply, end your turn. Inbound cues wake you automatically at the next turn boundary; there is nothing to poll.` +
143
+ `\n- \`listen\` is a one-shot inbox drain, not a wait primitive — it reads whatever is already queued at call time. A \`sleep\`+\`listen\` loop does not work as a wait and is an anti-pattern that burns tokens across the ensemble. If you're waiting for a reply, end your turn.` +
144
+ `\n- Don't reply to ack/FYI cues — if a player sends a status update or acknowledgment without asking a question or requesting action, do not respond. Responding starts a ping-pong that wastes turns on both sides.` +
145
+ `\n- Cues queue, they don't interrupt — a cue sent to you while you're processing arrives at your next turn boundary, not mid-turn. A burst from multiple players arrives together; process the batch in one turn.` +
141
146
  (isConductor
142
147
  ? `\n\nOperational rules:\n` +
143
148
  `- Before assigning parallel work on different branches, provision git worktrees via the \`worktree\` tool so each player has an isolated checkout.\n` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-tempo",
3
- "version": "1.6.2",
3
+ "version": "1.7.0-beta.0",
4
4
  "description": "Many agents, one tempo. Durable coordination for multi-agent work via Temporal.",
5
5
  "keywords": [
6
6
  "mcp",