@mitralab.io/sdk-core 0.3.6 → 0.3.7

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
@@ -1791,6 +1791,7 @@ function createAgentTasksModule(transport, errors = defaultSdkCoreErrorFactory)
1791
1791
  size: options.size,
1792
1792
  sort: options.sort,
1793
1793
  kinds: options.kinds,
1794
+ include: options.include,
1794
1795
  before: options.before
1795
1796
  }
1796
1797
  }),
@@ -4500,12 +4501,22 @@ function isChatRow(message) {
4500
4501
  var REQUEST_ROW_KINDS = {
4501
4502
  APPROVAL: "approval",
4502
4503
  USER_INPUT_REQUEST: "userInputRequest",
4503
- NOTIFICATION: "notification"
4504
+ NOTIFICATION: "notification",
4505
+ PLAN: "plan"
4504
4506
  };
4505
4507
  function notificationFieldsOf(payload) {
4506
4508
  const { source, outcome, summary, detail } = payload;
4507
4509
  return { source, outcome, summary, ...detail !== void 0 ? { detail } : {} };
4508
4510
  }
4511
+ function planFieldsOf(payload) {
4512
+ const { planId, steps, explanation, status } = payload;
4513
+ return {
4514
+ planId: planId ?? null,
4515
+ steps: Array.isArray(steps) ? steps : [],
4516
+ ...explanation !== void 0 ? { explanation } : {},
4517
+ status: status ?? null
4518
+ };
4519
+ }
4509
4520
  function parseJson(text) {
4510
4521
  try {
4511
4522
  return JSON.parse(text);
@@ -4535,7 +4546,10 @@ function toAgentTimelineItem(message) {
4535
4546
  ...timelineIdentityOf(message),
4536
4547
  ...parentToolIdOf(message.parentToolId)
4537
4548
  };
4538
- return requestKind === "notification" ? { ...item, kind: requestKind, ...notificationFieldsOf(payload) } : { ...item, kind: requestKind };
4549
+ if (requestKind === "notification") {
4550
+ return { ...item, kind: requestKind, ...notificationFieldsOf(payload) };
4551
+ }
4552
+ return requestKind === "plan" ? { ...item, kind: requestKind, ...planFieldsOf(payload) } : { ...item, kind: requestKind };
4539
4553
  }
4540
4554
  }
4541
4555
  if (message.type === "TOOL_USE") {
@@ -4784,7 +4798,8 @@ var CoreAgentTaskSession = class {
4784
4798
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
4785
4799
  ...options.limit !== void 0 ? { size: options.limit } : {},
4786
4800
  sort: "createdAt,desc",
4787
- kinds: "all"
4801
+ kinds: "all",
4802
+ include: "plan"
4788
4803
  });
4789
4804
  this.historyLimit = options.limit;
4790
4805
  this.replaceHistory(page);
@@ -4814,7 +4829,8 @@ var CoreAgentTaskSession = class {
4814
4829
  before: oldest.id,
4815
4830
  ...this.historyLimit !== void 0 ? { size: this.historyLimit } : {},
4816
4831
  sort: "createdAt,desc",
4817
- kinds: "all"
4832
+ kinds: "all",
4833
+ include: "plan"
4818
4834
  });
4819
4835
  } catch (error) {
4820
4836
  if (generation !== this.historyGeneration || this.isClosed()) return [];
@@ -5247,7 +5263,8 @@ var CoreAgentTaskSession = class {
5247
5263
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5248
5264
  size: 100,
5249
5265
  sort: "createdAt,desc",
5250
- kinds: "all"
5266
+ kinds: "all",
5267
+ include: "plan"
5251
5268
  });
5252
5269
  this.turnBaselineIds = new Set(page.content.map((message) => message.id));
5253
5270
  }
@@ -5256,7 +5273,8 @@ var CoreAgentTaskSession = class {
5256
5273
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5257
5274
  size: 100,
5258
5275
  sort: "createdAt,desc",
5259
- kinds: "all"
5276
+ kinds: "all",
5277
+ include: "plan"
5260
5278
  });
5261
5279
  this.replaceHistory(page);
5262
5280
  this.emit("historyLoaded", { history: this.history });
@@ -5507,6 +5525,15 @@ var CoreAgentTaskSession = class {
5507
5525
  });
5508
5526
  }
