@meistrari/agent-core 0.2.0-experimental.3 → 0.2.0-experimental.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meistrari/agent-core",
3
3
  "type": "module",
4
- "version": "0.2.0-experimental.3",
4
+ "version": "0.2.0-experimental.4",
5
5
  "packageManager": "bun@1.3.12",
6
6
  "description": "Shared contracts and runtime modules for Tela coding-agent sandboxes: agent protocol, supervisor wire protocol, resident supervisor, worker runtime client, and Claude/Codex harness adapters.",
7
7
  "license": "UNLICENSED",
@@ -741,7 +741,25 @@ export class ClaudeRun implements AgentRun {
741
741
  // Deliver first: on a prebound resume this is the run's first input, and the resolved
742
742
  // event must not precede the lifecycle events the init barrier emits.
743
743
  await this.applyProviderSettings(this.current)
744
- await this.deliverInput(toClaudeUserMessage({ prompt: resolved.prompt, mode: 'next', commandId: command.commandId }))
744
+ // The answer opens its turn as the user's input, correlated like a prompt: the turn it
745
+ // starts carries this command, and the answer is accepted as that turn's user message.
746
+ const clientMessageId = deriveMessageId(command.commandId)
747
+ const receipt = this.registerAcceptanceWaiter(clientMessageId)
748
+ this.eventMapperState.promptCommandByInputId.set(clientMessageId, command.commandId)
749
+ this.pendingMessages.set(command.commandId, { messageId: clientMessageId, mode: 'next', turnId: undefined, started: false })
750
+ this.commandByClientMessageId.set(clientMessageId, command.commandId)
751
+ try {
752
+ await this.deliverInput(toClaudeUserMessage({ prompt: resolved.prompt, mode: 'next', commandId: command.commandId }))
753
+ await receipt.promise
754
+ }
755
+ catch (error) {
756
+ if (error instanceof AgentNotAcceptedError)
757
+ this.eventMapperState.promptCommandByInputId.delete(clientMessageId)
758
+ throw error
759
+ }
760
+ finally {
761
+ this.acceptanceWaiters.delete(clientMessageId)
762
+ }
745
763
  if (resolved.event)
746
764
  this.pushEvent(resolved.event)
747
765
  this.userInputRequests.markDelivered(command.requestId)
@@ -1,6 +1,6 @@
1
1
  // Generated by scripts/write-provenance.ts. Do not edit by hand.
2
2
  export const generatedProvenance = {
3
- version: "0.2.0-experimental.3",
4
- sha: "fc83cb1529dd69c5b1e13367d6a0af8ae2fe9b9b",
5
- buildTime: "2026-09-28T14:11:01.435Z",
3
+ version: "0.2.0-experimental.4",
4
+ sha: "432a69b2d7243b7d5c6651229bf2f005e94afad7",
5
+ buildTime: "2026-09-29T14:26:10.056Z",
6
6
  } as const
@@ -1,6 +1,6 @@
1
1
  import type { AgentProvider, AgentRun } from '../agents'
2
2
  import type { AgentInputAttachmentPreparation } from '../agents/materialized-input-attachment'
3
- import type { AgentEvent, AgentProviderId } from '../protocol'
3
+ import type { AgentEvent, AgentPrompt, AgentProviderId } from '../protocol'
4
4
  import type { EphemeralCredentials, SessionBootstrapBody, SessionBootstrapGitToken } from '../supervisor-protocol/bootstrap'
5
5
  import type { WireSendPromptCommand } from '../supervisor-protocol/command-body'
6
6
  import type { WireEventBody } from '../supervisor-protocol/event-body'
@@ -62,11 +62,16 @@ export interface AgentSupervisorProviderFactoryOptions {
62
62
  rpc: SupervisorRpcClient
63
63
  }) => AgentProvider<'claude'> | AgentProvider<'codex'>
64
64
  bindingStore: AgentProviderBindingStore
65
+ /**
66
+ * Prepares a send-prompt's attachments before the provider sees it. It may also return the
67
+ * prompt the provider receives instead of the command's, for text the command could only
68
+ * reference (a message too long for a wire frame, fetched by the supervisor).
69
+ */
65
70
  prepareInputAttachments?: (input: {
66
71
  commandId: string
67
72
  command: WireSendPromptCommand
68
73
  signal: AbortSignal
69
- }) => Promise<AgentInputAttachmentPreparation | undefined>
74
+ }) => Promise<(AgentInputAttachmentPreparation & { prompt?: AgentPrompt }) | undefined>
70
75
  onSecretsRefreshed?: (input: {
71
76
  credentials?: EphemeralCredentials
72
77
  gitToken?: SessionBootstrapGitToken
@@ -194,7 +199,7 @@ class AgentSupervisorRuntime implements SupervisorAgentRuntime {
194
199
  model: input.body.model,
195
200
  reasoningEffort: input.body.reasoningEffort,
196
201
  origin: 'user',
197
- prompt: input.body.prompt,
202
+ prompt: inputAttachmentPreparation?.prompt ?? input.body.prompt,
198
203
  author: input.body.user
199
204
  ? {
200
205
  name: input.body.user.name,