@rallycry/conveyor-agent 10.13.62 → 10.13.63

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.
@@ -2819,6 +2819,40 @@ var QueryProjectGrafanaLogsRequestSchema = z5.object({
2819
2819
  endTime: z5.string().optional(),
2820
2820
  limit: z5.number().int().min(1).max(200).optional().default(50)
2821
2821
  });
2822
+ var driveFileNameSchema = z5.string().min(1).max(255).regex(/^[^/\\\r\n]+$/, "File names cannot contain slashes or line breaks");
2823
+ var DRIVE_MAX_CONTENT_CHARS = 1e6;
2824
+ var ListProjectDriveFilesRequestSchema = z5.object({
2825
+ projectId: z5.string(),
2826
+ folderId: z5.string().max(200).optional(),
2827
+ search: z5.string().max(200).optional(),
2828
+ limit: z5.number().int().min(1).max(200).optional()
2829
+ });
2830
+ var ReadProjectDriveFileRequestSchema = z5.object({
2831
+ projectId: z5.string(),
2832
+ fileId: z5.string().min(1).max(200)
2833
+ });
2834
+ var CreateProjectDriveFileRequestSchema = z5.object({
2835
+ projectId: z5.string(),
2836
+ name: driveFileNameSchema,
2837
+ content: z5.string().max(DRIVE_MAX_CONTENT_CHARS),
2838
+ mimeType: z5.string().max(200).optional(),
2839
+ folderId: z5.string().max(200).optional()
2840
+ });
2841
+ var UpdateProjectDriveFileRequestSchema = z5.object({
2842
+ projectId: z5.string(),
2843
+ fileId: z5.string().min(1).max(200),
2844
+ content: z5.string().max(DRIVE_MAX_CONTENT_CHARS),
2845
+ mimeType: z5.string().max(200).optional()
2846
+ });
2847
+ var DeleteProjectDriveFileRequestSchema = z5.object({
2848
+ projectId: z5.string(),
2849
+ fileId: z5.string().min(1).max(200)
2850
+ });
2851
+ var CreateProjectDriveFolderRequestSchema = z5.object({
2852
+ projectId: z5.string(),
2853
+ name: driveFileNameSchema,
2854
+ folderId: z5.string().max(200).optional()
2855
+ });
2822
2856
  var StartProjectBuildRequestSchema = z5.object({
2823
2857
  projectId: z5.string(),
2824
2858
  taskId: z5.string(),
@@ -9974,14 +10008,14 @@ var f = {
9974
10008
  return { kind: "nullable", inner };
9975
10009
  }
9976
10010
  };
9977
- function compileString(z18, spec) {
9978
- let schema = z18.string();
10011
+ function compileString(z19, spec) {
10012
+ let schema = z19.string();
9979
10013
  if (spec.min !== void 0) schema = schema.min(spec.min);
9980
10014
  if (spec.max !== void 0) schema = schema.max(spec.max);
9981
10015
  return schema;
9982
10016
  }
9983
- function compileNumber(z18, spec) {
9984
- let schema = z18.number();
10017
+ function compileNumber(z19, spec) {
10018
+ let schema = z19.number();
9985
10019
  if (spec.int) schema = schema.int();
9986
10020
  if (spec.positive) schema = schema.positive();
9987
10021
  if (spec.nonnegative) schema = schema.nonnegative();
@@ -9989,41 +10023,41 @@ function compileNumber(z18, spec) {
9989
10023
  if (spec.max !== void 0) schema = schema.max(spec.max);
9990
10024
  return schema;
9991
10025
  }
9992
- function compileArray(z18, spec) {
9993
- let schema = z18.array(compileField(z18, spec.item));
10026
+ function compileArray(z19, spec) {
10027
+ let schema = z19.array(compileField(z19, spec.item));
9994
10028
  if (spec.min !== void 0) schema = schema.min(spec.min);
9995
10029
  return schema;
9996
10030
  }
9997
- function compileBase(z18, spec) {
10031
+ function compileBase(z19, spec) {
9998
10032
  switch (spec.kind) {
9999
10033
  case "string":
10000
- return compileString(z18, spec);
10034
+ return compileString(z19, spec);
10001
10035
  case "number":
10002
- return compileNumber(z18, spec);
10036
+ return compileNumber(z19, spec);
10003
10037
  case "boolean":
10004
- return z18.boolean();
10038
+ return z19.boolean();
10005
10039
  case "enum":
10006
- return z18.enum([...spec.values]);
10040
+ return z19.enum([...spec.values]);
10007
10041
  case "array":
10008
- return compileArray(z18, spec);
10042
+ return compileArray(z19, spec);
10009
10043
  case "object":
10010
- return z18.object(compileShape(z18, spec.fields));
10044
+ return z19.object(compileShape(z19, spec.fields));
10011
10045
  }
10012
10046
  }
10013
- function compileField(z18, spec) {
10047
+ function compileField(z19, spec) {
10014
10048
  if (spec.kind === "optional") {
10015
- return compileField(z18, spec.inner).optional();
10049
+ return compileField(z19, spec.inner).optional();
10016
10050
  }
10017
10051
  if (spec.kind === "nullable") {
10018
- return compileField(z18, spec.inner).nullable();
10052
+ return compileField(z19, spec.inner).nullable();
10019
10053
  }
10020
- const schema = compileBase(z18, spec);
10054
+ const schema = compileBase(z19, spec);
10021
10055
  return spec.desc === void 0 ? schema : schema.describe(spec.desc);
10022
10056
  }
10023
- function compileShape(z18, fields) {
10057
+ function compileShape(z19, fields) {
10024
10058
  const shape = {};
10025
10059
  for (const [key, spec] of Object.entries(fields)) {
10026
- shape[key] = compileField(z18, spec);
10060
+ shape[key] = compileField(z19, spec);
10027
10061
  }
10028
10062
  return shape;
10029
10063
  }
@@ -12367,10 +12401,165 @@ function buildProjectTools(connection, projectId, workspaceDir) {
12367
12401
  ];
12368
12402
  }
12369
12403
 
12404
+ // src/tools/drive-tools.ts
12405
+ import { z as z17 } from "zod";
12406
+ var MAX_CONTENT_CHARS = 1e6;
12407
+ var MAX_READ_CHARS = 1e5;
12408
+ function errText2(prefix, error) {
12409
+ return textResult(`${prefix}: ${error instanceof Error ? error.message : "Unknown error"}`);
12410
+ }
12411
+ function buildDriveListFilesTool(connection, projectId) {
12412
+ return defineTool(
12413
+ "drive_list_files",
12414
+ "List files and folders in the project's connected Google Drive folder. Omit folderId to list the project's root folder. Returns id, name, mimeType, size, and modified time for each entry.",
12415
+ {
12416
+ folderId: z17.string().optional().describe("Folder to list. Defaults to the project's connected root folder."),
12417
+ search: z17.string().max(200).optional().describe("Only return names containing this text"),
12418
+ limit: z17.number().int().min(1).max(200).optional().describe("Max entries (default 100)")
12419
+ },
12420
+ async ({ folderId, search, limit }) => {
12421
+ try {
12422
+ const result = await connection.call("listProjectDriveFiles", {
12423
+ projectId,
12424
+ folderId,
12425
+ search,
12426
+ limit
12427
+ });
12428
+ return textResult(JSON.stringify(result, null, 2));
12429
+ } catch (error) {
12430
+ return errText2("Failed to list Google Drive files", error);
12431
+ }
12432
+ },
12433
+ { annotations: { readOnlyHint: true } }
12434
+ );
12435
+ }
12436
+ function buildDriveReadFileTool(connection, projectId) {
12437
+ return defineTool(
12438
+ "drive_read_file",
12439
+ "Read a file's text content from the project's connected Google Drive folder. Google Docs, Sheets, and Slides are exported to text automatically. Content over 100 KB is truncated.",
12440
+ { fileId: z17.string().describe("Drive file id, as returned by drive_list_files") },
12441
+ async ({ fileId }) => {
12442
+ try {
12443
+ const result = await connection.call("readProjectDriveFile", { projectId, fileId });
12444
+ const overReadCap = result.content.length > MAX_READ_CHARS;
12445
+ const content = overReadCap ? result.content.slice(0, MAX_READ_CHARS) : result.content;
12446
+ const notes = [
12447
+ result.exported ? "(exported from a Google-native document)" : null,
12448
+ result.truncated || overReadCap ? "(truncated at the 100 KB read limit)" : null
12449
+ ].filter(Boolean);
12450
+ const header = `${result.file.name} ${notes.join(" ")}`.trim();
12451
+ return textResult(`${header}
12452
+
12453
+ ${content}`);
12454
+ } catch (error) {
12455
+ return errText2("Failed to read the Google Drive file", error);
12456
+ }
12457
+ },
12458
+ { annotations: { readOnlyHint: true } }
12459
+ );
12460
+ }
12461
+ function buildDriveCreateFileTool(connection, projectId) {
12462
+ return defineTool(
12463
+ "drive_create_file",
12464
+ "Create a new file in the project's connected Google Drive folder. Use drive_update_file to change an existing file instead.",
12465
+ {
12466
+ name: z17.string().min(1).max(255).describe("File name, without any path separators"),
12467
+ content: z17.string().max(MAX_CONTENT_CHARS).describe("File content, UTF-8 text"),
12468
+ mimeType: z17.string().optional().describe("MIME type (default text/plain)"),
12469
+ folderId: z17.string().optional().describe("Destination folder. Defaults to the project's connected root folder.")
12470
+ },
12471
+ async ({ name, content, mimeType, folderId }) => {
12472
+ try {
12473
+ const file = await connection.call("createProjectDriveFile", {
12474
+ projectId,
12475
+ name,
12476
+ content,
12477
+ mimeType,
12478
+ folderId
12479
+ });
12480
+ return textResult(`Created "${file.name}" (${file.id})`);
12481
+ } catch (error) {
12482
+ return errText2("Failed to create the Google Drive file", error);
12483
+ }
12484
+ }
12485
+ );
12486
+ }
12487
+ function buildDriveUpdateFileTool(connection, projectId) {
12488
+ return defineTool(
12489
+ "drive_update_file",
12490
+ "Replace the content of an existing file in the project's connected Google Drive folder. This overwrites the whole file. Google-native documents cannot be overwritten.",
12491
+ {
12492
+ fileId: z17.string().describe("Drive file id, as returned by drive_list_files"),
12493
+ content: z17.string().max(MAX_CONTENT_CHARS).describe("Replacement content, UTF-8 text"),
12494
+ mimeType: z17.string().optional().describe("MIME type (defaults to the file's current type)")
12495
+ },
12496
+ async ({ fileId, content, mimeType }) => {
12497
+ try {
12498
+ const file = await connection.call("updateProjectDriveFile", {
12499
+ projectId,
12500
+ fileId,
12501
+ content,
12502
+ mimeType
12503
+ });
12504
+ return textResult(`Updated "${file.name}" (${file.id})`);
12505
+ } catch (error) {
12506
+ return errText2("Failed to update the Google Drive file", error);
12507
+ }
12508
+ }
12509
+ );
12510
+ }
12511
+ function buildDriveDeleteFileTool(connection, projectId) {
12512
+ return defineTool(
12513
+ "drive_delete_file",
12514
+ "Move a file in the project's connected Google Drive folder to the Drive trash. The file is recoverable from the trash; it is never permanently deleted.",
12515
+ { fileId: z17.string().describe("Drive file id, as returned by drive_list_files") },
12516
+ async ({ fileId }) => {
12517
+ try {
12518
+ const result = await connection.call("deleteProjectDriveFile", { projectId, fileId });
12519
+ return textResult(`Moved "${result.name}" (${result.id}) to the Google Drive trash`);
12520
+ } catch (error) {
12521
+ return errText2("Failed to delete the Google Drive file", error);
12522
+ }
12523
+ }
12524
+ );
12525
+ }
12526
+ function buildDriveCreateFolderTool(connection, projectId) {
12527
+ return defineTool(
12528
+ "drive_create_folder",
12529
+ "Create a folder inside the project's connected Google Drive folder.",
12530
+ {
12531
+ name: z17.string().min(1).max(255).describe("Folder name, without any path separators"),
12532
+ folderId: z17.string().optional().describe("Parent folder. Defaults to the project's connected root folder.")
12533
+ },
12534
+ async ({ name, folderId }) => {
12535
+ try {
12536
+ const folder = await connection.call("createProjectDriveFolder", {
12537
+ projectId,
12538
+ name,
12539
+ folderId
12540
+ });
12541
+ return textResult(`Created folder "${folder.name}" (${folder.id})`);
12542
+ } catch (error) {
12543
+ return errText2("Failed to create the Google Drive folder", error);
12544
+ }
12545
+ }
12546
+ );
12547
+ }
12548
+ function buildDriveTools(connection, projectId) {
12549
+ return [
12550
+ buildDriveListFilesTool(connection, projectId),
12551
+ buildDriveReadFileTool(connection, projectId),
12552
+ buildDriveCreateFileTool(connection, projectId),
12553
+ buildDriveUpdateFileTool(connection, projectId),
12554
+ buildDriveDeleteFileTool(connection, projectId),
12555
+ buildDriveCreateFolderTool(connection, projectId)
12556
+ ];
12557
+ }
12558
+
12370
12559
  // src/tools/code-review-tools.ts
12371
12560
  import { execFile as execFile2 } from "child_process";
12372
12561
  import { promisify as promisify2 } from "util";
12373
- import { z as z17 } from "zod";
12562
+ import { z as z18 } from "zod";
12374
12563
  async function endReviewSession(connection, reason) {
12375
12564
  await connection.call("endReviewSession", {
12376
12565
  sessionId: connection.sessionId,
@@ -12378,26 +12567,26 @@ async function endReviewSession(connection, reason) {
12378
12567
  });
12379
12568
  }
12380
12569
  var RISK_LEVELS2 = ["critical", "high", "medium", "low"];
12381
- var reviewedShaSchema = z17.string().regex(/^[0-9a-f]{40}$/i).describe("REQUIRED. The full 40-character commit SHA this verdict reviews.");
12570
+ var reviewedShaSchema = z18.string().regex(/^[0-9a-f]{40}$/i).describe("REQUIRED. The full 40-character commit SHA this verdict reviews.");
12382
12571
  var riskDescription = "REQUIRED. The risk level this change carries, judged by the surface area it touches: critical = touches critical/foundational surface, high = important surface, medium = moderate, low = small/isolated. Set this on every verdict. You have authority to override a risk level already set on the task if you disagree with it.";
12383
- var ReviewGuideToolSchema = z17.strictObject({
12384
- reviewedSha: z17.string().regex(/^[0-9a-f]{40}$/i).describe(
12572
+ var ReviewGuideToolSchema = z18.strictObject({
12573
+ reviewedSha: z18.string().regex(/^[0-9a-f]{40}$/i).describe(
12385
12574
  "REQUIRED. The PR's current head as a full 40-char SHA. Run `git rev-parse HEAD` immediately before this call \u2014 never extend an abbreviated hash into 40 characters."
12386
12575
  ),
12387
- overview: z17.string().min(1).max(6e4).describe("REQUIRED. Plain-text walkthrough intro, max 3000 characters. Keep it short."),
12388
- sections: z17.array(
12389
- z17.strictObject({
12390
- title: z17.string().min(1).max(160),
12391
- explanation: z17.string().min(1).max(2e3),
12392
- classification: z17.enum(["core", "supporting"]).optional(),
12393
- files: z17.array(
12394
- z17.strictObject({
12395
- path: z17.string().min(1).max(500).describe(
12576
+ overview: z18.string().min(1).max(6e4).describe("REQUIRED. Plain-text walkthrough intro, max 3000 characters. Keep it short."),
12577
+ sections: z18.array(
12578
+ z18.strictObject({
12579
+ title: z18.string().min(1).max(160),
12580
+ explanation: z18.string().min(1).max(2e3),
12581
+ classification: z18.enum(["core", "supporting"]).optional(),
12582
+ files: z18.array(
12583
+ z18.strictObject({
12584
+ path: z18.string().min(1).max(500).describe(
12396
12585
  "A file the PR's diff actually changed. Context files you merely read are rejected."
12397
12586
  ),
12398
- startLine: z17.number().int().positive().max(1e6).optional(),
12399
- endLine: z17.number().int().positive().max(1e6).optional(),
12400
- hunkHeader: z17.string().min(1).max(300).optional().describe(
12587
+ startLine: z18.number().int().positive().max(1e6).optional(),
12588
+ endLine: z18.number().int().positive().max(1e6).optional(),
12589
+ hunkHeader: z18.string().min(1).max(300).optional().describe(
12401
12590
  "Optional anchor, matched byte-exactly against the full hunk header line from `git diff` INCLUDING the context text after the second @@. Copy it verbatim from `git diff <base>..HEAD -- <file> | grep '^@@'`, or omit anchors entirely (path-only entries always validate)."
12402
12591
  )
12403
12592
  })
@@ -12472,8 +12661,8 @@ function buildApproveCodeReviewTool(connection) {
12472
12661
  "Approve the code review and exit. Use when the diff passes all review criteria. Requires a summary and a risk level \u2014 for changes, use request_code_changes with a structured issues[] list.",
12473
12662
  {
12474
12663
  reviewedSha: reviewedShaSchema,
12475
- summary: z17.string().describe("Brief summary of what was reviewed and why it looks good"),
12476
- risk: z17.enum(RISK_LEVELS2).describe(riskDescription)
12664
+ summary: z18.string().describe("Brief summary of what was reviewed and why it looks good"),
12665
+ risk: z18.enum(RISK_LEVELS2).describe(riskDescription)
12477
12666
  },
12478
12667
  async ({ reviewedSha, summary, risk }) => {
12479
12668
  const content = `**Code Review: Approved** :white_check_mark:
@@ -12504,16 +12693,16 @@ function buildRequestCodeChangesTool(connection) {
12504
12693
  "Request changes during code review and exit. Use when substantive issues must be fixed before merge. Each issue: { file, line?, severity: critical|major|minor, description }.",
12505
12694
  {
12506
12695
  reviewedSha: reviewedShaSchema,
12507
- issues: z17.array(
12508
- z17.object({
12509
- file: z17.string().describe("File path where the issue was found"),
12510
- line: z17.number().optional().describe("Line number (if applicable)"),
12511
- severity: z17.enum(["critical", "major", "minor"]).describe("Issue severity"),
12512
- description: z17.string().describe("What is wrong and how to fix it")
12696
+ issues: z18.array(
12697
+ z18.object({
12698
+ file: z18.string().describe("File path where the issue was found"),
12699
+ line: z18.number().optional().describe("Line number (if applicable)"),
12700
+ severity: z18.enum(["critical", "major", "minor"]).describe("Issue severity"),
12701
+ description: z18.string().describe("What is wrong and how to fix it")
12513
12702
  })
12514
12703
  ).describe("List of issues found during review"),
12515
- summary: z17.string().describe("Brief overall summary of the review findings"),
12516
- risk: z17.enum(RISK_LEVELS2).describe(riskDescription)
12704
+ summary: z18.string().describe("Brief overall summary of the review findings"),
12705
+ risk: z18.enum(RISK_LEVELS2).describe(riskDescription)
12517
12706
  },
12518
12707
  async ({ reviewedSha, issues, summary, risk }) => {
12519
12708
  const issueLines = issues.map((issue) => {
@@ -12625,6 +12814,9 @@ var PACK_PROMOTED_TOOLS = /* @__PURE__ */ new Set(["get_execution_logs"]);
12625
12814
  function glossaryToolsFor(connection, config, context) {
12626
12815
  return context?.projectId ? buildGlossaryTools(connection, context.projectId, config.taskId, config.workspaceDir) : [];
12627
12816
  }
12817
+ function driveToolsFor(connection, context) {
12818
+ return context?.projectId && context.googleDriveConnected ? buildDriveTools(connection, context.projectId) : [];
12819
+ }
12628
12820
  function promotedToolsFor(effectiveMode, isPack) {
12629
12821
  const names = /* @__PURE__ */ new Set();
12630
12822
  if (effectiveMode === "building" || effectiveMode === "auto") {
@@ -12653,6 +12845,7 @@ function buildConveyorTools(connection, config, context, agentMode) {
12653
12845
  const handoffTools = config.mode === "pm" && (effectiveMode === "discovery" || effectiveMode === "auto") ? [buildHandoffTool(connection)] : [];
12654
12846
  const emergencyTools = [buildForceUpdateTaskStatusTool(connection)];
12655
12847
  const glossaryTools = glossaryToolsFor(connection, config, context);
12848
+ const driveTools = driveToolsFor(connection, context);
12656
12849
  const isPack = config.mode === "pack" || Boolean(context?.isParentTask);
12657
12850
  return withAlwaysLoad(
12658
12851
  [
@@ -12663,6 +12856,7 @@ function buildConveyorTools(connection, config, context, agentMode) {
12663
12856
  ...prGuideTools,
12664
12857
  ...handoffTools,
12665
12858
  ...glossaryTools,
12859
+ ...driveTools,
12666
12860
  ...emergencyTools
12667
12861
  ],
12668
12862
  promotedToolsFor(effectiveMode, isPack)
@@ -16563,4 +16757,4 @@ export {
16563
16757
  loadConveyorConfig,
16564
16758
  unshallowRepo
16565
16759
  };
16566
- //# sourceMappingURL=chunk-D2TYLAPI.js.map
16760
+ //# sourceMappingURL=chunk-ELGNA6SP.js.map