@codio-ai/opencode-authoring-agent 0.1.3 → 0.1.4
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
CHANGED
|
@@ -46365,8 +46365,8 @@ function getAgentConfigs(agents) {
|
|
|
46365
46365
|
import { existsSync, readFileSync } from "node:fs";
|
|
46366
46366
|
import { join } from "node:path";
|
|
46367
46367
|
import { z } from "zod";
|
|
46368
|
-
var DEFAULT_PRIMARY = "
|
|
46369
|
-
var DEFAULT_CHEAP = "
|
|
46368
|
+
var DEFAULT_PRIMARY = "anthropic/claude-sonnet-4-6";
|
|
46369
|
+
var DEFAULT_CHEAP = "anthropic/claude-haiku-4-5-20251001";
|
|
46370
46370
|
var agentOverrideSchema = z.object({
|
|
46371
46371
|
model: z.string().optional(),
|
|
46372
46372
|
prompt: z.string().optional(),
|
|
@@ -47032,8 +47032,6 @@ ${freezeErrors.join(`
|
|
|
47032
47032
|
}
|
|
47033
47033
|
|
|
47034
47034
|
// src/tools/fetch-course.ts
|
|
47035
|
-
var import_codio_api_js = __toESM(require_lib3(), 1);
|
|
47036
|
-
var import_json_2_csv = __toESM(require_converter(), 1);
|
|
47037
47035
|
import { execFile } from "node:child_process";
|
|
47038
47036
|
import {
|
|
47039
47037
|
existsSync as existsSync3,
|
|
@@ -47107,6 +47105,10 @@ function copyDir(src, dst) {
|
|
|
47107
47105
|
}
|
|
47108
47106
|
async function fetchCourseHandler(raw) {
|
|
47109
47107
|
const input = fetchCourseInputSchema.parse(raw);
|
|
47108
|
+
const [{ default: codio }, { json2csv }] = await Promise.all([
|
|
47109
|
+
Promise.resolve().then(() => __toESM(require_lib3(), 1)),
|
|
47110
|
+
Promise.resolve().then(() => __toESM(require_converter(), 1))
|
|
47111
|
+
]);
|
|
47110
47112
|
const clientId = process.env["CODIO_CLIENT_ID"];
|
|
47111
47113
|
const clientSecret = process.env["CODIO_CLIENT_SECRET"];
|
|
47112
47114
|
if (!clientId || !clientSecret) {
|
|
@@ -47118,9 +47120,9 @@ async function fetchCourseHandler(raw) {
|
|
|
47118
47120
|
const contentDir = join5(outputDir, "course-content");
|
|
47119
47121
|
const manifestPath = join5(outputDir, "course-manifest.json");
|
|
47120
47122
|
const csvPath = join5(outputDir, "course-assignments.csv");
|
|
47121
|
-
|
|
47122
|
-
await
|
|
47123
|
-
const courseInfo = await
|
|
47123
|
+
codio.v1.setDomain(domain);
|
|
47124
|
+
await codio.v1.auth(clientId, clientSecret);
|
|
47125
|
+
const courseInfo = await codio.v1.course.info(input.courseId);
|
|
47124
47126
|
const modules = (courseInfo.modules ?? []).map((mod, mi) => {
|
|
47125
47127
|
const moduleName = mod.name ?? `Module ${mi + 1}`;
|
|
47126
47128
|
const moduleFolder = codioFolderSlug(moduleName);
|
|
@@ -47168,13 +47170,13 @@ async function fetchCourseHandler(raw) {
|
|
|
47168
47170
|
assignmentFolder: a.folder,
|
|
47169
47171
|
assignmentPath: a.path
|
|
47170
47172
|
})));
|
|
47171
|
-
const csv = await
|
|
47173
|
+
const csv = await json2csv(rows, { emptyFieldValue: "", prependHeader: true });
|
|
47172
47174
|
await writeFile(csvPath, csv, "utf8");
|
|
47173
47175
|
const workDir = join5(tmpdir(), `codio-fetch-${Date.now()}`);
|
|
47174
47176
|
const zipPath = join5(workDir, "course-export.zip");
|
|
47175
47177
|
mkdirSync2(workDir, { recursive: true });
|
|
47176
47178
|
try {
|
|
47177
|
-
await
|
|
47179
|
+
await codio.v1.course.downloadSourceExport(input.courseId, zipPath);
|
|
47178
47180
|
const stagingDir = join5(workDir, "staging");
|
|
47179
47181
|
await extractZip(zipPath, stagingDir);
|
|
47180
47182
|
await extractTarZstArchives(stagingDir);
|
|
@@ -47193,7 +47195,6 @@ async function fetchCourseHandler(raw) {
|
|
|
47193
47195
|
}
|
|
47194
47196
|
|
|
47195
47197
|
// src/tools/publish-course.ts
|
|
47196
|
-
var import_codio_api_js2 = __toESM(require_lib3(), 1);
|
|
47197
47198
|
import { createHash } from "node:crypto";
|
|
47198
47199
|
import {
|
|
47199
47200
|
existsSync as existsSync4,
|
|
@@ -47249,6 +47250,7 @@ function computeContentHash(dir) {
|
|
|
47249
47250
|
}
|
|
47250
47251
|
async function publishCourseHandler(raw) {
|
|
47251
47252
|
const input = publishCourseInputSchema.parse(raw);
|
|
47253
|
+
const { default: codio } = await Promise.resolve().then(() => __toESM(require_lib3(), 1));
|
|
47252
47254
|
const clientId = process.env["CODIO_CLIENT_ID"];
|
|
47253
47255
|
const clientSecret = process.env["CODIO_CLIENT_SECRET"];
|
|
47254
47256
|
if (!clientId || !clientSecret) {
|
|
@@ -47258,8 +47260,8 @@ async function publishCourseHandler(raw) {
|
|
|
47258
47260
|
throw new Error(`course-manifest.json not found at ${input.manifestPath}`);
|
|
47259
47261
|
}
|
|
47260
47262
|
const domain = process.env["CODIO_DOMAIN"] ?? "codio.com";
|
|
47261
|
-
|
|
47262
|
-
await
|
|
47263
|
+
codio.v1.setDomain(domain);
|
|
47264
|
+
await codio.v1.auth(clientId, clientSecret);
|
|
47263
47265
|
const manifest = JSON.parse(readFileSync2(input.manifestPath, "utf8"));
|
|
47264
47266
|
const manifestDir = join6(input.manifestPath, "..");
|
|
47265
47267
|
if (!manifest.courseId) {
|
|
@@ -47269,7 +47271,7 @@ async function publishCourseHandler(raw) {
|
|
|
47269
47271
|
} else {
|
|
47270
47272
|
const start = manifest.start ?? new Date().toISOString().replace(/T.*/, "T00:00:00.000Z");
|
|
47271
47273
|
const timezone = manifest.timezone ?? "UTC";
|
|
47272
|
-
manifest.courseId = await
|
|
47274
|
+
manifest.courseId = await codio.v1.course.createCourse({ name: courseName, start, timezone });
|
|
47273
47275
|
if (!manifest.courseName)
|
|
47274
47276
|
manifest.courseName = courseName;
|
|
47275
47277
|
saveManifest(input.manifestPath, manifest);
|
|
@@ -47278,7 +47280,7 @@ async function publishCourseHandler(raw) {
|
|
|
47278
47280
|
const existingModuleIds = new Map;
|
|
47279
47281
|
if (manifest.courseId && !input.dryRun) {
|
|
47280
47282
|
try {
|
|
47281
|
-
const courseInfo = await
|
|
47283
|
+
const courseInfo = await codio.v1.course.info(manifest.courseId);
|
|
47282
47284
|
for (const m of courseInfo.modules ?? []) {
|
|
47283
47285
|
if (m.id && m.name)
|
|
47284
47286
|
existingModuleIds.set(m.name, m.id);
|
|
@@ -47295,7 +47297,7 @@ async function publishCourseHandler(raw) {
|
|
|
47295
47297
|
mod.id = knownId;
|
|
47296
47298
|
saveManifest(input.manifestPath, manifest);
|
|
47297
47299
|
} else if (!input.dryRun && mod.assignments.some((a) => !a.id)) {
|
|
47298
|
-
mod.id = await
|
|
47300
|
+
mod.id = await codio.v1.course.createModule(manifest.courseId, mod.name);
|
|
47299
47301
|
saveManifest(input.manifestPath, manifest);
|
|
47300
47302
|
created++;
|
|
47301
47303
|
}
|
|
@@ -47318,7 +47320,7 @@ async function publishCourseHandler(raw) {
|
|
|
47318
47320
|
skipped++;
|
|
47319
47321
|
continue;
|
|
47320
47322
|
}
|
|
47321
|
-
asgn.id = await
|
|
47323
|
+
asgn.id = await codio.v1.assignment.createAssignment(manifest.courseId, {
|
|
47322
47324
|
moduleId: mod.id,
|
|
47323
47325
|
settings: { name: asgn.name }
|
|
47324
47326
|
});
|
|
@@ -47342,9 +47344,9 @@ async function publishCourseHandler(raw) {
|
|
|
47342
47344
|
const zipPath = findZip(asgnAbsPath);
|
|
47343
47345
|
try {
|
|
47344
47346
|
if (zipPath) {
|
|
47345
|
-
await
|
|
47347
|
+
await codio.v1.assignment.publishArchive(manifest.courseId, asgn.id, zipPath, publishOpts);
|
|
47346
47348
|
} else {
|
|
47347
|
-
await
|
|
47349
|
+
await codio.v1.assignment.publish(manifest.courseId, asgn.id, asgnAbsPath, publishOpts);
|
|
47348
47350
|
}
|
|
47349
47351
|
asgn.contentHash = computeContentHash(asgnAbsPath);
|
|
47350
47352
|
saveManifest(input.manifestPath, manifest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-course.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-course.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch-course.d.ts","sourceRoot":"","sources":["../../src/tools/fetch-course.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,sBAAsB;;;;;iBAQjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAoED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA0GjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-course.d.ts","sourceRoot":"","sources":["../../src/tools/publish-course.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-course.d.ts","sourceRoot":"","sources":["../../src/tools/publish-course.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB;;;;;;;;iBAQnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AA6DD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAuHrF"}
|
package/package.json
CHANGED