Selaa lähdekoodia

fix(v2.0.1): token 解析补 fmode-identity.json 兜底 + license 头统一 MIT

- fix(identity): sessionToken 链新增 /opt/data/fmode-identity.json 与
  ~/.fmode-harness-agent/fmode-identity.json 兜底(放在最后,不改变既有优先级)
  实测:34 台容器中 32 台只有 fmode-identity.json 有 session_token
  → 修前 agent-node-tuye 报『token 可在 Fmode 控制台获取』无法上报
- chore(license): lib/index.mjs lib/upload.mjs lib/identity.mjs bin/agent-log.mjs
  头部 MPL-2.0 声明统一为 MIT(保留商标条款),与仓库 LICENSE 一致
- 语法校验全过,冒烟测试全通
fmode-ops 1 päivä sitten
vanhempi
commit
2caaeeb612
8 muutettua tiedostoa jossa 22 lisäystä ja 19 poistoa
  1. 6 0
      CHANGELOG.md
  2. 1 1
      SKILL.md
  3. 2 4
      bin/agent-log.mjs
  4. 7 4
      lib/identity.mjs
  5. 2 4
      lib/index.mjs
  6. 2 4
      lib/upload.mjs
  7. 1 1
      package.json
  8. 1 1
      skills/skill-agent-log-s3/SKILL.md

+ 6 - 0
CHANGELOG.md

@@ -1,3 +1,9 @@
+## 2.0.1
+
+- fix(identity): sessionToken 解析链补 /opt/data/fmode-identity.json 与 ~/.fmode-harness-agent/ 兜底
+  (实测 34 台容器中 32 台只有 fmode-identity.json 带 session_token,缺此兜底会误报"缺 token"无法上报)
+- chore(license): 4 个源文件头部 MPL-2.0 声明统一为 MIT,与仓库 LICENSE 一致
+
 # CHANGELOG
 
 ## [2.0.0] - 2026-09-23

+ 1 - 1
SKILL.md

@@ -1,7 +1,7 @@
 ---
 slug: fmode-skill-agent-log-s3
 displayName: skill-agent-log-s3
-version: 2.0.0
+version: 2.0.1
 summary: 数字生命自报运行日志到个人S3空间 — 零密钥云函数通道,上报CPU/内存/并发/事件指标
 description: "数字生命(FmodeAgent/HermesAgent)通过平台云函数 fmodeagent-upload-url 把运行状态 JSON 写入个人 S3 空间 user/<userid>/log/ 目录,主协调者每天下载各家日志做汇总分析。v2.0 走云函数免密钥通道,不再依赖 boto3/obs SDK 或 AK/SK 环境变量,零依赖、Node>=18 原生 fetch,Python3 标准库采集指标。Digital life agent log reporting via cloud function presigned URL, no AK/SK required."
 platform: HermesAgent

+ 2 - 4
bin/agent-log.mjs

@@ -1,12 +1,10 @@
 #!/usr/bin/env node
 // Copyright (c) 未来飞马
 //
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at https://mozilla.org/MPL/2.0/.
+// MIT License — Copyright (c) 2026 Fmode (未来飞马)
 //
 // Trademark Notice:
-// The MPL-2.0 license grants copyright permissions for source code only.
+// The MIT license grants copyright permissions for source code only.
 // It does NOT grant any rights to use trademarks including "未来飞马",
 // "Harness Loop", "RSI", and associated slogan "让AI进化提前发生,让AI落地快人一步".
 // Any use of these trademarks requires separate written permission.

+ 7 - 4
lib/identity.mjs

@@ -1,11 +1,9 @@
 // Copyright (c) 未来飞马
 //
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at https://mozilla.org/MPL/2.0/.
+// MIT License — Copyright (c) 2026 Fmode (未来飞马)
 //
 // Trademark Notice:
-// The MPL-2.0 license grants copyright permissions for source code only.
+// The MIT license grants copyright permissions for source code only.
 // It does NOT grant any rights to use trademarks including "未来飞马",
 // "Harness Loop", "RSI", and associated slogan "让AI进化提前发生,让AI落地快人一步".
 // Any use of these trademarks requires separate written permission.
@@ -48,6 +46,11 @@ export function resolveIdentity() {
     readJson(`${home}/.fmode/config/user.json`)?.sessionToken ||
     readJson(`${home}/.fmode/config.json`)?.sessionToken ||
     readJson('./.fmode/config.json')?.sessionToken ||
+    // ⚠️ 兜底:容器普遍有 /opt/data/fmode-identity.json(开通时写入),
+    // 而 ~/.fmode/config.json 不一定有。放在最后不改变既有优先级。
+    // 实测 34 台容器中 32 台只有 fmode-identity.json 带 session_token。
+    readJson('/opt/data/fmode-identity.json')?.session_token ||
+    readJson(`${home}/.fmode-harness-agent/fmode-identity.json`)?.session_token ||
     null;
 
   const agentId =

+ 2 - 4
lib/index.mjs

@@ -1,11 +1,9 @@
 // Copyright (c) 未来飞马
 //
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at https://mozilla.org/MPL/2.0/.
+// MIT License — Copyright (c) 2026 Fmode (未来飞马)
 //
 // Trademark Notice:
-// The MPL-2.0 license grants copyright permissions for source code only.
+// The MIT license grants copyright permissions for source code only.
 // It does NOT grant any rights to use trademarks including "未来飞马",
 // "Harness Loop", "RSI", and associated slogan "让AI进化提前发生,让AI落地快人一步".
 // Any use of these trademarks requires separate written permission.

+ 2 - 4
lib/upload.mjs

@@ -1,11 +1,9 @@
 // Copyright (c) 未来飞马
 //
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at https://mozilla.org/MPL/2.0/.
+// MIT License — Copyright (c) 2026 Fmode (未来飞马)
 //
 // Trademark Notice:
-// The MPL-2.0 license grants copyright permissions for source code only.
+// The MIT license grants copyright permissions for source code only.
 // It does NOT grant any rights to use trademarks including "未来飞马",
 // "Harness Loop", "RSI", and associated slogan "让AI进化提前发生,让AI落地快人一步".
 // Any use of these trademarks requires separate written permission.

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "skill-agent-log-s3",
-  "version": "2.0.0",
+  "version": "2.0.1",
   "description": "数字生命自报运行日志到个人S3空间 — 零密钥云函数通道,每6小时上报CPU/内存/并发/事件指标",
   "type": "module",
   "main": "./lib/index.mjs",

+ 1 - 1
skills/skill-agent-log-s3/SKILL.md

@@ -1,7 +1,7 @@
 ---
 name: skill-agent-log-s3
 description: "触发词:日志上报、性能记录、运行状态、自报指标。数字生命通过云函数免密钥通道把运行状态 JSON 上传到个人 S3 空间 user/<userid>/log/ 目录。"
-version: 2.0.0
+version: 2.0.1
 author: Yuyang001 (FmodeAgent)
 license: MIT
 tags: [HermesAgent, FmodeAgent, 系统级, 平台基础设施, 日志上报, agent-log, monitoring]