@kafca/agentdock 0.1.21 → 0.1.22

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 (65) hide show
  1. package/README.md +6 -0
  2. package/dist/renderer/assets/{Badge-BRmQIqbd.js → Badge-B_rgzxYO.js} +1 -1
  3. package/dist/renderer/assets/{Chat-D94ODABB.js → Chat-CYtp6m7T.js} +1 -1
  4. package/dist/renderer/assets/{ChatMarkdown-DqW7OUvV.js → ChatMarkdown-DOBMwa9d.js} +1 -1
  5. package/dist/renderer/assets/{Config-9lgzpTCp.js → Config-DppMSPHF.js} +2 -2
  6. package/dist/renderer/assets/CronList-BDtB1SuA.js +1 -0
  7. package/dist/renderer/assets/{Dashboard-COISXbQy.js → Dashboard-iFlRnd7Y.js} +2 -2
  8. package/dist/renderer/assets/{EmptyState-w5-I9zg7.js → EmptyState-bKDt_T88.js} +1 -1
  9. package/dist/renderer/assets/{KnowledgeDetail-DVxwrTLw.js → KnowledgeDetail-CKPhKPIg.js} +2 -2
  10. package/dist/renderer/assets/{KnowledgeHome-BKkubcwi.js → KnowledgeHome-CFeJre6i.js} +3 -3
  11. package/dist/renderer/assets/Logs-CyxSVOFK.js +1 -0
  12. package/dist/renderer/assets/{Modal-Ceu_MP2e.js → Modal-CxPnk1Ey.js} +1 -1
  13. package/dist/renderer/assets/{Page-CpSczAz8.js → Page-kU9vubzj.js} +1 -1
  14. package/dist/renderer/assets/{ProjectDetail-FJ_bNXLF.js → ProjectDetail-D9FY9NWZ.js} +1 -1
  15. package/dist/renderer/assets/{ProjectList-DZKL4K9C.js → ProjectList-DIwr2TXg.js} +1 -1
  16. package/dist/renderer/assets/{Select-BHQk6qCU.js → Select-BaWoz5Dn.js} +2 -7
  17. package/dist/renderer/assets/SessionChat-Cm9CW8Zx.js +1 -0
  18. package/dist/renderer/assets/SessionList-UPnWlXXO.js +1 -0
  19. package/dist/renderer/assets/{ThreadChat-D3s4GXGh.js → ThreadChat-YvVsACW3.js} +7 -7
  20. package/dist/renderer/assets/{Workspace-B7looTVo.js → Workspace-ST7V8u6T.js} +2 -2
  21. package/dist/renderer/assets/{arrow-left-Dtal-eOi.js → arrow-left-BmZAVGV7.js} +1 -1
  22. package/dist/renderer/assets/{book-open-q814R_Ov.js → book-open-DZ3GXFgI.js} +1 -1
  23. package/dist/renderer/assets/{check-DjfCdLvw.js → check-CeVSvDCv.js} +1 -1
  24. package/dist/renderer/assets/chevron-down-yryuMoQ-.js +6 -0
  25. package/dist/renderer/assets/{circle-vfhmyE8v.js → circle-eASsFISH.js} +1 -1
  26. package/dist/renderer/assets/desktop-Che1cbpE.js +4 -0
  27. package/dist/renderer/assets/desktop-DkrP_s-b.js +1 -0
  28. package/dist/renderer/assets/{funnel-CUQibo1I.js → funnel-pwAe2Ixp.js} +1 -1
  29. package/dist/renderer/assets/{heart-DG9_b8P1.js → heart-B2Sp-bCm.js} +1 -1
  30. package/dist/renderer/assets/{index-Bn8ane6_.js → index-BC3MWbS1.js} +3 -3
  31. package/dist/renderer/assets/{index-Ds0IN5rP.js → index-Cse2Br64.js} +1 -1
  32. package/dist/renderer/assets/{index-3CzgyQYB.css → index-DFiJR0vv.css} +1 -1
  33. package/dist/renderer/assets/{pencil-Dij0LlRY.js → pencil-BfEunUF3.js} +1 -1
  34. package/dist/renderer/assets/{play-CPFGjIyJ.js → play-Dcs9Lj_Z.js} +1 -1
  35. package/dist/renderer/assets/{plug-DH3RKQyn.js → plug-B_YschQe.js} +1 -1
  36. package/dist/renderer/assets/{plus-afkK9_Y8.js → plus-Pqo-cXHQ.js} +1 -1
  37. package/dist/renderer/assets/projects-BCj0k_Gy.js +1 -0
  38. package/dist/renderer/assets/{save-B-cKgWcy.js → save-BKM5yi1A.js} +1 -1
  39. package/dist/renderer/assets/{search-DR6PeYkt.js → search-BU42h10M.js} +1 -1
  40. package/dist/renderer/assets/{server-BM6KOB5a.js → server-DA5t3Rtr.js} +1 -1
  41. package/dist/renderer/assets/{session-utils-BDuThM0a.js → session-utils-Cr9VhNSq.js} +1 -1
  42. package/dist/renderer/assets/{sessions-C1yKps4T.js → sessions-bvV8ZMfX.js} +1 -1
  43. package/dist/renderer/assets/{shield-check-BFjMG-r2.js → shield-check-BeOJKur_.js} +1 -1
  44. package/dist/renderer/assets/{trash-2-CW1heMCf.js → trash-2-CQ7HKO3q.js} +1 -1
  45. package/dist/renderer/assets/{user-r_2sHG7m.js → user-CtFjY9SV.js} +1 -1
  46. package/dist/renderer/assets/{wifi-off-VMUokMpE.js → wifi-off-Ci5m0ysf.js} +1 -1
  47. package/dist/renderer/index.html +2 -2
  48. package/dist-electron/electron/local-core-refactor.test.js +307 -3
  49. package/dist-electron/services/local-ai-core/src/{gateway → channel/lark}/local-core-lark-gateway.js +249 -8
  50. package/dist-electron/services/local-ai-core/src/channel/shared/file-utils.js +33 -0
  51. package/dist-electron/services/local-ai-core/src/{gateway → channel/weixin}/local-core-weixin-gateway.js +188 -1
  52. package/dist-electron/services/local-ai-core/src/cli/lac.js +41 -1
  53. package/dist-electron/services/local-ai-core/src/plugins/builtin/channel-lark-plugin.js +1 -1
  54. package/dist-electron/services/local-ai-core/src/plugins/builtin/channel-weixin-plugin.js +1 -1
  55. package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +41 -0
  56. package/dist-electron/services/local-ai-core/src/runtime/server.js +10 -0
  57. package/dist-electron/shared/desktop.js +14 -1
  58. package/package.json +1 -1
  59. package/dist/renderer/assets/CronList-BYZ-x_bp.js +0 -1
  60. package/dist/renderer/assets/Logs-D7HxZ8Nb.js +0 -1
  61. package/dist/renderer/assets/SessionChat-DpgSXF3m.js +0 -1
  62. package/dist/renderer/assets/SessionList-CU6drQ4N.js +0 -1
  63. package/dist/renderer/assets/desktop-BPIxWbkM.js +0 -1
  64. package/dist/renderer/assets/desktop-DZHC4PDB.js +0 -3
  65. package/dist/renderer/assets/projects-DTDS9SnT.js +0 -1
