@mitralab.io/sdk-core 0.3.11 → 0.3.12

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/dist/index.cjs CHANGED
@@ -1901,7 +1901,9 @@ function createAgentTasksModule(transport, errors = defaultSdkCoreErrorFactory)
1901
1901
  sort: options.sort,
1902
1902
  kinds: options.kinds,
1903
1903
  include: options.include,
1904
- before: options.before
1904
+ before: options.before,
1905
+ thread: options.thread,
1906
+ parentToolId: options.parentToolId
1905
1907
  }
1906
1908
  }),
1907
1909
  context,
@@ -4615,7 +4617,15 @@ var AgentDirectChannel = class {
4615
4617
 
4616
4618
  // src/agentSession.ts
4617
4619
  var CANCEL_SAFETY_MS = 1e4;
4620
+ var DELIVERY_DELAY_MS = 2e4;
4621
+ var MAX_TURN_START_READS = 10;
4618
4622
  var RECONCILE_DELAY_MS = 1e3;
4623
+ var ROOT_HISTORY = {
4624
+ sort: "createdAt,desc",
4625
+ kinds: "all",
4626
+ include: "plan",
4627
+ thread: "root"
4628
+ };
4619
4629
  var ENDED_POLLS_BEFORE_NEWEST = 3;
4620
4630
  var TURN_TAIL_TYPES = /* @__PURE__ */ new Set([
4621
4631
  "textDelta",
@@ -4787,6 +4797,10 @@ function rowOrHeld(held, row, liveComparable) {
4787
4797
  function hasOlderRows(page) {
4788
4798
  return page.page.totalPages > page.page.number + 1;
4789
4799
  }
4800
+ function pageWithOlder(content, older) {
4801
+ const size = content.length;
4802
+ return { content, page: { size, totalElements: size, totalPages: older ? 2 : 1, number: 0 } };
4803
+ }
4790
4804
  function isChatRow(message) {
4791
4805
  return (message.type === "TEXT" || message.type === "ERROR" || message.type === "TOOL_USE") && message.parentToolId === void 0;
4792
4806
  }
@@ -4879,6 +4893,12 @@ function toAgentTimelineItem(message) {
4879
4893
  ...parentToolIdOf(message.parentToolId)
4880
4894
  };
4881
4895
  }
4896
+ function parentToolIdOfItem(item) {
4897
+ return item.kind === "tool" ? item.tool.parentToolId : item.parentToolId;
4898
+ }
4899
+ function rootItemsOf(messages) {
4900
+ return messages.map(toAgentTimelineItem).filter((item) => parentToolIdOfItem(item) === void 0);
4901
+ }
4882
4902
  function liveAtOf(event) {
4883
4903
  return new Date(typeof event.timestamp === "number" ? event.timestamp : Date.now()).toISOString();
4884
4904
  }
@@ -4892,13 +4912,17 @@ function createAgentTaskSessionManager(options) {
4892
4912
  session(requested) {
4893
4913
  if ("taskId" in requested) {
4894
4914
  const current = sessions.get(requested.taskId);
4895
- if (current && current.status !== "closed") return current;
4915
+ if (current && current.status !== "closed") {
4916
+ if (!requested.reopen || current.status !== "error") return current;
4917
+ current.close();
4918
+ }
4896
4919
  }
4897
4920
  const sessionOptions = "create" in requested && requested.agentId && !requested.runtime && channel.canDial(requested.transport) ? { ...requested, runtime: "T3" } : requested;
4898
4921
  const session = new CoreAgentTaskSession(sessionOptions, {
4899
4922
  tasks: options.tasks,
4900
4923
  eventSource: options.eventSource,
4901
4924
  channel,
4925
+ deliveryDelayMs: options.deliveryDelayMs ?? DELIVERY_DELAY_MS,
4902
4926
  onTaskId: (taskId, value) => sessions.set(taskId, value),
4903
4927
  onClose: (taskId, value) => {
4904
4928
  if (sessions.get(taskId) === value) sessions.delete(taskId);
@@ -4991,6 +5015,9 @@ var CoreAgentTaskSession = class {
4991
5015
  openingCursor;
4992
5016
  historyLimit;
4993
5017
  _hasOlder = false;
5018
+ // The oldest row read so far, kept or not: a page of a Copilot that ignores `thread=root` can
5019
+ // be all subagent rows, and reading before the oldest kept row would read it again (#162).
5020
+ olderCursor;
4994
5021
  // Moves whenever `history` is replaced, so a `loadOlder` still reading drops what it read.
4995
5022
  historyGeneration = 0;
4996
5023
  // Whether the box the channel follows counts in the log of the history's rows. A box whose hello
@@ -5000,6 +5027,8 @@ var CoreAgentTaskSession = class {
5000
5027
  // flag above starts over at each reread, and a page from the old log may come again.
5001
5028
  channelLog;
5002
5029
  olderRead = null;
5030
+ // Messages sent and not at the server yet, by `clientMessageId`, each with its `delivery` clock.
5031
+ deliveries = /* @__PURE__ */ new Map();
5003
5032
  get taskId() {
5004
5033
  return this._taskId;
5005
5034
  }
@@ -5028,7 +5057,7 @@ var CoreAgentTaskSession = class {
5028
5057
  this.requireOpen();
5029
5058
  if (!prompt.trim()) return void 0;
5030
5059
  if (this.isBusy()) return this.steer(prompt, options);
5031
- const clientMessageId = newClientMessageId();
5060
+ const clientMessageId = options.clientMessageId || newClientMessageId();
5032
5061
  this.startDispatch(prompt, options, clientMessageId);
5033
5062
  return clientMessageId;
5034
5063
  }
@@ -5040,13 +5069,19 @@ var CoreAgentTaskSession = class {
5040
5069
  const sendOptions = {
5041
5070
  ...options.agentType ? { agentType: options.agentType } : {},
5042
5071
  ...options.reasoningEffort ? { reasoningEffort: options.reasoningEffort } : {},
5043
- ...options.mode ? { mode: options.mode } : {}
5072
+ ...options.mode ? { mode: options.mode } : {},
5073
+ ...options.clientMessageId ? { clientMessageId: options.clientMessageId } : {}
5044
5074
  };
5045
5075
  if (this.isBusy()) {
5046
5076
  this.steer(prompt, sendOptions, waiter);
5047
5077
  return waiter.promise;
5048
5078
  }
5049
- this.startDispatch(prompt, sendOptions, newClientMessageId(), waiter);
5079
+ this.startDispatch(
5080
+ prompt,
5081
+ sendOptions,
5082
+ sendOptions.clientMessageId || newClientMessageId(),
5083
+ waiter
5084
+ );
5050
5085
  return waiter.promise;
5051
5086
  }
5052
5087
  async cancel() {
@@ -5091,14 +5126,14 @@ var CoreAgentTaskSession = class {
5091
5126
  }
5092
5127
  async loadHistory(options = {}) {
5093
5128
  if (!this._taskId) return [];
5129
+ const generation = this.historyGeneration;
5094
5130
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5095
5131
  ...options.limit !== void 0 ? { size: options.limit } : {},
5096
- sort: "createdAt,desc",
5097
- kinds: "all",
5098
- include: "plan"
5132
+ ...ROOT_HISTORY
5099
5133
  });
5100
5134
  this.historyLimit = options.limit;
5101
- await this.rereadHistory(page);
5135
+ const whole = this.reachesHistory(page) ? page : await this.backToTurnStart(page, options.limit, generation);
5136
+ if (whole) await this.rereadHistory(whole);
5102
5137
  const history = this.history;
5103
5138
  this.emit("historyLoaded", { history });
5104
5139
  return history;
@@ -5106,34 +5141,25 @@ var CoreAgentTaskSession = class {
5106
5141
  get hasOlder() {
5107
5142
  return this._hasOlder;
5108
5143
  }
5109
- loadOlder() {
5144
+ loadOlder(options = {}) {
5110
5145
  if (this.olderRead?.generation !== this.historyGeneration) {
5111
5146
  const generation = this.historyGeneration;
5112
- const promise = this.readOlder(generation).finally(() => {
5147
+ const size = options.limit ?? this.historyLimit;
5148
+ const promise = this.readOlder(generation, size).finally(() => {
5113
5149
  if (this.olderRead?.promise === promise) this.olderRead = null;
5114
5150
  });
5115
5151
  this.olderRead = { generation, promise };
5116
5152
  }
5117
5153
  return this.olderRead.promise;
5118
5154
  }
5119
- async readOlder(generation) {
5120
- const oldest = oldestRowOf(this._history);
5121
- if (!this._taskId || !this._hasOlder || !oldest) return [];
5122
- let page;
5123
- try {
5124
- page = await this.dependencies.tasks.listMessages(this._taskId, {
5125
- before: oldest.id,
5126
- ...this.historyLimit !== void 0 ? { size: this.historyLimit } : {},
5127
- sort: "createdAt,desc",
5128
- kinds: "all",
5129
- include: "plan"
5130
- });
5131
- } catch (error) {
5132
- if (generation !== this.historyGeneration || this.isClosed()) return [];
5133
- throw error;
5134
- }
5135
- if (generation !== this.historyGeneration || this.isClosed()) return [];
5136
- const rows = [...page.content].reverse().map(toAgentTimelineItem);
5155
+ async readOlder(generation, size) {
5156
+ const before = this.olderCursor ?? oldestRowOf(this._history)?.id;
5157
+ if (!this._taskId || !this._hasOlder || !before) return [];
5158
+ const page = await this.readBefore(before, size, generation);
5159
+ const whole = page && await this.backToTurnStart(page, size, generation);
5160
+ if (!whole) return [];
5161
+ this.olderCursor = whole.content[whole.content.length - 1]?.id ?? before;
5162
+ const rows = rootItemsOf([...whole.content].reverse());
5137
5163
  const rowsLog = [...rows].reverse().find((item) => item.boxLog !== void 0)?.boxLog;
5138
5164
  const liveComparable = this.rowsInChannelLog && (this.channelLog === void 0 || rowsLog === void 0 || rowsLog === this.channelLog);
5139
5165
  const taken = /* @__PURE__ */ new Set();
@@ -5145,11 +5171,73 @@ var CoreAgentTaskSession = class {
5145
5171
  taken.add(held);
5146
5172
  return rowOrHeld(held, row, liveComparable);
5147
5173
  });
5148
- this._hasOlder = hasOlderRows(page);
5174
+ this._hasOlder = hasOlderRows(whole);
5149
5175
  this._history = [...older, ...this._history.filter((item) => !taken.has(item))];
5150
5176
  this.emit("historyLoaded", { history: this.history });
5151
5177
  return older;
5152
5178
  }
5179
+ async loadSubagent(toolId, options = {}) {
5180
+ if (!this._taskId) return { items: [], hasOlder: false };
5181
+ const page = await this.dependencies.tasks.listMessages(this._taskId, {
5182
+ ...options.limit !== void 0 ? { size: options.limit } : {},
5183
+ ...options.before !== void 0 ? { before: options.before } : {},
5184
+ sort: "createdAt,desc",
5185
+ kinds: "all",
5186
+ include: "plan",
5187
+ parentToolId: toolId
5188
+ });
5189
+ const items = [...page.content].reverse().map(toAgentTimelineItem).filter((item) => parentToolIdOfItem(item) === toolId);
5190
+ const oldest = page.content[page.content.length - 1];
5191
+ return {
5192
+ items,
5193
+ hasOlder: hasOlderRows(page),
5194
+ ...oldest === void 0 ? {} : { before: oldest.id }
5195
+ };
5196
+ }
5197
+ // The rows recorded before `before`, or null once `history` was replaced or the session closed:
5198
+ // a read of a history since replaced resolves with nothing, as its success would.
5199
+ async readBefore(before, size, generation) {
5200
+ try {
5201
+ const page = await this.dependencies.tasks.listMessages(this._taskId, {
5202
+ before,
5203
+ ...size !== void 0 ? { size } : {},
5204
+ ...ROOT_HISTORY
5205
+ });
5206
+ return generation !== this.historyGeneration || this.isClosed() ? null : page;
5207
+ } catch (error) {
5208
+ if (generation !== this.historyGeneration || this.isClosed()) return null;
5209
+ throw error;
5210
+ }
5211
+ }
5212
+ // The Copilot pages by piece, so a page can start inside a turn, and without the person's
5213
+ // message that opened it a screen cannot tell the answer from the text between tools (Crew,
5214
+ // 0.3.9). The rows before it are read with the same size until that message, and what the last
5215
+ // read brought from before it is left for the next page. A steer is a person's message too: a
5216
+ // turn steered past a page boundary starts at the steer. Rows carry no turn id to do better.
5217
+ async backToTurnStart(page, size, generation) {
5218
+ let content = page.content;
5219
+ let last = page;
5220
+ let reads = 0;
5221
+ while (hasOlderRows(last) && reads < MAX_TURN_START_READS) {
5222
+ const oldest = content[content.length - 1];
5223
+ if (!oldest || oldest.sender === "USER") break;
5224
+ reads++;
5225
+ const older = await this.readBefore(oldest.id, size, generation);
5226
+ if (!older) return null;
5227
+ const known = new Set(content.map((message) => message.id));
5228
+ if (older.content.some((message) => known.has(message.id))) break;
5229
+ last = older;
5230
+ const start = older.content.findIndex((message) => message.sender === "USER");
5231
+ if (start >= 0) {
5232
+ const left = start + 1 < older.content.length;
5233
+ content = [...content, ...older.content.slice(0, start + 1)];
5234
+ return pageWithOlder(content, left || hasOlderRows(older));
5235
+ }
5236
+ if (older.content.length === 0) break;
5237
+ content = [...content, ...older.content];
5238
+ }
5239
+ return content === page.content ? page : pageWithOlder(content, hasOlderRows(last));
5240
+ }
5153
5241
  // A page that starts at a piece held live, with live pieces before it that no row of the page
5154
5242
  // takes, skipped rows the Copilot wrote between two rereads (more than a page of them): kept as
5155
5243
  // they are, those pieces never get their rows, and `loadOlder` only reads before the oldest row.
@@ -5168,9 +5256,7 @@ var CoreAgentTaskSession = class {
5168
5256
  older = await this.dependencies.tasks.listMessages(this._taskId, {
5169
5257
  before: oldest.id,
5170
5258
  ...this.historyLimit !== void 0 ? { size: this.historyLimit } : {},
5171
- sort: "createdAt,desc",
5172
- kinds: "all",
5173
- include: "plan"
5259
+ ...ROOT_HISTORY
5174
5260
  });
5175
5261
  } catch (error) {
5176
5262
  if (generation !== this.historyGeneration || this.isClosed()) return;
@@ -5182,10 +5268,14 @@ var CoreAgentTaskSession = class {
5182
5268
  }
5183
5269
  this.replaceHistory(current);
5184
5270
  }
5271
+ reachesHistory(page) {
5272
+ const oldest = rootItemsOf(page.content).pop();
5273
+ return oldest !== void 0 && this._history.some((item) => samePiece(item, oldest));
5274
+ }
5185
5275
  // Newest first, as the Copilot answers. Once rows before the page were read, a row the history
5186
5276
  // does not hold at all (one the session never heard) is still inside the gap.
5187
5277
  skipsRows(page, extended) {
5188
- const rows = page.content.map(toAgentTimelineItem);
5278
+ const rows = rootItemsOf(page.content);
5189
5279
  const first = rows[rows.length - 1];
5190
5280
  if (!first) return false;
5191
5281
  const anchor = this._history.findIndex((item) => samePiece(item, first));
@@ -5203,7 +5293,7 @@ var CoreAgentTaskSession = class {
5203
5293
  // `loadOlder` (#145). A page that does not reach the history it already has replaces it.
5204
5294
  replaceHistory(page) {
5205
5295
  const oldest = oldestRowOf(this._history)?.id;
5206
- const rows = [...page.content].reverse().map(toAgentTimelineItem);
5296
+ const rows = rootItemsOf([...page.content].reverse());
5207
5297
  const rowsLog = [...rows].reverse().find((item) => item.boxLog !== void 0)?.boxLog;
5208
5298
  const liveComparable = this.rowsInChannelLog && (this.channelLog === void 0 || rowsLog === void 0 || rowsLog === this.channelLog);
5209
5299
  this.rowsInChannelLog = true;
@@ -5211,7 +5301,10 @@ var CoreAgentTaskSession = class {
5211
5301
  const anchor = first ? this._history.findIndex((item) => samePiece(item, first)) : -1;
5212
5302
  const kept = anchor < 0 ? [] : this._history.slice(0, anchor).filter((item) => !rows.some((row) => samePiece(item, row)));
5213
5303
  const replaced = anchor < 0 ? this._history : this._history.slice(anchor);
5214
- if (anchor < 0) this._hasOlder = hasOlderRows(page);
5304
+ if (anchor < 0) {
5305
+ this._hasOlder = hasOlderRows(page);
5306
+ this.olderCursor = page.content[page.content.length - 1]?.id;
5307
+ }
5215
5308
  const used = /* @__PURE__ */ new Set();
5216
5309
  const merged = rows.map((row) => {
5217
5310
  const held = this._history.find((item) => !used.has(item) && samePiece(item, row));
@@ -5301,6 +5394,8 @@ var CoreAgentTaskSession = class {
5301
5394
  this.connection?.close();
5302
5395
  this.connection = null;
5303
5396
  this.recoveryGeneration += 1;
5397
+ for (const delivery of this.deliveries.values()) clearTimeout(delivery.timer);
5398
+ this.deliveries.clear();
5304
5399
  const closedError = new Error("Agent task session is closed.");
5305
5400
  this.activeWaiter?.reject(closedError);
5306
5401
  this.activeWaiter = void 0;
@@ -5328,6 +5423,7 @@ var CoreAgentTaskSession = class {
5328
5423
  }
5329
5424
  startDispatch(prompt, options, clientMessageId, waiter) {
5330
5425
  this.sentTexts.set(clientMessageId, prompt);
5426
+ this.watchDelivery(clientMessageId);
5331
5427
  this.dispatching = true;
5332
5428
  let handedOver;
5333
5429
  this.handOff = new Promise((resolve) => {
@@ -5341,6 +5437,9 @@ var CoreAgentTaskSession = class {
5341
5437
  this.setStatus("idle");
5342
5438
  }
5343
5439
  return false;
5440
+ }).then((sent) => {
5441
+ this.deliveryEnded(clientMessageId, sent ? "sent" : "failed");
5442
+ return sent;
5344
5443
  }).finally(() => {
5345
5444
  handedOver();
5346
5445
  if (this.dispatch === dispatch) {
@@ -5439,7 +5538,7 @@ var CoreAgentTaskSession = class {
5439
5538
  // session for a message that asks for another model, which would end that turn.
5440
5539
  steer(prompt, options, waiter) {
5441
5540
  const steered = {
5442
- clientMessageId: newClientMessageId(),
5541
+ clientMessageId: options.clientMessageId || newClientMessageId(),
5443
5542
  ...waiter ? { waiter } : {},
5444
5543
  taken: false
5445
5544
  };
@@ -5449,6 +5548,7 @@ var CoreAgentTaskSession = class {
5449
5548
  this.strayedSteers.push(steered);
5450
5549
  }
5451
5550
  this.sentTexts.set(steered.clientMessageId, prompt);
5551
+ this.watchDelivery(steered.clientMessageId);
5452
5552
  const input = messageInput(prompt, options);
5453
5553
  this.pendingSteers += 1;
5454
5554
  const handed = this.handOff.then(async () => {
@@ -5464,6 +5564,7 @@ var CoreAgentTaskSession = class {
5464
5564
  void handed.then(({ admitted }) => admitted).then((admitted) => {
5465
5565
  if (!admitted) {
5466
5566
  this.forgetSteer(steered);
5567
+ this.deliveryEnded(steered.clientMessageId, "failed");
5467
5568
  waiter?.reject(
5468
5569
  steered.refusal ?? new AgentTaskTurnError("The Agent box did not take the message.")
5469
5570
  );
@@ -5473,6 +5574,7 @@ var CoreAgentTaskSession = class {
5473
5574
  this.acceptOnce(steered.clientMessageId);
5474
5575
  }).catch((error) => {
5475
5576
  this.forgetSteer(steered);
5577
+ this.deliveryEnded(steered.clientMessageId, "failed");
5476
5578
  waiter?.reject(error);
5477
5579
  this.emitSendError(error);
5478
5580
  }).finally(() => {
@@ -5609,7 +5711,7 @@ var CoreAgentTaskSession = class {
5609
5711
  this.options.transport,
5610
5712
  historyCursor
5611
5713
  ).then((connection) => {
5612
- if (this.isClosed() || this._status === "error") {
5714
+ if (this.isClosed() || this._status === "error" && !this.dispatching) {
5613
5715
  connection.close();
5614
5716
  return;
5615
5717
  }
@@ -5653,9 +5755,7 @@ var CoreAgentTaskSession = class {
5653
5755
  if (!this._taskId) return;
5654
5756
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5655
5757
  size: 100,
5656
- sort: "createdAt,desc",
5657
- kinds: "all",
5658
- include: "plan"
5758
+ ...ROOT_HISTORY
5659
5759
  });
5660
5760
  this.turnBaselineIds = new Set(page.content.map((message) => message.id));
5661
5761
  }
@@ -5663,9 +5763,7 @@ var CoreAgentTaskSession = class {
5663
5763
  if (!this._taskId) return false;
5664
5764
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5665
5765
  size: 100,
5666
- sort: "createdAt,desc",
5667
- kinds: "all",
5668
- include: "plan"
5766
+ ...ROOT_HISTORY
5669
5767
  });
5670
5768
  await this.rereadHistory(page);
5671
5769
  this.emit("historyLoaded", { history: this.history });
@@ -5985,6 +6083,7 @@ var CoreAgentTaskSession = class {
5985
6083
  if (ours) this.acceptOnce(id);
5986
6084
  }
5987
6085
  acceptOnce(id) {
6086
+ this.deliveryEnded(id, "sent");
5988
6087
  if (this.acceptedIds.includes(id)) return;
5989
6088
  this.acceptedIds.push(id);
5990
6089
  if (this.acceptedIds.length > 32) this.acceptedIds.shift();
@@ -6157,7 +6256,7 @@ var CoreAgentTaskSession = class {
6157
6256
  if (oldest?.sequence === void 0 || oldest.boxLog !== newest?.boxLog) return false;
6158
6257
  return sequence < oldest.sequence;
6159
6258
  }
6160
- liveText(event, payload, kind, parentToolId) {
6259
+ liveText(event, payload, kind) {
6161
6260
  const itemId = typeof payload?.itemId === "string" ? payload.itemId : void 0;
6162
6261
  if (itemId === void 0) return;
6163
6262
  const piece = itemDeltaOf(payload).itemDelta ?? (typeof payload?.text === "string" ? payload.text : "");
@@ -6171,8 +6270,7 @@ var CoreAgentTaskSession = class {
6171
6270
  text: piece,
6172
6271
  at: liveAtOf(event),
6173
6272
  itemId,
6174
- ...sequence === void 0 ? {} : { sequence },
6175
- ...parentToolIdOf(parentToolId)
6273
+ ...sequence === void 0 ? {} : { sequence }
6176
6274
  }),
6177
6275
  (item) => {
6178
6276
  const held = item.lastSequence ?? item.sequence;
@@ -6205,7 +6303,7 @@ var CoreAgentTaskSession = class {
6205
6303
  // An approval or a question T3 asks mid-turn enters where it came, with the frame's payload as
6206
6304
  // it came, as the Copilot records it (`APPROVAL` and `USER_INPUT_REQUEST` rows). It still
6207
6305
  // reaches the app as a `raw` event, as before.
6208
- liveRequest(event, payload, parentToolId) {
6306
+ liveRequest(event, payload) {
6209
6307
  if (!payload) return;
6210
6308
  const kind = event.type === "approval" ? "approval" : event.type === "notification" ? "notification" : "userInputRequest";
6211
6309
  const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
@@ -6219,8 +6317,7 @@ var CoreAgentTaskSession = class {
6219
6317
  payload,
6220
6318
  at: liveAtOf(event),
6221
6319
  ...sequence === void 0 ? {} : { sequence },
6222
- ...itemId === void 0 ? {} : { itemId },
6223
- ...parentToolIdOf(parentToolId)
6320
+ ...itemId === void 0 ? {} : { itemId }
6224
6321
  };
6225
6322
  return kind === "notification" ? { ...item, kind, ...notificationFieldsOf(payload) } : { ...item, kind };
6226
6323
  },
@@ -6267,7 +6364,9 @@ var CoreAgentTaskSession = class {
6267
6364
  }
6268
6365
  // A child thread's frames are the subagent's conversation: they open no turn and settle no
6269
6366
  // message. Its text and tools still reach `delta`, `content` and `tool` as they did in 0.2.13,
6270
- // which knew no subagents, so an app that only bumps the version sees what it saw before.
6367
+ // which knew no subagents, so an app that only bumps the version sees what it saw before. None
6368
+ // enters `history`, which holds the chat's own thread as `thread=root` reads it back: the
6369
+ // subagent's pieces come from `loadSubagent`, and its approvals still reach `raw`.
6271
6370
  handleSubagentFrame(event, payload) {
6272
6371
  const parentToolId = payload.parentToolId;
6273
6372
  switch (event.type) {
@@ -6278,7 +6377,6 @@ var CoreAgentTaskSession = class {
6278
6377
  const kind = event.type === "thinking" ? "thinking" : "text";
6279
6378
  const identity = { ...itemDeltaOf(payload), ...pieceIdentityOf(event, payload) };
6280
6379
  if (kind === "text") this._content += delta;
6281
- this.liveText(event, payload, kind, parentToolId);
6282
6380
  this.emit("delta", { delta, kind, parentToolId, ...identity });
6283
6381
  this.emit("subagentDelta", { parentToolId, delta, kind, ...identity });
6284
6382
  break;
@@ -6289,15 +6387,10 @@ var CoreAgentTaskSession = class {
6289
6387
  ...toolEventOf(event, payload, event.type === "toolCall" ? "call" : "result"),
6290
6388
  parentToolId
6291
6389
  };
6292
- this.liveTool(tool, event);
6293
6390
  this.emit("tool", tool);
6294
6391
  this.emit("subagentTool", tool);
6295
6392
  break;
6296
6393
  }
6297
- case "approval":
6298
- case "user_input_request":
6299
- this.liveRequest(event, payload, parentToolId);
6300
- break;
6301
6394
  case "contextCompacted":
6302
6395
  this.emitCompaction(event, payload, parentToolId);
6303
6396
  break;
@@ -6448,6 +6541,29 @@ var CoreAgentTaskSession = class {
6448
6541
  }
6449
6542
  return waiter;
6450
6543
  }
6544
+ // A message waits in silence for whatever it needs before it leaves (the task, the channel, a
6545
+ // read of the history, the box's answer) when the network is down without failing the request
6546
+ // (Crew, 0.3.9). Failing it after a deadline could not stop the request already out, which may
6547
+ // still deliver it, and a send again would be a second message: the screen is told instead.
6548
+ watchDelivery(id) {
6549
+ const delivery = {
6550
+ timer: void 0,
6551
+ delayed: false
6552
+ };
6553
+ delivery.timer = setTimeout(() => {
6554
+ delivery.timer = void 0;
6555
+ delivery.delayed = true;
6556
+ this.emit("delivery", { clientMessageId: id, state: "delayed" });
6557
+ }, this.dependencies.deliveryDelayMs);
6558
+ this.deliveries.set(id, delivery);
6559
+ }
6560
+ deliveryEnded(id, state) {
6561
+ const delivery = this.deliveries.get(id);
6562
+ if (!delivery) return;
6563
+ this.deliveries.delete(id);
6564
+ clearTimeout(delivery.timer);
6565
+ if (delivery.delayed) this.emit("delivery", { clientMessageId: id, state });
6566
+ }
6451
6567
  emitError(prefix, error) {
6452
6568
  const code = errorCode(error);
6453
6569
  this.emit("error", {
package/dist/index.d.cts CHANGED
@@ -543,6 +543,17 @@ interface AgentMessageListOptions extends PageOptions {
543
543
  include?: "plan";
544
544
  /** Id of a message: only the rows recorded before it, so the next page back holds still. */
545
545
  before?: string;
546
+ /**
547
+ * `root` asks only for the rows of the chat itself, with every kind, and the page counts only
548
+ * them: a subagent's rows no longer push the chat out of the newest page. A Copilot without it
549
+ * ignores it and answers every thread.
550
+ */
551
+ thread?: "root";
552
+ /**
553
+ * The `toolId` of the tool call that spawned a subagent: only that subagent's rows. A Copilot
554
+ * without it ignores it and answers every thread.
555
+ */
556
+ parentToolId?: string;
546
557
  }
547
558
  type AppColor = {
548
559
  type: "SOLID";
@@ -1126,7 +1137,7 @@ interface IntegrationExecution {
1126
1137
  source: string | null;
1127
1138
  createdAt: string;
1128
1139
  }
1129
- type CopilotProvider = "ANTHROPIC" | "OPENAI" | (string & {});
1140
+ type CopilotProvider = "ANTHROPIC" | "OPENAI" | "GOOGLE" | (string & {});
1130
1141
  /** Execution runtime a chat is born on. Absent means the Copilot server default. */
1131
1142
  type AgentTaskRuntime = "T3" | "RUNNER";
1132
1143
  /** Credential scope a call or a chat resolves against. Absent means the Copilot server default. */
@@ -2481,6 +2492,13 @@ interface NewAgentTaskSessionOptions {
2481
2492
  interface ExistingAgentTaskSessionOptions {
2482
2493
  taskId: string;
2483
2494
  transport?: AgentSessionTransport;
2495
+ /**
2496
+ * With the session open for this task in `error`, closes it and opens a new one, as a "try
2497
+ * again" does. A session in any other status is returned as is. Without it a failed session
2498
+ * keeps being returned until it is closed, so a screen that asks for the session on every
2499
+ * render does not reopen it in a loop.
2500
+ */
2501
+ reopen?: boolean;
2484
2502
  }
2485
2503
  type AgentTaskSessionOptions = NewAgentTaskSessionOptions | ExistingAgentTaskSessionOptions;
2486
2504
  interface AgentSendOptions {
@@ -2493,6 +2511,12 @@ interface AgentSendOptions {
2493
2511
  * `resumeQueue`. With no turn running the message starts one.
2494
2512
  */
2495
2513
  mode?: "queue" | "steer";
2514
+ /**
2515
+ * The id to send the message with, in place of a new one: for a layer that held the message
2516
+ * before it reached the session and already showed the person this id. It must not have gone
2517
+ * out before, since the Copilot does not dedupe by it.
2518
+ */
2519
+ clientMessageId?: string;
2496
2520
  }
2497
2521
  interface AgentSendAndWaitOptions extends AgentSendOptions {
2498
2522
  signal?: AbortSignal;
@@ -2512,7 +2536,7 @@ interface AgentBackgroundTask {
2512
2536
  /** The subagent's own thread, when it has one. */
2513
2537
  childThreadId?: string;
2514
2538
  }
2515
- interface AgentQueueItem extends AgentSendOptions {
2539
+ interface AgentQueueItem extends Omit<AgentSendOptions, "clientMessageId"> {
2516
2540
  /** The `clientMessageId` the message went out with: what `send` returned for it. */
2517
2541
  id: string;
2518
2542
  text: string;
@@ -2690,6 +2714,12 @@ type AgentTimelineItem = ({
2690
2714
  /** On the tool call that spawned a subagent: its last state, as the box's `subagentUpdate`. */
2691
2715
  subagent?: Partial<AgentSubagentFrame>;
2692
2716
  } & AgentTimelineItemIdentity);
2717
+ interface AgentSubagentHistory {
2718
+ items: readonly AgentTimelineItem[];
2719
+ hasOlder: boolean;
2720
+ /** The oldest row read, to pass as `before` for the page before this one; absent on none. */
2721
+ before?: string;
2722
+ }
2693
2723
  interface AgentTurnResult {
2694
2724
  task: AgentTask;
2695
2725
  content: string;
@@ -2751,6 +2781,17 @@ interface AgentTaskSessionEventMap {
2751
2781
  * that does not wait for the answer can close it or return.
2752
2782
  */
2753
2783
  accepted: Record<string, never>;
2784
+ /**
2785
+ * A message this session sent did not reach the server within `deliveryDelayMs` of the send
2786
+ * (the network is down, or the server does not answer): `delayed`, then `sent` when it gets
2787
+ * there or `failed` when it cannot go, which also comes as `error`. Only a delayed message has
2788
+ * this event. A delayed message is not dropped and goes out once, so it must not be sent again:
2789
+ * the Copilot does not dedupe by `clientMessageId`, and a second send is a second message.
2790
+ */
2791
+ delivery: {
2792
+ clientMessageId: string;
2793
+ state: "delayed" | "sent" | "failed";
2794
+ };
2754
2795
  cancelled: Record<string, never>;
2755
2796
  /** T3's queue of the chat changed: a message entered it, moved, or left it. */
2756
2797
  queueChange: {
@@ -2864,12 +2905,26 @@ interface AgentTaskSession {
2864
2905
  */
2865
2906
  readonly hasOlder: boolean;
2866
2907
  /**
2867
- * Reads the page before the oldest row `history` holds, with the size `loadHistory` used, and
2868
- * puts it before `history`, in the box's order. Resolves with the items it added (none when
2869
- * there is nothing older) and emits `historyLoaded`. A read still running when `history` is
2870
- * replaced resolves with nothing.
2908
+ * Reads the page before the oldest row `history` holds, with `limit` or else the size
2909
+ * `loadHistory` used, and puts it before `history`, in the box's order. A page that starts in
2910
+ * the middle of a turn is read on back to the person's message that opened it, so `history`
2911
+ * never starts inside a turn. Resolves with the items it added (none when there is nothing
2912
+ * older) and emits `historyLoaded`. A read still running when `history` is replaced resolves
2913
+ * with nothing.
2871
2914
  */
2872
- loadOlder(): Promise<readonly AgentTimelineItem[]>;
2915
+ loadOlder(options?: {
2916
+ limit?: number;
2917
+ }): Promise<readonly AgentTimelineItem[]>;
2918
+ /**
2919
+ * Reads the pieces of the subagent the tool call `toolId` spawned, which `history` leaves out:
2920
+ * the newest `limit` rows (the Copilot's page size without it), or the ones before `before`.
2921
+ * Resolves with them in the box's order, whether there are older ones, and the `before` that
2922
+ * reads the page before this one.
2923
+ */
2924
+ loadSubagent(toolId: string, options?: {
2925
+ limit?: number;
2926
+ before?: string;
2927
+ }): Promise<AgentSubagentHistory>;
2873
2928
  /** Changes the text of a queued message (T3's `queued-run.edit`); only the box channel takes it. */
2874
2929
  editQueueItem(id: string, text: string): void;
2875
2930
  /** Takes a message out of the queue (T3's `queued-run.cancel`); only the box channel takes it. */
@@ -2905,6 +2960,11 @@ interface AgentTaskSessionManagerOptions {
2905
2960
  eventSource: AgentTaskEventSource;
2906
2961
  /** Where the box channel may live and how to dial it outside a browser. */
2907
2962
  directChannel?: AgentDirectChannelOptions;
2963
+ /**
2964
+ * How long a message may take to reach the server before the session emits `delivery` with
2965
+ * `delayed`. 20 s by default: past a cold box, whose channel takes 5 to 10 s to open.
2966
+ */
2967
+ deliveryDelayMs?: number;
2908
2968
  }
2909
2969
  declare function toAgentTimelineItem(message: AgentMessage): AgentTimelineItem;
2910
2970
  declare function createAgentTaskSessionManager(options: AgentTaskSessionManagerOptions): AgentTaskSessionManager;
@@ -3093,4 +3153,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
3093
3153
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
3094
3154
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
3095
3155
 
3096
- export { API_KEY_EXCHANGE_PATH, type AgentBackgroundTask, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentHistoryCursor, type AgentInput, type AgentMessage, type AgentMessageListOptions, type AgentModel, type AgentNotification, type AgentPieceIdentity, type AgentPlan, type AgentPlanStep, type AgentProviderUsage, type AgentQueueItem, type AgentReadyProvider, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentFrame, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskLastTurn, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, type AgentTaskTurn, AgentTaskTurnError, type AgentTaskTurnStateEntry, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnCompaction, type AgentTurnEndedEvent, type AgentTurnEvent, type AgentTurnEventCompaction, type AgentTurnEventUsage, type AgentTurnResult, type AgentTurnStartedEvent, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type AiProviders, type AiProvidersModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FileCreator, type FileDownloadOptions, type FileKind, type FileMetadata, type FileReadUrl, type FileReadUrlItem, type FileReadUrlOptions, type FileReadUrls, type FileStatus, FileTransferError, type FileTransferErrorDetails, type FileTransferStep, type FileUpload, type FileUploadInput, type FileUploadOptions, type FileVisibility, type FilesFetch, type FilesFetchResponse, type FilesModule, type FilesModuleOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IncludedAiQuota, type IncludedAiQuotaWindow, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type ManagedAiProfile, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type OpencodeAiProvider, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAiProvidersModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFilesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isAgentTurnEvent, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
3156
+ export { API_KEY_EXCHANGE_PATH, type AgentBackgroundTask, type AgentBulkDeleteResult, type AgentConnection, type AgentConnectionCreateInput, type AgentConnectionCustomProvider, type AgentConnectionCustomProviderInput, type AgentConnectionsModule, type AgentCredentialOptions, type AgentCredentialScope, type AgentCredentialsModule, type AgentDefinition, type AgentDirectChannelOptions, type AgentFetch, type AgentFetchResponse, type AgentHistoryCursor, type AgentInput, type AgentMessage, type AgentMessageListOptions, type AgentModel, type AgentNotification, type AgentPieceIdentity, type AgentPlan, type AgentPlanStep, type AgentProviderUsage, type AgentQueueItem, type AgentReadyProvider, type AgentSendAndWaitOptions, type AgentSendOptions, type AgentSessionTransport, type AgentSubagent, type AgentSubagentFrame, type AgentSubagentHistory, type AgentSubagentStatus, type AgentTask, type AgentTaskChannel, type AgentTaskCreateInput, type AgentTaskEvent, type AgentTaskEventConnection, type AgentTaskEventObserver, type AgentTaskEventSource, type AgentTaskInput, type AgentTaskLastTurn, type AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, type AgentTaskTurn, AgentTaskTurnError, type AgentTaskTurnStateEntry, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnCompaction, type AgentTurnEndedEvent, type AgentTurnEvent, type AgentTurnEventCompaction, type AgentTurnEventUsage, type AgentTurnResult, type AgentTurnStartedEvent, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, type AiProviders, type AiProvidersModule, type ApiKeyExchangeCaller, type AppColor, type AppContext, type AppCreateInput, type AppDefinition, type AppDeploy, type AppDomain, type AppFiles, type AppGetOptions, type AppListOptions, type AppMember, type AppPublishOptions, type AppSummary, type AppUpdateInput, type AppVersion, type AppVersionStatus, type AppsModule, type AuthModule, type AuthenticationResult, type BatchExecution, type BatchStatementResult, type BulkUnsubscribeResult, type ColumnInput, type ConnectionConfig, type ConnectionConfigResponse, type ConnectionTestResult, type ContextModule, type ContextModuleDependencies, type CopilotProvider, type CredentialStatus, type CredentialUsage, type CredentialUsageWindow, type CustomQueriesModule, type CustomQueryDefinition, type CustomQueryInput, type CustomQuerySummary, type CustomQueryUpdateInput, type DataSourceBulkItemResult, type DataSourceBulkResult, type DataSourceCreateInput, type DataSourceDbType, type DataSourceDefinition, type DataSourceInstanceType, type DataSourceUpdateInput, type DataSourcesModule, type DdlStatement, type DeviceAuthorization, type DmlStatement, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, type FileCreator, type FileDownloadOptions, type FileKind, type FileMetadata, type FileReadUrl, type FileReadUrlItem, type FileReadUrlOptions, type FileReadUrls, type FileStatus, FileTransferError, type FileTransferErrorDetails, type FileTransferStep, type FileUpload, type FileUploadInput, type FileUploadOptions, type FileVisibility, type FilesFetch, type FilesFetchResponse, type FilesModule, type FilesModuleOptions, type FunctionBulkCreateInput, type FunctionBulkDeleteInput, type FunctionBulkDeleteResult, type FunctionBulkPatchInput, type FunctionBulkPatchItem, type FunctionBulkUpdateItem, type FunctionCreateInput, type FunctionDefinition, type FunctionExecution, type FunctionListOptions, type FunctionPatchInput, type FunctionRuntime, type FunctionSecrets, type FunctionSummary, type FunctionUpdateInput, type FunctionVersion, type FunctionVersionListOptions, type FunctionVisibility, type FunctionsAdminModule, type FunctionsModule, type FunctionsModuleOptions, type HttpMethod, type ImportColumnMapping, type ImportDefinition, type ImportExecution, type ImportExecutionListOptions, type ImportInput, type ImportProcessing, type ImportSchedule, type ImportSource, type ImportSourceResponse, type ImportTarget, type ImportsModule, type IncludedAiQuota, type IncludedAiQuotaWindow, type IntegrationAdminModule, type IntegrationConnectionStatus, type IntegrationCredentialRule, type IntegrationExecution, type IntegrationFieldSchema, type IntegrationFieldSchemaInput, type IntegrationLoginConfig, type IntegrationModule, type IntegrationProxyMode, type IntegrationRequestConfig, type IntegrationResource, type IntegrationResourceInput, type IntegrationResourceParam, type IntegrationResourceSummary, type IntegrationResourceUpdateInput, type IntegrationResourcesModule, type IntegrationTemplate, type IntegrationTemplateSummary, type IntegrationTemplateType, type IntegrationTemplatesModule, type IntegrationTokenExtraction, type InviteAppUserInput, type InvocationType, type JsonValue, type LegacyPage, type ListTablesOptions, type ListTemplateConfigsOptions, type ManagedAiProfile, type MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, type OpencodeAiProvider, type Page, type PageOptions, type PlanPrice, type ProviderCredentialStatus, type ProxyInput, type ProxyResult, type PublicFunctionAsyncResult, type PublicFunctionResult, type PublicFunctionsModule, type QueriesModule, type QueryParamPrimitive, type QueryParamValue, type QueryResult, type SchemaModule, type SchemaScope, type SchemaTables, type SdkCore, SdkCoreConfigurationError, type SdkCoreErrorFactory, type SdkCoreOptions, SdkCoreResponseError, type SdkCoreTransports, type SendEmailInput, type SqlModule, type TableColumn, type TableDefinition, type TableForeignKey, type TemplateConfig, type TemplateConfigBulkItemResult, type TemplateConfigBulkResult, type TemplateConfigCreateInput, type TemplateConfigPage, type TemplateConfigSummary, type TemplateConfigUpdateInput, type Tenant, type TestCredentialsInput, type Transport, type TransportRequestOptions, type User, type UserPlan, type WorkflowDefinition, type WorkflowExecution, type WorkflowInput, type WorkflowSummary, type WorkflowsModule, appAccessTokenPath, createAgentConnectionsModule, createAgentCredentialsModule, createAgentTaskSessionManager, createAgentTasksModule, createAgentsModule, createAiProvidersModule, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFilesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isAgentTurnEvent, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };