@jackchen_me/open-multi-agent 0.2.0 → 1.0.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.
Files changed (117) hide show
  1. package/README.md +87 -20
  2. package/dist/agent/agent.d.ts +15 -1
  3. package/dist/agent/agent.d.ts.map +1 -1
  4. package/dist/agent/agent.js +144 -10
  5. package/dist/agent/agent.js.map +1 -1
  6. package/dist/agent/loop-detector.d.ts +39 -0
  7. package/dist/agent/loop-detector.d.ts.map +1 -0
  8. package/dist/agent/loop-detector.js +122 -0
  9. package/dist/agent/loop-detector.js.map +1 -0
  10. package/dist/agent/pool.d.ts +2 -1
  11. package/dist/agent/pool.d.ts.map +1 -1
  12. package/dist/agent/pool.js +4 -2
  13. package/dist/agent/pool.js.map +1 -1
  14. package/dist/agent/runner.d.ts +23 -1
  15. package/dist/agent/runner.d.ts.map +1 -1
  16. package/dist/agent/runner.js +113 -12
  17. package/dist/agent/runner.js.map +1 -1
  18. package/dist/index.d.ts +3 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +2 -0
  21. package/dist/index.js.map +1 -1
  22. package/dist/llm/adapter.d.ts +4 -1
  23. package/dist/llm/adapter.d.ts.map +1 -1
  24. package/dist/llm/adapter.js +11 -0
  25. package/dist/llm/adapter.js.map +1 -1
  26. package/dist/llm/copilot.d.ts.map +1 -1
  27. package/dist/llm/copilot.js +2 -1
  28. package/dist/llm/copilot.js.map +1 -1
  29. package/dist/llm/gemini.d.ts +65 -0
  30. package/dist/llm/gemini.d.ts.map +1 -0
  31. package/dist/llm/gemini.js +317 -0
  32. package/dist/llm/gemini.js.map +1 -0
  33. package/dist/llm/grok.d.ts +21 -0
  34. package/dist/llm/grok.d.ts.map +1 -0
  35. package/dist/llm/grok.js +24 -0
  36. package/dist/llm/grok.js.map +1 -0
  37. package/dist/llm/openai-common.d.ts +8 -1
  38. package/dist/llm/openai-common.d.ts.map +1 -1
  39. package/dist/llm/openai-common.js +35 -2
  40. package/dist/llm/openai-common.js.map +1 -1
  41. package/dist/llm/openai.d.ts +1 -1
  42. package/dist/llm/openai.d.ts.map +1 -1
  43. package/dist/llm/openai.js +20 -2
  44. package/dist/llm/openai.js.map +1 -1
  45. package/dist/orchestrator/orchestrator.d.ts.map +1 -1
  46. package/dist/orchestrator/orchestrator.js +89 -9
  47. package/dist/orchestrator/orchestrator.js.map +1 -1
  48. package/dist/task/queue.d.ts +31 -2
  49. package/dist/task/queue.d.ts.map +1 -1
  50. package/dist/task/queue.js +69 -2
  51. package/dist/task/queue.js.map +1 -1
  52. package/dist/tool/text-tool-extractor.d.ts +32 -0
  53. package/dist/tool/text-tool-extractor.d.ts.map +1 -0
  54. package/dist/tool/text-tool-extractor.js +187 -0
  55. package/dist/tool/text-tool-extractor.js.map +1 -0
  56. package/dist/types.d.ts +139 -7
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/utils/trace.d.ts +12 -0
  59. package/dist/utils/trace.d.ts.map +1 -0
  60. package/dist/utils/trace.js +30 -0
  61. package/dist/utils/trace.js.map +1 -0
  62. package/package.json +18 -2
  63. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  64. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
  65. package/.github/pull_request_template.md +0 -14
  66. package/.github/workflows/ci.yml +0 -23
  67. package/CLAUDE.md +0 -72
  68. package/CODE_OF_CONDUCT.md +0 -48
  69. package/CONTRIBUTING.md +0 -72
  70. package/DECISIONS.md +0 -43
  71. package/README_zh.md +0 -217
  72. package/SECURITY.md +0 -17
  73. package/examples/01-single-agent.ts +0 -131
  74. package/examples/02-team-collaboration.ts +0 -167
  75. package/examples/03-task-pipeline.ts +0 -201
  76. package/examples/04-multi-model-team.ts +0 -261
  77. package/examples/05-copilot-test.ts +0 -49
  78. package/examples/06-local-model.ts +0 -199
  79. package/examples/07-fan-out-aggregate.ts +0 -209
  80. package/examples/08-gemma4-local.ts +0 -203
  81. package/examples/09-gemma4-auto-orchestration.ts +0 -162
  82. package/src/agent/agent.ts +0 -473
  83. package/src/agent/pool.ts +0 -278
  84. package/src/agent/runner.ts +0 -413
  85. package/src/agent/structured-output.ts +0 -126
  86. package/src/index.ts +0 -167
  87. package/src/llm/adapter.ts +0 -87
  88. package/src/llm/anthropic.ts +0 -389
  89. package/src/llm/copilot.ts +0 -551
  90. package/src/llm/openai-common.ts +0 -255
  91. package/src/llm/openai.ts +0 -272
  92. package/src/memory/shared.ts +0 -181
  93. package/src/memory/store.ts +0 -124
  94. package/src/orchestrator/orchestrator.ts +0 -977
  95. package/src/orchestrator/scheduler.ts +0 -352
  96. package/src/task/queue.ts +0 -394
  97. package/src/task/task.ts +0 -239
  98. package/src/team/messaging.ts +0 -232
  99. package/src/team/team.ts +0 -334
  100. package/src/tool/built-in/bash.ts +0 -187
  101. package/src/tool/built-in/file-edit.ts +0 -154
  102. package/src/tool/built-in/file-read.ts +0 -105
  103. package/src/tool/built-in/file-write.ts +0 -81
  104. package/src/tool/built-in/grep.ts +0 -362
  105. package/src/tool/built-in/index.ts +0 -50
  106. package/src/tool/executor.ts +0 -178
  107. package/src/tool/framework.ts +0 -557
  108. package/src/types.ts +0 -391
  109. package/src/utils/semaphore.ts +0 -89
  110. package/tests/semaphore.test.ts +0 -57
  111. package/tests/shared-memory.test.ts +0 -122
  112. package/tests/structured-output.test.ts +0 -331
  113. package/tests/task-queue.test.ts +0 -244
  114. package/tests/task-retry.test.ts +0 -368
  115. package/tests/task-utils.test.ts +0 -155
  116. package/tests/tool-executor.test.ts +0 -193
  117. package/tsconfig.json +0 -25