5509
5527
  break;
5528
+ case "plan":
5529
+ if (payload && this.livePlan(event, payload)) {
5530
+ this.emit("plan", {
5531
+ ...payload,
5532
+ ...planFieldsOf(payload),
5533
+ ...pieceIdentityOf(event, payload)
5534
+ });
5535
+ }
5536
+ break;
5510
5537
  default:
5511
5538
  break;
5512
5539
  }
@@ -5784,6 +5811,44 @@ var CoreAgentTaskSession = class {
5784
5811
  (item) => item
5785
5812
  );
5786
5813
  }
5814
+ // T3 sends the list whole on each update: the item takes the last one where it first came, as
5815
+ // the Copilot's row does. An update the item already holds (a replay after the history) leaves
5816
+ // it as it is and answers false.
5817
+ livePlan(event, payload) {
5818
+ const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
5819
+ const sequence = typeof event.sequence === "number" ? event.sequence : void 0;
5820
+ if (itemId === void 0 && sequence === void 0) return true;
5821
+ let applied = true;
5822
+ this.livePiece(
5823
+ (item) => item.kind === "plan" && (itemId !== void 0 ? item.itemId === itemId : item.sequence === sequence),
5824
+ () => ({
5825
+ id: `live:plan:${itemId ?? sequence}`,
5826
+ kind: "plan",
5827
+ payload,
5828
+ ...planFieldsOf(payload),
5829
+ at: liveAtOf(event),
5830
+ ...sequence === void 0 ? {} : { sequence },
5831
+ ...itemId === void 0 ? {} : { itemId }
5832
+ }),
5833
+ (item) => {
5834
+ const held = item.lastSequence ?? item.sequence;
5835
+ if (sequence !== void 0 && held !== void 0 && sequence <= held) {
5836
+ applied = false;
5837
+ return item;
5838
+ }
5839
+ const fields = planFieldsOf(payload);
5840
+ const next = {
5841
+ ...item,
5842
+ payload,
5843
+ ...fields,
5844
+ ...sequence === void 0 ? {} : { lastSequence: sequence }
5845
+ };
5846
+ if (fields.explanation === void 0) delete next.explanation;
5847
+ return next;
5848
+ }
5849
+ );
5850
+ return applied;
5851
+ }
5787
5852
  // A child thread's frames are the subagent's conversation: they open no turn and settle no
5788
5853
  // message. Its text and tools still reach `delta`, `content` and `tool` as they did in 0.2.13,
5789
5854
  // which knew no subagents, so an app that only bumps the version sees what it saw before.
package/dist/index.d.cts CHANGED
@@ -536,6 +536,11 @@ interface AgentMessageListOptions extends PageOptions {
536
536
  * and `TOOL_USE` rows of the chat itself, as before.
537
537
  */
538
538
  kinds?: "all";
539
+ /**
540
+ * `plan` also asks for the `PLAN` rows, which `kinds: "all"` alone leaves out: 0.3.0 to 0.3.5 read
541
+ * a row of a type they do not know as text. A Copilot without them ignores it.
542
+ */
543
+ include?: "plan";
539
544
  /** Id of a message: only the rows recorded before it, so the next page back holds still. */
540
545
  before?: string;
541
546
  }
