| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[Core] Add Factory Pause Checkpoints (#2537) * [Core] Add Factory Pause Checkpoints Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * [Core] Expose SDK Pause Checkpoints Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * [Core] Clean Up Factory Pause Checkpoints Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Address factory pause review feedback Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2d06445-b3d6-4328-834f-81fceb95019c * Update factory guard E2E expectations Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2d06445-b3d6-4328-834f-81fceb95019c * Add factory pause E2E coverage Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2d06445-b3d6-4328-834f-81fceb95019c * Avoid race in factory E2E counter Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2d06445-b3d6-4328-834f-81fceb95019c --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2d06445-b3d6-4328-834f-81fceb95019c | 8 天前 | |
TypeScript SDK API review fixes (#1357) * Phase A: property/method renames on SessionConfig/ResumeSessionConfig Mirrors C# PR #1343 Phase 4a renames: - onExitPlanMode -> onExitPlanModeRequest - onAutoModeSwitch -> onAutoModeSwitchRequest - createSessionFsHandler -> createSessionFsProvider - ResumeSessionConfig.disableResume -> suppressResumeEvent - ProviderConfig.maxInputTokens -> maxPromptTokens (drops the wire shim) - CopilotSession.getMessages() -> getEvents() - InputOptions -> UiInputOptions Wire RPC name 'session.getMessages' is unchanged (runtime contract). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase C: CopilotClientOptions / MCP / streaming shape changes - Remove autoStart and autoRestart from CopilotClientOptions. The client now always starts on first createSession/resumeSession; users can still call client.start() explicitly for eager startup. - Make MCPServerConfigBase.tools optional (undefined = all, [] = none). - Fix streaming JSDoc block comment that wasn't attached due to single-star. Mirrors C# PR #1343 Phase 4c. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase D: lifecycle event polymorphic union + Date timestamps - Split SessionLifecycleEvent into a discriminated union of SessionCreatedEvent / SessionDeletedEvent / SessionUpdatedEvent / SessionForegroundEvent / SessionBackgroundEvent. - Promote the metadata payload into a named SessionLifecycleEventMetadata interface; metadata is required on non-delete variants and absent on session.deleted. - Convert metadata.startTime and metadata.modifiedTime from string to Date, matching SessionMetadata. Parse on receipt in client.handleSessionLifecycleNotification. - Export the new variant types from index.ts. Mirrors C# PR #1343 Phase 4f + review §2.3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase E: hook input timestamps as Date - Change BaseHookInput.timestamp from number (Unix ms) to Date. - Parse incoming numeric timestamps into Date in handleHooksInvoke. - Update hooks_extended.e2e.test.ts assertion accordingly. Mirrors C# PR #1343 Phase 4g. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase F: PermissionRequestResult.feedback + use generated PermissionRequest union - Add optional feedback?: string field to PermissionRequestResult so consumers can return free-form text forwarded to the model with the decision. - Delete the hand-written narrow PermissionRequest interface in types.ts and re-export the generated discriminated union from session-events.ts instead. Handlers can now type-safely access per-kind fields (e.g. shell .commands, write .fileName / .diff, mcp .toolName / .args). Mirrors C# PR #1343 Phase 4g + review §2.9. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase G: extract SessionConfigBase Replaces the fragile Pick<SessionConfig, '...30+ keys...'> definition for ResumeSessionConfig with a shared SessionConfigBase interface. SessionConfig and ResumeSessionConfig now both extend it: - SessionConfig adds sessionId? and cloud?. - ResumeSessionConfig adds suppressResumeEvent? and continuePendingWork?. SessionConfigBase is exported from index.ts for consumers that want to build shared helpers over both shapes. Mirrors C# PR #1343 Phase 5 + review §2.2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase H: defineTool({ name, ... }) single-arg form Change defineTool from defineTool(name, config) to defineTool({ name, ...config }) so the call shape matches the Tool<T> interface. name remains mandatory and is enforced by the Tool<T> type. Updates all samples, docs, tests, and the CHANGELOG snippet. Review §1.3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert "Phase H: defineTool({ name, ... }) single-arg form" This reverts commit 49da9117b4403ce9e57078861582d872916622d6. * Phase I: RuntimeConnection discriminated config Replaces the flat connection-related fields on CopilotClientOptions (cliPath, cliArgs, port, useStdio, cliUrl, tcpConnectionToken, isChildProcess) with a single discriminated 'connection?: RuntimeConnection' field. Construct values via factory functions: RuntimeConnection.forStdio({ path?, args? }) // default RuntimeConnection.forTcp({ port?, connectionToken?, path?, args? }) RuntimeConnection.forUri(url, { connectionToken? }) The mutually-exclusive combinations that used to be runtime errors are now caught at compile time by the discriminated union. The previous isChildProcess flag (only ever used by joinSession() in extension.ts) is dropped from the public API surface; extension.ts now uses an @internal _internalConnection hook to enter the parent-process stdio mode. Other renames in this phase: - CopilotClientOptions.copilotHome -> baseDirectory. - Internal CopilotClient.actualPort field -> runtimePort. All TS test files, scenario fixtures, samples, README, and docs updated to the new shape. Mirrors C# PR #1343 Phase 9. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase J: send / sendAndWait string overloads Both methods now accept either a MessageOptions object or just a string prompt. The string form is a shorthand for { prompt }: await session.send('Hello'); await session.sendAndWait('Hello'); Mirrors C# PR #1343 Phase 7. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase K: stripInternal, AsyncDisposable, clean stop(), drop destroy() - Enable stripInternal in tsconfig.json so @internal members no longer appear in the published .d.ts. Verified that CopilotSession constructor, the register*/clientSessionApis hooks, _handle* methods, NO_RESULT_PERMISSION_V2_ERROR, _internalConnection, and ParentProcessRuntimeConnection are all stripped from the public types. The MessageConnection import from vscode-jsonrpc no longer leaks either. - Tag NO_RESULT_PERMISSION_V2_ERROR with @internal explicitly. - Implement Symbol.asyncDispose on CopilotClient so it works inside 'await using' blocks, matching CopilotSession. - Tighten client.stop() so the Node process can exit cleanly without process.exit(): socket.destroy() in addition to socket.end(), explicit destroy() on the child process stdio streams, and cliProcess.unref(). Manually verified by running examples/basic-example.ts against a live runtime: the process exits within a few seconds of the await using block ending. - Remove the deprecated CopilotSession.destroy() alias. - Rewrite examples/basic-example.ts to import from '@github/copilot-sdk' (not '../src/index.js') and demonstrate the await using pattern with the new send/sendAndWait string overloads. Covers review §2.4, §2.5, §2.10, §3.1, §3.2, §4.1, §4.3 and the C# PR's Phase 8 docs/sample updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase L: fix githubToken typos in scenario fixtures Twenty-one test/scenarios/**/typescript/src/index.ts files used 'githubToken: process.env.GITHUB_TOKEN' (lowercase h) instead of the correct 'gitHubToken'. They silently passed an unrecognized property and the runtime ignored the token. Fix in lock-step across all affected scenarios. The existing 'typecheck' npm script already runs 'tsc --noEmit -p tsconfig.test.json' in CI, so no further CI wiring is needed to prevent regressions: this typo would now be a compile error under the SDK's strict CopilotClientOptions shape. Other Phase L items (missing onPermissionRequest, invalid permission kinds, resumeSession scenarios without config) were either already caught by the runtime PR or do not apply to TS — no remaining work. Covers review §1.1, §2.1, §2.8, §2.11. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase L follow-up: run prettier --write over all modified files Prettier check failed on Ubuntu CI because several files modified in earlier phases didn't get re-formatted after the bulk regex rewrites. Running 'npm run format' (prettier --write) normalizes them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Phase I/E/L test failures surfaced by CI - commands/multi-client/ui_elicitation: shorthand 'copilotClientOptions: { tcpConnectionToken }' wasn't matched by the earlier batch rewrite, so client1 was still spawned in stdio mode while client2 tried to connect by URI. Switch the harness call to TCP + RuntimeConnection.forTcp({ connectionToken: tcpConnectionToken }). - session_fs.e2e.test.ts: add the missing RuntimeConnection import. - hooks_extended.e2e.test.ts: SessionStart and UserPromptSubmitted timestamp assertions still used toBeGreaterThan(0) but BaseHookInput.timestamp is now Date. Switch to toBeInstanceOf(Date). - client.test.ts: delete the two obsolete 'allows *Session without onPermissionRequest' unit tests. They asserted on the 'Client not connected' error that only occurred when autoStart was false; with Phase C removing autoStart, the client now auto-starts on the first session call and those tests would need a real spawned runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add E2E equivalents of removed createSession/resumeSession-without-permission tests The two client.test.ts unit tests deleted in the previous commit only asserted that createSession/resumeSession surface 'Client not connected' when called pre-start. The intent behind them was to confirm that omitting onPermissionRequest doesn't itself throw. With autoStart gone, the only meaningful version of that test is an E2E one that actually spawns a runtime. Port the equivalent C# coverage (ClientE2ETests.Should_Allow_*Session_Called_Without_PermissionHandler) to client.e2e.test.ts so we have parity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add E2E tests for createSession/resumeSession without onPermissionRequest Ports dotnet's Should_Allow_CreateSession_Called_Without_PermissionHandler (Theory: stdio + tcp) and Should_Allow_ResumeSession_Called_Without_PermissionHandler from dotnet/test/E2E/ClientE2ETests.cs into nodejs/test/e2e/session.e2e.test.ts. These exercise the contract that {onPermissionRequest} is optional on both SessionConfig and ResumeSessionConfig: when not provided, the runtime leaves permission prompts pending for the consumer to resolve via the low-level RPC. Without these tests, that contract was unprotected against regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Harness: preserve caller-supplied RuntimeConnection while still injecting CLI path Earlier batch rewrite of createSdkTestContext meant that whenever a test passed copilotClientOptions.connection, the spread overrode the harness's own connection variant entirely - losing the COPILOT_CLI_PATH binding. Now merge by variant kind: if the caller asks for tcp/stdio without a path, the harness fills it in from COPILOT_CLI_PATH; explicit values from the caller win. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * session_fs.e2e: fix unconverted tcpConnectionToken flat key on inner client In the 'should reject setProvider when sessions already exist' test, the first client was still using the flat tcpConnectionToken property which is no longer a valid CopilotClientOptions field. Switch to RuntimeConnection.forTcp({ connectionToken }). Verified locally: full session_fs.e2e.test.ts suite (9 tests) now passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Move hook input deserialization next to the cast that types it normalizeHookInput lived in client.ts and inspected for a 'timestamp' property by name, which felt magical (brittle against any future hook-shaped wire payload that happens to contain a numeric 'timestamp'). Move the conversion into CopilotSession._handleHooksInvoke, renamed deserializeHookInput, right next to the GenericHandler cast that says 'this unknown is now a HookInput'. That's the only call site that actually knows the payload is a hook input, so it's the correct boundary for the schema transform. This is the TS equivalent of what C# does via UnixMillisecondsDateTimeOffsetConverter (attached per-property on each HookInput.Timestamp); TS just plumbs the same conversion through the hooks dispatcher instead of a per-type JSON converter. Verified 3/3 hooks_extended.e2e tests pass locally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase K refinement: use unref() instead of destroy() in client.stop() destroy() on the child's stdio pipes and the TCP socket is more aggressive than needed. If the child crashes with a useful message on stderr that our existing data listener hasn't drained yet, stderr.destroy() drops it. If there's an in-flight write to stdin, destroy() raises 'error' on the stream. Same trade-off for socket.destroy() short-circuiting the graceful FIN/ACK. unref() solves the actual problem (event loop staying alive after stop()) without disrupting late output. From the Node docs: 'unref will allow the program to exit if this is the only active socket in the event system. The socket does not lose any functionality' — error events still fire, late data still drains through registered listeners. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * client.stop(): await child exit and socket close Replace the unref()-based fire-and-forget cleanup with deterministic awaiting: - Socket: end() + await 'close'. By the time stop() returns the FIN/ACK exchange has completed. - ChildProcess: kill() + await 'exit'. By the time stop() returns the child has truly exited, its stdio pipes are closed, and there are no lingering handles to keep the event loop alive. No SIGKILL escalation. If the child ignores SIGTERM, stop() blocks; callers that need a guaranteed-bounded shutdown should use forceStop() (which already sends SIGKILL). Replaces the previous unref() approach: that worked for clean exit but allowed late stderr output to surface after stop() resolved, which is exactly the timing window where consumers expect cleanup to be done. Verified locally: full client.test.ts (75 tests) passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert incorrect feedback widening of PermissionRequestResult The previous '& { feedback?: string }' incorrectly added feedback to every variant of the union. In the runtime schema, feedback is reject-only — it appears only on PermissionDecisionReject and is already typed by the generated PermissionDecisionRequest['result'] union. No manual augmentation needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename client.on -> client.onLifecycle for cross-SDK consistency Matches the C# rename in PR #1357 Phase 4f (client.On -> client.OnLifecycle). client.onLifecycle is clearer than client.on at the call site because the two on() methods on CopilotClient and CopilotSession listen for completely different event families (lifecycle vs per-session). The receiver alone isn't always enough to disambiguate, especially in mixed code that holds both objects. session.on stays unchanged because that's where the bare 'on' verb belongs: session events are the primary stream for that object. Updates README + client_lifecycle.e2e.test.ts to the new name. Tests still pass (validated via tsc -p tsconfig.test.json). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Reformat src/types.ts after PermissionRequestResult revert Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review comments from #1357 - Add missing RuntimeConnection imports to 26 test/scenarios TypeScript fixtures. The earlier batch rewrite added the .forStdio/.forUri call sites but missed the corresponding import statement, so each scenario failed to compile until now. - nodejs/test/e2e/harness/sdkTestContext.ts: strip the 'kind' property before spreading a user-supplied RuntimeConnection back through the forStdio/forTcp factory opts. The factory opt types don't accept 'kind' so the spread was producing excess-property type errors. - nodejs/src/client.ts: rewrite the 'Path to Copilot CLI is required' error message to point at the new connection options (RuntimeConnection.forStdio({ path }), forTcp({ path }), forUri(...), or the COPILOT_CLI_PATH environment variable). The old message referenced removed cliPath / cliUrl options. - nodejs/src/client.ts: change the default logLevel from 'debug' to 'info'. 'debug' was a TS-only outlier; Python and Rust default to 'info', and the README has always claimed 'info'. Go and .NET don't pass --log-level at all when omitted (CLI defaults to info anyway), so 'info' is consistent with every other SDK's effective default. - nodejs/src/types.ts: fix MCPServerConfigBase.tools doc comment to spell the all-tools sentinel as ['*'] (the actual type is string[], so a bare '*' string can't be passed). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * logLevel: don't impose any default, match C#/Go Instead of defaulting to 'info' on the SDK side, omit the --log-level flag entirely when the caller didn't set one and let the runtime use its own default. Matches dotnet/Client.cs and go/client.go, which both only pass --log-level when explicitly provided. CopilotClientOptions.logLevel JSDoc and README updated to describe this ('When omitted, the runtime uses its own default'). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename CopilotClientOptions.remote -> enableRemoteSessions for cross-SDK consistency Matches the C# API review rename in #1343 (EnableRemoteSessions on CopilotClientOptions). The wire-level RPC field stays 'remote' since that is the runtime's contract; only the SDK surface changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> | 4 个月前 | |
nodejs: enforce exact npm dependency policy (#2700) * Enforce exact npm dependency policy Pin Node.js production dependencies at their existing resolved versions and require external npm releases to age seven full days before release packaging. Preserve exact requirements in packed packages and default future npm saves to exact versions. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a * Validate resolved production dependency ages Walk the package-lock v3 production closure so optional and transitive package versions are subject to the seven-day npm publication policy while dev-only packages remain excluded. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a | 5 天前 | |
nodejs: enforce exact npm dependency policy (#2700) * Enforce exact npm dependency policy Pin Node.js production dependencies at their existing resolved versions and require external npm releases to age seven full days before release packaging. Preserve exact requirements in packed packages and default future npm saves to exact versions. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a * Validate resolved production dependency ages Walk the package-lock v3 production closure so optional and transitive package versions are subject to the seven-day npm publication policy while dev-only packages remain excluded. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a | 5 天前 | |
Coalesce intercepted HTTP response chunks (#2734) * Coalesce intercepted HTTP response chunks Add bounded 32 KiB read-ahead across Node.js, Python, Go, .NET, and Java while preserving byte ordering, cancellation, and a single outstanding data RPC. Add protocol-level coverage for backpressure, cancellation, connection loss, and upstream errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix scenario event test concurrency Synchronize the resumed session event list while callbacks and assertions access it to avoid collection-modified failures in the Windows E2E matrix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix response forwarding lifecycle edge cases Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Explain expected response reader exceptions Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Resolve .NET merge-build duplication Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> | 2 天前 | |
Coalesce intercepted HTTP response chunks (#2734) * Coalesce intercepted HTTP response chunks Add bounded 32 KiB read-ahead across Node.js, Python, Go, .NET, and Java while preserving byte ordering, cancellation, and a single outstanding data RPC. Add protocol-level coverage for backpressure, cancellation, connection loss, and upstream errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix scenario event test concurrency Synchronize the resumed session event list while callbacks and assertions access it to avoid collection-modified failures in the Windows E2E matrix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix response forwarding lifecycle edge cases Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Explain expected response reader exceptions Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Resolve .NET merge-build duplication Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> | 2 天前 | |
Moving files into the correct locations (#84) * Moving files into the correct locations * Fixing paths from move | 7 个月前 | |
Moving files into the correct locations (#84) * Moving files into the correct locations * Fixing paths from move | 7 个月前 | |
nodejs: enforce exact npm dependency policy (#2700) * Enforce exact npm dependency policy Pin Node.js production dependencies at their existing resolved versions and require external npm releases to age seven full days before release packaging. Preserve exact requirements in packed packages and default future npm saves to exact versions. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a * Validate resolved production dependency ages Walk the package-lock v3 production closure so optional and transitive package versions are subject to the seven-day npm publication policy while dev-only packages remain excluded. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a | 5 天前 | |
Moving files into the correct locations (#84) * Moving files into the correct locations * Fixing paths from move | 7 个月前 | |
Moving files into the correct locations (#84) * Moving files into the correct locations * Fixing paths from move | 7 个月前 | |
Expand cross-SDK scenario and RPC E2E coverage (#2724) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> | 3 天前 | |
fix(nodejs): add CJS compatibility for VS Code extensions (#546) * fix(nodejs): add CJS compatibility for VS Code extensions (#528) Replace import.meta.resolve with createRequire + path walking in getBundledCliPath(). The new implementation falls back to __filename when import.meta.url is unavailable (shimmed CJS environments like VS Code extensions bundled with esbuild format:"cjs"). Single ESM build output retained — no dual CJS/ESM builds needed. The fallback logic handles both native ESM and shimmed CJS contexts. * docs(nodejs): note CJS bundle and system-installed CLI requirements * Dual ESM/CJS build for CommonJS compatibility (#528) Produce both ESM and CJS outputs from the esbuild config so that consumers using either module system get a working package automatically. - Add a second esbuild.build() call with format:"cjs" outputting to dist/cjs/ - Write a dist/cjs/package.json with type:"commonjs" so Node treats .js as CJS - Update package.json exports with "import" and "require" conditions for both the main and ./extension entry points - Revert getBundledCliPath() to use import.meta.resolve for ESM, with a createRequire + path-walking fallback for CJS contexts - Update CJS compatibility tests to verify the actual dual build - Update README to document CJS/CommonJS support Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com> * ci(nodejs): add build step before tests The CJS compatibility tests verify dist/ output, which requires a build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * style(nodejs): fix prettier formatting in changed files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * test(nodejs): verify CLI path resolution in both ESM and CJS builds Replace the cliUrl-based test (which skipped getBundledCliPath()) with tests that construct CopilotClient without cliUrl, actually exercising the bundled CLI resolution in both module formats. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * build(nodejs): suppress expected empty-import-meta warning in CJS build The CJS build intentionally produces empty import.meta — our runtime code detects this and falls back to createRequire. Silence the esbuild warning to avoid confusing contributors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> | 6 个月前 | |
Moving files into the correct locations (#84) * Moving files into the correct locations * Fixing paths from move | 7 个月前 | |
nodejs: enforce exact npm dependency policy (#2700) * Enforce exact npm dependency policy Pin Node.js production dependencies at their existing resolved versions and require external npm releases to age seven full days before release packaging. Preserve exact requirements in packed packages and default future npm saves to exact versions. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a * Validate resolved production dependency ages Walk the package-lock v3 production closure so optional and transitive package versions are subject to the seven-day npm publication policy while dev-only packages remain excluded. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 823a3ba3-43a5-4b6a-be71-625e7660994a | 5 天前 | |
Update Copilot CLI to 1.0.87-0 (#2731) * Repair codegen for Copilot CLI 1.0.87 schemas Disambiguate shared C# session request envelopes without weakening collision checks. Preserve Rust explicit unknown values and forward-compatible fallbacks from #2703. Resolve Go event payload references and preserve root event unions across bindings, with real envelope regressions and target-schema Java test adaptations. Validated with the 1.0.87-0 generated overlay; release pins and generated outputs are intentionally excluded from this source-only workflow seed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Update Copilot CLI to 1.0.87-0 - Updated the shared CLI release pin - Re-ran code generators - Formatted generated code * Fix CLI 1.0.87 replay fixtures and Java test formatting Preserve existing subagent histories and add only observed short-idle, full-history read variants with failure/cancellation rejection coverage. Apply the repository root Java formatter to the two repaired test files. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix Java shared RPC variant ownership Preserve historical public variant superclasses and emit contextual secondary-root variants with validated Jackson subtype registrations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Cover new Java RPC wrapper dispatch methods Exercise 29 new public endpoints and optional marketplace refresh with independent method, result type, payload, and session identity assertions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix Windows bundled CLI tar extractor availability Compile the private TAR helper only for non-Windows production or bundled unit tests, preserving Windows runtime-archive test coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(rust): preserve constant constraints on referenced fields Validate field-local literals before decoding extensible named enums so untagged catalogue candidates cannot consume another kind. Preserve public field types and standalone Unknown fallbacks; regenerate from CLI 1.0.87-0. Includes the exact AI-skill decoding regression and MCP/Plugin controls. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Hunter Sadler <aurokin@github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 4 天前 | |
TypeScript SDK API review fixes (#1357) * Phase A: property/method renames on SessionConfig/ResumeSessionConfig Mirrors C# PR #1343 Phase 4a renames: - onExitPlanMode -> onExitPlanModeRequest - onAutoModeSwitch -> onAutoModeSwitchRequest - createSessionFsHandler -> createSessionFsProvider - ResumeSessionConfig.disableResume -> suppressResumeEvent - ProviderConfig.maxInputTokens -> maxPromptTokens (drops the wire shim) - CopilotSession.getMessages() -> getEvents() - InputOptions -> UiInputOptions Wire RPC name 'session.getMessages' is unchanged (runtime contract). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase C: CopilotClientOptions / MCP / streaming shape changes - Remove autoStart and autoRestart from CopilotClientOptions. The client now always starts on first createSession/resumeSession; users can still call client.start() explicitly for eager startup. - Make MCPServerConfigBase.tools optional (undefined = all, [] = none). - Fix streaming JSDoc block comment that wasn't attached due to single-star. Mirrors C# PR #1343 Phase 4c. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase D: lifecycle event polymorphic union + Date timestamps - Split SessionLifecycleEvent into a discriminated union of SessionCreatedEvent / SessionDeletedEvent / SessionUpdatedEvent / SessionForegroundEvent / SessionBackgroundEvent. - Promote the metadata payload into a named SessionLifecycleEventMetadata interface; metadata is required on non-delete variants and absent on session.deleted. - Convert metadata.startTime and metadata.modifiedTime from string to Date, matching SessionMetadata. Parse on receipt in client.handleSessionLifecycleNotification. - Export the new variant types from index.ts. Mirrors C# PR #1343 Phase 4f + review §2.3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase E: hook input timestamps as Date - Change BaseHookInput.timestamp from number (Unix ms) to Date. - Parse incoming numeric timestamps into Date in handleHooksInvoke. - Update hooks_extended.e2e.test.ts assertion accordingly. Mirrors C# PR #1343 Phase 4g. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase F: PermissionRequestResult.feedback + use generated PermissionRequest union - Add optional feedback?: string field to PermissionRequestResult so consumers can return free-form text forwarded to the model with the decision. - Delete the hand-written narrow PermissionRequest interface in types.ts and re-export the generated discriminated union from session-events.ts instead. Handlers can now type-safely access per-kind fields (e.g. shell .commands, write .fileName / .diff, mcp .toolName / .args). Mirrors C# PR #1343 Phase 4g + review §2.9. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase G: extract SessionConfigBase Replaces the fragile Pick<SessionConfig, '...30+ keys...'> definition for ResumeSessionConfig with a shared SessionConfigBase interface. SessionConfig and ResumeSessionConfig now both extend it: - SessionConfig adds sessionId? and cloud?. - ResumeSessionConfig adds suppressResumeEvent? and continuePendingWork?. SessionConfigBase is exported from index.ts for consumers that want to build shared helpers over both shapes. Mirrors C# PR #1343 Phase 5 + review §2.2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase H: defineTool({ name, ... }) single-arg form Change defineTool from defineTool(name, config) to defineTool({ name, ...config }) so the call shape matches the Tool<T> interface. name remains mandatory and is enforced by the Tool<T> type. Updates all samples, docs, tests, and the CHANGELOG snippet. Review §1.3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert "Phase H: defineTool({ name, ... }) single-arg form" This reverts commit 49da9117b4403ce9e57078861582d872916622d6. * Phase I: RuntimeConnection discriminated config Replaces the flat connection-related fields on CopilotClientOptions (cliPath, cliArgs, port, useStdio, cliUrl, tcpConnectionToken, isChildProcess) with a single discriminated 'connection?: RuntimeConnection' field. Construct values via factory functions: RuntimeConnection.forStdio({ path?, args? }) // default RuntimeConnection.forTcp({ port?, connectionToken?, path?, args? }) RuntimeConnection.forUri(url, { connectionToken? }) The mutually-exclusive combinations that used to be runtime errors are now caught at compile time by the discriminated union. The previous isChildProcess flag (only ever used by joinSession() in extension.ts) is dropped from the public API surface; extension.ts now uses an @internal _internalConnection hook to enter the parent-process stdio mode. Other renames in this phase: - CopilotClientOptions.copilotHome -> baseDirectory. - Internal CopilotClient.actualPort field -> runtimePort. All TS test files, scenario fixtures, samples, README, and docs updated to the new shape. Mirrors C# PR #1343 Phase 9. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase J: send / sendAndWait string overloads Both methods now accept either a MessageOptions object or just a string prompt. The string form is a shorthand for { prompt }: await session.send('Hello'); await session.sendAndWait('Hello'); Mirrors C# PR #1343 Phase 7. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase K: stripInternal, AsyncDisposable, clean stop(), drop destroy() - Enable stripInternal in tsconfig.json so @internal members no longer appear in the published .d.ts. Verified that CopilotSession constructor, the register*/clientSessionApis hooks, _handle* methods, NO_RESULT_PERMISSION_V2_ERROR, _internalConnection, and ParentProcessRuntimeConnection are all stripped from the public types. The MessageConnection import from vscode-jsonrpc no longer leaks either. - Tag NO_RESULT_PERMISSION_V2_ERROR with @internal explicitly. - Implement Symbol.asyncDispose on CopilotClient so it works inside 'await using' blocks, matching CopilotSession. - Tighten client.stop() so the Node process can exit cleanly without process.exit(): socket.destroy() in addition to socket.end(), explicit destroy() on the child process stdio streams, and cliProcess.unref(). Manually verified by running examples/basic-example.ts against a live runtime: the process exits within a few seconds of the await using block ending. - Remove the deprecated CopilotSession.destroy() alias. - Rewrite examples/basic-example.ts to import from '@github/copilot-sdk' (not '../src/index.js') and demonstrate the await using pattern with the new send/sendAndWait string overloads. Covers review §2.4, §2.5, §2.10, §3.1, §3.2, §4.1, §4.3 and the C# PR's Phase 8 docs/sample updates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase L: fix githubToken typos in scenario fixtures Twenty-one test/scenarios/**/typescript/src/index.ts files used 'githubToken: process.env.GITHUB_TOKEN' (lowercase h) instead of the correct 'gitHubToken'. They silently passed an unrecognized property and the runtime ignored the token. Fix in lock-step across all affected scenarios. The existing 'typecheck' npm script already runs 'tsc --noEmit -p tsconfig.test.json' in CI, so no further CI wiring is needed to prevent regressions: this typo would now be a compile error under the SDK's strict CopilotClientOptions shape. Other Phase L items (missing onPermissionRequest, invalid permission kinds, resumeSession scenarios without config) were either already caught by the runtime PR or do not apply to TS — no remaining work. Covers review §1.1, §2.1, §2.8, §2.11. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase L follow-up: run prettier --write over all modified files Prettier check failed on Ubuntu CI because several files modified in earlier phases didn't get re-formatted after the bulk regex rewrites. Running 'npm run format' (prettier --write) normalizes them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Phase I/E/L test failures surfaced by CI - commands/multi-client/ui_elicitation: shorthand 'copilotClientOptions: { tcpConnectionToken }' wasn't matched by the earlier batch rewrite, so client1 was still spawned in stdio mode while client2 tried to connect by URI. Switch the harness call to TCP + RuntimeConnection.forTcp({ connectionToken: tcpConnectionToken }). - session_fs.e2e.test.ts: add the missing RuntimeConnection import. - hooks_extended.e2e.test.ts: SessionStart and UserPromptSubmitted timestamp assertions still used toBeGreaterThan(0) but BaseHookInput.timestamp is now Date. Switch to toBeInstanceOf(Date). - client.test.ts: delete the two obsolete 'allows *Session without onPermissionRequest' unit tests. They asserted on the 'Client not connected' error that only occurred when autoStart was false; with Phase C removing autoStart, the client now auto-starts on the first session call and those tests would need a real spawned runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add E2E equivalents of removed createSession/resumeSession-without-permission tests The two client.test.ts unit tests deleted in the previous commit only asserted that createSession/resumeSession surface 'Client not connected' when called pre-start. The intent behind them was to confirm that omitting onPermissionRequest doesn't itself throw. With autoStart gone, the only meaningful version of that test is an E2E one that actually spawns a runtime. Port the equivalent C# coverage (ClientE2ETests.Should_Allow_*Session_Called_Without_PermissionHandler) to client.e2e.test.ts so we have parity. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add E2E tests for createSession/resumeSession without onPermissionRequest Ports dotnet's Should_Allow_CreateSession_Called_Without_PermissionHandler (Theory: stdio + tcp) and Should_Allow_ResumeSession_Called_Without_PermissionHandler from dotnet/test/E2E/ClientE2ETests.cs into nodejs/test/e2e/session.e2e.test.ts. These exercise the contract that {onPermissionRequest} is optional on both SessionConfig and ResumeSessionConfig: when not provided, the runtime leaves permission prompts pending for the consumer to resolve via the low-level RPC. Without these tests, that contract was unprotected against regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Harness: preserve caller-supplied RuntimeConnection while still injecting CLI path Earlier batch rewrite of createSdkTestContext meant that whenever a test passed copilotClientOptions.connection, the spread overrode the harness's own connection variant entirely - losing the COPILOT_CLI_PATH binding. Now merge by variant kind: if the caller asks for tcp/stdio without a path, the harness fills it in from COPILOT_CLI_PATH; explicit values from the caller win. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * session_fs.e2e: fix unconverted tcpConnectionToken flat key on inner client In the 'should reject setProvider when sessions already exist' test, the first client was still using the flat tcpConnectionToken property which is no longer a valid CopilotClientOptions field. Switch to RuntimeConnection.forTcp({ connectionToken }). Verified locally: full session_fs.e2e.test.ts suite (9 tests) now passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Move hook input deserialization next to the cast that types it normalizeHookInput lived in client.ts and inspected for a 'timestamp' property by name, which felt magical (brittle against any future hook-shaped wire payload that happens to contain a numeric 'timestamp'). Move the conversion into CopilotSession._handleHooksInvoke, renamed deserializeHookInput, right next to the GenericHandler cast that says 'this unknown is now a HookInput'. That's the only call site that actually knows the payload is a hook input, so it's the correct boundary for the schema transform. This is the TS equivalent of what C# does via UnixMillisecondsDateTimeOffsetConverter (attached per-property on each HookInput.Timestamp); TS just plumbs the same conversion through the hooks dispatcher instead of a per-type JSON converter. Verified 3/3 hooks_extended.e2e tests pass locally. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Phase K refinement: use unref() instead of destroy() in client.stop() destroy() on the child's stdio pipes and the TCP socket is more aggressive than needed. If the child crashes with a useful message on stderr that our existing data listener hasn't drained yet, stderr.destroy() drops it. If there's an in-flight write to stdin, destroy() raises 'error' on the stream. Same trade-off for socket.destroy() short-circuiting the graceful FIN/ACK. unref() solves the actual problem (event loop staying alive after stop()) without disrupting late output. From the Node docs: 'unref will allow the program to exit if this is the only active socket in the event system. The socket does not lose any functionality' — error events still fire, late data still drains through registered listeners. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * client.stop(): await child exit and socket close Replace the unref()-based fire-and-forget cleanup with deterministic awaiting: - Socket: end() + await 'close'. By the time stop() returns the FIN/ACK exchange has completed. - ChildProcess: kill() + await 'exit'. By the time stop() returns the child has truly exited, its stdio pipes are closed, and there are no lingering handles to keep the event loop alive. No SIGKILL escalation. If the child ignores SIGTERM, stop() blocks; callers that need a guaranteed-bounded shutdown should use forceStop() (which already sends SIGKILL). Replaces the previous unref() approach: that worked for clean exit but allowed late stderr output to surface after stop() resolved, which is exactly the timing window where consumers expect cleanup to be done. Verified locally: full client.test.ts (75 tests) passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Revert incorrect feedback widening of PermissionRequestResult The previous '& { feedback?: string }' incorrectly added feedback to every variant of the union. In the runtime schema, feedback is reject-only — it appears only on PermissionDecisionReject and is already typed by the generated PermissionDecisionRequest['result'] union. No manual augmentation needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename client.on -> client.onLifecycle for cross-SDK consistency Matches the C# rename in PR #1357 Phase 4f (client.On -> client.OnLifecycle). client.onLifecycle is clearer than client.on at the call site because the two on() methods on CopilotClient and CopilotSession listen for completely different event families (lifecycle vs per-session). The receiver alone isn't always enough to disambiguate, especially in mixed code that holds both objects. session.on stays unchanged because that's where the bare 'on' verb belongs: session events are the primary stream for that object. Updates README + client_lifecycle.e2e.test.ts to the new name. Tests still pass (validated via tsc -p tsconfig.test.json). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Reformat src/types.ts after PermissionRequestResult revert Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address PR review comments from #1357 - Add missing RuntimeConnection imports to 26 test/scenarios TypeScript fixtures. The earlier batch rewrite added the .forStdio/.forUri call sites but missed the corresponding import statement, so each scenario failed to compile until now. - nodejs/test/e2e/harness/sdkTestContext.ts: strip the 'kind' property before spreading a user-supplied RuntimeConnection back through the forStdio/forTcp factory opts. The factory opt types don't accept 'kind' so the spread was producing excess-property type errors. - nodejs/src/client.ts: rewrite the 'Path to Copilot CLI is required' error message to point at the new connection options (RuntimeConnection.forStdio({ path }), forTcp({ path }), forUri(...), or the COPILOT_CLI_PATH environment variable). The old message referenced removed cliPath / cliUrl options. - nodejs/src/client.ts: change the default logLevel from 'debug' to 'info'. 'debug' was a TS-only outlier; Python and Rust default to 'info', and the README has always claimed 'info'. Go and .NET don't pass --log-level at all when omitted (CLI defaults to info anyway), so 'info' is consistent with every other SDK's effective default. - nodejs/src/types.ts: fix MCPServerConfigBase.tools doc comment to spell the all-tools sentinel as ['*'] (the actual type is string[], so a bare '*' string can't be passed). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * logLevel: don't impose any default, match C#/Go Instead of defaulting to 'info' on the SDK side, omit the --log-level flag entirely when the caller didn't set one and let the runtime use its own default. Matches dotnet/Client.cs and go/client.go, which both only pass --log-level when explicitly provided. CopilotClientOptions.logLevel JSDoc and README updated to describe this ('When omitted, the runtime uses its own default'). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Rename CopilotClientOptions.remote -> enableRemoteSessions for cross-SDK consistency Matches the C# API review rename in #1343 (EnableRemoteSessions on CopilotClientOptions). The wire-level RPC field stays 'remote' since that is the runtime's contract; only the SDK surface changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> | 4 个月前 | |
Coalesce intercepted HTTP response chunks (#2734) * Coalesce intercepted HTTP response chunks Add bounded 32 KiB read-ahead across Node.js, Python, Go, .NET, and Java while preserving byte ordering, cancellation, and a single outstanding data RPC. Add protocol-level coverage for backpressure, cancellation, connection loss, and upstream errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix scenario event test concurrency Synchronize the resumed session event list while callbacks and assertions access it to avoid collection-modified failures in the Windows E2E matrix. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix response forwarding lifecycle edge cases Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Explain expected response reader exceptions Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Resolve .NET merge-build duplication Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> | 2 天前 | |
Update @github/copilot to 1.0.81-5 (#2364) * Update @github/copilot to 1.0.81-5 - Updated nodejs and test harness dependencies - Re-ran code generators - Formatted generated code * Restore runtime-blocked test coverage Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Keep ephemeral query coverage disabled Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix Python denied-tool E2E race Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e94289c-90c8-4664-a878-056539754908 * Keep .NET in-process CAPI legs disabled Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e94289c-90c8-4664-a878-056539754908 * Keep blocked in-process model suites excluded Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e94289c-90c8-4664-a878-056539754908 * Split hanging macOS .NET test shard Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e94289c-90c8-4664-a878-056539754908 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4e94289c-90c8-4664-a878-056539754908 | 1 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 8 天前 | ||
| 4 个月前 | ||
| 5 天前 | ||
| 5 天前 | ||
| 2 天前 | ||
| 2 天前 | ||
| 7 个月前 | ||
| 7 个月前 | ||
| 5 天前 | ||
| 7 个月前 | ||
| 7 个月前 | ||
| 3 天前 | ||
| 6 个月前 | ||
| 7 个月前 | ||
| 5 天前 | ||
| 4 天前 | ||
| 4 个月前 | ||
| 2 天前 | ||
| 1 个月前 |