first-tree-staging 0.5.2-staging.29.1 → 0.5.2-staging.32.1

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { a as cliFetch, f as channelConfig, l as print, n as bindFeishuUser, o as CLI_USER_AGENT, r as documentContextSchema, s as COMMAND_VERSION, t as bindFeishuBot, u as setJsonMode } from "../feishu-DmpOdXci.mjs";
3
- import { $ as agentConfigSchema, A as installClientService, C as checkClientConfig, D as printResults, E as checkWebSocket, F as startClientService, G as loadCredentials, I as stopClientService, J as saveAgentConfig, M as isServiceUnitDriftDetected, O as reconcileAgentConfigs, P as restartClientService, Q as removeLocalAgent, R as ClientRuntime, S as checkBackgroundService, T as checkServerReachable, U as ensureFreshAccessToken, W as ensureFreshAdminToken, X as findStaleAliases, Y as saveCredentials, Z as formatStaleReason, _t as buildMessageDocumentSnapshots, a as declineUpdate, at as initConfig, b as migrateLocalAgentDirs, bt as applyClientLoggerConfig, c as detectInstallMode, ct as resetConfig, d as reconcileLocalRuntimeProviders, dt as setConfigValue, et as clientConfigSchema, f as uploadClientCapabilities, ft as ClientOrgMismatchError, gt as SessionRegistry, h as promptMissingFields, ht as SdkError, i as createExecuteUpdate, it as getConfigValue, j as isServiceSupported, k as getClientServiceStatus, l as fetchLatestVersion, lt as resetConfigMeta, m as promptAddAgent, mt as FirstTreeHubSDK, n as decodeJwtPayload, nt as defaultDataDir, o as promptUpdate, ot as loadAgents, pt as ClientUserMismatchError, q as resolveServerUrl, r as deriveHubUrlFromToken, rt as defaultHome, s as PACKAGE_NAME, st as readConfigFile, t as HubUrlDerivationError, tt as defaultConfigDir, u as installGlobalLatest, ut as resolveConfigReadonly, vt as cleanWorkspaces, w as checkNodeVersion, x as checkAgentConfigs, xt as configureClientLoggerForService, y as createApiNameResolver, yt as probeCapabilities, z as handleClientOrgMismatch } from "../connect-token-18Jcc1BV.mjs";
2
+ import { a as cliFetch, f as channelConfig, l as print, n as bindFeishuUser, o as CLI_USER_AGENT, r as documentContextSchema, s as COMMAND_VERSION, t as bindFeishuBot, u as setJsonMode } from "../feishu-DirO-XHk.mjs";
3
+ import { $ as agentConfigSchema, A as installClientService, C as checkClientConfig, D as printResults, E as checkWebSocket, F as startClientService, G as loadCredentials, I as stopClientService, J as saveAgentConfig, M as isServiceUnitDriftDetected, O as reconcileAgentConfigs, P as restartClientService, Q as removeLocalAgent, R as ClientRuntime, S as checkBackgroundService, T as checkServerReachable, U as ensureFreshAccessToken, W as ensureFreshAdminToken, X as findStaleAliases, Y as saveCredentials, Z as formatStaleReason, _t as buildMessageDocumentSnapshots, a as declineUpdate, at as initConfig, b as migrateLocalAgentDirs, bt as applyClientLoggerConfig, c as detectInstallMode, ct as resetConfig, d as reconcileLocalRuntimeProviders, dt as setConfigValue, et as clientConfigSchema, f as uploadClientCapabilities, ft as ClientOrgMismatchError, gt as SessionRegistry, h as promptMissingFields, ht as SdkError, i as createExecuteUpdate, it as getConfigValue, j as isServiceSupported, k as getClientServiceStatus, l as fetchLatestVersion, lt as resetConfigMeta, m as promptAddAgent, mt as FirstTreeHubSDK, n as decodeJwtPayload, nt as defaultDataDir, o as promptUpdate, ot as loadAgents, pt as ClientUserMismatchError, q as resolveServerUrl, r as deriveHubUrlFromToken, rt as defaultHome, s as PACKAGE_NAME, st as readConfigFile, t as HubUrlDerivationError, tt as defaultConfigDir, u as installGlobalLatest, ut as resolveConfigReadonly, vt as cleanWorkspaces, w as checkNodeVersion, x as checkAgentConfigs, xt as configureClientLoggerForService, y as createApiNameResolver, yt as probeCapabilities, z as handleClientOrgMismatch } from "../connect-token-CELrKY8z.mjs";
4
4
  import { basename, dirname, join, relative, resolve } from "node:path";
