@oxgeneral/orch 1.0.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.
@@ -7,6 +7,8 @@ import { printWarning, printSuccess, dim } from './chunk-7X2GI5OV.js';
7
7
  import './chunk-2C2TFQ7K.js';
8
8
  import path from 'path';
9
9
  import fs from 'fs/promises';
10
+ import { execFile } from 'child_process';
11
+ import { promisify } from 'util';
10
12
 
11
13
  // src/domain/default-agents.ts
12
14
  var AGENT_CREATOR_ROLE = `Agent architect \u2014 designs and creates AI agents for the orchestrator via \`orch agent add\`.
@@ -76,6 +78,7 @@ function getDefaultAgents() {
76
78
  }
77
79
 
78
80
  // src/cli/commands/init.ts
81
+ var execFileAsync = promisify(execFile);
79
82
  async function runInit(opts = {}) {
80
83
  const projectRoot = process.cwd();
81
84
  const paths = new Paths(projectRoot);
@@ -91,8 +94,12 @@ async function runInit(opts = {}) {
91
94
  ensureDir(paths.templatesDir),
92
95
  ensureDir(paths.logsDir)
93
96
  ]);
94
- const config = { ...DEFAULT_CONFIG };
97
+ const gitAvailable = await ensureGitRepo(projectRoot);
98
+ const config = structuredClone(DEFAULT_CONFIG);
95
99
  config.project.name = opts.name ?? path.basename(projectRoot);
100
+ if (!gitAvailable) {
101
+ config.defaults.agent.workspace_mode = "shared";
102
+ }
96
103
  const gitignoreContent = [
97
104
  "# Runtime state",
98
105
  "state.json",
@@ -126,6 +133,9 @@ async function runInit(opts = {}) {
126
133
  ...defaultAgents.map((agent) => writeYaml(paths.agentPath(agent.id), agent))
127
134
  ]);
128
135
  await ensureRootGitignore(projectRoot);
136
+ if (gitAvailable) {
137
+ await ensureGitCommit(projectRoot);
138
+ }
129
139
  console.log();
130
140
  printSuccess("initialized");
131
141
  console.log();
@@ -140,6 +150,30 @@ async function runInit(opts = {}) {
140
150
  console.log(` ${dim("\u2514\u2500\u2500")} .gitignore`);
141
151
  console.log();
142
152
  }
153
+ async function ensureGitRepo(projectRoot) {
154
+ try {
155
+ await execFileAsync("git", ["rev-parse", "--is-inside-work-tree"], { cwd: projectRoot });
156
+ return true;
157
+ } catch {
158
+ try {
159
+ await execFileAsync("git", ["init"], { cwd: projectRoot });
160
+ return true;
161
+ } catch {
162
+ return false;
163
+ }
164
+ }
165
+ }
166
+ async function ensureGitCommit(projectRoot) {
167
+ try {
168
+ await execFileAsync("git", ["rev-parse", "HEAD"], { cwd: projectRoot });
169
+ } catch {
170
+ try {
171
+ await execFileAsync("git", ["add", "-A"], { cwd: projectRoot });
172
+ await execFileAsync("git", ["commit", "-m", "Initial commit", "--allow-empty"], { cwd: projectRoot });
173
+ } catch {
174
+ }
175
+ }
176
+ }
143
177
  async function ensureRootGitignore(projectRoot) {
144
178
  const gitignorePath = path.join(projectRoot, ".gitignore");
145
179
  try {
@@ -963,9 +963,12 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
963
963
  await this.deps.taskService.assign(taskId, agent.id);
964
964
  await this.deps.taskService.incrementAttempts(taskId);
965
965
  if (worktreeBranch) {
966
- task.proof = { ...task.proof ?? { files_changed: [] }, branch: worktreeBranch };
967
- task.workspace = workspacePath;
968
- await this.deps.taskStore.save(task);
966
+ const freshTask = await this.deps.taskStore.get(taskId);
967
+ if (freshTask) {
968
+ freshTask.proof = { ...freshTask.proof ?? { files_changed: [] }, branch: worktreeBranch };
969
+ freshTask.workspace = workspacePath;
970
+ await this.deps.taskStore.save(freshTask);
971
+ }
969
972
  }
970
973
  await this.deps.agentService.setStatus(agent.id, "running");
971
974
  const agentData = await this.deps.agentService.get(agent.id);
@@ -1053,11 +1056,15 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1053
1056
  if (typeof p === "string") filesChangedSet.add(p);
1054
1057
  }
1055
1058
  } else {
1056
- const filePath = data && typeof data.path === "string" ? data.path : typeof event.data === "string" ? event.data : String(event.data);
1057
- filesChangedSet.add(filePath);
1059
+ const filePath2 = data && typeof data.path === "string" ? data.path : typeof event.data === "string" ? event.data : String(event.data);
1060
+ filesChangedSet.add(filePath2);
1058
1061
  }
1059
1062
  }
1060
1063
  const eventTimestamp = isValidISOTimestamp(event.timestamp) ? event.timestamp : (/* @__PURE__ */ new Date()).toISOString();
1064
+ const filePath = event.type === "file_change" ? (() => {
1065
+ const d = event.data;
1066
+ return d && typeof d.path === "string" ? d.path : typeof event.data === "string" ? event.data : String(event.data);
1067
+ })() : null;
1061
1068
  const serialized = serializeEventData(event.data, MAX_EVENT_DATA_LEN);
1062
1069
  event.data = void 0;
1063
1070
  const runEvent = {
@@ -1083,7 +1090,7 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1083
1090
  type: "agent:file_changed",
1084
1091
  runId,
1085
1092
  agentId,
1086
- path: typeof event.data === "string" ? event.data : String(event.data)
1093
+ path: filePath
1087
1094
  });
1088
1095
  } else if (event.type === "error") {
1089
1096
  if (event.errorKind) lastErrorKind = event.errorKind;
@@ -1221,7 +1228,7 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1221
1228
  await this.deps.agentStore.save(agentAfter);
1222
1229
  }
1223
1230
  if (newStatus === "review" && task.review_criteria?.length) {
1224
- await this.runAutoReview(taskId, task.review_criteria, task.workspace ?? this.deps.projectRoot);
1231
+ await this.runAutoReview(taskId, task.review_criteria, task.workspace ?? this.deps.projectRoot, autoApprove);
1225
1232
  } else if (newStatus === "review" && autoApprove) {
1226
1233
  await this.deps.taskService.updateStatus(taskId, "done");
1227
1234
  }
@@ -1296,7 +1303,7 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1296
1303
  * If all criteria pass, transition review → done.
1297
1304
  * If any fail, stay in review with results attached.
1298
1305
  */
1299
- async runAutoReview(taskId, criteria, cwd) {
1306
+ async runAutoReview(taskId, criteria, cwd, autoApprove = false) {
1300
1307
  const runner = new ReviewRunner({ cwd });
1301
1308
  const results = await runner.runAll(criteria);
1302
1309
  const allPassed = ReviewRunner.allPassed(results);
@@ -1315,7 +1322,15 @@ Agent role: ${role}` : `Autonomous work cycle. Agent role: ${role}`;
1315
1322
  passed: allPassed,
