dank-ai 1.0.30 → 1.0.31

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.
@@ -1149,14 +1149,21 @@ class DockerManager {
1149
1149
 
1150
1150
  try {
1151
1151
  const buildContext = await this.createAgentBuildContext(agent);
1152
-
1153
- const stream = await this.docker.buildImage(buildContext, {
1154
- t: imageName,
1155
- dockerfile: "Dockerfile",
1156
- nocache: options.rebuild || options.noCache || false,
1157
- });
1158
-
1159
- await this.followBuildProgress(stream, `Agent ${agent.name} build`);
1152
+ const dockerCmd = await this.resolveDockerCommand();
1153
+
1154
+ const buildCommand = [
1155
+ dockerCmd,
1156
+ 'buildx',
1157
+ 'build',
1158
+ '--platform', 'linux/amd64',
1159
+ '--tag', imageName,
1160
+ '--file', path.join(buildContext, 'Dockerfile'),
1161
+ '--load',
1162
+ ...(options.rebuild || options.noCache ? ['--no-cache'] : []),
1163
+ buildContext
1164
+ ].join(' ');
1165
+
1166
+ await this.runCommand(buildCommand, `Agent ${agent.name} build`);
1160
1167
 
1161
1168
  this.logger.info(`Agent image '${imageName}' built successfully`);
1162
1169
 
@@ -1195,9 +1202,11 @@ class DockerManager {
1195
1202
  //construct full repo name
1196
1203
  let repoName;
1197
1204
  if(!tagByAgent){
1198
-
1199
- repoName = `${registry?`${registry}/`:''}${namespace?`${namespace}/`:''}${repoName}`;
1205
+ // Per-agent repository: {registry}/{namespace}/{agent-name}
1206
+ const agentRepoName = agent.name.toLowerCase().replace(/[^a-z0-9_.-]/g, '-');
1207
+ repoName = `${registry?`${registry}/`:''}${namespace?`${namespace}/`:''}${agentRepoName}`;
1200
1208
  }else{
1209
+ // Common repository: {registry}/{namespace}:agent-name
1201
1210
  repoName = `${registry?`${registry}/`:''}${namespace?`${namespace}/`:''}`;
1202
1211
  }
1203
1212
 
@@ -1214,54 +1223,33 @@ class DockerManager {
1214
1223
 
1215
1224
  try {
1216
1225
  const buildContext = await this.createAgentBuildContext(agent);
1217
-
1218
- const stream = await this.docker.buildImage(buildContext, {
1219
- t: imageName,
1220
- dockerfile: "Dockerfile",
1221
- nocache: force,
1222
- });
1223
-
1224
- await this.followBuildProgress(
1225
- stream,
1226
- `Production build for ${agent.name}`
1227
- );
1226
+ const dockerCmd = await this.resolveDockerCommand();
1227
+
1228
+ const buildCommand = [
1229
+ dockerCmd,
1230
+ 'buildx',
1231
+ 'build',
1232
+ '--platform', 'linux/amd64',
1233
+ '--tag', imageName,
1234
+ '--file', path.join(buildContext, 'Dockerfile'),
1235
+ ...(push ? ['--push'] : ['--load']),
1236
+ ...(force ? ['--no-cache'] : []),
1237
+ buildContext
1238
+ ].join(' ');
1239
+
1240
+ await this.runCommand(buildCommand, `Production build for ${agent.name}`);
1228
1241
 
1229
1242
  this.logger.info(`Production image '${imageName}' built successfully`);
1243
+ if (push) {
1244
+ this.logger.info(`Successfully pushed image: ${imageName}`);
1245
+ }
1230
1246
 
1231
1247
  // Clean up build context
1232
1248
  await fs.remove(buildContext);
1233
1249
 
1234
- let pushed = false;
1235
-
1236
- // Push to registry if requested (use docker CLI for reliability)
1237
- if (push) {
1238
- const dockerCmd = await this.resolveDockerCommand();
1239
- const maxAttempts = 3;
1240
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
1241
- try {
1242
- this.logger.info(`Pushing image to registry (attempt ${attempt}/${maxAttempts}): ${imageName}`);
1243
- await this.runCommand(`${dockerCmd} push "${imageName}"`, `Docker push ${imageName}`);
1244
- this.logger.info(`Successfully pushed image: ${imageName}`);
1245
- pushed = true;
1246
- break;
1247
- } catch (pushError) {
1248
- const msg = pushError?.message || '';
1249
- this.logger.warn(`Push attempt ${attempt} failed: ${msg}`);
1250
- if (msg.match(/denied|unauthorized|authentication required/i)) {
1251
- this.logger.warn("Authentication issue detected. Please ensure you're logged in: docker login <registry>");
1252
- break; // don't retry auth failures automatically
1253
- }
1254
- if (attempt < maxAttempts) {
1255
- await this.sleep(2000 * attempt);
1256
- continue;
1257
- }
1258
- }
1259
- }
1260
- }
1261
-
1262
1250
  return {
1263
1251
  imageName,
1264
- pushed,
1252
+ pushed: push,
1265
1253
  };
1266
1254
  } catch (error) {
1267
1255
  throw new Error(`Failed to build production image: ${error.message}`);
@@ -1623,20 +1611,8 @@ module.exports = {
1623
1611
 
1624
1612
  await fs.writeFile(path.join(agentCodeDir, "index.js"), agentCode);
1625
1613
 
1626
- // Create tarball
1627
- const tarPath = path.join(
1628
- __dirname,
1629
- `../../.agent-${agent.name}-context.tar`
1630
- );
1631
- await tar.create(
1632
- {
1633
- file: tarPath,
1634
- cwd: contextDir,
1635
- },
1636
- ["."]
1637
- );
1638
-
1639
- return tarPath;
1614
+ // Return directory path (CLI build commands work with directories directly)
1615
+ return contextDir;
1640
1616
  }
1641
1617
 
1642
1618
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dank-ai",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Dank Agent Service - Docker-based AI agent orchestration platform",
5
5
  "main": "lib/index.js",
6
6
  "exports": {