5
5
  import { homedir, tmpdir } from "node:os";
6
6
  import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
@@ -1,5 +1,5 @@
1
1
  import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-CBBoxR_p.mjs";
2
- import { a as cliFetch, c as blank, f as channelConfig, i as updateAttemptSchema$1, l as print, o as CLI_USER_AGENT, p as inferChannelFromVersion } from "./feishu-DmpOdXci.mjs";
2
+ import { a as cliFetch, c as blank, f as channelConfig, i as updateAttemptSchema$1, l as print, o as CLI_USER_AGENT, p as inferChannelFromVersion } from "./feishu-DirO-XHk.mjs";
3
3
  import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
4
4
  import { homedir, hostname, platform, tmpdir, userInfo } from "node:os";
5
5
  import { z } from "zod";
@@ -4480,7 +4480,9 @@ const liveActivitySchema = z.object({
4480
4480
  kind: liveActivityKindSchema,
4481
4481
  label: z.string(),
4482
4482
  startedAt: z.string(),
4483
- detail: z.string().optional()
4483
+ detail: z.string().optional(),
4484
+ turnText: z.string().optional(),
4485
+ staleAt: z.string().optional()
4484
4486
  });
4485
4487
  const meChatRowSchema = z.object({
4486
4488
  chatId: z.string(),
@@ -4497,7 +4499,6 @@ const meChatRowSchema = z.object({
4497
4499
  unreadMentionCount: z.number().int(),
4498
4500
  canReply: z.boolean(),
4499
4501
  engagementStatus: chatEngagementStatusSchema,
4500
- engagedAgentIds: z.array(z.string()),
4501
4502
  liveActivity: liveActivitySchema.nullable(),
4502
4503
  pendingQuestionAgentIds: z.array(z.string()).default([]),
4503
4504
  failedAgentIds: z.array(z.string()).default([])
@@ -9903,19 +9904,23 @@ const createClaudeCodeHandler = (config) => {
9903
9904
  }
9904
9905
  if (retryCount >= MAX_RETRIES || !claudeSessionId) {
9905
9906
  sessionCtx.log("Exhausted retries, session will be suspended");
9906
- const preview = errMsg.slice(0, 800);
9907
- const reason = claudeSessionId ? `Query failed after ${MAX_RETRIES} retries: ${preview}` : `Query failed and no resume id available: ${preview}`;
9908
- sessionCtx.emitEvent({
9909
- kind: "error",
9910
- payload: {
9911
- source: "runtime",
9912
- message: reason
9913
- }
9914
- });
9915
- sessionCtx.emitEvent({
9916
- kind: "turn_end",
9917
- payload: { status: "error" }
9918
- });
9907
+ try {
9908
+ const preview = errMsg.slice(0, 800);
9909
+ const reason = claudeSessionId ? `Query failed after ${MAX_RETRIES} retries: ${preview}` : `Query failed and no resume id available: ${preview}`;
9910
+ sessionCtx.emitEvent({
9911
+ kind: "error",
9912
+ payload: {
9913
+ source: "runtime",
9914
+ message: reason
9915
+ }
9916
+ });
9917
+ sessionCtx.emitEvent({
9918
+ kind: "turn_end",
9919
+ payload: { status: "error" }
9920
+ });
9921
+ } catch (emitErr) {
9922
+ sessionCtx.log(`Failed to emit retry-exhaustion error event: ${emitErr instanceof Error ? emitErr.message : String(emitErr)}`);
9923
+ }
9919
9924
  sessionCtx.setRuntimeState("error");
9920
9925
  return;
9921
9926
  }
@@ -9927,17 +9932,21 @@ const createClaudeCodeHandler = (config) => {
9927
9932
  } catch (resumeErr) {
9928
9933
  const resumeMsg = resumeErr instanceof Error ? resumeErr.message : String(resumeErr);
9929
9934
  sessionCtx.log(`Auto-resume failed: ${resumeMsg}`);
9930
- sessionCtx.emitEvent({
9931
- kind: "error",
9932
- payload: {
9933
- source: "runtime",
9934
- message: `Auto-resume failed: ${resumeMsg.slice(0, 800)}`
9935
- }
9936
- });
9937
- sessionCtx.emitEvent({
9938
- kind: "turn_end",
9939
- payload: { status: "error" }
9940
- });
9935
+ try {
9936
+ sessionCtx.emitEvent({
9937
+ kind: "error",
9938
+ payload: {
9939
+ source: "runtime",
9940
+ message: `Auto-resume failed: ${resumeMsg.slice(0, 800)}`
9941
+ }
9942
+ });
9943
+ sessionCtx.emitEvent({
9944
+ kind: "turn_end",
9945
+ payload: { status: "error" }
9946
+ });
9947
+ } catch (emitErr) {
9948
+ sessionCtx.log(`Failed to emit auto-resume error event: ${emitErr instanceof Error ? emitErr.message : String(emitErr)}`);
9949
+ }
9941
9950
  sessionCtx.setRuntimeState("error");
9942
9951
  return;
9943
9952
  }
@@ -11839,14 +11848,21 @@ var SessionManager = class {
11839
11848
  phase
11840
11849
  }, "session start/resume failed");
11841
11850
  this.notifySessionState(chatId, "errored");
11842
- const preview = errMsg.slice(0, 800);
11843
- ctx.emitEvent({
11844
- kind: "error",
11845
- payload: {
11846
- source: "runtime",
11847
- message: `Session ${phase} failed: ${preview}`
11848
- }
11849
- });
11851
+ try {
11852
+ const preview = errMsg.slice(0, 800);
11853
+ ctx.emitEvent({
11854
+ kind: "error",
11855
+ payload: {
11856
+ source: "runtime",
11857
+ message: `Session ${phase} failed: ${preview}`
11858
+ }
11859
+ });
11860
+ } catch (emitErr) {
11861
+ this.config.log.warn({
11862
+ chatId,
11863
+ emitErr
11864
+ }, "session error event emit failed");
11865
+ }
11850
11866
  this.sessions.delete(chatId);
11851
11867
  this.sessionRuntimeStates.delete(chatId);
11852
11868
  this.recomputeRuntimeState();
@@ -11884,14 +11900,21 @@ var SessionManager = class {
11884
11900
  err
11885
11901
  }, "resume failed");
11886
11902
  this.notifySessionState(entry.chatId, "errored");
11887
- const preview = errMsg.slice(0, 800);
11888
- ctx.emitEvent({
11889
- kind: "error",
11890
- payload: {
11891
- source: "runtime",
11892
- message: `Session resume failed: ${preview}`
11893
- }
11894
- });
11903
+ try {
11904
+ const preview = errMsg.slice(0, 800);
11905
+ ctx.emitEvent({
11906
+ kind: "error",
11907
+ payload: {
11908
+ source: "runtime",
11909
+ message: `Session resume failed: ${preview}`
11910
+ }
11911
+ });
11912
+ } catch (emitErr) {
11913
+ this.config.log.warn({
11914
+ chatId: entry.chatId,
11915
+ emitErr
11916
+ }, "session error event emit failed");
11917
+ }
11895
11918
  this.sessions.delete(entry.chatId);
11896
11919
  this.sessionRuntimeStates.delete(entry.chatId);
11897
11920
  this.recomputeRuntimeState();
@@ -15421,7 +15444,7 @@ async function onboardCreate(args) {
15421
15444
  }
15422
15445
  const runtimeAgent = args.type === "human" ? args.assistant : args.id;
15423
15446
  if (args.feishuBotAppId && args.feishuBotAppSecret) {
15424
- const { bindFeishuBot } = await import("./feishu-C9HuvVNS.mjs");
15447
+ const { bindFeishuBot } = await import("./feishu-S2IdFiQv.mjs");
15425
15448
  const targetAgentUuid = args.type === "human" ? assistantUuid : primary.uuid;
15426
15449
  if (!targetAgentUuid) print.line(`Warning: Cannot bind Feishu bot — no runtime agent available for "${args.id}".\n`);
15427
15450
  else {
@@ -893,7 +893,9 @@ const liveActivitySchema = z.object({
893
893
  kind: liveActivityKindSchema,
894
894
  label: z.string(),
895
895
  startedAt: z.string(),
896
- detail: z.string().optional()
896
+ detail: z.string().optional(),
897
+ turnText: z.string().optional(),
898
+ staleAt: z.string().optional()
897
899
  });
898
900
  const meChatRowSchema = z.object({
899
901
  chatId: z.string(),
@@ -910,7 +912,6 @@ const meChatRowSchema = z.object({
910
912
  unreadMentionCount: z.number().int(),
911
913
  canReply: z.boolean(),
912
914
  engagementStatus: chatEngagementStatusSchema,
913
- engagedAgentIds: z.array(z.string()),
914
915
  liveActivity: liveActivitySchema.nullable(),
915
916
  pendingQuestionAgentIds: z.array(z.string()).default([]),
916
917
  failedAgentIds: z.array(z.string()).default([])
@@ -0,0 +1,2 @@
1
+ import { t as bindFeishuBot } from "./feishu-DirO-XHk.mjs";
2
+ export { bindFeishuBot };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { c as blank, d as status, n as bindFeishuUser, t as bindFeishuBot } from "./feishu-DmpOdXci.mjs";
2
- import { A as installClientService, B as rotateClientIdWithBackup, C as checkClientConfig, D as printResults, E as checkWebSocket, F as startClientService, H as AuthRefreshRateLimitedError, I as stopClientService, K as resolveAccessToken, L as uninstallClientService, N as resolveCliInvocation, P as restartClientService, R as ClientRuntime, T as checkServerReachable, U as ensureFreshAccessToken, V as AuthRefreshFailedError, W as ensureFreshAdminToken, _ as onboardCheck, g as formatCheckReport, h as promptMissingFields, ht as SdkError, j as isServiceSupported, k as getClientServiceStatus, m as promptAddAgent, mt as FirstTreeHubSDK, p as isInteractive, q as resolveServerUrl, r as deriveHubUrlFromToken, t as HubUrlDerivationError, v as onboardCreate, w as checkNodeVersion, x as checkAgentConfigs, z as handleClientOrgMismatch } from "./connect-token-18Jcc1BV.mjs";
1
+ import { c as blank, d as status, n as bindFeishuUser, t as bindFeishuBot } from "./feishu-DirO-XHk.mjs";
2
+ import { A as installClientService, B as rotateClientIdWithBackup, C as checkClientConfig, D as printResults, E as checkWebSocket, F as startClientService, H as AuthRefreshRateLimitedError, I as stopClientService, K as resolveAccessToken, L as uninstallClientService, N as resolveCliInvocation, P as restartClientService, R as ClientRuntime, T as checkServerReachable, U as ensureFreshAccessToken, V as AuthRefreshFailedError, W as ensureFreshAdminToken, _ as onboardCheck, g as formatCheckReport, h as promptMissingFields, ht as SdkError, j as isServiceSupported, k as getClientServiceStatus, m as promptAddAgent, mt as FirstTreeHubSDK, p as isInteractive, q as resolveServerUrl, r as deriveHubUrlFromToken, t as HubUrlDerivationError, v as onboardCreate, w as checkNodeVersion, x as checkAgentConfigs, z as handleClientOrgMismatch } from "./connect-token-CELrKY8z.mjs";
3
3
  export { AuthRefreshFailedError, AuthRefreshRateLimitedError, ClientRuntime, FirstTreeHubSDK, HubUrlDerivationError, SdkError, bindFeishuBot, bindFeishuUser, blank, checkAgentConfigs, checkClientConfig, checkNodeVersion, checkServerReachable, checkWebSocket, deriveHubUrlFromToken, ensureFreshAccessToken, ensureFreshAdminToken, formatCheckReport, getClientServiceStatus, handleClientOrgMismatch, installClientService, isInteractive, isServiceSupported, onboardCheck, onboardCreate, printResults, promptAddAgent, promptMissingFields, resolveAccessToken, resolveCliInvocation, resolveServerUrl, restartClientService, rotateClientIdWithBackup, startClientService, status, stopClientService, uninstallClientService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "first-tree-staging",
3
- "version": "0.5.2-staging.29.1",
3
+ "version": "0.5.2-staging.32.1",
4
4
  "type": "module",
5
5
  "description": "First Tree — unified CLI for Context Tree onboarding, GitHub Scan automation, agent management, and Hub messaging. (Source-tree dev build; CI rewrites `name` and `bin` for prod / staging publishes — see docs/local-dev-isolation.md.)",
6
6
  "keywords": [
@@ -1,2 +0,0 @@
1
- import { t as bindFeishuBot } from "./feishu-DmpOdXci.mjs";
2
- export { bindFeishuBot };