@rudderhq/cli 0.2.1-canary.1 → 0.2.1-canary.3

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/README.md CHANGED
@@ -8,8 +8,6 @@ Rudder began from a fork of an early version of Paperclip. That gave us a practi
8
8
 
9
9
  Rudder is built for the moment when agent work stops looking like a single prompt and starts looking like a real team.
10
10
 
11
- Current status: V1 is under active development. The current north-star metric is the weekly count of real agent-work loops completed end-to-end through Rudder.
12
-
13
11
  ## The Design Idea
14
12
 
15
13
  Rudder is shaped by a simple belief: the most useful way to work with agents is closer to the way humans coordinate with each other.
package/dist/index.js CHANGED
@@ -117,6 +117,7 @@ var init_constants = __esm({
117
117
  CHAT_MESSAGE_ROLES = ["user", "assistant", "system"];
118
118
  CHAT_MESSAGE_KINDS = [
119
119
  "message",
120
+ "ask_user",
120
121
  "issue_proposal",
121
122
  "operation_proposal",
122
123
  "system_event"
@@ -579,7 +580,7 @@ var init_resource = __esm({
579
580
 
580
581
  // ../packages/shared/src/validators/chat.ts
581
582
  import { z as z5 } from "zod";
582
- var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, addChatMessageSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema;
583
+ var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, addChatMessageSchema, chatRichReferenceDisplaySchema, chatIssueIdentifierSchema, chatAskUserIdentifierSchema, chatAskUserOptionSchema, chatAskUserQuestionSchema, chatAskUserRequestSchema, chatIssueRichReferenceSchema, chatIssueCommentRichReferenceSchema, chatRichReferenceSchema, chatRichReferencesSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema;
583
584
  var init_chat = __esm({
584
585
  "../packages/shared/src/validators/chat.ts"() {
585
586
  "use strict";
@@ -616,6 +617,47 @@ var init_chat = __esm({
616
617
  body: z5.string().trim().min(1).max(2e4),
617
618
  editUserMessageId: z5.string().uuid().optional().nullable()
618
619
  });
620
+ chatRichReferenceDisplaySchema = z5.enum(["card", "inline"]);
621
+ chatIssueIdentifierSchema = z5.string().trim().min(1).max(64).regex(/^[A-Z0-9][A-Z0-9-]*$/i);
622
+ chatAskUserIdentifierSchema = z5.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/);
623
+ chatAskUserOptionSchema = z5.object({
624
+ id: chatAskUserIdentifierSchema,
625
+ label: z5.string().trim().min(1).max(80),
626
+ description: z5.string().trim().min(1).max(220).optional(),
627
+ recommended: z5.boolean().optional()
628
+ });
629
+ chatAskUserQuestionSchema = z5.object({
630
+ id: chatAskUserIdentifierSchema,
631
+ header: z5.string().trim().min(1).max(32).optional(),
632
+ question: z5.string().trim().min(1).max(240),
633
+ options: z5.array(chatAskUserOptionSchema).min(2).max(3),
634
+ allowFreeform: z5.boolean().optional()
635
+ });
636
+ chatAskUserRequestSchema = z5.object({
637
+ questions: z5.array(chatAskUserQuestionSchema).min(1).max(3)
638
+ });
639
+ chatIssueRichReferenceSchema = z5.object({
640
+ type: z5.literal("issue"),
641
+ issueId: z5.string().uuid().optional(),
642
+ identifier: chatIssueIdentifierSchema.optional(),
643
+ display: chatRichReferenceDisplaySchema.optional()
644
+ }).refine((value) => Boolean(value.issueId || value.identifier), {
645
+ message: "issueId or identifier is required"
646
+ });
647
+ chatIssueCommentRichReferenceSchema = z5.object({
648
+ type: z5.literal("issue_comment"),
649
+ issueId: z5.string().uuid().optional(),
650
+ identifier: chatIssueIdentifierSchema.optional(),
651
+ commentId: z5.string().uuid(),
652
+ display: chatRichReferenceDisplaySchema.optional()
653
+ }).refine((value) => Boolean(value.issueId || value.identifier), {
654
+ message: "issueId or identifier is required"
655
+ });
656
+ chatRichReferenceSchema = z5.union([
657
+ chatIssueRichReferenceSchema,
658
+ chatIssueCommentRichReferenceSchema
659
+ ]);
660
+ chatRichReferencesSchema = z5.array(chatRichReferenceSchema).max(5);
619
661
  createChatAttachmentMetadataSchema = z5.object({
620
662
  messageId: z5.string().uuid()
621
663
  });
@@ -2491,7 +2533,10 @@ var init_organization_skill_reference = __esm({
2491
2533
  "para-memory-files",
2492
2534
  "rudder",
2493
2535
  "rudder-create-agent",
2494
- "rudder-create-plugin"
2536
+ "rudder-create-plugin",
2537
+ "skill-creator",
2538
+ "skill-optimizer",
2539
+ "conversation-to-skill"
2495
2540
  ];
2496
2541
  RUDDER_BUNDLED_SKILL_KEYS = new Set(
2497
2542
  RUDDER_BUNDLED_SKILL_SLUGS.map((slug) => `rudder/${slug}`)
@@ -6132,6 +6177,7 @@ var CLI_REGISTRY_LATEST_URL = "https://registry.npmjs.org/@rudderhq%2fcli/latest
6132
6177
  var DESKTOP_APP_NAME = "Rudder";
6133
6178
  var DESKTOP_METADATA_FILE = ".rudder-desktop-install.json";
6134
6179
  var DESKTOP_CHECKSUM_ASSET_NAME = "SHASUMS256.txt";
6180
+ var GITHUB_ASSET_DOWNLOAD_ACCEPT = "application/octet-stream";
6135
6181
  function resolveCurrentCliVersion(env = process.env) {
6136
6182
  const version = resolveCliVersion(import.meta.url, env);
6137
6183
  return version === "0.0.0" ? "latest" : version;
@@ -6313,6 +6359,26 @@ function buildGithubReleaseAsset(repo, tag, assetName) {
6313
6359
  browser_download_url: buildGithubReleaseAssetDownloadUrl(repo, tag, assetName)
6314
6360
  };
6315
6361
  }
6362
+ function uniqueAssetDownloadUrls(asset) {
6363
+ const urls = [asset.url, asset.browser_download_url].filter((url) => Boolean(url));
6364
+ return Array.from(new Set(urls));
6365
+ }
6366
+ function downloadHeadersForAssetUrl(asset, url) {
6367
+ return {
6368
+ Accept: url === asset.url ? GITHUB_ASSET_DOWNLOAD_ACCEPT : "*/*",
6369
+ "User-Agent": "rudder-cli-installer"
6370
+ };
6371
+ }
6372
+ function formatFetchError(error) {
6373
+ if (!(error instanceof Error)) return String(error);
6374
+ const cause = error.cause;
6375
+ if (cause instanceof Error) {
6376
+ const code = cause.code;
6377
+ const suffix = typeof code === "string" ? ` [${code}]` : "";
6378
+ return `${error.message}: ${cause.message}${suffix}`;
6379
+ }
6380
+ return error.message;
6381
+ }
6316
6382
  function contentLengthFromHeaders(headers) {
6317
6383
  const raw = headers.get("content-length");
6318
6384
  if (!raw) return null;
@@ -6322,11 +6388,24 @@ function contentLengthFromHeaders(headers) {
6322
6388
  async function downloadAsset(asset, outputDir, progressFactory = createByteProgress) {
6323
6389
  mkdirSync(outputDir, { recursive: true });
6324
6390
  const outputPath = path11.join(outputDir, path11.basename(asset.name));
6325
- const response = await fetch(asset.browser_download_url, {
6326
- headers: { "User-Agent": "rudder-cli-installer" }
6327
- });
6328
- if (!response.ok || !response.body) {
6329
- throw new Error(`Failed to download ${asset.name} from ${asset.browser_download_url} (${response.status}).`);
6391
+ let response = null;
6392
+ const failures = [];
6393
+ for (const url of uniqueAssetDownloadUrls(asset)) {
6394
+ try {
6395
+ const candidate = await fetch(url, {
6396
+ headers: downloadHeadersForAssetUrl(asset, url)
6397
+ });
6398
+ if (candidate.ok && candidate.body) {
6399
+ response = candidate;
6400
+ break;
6401
+ }
6402
+ failures.push(`Failed to download ${asset.name} from ${url} (${candidate.status}).`);
6403
+ } catch (error) {
6404
+ failures.push(`Failed to download ${asset.name} from ${url}: ${formatFetchError(error)}.`);
6405
+ }
6406
+ }
6407
+ if (!response) {
6408
+ throw new Error(failures.join("\n"));
6330
6409
  }
6331
6410
  const totalBytes = contentLengthFromHeaders(response.headers);
6332
6411
  const progress = progressFactory(`Downloading ${asset.name}`);
@@ -6744,20 +6823,28 @@ async function startCommand(opts) {
6744
6823
  }
6745
6824
  const directReleaseVersion = resolveDesktopReleaseVersion(tag);
6746
6825
  const progressFactory = createByteProgress;
6747
- const release = directReleaseVersion ? null : await runStartPhase(
6748
- "Resolving Desktop release...",
6749
- "Desktop release resolved.",
6750
- () => fetchGithubRelease(repo, tag)
6751
- );
6752
- const releaseTag = directReleaseVersion ? tag : release?.tag_name;
6826
+ let release = null;
6827
+ try {
6828
+ release = await runStartPhase(
6829
+ "Resolving Desktop release...",
6830
+ "Desktop release resolved.",
6831
+ () => fetchGithubRelease(repo, tag)
6832
+ );
6833
+ } catch (error) {
6834
+ if (!directReleaseVersion) throw error;
6835
+ p13.log.warn(
6836
+ `Desktop release metadata could not be resolved; falling back to deterministic download URLs. ${formatFetchError(error)}`
6837
+ );
6838
+ }
6839
+ const releaseTag = release?.tag_name ?? (directReleaseVersion ? tag : null);
6753
6840
  if (!releaseTag) {
6754
6841
  throw new Error(`Unable to resolve Rudder Desktop release tag for ${repo}@${tag}.`);
6755
6842
  }
6756
- const asset = directReleaseVersion ? buildGithubReleaseAsset(repo, tag, resolveDesktopAssetName(directReleaseVersion, target)) : selectDesktopAsset(release?.assets ?? [], target);
6843
+ const asset = selectDesktopAsset(release?.assets ?? [], target) ?? (directReleaseVersion ? buildGithubReleaseAsset(repo, tag, resolveDesktopAssetName(directReleaseVersion, target)) : null);
6757
6844
  if (!asset) {
6758
6845
  throw new Error(`No Rudder Desktop portable asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
6759
6846
  }
6760
- const checksumAsset = directReleaseVersion ? buildGithubReleaseAsset(repo, tag, DESKTOP_CHECKSUM_ASSET_NAME) : selectChecksumAsset(release?.assets ?? []);
6847
+ const checksumAsset = selectChecksumAsset(release?.assets ?? []) ?? (directReleaseVersion ? buildGithubReleaseAsset(repo, tag, DESKTOP_CHECKSUM_ASSET_NAME) : null);
6761
6848
  const checksums = await downloadChecksums(checksumAsset, outputDir, progressFactory);
6762
6849
  const expectedChecksum = resolveAssetChecksum(checksums, asset.name);
6763
6850
  const metadata = await readInstallMetadata(installPaths.metadataPath);