@springbrand/agent-runtime 0.2.0-alpha.20 → 0.2.0-alpha.21

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@springbrand/agent-runtime",
3
- "version": "0.2.0-alpha.20",
3
+ "version": "0.2.0-alpha.21",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src",
@@ -39,6 +39,7 @@ export interface NewApproval {
39
39
 
40
40
  export interface PendingApprovalSummary {
41
41
  executionId: string;
42
+ toolCallId: string;
42
43
  source: string;
43
44
  toolName: string;
44
45
  summary: string;
@@ -189,6 +190,7 @@ export class ApprovalRepository {
189
190
  listPendingActive(): PendingApprovalSummary[] {
190
191
  return this.sql<{
191
192
  execution_id: string;
193
+ tool_call_id: string;
192
194
  source: string;
193
195
  tool_name: string;
194
196
  summary: string;
@@ -197,7 +199,7 @@ export class ApprovalRepository {
197
199
  input_json: string;
198
200
  request_id: string;
199
201
  }>`
200
- SELECT approval.execution_id, approval.source,
202
+ SELECT approval.execution_id, approval.tool_call_id, approval.source,
201
203
  approval.tool_name, approval.summary,
202
204
  approval.execution_level, approval.required_level,
203
205
  approval.input_json, approval.request_id
@@ -209,6 +211,7 @@ export class ApprovalRepository {
209
211
  ORDER BY approval.created_at ASC
210
212
  `.map((row) => ({
211
213
  executionId: row.execution_id,
214
+ toolCallId: row.tool_call_id,
212
215
  source: row.source,
213
216
  toolName: row.tool_name,
214
217
  summary: row.summary,
@@ -158,6 +158,7 @@ export class ApprovalLifecycle<
158
158
  list(): ApprovalReceipt[] {
159
159
  return this.options.db.approvals.listPendingActive().map((row) => ({
160
160
  executionId: row.executionId,
161
+ toolCallId: row.toolCallId,
161
162
  source: row.source as ApprovalReceipt["source"],
162
163
  action: row.toolName,
163
164
  summary: row.summary,
@@ -24,6 +24,8 @@ export const APPROVAL_DECISIONS = [
24
24
  */
25
25
  export interface ApprovalReceipt {
26
26
  executionId: string;
27
+ /** Tool call that owns this approval; absent for non-tool approval sources. */
28
+ toolCallId?: string;
27
29
  source: "action" | "codemode" | "temporary-agent";
28
30
  action: string;
29
31
  summary: string;
@@ -21,19 +21,7 @@ function attachmentText(
21
21
  part: Extract<UIMessage["parts"][number], { type: "file" }>,
22
22
  ): string {
23
23
  const name = part.filename?.trim() || "attachment";
24
- let ref: string | null = null;
25
- try {
26
- const path = part.url.startsWith("/")
27
- ? new URL(part.url, "https://attachment.invalid").pathname
28
- : new URL(part.url).pathname;
29
- const leaf = path.split("/").filter(Boolean).at(-1);
30
- if (/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u.test(leaf ?? "")) {
31
- ref = leaf!;
32
- }
33
- } catch {
34
- // Preserve the existing canonical form for non-platform file URLs.
35
- }
36
- return `[Attachment: ${name} (${part.mediaType}) ${ref ? `ref=${ref}` : part.url}]`;
24
+ return `[Attachment: ${name} (${part.mediaType}) path=${part.url}]`;
37
25
  }
38
26
 
39
27
  function userContent(
package/src/runtime.ts CHANGED
@@ -1890,7 +1890,7 @@ export abstract class AgentRuntimeKernel<
1890
1890
  const submitted = await this.submissions.submit(
1891
1891
  this.submissionInput(userMessage, options),
1892
1892
  );
1893
- await this.drainRuntimeEvents();
1893
+ this.ctx.waitUntil(this.drainRuntimeEvents());
1894
1894
  await this.broadcastApprovals();
1895
1895
  return submitted;
1896
1896
  }