@@ -1232,7 +1237,7 @@ interface AgentMessage {
1232
1237
  sender: string;
1233
1238
  /**
1234
1239
  * `TEXT`, `ERROR`, `TOOL_USE`; asked with `kinds: "all"`, also `REASONING`, `SUBAGENT_TEXT`,
1235
- * `APPROVAL`, `USER_INPUT_REQUEST` and `NOTIFICATION`.
1240
+ * `APPROVAL`, `USER_INPUT_REQUEST` and `NOTIFICATION`; with `include: "plan"`, also `PLAN`.
1236
1241
  */
1237
1242
  type: string;
1238
1243
  content: string;
@@ -2374,6 +2379,31 @@ interface AgentNotification {
2374
2379
  itemId?: string;
2375
2380
  [field: string]: unknown;
2376
2381
  }
2382
+ /**
2383
+ * One step of the turn's list, as T3 has it: `status` `pending`, `running` or `completed`, and
2384
+ * `durationMs` once T3 timed a completed step. Values are passed as they come, an unknown one
2385
+ * included.
2386
+ */
2387
+ interface AgentPlanStep {
2388
+ id: string;
2389
+ text: string;
2390
+ status: string;
2391
+ durationMs?: number;
2392
+ [field: string]: unknown;
2393
+ }
2394
+ /**
2395
+ * The turn's list of steps as it stands, T3's `todo_list` item: Claude's TodoWrite and tasks and
2396
+ * Codex's plan. Each update carries the whole list; the same `itemId` is the same list. `status`
2397
+ * is the item's own, as T3 sends it.
2398
+ */
2399
+ interface AgentPlan {
2400
+ planId: string | null;
2401
+ steps: AgentPlanStep[];
2402
+ explanation?: string;
2403
+ status: string | null;
2404
+ itemId?: string;
2405
+ [field: string]: unknown;
2406
+ }
2377
2407
  interface AgentToolEvent extends AgentPieceIdentity {
2378
2408
  tool: string;
2379
2409
  /** The title the box gave the tool: a subagent's own name (its description), as T3 shows it. */
@@ -2450,6 +2480,17 @@ type AgentTimelineItem = ({
2450
2480
  at: string;
2451
2481
  parentToolId?: string;
2452
2482
  } & Pick<AgentNotification, "source" | "outcome" | "summary" | "detail"> & AgentTimelineItemIdentity) | ({
2483
+ id: string;
2484
+ /**
2485
+ * The turn's list of steps (`PLAN` row), one item per T3 item with its last state: `planId`,
2486
+ * `steps`, `explanation` and `status` as the live `plan` event carries them, and the box's
2487
+ * frame as it came in `payload`. Live, each update replaces the item in place.
2488
+ */
2489
+ kind: "plan";
2490
+ payload: Record<string, unknown>;
2491
+ at: string;
2492
+ parentToolId?: string;
2493
+ } & Pick<AgentPlan, "planId" | "steps" | "explanation" | "status"> & AgentTimelineItemIdentity) | ({
2453
2494
  id: string;
2454
2495
  kind: "tool";
2455
2496
  tool: AgentToolEvent;
@@ -2522,6 +2563,8 @@ interface AgentTaskSessionEventMap {
2522
2563
  };
2523
2564
  /** Background work ended: what it was, how it ended and T3's line for it. */
2524
2565
  notification: AgentNotification & AgentPieceIdentity;
2566
+ /** The turn's list of steps changed: the whole list, as T3 shows it. */
2567
+ plan: AgentPlan & AgentPieceIdentity;
2525
2568
  /**
2526
2569
  * The box took a message into the running turn at this point, with no turn of its own: the
2527
2570
  * place the app shows it in that turn. The turn's `turnEnd` answers it.
@@ -2709,4 +2752,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
2709
2752
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
2710
2753
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
2711
2754
 
2712
- 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 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 AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, 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 EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, 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 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 MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, 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, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
2755
+ 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 AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, 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 EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, 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 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 MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, 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, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
package/dist/index.d.ts CHANGED
@@ -536,6 +536,11 @@ interface AgentMessageListOptions extends PageOptions {
536
536
  * and `TOOL_USE` rows of the chat itself, as before.
537
537
  */
538
538
  kinds?: "all";
539
+ /**
540
+ * `plan` also asks for the `PLAN` rows, which `kinds: "all"` alone leaves out: 0.3.0 to 0.3.5 read
541
+ * a row of a type they do not know as text. A Copilot without them ignores it.
542
+ */
543
+ include?: "plan";
539
544
  /** Id of a message: only the rows recorded before it, so the next page back holds still. */
540
545
  before?: string;
541
546
  }
@@ -1232,7 +1237,7 @@ interface AgentMessage {
1232
1237
  sender: string;
1233
1238
  /**
1234
1239
  * `TEXT`, `ERROR`, `TOOL_USE`; asked with `kinds: "all"`, also `REASONING`, `SUBAGENT_TEXT`,
1235
- * `APPROVAL`, `USER_INPUT_REQUEST` and `NOTIFICATION`.
1240
+ * `APPROVAL`, `USER_INPUT_REQUEST` and `NOTIFICATION`; with `include: "plan"`, also `PLAN`.
1236
1241
  */
1237
1242
  type: string;
1238
1243
  content: string;
@@ -2374,6 +2379,31 @@ interface AgentNotification {
2374
2379
  itemId?: string;
2375
2380
  [field: string]: unknown;
2376
2381
  }
2382
+ /**
2383
+ * One step of the turn's list, as T3 has it: `status` `pending`, `running` or `completed`, and
2384
+ * `durationMs` once T3 timed a completed step. Values are passed as they come, an unknown one
2385
+ * included.
2386
+ */
2387
+ interface AgentPlanStep {
2388
+ id: string;
2389
+ text: string;
2390
+ status: string;
2391
+ durationMs?: number;
2392
+ [field: string]: unknown;
2393
+ }
2394
+ /**
2395
+ * The turn's list of steps as it stands, T3's `todo_list` item: Claude's TodoWrite and tasks and
2396
+ * Codex's plan. Each update carries the whole list; the same `itemId` is the same list. `status`
2397
+ * is the item's own, as T3 sends it.
2398
+ */
2399
+ interface AgentPlan {
2400
+ planId: string | null;
2401
+ steps: AgentPlanStep[];
2402
+ explanation?: string;
2403
+ status: string | null;
2404
+ itemId?: string;
2405
+ [field: string]: unknown;
2406
+ }
2377
2407
  interface AgentToolEvent extends AgentPieceIdentity {
2378
2408
  tool: string;
2379
2409
  /** The title the box gave the tool: a subagent's own name (its description), as T3 shows it. */
@@ -2450,6 +2480,17 @@ type AgentTimelineItem = ({
2450
2480
  at: string;
2451
2481
  parentToolId?: string;
2452
2482
  } & Pick<AgentNotification, "source" | "outcome" | "summary" | "detail"> & AgentTimelineItemIdentity) | ({
2483
+ id: string;
2484
+ /**
2485
+ * The turn's list of steps (`PLAN` row), one item per T3 item with its last state: `planId`,
2486
+ * `steps`, `explanation` and `status` as the live `plan` event carries them, and the box's
2487
+ * frame as it came in `payload`. Live, each update replaces the item in place.
2488
+ */
2489
+ kind: "plan";
2490
+ payload: Record<string, unknown>;
2491
+ at: string;
2492
+ parentToolId?: string;
2493
+ } & Pick<AgentPlan, "planId" | "steps" | "explanation" | "status"> & AgentTimelineItemIdentity) | ({
2453
2494
  id: string;
2454
2495
  kind: "tool";
2455
2496
  tool: AgentToolEvent;
@@ -2522,6 +2563,8 @@ interface AgentTaskSessionEventMap {
2522
2563
  };
2523
2564
  /** Background work ended: what it was, how it ended and T3's line for it. */
2524
2565
  notification: AgentNotification & AgentPieceIdentity;
2566
+ /** The turn's list of steps changed: the whole list, as T3 shows it. */
2567
+ plan: AgentPlan & AgentPieceIdentity;
2525
2568
  /**
2526
2569
  * The box took a message into the running turn at this point, with no turn of its own: the
2527
2570
  * place the app shows it in that turn. The turn's `turnEnd` answers it.
@@ -2709,4 +2752,4 @@ declare function expectPage<T extends object>(value: unknown, context: string, e
2709
2752
  declare function expectLegacyPage<T extends object>(value: unknown, context: string, errors?: SdkCoreErrorFactory, validateItem?: (value: unknown, context: string, errors: SdkCoreErrorFactory) => T): LegacyPage<T>;
2710
2753
  declare function expectEmpty(value: unknown, context: string, errors?: SdkCoreErrorFactory): void;
2711
2754
 
2712
- 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 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 AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, 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 EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, 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 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 MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, 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, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
2755
+ 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 AgentTaskListOptions, type AgentTaskRuntime, type AgentTaskSession, type AgentTaskSessionEventMap, type AgentTaskSessionManager, type AgentTaskSessionManagerOptions, type AgentTaskSessionOptions, type AgentTaskSessionStatus, AgentTaskTurnError, type AgentTasksModule, type AgentTasksWithSessions, type AgentTimelineItem, type AgentTimelineItemIdentity, type AgentToolEvent, type AgentTurnResult, type AgentTurnUsage, type AgentTurnUsageRequest, type AgentUpdateItem, type AgentWebSocket, type AgentWebSocketConstructor, type AgentsModule, 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 EffectiveEmailSender, type EmailSender, type EmailSenderInput, type EmailSettings, type EmailSettingsInput, type EmailTemplate, type EmailTemplateInput, type EmailTemplatePreview, type EmailTemplateType, type EmailTemplateTypeCatalog, type EmailTemplateUpsertResult, type EmailTemplateVariable, type EmptyFunctionInput, type EntitiesModule, type EntitiesProxy, type EntityListOptions, type EntityListResponse, type EntityTable, type ExistingAgentTaskSessionOptions, 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 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 MembersModule, type MessageAccepted, type MessengerModule, type NewAgentTaskSessionOptions, type OAuthExchangeInput, type OAuthStartResult, 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, createAppsModule, createAuthModule, createContextModule, createCustomQueriesModule, createDataSourcesModule, createEntitiesModule, createFunctionsAdminModule, createFunctionsModule, createImportsModule, createIntegrationAdminModule, createIntegrationModule, createIntegrationResourcesModule, createIntegrationTemplatesModule, createMembersModule, createMessengerModule, createPublicFunctionsModule, createQueriesModule, createSchemaModule, createSdkCore, createSqlModule, createWorkflowsModule, defaultSdkCoreErrorFactory, encodePathSegment, expectEmpty, expectLegacyPage, expectNullableObject, expectObject, expectObjectArray, expectPage, expectStringArray, isWorkspaceSession, readTokenAppId, readTokenExpiry, resolveApiKeyToken, toAgentTimelineItem, tokenAuthorizesApp, withAgentTaskSessions };
package/dist/index.js CHANGED
@@ -1719,6 +1719,7 @@ function createAgentTasksModule(transport, errors = defaultSdkCoreErrorFactory)
1719
1719
  size: options.size,
1720
1720
  sort: options.sort,
1721
1721
  kinds: options.kinds,
1722
+ include: options.include,
1722
1723
  before: options.before
1723
1724
  }
1724
1725
  }),
@@ -4428,12 +4429,22 @@ function isChatRow(message) {
4428
4429
  var REQUEST_ROW_KINDS = {
4429
4430
  APPROVAL: "approval",
4430
4431
  USER_INPUT_REQUEST: "userInputRequest",
4431
- NOTIFICATION: "notification"
4432
+ NOTIFICATION: "notification",
4433
+ PLAN: "plan"
4432
4434
  };
4433
4435
  function notificationFieldsOf(payload) {
4434
4436
  const { source, outcome, summary, detail } = payload;
4435
4437
  return { source, outcome, summary, ...detail !== void 0 ? { detail } : {} };
4436
4438
  }
4439
+ function planFieldsOf(payload) {
4440
+ const { planId, steps, explanation, status } = payload;
4441
+ return {
4442
+ planId: planId ?? null,
4443
+ steps: Array.isArray(steps) ? steps : [],
4444
+ ...explanation !== void 0 ? { explanation } : {},
4445
+ status: status ?? null
4446
+ };
4447
+ }
4437
4448
  function parseJson(text) {
4438
4449
  try {
4439
4450
  return JSON.parse(text);
@@ -4463,7 +4474,10 @@ function toAgentTimelineItem(message) {
4463
4474
  ...timelineIdentityOf(message),
4464
4475
  ...parentToolIdOf(message.parentToolId)
4465
4476
  };
4466
- return requestKind === "notification" ? { ...item, kind: requestKind, ...notificationFieldsOf(payload) } : { ...item, kind: requestKind };
4477
+ if (requestKind === "notification") {
4478
+ return { ...item, kind: requestKind, ...notificationFieldsOf(payload) };
4479
+ }
4480
+ return requestKind === "plan" ? { ...item, kind: requestKind, ...planFieldsOf(payload) } : { ...item, kind: requestKind };
4467
4481
  }
4468
4482
  }
4469
4483
  if (message.type === "TOOL_USE") {
@@ -4712,7 +4726,8 @@ var CoreAgentTaskSession = class {
4712
4726
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
4713
4727
  ...options.limit !== void 0 ? { size: options.limit } : {},
4714
4728
  sort: "createdAt,desc",
4715
- kinds: "all"
4729
+ kinds: "all",
4730
+ include: "plan"
4716
4731
  });
4717
4732
  this.historyLimit = options.limit;
4718
4733
  this.replaceHistory(page);
@@ -4742,7 +4757,8 @@ var CoreAgentTaskSession = class {
4742
4757
  before: oldest.id,
4743
4758
  ...this.historyLimit !== void 0 ? { size: this.historyLimit } : {},
4744
4759
  sort: "createdAt,desc",
4745
- kinds: "all"
4760
+ kinds: "all",
4761
+ include: "plan"
4746
4762
  });
4747
4763
  } catch (error) {
4748
4764
  if (generation !== this.historyGeneration || this.isClosed()) return [];
@@ -5175,7 +5191,8 @@ var CoreAgentTaskSession = class {
5175
5191
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5176
5192
  size: 100,
5177
5193
  sort: "createdAt,desc",
5178
- kinds: "all"
5194
+ kinds: "all",
5195
+ include: "plan"
5179
5196
  });
5180
5197
  this.turnBaselineIds = new Set(page.content.map((message) => message.id));
5181
5198
  }
@@ -5184,7 +5201,8 @@ var CoreAgentTaskSession = class {
5184
5201
  const page = await this.dependencies.tasks.listMessages(this._taskId, {
5185
5202
  size: 100,
5186
5203
  sort: "createdAt,desc",
5187
- kinds: "all"
5204
+ kinds: "all",
5205
+ include: "plan"
5188
5206
  });
5189
5207
  this.replaceHistory(page);
5190
5208
  this.emit("historyLoaded", { history: this.history });
@@ -5435,6 +5453,15 @@ var CoreAgentTaskSession = class {
5435
5453
  });
5436
5454
  }
5437
5455
  break;
5456
+ case "plan":
5457
+ if (payload && this.livePlan(event, payload)) {
5458
+ this.emit("plan", {
5459
+ ...payload,
5460
+ ...planFieldsOf(payload),
5461
+ ...pieceIdentityOf(event, payload)
5462
+ });
5463
+ }
5464
+ break;
5438
5465
  default:
5439
5466
  break;
5440
5467
  }
@@ -5712,6 +5739,44 @@ var CoreAgentTaskSession = class {
5712
5739
  (item) => item
5713
5740
  );
5714
5741
  }
5742
+ // T3 sends the list whole on each update: the item takes the last one where it first came, as
5743
+ // the Copilot's row does. An update the item already holds (a replay after the history) leaves
5744
+ // it as it is and answers false.
5745
+ livePlan(event, payload) {
5746
+ const itemId = typeof payload.itemId === "string" ? payload.itemId : void 0;
5747
+ const sequence = typeof event.sequence === "number" ? event.sequence : void 0;
5748
+ if (itemId === void 0 && sequence === void 0) return true;
5749
+ let applied = true;
5750
+ this.livePiece(
5751
+ (item) => item.kind === "plan" && (itemId !== void 0 ? item.itemId === itemId : item.sequence === sequence),
5752
+ () => ({
5753
+ id: `live:plan:${itemId ?? sequence}`,
5754
+ kind: "plan",
5755
+ payload,
5756
+ ...planFieldsOf(payload),
5757
+ at: liveAtOf(event),
5758
+ ...sequence === void 0 ? {} : { sequence },
5759
+ ...itemId === void 0 ? {} : { itemId }
5760
+ }),
5761
+ (item) => {
5762
+ const held = item.lastSequence ?? item.sequence;
5763
+ if (sequence !== void 0 && held !== void 0 && sequence <= held) {
5764
+ applied = false;
5765
+ return item;
5766
+ }
5767
+ const fields = planFieldsOf(payload);
5768
+ const next = {
5769
+ ...item,
5770
+ payload,
5771
+ ...fields,
5772
+ ...sequence === void 0 ? {} : { lastSequence: sequence }
5773
+ };
5774
+ if (fields.explanation === void 0) delete next.explanation;
5775
+ return next;
5776
+ }
5777
+ );
5778
+ return applied;
5779
+ }
5715
5780
  // A child thread's frames are the subagent's conversation: they open no turn and settle no
5716
5781
  // message. Its text and tools still reach `delta`, `content` and `tool` as they did in 0.2.13,
5717
5782
  // which knew no subagents, so an app that only bumps the version sees what it saw before.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitralab.io/sdk-core",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Environment-neutral contracts and modules shared by Mitra JavaScript SDKs",
5
5
  "type": "module",
6
6
  "sideEffects": false,