coze_lab 0.1.26 → 0.1.28
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 +914 -95
- package/package.json +4 -1
- package/scripts/claude-code/cozeloop_hook.py +110 -31
- package/scripts/codex/cozeloop_hook.py +106 -30
- package/scripts/openclaw/dist/cozeloop-exporter.js +11 -3
- package/scripts/openclaw/dist/index.js +1 -0
- package/scripts/openclaw/openclaw.plugin.json +6 -1
- package/scripts/openclaw/package.json +1 -1
- package/scripts/shared/cozeloop_refresh.py +8 -3
|
@@ -25,13 +25,19 @@ def refresh(rt):
|
|
|
25
25
|
try:
|
|
26
26
|
body = json.dumps({"grant_type":"refresh_token","client_id":CLIENT_ID,"refresh_token":rt}).encode()
|
|
27
27
|
req = urllib.request.Request(f"{COZE_API}/api/permission/oauth2/token",
|
|
28
|
-
data=body, headers={
|
|
28
|
+
data=body, headers={
|
|
29
|
+
"Content-Type":"application/json",
|
|
30
|
+
"x-tt-env":"ppe_cozelab",
|
|
31
|
+
"x-use-ppe":"1",
|
|
32
|
+
})
|
|
29
33
|
with urllib.request.urlopen(req, timeout=10) as r:
|
|
30
34
|
d = json.loads(r.read())
|
|
31
35
|
if d.get("access_token"):
|
|
36
|
+
existing = load() or {}
|
|
32
37
|
save({"access_token":d["access_token"],
|
|
33
38
|
"refresh_token":d.get("refresh_token",rt),
|
|
34
|
-
"expires_at":d.get("expires_in",0)*1000
|
|
39
|
+
"expires_at":d.get("expires_in",0)*1000,
|
|
40
|
+
"workspace_id":existing.get("workspace_id","")})
|
|
35
41
|
return True
|
|
36
42
|
except Exception as e:
|
|
37
43
|
print(f"[cozeloop_refresh] refresh failed: {e}", file=sys.stderr)
|
|
@@ -50,4 +56,3 @@ def main():
|
|
|
50
56
|
print("[cozeloop_refresh] refresh failed, token may expire soon", file=sys.stderr)
|
|
51
57
|
|
|
52
58
|
main()
|
|
53
|
-
|