@engineeros/connector 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Connect a local Codex CLI workspace to EngineerOS through an outbound WebSocket.
4
4
 
5
+ This package is only a connector. EngineerOS owns every prompt, Goal instruction, and
6
+ execution boundary. The connector validates the assignment envelope, passes the supplied
7
+ Markdown to Codex CLI unchanged, streams lifecycle events, and returns bounded results.
8
+ It contains no product, assessment, planning, architecture, or delivery prompt templates.
9
+
5
10
  ## Onboard a workspace
6
11
 
7
12
  Create a connection command from **Project steering -> Connect workspace**, then run it inside the local folder:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@engineeros/connector",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Connect a local Codex CLI workspace to EngineerOS over an outbound WebSocket.",
5
5
  "private": false,
6
6
  "type": "module",
package/src/runner.mjs CHANGED
@@ -82,14 +82,16 @@ const CODE_MARKERS = new Set([
82
82
  ]);
83
83
 
84
84
  export async function executeAssignment(assignment, config, callbacks) {
85
+ const execution = connectorExecution(assignment);
85
86
  const runWorkspace = await prepareRunWorkspace(
86
87
  config.workspace,
87
88
  assignment.run_id,
88
89
  assignment.base_revision,
89
90
  );
90
- const controller = launchCodex(
91
+ const controller = launchCodexProcess(
91
92
  runWorkspace,
92
- assignment.packet_markdown,
93
+ execution.prompt,
94
+ execution.sandboxMode,
93
95
  callbacks,
94
96
  );
95
97
  callbacks.onProcess?.(controller.child);
@@ -113,27 +115,23 @@ export async function executeAssignment(assignment, config, callbacks) {
113
115
  }
114
116
 
115
117
  export async function executeWorkspaceAssessment(assignment, config, callbacks) {
118
+ const execution = connectorExecution(assignment);
116
119
  const revision = await run(
117
120
  "git",
118
121
  ["rev-parse", "HEAD"],
119
122
  config.workspace,
120
123
  { allowFailure: true },
121
124
  );
122
- const instruction = `${assignment.prompt_markdown}\n\n## EngineerOS execution instruction\n\nAssess the current workspace at the requested inventory revision ${assignment.source_revision}. Remain read-only. Return only the required structured Markdown assessment as your final answer.\n`;
123
125
  const controller = launchCodexProcess(
124
126
  config.workspace,
125
- instruction,
126
- "read-only",
127
+ execution.prompt,
128
+ execution.sandboxMode,
127
129
  callbacks,
128
130
  );
129
131
  callbacks.onProcess?.(controller.child);
130
132
  const completed = await controller.completed;
131
133
  const report = completed.finalMessage.trim();
132
- if (!report.startsWith("# Workspace Assessment")) {
133
- throw new Error(
134
- "Codex completed without returning the required structured Workspace Assessment.",
135
- );
136
- }
134
+ if (!report) throw new Error("Codex completed without returning a response.");
137
135
  return {
138
136
  report_markdown: report,
139
137
  observed_head_revision:
@@ -142,11 +140,11 @@ export async function executeWorkspaceAssessment(assignment, config, callbacks)
142
140
  }
143
141
 
144
142
  export async function executeConnectedPrompt(assignment, config, callbacks) {
145
- const instruction = `${assignment.prompt_markdown}\n\n## EngineerOS connector instruction\n\nAnswer this project prompt from the connected workspace. Remain read-only and return only the requested response as your final answer.\n`;
143
+ const execution = connectorExecution(assignment);
146
144
  const controller = launchCodexProcess(
147
145
  config.workspace,
148
- instruction,
149
- "read-only",
146
+ execution.prompt,
147
+ execution.sandboxMode,
150
148
  callbacks,
151
149
  );
152
150
  callbacks.onProcess?.(controller.child);
@@ -158,6 +156,18 @@ export async function executeConnectedPrompt(assignment, config, callbacks) {
158
156
  return { content, model: "codex-cli" };
159
157
  }
160
158
 
159
+ export function connectorExecution(assignment) {
160
+ const prompt = assignment?.prompt_markdown;
161
+ if (typeof prompt !== "string" || !prompt.trim()) {
162
+ throw new Error("EngineerOS assignment is missing prompt_markdown.");
163
+ }
164
+ const sandboxMode = assignment?.sandbox_mode;
165
+ if (!new Set(["read-only", "workspace-write"]).has(sandboxMode)) {
166
+ throw new Error("EngineerOS assignment has an unsupported sandbox_mode.");
167
+ }
168
+ return { prompt, sandboxMode };
169
+ }
170
+
161
171
  export async function stopProcess(child) {
162
172
  if (!child || child.exitCode !== null) return;
163
173
  if (process.platform === "win32") {
@@ -278,11 +288,6 @@ async function prepareRunWorkspace(workspace, runId, baseRevision) {
278
288
  return target;
279
289
  }
280
290
 
281
- function launchCodex(workspace, packet, callbacks) {
282
- const prompt = `${packet}\n\n## EngineerOS execution instruction\n\nImplement this frozen Goal completely in the current run workspace. Run the required verification. Do not commit, push, or modify files outside this workspace. End with a concise result and verification summary.\n`;
283
- return launchCodexProcess(workspace, prompt, "workspace-write", callbacks);
284
- }
285
-
286
291
  function launchCodexProcess(workspace, prompt, sandbox, callbacks) {
287
292
  const command =
288
293
  process.env.CODEX_BIN ||