@get-bb/plugin-sdk 0.6.16 → 0.6.23

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.
@@ -178,11 +178,15 @@ var promptInputSchema = z3.discriminatedUnion("type", [
178
178
  z3.object({
179
179
  type: z3.literal("localImage"),
180
180
  path: z3.string(),
181
+ sourceProjectId: z3.string().min(1).optional(),
182
+ hostId: z3.string().min(1).optional(),
181
183
  ...promptInputVisibilityFields
182
184
  }),
183
185
  z3.object({
184
186
  type: z3.literal("localFile"),
185
187
  path: z3.string(),
188
+ sourceProjectId: z3.string().min(1).optional(),
189
+ hostId: z3.string().min(1).optional(),
186
190
  name: z3.string().optional(),
187
191
  sizeBytes: z3.number().int().nonnegative().optional(),
188
192
  mimeType: z3.string().optional(),
@@ -6536,6 +6540,26 @@ var PARITY_INITIALIZE_ID = "parity-initialize";
6536
6540
  function sleep(ms) {
6537
6541
  return new Promise((resolveSleep) => setTimeout(resolveSleep, ms));
6538
6542
  }
6543
+ var REPLAY_STARTUP_CONCURRENCY = 4;
6544
+ var replayStartupQueue = [];
6545
+ var startingReplays = 0;
6546
+ async function acquireReplayStartup() {
6547
+ if (startingReplays < REPLAY_STARTUP_CONCURRENCY) {
6548
+ startingReplays += 1;
6549
+ } else {
6550
+ await new Promise(
6551
+ (resolveSlot) => replayStartupQueue.push(resolveSlot)
6552
+ );
6553
+ }
6554
+ let released = false;
6555
+ return () => {
6556
+ if (released) return;
6557
+ released = true;
6558
+ const next = replayStartupQueue.shift();
6559
+ if (next === void 0) startingReplays -= 1;
6560
+ else next();
6561
+ };
6562
+ }
6539
6563
  async function replayRecording(options) {
6540
6564
  const timeoutMs = options.timeoutMs ?? 15e3;
6541
6565
  const orderTimeoutMs = options.orderTimeoutMs ?? 5e3;
@@ -6578,275 +6602,313 @@ async function replayRecording(options) {
6578
6602
  );
6579
6603
  profile.prepareState?.({ recording, stateDir, workspaceDir });
6580
6604
  const launch = options.bridge;
6581
- const child = spawn(launch.command, launch.args, {
6582
- cwd: launch.cwd,
6583
- env: {
6584
- ...process.env,
6585
- ...launch.env,
6586
- ...profile.env({ replayCommand, wrapperPath, stateDir })
6587
- },
6588
- stdio: ["pipe", "pipe", "pipe"]
6589
- });
6590
- const recordedCwd = recordedWorkspaceDir(recording);
6591
- const jsonText = (value) => JSON.stringify(value).slice(1, -1);
6592
- const restoreRecordedWorkspace = (line) => recordedCwd === null || recordedCwd === workspaceDir ? line : line.split(jsonText(workspaceDir)).join(jsonText(recordedCwd));
6593
- const initializeId = PARITY_INITIALIZE_ID;
6594
- const startedAt = Date.now();
6595
- const lines = [];
6596
- const lineTimes = [];
6597
- const lineAfter = [];
6598
- let lastSentRuntimeEntry = null;
6599
- const events = [];
6600
- const grammarViolations = [];
6601
- const stalls = [];
6602
- let stderr = "";
6603
- const grammar = new ThreadEventGrammar();
6604
- const liveAssembler = options.createAssembler(providerId);
6605
- const planAssembler = (options.createPlanAssembler ?? options.createAssembler)(providerId);
6606
- const exactPlan = options.planFromCurrentLane === true;
6607
- const planRecording = exactPlan ? withCurrentBridgeLane(recording) : recording;
6608
- const steps = planRuntimeSteps(planRecording, planAssembler);
6609
- const plannedEventCount = exactPlan ? assembleRecordedEvents(
6610
- planRecording,
6611
- options.createPlanAssembler ?? options.createAssembler,
6612
- providerId
6613
- ).events.length : null;
6614
- const answeredIds = /* @__PURE__ */ new Set();
6615
- const pendingBridgeRequests = [];
6616
- const recordedAnswers = /* @__PURE__ */ new Map();
6617
- for (const step of steps) {
6618
- if (step.message !== null && isResponse(step.message)) {
6619
- const method = methodOfRecordedBridgeRequest(
6620
- recording,
6621
- step.entry,
6622
- step.message.id
6623
- ) ?? "?";
6624
- const queue = recordedAnswers.get(method) ?? [];
6625
- queue.push(step.message);
6626
- recordedAnswers.set(method, queue);
6627
- }
6628
- }
6629
- let lastOutputAt = Date.now();
6630
- const exited = new Promise((resolveExit) => {
6631
- child.on("exit", (code) => resolveExit(code));
6632
- });
6633
- child.stderr?.setEncoding("utf8").on("data", (chunk) => {
6634
- stderr += chunk;
6635
- options.onStderr?.(chunk);
6636
- });
6637
- function write(line) {
6638
- if (child.stdin?.writable) {
6639
- child.stdin.write(`${line}
6605
+ const releaseStartup = await acquireReplayStartup();
6606
+ let spawnedChild;
6607
+ let childEnded;
6608
+ try {
6609
+ let write2 = function(line) {
6610
+ if (child.stdin?.writable) {
6611
+ child.stdin.write(`${line}
6640
6612
  `);
6641
- }
6642
- }
6643
- function answerBridgeRequest(message) {
6644
- const method = message.method ?? "?";
6645
- const queue = recordedAnswers.get(method);
6646
- const recorded = queue?.shift();
6647
- if (recorded === void 0) {
6648
- stalls.push(
6649
- `no recorded answer for bridge request ${method} (${String(message.id)})`
6650
- );
6651
- write(
6652
- JSON.stringify({
6653
- jsonrpc: "2.0",
6654
- id: message.id,
6655
- error: { code: -32e3, message: "parity replay: no recorded answer" }
6656
- })
6657
- );
6658
- return;
6659
- }
6660
- write(JSON.stringify({ ...recorded, id: message.id }));
6661
- }
6662
- readBoundedLines({
6663
- input: child.stdout,
6664
- onLine: (rawLine) => {
6665
- const line = restoreRecordedWorkspace(rawLine);
6666
- lastOutputAt = Date.now();
6667
- lines.push(line);
6668
- lineTimes.push(lastOutputAt - startedAt);
6669
- lineAfter.push(lastSentRuntimeEntry);
6670
- const message = parseWire(line);
6671
- if (message === null) return;
6672
- if (isResponse(message)) {
6673
- answeredIds.add(String(message.id));
6674
- return;
6675
6613
  }
6676
- if (isRequest(message)) {
6677
- pendingBridgeRequests.push({
6678
- id: message.id,
6679
- method: message.method
6680
- });
6681
- answerBridgeRequest(message);
6614
+ }, answerBridgeRequest2 = function(message) {
6615
+ const method = message.method ?? "?";
6616
+ const queue = recordedAnswers.get(method);
6617
+ const recorded = queue?.shift();
6618
+ if (recorded === void 0) {
6619
+ stalls.push(
6620
+ `no recorded answer for bridge request ${method} (${String(message.id)})`
6621
+ );
6622
+ write2(
6623
+ JSON.stringify({
6624
+ jsonrpc: "2.0",
6625
+ id: message.id,
6626
+ error: {
6627
+ code: -32e3,
6628
+ message: "parity replay: no recorded answer"
6629
+ }
6630
+ })
6631
+ );
6682
6632
  return;
6683
6633
  }
6684
- if (message.method === THREAD_DELTA_NOTIFICATION_METHOD) {
6685
- let assembled;
6686
- try {
6687
- assembled = liveAssembler.assembleMessage(message);
6688
- } catch (error) {
6689
- stalls.push(
6690
- `invalid thread/delta: ${error instanceof Error ? error.message : String(error)}`
6691
- );
6634
+ write2(JSON.stringify({ ...recorded, id: message.id }));
6635
+ };
6636
+ var write = write2, answerBridgeRequest = answerBridgeRequest2;
6637
+ const child = spawn(launch.command, launch.args, {
6638
+ cwd: launch.cwd,
6639
+ env: {
6640
+ ...process.env,
6641
+ ...launch.env,
6642
+ ...profile.env({ replayCommand, wrapperPath, stateDir })
6643
+ },
6644
+ stdio: ["pipe", "pipe", "pipe"]
6645
+ });
6646
+ spawnedChild = child;
6647
+ childEnded = new Promise((resolveEnded) => {
6648
+ const onEnded = () => {
6649
+ releaseStartup();
6650
+ resolveEnded();
6651
+ };
6652
+ child.once("exit", onEnded);
6653
+ child.once("error", onEnded);
6654
+ });
6655
+ const recordedCwd = recordedWorkspaceDir(recording);
6656
+ const jsonText = (value) => JSON.stringify(value).slice(1, -1);
6657
+ const restoreRecordedWorkspace = (line) => recordedCwd === null || recordedCwd === workspaceDir ? line : line.split(jsonText(workspaceDir)).join(jsonText(recordedCwd));
6658
+ const initializeId = PARITY_INITIALIZE_ID;
6659
+ const startedAt = Date.now();
6660
+ const lines = [];
6661
+ const lineTimes = [];
6662
+ const lineAfter = [];
6663
+ let lastSentRuntimeEntry = null;
6664
+ const events = [];
6665
+ const grammarViolations = [];
6666
+ const stalls = [];
6667
+ let stderr = "";
6668
+ const grammar = new ThreadEventGrammar();
6669
+ const liveAssembler = options.createAssembler(providerId);
6670
+ const planAssembler = (options.createPlanAssembler ?? options.createAssembler)(providerId);
6671
+ const exactPlan = options.planFromCurrentLane === true;
6672
+ const planRecording = exactPlan ? withCurrentBridgeLane(recording) : recording;
6673
+ const steps = planRuntimeSteps(planRecording, planAssembler);
6674
+ const plannedEventCount = exactPlan ? assembleRecordedEvents(
6675
+ planRecording,
6676
+ options.createPlanAssembler ?? options.createAssembler,
6677
+ providerId
6678
+ ).events.length : null;
6679
+ const answeredIds = /* @__PURE__ */ new Set();
6680
+ const pendingBridgeRequests = [];
6681
+ const recordedAnswers = /* @__PURE__ */ new Map();
6682
+ for (const step of steps) {
6683
+ if (step.message !== null && isResponse(step.message)) {
6684
+ const method = methodOfRecordedBridgeRequest(
6685
+ recording,
6686
+ step.entry,
6687
+ step.message.id
6688
+ ) ?? "?";
6689
+ const queue = recordedAnswers.get(method) ?? [];
6690
+ queue.push(step.message);
6691
+ recordedAnswers.set(method, queue);
6692
+ }
6693
+ }
6694
+ let lastOutputAt = Date.now();
6695
+ const exited = new Promise((resolveExit) => {
6696
+ child.on("exit", (code) => resolveExit(code));
6697
+ child.on("error", (error) => {
6698
+ stalls.push(`bridge spawn failed: ${error.message}`);
6699
+ resolveExit(null);
6700
+ });
6701
+ });
6702
+ child.stderr?.setEncoding("utf8").on("data", (chunk) => {
6703
+ stderr += chunk;
6704
+ options.onStderr?.(chunk);
6705
+ });
6706
+ readBoundedLines({
6707
+ input: child.stdout,
6708
+ onLine: (rawLine) => {
6709
+ const line = restoreRecordedWorkspace(rawLine);
6710
+ lastOutputAt = Date.now();
6711
+ lines.push(line);
6712
+ lineTimes.push(lastOutputAt - startedAt);
6713
+ lineAfter.push(lastSentRuntimeEntry);
6714
+ const message = parseWire(line);
6715
+ if (message === null) return;
6716
+ if (isResponse(message)) {
6717
+ answeredIds.add(String(message.id));
6692
6718
  return;
6693
6719
  }
6694
- for (const event of assembled) {
6695
- const result2 = grammar.observe(event);
6696
- if (result2.kind === "violation") {
6697
- grammarViolations.push({
6698
- rule: result2.rule,
6699
- reason: result2.reason,
6700
- eventType: event.type
6701
- });
6702
- continue;
6720
+ if (isRequest(message)) {
6721
+ pendingBridgeRequests.push({
6722
+ id: message.id,
6723
+ method: message.method
6724
+ });
6725
+ answerBridgeRequest2(message);
6726
+ return;
6727
+ }
6728
+ if (message.method === THREAD_DELTA_NOTIFICATION_METHOD) {
6729
+ let assembled;
6730
+ try {
6731
+ assembled = liveAssembler.assembleMessage(message);
6732
+ } catch (error) {
6733
+ stalls.push(
6734
+ `invalid thread/delta: ${error instanceof Error ? error.message : String(error)}`
6735
+ );
6736
+ return;
6737
+ }
6738
+ for (const event of assembled) {
6739
+ const result2 = grammar.observe(event);
6740
+ if (result2.kind === "violation") {
6741
+ grammarViolations.push({
6742
+ rule: result2.rule,
6743
+ reason: result2.reason,
6744
+ eventType: event.type
6745
+ });
6746
+ continue;
6747
+ }
6748
+ events.push(event);
6703
6749
  }
6704
- events.push(event);
6705
6750
  }
6751
+ },
6752
+ onOverflow: (bytes) => {
6753
+ stalls.push(`oversized bridge line (${bytes} bytes)`);
6706
6754
  }
6707
- },
6708
- onOverflow: (bytes) => {
6709
- stalls.push(`oversized bridge line (${bytes} bytes)`);
6710
- }
6711
- });
6712
- async function waitFor(label, predicate, limitMs = timeoutMs, reportStall = true) {
6713
- const deadline = Date.now() + limitMs;
6714
- while (!predicate()) {
6715
- if (child.exitCode !== null) {
6716
- stalls.push(`bridge exited while waiting for ${label}`);
6717
- return;
6718
- }
6719
- if (Date.now() > deadline) {
6720
- if (reportStall) stalls.push(`timed out waiting for ${label}`);
6721
- return;
6755
+ });
6756
+ async function waitFor(label, predicate, limitMs = timeoutMs, reportStall = true) {
6757
+ const deadline = Date.now() + limitMs;
6758
+ while (!predicate()) {
6759
+ if (child.exitCode !== null || child.signalCode !== null || child.pid === void 0) {
6760
+ stalls.push(`bridge exited while waiting for ${label}`);
6761
+ return;
6762
+ }
6763
+ if (Date.now() > deadline) {
6764
+ if (reportStall) stalls.push(`timed out waiting for ${label}`);
6765
+ return;
6766
+ }
6767
+ await sleep(10);
6722
6768
  }
6723
- await sleep(10);
6724
6769
  }
6725
- }
6726
- const firstStep = steps.find(
6727
- (step) => step.message !== null && isRequest(step.message)
6728
- );
6729
- setCursor(
6730
- firstStep === void 0 ? "end" : { run: firstStep.entry.run, seq: firstStep.entry.seq }
6731
- );
6732
- write(
6733
- JSON.stringify({
6734
- jsonrpc: "2.0",
6735
- id: initializeId,
6736
- method: "initialize",
6737
- params: {
6738
- protocolVersion: PROVIDER_BRIDGE_PROTOCOL_VERSION,
6739
- client: { name: "bb-parity", version: "0" }
6770
+ const firstStep = steps.find(
6771
+ (step) => step.message !== null && isRequest(step.message)
6772
+ );
6773
+ setCursor(
6774
+ firstStep === void 0 ? "end" : { run: firstStep.entry.run, seq: firstStep.entry.seq }
6775
+ );
6776
+ write2(
6777
+ JSON.stringify({
6778
+ jsonrpc: "2.0",
6779
+ id: initializeId,
6780
+ method: "initialize",
6781
+ params: {
6782
+ protocolVersion: PROVIDER_BRIDGE_PROTOCOL_VERSION,
6783
+ client: { name: "bb-parity", version: "0" }
6784
+ }
6785
+ })
6786
+ );
6787
+ await waitFor("initialize response", () => answeredIds.has(initializeId));
6788
+ const initialized = answeredIds.has(initializeId);
6789
+ if (!initialized) {
6790
+ if (child.pid !== void 0 && child.exitCode === null && child.signalCode === null)
6791
+ child.kill("SIGKILL");
6792
+ await childEnded;
6793
+ }
6794
+ releaseStartup();
6795
+ const sentRequestIds = [];
6796
+ for (const step of initialized ? steps : []) {
6797
+ if (step.message === null || !isRequest(step.message)) {
6798
+ if (step.message !== null && !isResponse(step.message)) {
6799
+ lastSentRuntimeEntry = {
6800
+ run: step.entry.run,
6801
+ seq: step.entry.seq,
6802
+ ts: step.entry.ts
6803
+ };
6804
+ write2(step.entry.line);
6805
+ }
6806
+ continue;
6740
6807
  }
6741
- })
6742
- );
6743
- await waitFor("initialize response", () => answeredIds.has(initializeId));
6744
- const sentRequestIds = [];
6745
- for (const step of steps) {
6746
- if (step.message === null || !isRequest(step.message)) {
6747
- if (step.message !== null && !isResponse(step.message)) {
6748
- lastSentRuntimeEntry = {
6749
- run: step.entry.run,
6750
- seq: step.entry.seq,
6751
- ts: step.entry.ts
6752
- };
6753
- write(step.entry.line);
6808
+ const request = step.message;
6809
+ const method = request.method;
6810
+ await waitFor(
6811
+ `earlier requests before ${method}`,
6812
+ () => sentRequestIds.every((id) => answeredIds.has(id))
6813
+ );
6814
+ await waitFor(
6815
+ `${step.gate.started} turn/started and ${step.gate.completed} turn/completed before ${method}`,
6816
+ () => {
6817
+ const live = countTurns(events);
6818
+ return live.started >= step.gate.started && live.completed >= step.gate.completed;
6819
+ }
6820
+ );
6821
+ await waitFor(
6822
+ `${step.eventsBefore} events before ${method}`,
6823
+ () => events.length >= step.eventsBefore || !exactPlan && Date.now() - lastOutputAt >= orderTimeoutMs,
6824
+ timeoutMs,
6825
+ exactPlan
6826
+ );
6827
+ await waitFor(
6828
+ `the stream to drain before ${method}`,
6829
+ () => Date.now() - lastOutputAt >= drainMs,
6830
+ timeoutMs,
6831
+ false
6832
+ );
6833
+ if (child.exitCode !== null) break;
6834
+ if (method === "thread/stop" && typeof request.params === "object" && request.params !== null && request.params.intent === "release") {
6835
+ const threadId = request.params.threadId;
6836
+ if (typeof threadId === "string") grammar.clearThread(threadId);
6754
6837
  }
6755
- continue;
6838
+ const rewritten = rewriteRecordedMachineFacts(
6839
+ step.entry.line,
6840
+ workspaceDir
6841
+ );
6842
+ const line = profile.rewriteRuntimeLine === void 0 ? rewritten : profile.rewriteRuntimeLine(rewritten, { replayCommand });
6843
+ lastSentRuntimeEntry = {
6844
+ run: step.entry.run,
6845
+ seq: step.entry.seq,
6846
+ ts: step.entry.ts
6847
+ };
6848
+ write2(line);
6849
+ sentRequestIds.push(String(request.id));
6850
+ const nextStep = steps.slice(steps.indexOf(step) + 1).find(
6851
+ (candidate) => candidate.message !== null && isRequest(candidate.message)
6852
+ );
6853
+ setCursor(
6854
+ nextStep === void 0 ? "end" : { run: nextStep.entry.run, seq: nextStep.entry.seq }
6855
+ );
6756
6856
  }
6757
- const request = step.message;
6758
- const method = request.method;
6857
+ setCursor("end");
6759
6858
  await waitFor(
6760
- `earlier requests before ${method}`,
6859
+ "the last responses",
6761
6860
  () => sentRequestIds.every((id) => answeredIds.has(id))
6762
6861
  );
6763
- await waitFor(
6764
- `${step.gate.started} turn/started and ${step.gate.completed} turn/completed before ${method}`,
6765
- () => {
6766
- const live = countTurns(events);
6767
- return live.started >= step.gate.started && live.completed >= step.gate.completed;
6768
- }
6769
- );
6770
- await waitFor(
6771
- `${step.eventsBefore} events before ${method}`,
6772
- () => events.length >= step.eventsBefore || !exactPlan && Date.now() - lastOutputAt >= orderTimeoutMs,
6773
- timeoutMs,
6774
- exactPlan
6775
- );
6776
- await waitFor(
6777
- `the stream to drain before ${method}`,
6778
- () => Date.now() - lastOutputAt >= drainMs,
6779
- timeoutMs,
6780
- false
6781
- );
6782
- if (child.exitCode !== null) break;
6783
- if (method === "thread/stop" && typeof request.params === "object" && request.params !== null && request.params.intent === "release") {
6784
- const threadId = request.params.threadId;
6785
- if (typeof threadId === "string") grammar.clearThread(threadId);
6862
+ if (plannedEventCount !== null) {
6863
+ await waitFor(
6864
+ `all ${plannedEventCount} planned events before closing the bridge`,
6865
+ () => events.length >= plannedEventCount
6866
+ );
6786
6867
  }
6787
- const rewritten = rewriteRecordedMachineFacts(
6788
- step.entry.line,
6789
- workspaceDir
6790
- );
6791
- const line = profile.rewriteRuntimeLine === void 0 ? rewritten : profile.rewriteRuntimeLine(rewritten, { replayCommand });
6792
- lastSentRuntimeEntry = {
6793
- run: step.entry.run,
6794
- seq: step.entry.seq,
6795
- ts: step.entry.ts
6796
- };
6797
- write(line);
6798
- sentRequestIds.push(String(request.id));
6799
- const nextStep = steps.slice(steps.indexOf(step) + 1).find(
6800
- (candidate) => candidate.message !== null && isRequest(candidate.message)
6801
- );
6802
- setCursor(
6803
- nextStep === void 0 ? "end" : { run: nextStep.entry.run, seq: nextStep.entry.seq }
6804
- );
6805
- }
6806
- setCursor("end");
6807
- await waitFor(
6808
- "the last responses",
6809
- () => sentRequestIds.every((id) => answeredIds.has(id))
6810
- );
6811
- if (plannedEventCount !== null) {
6812
6868
  await waitFor(
6813
- `all ${plannedEventCount} planned events before closing the bridge`,
6814
- () => events.length >= plannedEventCount
6869
+ "the stream to settle",
6870
+ () => Date.now() - lastOutputAt >= settleMs
6815
6871
  );
6872
+ child.stdin?.end();
6873
+ let shutdownTimer;
6874
+ const exitCode = await Promise.race([
6875
+ exited,
6876
+ new Promise((resolveTimeout) => {
6877
+ shutdownTimer = setTimeout(() => {
6878
+ stalls.push("bridge did not exit after stdin closed; killed");
6879
+ child.kill("SIGKILL");
6880
+ resolveTimeout(null);
6881
+ }, timeoutMs);
6882
+ })
6883
+ ]);
6884
+ clearTimeout(shutdownTimer);
6885
+ return {
6886
+ providerId,
6887
+ recordingDir: options.recordingDir,
6888
+ lines,
6889
+ lineTimes,
6890
+ lineAfter,
6891
+ events,
6892
+ grammarViolations,
6893
+ stalls,
6894
+ stderr,
6895
+ exitCode
6896
+ };
6897
+ } finally {
6898
+ if (spawnedChild !== void 0 && spawnedChild.pid !== void 0 && spawnedChild.exitCode === null && spawnedChild.signalCode === null) {
6899
+ spawnedChild.kill("SIGKILL");
6900
+ await childEnded;
6901
+ }
6902
+ releaseStartup();
6903
+ for (const directory of [stateDir, workspaceDir]) {
6904
+ await rm(directory, {
6905
+ force: true,
6906
+ maxRetries: REPLAY_CLEANUP_RETRIES,
6907
+ recursive: true,
6908
+ retryDelay: REPLAY_CLEANUP_RETRY_DELAY_MS
6909
+ });
6910
+ }
6816
6911
  }
6817
- await waitFor(
6818
- "the stream to settle",
6819
- () => Date.now() - lastOutputAt >= settleMs
6820
- );
6821
- child.stdin?.end();
6822
- const exitCode = await Promise.race([
6823
- exited,
6824
- sleep(timeoutMs).then(() => {
6825
- stalls.push("bridge did not exit after stdin closed; killed");
6826
- child.kill("SIGKILL");
6827
- return null;
6828
- })
6829
- ]);
6830
- for (const directory of [stateDir, workspaceDir]) {
6831
- await rm(directory, {
6832
- force: true,
6833
- maxRetries: REPLAY_CLEANUP_RETRIES,
6834
- recursive: true,
6835
- retryDelay: REPLAY_CLEANUP_RETRY_DELAY_MS
6836
- });
6837
- }
6838
- return {
6839
- providerId,
6840
- recordingDir: options.recordingDir,
6841
- lines,
6842
- lineTimes,
6843
- lineAfter,
6844
- events,
6845
- grammarViolations,
6846
- stalls,
6847
- stderr,
6848
- exitCode
6849
- };
6850
6912
  }
6851
6913
  function assembleRecordedEvents(recording, createAssembler, providerId) {
6852
6914
  const assembler = createAssembler(providerId);
@@ -563,6 +563,11 @@ import { execFile } from "node:child_process";
563
563
  import { promisify } from "node:util";
564
564
  var execFileAsync = promisify(execFile);
565
565
 
566
+ // ../process-utils/src/performance-diagnostics.ts
567
+ import { Session } from "node:inspector/promises";
568
+ var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
569
+ var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
570
+
566
571
  // ../provider-bridge-protocol/src/bridge-kit/bounded-line-reader.ts
567
572
  import { StringDecoder } from "node:string_decoder";
568
573
  var MAX_JSON_RPC_LINE_BYTES = 64 * 1024 * 1024;
@@ -1236,11 +1236,15 @@ var promptInputSchema = z5.discriminatedUnion("type", [
1236
1236
  z5.object({
1237
1237
  type: z5.literal("localImage"),
1238
1238
  path: z5.string(),
1239
+ sourceProjectId: z5.string().min(1).optional(),
1240
+ hostId: z5.string().min(1).optional(),
1239
1241
  ...promptInputVisibilityFields
1240
1242
  }),
1241
1243
  z5.object({
1242
1244
  type: z5.literal("localFile"),
1243
1245
  path: z5.string(),
1246
+ sourceProjectId: z5.string().min(1).optional(),
1247
+ hostId: z5.string().min(1).optional(),
1244
1248
  name: z5.string().optional(),
1245
1249
  sizeBytes: z5.number().int().nonnegative().optional(),
1246
1250
  mimeType: z5.string().optional(),
@@ -11066,6 +11070,11 @@ import { execFile as execFile2 } from "node:child_process";
11066
11070
  import { promisify as promisify3 } from "node:util";
11067
11071
  var execFileAsync = promisify3(execFile2);
11068
11072
 
11073
+ // ../process-utils/src/performance-diagnostics.ts
11074
+ import { Session } from "node:inspector/promises";
11075
+ var PROFILE_RETENTION_MS = 12 * 60 * 60 * 1e3;
11076
+ var MAX_PROFILE_BYTES = 12 * 1024 * 1024;
11077
+
11069
11078
  // ../provider-bridge-protocol/src/bridge-kit/provider-maintenance-kit.ts
11070
11079
  var import_compare = __toESM(require_compare(), 1);
11071
11080
  var import_valid = __toESM(require_valid(), 1);