coze_lab 0.1.35 → 0.1.36
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/package.json
CHANGED
|
@@ -105,11 +105,11 @@ else:
|
|
|
105
105
|
|
|
106
106
|
# --- Configuration ---
|
|
107
107
|
DEBUG = os.environ.get("CC_COZELOOP_DEBUG", "").lower() == "true"
|
|
108
|
-
_COZELOOP_CLIENT_ID = "
|
|
108
|
+
_COZELOOP_CLIENT_ID = "08972682140163281554629748278108.app.coze"
|
|
109
109
|
_COZE_API = "https://api.coze.cn"
|
|
110
110
|
_OTEL_SUFFIX = "/v1/loop/opentelemetry"
|
|
111
111
|
_REFRESH_THRESHOLD = 10 * 60 # refresh when < 10 minutes remain
|
|
112
|
-
_DEFAULT_WORKSPACE_ID = "
|
|
112
|
+
_DEFAULT_WORKSPACE_ID = "7649231955045072915" # hardcoded spaceID fallback
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
# --- coze-context parsing -------------------------------------------------
|
|
@@ -283,8 +283,6 @@ def _refresh_token(refresh_token: str) -> Optional[str]:
|
|
|
283
283
|
data=payload,
|
|
284
284
|
headers={
|
|
285
285
|
"Content-Type": "application/json",
|
|
286
|
-
"x-tt-env": "ppe_cozelab",
|
|
287
|
-
"x-use-ppe": "1",
|
|
288
286
|
},
|
|
289
287
|
)
|
|
290
288
|
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
@@ -42,10 +42,10 @@ from pathlib import Path
|
|
|
42
42
|
from typing import Optional, List, Dict, Any
|
|
43
43
|
|
|
44
44
|
# --- Token refresh --------------------------------------------------------
|
|
45
|
-
_COZELOOP_CLIENT_ID = "
|
|
45
|
+
_COZELOOP_CLIENT_ID = "08972682140163281554629748278108.app.coze"
|
|
46
46
|
_COZE_API = "https://api.coze.cn"
|
|
47
47
|
_REFRESH_THRESHOLD = 10 * 60
|
|
48
|
-
_DEFAULT_WORKSPACE_ID = "
|
|
48
|
+
_DEFAULT_WORKSPACE_ID = "7649231955045072915" # hardcoded spaceID fallback
|
|
49
49
|
_OTEL_SUFFIX = "/v1/loop/opentelemetry"
|
|
50
50
|
|
|
51
51
|
|
|
@@ -195,8 +195,6 @@ def _refresh_token(refresh_tok: str):
|
|
|
195
195
|
data=payload,
|
|
196
196
|
headers={
|
|
197
197
|
"Content-Type": "application/json",
|
|
198
|
-
"x-tt-env": "ppe_cozelab",
|
|
199
|
-
"x-use-ppe": "1",
|
|
200
198
|
},
|
|
201
199
|
)
|
|
202
200
|
with urllib.request.urlopen(req, timeout=10) as resp:
|
|
@@ -22,7 +22,7 @@ const CLIENT_USER_AGENT = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
// ── Token refresh helpers ─────────────────────────────────────────────────
|
|
25
|
-
const _CLIENT_ID = "
|
|
25
|
+
const _CLIENT_ID = "08972682140163281554629748278108.app.coze";
|
|
26
26
|
const _COZE_API = "https://api.coze.cn";
|
|
27
27
|
const _REFRESH_THRESHOLD_MS = 10 * 60 * 1000;
|
|
28
28
|
const _CREDS_PATH = join(homedir(), ".cozeloop", "credentials.json");
|
|
@@ -44,7 +44,7 @@ async function _refreshToken(refreshTok) {
|
|
|
44
44
|
const body = JSON.stringify({ grant_type: "refresh_token", client_id: _CLIENT_ID, refresh_token: refreshTok });
|
|
45
45
|
const req = https.request(`${_COZE_API}/api/permission/oauth2/token`, {
|
|
46
46
|
method: "POST",
|
|
47
|
-
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body)
|
|
47
|
+
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) },
|
|
48
48
|
}, (res) => {
|
|
49
49
|
let buf = "";
|
|
50
50
|
res.on("data", c => buf += c);
|
|
@@ -447,8 +447,6 @@ export class CozeloopExporter {
|
|
|
447
447
|
"Authorization": authorization,
|
|
448
448
|
"User-Agent": `openclaw-cozeloop-trace/${PLUGIN_VERSION} node/${process.versions.node}`,
|
|
449
449
|
"X-Coze-Client-User-Agent": JSON.stringify(CLIENT_USER_AGENT),
|
|
450
|
-
"x-tt-env": "ppe_cozelab",
|
|
451
|
-
"x-use-ppe": "1",
|
|
452
450
|
},
|
|
453
451
|
});
|
|
454
452
|
this.provider = new BasicTracerProvider({ resource });
|
|
@@ -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 = "
|
|
10
|
+
CLIENT_ID = "08972682140163281554629748278108.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"
|
|
@@ -27,8 +27,6 @@ def refresh(rt):
|
|
|
27
27
|
req = urllib.request.Request(f"{COZE_API}/api/permission/oauth2/token",
|
|
28
28
|
data=body, headers={
|
|
29
29
|
"Content-Type":"application/json",
|
|
30
|
-
"x-tt-env":"ppe_cozelab",
|
|
31
|
-
"x-use-ppe":"1",
|
|
32
30
|
})
|
|
33
31
|
with urllib.request.urlopen(req, timeout=10) as r:
|
|
34
32
|
d = json.loads(r.read())
|