codiedev 0.10.0-beta.10 → 0.10.0-beta.11

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.
@@ -154,7 +154,7 @@ result to \`/agent/.codiedev/output.json\`.
154
154
  Preinstalled: Python 3.12 with openai, mcp, httpx, pydantic; Node 22 with
155
155
  openai, @modelcontextprotocol/sdk, tsx; git, curl.
156
156
  - **Exit code:** 0 = succeeded. An exception or non-zero exit = failed, with
157
- the last log line as the error. Everything printed goes to the run's log.
157
+ the exception (or the last log line) as the error. Everything printed goes to the run's log.
158
158
 
159
159
  ## The sandbox
160
160
 
@@ -168,12 +168,16 @@ variables:
168
168
  | \`CODIEDEV_GATEWAY_URL\`, \`CODIEDEV_API_KEY\` | The same two, under Codiedev names |
169
169
  | \`CODIEDEV_AGENT\`, \`CODIEDEV_RUN_ID\` | This agent's name and this run's id |
170
170
  | \`CODIEDEV_ATTEMPT\`, \`CODIEDEV_MAX_ATTEMPTS\` | Which try this is, out of how many |
171
+ | \`CODIEDEV_MODEL\` | The agent's default model: the first one its key allows (unset when it allows every model) |
171
172
  | your secrets | Each by its own name, e.g. \`GITHUB_TOKEN\` |
172
173
 
173
174
  **Models:** use a model id from your company's **Models** page, like
174
175
  \`openai/gpt-5.1-codex-mini\`. A model your company hasn't approved fails with
175
176
  \`model_not_allowed\`. Calls are traced under the agent's name and count
176
177
  toward its \`budgetUsd\` (a monthly budget for the agent, not per run).
178
+ A call counts toward a run's cost when it sends the header
179
+ \`X-Codiedev-Run-Id: $CODIEDEV_RUN_ID\`. \`agents.openai()\` does; for any other
180
+ client or tool, add the header yourself (see opencode below).
177
181
 
178
182
  **Dependencies** from \`package.json\` install into \`/agent/node_modules\`, so
179
183
  their binaries are in \`/agent/node_modules/.bin\`. Python packages are importable
@@ -193,7 +197,9 @@ config = {
193
197
  "autoupdate": False, "share": "disabled", "permission": "allow",
194
198
  "provider": {"codiedev": {
195
199
  "npm": "@ai-sdk/openai-compatible",
196
- "options": {"baseURL": os.environ["OPENAI_BASE_URL"], "apiKey": "{env:OPENAI_API_KEY}"},
200
+ "options": {"baseURL": os.environ["OPENAI_BASE_URL"], "apiKey": "{env:OPENAI_API_KEY}",
201
+ # Counts its model calls toward this run's cost.
202
+ "headers": {"X-Codiedev-Run-Id": os.environ["CODIEDEV_RUN_ID"]}},
197
203
  "models": {MODEL: {}},
198
204
  }},
199
205
  }
@@ -455,13 +461,21 @@ function writeGuides(dir) {
455
461
  if (!fs.existsSync(path.join(dir, "CLAUDE.md")))
456
462
  fs.writeFileSync(path.join(dir, "CLAUDE.md"), "@AGENTS.md\n");
457
463
  }
464
+ function fillTemplate(text, file, name, model) {
465
+ let out = text.replace(/%NAME%/g, name);
466
+ if (!model) {
467
+ const fallback = file.endsWith(".py") ? 'os.environ.get("CODIEDEV_MODEL", "codiedev/fast")' : '(process.env.CODIEDEV_MODEL ?? "codiedev/fast")';
468
+ out = out.replace(/"%MODEL%"/g, fallback);
469
+ }
470
+ return out.replace(/%MODEL%/g, model ?? "codiedev/fast");
471
+ }
458
472
  async function initFromTemplate(name, dir, id, args) {
459
- const model = flag(args, "--model") ?? "codiedev/fast";
473
+ const model = flag(args, "--model");
460
474
  const starter = agentTemplates_generated_1.TEMPLATES.find((t) => t.id === id);
461
475
  if (starter) {
462
476
  for (const [rel, text] of Object.entries(starter.files)) {
463
477
  fs.mkdirSync(path.dirname(path.join(dir, rel)), { recursive: true });
464
- fs.writeFileSync(path.join(dir, rel), text.replace(/%NAME%/g, name).replace(/%MODEL%/g, model));
478
+ fs.writeFileSync(path.join(dir, rel), fillTemplate(text, rel, name, model));
465
479
  }
466
480
  writeGuides(dir);
467
481
  console.log(`Created ${path.relative(process.cwd(), dir) || "."}/ from the ${starter.title} template.`);
@@ -502,16 +516,15 @@ async function cmdInit(args) {
502
516
  if (existing)
503
517
  fail(`${dir} already has an ${existing}`);
504
518
  fs.mkdirSync(dir, { recursive: true });
505
- const model = flag(args, "--model") ?? "codiedev/fast";
506
- const fill = (t) => t.replace(/%NAME%/g, name).replace(/%MODEL%/g, model);
519
+ const model = flag(args, "--model");
507
520
  let entrypoint = "agent.py";
508
521
  if (lang.startsWith("py")) {
509
- fs.writeFileSync(path.join(dir, "agent.py"), fill(STARTER_AGENT));
522
+ fs.writeFileSync(path.join(dir, "agent.py"), fillTemplate(STARTER_AGENT, "agent.py", name, model));
510
523
  fs.writeFileSync(path.join(dir, "requirements.txt"), "# Extra packages for this agent, one per line. openai, mcp, httpx and pydantic are preinstalled.\n");
511
524
  }
512
525
  else {
513
526
  entrypoint = lang.startsWith("t") ? "agent.ts" : "agent.mjs";
514
- fs.writeFileSync(path.join(dir, entrypoint), fill(STARTER_TS));
527
+ fs.writeFileSync(path.join(dir, entrypoint), fillTemplate(STARTER_TS, entrypoint, name, model));
515
528
  fs.writeFileSync(path.join(dir, "package.json"), JSON.stringify({ name, private: true, type: "module", dependencies: {} }, null, 2) + "\n");
516
529
  }
517
530
  fs.writeFileSync(path.join(dir, "agent.json"), JSON.stringify({ name, entrypoint, timeoutSec: 600 }, null, 2) + "\n");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "codiedev",
3
- "version": "0.10.0-beta.10",
4
- "description": "Connect Claude Code, Codex, Cursor, OpenCode, or VS Code Copilot to Codiedev for team session capture and artifact collaboration \u2014 and run the governed Codie harness",
3
+ "version": "0.10.0-beta.11",
4
+ "description": "Connect Claude Code, Codex, Cursor, OpenCode, or VS Code Copilot to Codiedev for team session capture and artifact collaboration — and run the governed Codie harness",
5
5
  "bin": {
6
6
  "codiedev": "dist/cli.js",
7
7
  "codiedev-hook": "dist/hook.js",