@lightcone-ai/daemon 0.15.73 → 0.15.75

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/chat-bridge.js +40 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.15.73",
3
+ "version": "0.15.75",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -1521,6 +1521,45 @@ server.tool('register_data_source',
1521
1521
  }
1522
1522
  );
1523
1523
 
1524
+ // ── list_publish_accounts ─────────────────────────────────────────────────────
1525
+ server.tool('list_publish_accounts',
1526
+ 'List the platform accounts bound to a workspace. Each entry returns: account_id (workspace-account UUID), credential_id (REAL credential UUID — use this for credential-keyed tools like check_login_status / request_credential_auth), display_name, account_role, and selectors. The "selectors" list shows extra strings that request_approval will accept as credential_id (display name / role alias 主号·矩阵号·测试号) — for request_approval only; do NOT pass selectors or account_id to credential-keyed tools. Call this before publishing whenever the workspace might have more than one account on the target platform — never guess account names.',
1527
+ {
1528
+ workspace: z.string().optional().describe('Target #workspace-name. Defaults to the current workspace.'),
1529
+ platform: z.string().optional().describe('Optional platform filter, e.g. "xhs", "kuaishou", "douyin", "bilibili".'),
1530
+ },
1531
+ async ({ workspace, platform }) => {
1532
+ const targetWorkspace = String(workspace ?? currentWorkspaceId ?? WORKSPACE_ID ?? '').trim();
1533
+ if (!targetWorkspace) {
1534
+ return { isError: true, content: [{ type: 'text', text: 'workspace is required (no current workspace context).' }] };
1535
+ }
1536
+ try {
1537
+ const params = new URLSearchParams({ workspace: targetWorkspace });
1538
+ if (platform && String(platform).trim()) params.set('platform', String(platform).trim());
1539
+ const data = await api('GET', `/workspace-accounts?${params}`);
1540
+ const accounts = Array.isArray(data.accounts) ? data.accounts : [];
1541
+ if (accounts.length === 0) {
1542
+ return { content: [{ type: 'text', text: platform ? `No ${platform} account is bound to this workspace.` : 'No platform accounts are bound to this workspace.' }] };
1543
+ }
1544
+ const text = accounts.map((a) => {
1545
+ const name = a.display_name ?? a.account_id ?? 'unknown';
1546
+ const role = a.account_role ? ` [${a.account_role}]` : '';
1547
+ const credLine = a.credential_id
1548
+ ? `\n credential_id (for check_login_status etc.): ${a.credential_id}`
1549
+ : '\n credential_id: <unbound>';
1550
+ const accLine = `\n account_id: ${a.account_id ?? '?'}`;
1551
+ const sels = Array.isArray(a.selectors) && a.selectors.length
1552
+ ? `\n request_approval credential_id can also be: ${a.selectors.join(' / ')}`
1553
+ : '';
1554
+ return `- ${a.platform ?? '?'} / ${name}${role}${credLine}${accLine}${sels}`;
1555
+ }).join('\n');
1556
+ return { content: [{ type: 'text', text }] };
1557
+ } catch (err) {
1558
+ return { isError: true, content: [{ type: 'text', text: `Error: ${err.message}` }] };
1559
+ }
1560
+ }
1561
+ );
1562
+
1524
1563
  // ── request_approval ──────────────────────────────────────────────────────────
1525
1564
  server.tool('request_approval',
1526
1565
  'Request human approval before executing a sensitive platform action (posting, sending, publishing). Returns an action_id. After the human approves, call execute_approved_action with that ID.',
@@ -1529,7 +1568,7 @@ server.tool('request_approval',
1529
1568
  platform: z.string().describe('Target platform, e.g. "x", "xhs", "email"'),
1530
1569
  description: z.string().describe('Human-readable summary of what will happen if approved'),
1531
1570
  payload: z.record(z.any()).describe('Full action parameters (content, media_urls, etc.)'),
1532
- credential_id: z.string().optional().describe('Which account/credential to use. Accepts a workspace account_id, a real credential UUID, the account display name, or a role alias (主号/main/primary, 矩阵号/matrix/secondary, 测试号/test/incubator) — any value works as long as it uniquely matches one workspace account on the target platform. If publishing fails with publish_account_selection_required/ambiguous, pick a value from the returned candidates\' "selectors" list yourself instead of asking the user to re-type an account name.'),
1571
+ credential_id: z.string().optional().describe('Which account/credential to use. Accepts a workspace account_id, a real credential UUID, the account display name, or a role alias (主号/main/primary, 矩阵号/matrix/secondary, 测试号/test/incubator) — any value works as long as it uniquely matches one workspace account on the target platform. When the workspace may have several accounts on the platform, call list_publish_accounts first and pass one of the returned "selectors". If publishing still fails with publish_account_selection_required/ambiguous, pick a value from the returned candidates\' "selectors" list yourself instead of asking the user to re-type an account name.'),
1533
1572
  },
1534
1573
  async ({ action_type, platform, description, payload, credential_id }) => {
1535
1574
  try {