@github/copilot-sdk 1.0.7 → 1.0.8

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.
@@ -762,6 +762,68 @@ function createSessionRpc(connection, sessionId) {
762
762
  }
763
763
  },
764
764
  /** @experimental */
765
+ factory: {
766
+ /**
767
+ * Runs a registered factory by name at the top level.
768
+ *
769
+ * @param params Parameters for invoking a registered factory.
770
+ *
771
+ * @returns Complete current or terminal factory run envelope.
772
+ */
773
+ run: async (params) => connection.sendRequest("session.factory.run", { sessionId, ...params }),
774
+ /**
775
+ * Gets the current or settled envelope for a factory run.
776
+ *
777
+ * @param params Parameters for retrieving a factory run.
778
+ *
779
+ * @returns Complete current or terminal factory run envelope.
780
+ */
781
+ getRun: async (params) => connection.sendRequest("session.factory.getRun", { sessionId, ...params }),
782
+ /**
783
+ * Requests cancellation of a factory run and returns its run envelope.
784
+ *
785
+ * @param params Parameters for cancelling a factory run.
786
+ *
787
+ * @returns Complete current or terminal factory run envelope.
788
+ */
789
+ cancel: async (params) => connection.sendRequest("session.factory.cancel", { sessionId, ...params }),
790
+ /**
791
+ * Records a batch of ordered factory progress lines.
792
+ *
793
+ * @param params Parameters for recording factory progress.
794
+ *
795
+ * @returns Acknowledgement that a factory request was accepted.
796
+ */
797
+ log: async (params) => connection.sendRequest("session.factory.log", { sessionId, ...params }),
798
+ /**
799
+ * Runs one factory-scoped subagent and returns its result.
800
+ *
801
+ * @param params Parameters for one factory-scoped subagent call.
802
+ *
803
+ * @returns Result of one factory-scoped subagent call.
804
+ */
805
+ agent: async (params) => connection.sendRequest("session.factory.agent", { sessionId, ...params }),
806
+ /** @experimental */
807
+ journal: {
808
+ /**
809
+ * Reads a memoized factory journal entry.
810
+ *
811
+ * @param params Parameters for reading a factory journal entry.
812
+ *
813
+ * @returns Result of reading a factory journal entry.
814
+ */
815
+ get: async (params) => connection.sendRequest("session.factory.journal.get", { sessionId, ...params }),
816
+ /**
817
+ * Stores a memoized factory journal entry.
818
+ *
819
+ * @param params Parameters for storing a factory journal entry.
820
+ *
821
+ * @returns Acknowledgement that a factory request was accepted.
822
+ */
823
+ put: async (params) => connection.sendRequest("session.factory.journal.put", { sessionId, ...params })
824
+ }
825
+ },
826
+ /** @experimental */
765
827
  model: {
766
828
  /**
767
829
  * Gets the currently selected model for the session.
@@ -1794,11 +1856,11 @@ function createSessionRpc(connection, sessionId) {
1794
1856
  */
1795
1857
  getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
1796
1858
  /**
1797
- * Records a working-directory/git context change and emits a `session.context_changed` event.
1859
+ * Records a working-directory/git context change and emits a `session.context_changed` event. For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event): a local session's working directory is authoritative and is moved via `metadata.setWorkingDirectory` (or an SDK `session.resume` that supplies a `workingDirectory`), not by this method.
1798
1860
  *
1799
1861
  * @param params Updated working-directory/git context to record on the session.
1800
1862
  *
1801
- * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode).
1863
+ * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead.
1802
1864
  */
1803
1865
  recordContextChange: async (params) => connection.sendRequest("session.metadata.recordContextChange", { sessionId, ...params }),
1804
1866
  /**
@@ -2068,6 +2130,16 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2068
2130
  if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
2069
2131
  return handler.getToken(params);
2070
2132
  });
2133
+ connection.onRequest("factory.execute", async (params) => {
2134
+ const handler = getHandlers(params.sessionId).factory;
2135
+ if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
2136
+ return handler.execute(params);
2137
+ });
2138
+ connection.onRequest("factory.abort", async (params) => {
2139
+ const handler = getHandlers(params.sessionId).factory;
2140
+ if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
2141
+ return handler.abort(params);
2142
+ });
2071
2143
  connection.onRequest("sessionFs.readFile", async (params) => {
2072
2144
  const handler = getHandlers(params.sessionId).sessionFs;
2073
2145
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
@@ -484,6 +484,79 @@ export type ExternalToolTextResultForLlmContentResourceLinkIconTheme =
484
484
  */
485
485
  /** @experimental */
486
486
  export type ExternalToolTextResultForLlmContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents;
487
+ /**
488
+ * Kind of factory progress line.
489
+ *
490
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
491
+ * via the `definition` "FactoryLogLineKind".
492
+ */
493
+ /** @experimental */
494
+ export type FactoryLogLineKind =
495
+ /** A narrator log line. */
496
+ "log"
497
+ /** A named factory phase marker. */
498
+ | "phase";
499
+ /**
500
+ * Machine-readable factory run failure.
501
+ *
502
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
503
+ * via the `definition` "FactoryRunFailure".
504
+ */
505
+ /** @experimental */
506
+ export type FactoryRunFailure = {
507
+ kind: FactoryRunFailureKind;
508
+ /**
509
+ * Approved effective ceiling that was reached.
510
+ */
511
+ value: number;
512
+ /**
513
+ * Factory run identifier.
514
+ */
515
+ runId: string;
516
+ type: "factory_limit_reached";
517
+ } | {
518
+ /**
519
+ * Factory run identifier whose changed limits were declined.
520
+ */
521
+ runId: string;
522
+ /**
523
+ * Human-readable reason the resume did not proceed.
524
+ */
525
+ reason: string;
526
+ type: "factory_resume_declined";
527
+ };
528
+ /**
529
+ * Cumulative resource ceiling that stopped a factory run.
530
+ *
531
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
532
+ * via the `definition` "FactoryRunFailureKind".
533
+ */
534
+ /** @experimental */
535
+ export type FactoryRunFailureKind =
536
+ /** The run admitted the approved maximum total number of subagents. */
537
+ "maxTotalSubagents"
538
+ /** The run reached the approved timeout deadline. */
539
+ | "timeout";
540
+ /**
541
+ * Current or terminal state of a factory run.
542
+ *
543
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
544
+ * via the `definition` "FactoryRunStatus".
545
+ */
546
+ /** @experimental */
547
+ export type FactoryRunStatus =
548
+ /** The run was minted and is awaiting approval. */
549
+ "pending"
550
+ /** The run is executing. */
551
+ | "running"
552
+ /** The run completed successfully. */
553
+ | "completed"
554
+ /** The run was interrupted while resource budget remained. */
555
+ | "halted"
556
+ /** The run was cancelled before completion. */
557
+ | "cancelled"
558
+ /** The factory body failed or reached a cumulative resource ceiling. */
559
+ | "error";
487
560
  /**
488
561
  * Content filtering mode to apply to all tools, or a map of tool name to content filtering mode.
489
562
  *
@@ -4570,6 +4643,340 @@ export interface ExternalToolTextResultForLlmContentResource {
4570
4643
  type: "resource";
4571
4644
  resource: ExternalToolTextResultForLlmContentResourceDetails;
4572
4645
  }
4646
+ /**
4647
+ * Parameters for cooperatively aborting a factory body.
4648
+ *
4649
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4650
+ * via the `definition` "FactoryAbortRequest".
4651
+ */
4652
+ /** @experimental */
4653
+ export interface FactoryAbortRequest {
4654
+ /**
4655
+ * Target session identifier
4656
+ */
4657
+ sessionId: string;
4658
+ /**
4659
+ * Factory run identifier.
4660
+ */
4661
+ runId: string;
4662
+ }
4663
+ /**
4664
+ * Acknowledgement that a factory request was accepted.
4665
+ *
4666
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4667
+ * via the `definition` "FactoryAckResult".
4668
+ */
4669
+ /** @experimental */
4670
+ export interface FactoryAckResult {
4671
+ }
4672
+ /**
4673
+ * Options for one factory-scoped subagent call.
4674
+ *
4675
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4676
+ * via the `definition` "FactoryAgentOptions".
4677
+ */
4678
+ /** @experimental */
4679
+ export interface FactoryAgentOptions {
4680
+ /**
4681
+ * Optional label distinguishing otherwise identical memoized agent calls.
4682
+ */
4683
+ label?: string;
4684
+ /**
4685
+ * Optional JSON Schema for structured agent output.
4686
+ */
4687
+ schema?: {
4688
+ [k: string]: unknown | undefined;
4689
+ };
4690
+ /**
4691
+ * Optional model identifier for the subagent.
4692
+ */
4693
+ model?: string;
4694
+ }
4695
+ /**
4696
+ * Parameters for one factory-scoped subagent call.
4697
+ *
4698
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4699
+ * via the `definition` "FactoryAgentRequest".
4700
+ */
4701
+ /** @experimental */
4702
+ export interface FactoryAgentRequest {
4703
+ /**
4704
+ * Factory run identifier that owns the subagent.
4705
+ */
4706
+ factoryRunId: string;
4707
+ /**
4708
+ * Prompt to send to the subagent.
4709
+ */
4710
+ prompt: string;
4711
+ opts: FactoryAgentOptions;
4712
+ }
4713
+ /**
4714
+ * Result of one factory-scoped subagent call.
4715
+ *
4716
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4717
+ * via the `definition` "FactoryAgentResult".
4718
+ */
4719
+ /** @experimental */
4720
+ export interface FactoryAgentResult {
4721
+ /**
4722
+ * Agent result, omitted when the agent produced no result.
4723
+ */
4724
+ result?: {
4725
+ [k: string]: unknown | undefined;
4726
+ };
4727
+ }
4728
+ /**
4729
+ * Parameters for cancelling a factory run.
4730
+ *
4731
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4732
+ * via the `definition` "FactoryCancelRequest".
4733
+ */
4734
+ /** @experimental */
4735
+ export interface FactoryCancelRequest {
4736
+ /**
4737
+ * Factory run identifier.
4738
+ */
4739
+ runId: string;
4740
+ }
4741
+ /**
4742
+ * Parameters sent to the owning extension to execute a factory closure.
4743
+ *
4744
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4745
+ * via the `definition` "FactoryExecuteRequest".
4746
+ */
4747
+ /** @experimental */
4748
+ export interface FactoryExecuteRequest {
4749
+ /**
4750
+ * Target session identifier
4751
+ */
4752
+ sessionId: string;
4753
+ /**
4754
+ * Registered factory name.
4755
+ */
4756
+ name: string;
4757
+ /**
4758
+ * Factory run identifier.
4759
+ */
4760
+ runId: string;
4761
+ /**
4762
+ * Factory input value.
4763
+ */
4764
+ args: {
4765
+ [k: string]: unknown | undefined;
4766
+ };
4767
+ }
4768
+ /**
4769
+ * Result returned by an extension factory closure.
4770
+ *
4771
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4772
+ * via the `definition` "FactoryExecuteResult".
4773
+ */
4774
+ /** @experimental */
4775
+ export interface FactoryExecuteResult {
4776
+ /**
4777
+ * Factory result value.
4778
+ */
4779
+ result: {
4780
+ [k: string]: unknown | undefined;
4781
+ };
4782
+ }
4783
+ /**
4784
+ * Parameters for retrieving a factory run.
4785
+ *
4786
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4787
+ * via the `definition` "FactoryGetRunRequest".
4788
+ */
4789
+ /** @experimental */
4790
+ export interface FactoryGetRunRequest {
4791
+ /**
4792
+ * Factory run identifier.
4793
+ */
4794
+ runId: string;
4795
+ }
4796
+ /**
4797
+ * Parameters for reading a factory journal entry.
4798
+ *
4799
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4800
+ * via the `definition` "FactoryJournalGetRequest".
4801
+ */
4802
+ /** @experimental */
4803
+ export interface FactoryJournalGetRequest {
4804
+ /**
4805
+ * Factory run identifier.
4806
+ */
4807
+ runId: string;
4808
+ /**
4809
+ * Namespaced journal key.
4810
+ */
4811
+ key: string;
4812
+ }
4813
+ /**
4814
+ * Result of reading a factory journal entry.
4815
+ *
4816
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4817
+ * via the `definition` "FactoryJournalGetResult".
4818
+ */
4819
+ /** @experimental */
4820
+ export interface FactoryJournalGetResult {
4821
+ /**
4822
+ * Whether the journal contained the requested key.
4823
+ */
4824
+ hit: boolean;
4825
+ /**
4826
+ * Cached JSON result. The hit field distinguishes a cached JSON null from a miss.
4827
+ */
4828
+ resultJson?: {
4829
+ [k: string]: unknown | undefined;
4830
+ };
4831
+ }
4832
+ /**
4833
+ * Parameters for storing a factory journal entry.
4834
+ *
4835
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4836
+ * via the `definition` "FactoryJournalPutRequest".
4837
+ */
4838
+ /** @experimental */
4839
+ export interface FactoryJournalPutRequest {
4840
+ /**
4841
+ * Factory run identifier.
4842
+ */
4843
+ runId: string;
4844
+ /**
4845
+ * Namespaced journal key.
4846
+ */
4847
+ key: string;
4848
+ /**
4849
+ * JSON result to memoize.
4850
+ */
4851
+ resultJson: {
4852
+ [k: string]: unknown | undefined;
4853
+ };
4854
+ }
4855
+ /**
4856
+ * One ordered factory progress line.
4857
+ *
4858
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4859
+ * via the `definition` "FactoryLogLine".
4860
+ */
4861
+ /** @experimental */
4862
+ export interface FactoryLogLine {
4863
+ /**
4864
+ * Monotonic sequence number within the factory run.
4865
+ */
4866
+ seq: number;
4867
+ kind: FactoryLogLineKind;
4868
+ /**
4869
+ * Progress text.
4870
+ */
4871
+ text: string;
4872
+ }
4873
+ /**
4874
+ * Parameters for recording factory progress.
4875
+ *
4876
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4877
+ * via the `definition` "FactoryLogRequest".
4878
+ */
4879
+ /** @experimental */
4880
+ export interface FactoryLogRequest {
4881
+ /**
4882
+ * Factory run identifier.
4883
+ */
4884
+ runId: string;
4885
+ /**
4886
+ * Ordered progress lines to append.
4887
+ */
4888
+ lines: FactoryLogLine[];
4889
+ }
4890
+ /**
4891
+ * Wire-only per-invocation factory resource ceiling overrides.
4892
+ *
4893
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4894
+ * via the `definition` "FactoryRunLimits".
4895
+ */
4896
+ /** @experimental */
4897
+ export interface FactoryRunLimits {
4898
+ /**
4899
+ * Maximum number of factory subagents that may run concurrently.
4900
+ */
4901
+ maxConcurrentSubagents?: number;
4902
+ /**
4903
+ * Maximum total number of factory subagents that may be admitted.
4904
+ */
4905
+ maxTotalSubagents?: number;
4906
+ /**
4907
+ * Factory active-run timeout in milliseconds.
4908
+ */
4909
+ timeout?: number;
4910
+ }
4911
+ /**
4912
+ * Parameters for invoking a registered factory.
4913
+ *
4914
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4915
+ * via the `definition` "FactoryRunRequest".
4916
+ */
4917
+ /** @experimental */
4918
+ export interface FactoryRunRequest {
4919
+ /**
4920
+ * Registered factory name.
4921
+ */
4922
+ name: string;
4923
+ /**
4924
+ * Factory input value.
4925
+ */
4926
+ args: {
4927
+ [k: string]: unknown | undefined;
4928
+ };
4929
+ options?: RunOptions;
4930
+ }
4931
+ /**
4932
+ * Options controlling factory invocation.
4933
+ *
4934
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4935
+ * via the `definition` "RunOptions".
4936
+ */
4937
+ /** @experimental */
4938
+ export interface RunOptions {
4939
+ limits?: FactoryRunLimits;
4940
+ /**
4941
+ * Run identifier whose journal and progress should seed this resumed run.
4942
+ */
4943
+ resumeFromRunId?: string;
4944
+ }
4945
+ /**
4946
+ * Complete current or terminal factory run envelope.
4947
+ *
4948
+ * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
4949
+ * via the `definition` "FactoryRunResult".
4950
+ */
4951
+ /** @experimental */
4952
+ export interface FactoryRunResult {
4953
+ /**
4954
+ * Factory run identifier.
4955
+ */
4956
+ runId: string;
4957
+ status: FactoryRunStatus;
4958
+ /**
4959
+ * Completed factory result.
4960
+ */
4961
+ result?: {
4962
+ [k: string]: unknown | undefined;
4963
+ };
4964
+ /**
4965
+ * Error message for an errored run.
4966
+ */
4967
+ error?: string;
4968
+ failure?: FactoryRunFailure;
4969
+ /**
4970
+ * Reason for a halted or cancelled run.
4971
+ */
4972
+ reason?: string;
4973
+ /**
4974
+ * Partial journal and progress snapshot for a halted, cancelled, or errored run.
4975
+ */
4976
+ snapshot?: {
4977
+ [k: string]: unknown | undefined;
4978
+ };
4979
+ }
4573
4980
  /**
4574
4981
  * Optional user prompt to combine with the fleet orchestration instructions.
4575
4982
  *
@@ -5199,6 +5606,10 @@ export interface LlmInferenceHttpRequestChunkRequest {
5199
5606
  * Optional human-readable reason for the cancellation, propagated for logging.
5200
5607
  */
5201
5608
  cancelReason?: string;
5609
+ /**
5610
+ * Identity of the agent invocation (one agentic loop) this body chunk belongs to, matching the `agentInvocationId` semantics on httpRequestStart. Carried per chunk so a persistent transport can attribute successive turns correctly: when a WebSocket connection is reused across turns, the httpRequestStart identity reflects only the turn that opened the connection, so each later turn stamps its own invocation id here. Absent when the runtime has no invocation context for the request, or on the plain-HTTP transport where every request has its own httpRequestStart.
5611
+ */
5612
+ agentInvocationId?: string;
5202
5613
  }