@@ -1,124 +0,0 @@
1
- /**
2
- * @fileoverview In-memory implementation of {@link MemoryStore}.
3
- *
4
- * All data lives in a plain `Map` and is never persisted to disk. This is the
5
- * default store used by {@link SharedMemory} and is suitable for testing and
6
- * single-process use-cases. Swap it for a Redis or SQLite-backed implementation
7
- * in production by satisfying the same {@link MemoryStore} interface.
8
- */
9
-
10
- import type { MemoryEntry, MemoryStore } from '../types.js'
11
-
12
- // ---------------------------------------------------------------------------
13
- // InMemoryStore
14
- // ---------------------------------------------------------------------------
15
-
16
- /**
17
- * Synchronous-under-the-hood key/value store that exposes an `async` surface
18
- * so implementations can be swapped for async-native backends without changing
19
- * callers.
20
- *
21
- * All keys are treated as opaque strings. Values are always strings; structured
22
- * data must be serialised by the caller (e.g. `JSON.stringify`).
23
- *
24
- * @example
25
- * ```ts
26
- * const store = new InMemoryStore()
27
- * await store.set('config', JSON.stringify({ model: 'claude-opus-4-6' }))
28
- * const entry = await store.get('config')
29
- * ```
30
- */
31
- export class InMemoryStore implements MemoryStore {
32
- private readonly data = new Map<string, MemoryEntry>()
33
-
34
- // ---------------------------------------------------------------------------
35
- // MemoryStore interface
36
- // ---------------------------------------------------------------------------
37
-
38
- /** Returns the entry for `key`, or `null` if not present. */
39
- async get(key: string): Promise<MemoryEntry | null> {
40
- return this.data.get(key) ?? null
41
- }
42
-
43
- /**
44
- * Upserts `key` with `value` and optional `metadata`.
45
- *
46
- * If the key already exists its `createdAt` is **preserved** so callers can
47
- * detect when a value was first written.
48
- */
49
- async set(
50
- key: string,
51
- value: string,
52
- metadata?: Record<string, unknown>,
53
- ): Promise<void> {
54
- const existing = this.data.get(key)
55
- const entry: MemoryEntry = {
56
- key,
57
- value,
58
- metadata: metadata !== undefined ? { ...metadata } : undefined,
59
- createdAt: existing?.createdAt ?? new Date(),
60
- }
61
- this.data.set(key, entry)
62
- }
63
-
64
- /** Returns a snapshot of all entries in insertion order. */
65
- async list(): Promise<MemoryEntry[]> {
66
- return Array.from(this.data.values())
67
- }
68
-
69
- /**
70
- * Removes the entry for `key`.
71
- * Deleting a non-existent key is a no-op.
72
- */
73
- async delete(key: string): Promise<void> {
74
- this.data.delete(key)
75
- }
76
-
77
- /** Removes **all** entries from the store. */
78
- async clear(): Promise<void> {
79
- this.data.clear()
80
- }
81
-
82
- // ---------------------------------------------------------------------------
83
- // Extensions beyond the base MemoryStore interface
84
- // ---------------------------------------------------------------------------
85
-
86
- /**
87
- * Returns entries whose `key` starts with `query` **or** whose `value`
88
- * contains `query` (case-insensitive substring match).
89
- *
90
- * This is a simple linear scan; it is not suitable for very large stores
91
- * without an index layer on top.
92
- *
93
- * @example
94
- * ```ts
95
- * // Find all entries related to "research"
96
- * const hits = await store.search('research')
97
- * ```
98
- */
99
- async search(query: string): Promise<MemoryEntry[]> {
100
- if (query.length === 0) {
101
- return this.list()
102
- }
103
- const lower = query.toLowerCase()
104
- return Array.from(this.data.values()).filter(
105
- (entry) =>
106
- entry.key.toLowerCase().includes(lower) ||
107
- entry.value.toLowerCase().includes(lower),
108
- )
109
- }
110
-
111
- // ---------------------------------------------------------------------------
112
- // Convenience helpers (not part of MemoryStore)
113
- // ---------------------------------------------------------------------------
114
-
115
- /** Returns the number of entries currently held in the store. */
116
- get size(): number {
117
- return this.data.size
118
- }
119
-
120
- /** Returns `true` if `key` exists in the store. */
121
- has(key: string): boolean {
122
- return this.data.has(key)
123
- }
124
- }