1316
1323
  results
1317
1324
  });
1318
- if (allPassed) {
1325
+ if (allPassed || autoApprove) {
1326
+ if (!allPassed) {
1327
+ this.deps.eventBus.emit({
1328
+ type: "orchestrator:error",
1329
+ error: `Review criteria failed for task ${taskId} but autoApprove is set \u2014 force-approving`,
1330
+ context: "auto-review-with-auto-approve",
1331
+ fatal: false
1332
+ });
1333
+ }
1319
1334
  try {
1320
1335
  await this.deps.taskService.updateStatus(taskId, "done");
1321
1336
  } catch (validationErr) {
@@ -0,0 +1,5 @@
1
+ export { Orchestrator } from './chunk-O2OQCSBL.js';
2
+ import './chunk-VG4465AG.js';
3
+ import './chunk-NLQAJ7TW.js';
4
+ //# sourceMappingURL=orchestrator-X2CWGFCL.js.map
5
+ //# sourceMappingURL=orchestrator-X2CWGFCL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"orchestrator-IYWBVA7J.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"orchestrator-X2CWGFCL.js"}
@@ -193,7 +193,7 @@ function registerTaskCommand(program, container) {
193
193
  await container.paths.requireInit();
194
194
  const task2 = await container.taskService.get(id);
195
195
  if (task2.status === "in_progress") {
196
- const { buildFullContainer } = await import('./container-LUWGNBSS.js');
196
+ const { buildFullContainer } = await import('./container-RY54L3XC.js');
197
197
  const full = await buildFullContainer(container.context);
198
198
  await full.orchestrator.cancelTask(id);
199
199
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oxgeneral/orch",
3
- "version": "1.0.0",
4
- "description": "Agents Organizations CLI orchestrator for AI agents",
3
+ "version": "1.0.1",
4
+ "description": "Open-source orchestration for zero-human companies, processes and departments — deploy AI engineering, editorial, sales, analytics teams from your terminal",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=20.0.0"
@@ -38,19 +38,22 @@
38
38
  "prepublishOnly": "npm run build"
39
39
  },
40
40
  "keywords": [
41
- "cli",
41
+ "ai-agent-runtime",
42
+ "agent-orchestration",
43
+ "ai-agents",
44
+ "multi-agent",
45
+ "ai-team",
42
46
  "orchestrator",
43
- "ai",
44
- "agents",
45
47
  "claude",
46
48
  "codex",
47
- "terminal",
48
- "llm",
49
- "multi-agent",
50
- "ai-team",
51
- "agent-orchestration",
49
+ "cursor",
50
+ "opencode",
52
51
  "claude-code",
53
52
  "openai",
53
+ "llm",
54
+ "cli",
55
+ "typescript",
56
+ "git-worktree",
54
57
  "workflow",
55
58
  "devops"
56
59
  ],