5203
5614
  /**
5204
5615
  * Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget.
@@ -5236,13 +5647,17 @@ export interface LlmInferenceHttpRequestStartRequest {
5236
5647
  headers: LlmInferenceHeaders;
5237
5648
  transport?: LlmInferenceHttpRequestStartTransport;
5238
5649
  /**
5239
- * Stable per-agent-instance id attributing this request to a specific agent trajectory. Present when the request originates from an agent turn; absent for requests issued outside any agent context (e.g. some SDK callers). A request with an `agentId` but no `parentAgentId` is a root-agent request; one carrying both is a subagent request. Sourced from the runtime's per-request agent context and surfaced on the envelope independently of transport, so it is available for both first-party (CAPI) and BYOK/custom-provider requests; on the CAPI transport the runtime derives the upstream `X-Agent-Task-Id` header from this same context. Consumers routing each provider call to a training trajectory should key on this rather than on lifecycle events, since it is available on the request path before sampling.
5650
+ * Stable identity of the agent trajectory that issued this request. Present when the request originates from an agent turn; absent for requests outside any agent context. This is the same identity used by lifecycle and bridged session events and remains constant across turns and retries.
5240
5651
  */
5241
5652
  agentId?: string;
5242
5653
  /**
5243
- * Id of the parent agent that spawned the agent issuing this request. Present only for subagent requests; absent for root-agent requests and non-agent requests. Combined with `agentId`, this lets consumers attribute a call to a child trajectory versus the root. Like `agentId`, it comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Parent-Agent-Id` header from this same context.
5654
+ * Stable identity of the immediate parent trajectory. Present for child trajectories such as subagents and conversation-sampling requests; absent for root-agent and non-agent requests.
5244
5655
  */
