@love-moon/ai-sdk 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @love-moon/ai-sdk
2
2
 
3
+ ## 0.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e8936fb: Upgrade the GitHub Copilot SDK permission protocol so Copilot-backed tasks auto-approve tool calls with current Copilot CLI releases instead of failing with `unexpected user permission response`.
8
+
9
+ ## 0.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - aada753: Add explicit ChatGPT and Gemini web backend aliases, expose project icon
14
+ configuration in generated CLI settings, and default browser-backed session
15
+ checks to headed mode for reliable authenticated detection.
16
+
3
17
  ## 0.4.0
4
18
 
5
19
  ### Minor Changes
@@ -371,7 +371,7 @@ function resolveClientOptions(opts) {
371
371
  useLoggedInUser: explicitGithubToken
372
372
  ? opts.clientOptions?.useLoggedInUser
373
373
  : opts.clientOptions?.useLoggedInUser ?? true,
374
- ...(opts.githubToken ? { githubToken: opts.githubToken } : {}),
374
+ ...(opts.githubToken ? { gitHubToken: opts.githubToken } : {}),
375
375
  };
376
376
  if (options.cliPath === undefined &&
377
377
  options.cliUrl === undefined &&
@@ -384,7 +384,7 @@ function resolveClientOptions(opts) {
384
384
  return options;
385
385
  }
386
386
  function resolveExplicitGithubToken(opts) {
387
- return opts.githubToken ?? opts.clientOptions?.githubToken;
387
+ return opts.githubToken ?? opts.clientOptions?.gitHubToken;
388
388
  }
389
389
  function hasExplicitCopilotCliPathEnv(env) {
390
390
  return Boolean(typeof env?.COPILOT_CLI_PATH === "string" && env.COPILOT_CLI_PATH.trim());
@@ -472,7 +472,7 @@ function resolveKnownGitHubHost(rawHost) {
472
472
  return host || envHost || undefined;
473
473
  }
474
474
  function resolveGitHubLoginToken(opts) {
475
- return opts.githubToken ?? opts.clientOptions?.githubToken ?? process.env.GITHUB_TOKEN;
475
+ return opts.githubToken ?? opts.clientOptions?.gitHubToken ?? process.env.GITHUB_TOKEN;
476
476
  }
477
477
  async function fetchCopilotUserQuota(authInfo, opts, doFetch, timeoutMs) {
478
478
  if (!timeoutMs || timeoutMs <= 0)
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * Lifecycle:
15
15
  * - `boot()` lazily imports `@love-moon/chat-web`, registers its built-in
16
- * providers, and opens a long-lived `ChatSession` (headless by default).
16
+ * providers, and opens a long-lived `ChatSession` (headed by default).
17
17
  * - `runTurn(prompt)` calls `session.send(prompt)` and emits a single
18
18
  * `assistant_message` with the model's reply.
19
19
  * - `close()` tears the Chromium context down.
@@ -102,7 +102,7 @@ function isPlaywrightMissingError(error) {
102
102
  *
103
103
  * Lifecycle:
104
104
  * - `boot()` lazily imports `@love-moon/chat-web`, registers its built-in
105
- * providers, and opens a long-lived `ChatSession` (headless by default).
105
+ * providers, and opens a long-lived `ChatSession` (headed by default).
106
106
  * - `runTurn(prompt)` calls `session.send(prompt)` and emits a single
107
107
  * `assistant_message` with the model's reply.
108
108
  * - `close()` tears the Chromium context down.
@@ -119,7 +119,16 @@ export class ChatWebSession extends EventEmitter {
119
119
  this.options = options;
120
120
  this.logger = normalizeLogger(options.logger);
121
121
  this.chatWebProvider = resolveChatWebProvider(options);
122
- this.headless = options.headless !== false;
122
+ // Match chat-web SDK's own default (headed). Per chat-web/core/browser.ts
123
+ // resolveHeadless(), headed mode is the documented safe default for
124
+ // anti-bot heuristics — ChatGPT/AI Studio routinely serve unauthenticated
125
+ // or challenge pages to chrome-headless-shell even when profile cookies
126
+ // are valid, which masquerades as "not logged in" downstream. The old
127
+ // `options.headless !== false` defaulted to true and effectively neutered
128
+ // chat-web's anti-bot stance whenever the caller (daemon, serve-ai)
129
+ // didn't explicitly pass a value. Users who actually want headless must
130
+ // now opt in with an explicit `headless: true`.
131
+ this.headless = options.headless === true;
123
132
  // Optional: use a specific Chromium-family binary (system Chrome /
124
133
  // Edge / explicit path) instead of Playwright's bundled
125
134
  // `chrome-headless-shell`. Useful when the user's network treats
@@ -405,10 +405,10 @@ function buildCopilotClientOptions(options, cwd, env) {
405
405
  const explicitGithubToken = typeof options.githubToken === "string" && options.githubToken.trim()
406
406
  ? options.githubToken.trim()
407
407
  : "";
408
- if (clientOptions.githubToken === undefined && explicitGithubToken) {
409
- clientOptions.githubToken = explicitGithubToken;
408
+ if (clientOptions.gitHubToken === undefined && explicitGithubToken) {
409
+ clientOptions.gitHubToken = explicitGithubToken;
410
410
  }
411
- const hasExplicitGithubToken = typeof clientOptions.githubToken === "string" && clientOptions.githubToken.trim();
411
+ const hasExplicitGithubToken = typeof clientOptions.gitHubToken === "string" && clientOptions.gitHubToken.trim();
412
412
  if (clientOptions.useLoggedInUser === undefined && typeof options.useLoggedInUser === "boolean") {
413
413
  clientOptions.useLoggedInUser = options.useLoggedInUser;
414
414
  }
@@ -908,7 +908,7 @@ export class CopilotSdkSession extends EventEmitter {
908
908
  }
909
909
  const permissionHandler = typeof sdkModule.approveAll === "function"
910
910
  ? sdkModule.approveAll
911
- : () => ({ kind: "approved" });
911
+ : () => ({ kind: "approve-once" });
912
912
  const clientOptions = buildCopilotClientOptions(this.options, this.cwd, this.env);
913
913
  this.client = new sdkModule.CopilotClient(clientOptions);
914
914
  const cleanupIfClosedDuringBoot = async (session = null) => {
@@ -116,13 +116,13 @@ async function buildCopilotClientOptions(options = {}) {
116
116
  clientOptions.cliArgs = cliLaunch.cliArgs;
117
117
  }
118
118
  }
119
- const explicitGithubToken = typeof clientOptions.githubToken === "string" && clientOptions.githubToken.trim()
120
- ? clientOptions.githubToken.trim()
119
+ const explicitGithubToken = typeof clientOptions.gitHubToken === "string" && clientOptions.gitHubToken.trim()
120
+ ? clientOptions.gitHubToken.trim()
121
121
  : typeof options.githubToken === "string" && options.githubToken.trim()
122
122
  ? options.githubToken.trim()
123
123
  : "";
124
- if (clientOptions.githubToken === undefined && explicitGithubToken) {
125
- clientOptions.githubToken = explicitGithubToken;
124
+ if (clientOptions.gitHubToken === undefined && explicitGithubToken) {
125
+ clientOptions.gitHubToken = explicitGithubToken;
126
126
  }
127
127
  if (clientOptions.useLoggedInUser === undefined && typeof options.useLoggedInUser === "boolean") {
128
128
  clientOptions.useLoggedInUser = options.useLoggedInUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@love-moon/ai-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lovemoon-ai/conductor.git"
@@ -25,19 +25,19 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@anthropic-ai/claude-agent-sdk": "^0.2.72",
28
- "@github/copilot-sdk": "^0.2.2",
28
+ "@github/copilot-sdk": "^0.3.0",
29
29
  "@opencode-ai/sdk": "^1.2.25",
30
30
  "js-yaml": "^4.1.1",
31
31
  "yaml": "^2.5.1",
32
32
  "zod": "^4.1.5"
33
33
  },
34
34
  "optionalDependencies": {
35
- "@love-moon/chat-web": "^0.4.0"
35
+ "@love-moon/chat-web": "^0.4.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "^22.10.2",
39
39
  "tsx": "^4.20.6",
40
40
  "typescript": "^5.6.3"
41
41
  },
42
- "gitCommitId": "2d1526c"
42
+ "gitCommitId": "23fc1c2"
43
43
  }