open-agents-ai 0.185.75 → 0.185.76
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/dist/index.js +117 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65977,6 +65977,98 @@ var init_logger = __esm({
|
|
|
65977
65977
|
}
|
|
65978
65978
|
});
|
|
65979
65979
|
|
|
65980
|
+
// packages/cli/dist/api/openapi.js
|
|
65981
|
+
function getOpenApiSpec() {
|
|
65982
|
+
return {
|
|
65983
|
+
openapi: "3.0.3",
|
|
65984
|
+
info: {
|
|
65985
|
+
title: "Open Agents REST API",
|
|
65986
|
+
description: "AI coding agent powered by open-weight models. Enterprise REST API for agentic task execution, OpenAI-compatible inference, and system management.",
|
|
65987
|
+
version: "0.185.75",
|
|
65988
|
+
license: { name: "CC-BY-NC-4.0", url: "https://creativecommons.org/licenses/by-nc/4.0/" }
|
|
65989
|
+
},
|
|
65990
|
+
servers: [{ url: "http://localhost:11435", description: "Local development" }],
|
|
65991
|
+
security: [{ BearerAuth: [] }],
|
|
65992
|
+
components: {
|
|
65993
|
+
securitySchemes: {
|
|
65994
|
+
BearerAuth: { type: "http", scheme: "bearer", description: "API key with scope (read/run/admin)" }
|
|
65995
|
+
}
|
|
65996
|
+
},
|
|
65997
|
+
paths: {
|
|
65998
|
+
"/health": { get: { summary: "Liveness probe", tags: ["Health"], security: [], responses: { 200: { description: "Server is alive" } } } },
|
|
65999
|
+
"/health/ready": { get: { summary: "Readiness probe (checks backend)", tags: ["Health"], security: [], responses: { 200: { description: "Backend reachable" }, 503: { description: "Backend unreachable" } } } },
|
|
66000
|
+
"/health/startup": { get: { summary: "Startup complete", tags: ["Health"], security: [], responses: { 200: { description: "Started" } } } },
|
|
66001
|
+
"/version": { get: { summary: "Version info", tags: ["Health"], security: [], responses: { 200: { description: "Version, node, platform" } } } },
|
|
66002
|
+
"/metrics": { get: { summary: "Prometheus metrics", tags: ["Health"], security: [], responses: { 200: { description: "Prometheus text format" } } } },
|
|
66003
|
+
"/v1/models": { get: { summary: "List available models", tags: ["Inference"], security: [{ BearerAuth: [] }], responses: { 200: { description: "OpenAI-format model list" } } } },
|
|
66004
|
+
"/v1/chat/completions": { post: { summary: "Chat completion (OpenAI-compatible)", tags: ["Inference"], security: [{ BearerAuth: [] }], requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["model", "messages"], properties: { model: { type: "string" }, messages: { type: "array" }, stream: { type: "boolean" }, max_tokens: { type: "integer" }, temperature: { type: "number" } } } } } }, responses: { 200: { description: "Chat response" } } } },
|
|
66005
|
+
"/v1/embeddings": { post: { summary: "Generate embeddings", tags: ["Inference"], responses: { 200: { description: "Embedding vectors" } } } },
|
|
66006
|
+
"/v1/run": { post: { summary: "Submit agentic task", tags: ["Agentic"], requestBody: { required: true, content: { "application/json": { schema: { type: "object", required: ["task"], properties: { task: { type: "string" }, model: { type: "string" }, stream: { type: "boolean" }, profile: { type: "string" }, working_directory: { type: "string" }, isolate: { type: "boolean" } } } } } }, responses: { 202: { description: "Task accepted" } } } },
|
|
66007
|
+
"/v1/runs": { get: { summary: "List all runs", tags: ["Agentic"], parameters: [{ name: "limit", in: "query", schema: { type: "integer" } }, { name: "offset", in: "query", schema: { type: "integer" } }, { name: "status", in: "query", schema: { type: "string" } }], responses: { 200: { description: "Run list with pagination" } } } },
|
|
66008
|
+
"/v1/runs/{id}": { get: { summary: "Get run status", tags: ["Agentic"], parameters: [{ name: "id", in: "path", required: true, schema: { type: "string" } }], responses: { 200: { description: "Run details" }, 404: { description: "Not found" } } }, delete: { summary: "Abort run", tags: ["Agentic"], responses: { 200: { description: "Aborted" } } } },
|
|
66009
|
+
"/v1/config": { get: { summary: "Get configuration", tags: ["Config"], responses: { 200: { description: "Current config" } } }, patch: { summary: "Update configuration", tags: ["Config"], responses: { 200: { description: "Updated" } } } },
|
|
66010
|
+
"/v1/config/model": { get: { summary: "Current model", tags: ["Config"], responses: { 200: { description: "Model name" } } }, put: { summary: "Switch model", tags: ["Config"], responses: { 200: { description: "Switched" } } } },
|
|
66011
|
+
"/v1/config/endpoint": { get: { summary: "Current endpoint", tags: ["Config"], responses: { 200: { description: "Endpoint URL" } } }, put: { summary: "Switch endpoint", tags: ["Config"], responses: { 200: { description: "Switched" } } } },
|
|
66012
|
+
"/v1/usage": { get: { summary: "Token usage and rate limits", tags: ["Metering"], responses: { 200: { description: "Usage stats" } } } },
|
|
66013
|
+
"/v1/audit": { get: { summary: "Query audit log", tags: ["Audit"], parameters: [{ name: "since", in: "query", schema: { type: "string" } }, { name: "user", in: "query", schema: { type: "string" } }, { name: "limit", in: "query", schema: { type: "integer" } }], responses: { 200: { description: "Audit records" } } } },
|
|
66014
|
+
"/v1/commands": { get: { summary: "List slash commands", tags: ["Commands"], responses: { 200: { description: "Command list" } } } },
|
|
66015
|
+
"/v1/commands/{cmd}": { post: { summary: "Execute slash command", tags: ["Commands"], responses: { 200: { description: "Command output" } } } },
|
|
66016
|
+
"/v1/profiles": { get: { summary: "List tool profiles", tags: ["Profiles"], responses: { 200: { description: "Profile list" } } }, post: { summary: "Create profile", tags: ["Profiles"], responses: { 201: { description: "Created" } } } },
|
|
66017
|
+
"/v1/profiles/{name}": { get: { summary: "Get profile", tags: ["Profiles"], responses: { 200: { description: "Profile details" } } }, delete: { summary: "Delete profile", tags: ["Profiles"], responses: { 200: { description: "Deleted" } } } }
|
|
66018
|
+
}
|
|
66019
|
+
};
|
|
66020
|
+
}
|
|
66021
|
+
function getSwaggerUI() {
|
|
66022
|
+
return `<!DOCTYPE html><html><head><title>OA API Docs</title>
|
|
66023
|
+
<style>body{font-family:'SF Mono',monospace;background:#1a1a1e;color:#b0b0b0;margin:0;padding:20px}
|
|
66024
|
+
h1{color:#b2920a;font-size:1.2rem}h2{color:#b2920a;font-size:0.9rem;margin-top:20px}
|
|
66025
|
+
.endpoint{background:#1e1e22;border:1px solid #2a2a30;border-radius:3px;padding:10px;margin:8px 0}
|
|
66026
|
+
.method{font-weight:bold;padding:2px 8px;border-radius:2px;font-size:0.75rem}
|
|
66027
|
+
.get{color:#4ec94e}.post{color:#b2920a}.put{color:#4e94c9}.patch{color:#c9944e}.delete{color:#c94e4e}
|
|
66028
|
+
.path{color:#b0b0b0;margin-left:8px}.summary{color:#888;font-size:0.75rem;margin-left:12px}
|
|
66029
|
+
.tag{margin-top:16px;border-bottom:1px solid #2a2a30;padding-bottom:4px}
|
|
66030
|
+
a{color:#b2920a}
|
|
66031
|
+
</style></head><body>
|
|
66032
|
+
<h1>Open Agents API</h1>
|
|
66033
|
+
<p>Interactive docs. For full spec: <a href="/openapi.json">/openapi.json</a></p>
|
|
66034
|
+
<div id="docs"></div>
|
|
66035
|
+
<script>
|
|
66036
|
+
fetch('/openapi.json').then(r=>r.json()).then(spec=>{
|
|
66037
|
+
const docs=document.getElementById('docs');
|
|
66038
|
+
const tags={};
|
|
66039
|
+
for(const[path,methods]of Object.entries(spec.paths)){
|
|
66040
|
+
for(const[method,op]of Object.entries(methods)){
|
|
66041
|
+
const tag=(op.tags||['Other'])[0];
|
|
66042
|
+
if(!tags[tag])tags[tag]=[];
|
|
66043
|
+
tags[tag].push({method,path,summary:op.summary||''});
|
|
66044
|
+
}
|
|
66045
|
+
}
|
|
66046
|
+
for(const[tag,endpoints]of Object.entries(tags)){
|
|
66047
|
+
docs.innerHTML+='<div class="tag"><h2>'+tag+'</h2></div>';
|
|
66048
|
+
for(const ep of endpoints){
|
|
66049
|
+
docs.innerHTML+='<div class="endpoint"><span class="method '+ep.method+'">'+ep.method.toUpperCase()+'</span><span class="path">'+ep.path+'</span><span class="summary">'+ep.summary+'</span></div>';
|
|
66050
|
+
}
|
|
66051
|
+
}
|
|
66052
|
+
});
|
|
66053
|
+
</script></body></html>`;
|
|
66054
|
+
}
|
|
66055
|
+
var init_openapi = __esm({
|
|
66056
|
+
"packages/cli/dist/api/openapi.js"() {
|
|
66057
|
+
"use strict";
|
|
66058
|
+
}
|
|
66059
|
+
});
|
|
66060
|
+
|
|
66061
|
+
// packages/cli/dist/api/auth-oidc.js
|
|
66062
|
+
var OIDC_ISSUER, OIDC_AUDIENCE, OIDC_SCOPE_CLAIM;
|
|
66063
|
+
var init_auth_oidc = __esm({
|
|
66064
|
+
"packages/cli/dist/api/auth-oidc.js"() {
|
|
66065
|
+
"use strict";
|
|
66066
|
+
OIDC_ISSUER = process.env["OA_OIDC_ISSUER"] || "";
|
|
66067
|
+
OIDC_AUDIENCE = process.env["OA_OIDC_AUDIENCE"] || "";
|
|
66068
|
+
OIDC_SCOPE_CLAIM = process.env["OA_OIDC_SCOPE_CLAIM"] || "scope";
|
|
66069
|
+
}
|
|
66070
|
+
});
|
|
66071
|
+
|
|
65980
66072
|
// packages/cli/dist/api/profiles.js
|
|
65981
66073
|
import { existsSync as existsSync53, readFileSync as readFileSync42, writeFileSync as writeFileSync25, mkdirSync as mkdirSync27, readdirSync as readdirSync20, unlinkSync as unlinkSync12 } from "node:fs";
|
|
65982
66074
|
import { join as join70 } from "node:path";
|
|
@@ -66912,6 +67004,20 @@ async function handleV1Run(req, res) {
|
|
|
66912
67004
|
jsonResponse(res, 400, { error: "Missing required field: task" });
|
|
66913
67005
|
return;
|
|
66914
67006
|
}
|
|
67007
|
+
if (task.length > 5e4) {
|
|
67008
|
+
jsonResponse(res, 400, { error: "Task too long", message: "Max 50,000 characters", length: task.length });
|
|
67009
|
+
return;
|
|
67010
|
+
}
|
|
67011
|
+
const sandbox = requestBody["sandbox"] || process.env["OA_DEFAULT_SANDBOX"] || "none";
|
|
67012
|
+
if (sandbox === "container") {
|
|
67013
|
+
try {
|
|
67014
|
+
const { execSync: es } = __require("node:child_process");
|
|
67015
|
+
es("docker --version", { stdio: "pipe", timeout: 5e3 });
|
|
67016
|
+
} catch {
|
|
67017
|
+
jsonResponse(res, 400, { error: "Container sandbox unavailable", message: "Docker not found. Install Docker or use sandbox:'none'." });
|
|
67018
|
+
return;
|
|
67019
|
+
}
|
|
67020
|
+
}
|
|
66915
67021
|
const id = `job-${randomBytes16(3).toString("hex")}`;
|
|
66916
67022
|
const dir = jobsDir();
|
|
66917
67023
|
const workingDir = requestBody["working_directory"] || req.headers["x-working-directory"];
|
|
@@ -67278,6 +67384,15 @@ async function handleRequest(req, res, ollamaUrl, verbose) {
|
|
|
67278
67384
|
handleMetrics(res);
|
|
67279
67385
|
return;
|
|
67280
67386
|
}
|
|
67387
|
+
if (pathname === "/openapi.json" && method === "GET") {
|
|
67388
|
+
jsonResponse(res, 200, getOpenApiSpec());
|
|
67389
|
+
return;
|
|
67390
|
+
}
|
|
67391
|
+
if (pathname === "/docs" && method === "GET") {
|
|
67392
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
67393
|
+
res.end(getSwaggerUI());
|
|
67394
|
+
return;
|
|
67395
|
+
}
|
|
67281
67396
|
if (pathname === "/" && method === "GET" && req.headers.accept?.includes("text/html")) {
|
|
67282
67397
|
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
67283
67398
|
res.end(getWebUI());
|
|
@@ -67707,6 +67822,8 @@ var init_serve = __esm({
|
|
|
67707
67822
|
init_audit_log();
|
|
67708
67823
|
init_web_ui();
|
|
67709
67824
|
init_logger();
|
|
67825
|
+
init_openapi();
|
|
67826
|
+
init_auth_oidc();
|
|
67710
67827
|
init_oa_directory();
|
|
67711
67828
|
init_render();
|
|
67712
67829
|
init_profiles();
|
package/package.json
CHANGED