linco-connect 1.1.2 → 1.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linco-connect",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "自研 IM 桥接多 Agent 服务",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -232,6 +232,7 @@ function ensureThread(session) {
232
232
  threadId: session.agentSessionId,
233
233
  cwd: session.workspace,
234
234
  approvalPolicy: 'untrusted',
235
+ ...buildCodexThreadSandbox(session),
235
236
  }).then(result => {
236
237
  return session.agentSessionId;
237
238
  }).catch(err => {
@@ -250,6 +251,7 @@ function startNewThread(session, agentConfig) {
250
251
  cwd: session.workspace,
251
252
  model: agentConfig.model || null,
252
253
  approvalPolicy: 'untrusted',
254
+ ...buildCodexThreadSandbox(session),
253
255
  }).then(result => {
254
256
  const threadId = result?.thread?.id || result?.id || result?.threadId;
255
257
  if (threadId) {
@@ -359,6 +361,37 @@ function sendJsonRpc(child, message) {
359
361
  }
360
362
  }
361
363
 
364
+ function buildCodexThreadSandbox(session) {
365
+ const writableRoots = [session.workspace, session.outboxDir].filter(Boolean);
366
+ return {
367
+ sandbox: 'workspace-write',
368
+ config: {
369
+ sandbox_mode: 'workspace-write',
370
+ sandbox_workspace_write: {
371
+ writable_roots: [...new Set(writableRoots)],
372
+ network_access: false,
373
+ exclude_tmpdir_env_var: false,
374
+ exclude_slash_tmp: false,
375
+ },
376
+ },
377
+ };
378
+ }
379
+
380
+ function buildCodexPermissionGrant(session) {
381
+ const writableRoots = [session.outboxDir].filter(Boolean);
382
+ return {
383
+ fileSystem: {
384
+ read: null,
385
+ write: writableRoots,
386
+ entries: writableRoots.map(root => ({
387
+ path: { type: 'path', path: root },
388
+ access: 'write',
389
+ })),
390
+ },
391
+ network: { enabled: false },
392
+ };
393
+ }
394
+
362
395
  function handleServerRequest(message, session) {
363
396
  const method = message.method || '';
364
397
  const params = message.params || {};
@@ -434,7 +467,7 @@ function handleServerRequest(message, session) {
434
467
  sendJsonRpc(session.codexAppServer, {
435
468
  jsonrpc: '2.0',
436
469
  id: message.id,
437
- result: { permissions: { fileSystem: { entries: [] }, network: { enabled: false } }, scope: 'session' },
470
+ result: { permissions: buildCodexPermissionGrant(session), scope: 'session' },
438
471
  });
439
472
  return;
440
473
  }
@@ -395,7 +395,7 @@ function createOpenClawProcessHandle(session, client) {
395
395
  }
396
396
 
397
397
  function resolveOpenClawAgentId(input, session, agentConfig) {
398
- const messageAgentId = readInputMeta(input, 'openclawAgentId') || readInputMeta(input, 'agentId');
398
+ const messageAgentId = readInputMeta(input, 'openclawAgentId');
399
399
  return String(
400
400
  messageAgentId ||
401
401
  session.openclawAgentId ||
@@ -517,7 +517,10 @@ function readInputMeta(input, key) {
517
517
  }
518
518
  return '';
519
519
  }
520
- return input && typeof input === 'object' ? input[key] : '';
520
+ if (input && typeof input === 'object') {
521
+ return input[key] || input._lincoMeta?.[key] || '';
522
+ }
523
+ return '';
521
524
  }
522
525
 
523
526
  function extractMessageText(message) {
@@ -609,4 +612,7 @@ module.exports = {
609
612
  resolvePendingDanger,
610
613
  resolvePendingPermission,
611
614
  stop,
615
+ _internal: {
616
+ resolveOpenClawAgentId,
617
+ },
612
618
  };
@@ -517,7 +517,6 @@ function isDuplicateInbound(msg) {
517
517
  function resolveOpenClawAgentIdFromMessage(msg, session, agentConfig, config) {
518
518
  return String(
519
519
  msg.openclawAgentId ||
520
- msg.agentId ||
521
520
  session.openclawAgentId ||
522
521
  agentConfig.openclawAgentId ||
523
522
  config.agents?.openclaw?.openclawAgentId ||
@@ -564,4 +563,7 @@ function safeUrlForLog(value) {
564
563
  module.exports = {
565
564
  startImConnector,
566
565
  startImConnectors,
566
+ _internal: {
567
+ resolveOpenClawAgentIdFromMessage,
568
+ },
567
569
  };