5245
5656
  parentAgentId?: string;
5657
+ /**
5658
+ * Identity of the agent invocation (one agentic loop) that issued this request. It remains fixed across physical retries within the invocation and is distinct from the stable trajectory `agentId`. A caller-supplied invocation id always takes precedence (this covers auxiliary calls that have no model call id). Otherwise, first-party CAPI requests fall back to the runtime's agent task id — the same value the runtime emits as the `X-Agent-Task-Id` header — while custom-provider requests fall back to the model call id.
5659
+ */
5660
+ agentInvocationId?: string;
5246
5661
  /**
5247
5662
  * Coarse classification of the interaction that produced this request. Open string for forward-compatibility; known values include `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, and `conversation-user`. Absent when the runtime did not classify the request. Comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Interaction-Type` header from this same context.
5248
5663
  */
@@ -7132,7 +7547,7 @@ export interface SessionWorkingDirectoryContext {
7132
7547
  baseCommit?: string;
7133
7548
  }
7134
7549
  /**
7135
- * Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode).
7550
+ * Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead.
7136
7551
  *
7137
7552
  * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema
7138
7553
  * via the `definition` "MetadataRecordContextChangeResult".
@@ -10627,6 +11042,14 @@ export interface SandboxConfig {
10627
11042
  * Whether to auto-add the current working directory to readwritePaths. Default: true.
10628
11043
  */
