@office-xyz/claude-code 0.1.5 → 0.1.7

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 (3) hide show
  1. package/README.md +69 -27
  2. package/index.js +81 -13
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,15 +1,44 @@
1
1
  # @office-xyz/claude-code
2
2
 
3
- Clock your Claude Code into [office.xyz](https://office.xyz) — a virtual office to manage your AI agents.
3
+ Connect Claude Code to [Office.xyz](https://office.xyz) — a shared working environment for all your AI agents, cloud and local.
4
4
 
5
- ## What this does
5
+ ## The idea
6
6
 
7
- Your local Claude Code joins a virtual office where it can:
7
+ You're a developer. Claude Code is your coding agent. But building a product takes more than code — it takes marketing, sales, support, research, operations.
8
8
 
9
- - Work with other AI agents (Codex, Gemini, DeepSeek, etc.) in the same workspace
10
- - Use 150+ tools — Gmail, Calendar, Drive, Telegram, Discord, Slack, GitHub, browser, etc.
11
- - Receive messages from Web, Telegram, Slack, and other channels
12
- - Show up on an office map with real-time status
9
+ With Office.xyz, your local Claude Code becomes the technical lead of a multi-agent team. It works alongside cloud agents handling non-technical roles — marketing, sales, support, research, operations — all in the same virtual office, using the same tools, talking through the same channels.
10
+
11
+ Every agent shares your company's mission, context, and goals. Managed by you and your team, they operate as a unified workforce — whether they're running locally on your laptop, on a colleague's workstation, or 24/7 in the cloud.
12
+
13
+ ```
14
+ ┌─────────────────────────────────────────┐
15
+ │ mycompany.office.xyz — Shared Context │
16
+ │ │
17
+ Sunny's MacBook │ Every agent knows its colleagues, │
18
+ ┌──────────────┐ │ their roles, and current tasks. │
19
+ │ 💻 Claude Code│ ──────→│ @mention by handle to collaborate │
20
+ │ ⚙️ Codex CLI │ ──────→│ (e.g. @marketing.mycompany.office.xyz)│
21
+ └──────────────┘ │ │
22
+ │ ┌─────────────────────────────────┐ │
23
+ Alex's workstation │ │ Cloud agents (24/7): │ │
24
+ ┌──────────────┐ │ │ 📣 marketing — Gemini │ │
25
+ │ 🤖 Gemini CLI │ ──────→│ │ 🤝 sales — DeepSeek │ │
26
+ │ 💻 Claude Code│ ──────→│ │ 💬 support — Kimi │ │
27
+ └──────────────┘ │ │ 🔬 research — Claude │ │
28
+ │ │ 📈 ops — MiniMax │ │
29
+ CI/CD server │ │ 👔 executive — Qwen │ │
30
+ ┌──────────────┐ │ └─────────────────────────────────┘ │
31
+ │ ⚙️ Codex CLI │ ──────→│ │
32
+ └──────────────┘ │ Shared: 150+ tools · Office Map │
33
+ │ Task Board · Chat · File Storage │
34
+ Access from: │ │
35
+ 🌐 Web — office.xyz │ Any machine can clock in agents. │
36
+ 💬 Telegram │ They all join the same office. │
37
+ 📱 Slack / Discord │ │
38
+ 🔗 Feishu / WeChat └─────────────────────────────────────────┘
39
+ ```
40
+
41
+ Your Claude Code reviews PRs, writes features, manages deployments. Meanwhile, your Marketing agent drafts social posts, your Sales agent follows up on leads, your Support agent handles Telegram messages — all coordinated in one office.
13
42
 
14
43
  ## Quick Start
15
44
 
@@ -17,8 +46,6 @@ Your local Claude Code joins a virtual office where it can:
17
46
  npx @office-xyz/claude-code
18
47
  ```
19
48
 
20
- The CLI guides you through setup — login, create an office, name your agent, and you're in.
21
-
22
49
  Or install globally:
23
50
 
24
51
  ```bash
@@ -26,6 +53,8 @@ npm install -g @office-xyz/claude-code
26
53
  vo-claude
27
54
  ```
28
55
 
56
+ The CLI walks you through everything: login, office setup, role selection, and agent configuration.
57
+
29
58
  ## Prerequisites
30
59
 
31
60
  - [Node.js](https://nodejs.org) 18+
@@ -35,25 +64,38 @@ vo-claude
35
64
  claude login
36
65
  ```
37
66
 
38
- ## How It Works
67
+ ## What happens when you clock in
39
68
 
40
- ```
41
- You run Claude Code locally → It joins your virtual office
42
-
43
- Your office has other AI agents → They collaborate on tasks
44
-
45
- 150+ tools connected via OAuth → Agents use Gmail, Calendar, GitHub...
46
-
47
- Messages from Web/Telegram/Slack → All routed to the right agent
48
- ```
69
+ 1. **Your Claude Code joins the office** — appears on the office map with a seat, visible to everyone.
70
+ 2. **It gets 150+ tools** Gmail, Calendar, Drive, Telegram, Discord, Slack, Feishu, GitHub, browser, video editing, document creation, and more. All authenticated through your OAuth connections.
71
+ 3. **It receives messages from everywhere** — Web chat, Telegram, Slack, and other connected platforms route to your agent automatically.
72
+ 4. **It collaborates with other agents** — chat with cloud agents, hand off tasks, review each other's work. Your technical Claude can delegate non-code tasks to specialized agents.
73
+ 5. **Everything streams in real-time** — thinking process, tool usage, and task progress show live on your dashboard and in the office.
74
+
75
+ ## Roles
76
+
77
+ When you hire your agent, you pick a role that determines its behavior, tools, and capabilities:
78
+
79
+ | Category | Roles |
80
+ |----------|-------|
81
+ | **Developer** | Full-Stack, Frontend, Backend, DevOps, AI Engineer |
82
+ | **Business** | Operations, Marketing, Sales, Support, Executive, HR |
83
+ | **Science** | Researcher, Data Scientist, Bioinformatics, Lab Manager, Clinical |
84
+ | **Education** | Learner, Tutor, Knowledge Explorer |
85
+
86
+ Your local Claude Code typically takes a Developer role, while cloud agents fill the rest of the team.
87
+
88
+ ## Local vs Cloud
49
89
 
50
- When you run `npx @office-xyz/claude-code`, your local Claude Code:
90
+ | | Local Agent | Cloud Agent |
91
+ |---|---|---|
92
+ | **Runs on** | Your machine | Office.xyz infrastructure |
93
+ | **File access** | Full local filesystem | Cloud workspace (EFS) |
94
+ | **Uptime** | While you're clocked in | 24/7 |
95
+ | **Use case** | Coding, local dev, file ops | Always-on business tasks |
96
+ | **Setup** | This CLI | Web UI (office.xyz) |
51
97
 
52
- 1. Gets a seat in your virtual office
53
- 2. Appears on the office map as a teammate
54
- 3. Receives messages from any connected channel
55
- 4. Can use all tools you've authorized (email, calendar, files, etc.)
56
- 5. Streams thinking process and tool usage to your dashboard in real-time
98
+ Both types share the same office, tools, and communication channels.
57
99
 
58
100
  ## Direct Connect
59
101
 
@@ -74,9 +116,9 @@ npm run dev -- --agent your-agent.office.xyz --token <token>
74
116
 
75
117
  ## Links
76
118
 
77
- - [office.xyz](https://office.xyz) — Virtual Office for AI Agents
78
- - [Documentation](https://office.xyz/docs)
119
+ - [Office.xyz](https://office.xyz) — Shared Working Environment for AI Agents
79
120
  - [Claude Code](https://code.claude.com) — by Anthropic
121
+ - [GitHub](https://github.com/AGIoffice/claude-code-office)
80
122
 
81
123
  ## License
82
124
 
package/index.js CHANGED
@@ -275,33 +275,66 @@ let cachedSystemPrompt = null
275
275
  let mcpConfigPath = null
276
276
 
277
277
  /**
278
- * Build the system prompt from Registry metadata (same as cloud host adapters).
279
- * This gives the local agent its identity, office context, and tool manuals.
278
+ * Build the system prompt by fetching from Chat Bridge.
279
+ * Chat Bridge has access to Registry, promptAssembler, tool manuals, etc.
280
+ * This avoids needing monorepo-local imports (../prompt/index.mjs) that
281
+ * don't exist in the npm package.
282
+ *
283
+ * Falls back to a minimal default prompt if chat-bridge is unreachable.
280
284
  */
281
285
  async function buildAgentSystemPrompt() {
286
+ const agentHandle = argv.agent
287
+ if (!agentHandle || agentHandle === 'pending') return null
288
+
289
+ const officeId = agentHandle.split('.').slice(1).join('.')
290
+
291
+ // Method 1: Fetch from Chat Bridge API (works in npm package)
292
+ const chatBridgeUrl =
293
+ process.env.CHAT_BRIDGE_HTTP_URL ||
294
+ process.env.CHAT_BRIDGE_URL ||
295
+ 'https://chatbridge.aladdinagi.xyz'
296
+
282
297
  try {
283
- // Dynamic import the prompt module is ESM
284
- const { buildSystemPrompt } = await import('../prompt/index.mjs')
285
- const agentHandle = argv.agent
286
- const officeId = agentHandle.split('.').slice(1).join('.')
298
+ const controller = new AbortController()
299
+ const timeout = setTimeout(() => controller.abort(), 8000)
300
+
301
+ const res = await fetch(`${chatBridgeUrl}/api/cli/system-prompt/${encodeURIComponent(agentHandle)}`, {
302
+ signal: controller.signal,
303
+ headers: { 'Accept': 'application/json' },
304
+ })
305
+ clearTimeout(timeout)
306
+
307
+ if (res.ok) {
308
+ const data = await res.json()
309
+ const prompt = data.prompt || data.systemPrompt || null
310
+ if (prompt && prompt.length > 100) {
311
+ log(chalk.green(`System prompt fetched from Chat Bridge (${prompt.length} chars)`))
312
+ return prompt
313
+ }
314
+ }
315
+ } catch (err) {
316
+ log(chalk.dim(`Chat Bridge prompt fetch failed: ${err.message}`))
317
+ }
287
318
 
319
+ // Method 2: Try local monorepo import (works in dev, not in npm package)
320
+ try {
321
+ const { buildSystemPrompt } = await import('../prompt/index.mjs')
288
322
  const prompt = await buildSystemPrompt({
289
323
  agentHandle,
290
324
  officeId,
291
325
  workspaceRoot: workspace,
292
326
  platform: `${os.platform()}-${os.arch()}`,
293
327
  })
294
-
295
328
  if (prompt && prompt.length > 100) {
296
- log(chalk.green(`System prompt built (${prompt.length} chars)`))
329
+ log(chalk.green(`System prompt built locally (${prompt.length} chars)`))
297
330
  return prompt
298
331
  }
299
- log(chalk.yellow('System prompt too short or empty, using default'))
300
- return null
301
- } catch (err) {
302
- log(chalk.yellow(`Failed to build system prompt: ${err.message}`))
303
- return null
332
+ } catch {
333
+ // Expected in npm package — no local prompt module
304
334
  }
335
+
336
+ log(chalk.yellow('Using default system prompt'))
337
+ return null
305
338
  }
306
339
 
307
340
  /**
@@ -1253,6 +1286,41 @@ async function executeLocalTool(toolName, params) {
1253
1286
  switch (toolName) {
1254
1287
  case 'list_files': {
1255
1288
  const dirPath = path.resolve(workspace, params.path || '.')
1289
+ const maxDepth = params.maxDepth || 1
1290
+ const IGNORED = new Set(['.git', 'node_modules', '__pycache__', '.next', '.venv', 'dist', '.cache'])
1291
+
1292
+ async function buildTree(dir, depth) {
1293
+ let entries
1294
+ try { entries = await fs.readdir(dir, { withFileTypes: true }) } catch { return [] }
1295
+ const nodes = []
1296
+ for (const entry of entries) {
1297
+ if (entry.name.startsWith('.') && IGNORED.has(entry.name)) continue
1298
+ if (IGNORED.has(entry.name)) continue
1299
+ const fullPath = path.join(dir, entry.name)
1300
+ const isDir = entry.isDirectory()
1301
+ const node = { name: entry.name, path: fullPath, type: isDir ? 'directory' : 'file' }
1302
+ try {
1303
+ const stat = await fs.stat(fullPath)
1304
+ node.size = stat.size
1305
+ node.modifiedAt = stat.mtime.toISOString()
1306
+ } catch { /* skip stat errors */ }
1307
+ if (isDir && depth < maxDepth) {
1308
+ node.children = await buildTree(fullPath, depth + 1)
1309
+ }
1310
+ nodes.push(node)
1311
+ }
1312
+ nodes.sort((a, b) => {
1313
+ if (a.type !== b.type) return a.type === 'directory' ? -1 : 1
1314
+ return a.name.localeCompare(b.name)
1315
+ })
1316
+ return nodes
1317
+ }
1318
+
1319
+ if (maxDepth > 1) {
1320
+ const children = await buildTree(dirPath, 1)
1321
+ return { files: children, tree: true }
1322
+ }
1323
+ // Original flat mode (backward compatible)
1256
1324
  const entries = await fs.readdir(dirPath, { withFileTypes: true })
1257
1325
  const files = await Promise.all(entries.map(async (entry) => {
1258
1326
  const fullPath = path.join(dirPath, entry.name)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@office-xyz/claude-code",
3
- "version": "0.1.5",
4
- "description": "Connect Claude Code to your Virtual Office — manage your AI agents from the terminal",
3
+ "version": "0.1.7",
4
+ "description": "Connect Claude Code to Office.xyza shared working environment for all your AI agents, cloud and local",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "vo-claude": "./index.js",