@@ -343,6 +343,47 @@ class LocalCoreController extends node_events_1.EventEmitter {
343
343
  async listChannelAuthorizedUsers(platform, workspaceId) {
344
344
  return this.resolveChannelRuntime(platform).listAuthorizedUsers(workspaceId);
345
345
  }
346
+ async sendChannelFile(platform, workspaceId, input) {
347
+ const runtime = this.resolveChannelRuntime(platform);
348
+ if (runtime.sendOutboundMessage) {
349
+ const result = await runtime.sendOutboundMessage(workspaceId, {
350
+ route: {
351
+ type: 'channel.chat',
352
+ channelId: input.channelId,
353
+ participantId: input.participantId,
354
+ },
355
+ parts: [{
356
+ type: 'file',
357
+ path: input.path,
358
+ fileName: input.fileName,
359
+ }],
360
+ });
361
+ const attachment = result.attachments?.[0];
362
+ return {
363
+ platform: result.platform,
364
+ workspaceId: result.workspaceId,
365
+ channelId: result.channelId,
366
+ messageId: result.messageIds[0] || '',
367
+ messageIds: result.messageIds,
368
+ fileKey: String(attachment?.metadata?.fileKey || attachment?.attachmentId || ''),
369
+ attachmentId: attachment?.attachmentId,
370
+ fileName: attachment?.fileName || input.fileName || '',
371
+ fileSize: attachment?.fileSize || 0,
372
+ metadata: result.metadata,
373
+ };
374
+ }
375
+ if (!runtime.sendFile) {
376
+ throw new Error(`Channel platform does not support sending files: ${platform}`);
377
+ }
378
+ return runtime.sendFile(workspaceId, input);
379
+ }
380
+ async sendChannelMessage(platform, workspaceId, input) {
381
+ const runtime = this.resolveChannelRuntime(platform);
382
+ if (!runtime.sendOutboundMessage) {
383
+ throw new Error(`Channel platform does not support outbound messages: ${platform}`);
384
+ }
385
+ return runtime.sendOutboundMessage(workspaceId, input);
386
+ }
346
387
  async getWeixinQrCode(workspaceId) {
347
388
  const runtime = this.weixinChannelRuntime;
348
389
  return runtime.getQrCode(workspaceId);
@@ -249,6 +249,16 @@ class LocalAiCoreServer {
249
249
  json(res, 200, await this.bindings.disableChannelGateway(platform, workspaceOrCollection));
250
250
  return;
251
251
  }
252
+ if (action === 'files') {
253
+ const body = await readJsonBody(req);
254
+ json(res, 200, await this.bindings.sendChannelFile(platform, workspaceOrCollection, body));
255
+ return;
256
+ }
257
+ if (action === 'messages') {
258
+ const body = await readJsonBody(req);
259
+ json(res, 200, await this.bindings.sendChannelMessage(platform, workspaceOrCollection, body));
260
+ return;
261
+ }
252
262
  if (platform === 'weixin' && segments.length === 3 && workspaceOrCollection !== 'pairings' && action === 'qrcode') {
253
263
  json(res, 200, await this.bindings.getWeixinQrCode(workspaceOrCollection));
254
264
  return;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SCHEDULER_PROTOCOL_INSTRUCTION = exports.LOCALCORE_ACP_AGENT_TYPE = exports.DESKTOP_INTERACTIVE_PERMISSION_AGENT_TYPES = exports.DESKTOP_PROVIDER_THINKING_OPTIONS = exports.DESKTOP_PROVIDER_PRESET_OPTIONS = exports.DESKTOP_PLATFORM_TYPE_OPTIONS = exports.DESKTOP_AGENT_TYPE_OPTIONS = exports.DESKTOP_LARK_SDK_PACKAGE = exports.DESKTOP_CLAUDECODE_ACP_PACKAGE = exports.DESKTOP_CODEX_ACP_PACKAGE = exports.DEFAULT_DESKTOP_CLAUDECODE_MODEL = exports.DEFAULT_DESKTOP_OPENCODE_MODEL = exports.DEFAULT_DESKTOP_AGENT_TYPE = void 0;
3
+ exports.CHANNEL_PROTOCOL_INSTRUCTION = exports.SCHEDULER_PROTOCOL_INSTRUCTION = exports.LOCALCORE_ACP_AGENT_TYPE = exports.DESKTOP_INTERACTIVE_PERMISSION_AGENT_TYPES = exports.DESKTOP_PROVIDER_THINKING_OPTIONS = exports.DESKTOP_PROVIDER_PRESET_OPTIONS = exports.DESKTOP_PLATFORM_TYPE_OPTIONS = exports.DESKTOP_AGENT_TYPE_OPTIONS = exports.DESKTOP_LARK_SDK_PACKAGE = exports.DESKTOP_CLAUDECODE_ACP_PACKAGE = exports.DESKTOP_CODEX_ACP_PACKAGE = exports.DEFAULT_DESKTOP_CLAUDECODE_MODEL = exports.DEFAULT_DESKTOP_OPENCODE_MODEL = exports.DEFAULT_DESKTOP_AGENT_TYPE = void 0;
4
4
  exports.deriveDesktopRuntimePhase = deriveDesktopRuntimePhase;
5
5
  exports.deriveDesktopRuntimeRoles = deriveDesktopRuntimeRoles;
6
6
  exports.normalizeDesktopPlatformType = normalizeDesktopPlatformType;
@@ -73,6 +73,17 @@ exports.SCHEDULER_PROTOCOL_INSTRUCTION = [
73
73
  'Only use the scheduler CLI when the user explicitly asks for scheduled automation.',
74
74
  '[/Scheduler Tools]',
75
75
  ].join('\n');
76
+ exports.CHANNEL_PROTOCOL_INSTRUCTION = [
77
+ '[Channel Tools]',
78
+ 'If the user asks you to send a local file back through the current channel conversation, use the Bash tool to run the local channel CLI.',
79
+ 'Use this command:',
80
+ 'lac channel send-file --path "<absolute-or-workdir-relative-file-path>" [--target "<channel-chat-or-user-id>"]',
81
+ 'By default, the file is sent to the current platform conversation from LOCAL_AI_CHAT_ID.',
82
+ 'Use --target only when the user explicitly names a different channel chat or user id.',
83
+ 'The CLI accepts absolute paths. Check that the file exists before sending when practical.',
84
+ 'Only use the channel CLI when the user explicitly asks to send a file through the channel.',
85
+ '[/Channel Tools]',
86
+ ].join('\n');
76
87
  const PERMISSION_RESPONSE_MAP = {
77
88
  allow: 'allow',
78
89
  deny: 'deny',
@@ -111,6 +122,8 @@ function normalizeDesktopPlatformType(platformType) {
111
122
  function wrapUserMessageWithSchedulerProtocol(content, extraBlocks = []) {
112
123
  return [
113
124
  exports.SCHEDULER_PROTOCOL_INSTRUCTION,
125
+ '',
126
+ exports.CHANNEL_PROTOCOL_INSTRUCTION,
114
127
  ...extraBlocks.flatMap((block) => (block ? ['', block] : [])),
115
128
  '',
116
129
  '[User Message]',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kafca/agentdock",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "type": "module",
5
5
  "main": "dist-electron/electron/main.js",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- import{G as R,l as b,H as z,J as D,K as W,N as O,u as B,r as n,j as t,O as F,B as c,D as L,C as U,A as k,I as f,T as H}from"./index-Bn8ane6_.js";import{B as u}from"./Badge-BRmQIqbd.js";import{M as G}from"./Modal-Ceu_MP2e.js";import{S as w}from"./Select-BHQk6qCU.js";import{E as K}from"./EmptyState-w5-I9zg7.js";import{P as _}from"./Page-CpSczAz8.js";import{P as q}from"./plus-afkK9_Y8.js";import{P as Q}from"./play-CPFGjIyJ.js";import{P as V}from"./pencil-Dij0LlRY.js";import{T as X}from"./trash-2-CW1heMCf.js";import"./index-Ds0IN5rP.js";import"./check-DjfCdLvw.js";const Y=a=>R(),Z=a=>D(a),$=(a,o)=>z(a,o),ee=a=>W(a),te=a=>O(a),ae=()=>b().then(a=>a.workspaces),x={workspaceId:"",executionMode:"same-thread",triggerType:"cron",cronExpr:"0 9 * * *",runAt:"",promptTemplate:"",description:"",chatId:"",platformUserId:"",threadId:"",enabled:!0};function se(a){return a?{workspaceId:a.workspaceId,executionMode:a.executionMode,triggerType:a.triggerType,cronExpr:a.cronExpr||"0 9 * * *",runAt:a.runAt?String(a.runAt).slice(0,16):"",promptTemplate:a.promptTemplate,description:a.description,chatId:a.route.channelId,platformUserId:a.route.participantId||"",threadId:a.route.threadId||"",enabled:a.enabled}:x}function re(a){return{workspaceId:a.workspaceId,platform:"local",route:{type:"local.thread",channelId:a.workspaceId||"local",...a.threadId?{threadId:a.threadId}:{}},executionMode:a.executionMode||"same-thread",triggerType:a.triggerType,...a.triggerType==="cron"?{cronExpr:a.cronExpr,runAt:void 0}:{runAt:new Date(a.runAt).toISOString(),cronExpr:void 0},promptTemplate:a.promptTemplate,description:a.description,enabled:a.enabled}}function fe(){const{t:a}=B(),[o,I]=n.useState([]),[m,T]=n.useState([]),[C,y]=n.useState(!0),[S,d]=n.useState(!1),[j,v]=n.useState(!1),[p,h]=n.useState(null),[s,r]=n.useState(x),E=n.useMemo(()=>m.map(e=>t.jsx("option",{value:e.id,children:e.name},e.id)),[m]),i=n.useCallback(async()=>{y(!0);try{const[e,l]=await Promise.all([Y(),ae()]);I(e.jobs||[]),T(l),r(g=>g.workspaceId||l.length===0?g:{...g,workspaceId:l[0].id})}finally{y(!1)}},[]);n.useEffect(()=>{i();const e=F(l=>{(l.type==="scheduler.job.updated"||l.type==="scheduler.run.updated")&&i()});return()=>e()},[i]);const J=()=>{var e;h(null),r({...x,workspaceId:((e=m[0])==null?void 0:e.id)||""}),d(!0)},N=e=>{h(e),r(se(e)),d(!0)},A=async()=>{if(!(!s.workspaceId||!s.promptTemplate.trim())&&!(s.triggerType==="once"&&!s.runAt)){v(!0);try{const e=re(s);p?await $(p.id,e):await Z(e),d(!1),h(null),r(x),await i()}finally{v(!1)}}},M=async e=>{confirm(a("common.confirmDelete"))&&(await ee(e),await i())},P=async e=>{await te(e),await i()};return C&&o.length===0?t.jsx("div",{className:"flex items-center justify-center h-64 text-gray-400 animate-pulse",children:a("common.loading")}):t.jsxs("div",{className:"space-y-4 animate-fade-in",children:[t.jsx(_,{title:a("cron.title"),description:"Create simple scheduled prompts for a workspace.",actions:t.jsxs(c,{onClick:J,children:[t.jsx(q,{size:16})," ",a("cron.add")]})}),o.length===0?t.jsx(K,{message:a("cron.noJobs"),icon:L}):t.jsx("div",{className:"space-y-3",children:o.map(e=>t.jsx(U,{children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex-1",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[t.jsx("span",{className:"font-medium text-gray-900 dark:text-white text-sm",children:e.description||e.id}),t.jsx(u,{variant:e.enabled?"success":"default",children:e.enabled?a("cron.enabled"):"disabled"}),t.jsx(u,{variant:"default",children:e.triggerType}),t.jsx(u,{variant:"default",children:e.platform}),e.lastStatus&&t.jsx(u,{variant:e.lastStatus==="failed"?"danger":"default",children:e.lastStatus})]}),t.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500 dark:text-gray-400 mt-2",children:[t.jsxs("span",{children:[t.jsx("strong",{children:"Workspace:"})," ",e.workspaceId]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Execution:"})," ",e.executionMode]}),t.jsxs("span",{children:[t.jsx("strong",{children:"Route:"})," ",e.route.channelId," / ",e.route.participantId]}),t.jsxs("span",{children:[t.jsxs("strong",{children:[e.triggerType==="cron"?a("cron.expression"):"Run at",":"]})," ",e.triggerType==="cron"?e.cronExpr:k(e.runAt||"")]}),e.route.threadId&&t.jsxs("span",{children:[t.jsx("strong",{children:"Thread:"})," ",e.route.threadId]}),e.lastRunAt&&t.jsxs("span",{children:[t.jsxs("strong",{children:[a("cron.lastRun"),":"]})," ",k(e.lastRunAt)]})]}),t.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 mt-2 whitespace-pre-wrap",children:e.promptTemplate}),e.lastError&&t.jsx("p",{className:"text-xs text-red-500 mt-2",children:e.lastError})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(c,{size:"sm",variant:"secondary",onClick:()=>void P(e.id),children:t.jsx(Q,{size:14})}),t.jsx(c,{size:"sm",variant:"secondary",onClick:()=>N(e),children:t.jsx(V,{size:14})}),t.jsx(c,{size:"sm",variant:"danger",onClick:()=>void M(e.id),children:t.jsx(X,{size:14})})]})]})},e.id))}),t.jsx(G,{open:S,onClose:()=>d(!1),title:p?"Edit scheduler job":a("cron.add"),children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs(w,{label:"Workspace",value:s.workspaceId,onChange:e=>r({...s,workspaceId:e.target.value}),children:[t.jsx("option",{value:"",children:"Select workspace"}),E]}),t.jsxs(w,{label:"Schedule type",value:s.triggerType,onChange:e=>r({...s,triggerType:e.target.value}),children:[t.jsx("option",{value:"cron",children:"Repeating"}),t.jsx("option",{value:"once",children:"One time"})]}),s.triggerType==="cron"?t.jsx(f,{label:a("cron.expression"),value:s.cronExpr,onChange:e=>r({...s,cronExpr:e.target.value}),placeholder:"0 9 * * *"}):t.jsx(f,{label:"Run at",type:"datetime-local",value:s.runAt,onChange:e=>r({...s,runAt:e.target.value})}),t.jsx(f,{label:a("cron.description"),value:s.description,onChange:e=>r({...s,description:e.target.value})}),t.jsx(H,{label:a("cron.prompt"),value:s.promptTemplate,onChange:e=>r({...s,promptTemplate:e.target.value}),rows:4,placeholder:"Summarize today's blockers and post a status update."}),t.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700 dark:text-gray-300",children:[t.jsx("input",{type:"checkbox",checked:s.enabled,onChange:e=>r({...s,enabled:e.target.checked})}),a("cron.enabled")]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[t.jsx(c,{variant:"secondary",onClick:()=>d(!1),children:a("common.cancel")}),t.jsx(c,{onClick:()=>void A(),disabled:j,children:a(p?"common.save":"cron.add")})]})]})})]})}export{fe as default};
@@ -1 +0,0 @@
1
- import{u as p,r as t,au as v,j as e,L as j,B as d,C as y}from"./index-Bn8ane6_.js";import{B as N}from"./Badge-BRmQIqbd.js";import{S as m}from"./Select-BHQk6qCU.js";import{P as b}from"./Page-CpSczAz8.js";import{A as w}from"./arrow-left-Dtal-eOi.js";import{F as L}from"./funnel-CUQibo1I.js";import"./index-Ds0IN5rP.js";import"./check-DjfCdLvw.js";const C={debug:"text-gray-400",info:"text-blue-400",warn:"text-amber-400",error:"text-red-400"},S={debug:"default",info:"info",warn:"warning",error:"danger"};function H(){const{t:a}=p(),[i,x]=t.useState([]),[r,u]=t.useState("info"),[n,f]=t.useState("100"),[g,l]=t.useState(!0),o=t.useCallback(async()=>{l(!0);try{const s=await v({level:r,limit:n});x(s.entries||[])}finally{l(!1)}},[r,n]);return t.useEffect(()=>{o()},[o]),e.jsxs("div",{className:"space-y-4 animate-fade-in",children:[e.jsx(b,{title:a("system.logs"),description:"Filtered runtime logs for troubleshooting.",actions:e.jsx(j,{to:"/system",children:e.jsxs(d,{variant:"secondary",size:"sm",children:[e.jsx(w,{size:14})," ",a("nav.system")]})})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{size:14,className:"text-muted-foreground"}),e.jsxs(m,{value:r,onChange:s=>u(s.target.value),className:"w-auto",children:[e.jsx("option",{value:"debug",children:"Debug"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"warn",children:"Warn"}),e.jsx("option",{value:"error",children:"Error"})]})]}),e.jsxs(m,{value:n,onChange:s=>f(s.target.value),className:"w-auto",children:[e.jsx("option",{value:"50",children:"50"}),e.jsx("option",{value:"100",children:"100"}),e.jsx("option",{value:"500",children:"500"}),e.jsx("option",{value:"1000",children:"1000"})]}),e.jsx(d,{size:"sm",variant:"secondary",onClick:o,children:a("common.refresh")})]}),e.jsx(y,{children:g?e.jsx("div",{className:"text-muted-foreground animate-pulse text-sm",children:"Loading..."}):i.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:a("common.noData")}):e.jsx("div",{className:"space-y-1 max-h-[65vh] overflow-y-auto font-mono text-xs",children:i.map((s,h)=>{var c;return e.jsxs("div",{className:"flex items-start gap-3 py-1.5 border-b last:border-0",children:[e.jsx("span",{className:"text-muted-foreground shrink-0 w-36",children:(c=s.time)==null?void 0:c.slice(0,19)}),e.jsx(N,{variant:S[s.level]||"default",children:s.level}),e.jsx("span",{className:`${C[s.level]||"text-gray-500"} flex-1`,children:s.message})]},h)})})})]})}export{H as default};
@@ -1 +0,0 @@
1
- import{u as C,z,r as a,j as e,L as S,B as g,w as j,T as B}from"./index-Bn8ane6_.js";import{B as b}from"./Badge-BRmQIqbd.js";import{g as E,a as L}from"./sessions-C1yKps4T.js";import{C as _,A}from"./ChatMarkdown-DqW7OUvV.js";import{A as I}from"./arrow-left-Dtal-eOi.js";import{C as M}from"./circle-vfhmyE8v.js";import{W as y,R}from"./wifi-off-VMUokMpE.js";import{B as T,U}from"./user-r_2sHG7m.js";import"./check-DjfCdLvw.js";function G(){var p;const{t:r}=C(),{project:i,id:l}=z(),[s,v]=a.useState(null),[d,m]=a.useState(""),[c,x]=a.useState(!1),[w,u]=a.useState(!0),f=a.useRef(null),o=a.useCallback(async()=>{if(!(!i||!l))try{u(!0);const t=await E(i,l,200);v(t)}finally{u(!1)}},[i,l]);a.useEffect(()=>{o()},[o]),a.useEffect(()=>{var t;(t=f.current)==null||t.scrollIntoView({behavior:"smooth"})},[s==null?void 0:s.history]);const h=async()=>{if(!d.trim()||!i||!s)return;const t=d.trim();m(""),x(!0);try{await L(i,{session_key:s.session_key,message:t}),setTimeout(o,1500)}finally{x(!1)}},N=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),h())};return w&&!s?e.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):e.jsxs("div",{className:"flex flex-col h-[calc(100vh-8rem)] animate-fade-in",children:[e.jsxs("div",{className:"flex items-center justify-between pb-4 border-b",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{to:"/sessions",className:"p-2 rounded-md hover:bg-accent/10 transition-colors",children:e.jsx(I,{size:18,className:"text-muted-foreground"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:(s==null?void 0:s.name)||l}),s!=null&&s.live?e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-primary bg-primary/10 px-1.5 py-0.5 rounded-full",children:[e.jsx(M,{size:5,className:"fill-current"})," live"]}):e.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full",children:[e.jsx(y,{size:9})," ",r("sessions.offline")]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx(b,{children:i}),(s==null?void 0:s.platform)&&e.jsx(b,{variant:"info",children:s.platform}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s==null?void 0:s.session_key})]})]})]}),e.jsxs(g,{size:"sm",variant:"ghost",onClick:o,children:[e.jsx(R,{size:14})," ",r("common.refresh")]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto py-6 space-y-5",children:[(!(s!=null&&s.history)||s.history.length===0)&&e.jsx("p",{className:"text-center text-sm text-muted-foreground py-12",children:r("sessions.noMessages")}),(p=s==null?void 0:s.history)==null?void 0:p.map((t,k)=>{const n=t.role==="user";return e.jsxs("div",{className:j("flex gap-3",n?"justify-end":"justify-start"),children:[!n&&e.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0 mt-1",children:e.jsx(T,{size:16,className:"text-primary"})}),e.jsx("div",{className:j("rounded-lg px-5 py-3.5 text-sm",n?"max-w-[70%] bg-primary text-primary-foreground rounded-br-md":"max-w-[85%] bg-card border text-card-foreground rounded-bl-md shadow-sm"),children:e.jsx(_,{content:t.content,isUser:n})}),n&&e.jsx("div",{className:"w-8 h-8 rounded-md bg-muted flex items-center justify-center shrink-0 mt-1",children:e.jsx(U,{size:16,className:"text-muted-foreground"})})]},k)}),e.jsx("div",{ref:f})]}),e.jsx("div",{className:"border-t pt-4",children:s!=null&&s.live?e.jsxs("div",{className:"relative",children:[e.jsx(B,{value:d,onChange:t=>m(t.target.value),onKeyDown:N,placeholder:r("sessions.messageInput"),rows:2,className:"min-h-[88px] rounded-[24px] border-gray-200 bg-white px-4 pb-14 pt-3 text-[15px] leading-6 shadow-[0_12px_34px_rgba(15,23,42,0.08)] dark:border-white/[0.08] dark:bg-[rgba(0,0,0,0.42)] sm:min-h-[96px] sm:px-5 sm:pt-4",disabled:c}),e.jsx(g,{onClick:h,disabled:c||!d.trim(),size:"icon","aria-label":r("sessions.messageInput"),className:"absolute bottom-3 right-3 h-10 w-10 rounded-full bg-slate-900 px-0 text-white shadow-none hover:bg-slate-800 disabled:bg-slate-300 disabled:text-white disabled:opacity-100 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white dark:disabled:bg-white/20 dark:disabled:text-white/55 sm:h-11 sm:w-11",children:c?e.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):e.jsx(A,{size:20,strokeWidth:2.2})})]}):e.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground bg-muted rounded-lg",children:[e.jsx(y,{size:14}),e.jsx("span",{children:r("sessions.notLiveHint")})]})})]})}export{G as default};
@@ -1 +0,0 @@
1
- import{u as N,r as n,j as s,M as x,L as v,C as y}from"./index-Bn8ane6_.js";import{B as f}from"./Badge-BRmQIqbd.js";import{S as w}from"./Select-BHQk6qCU.js";import{E as _}from"./EmptyState-w5-I9zg7.js";import{l as S}from"./projects-DTDS9SnT.js";import{l as C}from"./sessions-C1yKps4T.js";import{F as L}from"./funnel-CUQibo1I.js";import{C as M}from"./circle-vfhmyE8v.js";import{U as E,B as $}from"./user-r_2sHG7m.js";import"./index-Ds0IN5rP.js";import"./check-DjfCdLvw.js";function k(a,o){if(!a)return"";const m=Date.now()-new Date(a).getTime(),i=Math.floor(m/6e4);if(i<1)return o("sessions.justNow");if(i<60)return`${i}m`;const l=Math.floor(i/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function q(){const{t:a}=N(),[o,m]=n.useState([]),[i,l]=n.useState([]),[c,j]=n.useState(""),[h,p]=n.useState(!0),d=n.useCallback(async()=>{p(!0);try{const{projects:e}=await S();l(e||[]);const t=await Promise.all((e||[]).map(async r=>{try{const{sessions:g}=await C(r.name);return{project:r.name,sessions:g||[]}}catch{return{project:r.name,sessions:[]}}}));m(t)}finally{p(!1)}},[]);n.useEffect(()=>{d();const e=()=>d();return window.addEventListener("cc:refresh",e),()=>window.removeEventListener("cc:refresh",e)},[d]);const u=n.useMemo(()=>(c?o.filter(t=>t.project===c):o).flatMap(t=>t.sessions.map(r=>({...r,_project:t.project}))).sort((t,r)=>(r.updated_at||r.created_at||"").localeCompare(t.updated_at||t.created_at||"")),[o,c]);return h&&o.length===0?s.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground animate-pulse",children:"Loading..."}):s.jsxs("div",{className:"space-y-4 animate-fade-in",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(L,{size:16,className:"text-muted-foreground"}),s.jsxs(w,{value:c,onChange:e=>j(e.target.value),className:"w-auto min-w-48",children:[s.jsx("option",{value:"",children:a("sessions.allProjects")}),i.map(e=>s.jsx("option",{value:e.name,children:e.name},e.name))]}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.length," ",a("nav.sessions").toLowerCase()]})]}),u.length===0?s.jsx(_,{message:a("sessions.noSessions"),icon:x}):s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-3",children:u.map(e=>s.jsx(v,{to:`/sessions/${encodeURIComponent(e._project)}/${encodeURIComponent(e.id)}`,children:s.jsxs(y,{hover:!0,className:"group relative h-full p-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(x,{size:14,className:e.live?"text-primary shrink-0":"text-muted-foreground shrink-0"}),s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.name||e.user_name||e.id.slice(0,8)}),e.live&&s.jsx(M,{size:5,className:"fill-primary text-primary shrink-0"})]}),s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 mt-0.5",children:k(e.updated_at||e.created_at,a)})]}),s.jsx("div",{className:"mb-2.5 min-h-[2.5rem]",children:e.last_message?s.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:[e.last_message.role==="user"?s.jsx(E,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}):s.jsx($,{size:10,className:"inline mr-1 -mt-0.5 opacity-60"}),e.last_message.content.replace(/\n/g," ").slice(0,100)]}):s.jsx("p",{className:"text-xs text-muted-foreground italic",children:a("sessions.noMessages")})}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.jsx(f,{children:e._project}),e.platform&&s.jsx(f,{variant:"info",children:e.platform}),s.jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:[e.history_count," msgs"]})]})]})},`${e._project}-${e.id}`))})]})}export{q as default};
@@ -1 +0,0 @@
1
- import{U as l,O as g,V as d,X as u,Y as c,_ as h,$ as C,a0 as w,a1 as k,a2 as v,a3 as S,a4 as m,a5 as P,a6 as y,a7 as L,a8 as b,a9 as f,aa as G,ab as R,ac as B,ad as A,ae as F,af as E,ag as I,ah as W,ai as D,aj as K,ak as T,al as x,m as i,i as U,am as Q,an as j,ao as z,ap as $,aq as _,ar as q,as as M,at as O,g as V}from"./index-Bn8ane6_.js";function t(){if(!window.desktop)throw new Error("Desktop APIs are unavailable in the browser build");return window.desktop}const X={getRuntimeStatus:()=>t().getRuntimeStatus(),startService:()=>t().startService(),stopService:()=>t().stopService(),restartService:()=>t().restartService(),getLogs:e=>t().getLogs(e),listInstalledAgentRuntimes:()=>w().then(e=>e.runtimes),refreshInstalledAgentRuntimes:()=>C().then(e=>e.runtimes),readConfigFile:()=>t().readConfigFile(),saveRawConfigFile:e=>t().saveRawConfigFile(e),saveStructuredConfigFile:e=>t().saveStructuredConfigFile(e),getThreadKnowledgeBases:(e,a)=>t().getThreadKnowledgeBases(e,a),updateThreadKnowledgeBases:(e,a,s)=>t().updateThreadKnowledgeBases(e,a,s),deleteThreadKnowledgeBases:(e,a)=>t().deleteThreadKnowledgeBases(e,a),saveSettings:e=>t().saveSettings(e),getCapabilitySnapshot:()=>h(),getPluginDiagnostics:()=>c(),listChannelGateways:e=>t().listChannelGateways(e),getChannelGatewayStatus:(e,a)=>t().getChannelGatewayStatus(e,a),testChannelConnection:(e,a)=>t().testChannelConnection(e,a),enableChannelGateway:(e,a)=>t().enableChannelGateway(e,a),disableChannelGateway:(e,a)=>t().disableChannelGateway(e,a),listChannelPendingPairings:(e,a)=>t().listChannelPendingPairings(e,a),approveChannelPairing:(e,a)=>t().approveChannelPairing(e,a),rejectChannelPairing:(e,a)=>t().rejectChannelPairing(e,a),listChannelAuthorizedUsers:(e,a)=>t().listChannelAuthorizedUsers(e,a),getWeixinQrCode:e=>u(e),checkWeixinQrCodeStatus:(e,a)=>d(e,a),listLarkGateways:()=>t().listLarkGateways(),getLarkGatewayStatus:e=>t().getLarkGatewayStatus(e),testLarkConnection:e=>t().testLarkConnection(e),enableLarkGateway:e=>t().enableLarkGateway(e),disableLarkGateway:e=>t().disableLarkGateway(e),listLarkPendingPairings:e=>t().listLarkPendingPairings(e),approveLarkPairing:e=>t().approveLarkPairing(e),rejectLarkPairing:e=>t().rejectLarkPairing(e),listLarkAuthorizedUsers:e=>t().listLarkAuthorizedUsers(e),probeWorkspaceStreaming:e=>t().probeWorkspaceStreaming(e),onRuntimeEvent:e=>t().onRuntimeEvent(e),onRuntimeDetectionEvent:e=>g(a=>{(a.type.startsWith("runtime.detect.")||a.type==="runtime.status.changed")&&e(a)}),onBridgeEvent:e=>l(e)},r={getRuntimeStatus:()=>O(),startService:()=>M(),stopService:()=>q(),restartService:()=>_(),getLogs:e=>$(e),listInstalledAgentRuntimes:()=>w().then(e=>e.runtimes),refreshInstalledAgentRuntimes:()=>C().then(e=>e.runtimes),readConfigFile:()=>z(),saveRawConfigFile:e=>j(e),saveStructuredConfigFile:e=>Q(e),getThreadKnowledgeBases:(e,a)=>U(a).then(s=>s.selectedKnowledgeBaseIds||[]),updateThreadKnowledgeBases:(e,a,s)=>i(a,s).then(p=>p.knowledgeBaseIds),deleteThreadKnowledgeBases:(e,a)=>i(a,[]).then(()=>({deleted:!0})),saveSettings:e=>x(e),getCapabilitySnapshot:()=>h(),getPluginDiagnostics:()=>c(),listChannelGateways:e=>T(e).then(a=>a.gateways),getChannelGatewayStatus:(e,a)=>K(e,a),testChannelConnection:(e,a)=>D(e,a),enableChannelGateway:(e,a)=>W(e,a),disableChannelGateway:(e,a)=>I(e,a),listChannelPendingPairings:(e,a)=>E(e,a).then(s=>s.pairings),approveChannelPairing:(e,a)=>F(e,a),rejectChannelPairing:(e,a)=>A(e,a),listChannelAuthorizedUsers:(e,a)=>B(e,a).then(s=>s.users),getWeixinQrCode:e=>u(e),checkWeixinQrCodeStatus:(e,a)=>d(e,a),listLarkGateways:()=>R().then(e=>e.gateways),getLarkGatewayStatus:e=>G(e),testLarkConnection:e=>f(e),enableLarkGateway:e=>b(e),disableLarkGateway:e=>L(e),listLarkPendingPairings:e=>y(e).then(a=>a.pairings),approveLarkPairing:e=>P(e),rejectLarkPairing:e=>m(e),listLarkAuthorizedUsers:e=>S(e).then(a=>a.users),probeWorkspaceStreaming:e=>v(e),onRuntimeEvent:e=>k(e),onRuntimeDetectionEvent:e=>g(a=>{(a.type.startsWith("runtime.detect.")||a.type==="runtime.status.changed")&&e(a)}),onBridgeEvent:e=>l(e)};let o=null;function Y(e){return e==="electron"&&window.desktop?X:r}function n(){const e=o||Y(V());if(!e)throw new Error("Managed desktop APIs are unavailable in this build");return o=e,e}const J=()=>n().getRuntimeStatus(),N=()=>n().startService(),Z=()=>n().listInstalledAgentRuntimes(),ee=()=>n().refreshInstalledAgentRuntimes(),ae=()=>n().readConfigFile(),te=e=>n().saveStructuredConfigFile(e),ne=(e,a,s)=>n().updateThreadKnowledgeBases(e,a,s),se=e=>n().saveSettings(e),ie=()=>n().getPluginDiagnostics(),re=e=>n().getWeixinQrCode(e),oe=(e,a)=>n().checkWeixinQrCodeStatus(e,a),le=e=>n().onRuntimeEvent(e),ge=e=>n().onRuntimeDetectionEvent(e),de=e=>n().onBridgeEvent(e);export{ge as a,de as b,ae as c,te as d,re as e,oe as f,J as g,ie as h,se as i,Z as l,le as o,ee as r,N as s,ne as u};
@@ -1,3 +0,0 @@
1
- const u="opencode",s="opencode/minimax-m2.5-free";const h=["opencode","codex","claudecode","cursor","gemini","qoder","iflow","localcore-acp"],_=["telegram","feishu","lark","discord","slack","dingtalk","wecom","weixin","qq","qqbot","line"],l=["opencode","codex","claudecode","acp","localcore-acp"],c="localcore-acp",d=["[Scheduler Tools]","If the user asks to create, view, edit, delete, or manually run a scheduled task for this conversation, use the Bash tool to run the local scheduler CLI.","Use these commands:",'lac scheduler add --cron "<5-field cron>" --message "<exact message to send>" --desc "<short label>" [--execution-mode same-thread|side-thread]',"lac scheduler list","lac scheduler list --thread","lac scheduler info <job-id>",'lac scheduler edit <job-id> [--cron "<5-field cron>"] [--message "<exact message>"] [--desc "<short label>"] [--enabled true|false] [--execution-mode same-thread|side-thread]',"lac scheduler del <job-id>","lac scheduler run <job-id>","Environment variables LOCAL_AI_WORKSPACE_ID, LOCAL_AI_THREAD_ID, LOCAL_AI_PLATFORM, LOCAL_AI_CHAT_ID, and LOCAL_AI_PLATFORM_USER_ID are already set when available.","Prefer relying on those variables instead of inventing your own route or creating session-only cron jobs.","By default, `lac scheduler list` shows all scheduled tasks in the current workspace. Use `lac scheduler list --thread` to show only the current conversation thread.","Use `--execution-mode same-thread` to reuse the current thread, or `--execution-mode side-thread` to run in a dedicated scheduled thread.","Only use the scheduler CLI when the user explicitly asks for scheduled automation.","[/Scheduler Tools]"].join(`
2
- `),i={allow:"allow",deny:"deny","allow all":"allow all",allowall:"allow all","perm:allow":"allow","perm:deny":"deny","perm:allow_all":"allow all"};function E(e,t=[]){return[d,...t.flatMap(o=>o?["",o]:[]),"","[User Message]",e,"[/User Message]"].join(`
3
- `)}function m(e){switch(String(e||"").trim().toLowerCase()){case"opencode":return s;case"claudecode":return"";default:return""}}function O(e,t){const o=String(e||"").trim().toLowerCase(),r=String(t||"").trim();return o?o==="opencode"?r||s:o==="claudecode"&&r.startsWith("opencode/")?"":r:r}function n(e){return e&&i[String(e).trim().toLowerCase()]||null}function f(e){return!!n(e==null?void 0:e.data)}function T(e){if(!e||typeof e!="object")return null;const t=e,o=typeof t.text=="string"?t.text:typeof t.Text=="string"?t.Text:"",r=typeof t.data=="string"?t.data:typeof t.Data=="string"?t.Data:"";if(!o||!r)return null;const a=n(r);return a?{text:a,data:a}:{text:o,data:r}}function A(e){return e?l.includes(String(e).trim().toLowerCase()):!1}function D(e){const t=String(e||"").trim().toLowerCase();return t==="acp"||t==="opencode"||t==="codex"||t==="claudecode"||t===c}export{h as D,n as a,D as b,O as c,_ as d,u as e,m as g,f as i,T as n,A as s,E as w};
@@ -1 +0,0 @@
1
- import{y as t}from"./index-Bn8ane6_.js";const e=()=>t.get("/projects"),r=o=>t.get(`/projects/${o}`);export{r as g,e as l};