10629
11044
  addCurrentWorkingDirectory?: boolean;
11045
+ /**
11046
+ * Whether to inject the Copilot GitHub token as an `http.<host>.extraheader` so authenticated HTTPS git works inside the sandbox without the shell-based credential helper the sandbox blocks. Default: false (opt-in).
11047
+ */
11048
+ gitAuth?: boolean;
11049
+ /**
11050
+ * Whether to export `GH_TOKEN` so the `gh` CLI authenticates inside the sandbox without the OS keyring the sandbox blocks. Default: false (opt-in).
11051
+ */
11052
+ ghAuth?: boolean;
10630
11053
  }
10631
11054
  /**
10632
11055
  * User-managed sandbox policy fragment merged into the auto-discovered base policy.
@@ -11064,6 +11487,10 @@ export interface ServerSkillList {
11064
11487
  * All discovered skills across all sources
11065
11488
  */
11066
11489
  skills: ServerSkill[];
11490
+ /**
11491
+ * Messages for skills that failed to load (e.g. malformed SKILL.md). Empty when host skills are excluded so host-local paths are not disclosed to multitenant callers.
11492
+ */
11493
+ errors?: string[];
11067
11494
  }
11068
11495
  /**
11069
11496
  * Current activity flags for the session.
@@ -14844,6 +15271,10 @@ export interface UsageMetricsCodeChanges {
14844
15271
  export interface UsageMetricsModelMetric {
14845
15272
  requests: UsageMetricsModelMetricRequests;
14846
15273
  usage: UsageMetricsModelMetricUsage;
15274
+ /**
15275
+ * Latest known prompt-cache expiration for this model. A timestamp in the past indicates that the observed cache has expired.
15276
+ */
15277
+ cacheExpiresAt?: string;
14847
15278
  /**
14848
15279
  * Accumulated nano-AI units cost for this model
14849
15280
  */
@@ -16013,6 +16444,68 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
16013
16444
  };
16014
16445
  };
16015
16446
  /** @experimental */
16447
+ factory: {
16448
+ /**
16449
+ * Runs a registered factory by name at the top level.
16450
+ *
16451
+ * @param params Parameters for invoking a registered factory.
16452
+ *
16453
+ * @returns Complete current or terminal factory run envelope.
16454
+ */
16455
+ run: (params: FactoryRunRequest) => Promise<FactoryRunResult>;
16456
+ /**
16457
+ * Gets the current or settled envelope for a factory run.
16458
+ *
16459
+ * @param params Parameters for retrieving a factory run.
16460
+ *
16461
+ * @returns Complete current or terminal factory run envelope.
16462
+ */
16463
+ getRun: (params: FactoryGetRunRequest) => Promise<FactoryRunResult>;
16464
+ /**
16465
+ * Requests cancellation of a factory run and returns its run envelope.
16466
+ *
16467
+ * @param params Parameters for cancelling a factory run.
16468
+ *
16469
+ * @returns Complete current or terminal factory run envelope.
16470
+ */
16471
+ cancel: (params: FactoryCancelRequest) => Promise<FactoryRunResult>;
16472
+ /**
16473
+ * Records a batch of ordered factory progress lines.
16474
+ *
16475
+ * @param params Parameters for recording factory progress.
16476
+ *
16477
+ * @returns Acknowledgement that a factory request was accepted.
16478
+ */
16479
+ log: (params: FactoryLogRequest) => Promise<FactoryAckResult>;
16480
+ /**
16481
+ * Runs one factory-scoped subagent and returns its result.
16482
+ *
16483
+ * @param params Parameters for one factory-scoped subagent call.
16484
+ *
16485
+ * @returns Result of one factory-scoped subagent call.
16486
+ */
16487
+ agent: (params: FactoryAgentRequest) => Promise<FactoryAgentResult>;
16488
+ /** @experimental */
16489
+ journal: {
16490
+ /**
16491
+ * Reads a memoized factory journal entry.
16492
+ *
16493
+ * @param params Parameters for reading a factory journal entry.
16494
+ *
16495
+ * @returns Result of reading a factory journal entry.
16496
+ */
16497
+ get: (params: FactoryJournalGetRequest) => Promise<FactoryJournalGetResult>;
16498
+ /**
16499
+ * Stores a memoized factory journal entry.
16500
+ *
16501
+ * @param params Parameters for storing a factory journal entry.
16502
+ *
16503
+ * @returns Acknowledgement that a factory request was accepted.
16504
+ */
16505
+ put: (params: FactoryJournalPutRequest) => Promise<FactoryAckResult>;
16506
+ };
16507
+ };
16508
+ /** @experimental */
16016
16509
  model: {
16017
16510
  /**
16018
16511
  * Gets the currently selected model for the session.
@@ -17045,11 +17538,11 @@ export declare function createSessionRpc(connection: MessageConnection, sessionI
17045
17538
  */
17046
17539
  getContextHeaviestMessages: (params: MetadataContextHeaviestMessagesRequest) => Promise<MetadataContextHeaviestMessagesResult>;
17047
17540
  /**
17048
- * Records a working-directory/git context change and emits a `session.context_changed` event.
17541
+ * Records a working-directory/git context change and emits a `session.context_changed` event. For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event): a local session's working directory is authoritative and is moved via `metadata.setWorkingDirectory` (or an SDK `session.resume` that supplies a `workingDirectory`), not by this method.
17049
17542
  *
17050
17543
  * @param params Updated working-directory/git context to record on the session.
17051
17544
  *
17052
- * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode).
17545
+ * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead.
17053
17546
  */
17054
17547
  recordContextChange: (params: MetadataRecordContextChangeRequest) => Promise<MetadataRecordContextChangeResult>;
17055
17548
  /**
@@ -17272,6 +17765,26 @@ export interface ProviderTokenHandler {
17272
17765
  */
17273
17766
  getToken(params: ProviderTokenAcquireRequest): Promise<ProviderTokenAcquireResult>;
17274
17767
  }
