coze_lab 0.1.2 → 0.1.4

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/index.js CHANGED
@@ -3,7 +3,9 @@
3
3
 
4
4
  // ─── 0. Constants ─────────────────────────────────────────────────────────────
5
5
  const CLIENT_ID = '46371084383473718052118955183420.app.coze';
6
- const WORKSPACE_ID = '7645949103524380682';
6
+ const WORKSPACE_ID = '7644910356078837760';
7
+ // TEMP(test): 临时写死 token,跳过 OAuth。测试结束后请删除并恢复 getValidToken() 流程。
8
+ const HARDCODED_TOKEN = 'sat_KwzIM1cOhtgrKUAbxCbPTjmwxEktM61BVtkekkLD6DZldTv6keCtbzJHOzWaFynu';
7
9
  const COZE_API = 'https://api.coze.cn';
8
10
  const CREDS_PATH = require('path').join(require('os').homedir(), '.cozeloop', 'credentials.json');
9
11
  // Refresh when less than 10 minutes remain
@@ -4914,25 +4916,13 @@ async function main() {
4914
4916
 
4915
4917
  const { agent } = args;
4916
4918
 
4917
- // Step 1: Authorize (load cached refresh → device code)
4918
- // Step 2: Verify token works — if 401, refresh/re-auth and retry once
4919
- info('Step 1/5: 检查授权状态...');
4920
- let token = await getValidToken();
4919
+ // Step 1: Authorize — TEMP(test): 跳过 OAuth,直接使用写死 token
4920
+ // Step 2: Verify token works — TEMP(test): 一并跳过
4921
+ info('Step 1/5: 使用写死 token(已跳过 OAuth)...');
4922
+ let token = HARDCODED_TOKEN;
4921
4923
  console.log('');
4922
4924
 
4923
- info('Step 2/5: 验证工作空间权限...');
4924
- let verified = await verifyWorkspace(token);
4925
- if (verified === null) {
4926
- // Token rejected by API — clear cached creds and re-authorize
4927
- warn('Token 已失效,正在重新授权...');
4928
- deleteCredentials();
4929
- console.log('');
4930
- token = await deviceCodeAuth().then(c => c.access_token);
4931
- verified = await verifyWorkspace(token);
4932
- if (verified === null) {
4933
- errorBox(['ERROR: 重新授权后 Token 仍无效,请联系管理员。']);
4934
- }
4935
- }
4925
+ info('Step 2/5: 跳过工作空间权限验证(测试模式)...');
4936
4926
  console.log('');
4937
4927
 
4938
4928
  // Step 3: Detect agent binary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coze_lab",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Configure local AI agents (Claude Code, Codex, OpenClaw) to report traces to CozeLoop",
5
5
  "keywords": [
6
6
  "cozeloop",
@@ -42,7 +42,7 @@ except ImportError:
42
42
 
43
43
  # --- Configuration ---
44
44
  DEBUG = os.environ.get("CC_COZELOOP_DEBUG", "").lower() == "true"
45
- _COZELOOP_CLIENT_ID = "56089404009908161803155625287505.app.coze"
45
+ _COZELOOP_CLIENT_ID = "46371084383473718052118955183420.app.coze"
46
46
  _COZE_API = "https://api.coze.cn"
47
47
  _REFRESH_THRESHOLD = 10 * 60 # refresh when < 10 minutes remain
48
48
  _DEFAULT_WORKSPACE_ID = "7644910356078837760" # hardcoded spaceID fallback
@@ -42,7 +42,7 @@ from pathlib import Path
42
42
  from typing import Optional, List, Dict, Any
43
43
 
44
44
  # --- Token refresh --------------------------------------------------------
45
- _COZELOOP_CLIENT_ID = "56089404009908161803155625287505.app.coze"
45
+ _COZELOOP_CLIENT_ID = "46371084383473718052118955183420.app.coze"
46
46
  _COZE_API = "https://api.coze.cn"
47
47
  _REFRESH_THRESHOLD = 10 * 60
48
48
  _DEFAULT_WORKSPACE_ID = "7644910356078837760" # hardcoded spaceID fallback
@@ -14,7 +14,7 @@ const require = createRequire(import.meta.url);
14
14
  const { version: PLUGIN_VERSION } = require("../package.json");
15
15
 
16
16
  // ── Token refresh helpers ─────────────────────────────────────────────────
17
- const _CLIENT_ID = "56089404009908161803155625287505.app.coze";
17
+ const _CLIENT_ID = "46371084383473718052118955183420.app.coze";
18
18
  const _COZE_API = "https://api.coze.cn";
19
19
  const _REFRESH_THRESHOLD_MS = 10 * 60 * 1000;
20
20
  const _CREDS_PATH = join(homedir(), ".cozeloop", "credentials.json");
@@ -7,7 +7,7 @@ Writes the fresh token back so subsequent Stop hooks pick it up.
7
7
  import json, os, sys, time, urllib.request
8
8
  from pathlib import Path
9
9
 
10
- CLIENT_ID = "56089404009908161803155625287505.app.coze"
10
+ CLIENT_ID = "46371084383473718052118955183420.app.coze"
11
11
  COZE_API = "https://api.coze.cn"
12
12
  THRESHOLD = 10 * 60 # 10 minutes
13
13
  CREDS = Path.home() / ".cozeloop" / "credentials.json"