17768
+ /** Handler for `factory` client session API methods. */
17769
+ /** @experimental */
17770
+ export interface FactoryHandler {
17771
+ /**
17772
+ * Asks the owning extension connection to execute a registered factory closure.
17773
+ *
17774
+ * @param params Parameters sent to the owning extension to execute a factory closure.
17775
+ *
17776
+ * @returns Result returned by an extension factory closure.
17777
+ */
17778
+ execute(params: FactoryExecuteRequest): Promise<FactoryExecuteResult>;
17779
+ /**
17780
+ * Asks the owning extension connection to abort a running factory cooperatively.
17781
+ *
17782
+ * @param params Parameters for cooperatively aborting a factory body.
17783
+ *
17784
+ * @returns Acknowledgement that a factory request was accepted.
17785
+ */
17786
+ abort(params: FactoryAbortRequest): Promise<FactoryAckResult>;
17787
+ }
17275
17788
  /** Handler for `sessionFs` client session API methods. */
17276
17789
  /** @experimental */
17277
17790
  export interface SessionFsHandler {
@@ -17401,6 +17914,7 @@ export interface CanvasHandler {
17401
17914
  /** All client session API handler groups. */
17402
17915
  export interface ClientSessionApiHandlers {
17403
17916
  providerToken?: ProviderTokenHandler;
17917
+ factory?: FactoryHandler;
17404
17918
  sessionFs?: SessionFsHandler;
17405
17919
  canvas?: CanvasHandler;
17406
17920
  }
@@ -734,6 +734,68 @@ function createSessionRpc(connection, sessionId) {
734
734
  }
735
735
  },
736
736
  /** @experimental */
737
+ factory: {
738
+ /**
739
+ * Runs a registered factory by name at the top level.
740
+ *
741
+ * @param params Parameters for invoking a registered factory.
742
+ *
743
+ * @returns Complete current or terminal factory run envelope.
744
+ */
745
+ run: async (params) => connection.sendRequest("session.factory.run", { sessionId, ...params }),
746
+ /**
747
+ * Gets the current or settled envelope for a factory run.
748
+ *
749
+ * @param params Parameters for retrieving a factory run.
750
+ *
751
+ * @returns Complete current or terminal factory run envelope.
752
+ */
753
+ getRun: async (params) => connection.sendRequest("session.factory.getRun", { sessionId, ...params }),
754
+ /**
755
+ * Requests cancellation of a factory run and returns its run envelope.
756
+ *
757
+ * @param params Parameters for cancelling a factory run.
758
+ *
759
+ * @returns Complete current or terminal factory run envelope.
760
+ */
761
+ cancel: async (params) => connection.sendRequest("session.factory.cancel", { sessionId, ...params }),
762
+ /**
763
+ * Records a batch of ordered factory progress lines.
764
+ *
765
+ * @param params Parameters for recording factory progress.
766
+ *
767
+ * @returns Acknowledgement that a factory request was accepted.
768
+ */
769
+ log: async (params) => connection.sendRequest("session.factory.log", { sessionId, ...params }),
770
+ /**
771
+ * Runs one factory-scoped subagent and returns its result.
772
+ *
773
+ * @param params Parameters for one factory-scoped subagent call.
774
+ *
775
+ * @returns Result of one factory-scoped subagent call.
776
+ */
777
+ agent: async (params) => connection.sendRequest("session.factory.agent", { sessionId, ...params }),
778
+ /** @experimental */
779
+ journal: {
780
+ /**
781
+ * Reads a memoized factory journal entry.
782
+ *
783
+ * @param params Parameters for reading a factory journal entry.
784
+ *
785
+ * @returns Result of reading a factory journal entry.
786
+ */
787
+ get: async (params) => connection.sendRequest("session.factory.journal.get", { sessionId, ...params }),
788
+ /**
789
+ * Stores a memoized factory journal entry.
790
+ *
791
+ * @param params Parameters for storing a factory journal entry.
792
+ *
793
+ * @returns Acknowledgement that a factory request was accepted.
794
+ */
795
+ put: async (params) => connection.sendRequest("session.factory.journal.put", { sessionId, ...params })
796
+ }
797
+ },
798
+ /** @experimental */
737
799
  model: {
738
800
  /**
739
801
  * Gets the currently selected model for the session.
@@ -1766,11 +1828,11 @@ function createSessionRpc(connection, sessionId) {
1766
1828
  */
1767
1829
  getContextHeaviestMessages: async (params) => connection.sendRequest("session.metadata.getContextHeaviestMessages", { sessionId, ...params }),
1768
1830
  /**
1769
- * Records a working-directory/git context change and emits a `session.context_changed` event.
1831
+ * Records a working-directory/git context change and emits a `session.context_changed` event. For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event): a local session's working directory is authoritative and is moved via `metadata.setWorkingDirectory` (or an SDK `session.resume` that supplies a `workingDirectory`), not by this method.
1770
1832
  *
1771
1833
  * @param params Updated working-directory/git context to record on the session.
1772
1834
  *
1773
- * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode).
1835
+ * @returns Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead.
1774
1836
  */
1775
1837
  recordContextChange: async (params) => connection.sendRequest("session.metadata.recordContextChange", { sessionId, ...params }),
1776
1838
  /**
@@ -2040,6 +2102,16 @@ function registerClientSessionApiHandlers(connection, getHandlers) {
2040
2102
  if (!handler) throw new Error(`No providerToken handler registered for session: ${params.sessionId}`);
2041
2103
  return handler.getToken(params);
2042
2104
  });
2105
+ connection.onRequest("factory.execute", async (params) => {
2106
+ const handler = getHandlers(params.sessionId).factory;
2107
+ if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
2108
+ return handler.execute(params);
2109
+ });
2110
+ connection.onRequest("factory.abort", async (params) => {
2111
+ const handler = getHandlers(params.sessionId).factory;
2112
+ if (!handler) throw new Error(`No factory handler registered for session: ${params.sessionId}`);
2113
+ return handler.abort(params);
2114
+ });
2043
2115
  connection.onRequest("sessionFs.readFile", async (params) => {
2044
2116
  const handler = getHandlers(params.sessionId).sessionFs;
2045
2117
  if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`);
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Union of all session event variants emitted by the Copilot CLI runtime.
7
7
  */
8
- export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantIntentEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | ScheduleRearmedEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | SessionLimitsChangedEvent | PermissionsChangedEvent | PlanChangedEvent | TodosChangedEvent | WorkspaceFileChangedEvent | HandoffEvent | TruncationEvent | SnapshotRewindEvent | ShutdownEvent | UsageCheckpointEvent | ContextChangedEvent | UsageInfoEvent | CompactionStartEvent | CompactionCompleteEvent | TaskCompleteEvent | UserMessageEvent | PendingMessagesModifiedEvent | AssistantTurnStartEvent | AssistantTurnRetryEvent | AssistantIntentEvent | AssistantServerToolProgressEvent | AssistantReasoningEvent | AssistantReasoningDeltaEvent | AssistantToolCallDeltaEvent | AssistantStreamingDeltaEvent | AssistantMessageEvent | AssistantMessageStartEvent | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantIdleEvent | AssistantUsageEvent | ModelCallFailureEvent | ModelCallStartEvent | AbortEvent | ToolUserRequestedEvent | ToolExecutionStartEvent | ToolExecutionPartialResultEvent | ToolExecutionProgressEvent | ToolExecutionCompleteEvent | ToolSearchActivatedEvent | SkillInvokedEvent | SubagentStartedEvent | SubagentCompletedEvent | SubagentFailedEvent | SubagentSelectedEvent | SubagentDeselectedEvent | HookStartEvent | HookEndEvent | HookProgressEvent | BinaryAssetEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | McpHeadersRefreshRequiredEvent | McpHeadersRefreshCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | SessionLimitsExhaustedRequestedEvent | SessionLimitsExhaustedCompletedEvent | AutoModeResolvedEvent | ManagedSettingsResolvedEvent | ManagedSettingsEnforcedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | McpToolsListChangedEvent | McpResourcesListChangedEvent | McpPromptsListChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | CanvasClosedEvent | CanvasUnavailableEvent | CanvasRecordedEvent | CanvasRemovedEvent | ExtensionsAttachmentsPushedEvent | McpAppToolCallCompleteEvent;
9
9
  /**
10
10
  * Hosting platform type of the repository (github or ado)
11
11
  */
@@ -207,6 +207,14 @@ export type ModelCallFailureBadRequestKind =
207
207
  "bodyless"
208
208
  /** The 400 response carried a structured CAPI error envelope (deterministic validation failure). */
209
209
  | "structured_error";
210
+ /**
211
+ * Boundary that produced a model call failure
212
+ */
213
+ export type ModelCallFailureKind =
214
+ /** The provider returned an API error response. */
215
+ "api"
216
+ /** The request transport failed before a usable API response completed. */
217
+ | "transport";
210
218
  /**
211
219
  * Where the failed model call originated
212
220
  */
@@ -217,6 +225,14 @@ export type ModelCallFailureSource =
217
225
  | "subagent"
218
226
  /** Model call from MCP sampling. */
219
227
  | "mcp_sampling";
228
+ /**
229
+ * Transport used for a failed model call
230
+ */
231
+ export type ModelCallFailureTransport =
232
+ /** HTTP transport, including SSE streams. */
233
+ "http"
234
+ /** WebSocket transport. */
235
+ | "websocket";
220
236
  /**
221
237
  * Finite reason code describing why the current turn was aborted
222
238
  */
@@ -481,6 +497,26 @@ export type ManagedSettingsResolvedSource =
481
497
  | "device"
482
498
  /** No managed policy is in force (no layer contributed). */
483
499
  | "none";
500
+ /**
501
+ * The category of runtime action that enterprise managed settings governed (blocked or capped)
502
+ */
503
+ export type ManagedSettingsEnforcedAction =
504
+ /** An attempt to turn on a bypass-permissions ("yolo") escalation was refused or capped because policy disables bypass-permissions mode. */
505
+ "bypass_permissions_blocked";
506
+ /**
507
+ * For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused
508
+ */
509
+ export type ManagedSettingsEnforcedEscalation =
510
+ /** Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. */
511
+ "allow_all"
512
+ /** Auto-approval of all tool permission requests. */
513
+ | "approve_all"
514
+ /** Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. */
515
+ | "auto_approval"
516
+ /** Unrestricted filesystem access outside the session's allowed directories. */
517
+ | "unrestricted_paths"
518
+ /** Unrestricted URL fetch access. */
519
+ | "unrestricted_urls";
484
520
  /**
485
521
  * Exit plan mode action
486
522
  */
@@ -2914,6 +2950,23 @@ export interface AssistantTurnStartData {
2914
2950
  */
2915
2951
  turnId: string;
2916
2952
  }
2953
+ /**
2954
+ * Metadata for an additional model inference attempt within an existing assistant turn
2955
+ */
2956
+ export interface AssistantTurnRetryData {
2957
+ /**
2958
+ * Model identifier used for this retry, when known
2959
+ */
2960
+ model?: string;
2961
+ /**
2962
+ * Provider or runtime classification that caused the retry, when known
2963
+ */
2964
+ reason?: string;
2965
+ /**
2966
+ * Identifier of the turn whose model inference is being retried
2967
+ */
2968
+ turnId: string;
2969
+ }
2917
2970
  /**
2918
2971
  * Session event "assistant.intent". Agent intent description for current activity or plan
2919
2972
  */
@@ -3675,6 +3728,10 @@ export interface AssistantUsageData {
3675
3728
  */
3676
3729
  apiCallId?: string;
3677
3730
  apiEndpoint?: AssistantUsageApiEndpoint;
3731
+ /**
3732
+ * Updated prompt-cache expiration for this model call. Present only when the call establishes or refreshes known cache state.
3733
+ */
3734
+ cacheExpiresAt?: string;
3678
3735
  /**
3679
3736
  * Number of tokens read from prompt cache
3680
3737
  */
@@ -3816,6 +3873,7 @@ export interface ModelCallFailureData {
3816
3873
  * Completion ID from the model provider (e.g., chatcmpl-abc123)
3817
3874
  */
3818
3875
  apiCallId?: string;
3876
+ apiEndpoint?: AssistantUsageApiEndpoint;
3819
3877
  badRequestKind?: ModelCallFailureBadRequestKind;
3820
3878
  /**
3821
3879
  * Duration of the failed API call in milliseconds
@@ -3833,10 +3891,27 @@ export interface ModelCallFailureData {
3833
3891
  * For HTTP 400 failures only: the `type` from the CAPI error envelope (e.g. 'websocket_error'), a coarser companion to errorCode for envelopes that carry no code. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
3834
3892
  */
3835
3893
  errorType?: string;
3894
+ failureKind?: ModelCallFailureKind;
3836
3895
  /**
3837
3896
  * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
3838
3897
  */
3839
3898
  initiator?: string;
3899
+ /**
3900
+ * Whether the session selected Auto mode for the failed call
3901
+ */
3902
+ isAuto?: boolean;
3903
+ /**
3904
+ * Whether the failed call used a bring-your-own-key provider
3905
+ */
3906
+ isByok?: boolean;
3907
+ /**
3908
+ * Effective maximum output-token limit for the failed call
3909
+ */
3910
+ maxOutputTokens?: number;
3911
+ /**
3912
+ * Effective maximum prompt-token limit for the failed call
3913
+ */
3914
+ maxPromptTokens?: number;
3840
3915
  /**
3841
3916
  * Model identifier used for the failed API call
3842
3917
  */
@@ -3845,6 +3920,10 @@ export interface ModelCallFailureData {
3845
3920
  * GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3846
3921
  */
3847
3922
  providerCallId?: string;
3923
+ /**
3924
+ * Reasoning effort level used for the failed model call, if applicable
3925
+ */
3926
+ reasoningEffort?: string;
3848
3927
  requestFingerprint?: ModelCallFailureRequestFingerprint;
3849
3928
  /**
3850
3929
  * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
@@ -3855,6 +3934,7 @@ export interface ModelCallFailureData {
3855
3934
  * HTTP status code from the failed request
3856
3935
  */
3857
3936
  statusCode?: number;
3937
+ transport?: ModelCallFailureTransport;
3858
3938
  }
3859
3939
  /**
3860
3940
  * Content-free structural summary of the failing request for diagnosing malformed 4xx calls
@@ -3889,6 +3969,19 @@ export interface ModelCallFailureRequestFingerprint {
3889
3969
  */
3890
3970
  toolResultMessageCount: number;
3891
3971
  }
3972
+ /**
3973
+ * Model API dispatch metadata for internal telemetry
3974
+ */
3975
+ export interface ModelCallStartData {
3976
+ /**
3977
+ * Model identifier used for this API call, when known
3978
+ */
3979
+ model?: string;
3980
+ /**
3981
+ * Identifier of the assistant turn that initiated the model call
3982
+ */
3983
+ turnId: string;
3984
+ }
3892
3985
  /**
3893
3986
  * Session event "abort". Turn abort information including the reason for termination
3894
3987
  */
@@ -4734,6 +4827,49 @@ export interface ToolExecutionCompleteToolDescriptionMetaUI {
4734
4827
  */
4735
4828
  visibility?: ToolExecutionCompleteToolDescriptionMetaUIVisibility[];
4736
4829
  }
4830
+ /**
4831
+ * Session event "tool_search.activated". Persisted generic client-side tool activations restored when a session resumes.
4832
+ */
4833
+ export interface ToolSearchActivatedEvent {
4834
+ /**
4835
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4836
+ */
4837
+ agentId?: string;
4838
+ data: ToolSearchActivatedData;
4839
+ /**
4840
+ * When true, the event is transient and not persisted to the session event log on disk
4841
+ */
4842
+ ephemeral?: boolean;
4843
+ /**
4844
+ * Unique event identifier (UUID v4), generated when the event is emitted
4845
+ */
4846
+ id: string;
4847
+ /**
4848
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
4849
+ */
4850
+ parentId: string | null;
4851
+ /**
4852
+ * ISO 8601 timestamp when the event was created
4853
+ */
4854
+ timestamp: string;
4855
+ /**
4856
+ * Type discriminator. Always "tool_search.activated".
4857
+ */
4858
+ type: "tool_search.activated";
4859
+ }
4860
+ /**
4861
+ * Persisted generic client-side tool activations restored when a session resumes.
4862
+ */
4863
+ export interface ToolSearchActivatedData {
4864
+ /**
4865
+ * Tool-search strategy that activated the definitions.
4866
+ */
4867
+ strategy: string;
4868
+ /**
4869
+ * Names of tool definitions activated by this search invocation.
4870
+ */
4871
+ toolNames: string[];
4872
+ }
4737
4873
  /**
4738
4874
  * Session event "skill.invoked". Skill invocation details including content, allowed tools, and plugin metadata
4739
4875
  */
@@ -7739,6 +7875,57 @@ export interface ManagedSettingsResolvedData {
7739
7875
  };
7740
7876
  source: ManagedSettingsResolvedSource;
7741
7877
  }
7878
+ /**
7879
+ * Session event "session.managed_settings_enforced". Runtime enforcement of enterprise managed settings: fires when the session blocks or caps a runtime action because enterprise policy governs it, so SDK clients can explain *why* an action was governed. Unlike `session.managed_settings_resolved` (which reports *what* is managed), this reports a concrete governed action — e.g. a user or host tried to turn on a bypass-permissions escalation while policy disables it. Emitted live (not persisted to the session event log) on user/host-initiated attempts only, never for silent policy application. Marked experimental while the managed-settings surface stabilizes.
7880
+ */
7881
+ /** @experimental */
7882
+ export interface ManagedSettingsEnforcedEvent {
7883
+ /**
7884
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
7885
+ */
7886
+ agentId?: string;
7887
+ data: ManagedSettingsEnforcedData;
7888
+ /**
7889
+ * Always true for events that are transient and not persisted to the session event log on disk.
7890
+ */
7891
+ ephemeral: true;
7892
+ /**
7893
+ * Unique event identifier (UUID v4), generated when the event is emitted
7894
+ */
7895
+ id: string;
7896
+ /**
7897
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
7898
+ */
7899
+ parentId: string | null;
7900
+ /**
7901
+ * ISO 8601 timestamp when the event was created
7902
+ */
7903
+ timestamp: string;
7904
+ /**
7905
+ * Type discriminator. Always "session.managed_settings_enforced".
7906
+ */
7907
+ type: "session.managed_settings_enforced";
7908
+ }
7909
+ /**
7910
+ * Runtime enforcement of enterprise managed settings: fires when the session blocks or caps a runtime action because enterprise policy governs it, so SDK clients can explain *why* an action was governed. Unlike `session.managed_settings_resolved` (which reports *what* is managed), this reports a concrete governed action — e.g. a user or host tried to turn on a bypass-permissions escalation while policy disables it. Emitted live (not persisted to the session event log) on user/host-initiated attempts only, never for silent policy application. Marked experimental while the managed-settings surface stabilizes.
7911
+ */
7912
+ /** @experimental */
7913
+ export interface ManagedSettingsEnforcedData {
7914
+ action: ManagedSettingsEnforcedAction;
7915
+ escalation?: ManagedSettingsEnforcedEscalation;
7916
+ /**
7917
+ * Whether the enforcement was forced by fail-closed handling (managed policy could not be determined) rather than an explicit managed setting. When true, `setting` still names the restriction that was applied.
7918
+ */
7919
+ failClosed: boolean;
7920
+ /**
7921
+ * A human-readable explanation of why the action was governed, suitable for surfacing to the user.
7922
+ */
7923
+ message: string;
7924
+ /**
7925
+ * The managed setting key responsible for the enforcement (e.g. `permissions.disableBypassPermissionsMode`).
7926
+ */
7927
+ setting: string;
7928
+ }
7742
7929
  /**
7743
7930
  * Session event "commands.changed". SDK command registration change notification
7744
7931
  */
package/dist/index.d.ts CHANGED
@@ -10,4 +10,4 @@ export { CopilotSession, type AssistantMessageEvent } from "./session.js";
10
10
  export { Canvas, CanvasError, createCanvas, type CanvasAction, type CanvasDeclaration, type CanvasHostContext, type CanvasHostContextCapabilities, type CanvasJsonSchema, type CanvasOptions, } from "./canvas.js";
11
11
  export { defineTool, approveAll, convertMcpCallToolResult, createSessionFsAdapter, CopilotRequestHandler, CopilotWebSocketHandler, CopilotWebSocketCloseStatus, CopilotWebSocketForwarder, SYSTEM_MESSAGE_SECTIONS, } from "./types.js";
12
12
  export type * from "./generated/session-events.js";
13
- export type { CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
13
+ export type { CommandContext, CommandDefinition, CommandHandler, CanvasProviderIdentity, CloudSessionOptions, CloudSessionRepository, AutoModeSwitchHandler, AutoModeSwitchRequest, AutoModeSwitchResponse, CopilotClientMode, CopilotClientOptions, CopilotExpAssignmentResponse, StdioRuntimeConnection, InProcessRuntimeConnection, TcpRuntimeConnection, UriRuntimeConnection, ChildProcessRuntimeConnection, CustomAgentConfig, ElicitationFieldValue, ElicitationHandler, ElicitationParams, ElicitationContext, ElicitationResult, ElicitationSchema, ElicitationSchemaField, ExpConfigEntry, ExpFlagValue, ExitPlanModeHandler, ExitPlanModeRequest, ExitPlanModeResult, ExtensionInfo, ForegroundSessionInfo, GetAuthStatusResponse, GetStatusResponse, GitHubTelemetryNotification, GitHubTelemetryEvent, GitHubTelemetryClientInfo, InfiniteSessionConfig, LargeToolOutputConfig, MemoryConfiguration, UiInputOptions, MCPStdioServerConfig, MCPHTTPServerConfig, MCPServerConfig, DefaultAgentConfig, BearerTokenProvider, MessageOptions, ModelBilling, ModelBillingTokenPrices, ModelBillingTokenPricesLongContext, CapiSessionOptions, ModelCapabilities, ModelCapabilitiesOverride, ModelInfo, ModelPolicy, NamedProviderConfig, PermissionHandler, PermissionRequest, PermissionRequestResult, ProviderConfig, ProviderModelConfig, ProviderTokenArgs, RemoteSessionMode, ResumeSessionConfig, SectionOverride, SectionOverrideAction, SectionTransformFn, SessionCapabilities, SessionConfig, SessionConfigBase, SessionEvent, SessionEventHandler, SessionEventPayload, SessionEventType, SessionLifecycleEvent, SessionLifecycleEventMetadata, SessionLifecycleEventType, SessionLifecycleHandler, SessionCreatedEvent, SessionDeletedEvent, SessionUpdatedEvent, SessionForegroundEvent, SessionBackgroundEvent, SessionContext, SessionListFilter, SessionMetadata, SessionUiApi, SessionFsConfig, SessionFsProvider, SessionFsFileInfo, SessionFsSqliteQueryResult, SessionFsSqliteQueryType, SessionFsSqliteProvider, CopilotRequestContext, SystemMessageAppendConfig, SystemMessageConfig, SystemMessageCustomizeConfig, SystemMessageReplaceConfig, SystemMessageSection, TelemetryConfig, TraceContext, TraceContextProvider, Tool, ToolHandler, ToolInvocation, CurrentToolMetadata, ToolTelemetry, ToolResultObject, ToolSearchConfig, TypedSessionEventHandler, TypedSessionLifecycleHandler, ZodSchema, } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -1300,6 +1300,12 @@ export interface CustomAgentConfig {
1300
1300
  * falling back to the parent session model if unavailable.
1301
1301
  */
1302
1302
  model?: string;
1303
+ /**
1304
+ * Reasoning effort level for this agent's model.
1305
+ * When omitted, no per-agent override is sent and the backend chooses its
1306
+ * default. The parent session effort is not inherited.
1307
+ */
1308
+ reasoningEffort?: ReasoningEffort;
1303
1309
  }
1304
1310
  /**
1305
1311
  * Configuration for the default agent (the built-in agent that handles
@@ -1492,6 +1498,42 @@ export interface CapiSessionOptions {
1492
1498
  */
1493
1499
  enableWebSocketResponses?: boolean;
1494
1500
  }
1501
+ /**
1502
+ * A single ExP (Experiment Platform) flag value. ExP assignments resolve to a
1503
+ * string, number, boolean, or `null`.
1504
+ */
1505
+ export type ExpFlagValue = string | number | boolean | null;
1506
+ /**
1507
+ * A single configuration entry in a {@link CopilotExpAssignmentResponse}. Each
1508
+ * entry carries an identifier and a bag of typed parameter values.
1509
+ */
1510
+ export interface ExpConfigEntry {
1511
+ /** Identifier of the configuration entry. */
1512
+ Id: string;
1513
+ /** Parameter values keyed by parameter name. */
1514
+ Parameters: Record<string, ExpFlagValue>;
1515
+ }
1516
+ /**
1517
+ * ExP ("flight") assignment data, in the same JSON shape the Copilot CLI
1518
+ * fetches from the experimentation service. Field names are PascalCase to match
1519
+ * the on-the-wire contract consumed by the runtime.
1520
+ */
1521
+ export interface CopilotExpAssignmentResponse {
1522
+ /** Enabled feature names. */
1523
+ Features: string[];
1524
+ /** Assigned flights keyed by flight name. */
1525
+ Flights: Record<string, string>;
1526
+ /** Configuration entries carrying typed parameter values. */
1527
+ Configs: ExpConfigEntry[];
1528
+ /** Opaque parameter-group payload passed through untouched. */
1529
+ ParameterGroups?: unknown;
1530
+ /** Version of the flighting configuration. */
1531
+ FlightingVersion?: number;
1532
+ /** Impression identifier for the assignment. */
1533
+ ImpressionId?: string;
1534
+ /** Assignment context string forwarded to CAPI and telemetry. */
1535
+ AssignmentContext: string;
1536
+ }
1495
1537
  /**
1496
1538
  * Shared configuration fields used by both {@link SessionConfig} (for
1497
1539
  * creating a new session) and {@link ResumeSessionConfig} (for resuming
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/github/copilot-sdk.git"
6
6
  },
7
- "version": "1.0.7",
7
+ "version": "1.0.8",
8
8
  "description": "TypeScript SDK for programmatic control of GitHub Copilot CLI via JSON-RPC",
9
9
  "main": "./dist/cjs/index.js",
10
10
  "types": "./dist/index.d.ts",
@@ -56,7 +56,7 @@
56
56
  "author": "GitHub",
57
57
  "license": "MIT",
58
58
  "dependencies": {
59
- "@github/copilot": "^1.0.71",
59
+ "@github/copilot": "^1.0.73",
60
60
  "koffi": "^3.1.0",
61
61
  "vscode-jsonrpc": "^8.2.1",
62
62
  "zod": "^4.3.6"