@rudderhq/cli 0.7.3 → 0.7.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
@@ -65,6 +65,7 @@ var init_computer_use = __esm({
65
65
  COMPUTER_USE_MCP_TOOL_PREFIX = "rudder_computer_";
66
66
  COMPUTER_USE_ACTIONS = [
67
67
  "list_apps",
68
+ "launch_app",
68
69
  "list_windows",
69
70
  "get_app_state",
70
71
  "click",
@@ -103,6 +104,14 @@ var init_computer_use = __esm({
103
104
  });
104
105
  COMPUTER_USE_MCP_TOOLS = [
105
106
  tool("list_apps", "List running macOS applications. Use this to identify the exact target before observing it.", objectSchema({})),
107
+ tool("launch_app", "Launch an installed application without taking focus. Use the returned pid and window ID to observe it directly.", {
108
+ ...objectSchema({
109
+ name: { type: "string", description: "Exact installed application name." },
110
+ bundleId: { type: "string", description: "Exact application bundle identifier." },
111
+ newInstance: { type: "boolean", description: "Request a separate application instance when the platform supports it." }
112
+ }),
113
+ anyOf: [{ required: ["name"] }, { required: ["bundleId"] }]
114
+ }),
106
115
  tool("list_windows", "List windows for a running application.", objectSchema({
107
116
  ...targetProperties,
108
117
  onScreenOnly: { type: "boolean" }
@@ -182,6 +191,11 @@ var init_computer_use = __esm({
182
191
  }).strict();
183
192
  computerUseActionSchemas = {
184
193
  list_apps: z.object({}).strict(),
194
+ launch_app: z.object({
195
+ name: z.string().trim().min(1).max(300).optional(),
196
+ bundleId: z.string().trim().min(1).max(300).optional(),
197
+ newInstance: z.boolean().optional()
198
+ }).strict().refine((value) => value.name !== void 0 || value.bundleId !== void 0, { message: "Launch app requires a name or bundle ID." }),
185
199
  list_windows: appTargetSchema.extend({ onScreenOnly: z.boolean().optional() }).strict(),
186
200
  get_app_state: appTargetSchema.extend({
187
201
  includeScreenshot: z.boolean().optional(),
@@ -242,7 +256,7 @@ var init_computer_use = __esm({
242
256
  });
243
257
 
244
258
  // ../packages/shared/dist/constants.js
245
- var ORGANIZATION_STATUSES, ORGANIZATION_INTELLIGENCE_PROFILE_PURPOSES, ORGANIZATION_INTELLIGENCE_PROFILE_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, AGENT_OREO_ICON_PREFIX, AGENT_OREO_SHAPE_IDS, AGENT_OREO_PALETTE_IDS, AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX, AGENT_AVATAR_BACKGROUND_PRESET_IDS, ISSUE_STATUSES, ISSUE_PRIORITIES, AGENT_INTEGRATION_PROVIDERS, AGENT_INTEGRATION_STATUSES, AGENT_INTEGRATION_TRANSPORTS, AGENT_INTEGRATION_PROVIDER_REGIONS, AGENT_INTEGRATION_CHAT_TYPES, AGENT_INTEGRATION_DROP_REASONS, AGENT_INTEGRATION_OUTBOUND_STATUSES, RUDDER_AGENT_V1_MCP_TOOL_NAMES, RUDDER_BROWSER_MCP_TOOL_NAMES2, RUDDER_CORE_MCP_TOOL_NAMES2, CUSTOM_INTEGRATION_KINDS, CUSTOM_INTEGRATION_SCOPES, CUSTOM_INTEGRATION_STATUSES, CUSTOM_INTEGRATION_TOOL_STATUSES, CUSTOM_INTEGRATION_BINDING_STATUSES, CUSTOM_INTEGRATION_TOOL_CALL_STATUSES, MCP_CONNECTION_PROVIDERS, MCP_CONNECTION_TRANSPORTS, MCP_CONNECTION_SCOPES, MCP_CONNECTION_ACCESS_MODES, MCP_AGENT_ACCESS_MODES, MCP_CONNECTION_CANONICAL_STATES, MCP_PROVIDER_SCOPE_MODES, MCP_PROVIDER_CREDENTIAL_MODES, MCP_PROVIDER_ORGANIZATION_STATES, MCP_TOOL_CAPABILITY_CLASSES, MCP_CONNECTION_STATUSES, MCP_OAUTH_GRANT_STATUSES, MCP_AGENT_BINDING_STATUSES, MCP_OAUTH_SESSION_TTL_MS, MCP_PROVIDER_CATALOG, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_OBJECTIVE_MODES, GOAL_EVALUATOR_KINDS, GOAL_CONTINUATION_KINDS, GOAL_ACTIVITY_KINDS, GOAL_FEEDBACK_KINDS, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, ORGANIZATION_RESOURCE_SOURCE_TYPES, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_OUTPUT_MODES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, PROJECT_ICONS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, AGENT_ISSUE_CREATION_REQUEST_STATUSES, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS;
259
+ var ORGANIZATION_STATUSES, ORGANIZATION_INTELLIGENCE_PROFILE_PURPOSES, ORGANIZATION_INTELLIGENCE_PROFILE_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, AGENT_OREO_ICON_PREFIX, AGENT_OREO_SHAPE_IDS, AGENT_OREO_PALETTE_IDS, AGENT_DICEBEAR_NOTIONISTS_ICON_PREFIX, AGENT_AVATAR_BACKGROUND_PRESET_IDS, ISSUE_STATUSES, ISSUE_PRIORITIES, AGENT_INTEGRATION_PROVIDERS, AGENT_INTEGRATION_STATUSES, AGENT_INTEGRATION_TRANSPORTS, AGENT_INTEGRATION_PROVIDER_REGIONS, AGENT_INTEGRATION_CHAT_TYPES, AGENT_INTEGRATION_DROP_REASONS, AGENT_INTEGRATION_OUTBOUND_STATUSES, RUDDER_AGENT_V1_MCP_TOOL_NAMES, RUDDER_BROWSER_MCP_TOOL_NAMES2, RUDDER_CORE_MCP_TOOL_NAMES2, CUSTOM_INTEGRATION_KINDS, CUSTOM_INTEGRATION_SCOPES, CUSTOM_INTEGRATION_STATUSES, CUSTOM_INTEGRATION_TOOL_STATUSES, CUSTOM_INTEGRATION_BINDING_STATUSES, CUSTOM_INTEGRATION_TOOL_CALL_STATUSES, MCP_CONNECTION_PROVIDERS, MCP_CONNECTION_TRANSPORTS, MCP_CONNECTION_SCOPES, MCP_CONNECTION_ACCESS_MODES, MCP_AGENT_ACCESS_MODES, MCP_CONNECTION_CANONICAL_STATES, MCP_PROVIDER_SCOPE_MODES, MCP_PROVIDER_CREDENTIAL_MODES, MCP_PROVIDER_ORGANIZATION_STATES, MCP_TOOL_CAPABILITY_CLASSES, MCP_CONNECTION_STATUSES, MCP_OAUTH_GRANT_STATUSES, MCP_AGENT_BINDING_STATUSES, MCP_OAUTH_SESSION_TTL_MS, MCP_PROVIDER_CATALOG, CALENDAR_SOURCE_TYPES, CALENDAR_OWNER_TYPES, CALENDAR_VISIBILITIES, CALENDAR_SOURCE_STATUSES, CALENDAR_EVENT_KINDS, CALENDAR_EVENT_STATUSES, CALENDAR_SOURCE_MODES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_OBJECTIVE_MODES, GOAL_EVALUATOR_KINDS, GOAL_CONTINUATION_KINDS, GOAL_ACTIVITY_KINDS, GOAL_FEEDBACK_KINDS, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, ORGANIZATION_RESOURCE_SOURCE_TYPES, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_OUTPUT_MODES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, PROJECT_ICONS, APPROVAL_TYPES, REQUEST_STATUSES, ASSISTANCE_REQUEST_RESOLUTIONS, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, AGENT_ISSUE_CREATION_REQUEST_STATUSES, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS;
246
260
  var init_constants = __esm({
247
261
  "../packages/shared/dist/constants.js"() {
248
262
  "use strict";
@@ -424,6 +438,11 @@ var init_constants = __esm({
424
438
  "rudder_agent_skills_create",
425
439
  "rudder_agent_skills_enable",
426
440
  "rudder_agent_skills_sync",
441
+ "rudder_goal_list",
442
+ "rudder_goal_context",
443
+ "rudder_goal_progress",
444
+ "rudder_goal_change_propose",
445
+ "rudder_goal_result_propose",
427
446
  "rudder_issue_get",
428
447
  "rudder_issue_list",
429
448
  "rudder_issue_search",
@@ -642,7 +661,7 @@ var init_constants = __esm({
642
661
  "system_event"
643
662
  ];
644
663
  CHAT_MESSAGE_STATUSES = ["streaming", "completed", "stopped", "failed", "interrupted"];
645
- CHAT_CONTEXT_ENTITY_TYPES = ["issue", "project", "agent"];
664
+ CHAT_CONTEXT_ENTITY_TYPES = ["issue", "project", "agent", "goal"];
646
665
  GOAL_OBJECTIVE_MODES = ["target", "maximize", "maintain", "decide"];
647
666
  GOAL_EVALUATOR_KINDS = ["artifact", "metric", "policy", "human"];
648
667
  GOAL_CONTINUATION_KINDS = ["commitment", "wait", "decision", "verification"];
@@ -755,6 +774,8 @@ var init_constants = __esm({
755
774
  "agent_runtime",
756
775
  "goal_change"
757
776
  ];
777
+ REQUEST_STATUSES = ["open", "resolved", "cancelled", "superseded"];
778
+ ASSISTANCE_REQUEST_RESOLUTIONS = ["answered", "action_completed", "cannot_help"];
758
779
  SECRET_PROVIDERS = [
759
780
  "local_encrypted",
760
781
  "aws_secrets_manager",
@@ -2036,7 +2057,9 @@ var init_chat = __esm({
2036
2057
  body: z5.string().trim().max(2e4).default(""),
2037
2058
  inlineAnnotations: chatInlineAnnotationsInputSchema.optional(),
2038
2059
  editUserMessageId: z5.string().uuid().optional().nullable(),
2039
- queuedMessageId: z5.string().uuid().optional().nullable()
2060
+ queuedMessageId: z5.string().uuid().optional().nullable(),
2061
+ modelOverride: chatModelOverrideSchema.optional().nullable(),
2062
+ effortOverride: chatEffortOverrideSchema.optional().nullable()
2040
2063
  }).superRefine((value, ctx) => {
2041
2064
  if (value.body.length === 0 && (value.inlineAnnotations?.length ?? 0) === 0) {
2042
2065
  ctx.addIssue({
@@ -3206,7 +3229,7 @@ var init_organization_portability = __esm({
3206
3229
 
3207
3230
  // ../packages/shared/dist/validators/organization-skill.js
3208
3231
  import { z as z18 } from "zod";
3209
- var organizationSkillSourceTypeSchema, organizationSkillTrustLevelSchema, organizationSkillCompatibilitySchema, organizationSkillSourceBadgeSchema, organizationSkillFileInventoryEntrySchema, organizationSkillSchema, organizationSkillListItemSchema, organizationSkillUsageAgentSchema, organizationSkillDetailSchema, organizationSkillUpdateStatusSchema, organizationSkillImportSchema, organizationSkillProjectScanRequestSchema, organizationSkillProjectScanSkippedSchema, organizationSkillProjectScanConflictSchema, organizationSkillProjectScanResultSchema, organizationSkillLocalScanRequestSchema, organizationSkillLocalScanSkippedSchema, organizationSkillLocalScanConflictSchema, organizationSkillLocalScanResultSchema, organizationSkillCreateSchema, organizationSkillFileDetailSchema, organizationSkillFileUpdateSchema;
3232
+ var organizationSkillSourceTypeSchema, organizationSkillTrustLevelSchema, organizationSkillCompatibilitySchema, organizationSkillSourceBadgeSchema, organizationSkillFileInventoryEntrySchema, organizationSkillSchema, organizationSkillListItemSchema, organizationSkillUsageAgentSchema, organizationSkillDetailSchema, organizationSkillUpdateStatusSchema, organizationSkillImportSchema, organizationSkillUploadSchema, organizationSkillProjectScanRequestSchema, organizationSkillProjectScanSkippedSchema, organizationSkillProjectScanConflictSchema, organizationSkillProjectScanResultSchema, organizationSkillLocalScanRequestSchema, organizationSkillLocalScanSkippedSchema, organizationSkillLocalScanConflictSchema, organizationSkillLocalScanResultSchema, organizationSkillCreateSchema, organizationSkillFileDetailSchema, organizationSkillFileUpdateSchema;
3210
3233
  var init_organization_skill = __esm({
3211
3234
  "../packages/shared/dist/validators/organization-skill.js"() {
3212
3235
  "use strict";
@@ -3282,6 +3305,12 @@ var init_organization_skill = __esm({
3282
3305
  organizationSkillImportSchema = z18.object({
3283
3306
  source: z18.string().min(1)
3284
3307
  });
3308
+ organizationSkillUploadSchema = z18.object({
3309
+ files: z18.array(z18.object({
3310
+ path: z18.string().min(1).max(512),
3311
+ content: z18.string().max(1048576)
3312
+ })).min(1).max(128)
3313
+ });
3285
3314
  organizationSkillProjectScanRequestSchema = z18.object({
3286
3315
  projectIds: z18.array(z18.string().uuid()).optional(),
3287
3316
  workspaceIds: z18.array(z18.string().uuid()).optional()
@@ -3998,6 +4027,7 @@ var init_goal = __esm({
3998
4027
  "../packages/shared/dist/validators/goal.js"() {
3999
4028
  "use strict";
4000
4029
  init_constants();
4030
+ init_issue();
4001
4031
  jsonRecord = z27.record(z27.string(), z27.unknown());
4002
4032
  evidenceRefSchema = z27.string().trim().min(1).regex(/^[a-z][a-z0-9+.-]*:[^\s]+$/i, "Evidence references must use a URI-like scheme");
4003
4033
  sha256HexSchema = z27.string().regex(/^[a-f0-9]{64}$/, "Expected a SHA-256 hex digest");
@@ -4025,16 +4055,20 @@ var init_goal = __esm({
4025
4055
  title: z27.string().trim().min(1),
4026
4056
  description: z27.string().optional().nullable(),
4027
4057
  alignmentQuestion: z27.string().trim().min(1).optional().nullable(),
4028
- /** Accepted for legacy clients but intentionally ignored by the canonical create command. */
4058
+ targetTime: z27.coerce.date().optional().nullable(),
4029
4059
  level: z27.string().optional(),
4030
4060
  status: z27.string().optional(),
4031
4061
  parentId: z27.string().uuid().optional().nullable(),
4032
- ownerAgentId: z27.string().uuid().optional().nullable()
4062
+ ownerAgentId: z27.string().uuid().optional().nullable(),
4063
+ ownerAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable()
4033
4064
  });
4034
4065
  updateGoalSchema = z27.object({
4035
4066
  title: z27.string().trim().min(1).optional(),
4036
4067
  description: z27.string().optional().nullable(),
4037
- alignmentQuestion: z27.string().trim().min(1).optional().nullable()
4068
+ alignmentQuestion: z27.string().trim().min(1).optional().nullable(),
4069
+ ownerAgentId: z27.string().uuid().optional().nullable(),
4070
+ ownerAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
4071
+ targetTime: z27.coerce.date().optional().nullable()
4038
4072
  }).strict();
4039
4073
  activateGoalSchema = z27.object({
4040
4074
  confirmed: z27.literal(true),
@@ -4086,6 +4120,7 @@ var init_goal = __esm({
4086
4120
  requestKey: z27.string().trim().min(1),
4087
4121
  packetHash: sha256HexSchema,
4088
4122
  packet: goalStartPacketSchema,
4123
+ allowCapabilityMismatch: z27.boolean().optional(),
4089
4124
  draftGoalId: z27.string().uuid().optional()
4090
4125
  }).strict();
4091
4126
  createGoalActivitySchema = z27.object({
@@ -4217,8 +4252,29 @@ var init_approval = __esm({
4217
4252
  }
4218
4253
  });
4219
4254
 
4220
- // ../packages/shared/dist/validators/automation.js
4255
+ // ../packages/shared/dist/validators/request.js
4221
4256
  import { z as z29 } from "zod";
4257
+ var listRequestsQuerySchema, resolveAssistanceRequestSchema, cancelAssistanceRequestSchema;
4258
+ var init_request = __esm({
4259
+ "../packages/shared/dist/validators/request.js"() {
4260
+ "use strict";
4261
+ init_constants();
4262
+ listRequestsQuerySchema = z29.object({
4263
+ status: z29.enum(REQUEST_STATUSES).optional(),
4264
+ kind: z29.enum(["approval", "assistance"]).optional()
4265
+ });
4266
+ resolveAssistanceRequestSchema = z29.object({
4267
+ resolution: z29.enum(ASSISTANCE_REQUEST_RESOLUTIONS),
4268
+ response: z29.string().trim().min(1).max(2e4)
4269
+ });
4270
+ cancelAssistanceRequestSchema = z29.object({
4271
+ reason: z29.string().trim().min(1).max(2e3).optional()
4272
+ });
4273
+ }
4274
+ });
4275
+
4276
+ // ../packages/shared/dist/validators/automation.js
4277
+ import { z as z30 } from "zod";
4222
4278
  function normalizeAutomationInstructions(value) {
4223
4279
  const { instructions, ...rest } = value;
4224
4280
  return {
@@ -4237,28 +4293,28 @@ var init_automation = __esm({
4237
4293
  "use strict";
4238
4294
  init_constants();
4239
4295
  init_issue();
4240
- automationTextFieldSchema = z29.string().optional().nullable();
4241
- automationBodyFieldsSchema = z29.object({
4242
- projectId: z29.string().uuid().optional().nullable().default(null),
4243
- goalId: z29.string().uuid().optional().nullable(),
4244
- parentIssueId: z29.string().uuid().optional().nullable(),
4245
- title: z29.string().trim().min(1).max(200),
4296
+ automationTextFieldSchema = z30.string().optional().nullable();
4297
+ automationBodyFieldsSchema = z30.object({
4298
+ projectId: z30.string().uuid().optional().nullable().default(null),
4299
+ goalId: z30.string().uuid().optional().nullable(),
4300
+ parentIssueId: z30.string().uuid().optional().nullable(),
4301
+ title: z30.string().trim().min(1).max(200),
4246
4302
  instructions: automationTextFieldSchema,
4247
4303
  description: automationTextFieldSchema,
4248
- assigneeAgentId: z29.string().uuid(),
4304
+ assigneeAgentId: z30.string().uuid(),
4249
4305
  assigneeAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
4250
- priority: z29.enum(ISSUE_PRIORITIES).optional().default("medium"),
4251
- status: z29.enum(AUTOMATION_STATUSES).optional().default("active"),
4252
- concurrencyPolicy: z29.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
4253
- catchUpPolicy: z29.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed"),
4254
- outputMode: z29.enum(AUTOMATION_OUTPUT_MODES).optional().default("track_issue"),
4255
- chatConversationId: z29.string().uuid().optional().nullable().default(null),
4256
- notifyOnIssueCreated: z29.boolean().optional().default(false)
4306
+ priority: z30.enum(ISSUE_PRIORITIES).optional().default("medium"),
4307
+ status: z30.enum(AUTOMATION_STATUSES).optional().default("active"),
4308
+ concurrencyPolicy: z30.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
4309
+ catchUpPolicy: z30.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed"),
4310
+ outputMode: z30.enum(AUTOMATION_OUTPUT_MODES).optional().default("track_issue"),
4311
+ chatConversationId: z30.string().uuid().optional().nullable().default(null),
4312
+ notifyOnIssueCreated: z30.boolean().optional().default(false)
4257
4313
  });
4258
4314
  createAutomationSchema = automationBodyFieldsSchema.superRefine((value, ctx) => {
4259
4315
  if (value.chatConversationId) {
4260
4316
  ctx.addIssue({
4261
- code: z29.ZodIssueCode.custom,
4317
+ code: z30.ZodIssueCode.custom,
4262
4318
  path: ["chatConversationId"],
4263
4319
  message: "Chat output creates an automation-owned conversation; existing chats cannot be selected"
4264
4320
  });
@@ -4267,185 +4323,185 @@ var init_automation = __esm({
4267
4323
  updateAutomationSchema = automationBodyFieldsSchema.partial().superRefine((value, ctx) => {
4268
4324
  if (value.chatConversationId) {
4269
4325
  ctx.addIssue({
4270
- code: z29.ZodIssueCode.custom,
4326
+ code: z30.ZodIssueCode.custom,
4271
4327
  path: ["chatConversationId"],
4272
4328
  message: "Chat output creates an automation-owned conversation; existing chats cannot be selected"
4273
4329
  });
4274
4330
  }
4275
4331
  }).transform(normalizeAutomationInstructions).transform(normalizeAutomationNotifications);
4276
- baseTriggerSchema = z29.object({
4277
- label: z29.string().trim().max(120).optional().nullable(),
4278
- enabled: z29.boolean().optional().default(true)
4332
+ baseTriggerSchema = z30.object({
4333
+ label: z30.string().trim().max(120).optional().nullable(),
4334
+ enabled: z30.boolean().optional().default(true)
4279
4335
  });
4280
- createAutomationTriggerSchema = z29.discriminatedUnion("kind", [
4336
+ createAutomationTriggerSchema = z30.discriminatedUnion("kind", [
4281
4337
  baseTriggerSchema.extend({
4282
- kind: z29.literal("schedule"),
4283
- cronExpression: z29.string().trim().min(1),
4284
- timezone: z29.string().trim().min(1).default("UTC")
4338
+ kind: z30.literal("schedule"),
4339
+ cronExpression: z30.string().trim().min(1),
4340
+ timezone: z30.string().trim().min(1).default("UTC")
4285
4341
  }),
4286
4342
  baseTriggerSchema.extend({
4287
- kind: z29.literal("webhook"),
4288
- signingMode: z29.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
4289
- replayWindowSec: z29.number().int().min(30).max(86400).optional().default(300)
4343
+ kind: z30.literal("webhook"),
4344
+ signingMode: z30.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
4345
+ replayWindowSec: z30.number().int().min(30).max(86400).optional().default(300)
4290
4346
  }),
4291
4347
  baseTriggerSchema.extend({
4292
- kind: z29.literal("api")
4348
+ kind: z30.literal("api")
4293
4349
  })
4294
4350
  ]);
4295
- updateAutomationTriggerSchema = z29.object({
4296
- label: z29.string().trim().max(120).optional().nullable(),
4297
- enabled: z29.boolean().optional(),
4298
- cronExpression: z29.string().trim().min(1).optional().nullable(),
4299
- timezone: z29.string().trim().min(1).optional().nullable(),
4300
- signingMode: z29.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
4301
- replayWindowSec: z29.number().int().min(30).max(86400).optional().nullable()
4351
+ updateAutomationTriggerSchema = z30.object({
4352
+ label: z30.string().trim().max(120).optional().nullable(),
4353
+ enabled: z30.boolean().optional(),
4354
+ cronExpression: z30.string().trim().min(1).optional().nullable(),
4355
+ timezone: z30.string().trim().min(1).optional().nullable(),
4356
+ signingMode: z30.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
4357
+ replayWindowSec: z30.number().int().min(30).max(86400).optional().nullable()
4302
4358
  });
4303
- runAutomationSchema = z29.object({
4304
- triggerId: z29.string().uuid().optional().nullable(),
4305
- payload: z29.record(z29.unknown()).optional().nullable(),
4306
- idempotencyKey: z29.string().trim().max(255).optional().nullable(),
4307
- source: z29.enum(["manual", "api"]).optional().default("manual")
4359
+ runAutomationSchema = z30.object({
4360
+ triggerId: z30.string().uuid().optional().nullable(),
4361
+ payload: z30.record(z30.unknown()).optional().nullable(),
4362
+ idempotencyKey: z30.string().trim().max(255).optional().nullable(),
4363
+ source: z30.enum(["manual", "api"]).optional().default("manual")
4308
4364
  });
4309
- rotateAutomationTriggerSecretSchema = z29.object({});
4365
+ rotateAutomationTriggerSecretSchema = z30.object({});
4310
4366
  }
4311
4367
  });
4312
4368
 
4313
4369
  // ../packages/shared/dist/validators/calendar.js
4314
- import { z as z30 } from "zod";
4370
+ import { z as z31 } from "zod";
4315
4371
  var nullableUuid, createCalendarSourceSchema, updateCalendarSourceSchema, calendarEventBaseSchema, createCalendarEventSchema, updateCalendarEventSchema, calendarEventListQuerySchema, googleCalendarSyncSchema, updateGoogleCalendarOAuthConfigSchema;
4316
4372
  var init_calendar = __esm({
4317
4373
  "../packages/shared/dist/validators/calendar.js"() {
4318
4374
  "use strict";
4319
4375
  init_constants();
4320
- nullableUuid = z30.string().uuid().optional().nullable();
4321
- createCalendarSourceSchema = z30.object({
4322
- type: z30.enum(CALENDAR_SOURCE_TYPES).optional().default("rudder_local"),
4323
- name: z30.string().trim().min(1).max(160),
4324
- ownerType: z30.enum(CALENDAR_OWNER_TYPES).optional().default("user"),
4325
- ownerUserId: z30.string().trim().min(1).optional().nullable(),
4376
+ nullableUuid = z31.string().uuid().optional().nullable();
4377
+ createCalendarSourceSchema = z31.object({
4378
+ type: z31.enum(CALENDAR_SOURCE_TYPES).optional().default("rudder_local"),
4379
+ name: z31.string().trim().min(1).max(160),
4380
+ ownerType: z31.enum(CALENDAR_OWNER_TYPES).optional().default("user"),
4381
+ ownerUserId: z31.string().trim().min(1).optional().nullable(),
4326
4382
  ownerAgentId: nullableUuid,
4327
- externalProvider: z30.string().trim().min(1).max(80).optional().nullable(),
4328
- externalCalendarId: z30.string().trim().min(1).max(512).optional().nullable(),
4329
- visibilityDefault: z30.enum(CALENDAR_VISIBILITIES).optional().default("full"),
4330
- status: z30.enum(CALENDAR_SOURCE_STATUSES).optional().default("active"),
4331
- syncCursorJson: z30.record(z30.unknown()).optional().nullable()
4383
+ externalProvider: z31.string().trim().min(1).max(80).optional().nullable(),
4384
+ externalCalendarId: z31.string().trim().min(1).max(512).optional().nullable(),
4385
+ visibilityDefault: z31.enum(CALENDAR_VISIBILITIES).optional().default("full"),
4386
+ status: z31.enum(CALENDAR_SOURCE_STATUSES).optional().default("active"),
4387
+ syncCursorJson: z31.record(z31.unknown()).optional().nullable()
4332
4388
  });
4333
4389
  updateCalendarSourceSchema = createCalendarSourceSchema.partial().extend({
4334
- lastSyncedAt: z30.coerce.date().optional().nullable()
4390
+ lastSyncedAt: z31.coerce.date().optional().nullable()
4335
4391
  });
4336
- calendarEventBaseSchema = z30.object({
4392
+ calendarEventBaseSchema = z31.object({
4337
4393
  sourceId: nullableUuid,
4338
- eventKind: z30.enum(CALENDAR_EVENT_KINDS),
4339
- eventStatus: z30.enum(CALENDAR_EVENT_STATUSES).optional().default("planned"),
4340
- ownerType: z30.enum(CALENDAR_OWNER_TYPES),
4341
- ownerUserId: z30.string().trim().min(1).optional().nullable(),
4394
+ eventKind: z31.enum(CALENDAR_EVENT_KINDS),
4395
+ eventStatus: z31.enum(CALENDAR_EVENT_STATUSES).optional().default("planned"),
4396
+ ownerType: z31.enum(CALENDAR_OWNER_TYPES),
4397
+ ownerUserId: z31.string().trim().min(1).optional().nullable(),
4342
4398
  ownerAgentId: nullableUuid,
4343
- title: z30.string().trim().min(1).max(240),
4344
- description: z30.string().optional().nullable(),
4345
- startAt: z30.coerce.date(),
4346
- endAt: z30.coerce.date(),
4347
- timezone: z30.string().trim().min(1).max(80).optional().default("UTC"),
4348
- allDay: z30.boolean().optional().default(false),
4349
- visibility: z30.enum(CALENDAR_VISIBILITIES).optional().default("full"),
4399
+ title: z31.string().trim().min(1).max(240),
4400
+ description: z31.string().optional().nullable(),
4401
+ startAt: z31.coerce.date(),
4402
+ endAt: z31.coerce.date(),
4403
+ timezone: z31.string().trim().min(1).max(80).optional().default("UTC"),
4404
+ allDay: z31.boolean().optional().default(false),
4405
+ visibility: z31.enum(CALENDAR_VISIBILITIES).optional().default("full"),
4350
4406
  issueId: nullableUuid,
4351
4407
  projectId: nullableUuid,
4352
4408
  goalId: nullableUuid,
4353
4409
  approvalId: nullableUuid,
4354
4410
  heartbeatRunId: nullableUuid,
4355
4411
  activityId: nullableUuid,
4356
- sourceMode: z30.enum(CALENDAR_SOURCE_MODES).optional().default("manual"),
4357
- externalProvider: z30.string().trim().min(1).max(80).optional().nullable(),
4358
- externalCalendarId: z30.string().trim().min(1).max(512).optional().nullable(),
4359
- externalEventId: z30.string().trim().min(1).max(512).optional().nullable(),
4360
- externalEtag: z30.string().trim().min(1).max(512).optional().nullable(),
4361
- externalUpdatedAt: z30.coerce.date().optional().nullable()
4412
+ sourceMode: z31.enum(CALENDAR_SOURCE_MODES).optional().default("manual"),
4413
+ externalProvider: z31.string().trim().min(1).max(80).optional().nullable(),
4414
+ externalCalendarId: z31.string().trim().min(1).max(512).optional().nullable(),
4415
+ externalEventId: z31.string().trim().min(1).max(512).optional().nullable(),
4416
+ externalEtag: z31.string().trim().min(1).max(512).optional().nullable(),
4417
+ externalUpdatedAt: z31.coerce.date().optional().nullable()
4362
4418
  });
4363
4419
  createCalendarEventSchema = calendarEventBaseSchema.refine((value) => value.endAt.getTime() > value.startAt.getTime(), { path: ["endAt"], message: "End time must be after start time" });
4364
4420
  updateCalendarEventSchema = calendarEventBaseSchema.partial().refine((value) => value.startAt === void 0 || value.endAt === void 0 || value.endAt.getTime() > value.startAt.getTime(), { path: ["endAt"], message: "End time must be after start time" });
4365
- calendarEventListQuerySchema = z30.object({
4366
- start: z30.coerce.date(),
4367
- end: z30.coerce.date(),
4368
- agentIds: z30.string().optional(),
4369
- sourceIds: z30.string().optional(),
4370
- eventKinds: z30.string().optional(),
4371
- statuses: z30.string().optional()
4421
+ calendarEventListQuerySchema = z31.object({
4422
+ start: z31.coerce.date(),
4423
+ end: z31.coerce.date(),
4424
+ agentIds: z31.string().optional(),
4425
+ sourceIds: z31.string().optional(),
4426
+ eventKinds: z31.string().optional(),
4427
+ statuses: z31.string().optional()
4372
4428
  }).refine((value) => value.end.getTime() > value.start.getTime(), { path: ["end"], message: "End time must be after start time" });
4373
- googleCalendarSyncSchema = z30.object({
4374
- sourceId: z30.string().uuid().optional().nullable()
4429
+ googleCalendarSyncSchema = z31.object({
4430
+ sourceId: z31.string().uuid().optional().nullable()
4375
4431
  });
4376
- updateGoogleCalendarOAuthConfigSchema = z30.object({
4377
- clientId: z30.string().trim().min(1).max(512).optional(),
4378
- clientSecret: z30.string().trim().min(1).max(2048).optional(),
4379
- clear: z30.boolean().optional().default(false)
4432
+ updateGoogleCalendarOAuthConfigSchema = z31.object({
4433
+ clientId: z31.string().trim().min(1).max(512).optional(),
4434
+ clientSecret: z31.string().trim().min(1).max(2048).optional(),
4435
+ clear: z31.boolean().optional().default(false)
4380
4436
  }).refine((value) => value.clear || value.clientId !== void 0 || value.clientSecret !== void 0, { message: "Provide credentials or clear the stored Google Calendar OAuth configuration" });
4381
4437
  }
4382
4438
  });
4383
4439
 
4384
4440
  // ../packages/shared/dist/validators/cost.js
4385
- import { z as z31 } from "zod";
4441
+ import { z as z32 } from "zod";
4386
4442
  var createCostEventSchema, updateBudgetSchema;
4387
4443
  var init_cost = __esm({
4388
4444
  "../packages/shared/dist/validators/cost.js"() {
4389
4445
  "use strict";
4390
4446
  init_constants();
4391
- createCostEventSchema = z31.object({
4392
- agentId: z31.string().uuid(),
4393
- issueId: z31.string().uuid().optional().nullable(),
4394
- projectId: z31.string().uuid().optional().nullable(),
4395
- goalId: z31.string().uuid().optional().nullable(),
4396
- heartbeatRunId: z31.string().uuid().optional().nullable(),
4397
- billingCode: z31.string().optional().nullable(),
4398
- provider: z31.string().min(1),
4399
- biller: z31.string().min(1).optional(),
4400
- billingType: z31.enum(BILLING_TYPES).optional().default("unknown"),
4401
- model: z31.string().min(1),
4402
- inputTokens: z31.number().int().nonnegative().optional().default(0),
4403
- cachedInputTokens: z31.number().int().nonnegative().optional().default(0),
4404
- outputTokens: z31.number().int().nonnegative().optional().default(0),
4405
- costCents: z31.number().int().nonnegative(),
4406
- occurredAt: z31.string().datetime()
4447
+ createCostEventSchema = z32.object({
4448
+ agentId: z32.string().uuid(),
4449
+ issueId: z32.string().uuid().optional().nullable(),
4450
+ projectId: z32.string().uuid().optional().nullable(),
4451
+ goalId: z32.string().uuid().optional().nullable(),
4452
+ heartbeatRunId: z32.string().uuid().optional().nullable(),
4453
+ billingCode: z32.string().optional().nullable(),
4454
+ provider: z32.string().min(1),
4455
+ biller: z32.string().min(1).optional(),
4456
+ billingType: z32.enum(BILLING_TYPES).optional().default("unknown"),
4457
+ model: z32.string().min(1),
4458
+ inputTokens: z32.number().int().nonnegative().optional().default(0),
4459
+ cachedInputTokens: z32.number().int().nonnegative().optional().default(0),
4460
+ outputTokens: z32.number().int().nonnegative().optional().default(0),
4461
+ costCents: z32.number().int().nonnegative(),
4462
+ occurredAt: z32.string().datetime()
4407
4463
  }).transform((value) => ({
4408
4464
  ...value,
4409
4465
  biller: value.biller ?? value.provider
4410
4466
  }));
4411
- updateBudgetSchema = z31.object({
4412
- budgetMonthlyCents: z31.number().int().nonnegative()
4467
+ updateBudgetSchema = z32.object({
4468
+ budgetMonthlyCents: z32.number().int().nonnegative()
4413
4469
  });
4414
4470
  }
4415
4471
  });
4416
4472
 
4417
4473
  // ../packages/shared/dist/validators/finance.js
4418
- import { z as z32 } from "zod";
4474
+ import { z as z33 } from "zod";
4419
4475
  var createFinanceEventSchema;
4420
4476
  var init_finance = __esm({
4421
4477
  "../packages/shared/dist/validators/finance.js"() {
4422
4478
  "use strict";
4423
4479
  init_constants();
4424
- createFinanceEventSchema = z32.object({
4425
- agentId: z32.string().uuid().optional().nullable(),
4426
- issueId: z32.string().uuid().optional().nullable(),
4427
- projectId: z32.string().uuid().optional().nullable(),
4428
- goalId: z32.string().uuid().optional().nullable(),
4429
- heartbeatRunId: z32.string().uuid().optional().nullable(),
4430
- costEventId: z32.string().uuid().optional().nullable(),
4431
- billingCode: z32.string().optional().nullable(),
4432
- description: z32.string().max(500).optional().nullable(),
4433
- eventKind: z32.enum(FINANCE_EVENT_KINDS),
4434
- direction: z32.enum(FINANCE_DIRECTIONS).optional().default("debit"),
4435
- biller: z32.string().min(1),
4436
- provider: z32.string().min(1).optional().nullable(),
4437
- executionAgentRuntimeType: z32.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
4438
- pricingTier: z32.string().min(1).optional().nullable(),
4439
- region: z32.string().min(1).optional().nullable(),
4440
- model: z32.string().min(1).optional().nullable(),
4441
- quantity: z32.number().int().nonnegative().optional().nullable(),
4442
- unit: z32.enum(FINANCE_UNITS).optional().nullable(),
4443
- amountCents: z32.number().int().nonnegative(),
4444
- currency: z32.string().length(3).optional().default("USD"),
4445
- estimated: z32.boolean().optional().default(false),
4446
- externalInvoiceId: z32.string().optional().nullable(),
4447
- metadataJson: z32.record(z32.string(), z32.unknown()).optional().nullable(),
4448
- occurredAt: z32.string().datetime()
4480
+ createFinanceEventSchema = z33.object({
4481
+ agentId: z33.string().uuid().optional().nullable(),
4482
+ issueId: z33.string().uuid().optional().nullable(),
4483
+ projectId: z33.string().uuid().optional().nullable(),
4484
+ goalId: z33.string().uuid().optional().nullable(),
4485
+ heartbeatRunId: z33.string().uuid().optional().nullable(),
4486
+ costEventId: z33.string().uuid().optional().nullable(),
4487
+ billingCode: z33.string().optional().nullable(),
4488
+ description: z33.string().max(500).optional().nullable(),
4489
+ eventKind: z33.enum(FINANCE_EVENT_KINDS),
4490
+ direction: z33.enum(FINANCE_DIRECTIONS).optional().default("debit"),
4491
+ biller: z33.string().min(1),
4492
+ provider: z33.string().min(1).optional().nullable(),
4493
+ executionAgentRuntimeType: z33.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
4494
+ pricingTier: z33.string().min(1).optional().nullable(),
4495
+ region: z33.string().min(1).optional().nullable(),
4496
+ model: z33.string().min(1).optional().nullable(),
4497
+ quantity: z33.number().int().nonnegative().optional().nullable(),
4498
+ unit: z33.enum(FINANCE_UNITS).optional().nullable(),
4499
+ amountCents: z33.number().int().nonnegative(),
4500
+ currency: z33.string().length(3).optional().default("USD"),
4501
+ estimated: z33.boolean().optional().default(false),
4502
+ externalInvoiceId: z33.string().optional().nullable(),
4503
+ metadataJson: z33.record(z33.string(), z33.unknown()).optional().nullable(),
4504
+ occurredAt: z33.string().datetime()
4449
4505
  }).transform((value) => ({
4450
4506
  ...value,
4451
4507
  currency: value.currency.toUpperCase()
@@ -4454,127 +4510,127 @@ var init_finance = __esm({
4454
4510
  });
4455
4511
 
4456
4512
  // ../packages/shared/dist/validators/asset.js
4457
- import { z as z33 } from "zod";
4513
+ import { z as z34 } from "zod";
4458
4514
  var createAssetImageMetadataSchema;
4459
4515
  var init_asset = __esm({
4460
4516
  "../packages/shared/dist/validators/asset.js"() {
4461
4517
  "use strict";
4462
- createAssetImageMetadataSchema = z33.object({
4463
- namespace: z33.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
4518
+ createAssetImageMetadataSchema = z34.object({
4519
+ namespace: z34.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
4464
4520
  });
4465
4521
  }
4466
4522
  });
4467
4523
 
4468
4524
  // ../packages/shared/dist/validators/access.js
4469
- import { z as z34 } from "zod";
4525
+ import { z as z35 } from "zod";
4470
4526
  var createCompanyInviteSchema, createOpenClawInvitePromptSchema, acceptInviteSchema, listJoinRequestsQuerySchema, claimJoinRequestApiKeySchema, boardCliAuthAccessLevelSchema, createCliAuthChallengeSchema, resolveCliAuthChallengeSchema, updateMemberPermissionsSchema, updateUserCompanyAccessSchema;
4471
4527
  var init_access = __esm({
4472
4528
  "../packages/shared/dist/validators/access.js"() {
4473
4529
  "use strict";
4474
4530
  init_constants();
4475
- createCompanyInviteSchema = z34.object({
4476
- allowedJoinTypes: z34.enum(INVITE_JOIN_TYPES).default("both"),
4477
- defaultsPayload: z34.record(z34.string(), z34.unknown()).optional().nullable(),
4478
- agentMessage: z34.string().max(4e3).optional().nullable()
4531
+ createCompanyInviteSchema = z35.object({
4532
+ allowedJoinTypes: z35.enum(INVITE_JOIN_TYPES).default("both"),
4533
+ defaultsPayload: z35.record(z35.string(), z35.unknown()).optional().nullable(),
4534
+ agentMessage: z35.string().max(4e3).optional().nullable()
4479
4535
  });
4480
- createOpenClawInvitePromptSchema = z34.object({
4481
- agentMessage: z34.string().max(4e3).optional().nullable()
4536
+ createOpenClawInvitePromptSchema = z35.object({
4537
+ agentMessage: z35.string().max(4e3).optional().nullable()
4482
4538
  });
4483
- acceptInviteSchema = z34.object({
4484
- requestType: z34.enum(JOIN_REQUEST_TYPES),
4485
- agentName: z34.string().min(1).max(120).optional(),
4486
- agentRuntimeType: z34.enum(AGENT_RUNTIME_TYPES).optional(),
4487
- capabilities: z34.string().max(4e3).optional().nullable(),
4488
- agentDefaultsPayload: z34.record(z34.string(), z34.unknown()).optional().nullable(),
4539
+ acceptInviteSchema = z35.object({
4540
+ requestType: z35.enum(JOIN_REQUEST_TYPES),
4541
+ agentName: z35.string().min(1).max(120).optional(),
4542
+ agentRuntimeType: z35.enum(AGENT_RUNTIME_TYPES).optional(),
4543
+ capabilities: z35.string().max(4e3).optional().nullable(),
4544
+ agentDefaultsPayload: z35.record(z35.string(), z35.unknown()).optional().nullable(),
4489
4545
  // OpenClaw join compatibility fields accepted at top level.
4490
- responsesWebhookUrl: z34.string().max(4e3).optional().nullable(),
4491
- responsesWebhookMethod: z34.string().max(32).optional().nullable(),
4492
- responsesWebhookHeaders: z34.record(z34.string(), z34.unknown()).optional().nullable(),
4493
- rudderApiUrl: z34.string().max(4e3).optional().nullable(),
4494
- webhookAuthHeader: z34.string().max(4e3).optional().nullable()
4546
+ responsesWebhookUrl: z35.string().max(4e3).optional().nullable(),
4547
+ responsesWebhookMethod: z35.string().max(32).optional().nullable(),
4548
+ responsesWebhookHeaders: z35.record(z35.string(), z35.unknown()).optional().nullable(),
4549
+ rudderApiUrl: z35.string().max(4e3).optional().nullable(),
4550
+ webhookAuthHeader: z35.string().max(4e3).optional().nullable()
4495
4551
  });
4496
- listJoinRequestsQuerySchema = z34.object({
4497
- status: z34.enum(JOIN_REQUEST_STATUSES).optional(),
4498
- requestType: z34.enum(JOIN_REQUEST_TYPES).optional()
4552
+ listJoinRequestsQuerySchema = z35.object({
4553
+ status: z35.enum(JOIN_REQUEST_STATUSES).optional(),
4554
+ requestType: z35.enum(JOIN_REQUEST_TYPES).optional()
4499
4555
  });
4500
- claimJoinRequestApiKeySchema = z34.object({
4501
- claimSecret: z34.string().min(16).max(256)
4556
+ claimJoinRequestApiKeySchema = z35.object({
4557
+ claimSecret: z35.string().min(16).max(256)
4502
4558
  });
4503
- boardCliAuthAccessLevelSchema = z34.enum([
4559
+ boardCliAuthAccessLevelSchema = z35.enum([
4504
4560
  "board",
4505
4561
  "instance_admin_required"
4506
4562
  ]);
4507
- createCliAuthChallengeSchema = z34.object({
4508
- command: z34.string().min(1).max(240),
4509
- clientName: z34.string().max(120).optional().nullable(),
4563
+ createCliAuthChallengeSchema = z35.object({
4564
+ command: z35.string().min(1).max(240),
4565
+ clientName: z35.string().max(120).optional().nullable(),
4510
4566
  requestedAccess: boardCliAuthAccessLevelSchema.default("board"),
4511
- requestedCompanyId: z34.string().uuid().optional().nullable()
4567
+ requestedCompanyId: z35.string().uuid().optional().nullable()
4512
4568
  });
4513
- resolveCliAuthChallengeSchema = z34.object({
4514
- token: z34.string().min(16).max(256)
4569
+ resolveCliAuthChallengeSchema = z35.object({
4570
+ token: z35.string().min(16).max(256)
4515
4571
  });
4516
- updateMemberPermissionsSchema = z34.object({
4517
- grants: z34.array(z34.object({
4518
- permissionKey: z34.enum(PERMISSION_KEYS),
4519
- scope: z34.record(z34.string(), z34.unknown()).optional().nullable()
4572
+ updateMemberPermissionsSchema = z35.object({
4573
+ grants: z35.array(z35.object({
4574
+ permissionKey: z35.enum(PERMISSION_KEYS),
4575
+ scope: z35.record(z35.string(), z35.unknown()).optional().nullable()
4520
4576
  }))
4521
4577
  });
4522
- updateUserCompanyAccessSchema = z34.object({
4523
- orgIds: z34.array(z34.string().uuid()).default([])
4578
+ updateUserCompanyAccessSchema = z35.object({
4579
+ orgIds: z35.array(z35.string().uuid()).default([])
4524
4580
  });
4525
4581
  }
4526
4582
  });
4527
4583
 
4528
4584
  // ../packages/shared/dist/validators/plugin-v1.js
4529
- import { z as z35 } from "zod";
4585
+ import { z as z36 } from "zod";
4530
4586
  var rudderPluginPackageFileSchema, inspectRudderPluginSchema, inspectRudderPluginArchiveSchema, configureRudderPluginMarketplaceSchema, installRudderPluginSchema, updateRudderPluginEnablementSchema, configureRudderPluginSkillsSchema, configureRudderPluginMcpSchema, customizeRudderPluginSkillSchema;
4531
4587
  var init_plugin_v1 = __esm({
4532
4588
  "../packages/shared/dist/validators/plugin-v1.js"() {
4533
4589
  "use strict";
4534
- rudderPluginPackageFileSchema = z35.object({
4535
- path: z35.string().min(1).max(1024),
4536
- content: z35.string().max(14e6),
4537
- encoding: z35.enum(["utf8", "base64"]).optional().default("utf8")
4590
+ rudderPluginPackageFileSchema = z36.object({
4591
+ path: z36.string().min(1).max(1024),
4592
+ content: z36.string().max(14e6),
4593
+ encoding: z36.enum(["utf8", "base64"]).optional().default("utf8")
4538
4594
  }).strict();
4539
- inspectRudderPluginSchema = z35.object({
4540
- sourceLabel: z35.string().trim().min(1).max(240),
4541
- sourceType: z35.literal("local_upload").optional().default("local_upload"),
4542
- files: z35.array(rudderPluginPackageFileSchema).min(1).max(500)
4595
+ inspectRudderPluginSchema = z36.object({
4596
+ sourceLabel: z36.string().trim().min(1).max(240),
4597
+ sourceType: z36.literal("local_upload").optional().default("local_upload"),
4598
+ files: z36.array(rudderPluginPackageFileSchema).min(1).max(500)
4543
4599
  }).strict();
4544
- inspectRudderPluginArchiveSchema = z35.object({
4545
- sourceLabel: z35.string().trim().min(1).max(240),
4546
- filename: z35.string().trim().min(1).max(240).refine((value) => /\.zip$/i.test(value), "Only ZIP Plugin archives are supported"),
4547
- content: z35.string().min(1).max(14e6),
4548
- encoding: z35.literal("base64")
4600
+ inspectRudderPluginArchiveSchema = z36.object({
4601
+ sourceLabel: z36.string().trim().min(1).max(240),
4602
+ filename: z36.string().trim().min(1).max(240).refine((value) => /\.zip$/i.test(value), "Only ZIP Plugin archives are supported"),
4603
+ content: z36.string().min(1).max(14e6),
4604
+ encoding: z36.literal("base64")
4549
4605
  }).strict();
4550
- configureRudderPluginMarketplaceSchema = z35.object({
4551
- sourceLabel: z35.string().trim().min(1).max(240),
4552
- files: z35.array(rudderPluginPackageFileSchema).min(1).max(500).optional(),
4553
- github: z35.object({
4554
- repository: z35.string().url().max(500),
4555
- commit: z35.string().regex(/^[0-9a-f]{40}$/i, "A full 40-character Git commit SHA is required")
4606
+ configureRudderPluginMarketplaceSchema = z36.object({
4607
+ sourceLabel: z36.string().trim().min(1).max(240),
4608
+ files: z36.array(rudderPluginPackageFileSchema).min(1).max(500).optional(),
4609
+ github: z36.object({
4610
+ repository: z36.string().url().max(500),
4611
+ commit: z36.string().regex(/^[0-9a-f]{40}$/i, "A full 40-character Git commit SHA is required")
4556
4612
  }).strict().optional()
4557
4613
  }).strict().superRefine((value, ctx) => {
4558
4614
  if (Boolean(value.files) === Boolean(value.github)) {
4559
- ctx.addIssue({ code: z35.ZodIssueCode.custom, message: "Provide exactly one local marketplace folder or pinned GitHub marketplace" });
4615
+ ctx.addIssue({ code: z36.ZodIssueCode.custom, message: "Provide exactly one local marketplace folder or pinned GitHub marketplace" });
4560
4616
  }
4561
4617
  });
4562
- installRudderPluginSchema = z35.object({
4563
- enabled: z35.boolean().optional().default(true),
4564
- confirmAccessExpansion: z35.boolean().optional().default(false),
4565
- skillConflictStrategy: z35.enum(["keep", "replace", "rename"]).optional()
4618
+ installRudderPluginSchema = z36.object({
4619
+ enabled: z36.boolean().optional().default(true),
4620
+ confirmAccessExpansion: z36.boolean().optional().default(false),
4621
+ skillConflictStrategy: z36.enum(["keep", "replace", "rename"]).optional()
4566
4622
  }).strict();
4567
- updateRudderPluginEnablementSchema = z35.object({
4568
- enabled: z35.boolean()
4623
+ updateRudderPluginEnablementSchema = z36.object({
4624
+ enabled: z36.boolean()
4569
4625
  }).strict();
4570
- configureRudderPluginSkillsSchema = z35.object({
4571
- agentIds: z35.array(z35.string().uuid()).max(100)
4626
+ configureRudderPluginSkillsSchema = z36.object({
4627
+ agentIds: z36.array(z36.string().uuid()).max(100)
4572
4628
  }).strict();
4573
- configureRudderPluginMcpSchema = z35.object({
4574
- componentId: z35.string().uuid()
4629
+ configureRudderPluginMcpSchema = z36.object({
4630
+ componentId: z36.string().uuid()
4575
4631
  }).strict();
4576
- customizeRudderPluginSkillSchema = z35.object({
4577
- componentId: z35.string().uuid()
4632
+ customizeRudderPluginSkillSchema = z36.object({
4633
+ componentId: z36.string().uuid()
4578
4634
  }).strict();
4579
4635
  }
4580
4636
  });
@@ -4607,6 +4663,7 @@ var init_validators = __esm({
4607
4663
  init_workspace_backup2();
4608
4664
  init_goal();
4609
4665
  init_approval();
4666
+ init_request();
4610
4667
  init_secret();
4611
4668
  init_automation();
4612
4669
  init_calendar();
@@ -4650,6 +4707,7 @@ var init_api = __esm({
4650
4707
  calendar: `${API_PREFIX}/calendar`,
4651
4708
  goals: `${API_PREFIX}/goals`,
4652
4709
  approvals: `${API_PREFIX}/approvals`,
4710
+ requests: `${API_PREFIX}/requests`,
4653
4711
  secrets: `${API_PREFIX}/secrets`,
4654
4712
  costs: `${API_PREFIX}/costs`,
4655
4713
  activity: `${API_PREFIX}/activity`,
@@ -4780,34 +4838,34 @@ var init_issue_activity = __esm({
4780
4838
  });
4781
4839
 
4782
4840
  // ../packages/shared/dist/config-schema.js
4783
- import { z as z36 } from "zod";
4841
+ import { z as z37 } from "zod";
4784
4842
  var DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES, configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, rudderConfigSchema;
4785
4843
  var init_config_schema = __esm({
4786
4844
  "../packages/shared/dist/config-schema.js"() {
4787
4845
  "use strict";
4788
4846
  init_constants();
4789
4847
  DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES = 256 * 1024 * 1024;
4790
- configMetaSchema = z36.object({
4791
- version: z36.literal(1),
4792
- updatedAt: z36.string(),
4793
- source: z36.enum(["onboard", "configure", "doctor"])
4848
+ configMetaSchema = z37.object({
4849
+ version: z37.literal(1),
4850
+ updatedAt: z37.string(),
4851
+ source: z37.enum(["onboard", "configure", "doctor"])
4794
4852
  });
4795
- llmConfigSchema = z36.object({
4796
- provider: z36.enum(["claude", "openai"]),
4797
- apiKey: z36.string().optional()
4853
+ llmConfigSchema = z37.object({
4854
+ provider: z37.enum(["claude", "openai"]),
4855
+ apiKey: z37.string().optional()
4798
4856
  });
4799
- databaseBackupConfigSchema = z36.object({
4800
- enabled: z36.boolean().default(true),
4801
- intervalMinutes: z36.number().int().min(1).max(7 * 24 * 60).default(60),
4802
- retentionDays: z36.number().int().min(1).max(3650).default(30),
4803
- maxEstimatedBytes: z36.number().int().min(1).default(DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES),
4804
- dir: z36.string().default("~/.rudder/instances/default/data/backups")
4857
+ databaseBackupConfigSchema = z37.object({
4858
+ enabled: z37.boolean().default(true),
4859
+ intervalMinutes: z37.number().int().min(1).max(7 * 24 * 60).default(60),
4860
+ retentionDays: z37.number().int().min(1).max(3650).default(30),
4861
+ maxEstimatedBytes: z37.number().int().min(1).default(DEFAULT_DATABASE_BACKUP_MAX_ESTIMATED_BYTES),
4862
+ dir: z37.string().default("~/.rudder/instances/default/data/backups")
4805
4863
  });
4806
- databaseConfigSchema = z36.object({
4807
- mode: z36.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
4808
- connectionString: z36.string().optional(),
4809
- embeddedPostgresDataDir: z36.string().default("~/.rudder/instances/default/db"),
4810
- embeddedPostgresPort: z36.number().int().min(1).max(65535).default(54329),
4864
+ databaseConfigSchema = z37.object({
4865
+ mode: z37.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
4866
+ connectionString: z37.string().optional(),
4867
+ embeddedPostgresDataDir: z37.string().default("~/.rudder/instances/default/db"),
4868
+ embeddedPostgresPort: z37.number().int().min(1).max(65535).default(54329),
4811
4869
  backup: databaseBackupConfigSchema.default({
4812
4870
  enabled: true,
4813
4871
  intervalMinutes: 60,
@@ -4816,35 +4874,35 @@ var init_config_schema = __esm({
4816
4874
  dir: "~/.rudder/instances/default/data/backups"
4817
4875
  })
4818
4876
  });
4819
- loggingConfigSchema = z36.object({
4820
- mode: z36.enum(["file", "cloud"]),
4821
- logDir: z36.string().default("~/.rudder/instances/default/logs")
4877
+ loggingConfigSchema = z37.object({
4878
+ mode: z37.enum(["file", "cloud"]),
4879
+ logDir: z37.string().default("~/.rudder/instances/default/logs")
4822
4880
  });
4823
- serverConfigSchema = z36.object({
4824
- deploymentMode: z36.enum(DEPLOYMENT_MODES).default("local_trusted"),
4825
- exposure: z36.enum(DEPLOYMENT_EXPOSURES).default("private"),
4826
- host: z36.string().default("127.0.0.1"),
4827
- port: z36.number().int().min(1).max(65535).default(3100),
4828
- allowedHostnames: z36.array(z36.string().min(1)).default([]),
4829
- serveUi: z36.boolean().default(true)
4881
+ serverConfigSchema = z37.object({
4882
+ deploymentMode: z37.enum(DEPLOYMENT_MODES).default("local_trusted"),
4883
+ exposure: z37.enum(DEPLOYMENT_EXPOSURES).default("private"),
4884
+ host: z37.string().default("127.0.0.1"),
4885
+ port: z37.number().int().min(1).max(65535).default(3100),
4886
+ allowedHostnames: z37.array(z37.string().min(1)).default([]),
4887
+ serveUi: z37.boolean().default(true)
4830
4888
  });
4831
- authConfigSchema = z36.object({
4832
- baseUrlMode: z36.enum(AUTH_BASE_URL_MODES).default("auto"),
4833
- publicBaseUrl: z36.string().url().optional(),
4834
- disableSignUp: z36.boolean().default(false)
4889
+ authConfigSchema = z37.object({
4890
+ baseUrlMode: z37.enum(AUTH_BASE_URL_MODES).default("auto"),
4891
+ publicBaseUrl: z37.string().url().optional(),
4892
+ disableSignUp: z37.boolean().default(false)
4835
4893
  });
4836
- storageLocalDiskConfigSchema = z36.object({
4837
- baseDir: z36.string().default("~/.rudder/instances/default/data/storage")
4894
+ storageLocalDiskConfigSchema = z37.object({
4895
+ baseDir: z37.string().default("~/.rudder/instances/default/data/storage")
4838
4896
  });
4839
- storageS3ConfigSchema = z36.object({
4840
- bucket: z36.string().min(1).default("rudder"),
4841
- region: z36.string().min(1).default("us-east-1"),
4842
- endpoint: z36.string().optional(),
4843
- prefix: z36.string().default(""),
4844
- forcePathStyle: z36.boolean().default(false)
4897
+ storageS3ConfigSchema = z37.object({
4898
+ bucket: z37.string().min(1).default("rudder"),
4899
+ region: z37.string().min(1).default("us-east-1"),
4900
+ endpoint: z37.string().optional(),
4901
+ prefix: z37.string().default(""),
4902
+ forcePathStyle: z37.boolean().default(false)
4845
4903
  });
4846
- storageConfigSchema = z36.object({
4847
- provider: z36.enum(STORAGE_PROVIDERS).default("local_disk"),
4904
+ storageConfigSchema = z37.object({
4905
+ provider: z37.enum(STORAGE_PROVIDERS).default("local_disk"),
4848
4906
  localDisk: storageLocalDiskConfigSchema.default({
4849
4907
  baseDir: "~/.rudder/instances/default/data/storage"
4850
4908
  }),
@@ -4855,17 +4913,17 @@ var init_config_schema = __esm({
4855
4913
  forcePathStyle: false
4856
4914
  })
4857
4915
  });
4858
- secretsLocalEncryptedConfigSchema = z36.object({
4859
- keyFilePath: z36.string().default("~/.rudder/instances/default/secrets/master.key")
4916
+ secretsLocalEncryptedConfigSchema = z37.object({
4917
+ keyFilePath: z37.string().default("~/.rudder/instances/default/secrets/master.key")
4860
4918
  });
4861
- secretsConfigSchema = z36.object({
4862
- provider: z36.enum(SECRET_PROVIDERS).default("local_encrypted"),
4863
- strictMode: z36.boolean().default(false),
4919
+ secretsConfigSchema = z37.object({
4920
+ provider: z37.enum(SECRET_PROVIDERS).default("local_encrypted"),
4921
+ strictMode: z37.boolean().default(false),
4864
4922
  localEncrypted: secretsLocalEncryptedConfigSchema.default({
4865
4923
  keyFilePath: "~/.rudder/instances/default/secrets/master.key"
4866
4924
  })
4867
4925
  });
4868
- rudderConfigSchema = z36.object({
4926
+ rudderConfigSchema = z37.object({
4869
4927
  $meta: configMetaSchema,
4870
4928
  llm: llmConfigSchema.optional(),
4871
4929
  database: databaseConfigSchema,
@@ -4898,7 +4956,7 @@ var init_config_schema = __esm({
4898
4956
  if (value.server.deploymentMode === "local_trusted") {
4899
4957
  if (value.server.exposure !== "private") {
4900
4958
  ctx.addIssue({
4901
- code: z36.ZodIssueCode.custom,
4959
+ code: z37.ZodIssueCode.custom,
4902
4960
  message: "server.exposure must be private when deploymentMode is local_trusted",
4903
4961
  path: ["server", "exposure"]
4904
4962
  });
@@ -4907,21 +4965,21 @@ var init_config_schema = __esm({
4907
4965
  }
4908
4966
  if (value.auth.baseUrlMode === "explicit" && !value.auth.publicBaseUrl) {
4909
4967
  ctx.addIssue({
4910
- code: z36.ZodIssueCode.custom,
4968
+ code: z37.ZodIssueCode.custom,
4911
4969
  message: "auth.publicBaseUrl is required when auth.baseUrlMode is explicit",
4912
4970
  path: ["auth", "publicBaseUrl"]
4913
4971
  });
4914
4972
  }
4915
4973
  if (value.server.exposure === "public" && value.auth.baseUrlMode !== "explicit") {
4916
4974
  ctx.addIssue({
4917
- code: z36.ZodIssueCode.custom,
4975
+ code: z37.ZodIssueCode.custom,
4918
4976
  message: "auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",
4919
4977
  path: ["auth", "baseUrlMode"]
4920
4978
  });
4921
4979
  }
4922
4980
  if (value.server.exposure === "public" && !value.auth.publicBaseUrl) {
4923
4981
  ctx.addIssue({
4924
- code: z36.ZodIssueCode.custom,
4982
+ code: z37.ZodIssueCode.custom,
4925
4983
  message: "auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",
4926
4984
  path: ["auth", "publicBaseUrl"]
4927
4985
  });
@@ -4965,6 +5023,7 @@ var init_dist = __esm({
4965
5023
  init_project_url_key();
4966
5024
  init_short_refs();
4967
5025
  init_token_usage();
5026
+ init_request();
4968
5027
  init_chat_transcript_visibility();
4969
5028
  init_issue_activity();
4970
5029
  init_config_schema();
@@ -9197,6 +9256,51 @@ var RUDDER_MCP_TOOL_DESCRIPTORS = [
9197
9256
  "requiresAgentId": false,
9198
9257
  "attachesRunIdWhenAvailable": true
9199
9258
  },
9259
+ {
9260
+ "capabilityId": "goal.list",
9261
+ "name": "rudder_goal_list",
9262
+ "description": "Discover Goals owned by the authenticated Agent; defaults to active Goals and returns current progress, next step, and attention state.",
9263
+ "mutating": false,
9264
+ "requiresOrgId": true,
9265
+ "requiresAgentId": true,
9266
+ "attachesRunIdWhenAvailable": false
9267
+ },
9268
+ {
9269
+ "capabilityId": "goal.context",
9270
+ "name": "rudder_goal_context",
9271
+ "description": "Read the owned Goal agreement and current operating context before acting: contract revision, criteria, boundaries, progress, next step, attention, proposals, and recent feedback.",
9272
+ "mutating": false,
9273
+ "requiresOrgId": false,
9274
+ "requiresAgentId": true,
9275
+ "attachesRunIdWhenAvailable": false
9276
+ },
9277
+ {
9278
+ "capabilityId": "goal.progress",
9279
+ "name": "rudder_goal_progress",
9280
+ "description": "Record evidence-backed progress for a Goal owned by the authenticated Agent and attribute it to the current Run.",
9281
+ "mutating": true,
9282
+ "requiresOrgId": false,
9283
+ "requiresAgentId": true,
9284
+ "attachesRunIdWhenAvailable": true
9285
+ },
9286
+ {
9287
+ "capabilityId": "goal.change.propose",
9288
+ "name": "rudder_goal_change_propose",
9289
+ "description": "Propose a reviewable change to the current Goal contract when evidence shows its outcome, criteria, boundaries, or deadlines should change.",
9290
+ "mutating": true,
9291
+ "requiresOrgId": false,
9292
+ "requiresAgentId": true,
9293
+ "attachesRunIdWhenAvailable": true
9294
+ },
9295
+ {
9296
+ "capabilityId": "goal.result.propose",
9297
+ "name": "rudder_goal_result_propose",
9298
+ "description": "Submit an evidence-backed Goal result for mandatory human acceptance without closing the Goal.",
9299
+ "mutating": true,
9300
+ "requiresOrgId": false,
9301
+ "requiresAgentId": true,
9302
+ "attachesRunIdWhenAvailable": true
9303
+ },
9200
9304
  {
9201
9305
  "capabilityId": "issue.get",
9202
9306
  "name": "rudder_issue_get",
@@ -9308,7 +9412,7 @@ var RUDDER_MCP_TOOL_DESCRIPTORS = [
9308
9412
  {
9309
9413
  "capabilityId": "issue.block",
9310
9414
  "name": "rudder_issue_block",
9311
- "description": "Mark an issue blocked with a required blocker comment, optionally uploading images.",
9415
+ "description": "Request human assistance after bounded recovery attempts; repeated matching claims are audited before the Issue becomes blocked.",
9312
9416
  "mutating": true,
9313
9417
  "requiresOrgId": false,
9314
9418
  "requiresAgentId": false,
@@ -10225,6 +10329,7 @@ function coreMcpInputSchema(id) {
10225
10329
  ...required.length > 0 ? { required } : {}
10226
10330
  });
10227
10331
  const issue = string("Issue UUID, identifier, or short reference.", { maxLength: 200 });
10332
+ const goal = string("Goal UUID from the current Goal Runtime Context.", { maxLength: 200 });
10228
10333
  const project = string("Project UUID or shortname.", { maxLength: 200 });
10229
10334
  const approval = string("Approval UUID or short reference.", { maxLength: 200 });
10230
10335
  const automation = string("Automation UUID or short reference.", { maxLength: 200 });
@@ -10265,6 +10370,120 @@ function coreMcpInputSchema(id) {
10265
10370
  return schema({ selectionRefs: strings("Skill selection references.", 100) }, ["selectionRefs"]);
10266
10371
  case "agent.skills.sync":
10267
10372
  return schema({ desiredSkills: string("Comma-separated desired skill references.", { maxLength: 2e4 }) }, ["desiredSkills"]);
10373
+ case "goal.list":
10374
+ return schema({
10375
+ lifecycle: string("Goal lifecycle filter; active is the safe default.", {
10376
+ enum: ["draft", "active", "closed", "all"],
10377
+ maxLength: 20
10378
+ }),
10379
+ focus: boolean("Filter by whether the Goal is the organization Focus Goal."),
10380
+ facet: string("Current Goal workspace facet.", {
10381
+ enum: ["agent_advancing", "needs_attention", "waiting_focus", "waiting_external", "ready_for_acceptance", "closed"],
10382
+ maxLength: 40
10383
+ }),
10384
+ limit: number("Maximum owned Goals to return.", 1, 100)
10385
+ });
10386
+ case "goal.context":
10387
+ return schema({ goal: string("Goal UUID returned by rudder_goal_list.", { maxLength: 200 }) }, ["goal"]);
10388
+ case "goal.progress":
10389
+ return schema({
10390
+ goal,
10391
+ summary: string("Plain-language progress, observed change, or named blocker."),
10392
+ activityKind: string("Progress classification.", { enum: ["progress", "evidence", "bottleneck"], maxLength: 30 }),
10393
+ evidenceRefs: {
10394
+ type: "array",
10395
+ description: "URI-like references to artifacts, measurements, or other supporting evidence.",
10396
+ minItems: 1,
10397
+ maxItems: 100,
10398
+ items: string("URI-like evidence reference.", { maxLength: 8192 })
10399
+ },
10400
+ idempotencyKey: string("Stable key for safe retry.", { maxLength: 500 })
10401
+ }, ["goal", "summary", "evidenceRefs", "idempotencyKey"]);
10402
+ case "goal.change.propose":
10403
+ return schema({
10404
+ goal,
10405
+ contractRevision: number("Current Goal contract revision.", 1, 1e9),
10406
+ afterContract: {
10407
+ type: "object",
10408
+ description: "Only the Goal contract fields that should change.",
10409
+ additionalProperties: false,
10410
+ minProperties: 1,
10411
+ properties: {
10412
+ outcomeStatement: string("Proposed result-oriented outcome."),
10413
+ objectiveMode: string("Proposed objective mode.", {
10414
+ enum: ["target", "maximize", "maintain", "decide"],
10415
+ maxLength: 20
10416
+ }),
10417
+ criteria: {
10418
+ type: "array",
10419
+ minItems: 1,
10420
+ maxItems: 100,
10421
+ items: schema({
10422
+ id: string("Stable criterion id.", { maxLength: 500 }),
10423
+ label: string("Plain-language success criterion."),
10424
+ evaluator: string("Criterion evaluator.", {
10425
+ enum: ["artifact", "metric", "policy", "human"],
10426
+ maxLength: 20
10427
+ }),
10428
+ evidenceRequirements: {
10429
+ type: "array",
10430
+ maxItems: 100,
10431
+ items: string("URI-like required evidence reference.", { maxLength: 8192 })
10432
+ }
10433
+ }, ["id", "label", "evaluator"])
10434
+ },
10435
+ autonomyEnvelope: { type: "object", additionalProperties: true },
10436
+ humanAuthorities: { type: "object", additionalProperties: true },
10437
+ evaluationPolicy: { type: "object", additionalProperties: true },
10438
+ actionDeadline: {
10439
+ description: "Proposed ISO-8601 action deadline, or null to clear it.",
10440
+ oneOf: [{ type: "string", format: "date-time" }, { type: "null" }]
10441
+ },
10442
+ evaluationDeadline: {
10443
+ description: "Proposed ISO-8601 evaluation deadline, or null to clear it.",
10444
+ oneOf: [{ type: "string", format: "date-time" }, { type: "null" }]
10445
+ }
10446
+ }
10447
+ },
10448
+ rationale: string("Why the current contract should change and what evidence invalidated it."),
10449
+ evidenceRefs: {
10450
+ type: "array",
10451
+ description: "URI-like references supporting the proposed change.",
10452
+ maxItems: 100,
10453
+ items: string("URI-like evidence reference.", { maxLength: 8192 })
10454
+ },
10455
+ idempotencyKey: string("Stable key for safe retry.", { maxLength: 500 })
10456
+ }, ["goal", "contractRevision", "afterContract", "rationale", "idempotencyKey"]);
10457
+ case "goal.result.propose":
10458
+ return schema({
10459
+ goal,
10460
+ contractRevision: number("Current Goal contract revision.", 1, 1e9),
10461
+ criteria: {
10462
+ type: "array",
10463
+ description: "Criterion outcomes for the current contract revision.",
10464
+ minItems: 1,
10465
+ maxItems: 100,
10466
+ items: schema({
10467
+ id: string("Criterion id from the Goal Runtime Context.", { maxLength: 500 }),
10468
+ status: string("Observed criterion status.", { enum: ["met", "unmet", "breached", "unknown"], maxLength: 20 })
10469
+ }, ["id", "status"])
10470
+ },
10471
+ evidenceRefs: {
10472
+ type: "array",
10473
+ description: "URI-like references supporting the proposed result.",
10474
+ minItems: 1,
10475
+ maxItems: 100,
10476
+ items: string("URI-like evidence reference.", { maxLength: 8192 })
10477
+ },
10478
+ resultValue: {
10479
+ description: "Optional measured result value.",
10480
+ oneOf: [{ type: "string", maxLength: 1e5 }, { type: "number" }, { type: "boolean" }]
10481
+ },
10482
+ decision: string("Optional decision reached for decide-mode Goals."),
10483
+ resultPayload: { type: "object", description: "Optional structured result details.", additionalProperties: true },
10484
+ riskSummary: string("Known risks, limitations, or remaining gaps."),
10485
+ idempotencyKey: string("Stable key for safe retry.", { maxLength: 500 })
10486
+ }, ["goal", "contractRevision", "criteria", "evidenceRefs", "riskSummary", "idempotencyKey"]);
10268
10487
  case "issue.list":
10269
10488
  return schema({
10270
10489
  status: string("Comma-separated issue statuses.", { maxLength: 500 }),
@@ -10806,6 +11025,66 @@ var AGENT_CLI_CAPABILITIES = [
10806
11025
  requiresRunId: false,
10807
11026
  attachesRunIdWhenAvailable: true
10808
11027
  },
11028
+ {
11029
+ id: "goal.list",
11030
+ command: "rudder goal list [--lifecycle <draft|active|closed|all>] [--focus <true|false>] [--facet <facet>] [--limit <n>]",
11031
+ category: "goal",
11032
+ description: "Discover Goals owned by the authenticated Agent; defaults to active Goals and returns current progress, next step, and attention state.",
11033
+ mutating: false,
11034
+ contract: "agent-v1",
11035
+ requiresOrgId: true,
11036
+ requiresAgentId: true,
11037
+ requiresRunId: false,
11038
+ attachesRunIdWhenAvailable: false
11039
+ },
11040
+ {
11041
+ id: "goal.context",
11042
+ command: "rudder goal context <goal-id>",
11043
+ category: "goal",
11044
+ description: "Read the owned Goal agreement and current operating context before acting: contract revision, criteria, boundaries, progress, next step, attention, proposals, and recent feedback.",
11045
+ mutating: false,
11046
+ contract: "agent-v1",
11047
+ requiresOrgId: false,
11048
+ requiresAgentId: true,
11049
+ requiresRunId: false,
11050
+ attachesRunIdWhenAvailable: false
11051
+ },
11052
+ {
11053
+ id: "goal.progress",
11054
+ command: "rudder goal progress <goal-id> --summary <text> --evidence-refs <json> --idempotency-key <key>",
11055
+ category: "goal",
11056
+ description: "Record evidence-backed progress for a Goal owned by the authenticated Agent and attribute it to the current Run.",
11057
+ mutating: true,
11058
+ contract: "agent-v1",
11059
+ requiresOrgId: false,
11060
+ requiresAgentId: true,
11061
+ requiresRunId: true,
11062
+ attachesRunIdWhenAvailable: true
11063
+ },
11064
+ {
11065
+ id: "goal.change.propose",
11066
+ command: "rudder goal change propose <goal-id> --contract-revision <n> --after-contract <json> --rationale <text> --idempotency-key <key>",
11067
+ category: "goal",
11068
+ description: "Propose a reviewable change to the current Goal contract when evidence shows its outcome, criteria, boundaries, or deadlines should change.",
11069
+ mutating: true,
11070
+ contract: "agent-v1",
11071
+ requiresOrgId: false,
11072
+ requiresAgentId: true,
11073
+ requiresRunId: true,
11074
+ attachesRunIdWhenAvailable: true
11075
+ },
11076
+ {
11077
+ id: "goal.result.propose",
11078
+ command: "rudder goal result propose <goal-id> --contract-revision <n> --criteria <json> --evidence-refs <json> --risk-summary <text> --idempotency-key <key>",
11079
+ category: "goal",
11080
+ description: "Submit an evidence-backed Goal result for mandatory human acceptance without closing the Goal.",
11081
+ mutating: true,
11082
+ contract: "agent-v1",
11083
+ requiresOrgId: false,
11084
+ requiresAgentId: true,
11085
+ requiresRunId: true,
11086
+ attachesRunIdWhenAvailable: true
11087
+ },
10809
11088
  {
10810
11089
  id: "agent.hire",
10811
11090
  command: "rudder agent hire --org-id <id> --payload <json>",
@@ -11026,7 +11305,7 @@ var AGENT_CLI_CAPABILITIES = [
11026
11305
  id: "issue.block",
11027
11306
  command: "rudder issue block <issue> --comment-file <path> [--image <path>]",
11028
11307
  category: "issue",
11029
- description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
11308
+ description: "Request human assistance after bounded recovery attempts; repeated matching claims are audited before the Issue becomes blocked.",
11030
11309
  mutating: true,
11031
11310
  contract: "agent-v1",
11032
11311
  requiresOrgId: false,
@@ -11987,6 +12266,7 @@ var AGENT_CLI_CAPABILITIES = [
11987
12266
  // src/agent-v1-registry.ts
11988
12267
  var CATEGORY_TITLES = {
11989
12268
  agent: "Agent",
12269
+ goal: "Goal",
11990
12270
  issue: "Issue",
11991
12271
  project: "Project",
11992
12272
  automation: "Automation",
@@ -12277,6 +12557,10 @@ var LEGACY_ARGUMENT_ALIASES = {
12277
12557
  selections: "selectionRefs",
12278
12558
  skills: "selectionRefs"
12279
12559
  },
12560
+ "goal.context": { goalId: "goal" },
12561
+ "goal.progress": { goalId: "goal" },
12562
+ "goal.change.propose": { goalId: "goal" },
12563
+ "goal.result.propose": { goalId: "goal" },
12280
12564
  "issue.get": { issueId: "issue" },
12281
12565
  "issue.context": { issueId: "issue" },
12282
12566
  "issue.checkout": { issueId: "issue" },
@@ -12705,6 +12989,64 @@ async function callToolDirectlyIfSupported(toolName, rawArgs, env, signal) {
12705
12989
  return success(await api.get("/api/agents/me"));
12706
12990
  case "agent.inbox":
12707
12991
  return success(await api.get("/api/agents/me/inbox-lite"));
12992
+ case "goal.list": {
12993
+ const orgId = requiredRuntimeString(env, "RUDDER_ORG_ID");
12994
+ requiredRuntimeString(env, "RUDDER_AGENT_ID");
12995
+ const params = new URLSearchParams({
12996
+ lifecycle: optionalString(input.lifecycle) ?? "active",
12997
+ limit: String(parsePositiveInteger(input.limit, 20))
12998
+ });
12999
+ if (typeof input.focus === "boolean") params.set("focus", String(input.focus));
13000
+ appendOptionalQuery(params, "facet", input.facet);
13001
+ return success(await api.get(`/api/orgs/${encodeURIComponent(orgId)}/goals/assigned?${params}`));
13002
+ }
13003
+ case "goal.context":
13004
+ requiredRuntimeString(env, "RUDDER_AGENT_ID");
13005
+ return success(await api.get(
13006
+ `/api/goals/${encodeURIComponent(requiredAnyString(input, ["goal", "goalId"]))}/agent-context`
13007
+ ));
13008
+ case "goal.progress": {
13009
+ const payload = createGoalActivitySchema.parse({
13010
+ summary: requiredString(input, "summary"),
13011
+ activityKind: optionalString(input.activityKind) ?? "progress",
13012
+ evidenceRefs: input.evidenceRefs,
13013
+ idempotencyKey: requiredString(input, "idempotencyKey")
13014
+ });
13015
+ return success(await api.post(
13016
+ `/api/goals/${encodeURIComponent(requiredAnyString(input, ["goal", "goalId"]))}/activities`,
13017
+ payload
13018
+ ));
13019
+ }
13020
+ case "goal.change.propose": {
13021
+ const payload = createGoalChangeProposalSchema.parse({
13022
+ expectedContractRevision: input.contractRevision,
13023
+ afterContract: input.afterContract,
13024
+ rationale: requiredString(input, "rationale"),
13025
+ evidenceRefs: input.evidenceRefs,
13026
+ idempotencyKey: requiredString(input, "idempotencyKey")
13027
+ });
13028
+ return success(await api.post(
13029
+ `/api/goals/${encodeURIComponent(requiredAnyString(input, ["goal", "goalId"]))}/change-proposals`,
13030
+ payload
13031
+ ));
13032
+ }
13033
+ case "goal.result.propose": {
13034
+ const decision = optionalString(input.decision);
13035
+ const payload = createGoalResultProposalSchema.parse({
13036
+ contractRevision: input.contractRevision,
13037
+ criteria: input.criteria,
13038
+ evidenceRefs: input.evidenceRefs,
13039
+ resultValue: input.resultValue,
13040
+ ...decision ? { decision } : {},
13041
+ resultPayload: input.resultPayload,
13042
+ riskSummary: requiredString(input, "riskSummary"),
13043
+ idempotencyKey: requiredString(input, "idempotencyKey")
13044
+ });
13045
+ return success(await api.post(
13046
+ `/api/goals/${encodeURIComponent(requiredAnyString(input, ["goal", "goalId"]))}/result-proposals`,
13047
+ payload
13048
+ ));
13049
+ }
12708
13050
  case "issue.get":
12709
13051
  return success(await api.get(`/api/issues/${encodeURIComponent(requiredAnyString(input, ["issue", "issueId"]))}`));
12710
13052
  case "issue.context": {
@@ -13049,6 +13391,73 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
13049
13391
  pushOptional(args, "--desired-skills", input.desiredSkills);
13050
13392
  return args;
13051
13393
  }
13394
+ case "goal.list": {
13395
+ const args = ["goal", "list"];
13396
+ pushOptional(args, "--lifecycle", input.lifecycle ?? "active");
13397
+ if (typeof input.focus === "boolean") args.push("--focus", String(input.focus));
13398
+ pushOptional(args, "--facet", input.facet);
13399
+ if (input.limit !== void 0) args.push("--limit", String(input.limit));
13400
+ return args;
13401
+ }
13402
+ case "goal.context":
13403
+ return ["goal", "context", requiredAnyString(input, ["goal", "goalId"])];
13404
+ case "goal.progress": {
13405
+ const args = [
13406
+ "goal",
13407
+ "progress",
13408
+ requiredAnyString(input, ["goal", "goalId"]),
13409
+ "--summary",
13410
+ requiredString(input, "summary"),
13411
+ "--evidence-refs",
13412
+ JSON.stringify(input.evidenceRefs),
13413
+ "--idempotency-key",
13414
+ requiredString(input, "idempotencyKey")
13415
+ ];
13416
+ pushOptional(args, "--activity-kind", input.activityKind);
13417
+ return args;
13418
+ }
13419
+ case "goal.change.propose": {
13420
+ const args = [
13421
+ "goal",
13422
+ "change",
13423
+ "propose",
13424
+ requiredAnyString(input, ["goal", "goalId"]),
13425
+ "--contract-revision",
13426
+ String(input.contractRevision),
13427
+ "--after-contract",
13428
+ JSON.stringify(input.afterContract),
13429
+ "--rationale",
13430
+ requiredString(input, "rationale"),
13431
+ "--idempotency-key",
13432
+ requiredString(input, "idempotencyKey")
13433
+ ];
13434
+ if (input.evidenceRefs !== void 0) {
13435
+ args.push("--evidence-refs", JSON.stringify(input.evidenceRefs));
13436
+ }
13437
+ return args;
13438
+ }
13439
+ case "goal.result.propose": {
13440
+ const args = [
13441
+ "goal",
13442
+ "result",
13443
+ "propose",
13444
+ requiredAnyString(input, ["goal", "goalId"]),
13445
+ "--contract-revision",
13446
+ String(input.contractRevision),
13447
+ "--criteria",
13448
+ JSON.stringify(input.criteria),
13449
+ "--evidence-refs",
13450
+ JSON.stringify(input.evidenceRefs),
13451
+ "--risk-summary",
13452
+ requiredString(input, "riskSummary"),
13453
+ "--idempotency-key",
13454
+ requiredString(input, "idempotencyKey")
13455
+ ];
13456
+ if (input.resultValue !== void 0) args.push("--result-value", JSON.stringify(input.resultValue));
13457
+ pushOptional(args, "--decision", input.decision);
13458
+ if (input.resultPayload !== void 0) args.push("--result-payload", JSON.stringify(input.resultPayload));
13459
+ return args;
13460
+ }
13052
13461
  case "issue.get":
13053
13462
  return ["issue", "get", requiredAnyString(input, ["issue", "issueId"])];
13054
13463
  case "issue.list": {
@@ -14588,6 +14997,89 @@ function asString(value, fallback) {
14588
14997
  }
14589
14998
 
14590
14999
  // ../packages/agent-runtime-utils/dist/server-utils.prompts.js
15000
+ var RUDDER_GOAL_RUNTIME_BOUNDARY = `This is a Rudder product Goal, not a Codex internal goal. Do not call Codex \`create_goal\`, \`update_goal\`, or \`get_goal\` for it; those tools do not manage Rudder Goals. If the Goal packet names an exact managed Rudder tool, call that typed tool directly. Do not load \`rudder-docs\`, inspect skill files, or run discovery commands merely to confirm a tool that the packet already names. If the Rudder Goal context is missing or stale, report the named blocker and request refreshed context instead of using shell, Bash, curl, or the \`rudder\` CLI to retrieve it.
15001
+
15002
+ Record meaningful evidence-backed advancement with \`rudder_goal_progress\`; the tool automatically attributes progress to this Run. If evidence shows the Goal contract itself must change, use \`rudder_goal_change_propose\` so a human can review the exact delta; never silently redefine the outcome or boundaries. When the outcome is ready for review, use \`rudder_goal_result_propose\` with the current contract revision and supporting evidence. Do not use shell, Bash, curl, or the \`rudder\` CLI for these actions.
15003
+
15004
+ A human must accept every terminal Goal result. A Result Proposal requests acceptance; it does not let the runtime mark, close, or claim the Goal complete.`;
15005
+ var GOAL_STARTED_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). A Goal has started and you are responsible for advancing it.
15006
+
15007
+ {{context.rudderWorkspace.orgResourcesPrompt}}
15008
+
15009
+ ${RUDDER_GOAL_RUNTIME_BOUNDARY}
15010
+
15011
+ ## Goal Runtime Context
15012
+
15013
+ **Goal:** {{context.goalRuntime.goalTitle}}
15014
+ **Goal ID:** {{context.goalRuntime.goalId}}
15015
+
15016
+ **Goal outcome:**
15017
+ {{context.goalRuntime.goalOutcome}}
15018
+
15019
+ **Current contract:**
15020
+ {{context.goalRuntime.currentContract}}
15021
+
15022
+ **Continuation:**
15023
+ {{context.goalRuntime.continuation}}
15024
+
15025
+ Advance this Goal from the current contract and continuation. Preserve the stated outcome and contract boundaries; do not silently redefine them.`;
15026
+ var GOAL_FEEDBACK_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). New feedback requires your review on a Goal you own.
15027
+
15028
+ {{context.rudderWorkspace.orgResourcesPrompt}}
15029
+
15030
+ ${RUDDER_GOAL_RUNTIME_BOUNDARY}
15031
+
15032
+ ## Goal Runtime Context
15033
+
15034
+ **Goal:** {{context.goalRuntime.goalTitle}}
15035
+ **Goal ID:** {{context.goalRuntime.goalId}}
15036
+
15037
+ **Goal outcome:**
15038
+ {{context.goalRuntime.goalOutcome}}
15039
+
15040
+ **Current contract:**
15041
+ {{context.goalRuntime.currentContract}}
15042
+
15043
+ **Continuation:**
15044
+ {{context.goalRuntime.continuation}}
15045
+
15046
+ ## Goal Feedback
15047
+
15048
+ **Feedback ID:** {{context.goalRuntime.feedbackId}}
15049
+
15050
+ **Feedback body:**
15051
+ {{context.goalRuntime.feedbackBody}}
15052
+
15053
+ Review the feedback against the current Goal contract, then continue from the recorded continuation. Treat any outcome or contract change as an explicit proposal instead of silently changing the Goal.`;
15054
+ var GOAL_CHANGE_DECIDED_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). A human decided a proposed change to a Goal you own.
15055
+
15056
+ {{context.rudderWorkspace.orgResourcesPrompt}}
15057
+
15058
+ ${RUDDER_GOAL_RUNTIME_BOUNDARY}
15059
+
15060
+ ## Goal Runtime Context
15061
+
15062
+ **Goal:** {{context.goalRuntime.goalTitle}}
15063
+ **Goal ID:** {{context.goalRuntime.goalId}}
15064
+
15065
+ **Goal outcome:**
15066
+ {{context.goalRuntime.goalOutcome}}
15067
+
15068
+ **Current contract:**
15069
+ {{context.goalRuntime.currentContract}}
15070
+
15071
+ **Continuation:**
15072
+ {{context.goalRuntime.continuation}}
15073
+
15074
+ ## Goal Change Decision
15075
+
15076
+ **Decision:** {{context.goalRuntime.decision}}
15077
+ **Decision status:** {{context.goalRuntime.decisionStatus}}
15078
+
15079
+ **Decision note:**
15080
+ {{context.goalRuntime.decisionNote}}
15081
+
15082
+ Continue from the current Goal contract and this human decision. Do not apply a rejected change or silently reinterpret the decision.`;
14591
15083
  var ISSUE_ASSIGNEE_EXECUTION_RAIL = "Before doing issue-scoped execution as the assignee, check out the assigned issue. If checkout returns `409`, do not retry; stop and report the ownership conflict.";
14592
15084
  var ISSUE_ASSIGN_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). You have been assigned to work on an issue.
14593
15085
 
@@ -14800,7 +15292,7 @@ var RUDDER_AGENT_HEARTBEAT_INSTRUCTION = [
14800
15292
  "4. Inspect your Rudder inbox. Prioritize reviewer rows in `in_review` or `blocked`, then assignee `in_progress`, then assignee `todo`. Do not look for unassigned work.",
14801
15293
  "5. For mention wakes, read the wake comment before acting. Mentions request attention; they do not transfer ownership unless the comment explicitly says so. If the issue is not assigned to you, including user-owned or unassigned issues, and the comment does not explicitly ask you to implement, modify files, close the issue, or take ownership, respond to the comment itself instead of executing the whole issue.",
14802
15294
  "6. Load compact issue context, do one bounded useful chunk, and preserve evidence.",
14803
- "7. Before exiting active work, leave exactly one durable signal: progress, done, blocked, explicit handoff, or structured review decision.",
15295
+ "7. Complete the real task. When an action fails, investigate and try a bounded materially different recovery path before requesting human help. Before exiting active work, leave exactly one durable signal: progress, done, a blocker claim with the exact human input/action required, explicit handoff, or structured review decision. Rudder audits repeated blocker claims; the first claim does not directly establish a blocked Issue.",
14804
15296
  "8. Treat passive follow-up as issue follow-up, not a fresh assignment.",
14805
15297
  "9. Treat review close-out follow-up as review follow-up; free-form accept/reject text is not a durable decision.",
14806
15298
  "",
@@ -17801,6 +18293,124 @@ function registerDashboardCommands(program) {
17801
18293
  );
17802
18294
  }
17803
18295
 
18296
+ // src/commands/client/goal.ts
18297
+ init_dist();
18298
+ function registerGoalCommands(program) {
18299
+ const goal = program.command("goal").description("Goal Owner runtime operations");
18300
+ addCommonClientOptions(
18301
+ goal.command("list").description(getAgentCliCapabilityById("goal.list").description).option("--lifecycle <state>", "draft, active, closed, or all", "active").option("--focus <true|false>", "Filter by organization Focus state").option("--facet <facet>", "Filter by current workspace attention facet").option("--limit <n>", "Maximum Goals to return (1-100)", "20").action(async (opts) => {
18302
+ try {
18303
+ const ctx = resolveCommandContext(opts, { requireCompany: true });
18304
+ if (!ctx.agentId) throw new Error("Agent ID is required. Set RUDDER_AGENT_ID.");
18305
+ const params = new URLSearchParams({
18306
+ lifecycle: opts.lifecycle,
18307
+ limit: opts.limit
18308
+ });
18309
+ if (opts.focus !== void 0) params.set("focus", opts.focus);
18310
+ if (opts.facet) params.set("facet", opts.facet);
18311
+ const response = await ctx.api.get(`/api/orgs/${ctx.orgId}/goals/assigned?${params}`);
18312
+ printOutput(response, { json: ctx.json });
18313
+ } catch (err) {
18314
+ handleCommandError(err);
18315
+ }
18316
+ }),
18317
+ { includeCompany: true }
18318
+ );
18319
+ addCommonClientOptions(
18320
+ goal.command("context").description(getAgentCliCapabilityById("goal.context").description).argument("<goalId>", "Goal ID returned by goal list").action(async (goalId, opts) => {
18321
+ try {
18322
+ const ctx = resolveCommandContext(opts);
18323
+ if (!ctx.agentId) throw new Error("Agent ID is required. Set RUDDER_AGENT_ID.");
18324
+ const response = await ctx.api.get(`/api/goals/${goalId}/agent-context`);
18325
+ printOutput(response, { json: ctx.json });
18326
+ } catch (err) {
18327
+ handleCommandError(err);
18328
+ }
18329
+ })
18330
+ );
18331
+ addCommonClientOptions(
18332
+ goal.command("progress").description(getAgentCliCapabilityById("goal.progress").description).argument("<goalId>", "Goal ID from the current Goal Runtime Context").requiredOption("--summary <text>", "Plain-language progress summary").option("--activity-kind <kind>", "progress, evidence, or bottleneck", "progress").requiredOption("--evidence-refs <json>", "JSON array of URI-like evidence references").requiredOption("--idempotency-key <key>", "Stable key for safe retry").action(async (goalId, opts) => {
18333
+ try {
18334
+ const ctx = resolveCommandContext(opts);
18335
+ const payload = createGoalActivitySchema.parse({
18336
+ summary: opts.summary,
18337
+ activityKind: opts.activityKind,
18338
+ evidenceRefs: parseJsonArray(opts.evidenceRefs, "evidence refs"),
18339
+ idempotencyKey: opts.idempotencyKey
18340
+ });
18341
+ const activity = await ctx.api.post(`/api/goals/${goalId}/activities`, payload);
18342
+ printOutput(activity, { json: ctx.json });
18343
+ } catch (err) {
18344
+ handleCommandError(err);
18345
+ }
18346
+ })
18347
+ );
18348
+ const change = goal.command("change").description("Goal contract change operations");
18349
+ addCommonClientOptions(
18350
+ change.command("propose").description(getAgentCliCapabilityById("goal.change.propose").description).argument("<goalId>", "Goal ID from the current Goal Runtime Context").requiredOption("--contract-revision <n>", "Current Goal contract revision").requiredOption("--after-contract <json>", "JSON object containing only proposed contract field changes").requiredOption("--rationale <text>", "Why the current Goal contract should change").option("--evidence-refs <json>", "JSON array of URI-like evidence references", "[]").requiredOption("--idempotency-key <key>", "Stable key for safe retry").action(async (goalId, opts) => {
18351
+ try {
18352
+ const ctx = resolveCommandContext(opts);
18353
+ const payload = createGoalChangeProposalSchema.parse({
18354
+ expectedContractRevision: Number(opts.contractRevision),
18355
+ afterContract: parseJsonObject3(opts.afterContract, "after contract"),
18356
+ rationale: opts.rationale,
18357
+ evidenceRefs: parseJsonArray(opts.evidenceRefs ?? "[]", "evidence refs"),
18358
+ idempotencyKey: opts.idempotencyKey
18359
+ });
18360
+ const proposal = await ctx.api.post(`/api/goals/${goalId}/change-proposals`, payload);
18361
+ printOutput(proposal, { json: ctx.json });
18362
+ } catch (err) {
18363
+ handleCommandError(err);
18364
+ }
18365
+ })
18366
+ );
18367
+ const result = goal.command("result").description("Goal result operations");
18368
+ addCommonClientOptions(
18369
+ result.command("propose").description(getAgentCliCapabilityById("goal.result.propose").description).argument("<goalId>", "Goal ID from the current Goal Runtime Context").requiredOption("--contract-revision <n>", "Current Goal contract revision").requiredOption("--criteria <json>", "JSON array of criterion id/status objects").requiredOption("--evidence-refs <json>", "JSON array of URI-like evidence references").option("--result-value <json-or-text>", "Optional measured result value").option("--decision <text>", "Optional decision for decide-mode Goals").option("--result-payload <json>", "Optional structured result details").requiredOption("--risk-summary <text>", "Known risks, limitations, or remaining gaps").requiredOption("--idempotency-key <key>", "Stable key for safe retry").action(async (goalId, opts) => {
18370
+ try {
18371
+ const ctx = resolveCommandContext(opts);
18372
+ const payload = createGoalResultProposalSchema.parse({
18373
+ contractRevision: Number(opts.contractRevision),
18374
+ criteria: parseJsonArray(opts.criteria, "criteria"),
18375
+ evidenceRefs: parseJsonArray(opts.evidenceRefs, "evidence refs"),
18376
+ ...opts.resultValue !== void 0 ? { resultValue: parseResultValue(opts.resultValue) } : {},
18377
+ ...opts.decision !== void 0 ? { decision: opts.decision } : {},
18378
+ ...opts.resultPayload !== void 0 ? { resultPayload: parseJsonObject3(opts.resultPayload, "result payload") } : {},
18379
+ riskSummary: opts.riskSummary,
18380
+ idempotencyKey: opts.idempotencyKey
18381
+ });
18382
+ const proposal = await ctx.api.post(`/api/goals/${goalId}/result-proposals`, payload);
18383
+ printOutput(proposal, { json: ctx.json });
18384
+ } catch (err) {
18385
+ handleCommandError(err);
18386
+ }
18387
+ })
18388
+ );
18389
+ }
18390
+ function parseJsonArray(value, label) {
18391
+ const parsed = JSON.parse(value);
18392
+ if (!Array.isArray(parsed)) throw new Error(`${label} must be a JSON array`);
18393
+ return parsed;
18394
+ }
18395
+ function parseJsonObject3(value, label) {
18396
+ const parsed = JSON.parse(value);
18397
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
18398
+ throw new Error(`${label} must be a JSON object`);
18399
+ }
18400
+ return parsed;
18401
+ }
18402
+ function parseResultValue(value) {
18403
+ try {
18404
+ const parsed = JSON.parse(value);
18405
+ if (typeof parsed === "string" || typeof parsed === "number" || typeof parsed === "boolean") {
18406
+ return parsed;
18407
+ }
18408
+ } catch {
18409
+ return value;
18410
+ }
18411
+ throw new Error("result value must be a string, number, or boolean");
18412
+ }
18413
+
17804
18414
  // src/commands/client/issue.ts
17805
18415
  init_dist();
17806
18416
  import { readFile as readFile4, stat as stat4 } from "node:fs/promises";
@@ -20079,7 +20689,7 @@ import * as p15 from "@clack/prompts";
20079
20689
  import { spawn as spawn3, spawnSync as spawnSync4 } from "node:child_process";
20080
20690
  import { createHash as createHash2, randomUUID } from "node:crypto";
20081
20691
  import { createWriteStream, constants as fsConstants, mkdirSync, readFileSync as readFileSync2 } from "node:fs";
20082
- import { access, chmod, copyFile as copyFile2, cp as cp2, mkdir as mkdir4, mkdtemp as mkdtemp2, readdir as readdir3, readFile as readFile6, rm as rm2, stat as stat5, utimes, writeFile as writeFile3 } from "node:fs/promises";
20692
+ import { access, chmod, copyFile as copyFile2, cp as cp2, lstat, mkdir as mkdir4, mkdtemp as mkdtemp2, readdir as readdir3, readFile as readFile6, rm as rm2, stat as stat5, utimes, writeFile as writeFile3 } from "node:fs/promises";
20083
20693
  import { homedir, tmpdir } from "node:os";
20084
20694
  import path22 from "node:path";
20085
20695
  import { Readable, Transform } from "node:stream";
@@ -21427,6 +22037,21 @@ async function startCommand(opts) {
21427
22037
  const version = opts.targetVersion?.trim() || opts.version?.trim() || resolveCurrentCliVersion();
21428
22038
  const dryRun = opts.dryRun === true;
21429
22039
  const desktopProgressJson = opts.desktopProgressJson === true;
22040
+ const exactDesktopAssetPath = opts.desktopAssetPath?.trim() || null;
22041
+ const exactDesktopAssetChecksum = opts.desktopAssetChecksum?.trim() || null;
22042
+ const exactDesktopAssetName = opts.desktopAssetName?.trim() || null;
22043
+ const exactDesktopReleaseDigest = opts.desktopReleaseDigest?.trim() || null;
22044
+ if (exactDesktopAssetPath || exactDesktopAssetChecksum || exactDesktopAssetName || exactDesktopReleaseDigest) {
22045
+ if (!exactDesktopAssetPath || !exactDesktopAssetChecksum || !exactDesktopAssetName || !exactDesktopReleaseDigest) {
22046
+ throw new Error("Exact Desktop asset mode requires path, checksum, asset name, and release digest.");
22047
+ }
22048
+ if (!path22.isAbsolute(exactDesktopAssetPath) || exactDesktopAssetName.includes("/") || !/^[a-f0-9]{64}$/iu.test(exactDesktopAssetChecksum) || !/^[a-f0-9]{64}$/iu.test(exactDesktopReleaseDigest)) {
22049
+ throw new Error("Exact Desktop asset mode received invalid candidate identity.");
22050
+ }
22051
+ if (opts.desktopAssetKind && opts.desktopAssetKind !== "full" && opts.desktopAssetKind !== "shell") {
22052
+ throw new Error("Exact Desktop asset mode received an invalid asset kind.");
22053
+ }
22054
+ }
21430
22055
  let runtimeSupportsShellAssets = false;
21431
22056
  if (desktopProgressJson) {
21432
22057
  process.stdout.on("error", (error) => {
@@ -21513,49 +22138,86 @@ async function startCommand(opts) {
21513
22138
  return;
21514
22139
  }
21515
22140
  await withDesktopInstallLock(installPaths, async () => {
21516
- const directReleaseVersion = resolveDesktopReleaseVersion(tag);
21517
22141
  const progressFactory = desktopProgressJson ? createDesktopProgressFactory() : createByteProgress;
21518
- let release = null;
21519
- try {
21520
- release = await runStartPhase(
21521
- "Resolving Desktop release...",
21522
- "Desktop release resolved.",
21523
- () => fetchGithubRelease(repo, tag),
21524
- desktopProgressJson ? "resolving_release" : null
21525
- );
21526
- } catch (error) {
21527
- if (!directReleaseVersion) throw error;
21528
- p15.log.warn(
21529
- `Desktop release metadata could not be resolved; falling back to deterministic download URLs. ${formatFetchError(error)}`
22142
+ let releaseTag;
22143
+ let selectedAsset;
22144
+ let selectedAssetKind;
22145
+ let expectedChecksum;
22146
+ let cachedAsset = null;
22147
+ let assetCandidates = [];
22148
+ let checksums = /* @__PURE__ */ new Map();
22149
+ if (exactDesktopAssetPath) {
22150
+ releaseTag = tag;
22151
+ selectedAsset = {
22152
+ name: exactDesktopAssetName,
22153
+ browser_download_url: ""
22154
+ };
22155
+ selectedAssetKind = opts.desktopAssetKind ?? "full";
22156
+ expectedChecksum = normalizeDesktopAssetChecksum(exactDesktopAssetChecksum);
22157
+ const computedReleaseDigest = createHash2("sha256").update(JSON.stringify({
22158
+ releaseTag,
22159
+ assetName: selectedAsset.name,
22160
+ assetChecksum: expectedChecksum,
22161
+ assetKind: selectedAssetKind,
22162
+ platform: target.platform,
22163
+ arch: target.arch
22164
+ })).digest("hex");
22165
+ if (computedReleaseDigest !== exactDesktopReleaseDigest.toLowerCase()) {
22166
+ throw new Error("Exact Desktop asset release digest does not match the candidate identity.");
22167
+ }
22168
+ const descriptor = await stat5(exactDesktopAssetPath);
22169
+ if (!descriptor.isFile()) throw new Error("Exact Desktop asset must be a regular file.");
22170
+ const linkDescriptor = await lstat(exactDesktopAssetPath);
22171
+ if (linkDescriptor.isSymbolicLink()) throw new Error("Exact Desktop asset must not be a symbolic link.");
22172
+ const checksum = await runStartPhase(
22173
+ "Verifying staged Desktop checksum...",
22174
+ `Verified ${pc14.cyan(path22.basename(exactDesktopAssetPath))}.`,
22175
+ () => assertChecksumMatch(exactDesktopAssetPath, expectedChecksum),
22176
+ desktopProgressJson ? "verifying_checksum" : null
21530
22177
  );
22178
+ cachedAsset = { path: exactDesktopAssetPath, checksum, cacheStatus: "hit" };
22179
+ } else {
22180
+ const directReleaseVersion = resolveDesktopReleaseVersion(tag);
22181
+ let release = null;
22182
+ try {
22183
+ release = await runStartPhase(
22184
+ "Resolving Desktop release...",
22185
+ "Desktop release resolved.",
22186
+ () => fetchGithubRelease(repo, tag),
22187
+ desktopProgressJson ? "resolving_release" : null
22188
+ );
22189
+ } catch (error) {
22190
+ if (!directReleaseVersion) throw error;
22191
+ p15.log.warn(
22192
+ `Desktop release metadata could not be resolved; falling back to deterministic download URLs. ${formatFetchError(error)}`
22193
+ );
22194
+ }
22195
+ releaseTag = release?.tag_name ?? (directReleaseVersion ? tag : "");
22196
+ if (!releaseTag) throw new Error(`Unable to resolve Rudder Desktop release tag for ${repo}@${tag}.`);
22197
+ assetCandidates = resolveDesktopAssetCandidates({
22198
+ releaseAssets: release?.assets ?? [],
22199
+ target,
22200
+ repo,
22201
+ tag,
22202
+ directReleaseVersion,
22203
+ allowShellAssets: runtimeSupportsShellAssets
22204
+ });
22205
+ if (assetCandidates.length === 0) {
22206
+ throw new Error(`No Rudder Desktop portable asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
22207
+ }
22208
+ const checksumAsset = selectChecksumAsset(release?.assets ?? []) ?? (directReleaseVersion ? buildGithubReleaseAsset(repo, tag, DESKTOP_CHECKSUM_ASSET_NAME) : null);
22209
+ checksums = await downloadChecksums(checksumAsset, outputDir, progressFactory);
22210
+ let selectedCandidate;
22211
+ try {
22212
+ selectedCandidate = selectChecksummedDesktopAssetCandidate(assetCandidates, checksums);
22213
+ } catch {
22214
+ throw new Error(`No checksummed Rudder Desktop asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
22215
+ }
22216
+ for (const warning of selectedCandidate.warnings) p15.log.warn(warning);
22217
+ selectedAsset = selectedCandidate.asset;
22218
+ selectedAssetKind = selectedCandidate.kind;
22219
+ expectedChecksum = selectedCandidate.expectedChecksum;
21531
22220
  }
21532
- const releaseTag = release?.tag_name ?? (directReleaseVersion ? tag : null);
21533
- if (!releaseTag) {
21534
- throw new Error(`Unable to resolve Rudder Desktop release tag for ${repo}@${tag}.`);
21535
- }
21536
- const assetCandidates = resolveDesktopAssetCandidates({
21537
- releaseAssets: release?.assets ?? [],
21538
- target,
21539
- repo,
21540
- tag,
21541
- directReleaseVersion,
21542
- allowShellAssets: runtimeSupportsShellAssets
21543
- });
21544
- if (assetCandidates.length === 0) {
21545
- throw new Error(`No Rudder Desktop portable asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
21546
- }
21547
- const checksumAsset = selectChecksumAsset(release?.assets ?? []) ?? (directReleaseVersion ? buildGithubReleaseAsset(repo, tag, DESKTOP_CHECKSUM_ASSET_NAME) : null);
21548
- const checksums = await downloadChecksums(checksumAsset, outputDir, progressFactory);
21549
- let selectedCandidate;
21550
- try {
21551
- selectedCandidate = selectChecksummedDesktopAssetCandidate(assetCandidates, checksums);
21552
- } catch (error) {
21553
- throw new Error(`No checksummed Rudder Desktop asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
21554
- }
21555
- for (const warning of selectedCandidate.warnings) p15.log.warn(warning);
21556
- let selectedAsset = selectedCandidate.asset;
21557
- let selectedAssetKind = selectedCandidate.kind;
21558
- let expectedChecksum = selectedCandidate.expectedChecksum;
21559
22221
  const metadata = await readInstallMetadata(installPaths.metadataPath);
21560
22222
  if (isInstalledDesktopCurrent(metadata, releaseTag, selectedAsset.name, expectedChecksum) && await pathExists2(installPaths.executablePath)) {
21561
22223
  p15.log.success(`Rudder Desktop is already installed at ${pc14.cyan(installPaths.appPath)}.`);
@@ -21569,8 +22231,7 @@ async function startCommand(opts) {
21569
22231
  desktopProgressJson ? "preparing_restart" : null
21570
22232
  );
21571
22233
  } else {
21572
- let cachedAsset;
21573
- try {
22234
+ if (!exactDesktopAssetPath) try {
21574
22235
  cachedAsset = await downloadDesktopAssetWithCache(selectedAsset, expectedChecksum, {
21575
22236
  outputDir,
21576
22237
  progressFactory
@@ -21589,8 +22250,10 @@ async function startCommand(opts) {
21589
22250
  progressFactory
21590
22251
  });
21591
22252
  }
21592
- if (cachedAsset.cacheStatus === "hit") {
21593
- p15.log.success(`Desktop asset cache hit at ${pc14.cyan(cachedAsset.path)}.`);
22253
+ if (!cachedAsset) throw new Error("Desktop update did not produce a verified asset.");
22254
+ const verifiedAsset = cachedAsset;
22255
+ if (verifiedAsset.cacheStatus === "hit") {
22256
+ p15.log.success(`Desktop asset cache hit at ${pc14.cyan(verifiedAsset.path)}.`);
21594
22257
  if (desktopProgressJson) {
21595
22258
  writeDesktopProgress({
21596
22259
  phase: "downloading_asset",
@@ -21601,10 +22264,30 @@ async function startCommand(opts) {
21601
22264
  }
21602
22265
  const checksum = await runStartPhase(
21603
22266
  "Verifying Desktop checksum...",
21604
- `Verified ${pc14.cyan(path22.basename(cachedAsset.path))}.`,
21605
- () => assertChecksumMatch(cachedAsset.path, expectedChecksum),
22267
+ `Verified ${pc14.cyan(path22.basename(verifiedAsset.path))}.`,
22268
+ () => assertChecksumMatch(verifiedAsset.path, expectedChecksum),
21606
22269
  desktopProgressJson ? "verifying_checksum" : null
21607
22270
  );
22271
+ if (opts.desktopPrepareOnly === true) {
22272
+ writeDesktopProgress({
22273
+ phase: "prepared",
22274
+ message: "Desktop update is downloaded and verified.",
22275
+ percent: 100,
22276
+ assetName: selectedAsset.name,
22277
+ assetChecksum: checksum,
22278
+ stagedArtifactPath: path22.resolve(verifiedAsset.path),
22279
+ stagedArtifactDigest: checksum,
22280
+ releaseDigest: createHash2("sha256").update(JSON.stringify({
22281
+ releaseTag,
22282
+ assetName: selectedAsset.name,
22283
+ assetChecksum: checksum,
22284
+ assetKind: selectedAssetKind,
22285
+ platform: target.platform,
22286
+ arch: target.arch
22287
+ })).digest("hex")
22288
+ });
22289
+ return;
22290
+ }
21608
22291
  let applySignal = null;
21609
22292
  let applySignalController = null;
21610
22293
  if (desktopProgressJson && opts.desktopWaitForApply === true) {
@@ -21642,7 +22325,7 @@ async function startCommand(opts) {
21642
22325
  await runStartPhase(
21643
22326
  "Installing portable Desktop app...",
21644
22327
  `Installed Rudder Desktop to ${pc14.cyan(installPaths.appPath)}.`,
21645
- () => installPortableDesktop(cachedAsset.path, installPaths, target),
22328
+ () => installPortableDesktop(verifiedAsset.path, installPaths, target),
21646
22329
  desktopProgressJson ? "preparing_restart" : null
21647
22330
  );
21648
22331
  await runStartPhase(
@@ -21749,7 +22432,7 @@ function createProgram() {
21749
22432
  });
21750
22433
  loadRudderEnvFile(options.config);
21751
22434
  });
21752
- program.command("start").description("Start Rudder Desktop and prepare the matching persistent CLI").option("--server-only", "Prepare the Rudder server runtime and persistent CLI without installing Desktop").option("--no-cli", "Skip persistent CLI installation").option("--no-runtime", "Skip Rudder runtime installation").option("--no-desktop", "Skip desktop app installation").option("--version <version>", "Rudder version to start (default: current CLI version)").option("--target-version <version>", "Rudder version to start; avoids the root CLI version flag").option("--repo <owner/repo>", "GitHub repository that hosts desktop releases").option("--output-dir <path>", "Directory for downloaded desktop release assets").option("--desktop-install-dir <path>", "Directory for the portable Desktop install").option("--no-open", "Install Desktop without launching it").option("--wait-for-active-runs", "Wait for active Rudder runs to finish before replacing Desktop", false).option("--desktop-progress-json", "Emit newline-delimited Desktop update progress events").option("--desktop-wait-for-apply", "Wait for an apply signal after downloading and verifying the Desktop update", false).option("--no-version-check", "Skip checking npm for a newer Rudder CLI version").option("--dry-run", "Print the start actions without changing the machine", false).action(startCommand);
22435
+ program.command("start").description("Start Rudder Desktop and prepare the matching persistent CLI").option("--server-only", "Prepare the Rudder server runtime and persistent CLI without installing Desktop").option("--no-cli", "Skip persistent CLI installation").option("--no-runtime", "Skip Rudder runtime installation").option("--no-desktop", "Skip desktop app installation").option("--version <version>", "Rudder version to start (default: current CLI version)").option("--target-version <version>", "Rudder version to start; avoids the root CLI version flag").option("--repo <owner/repo>", "GitHub repository that hosts desktop releases").option("--output-dir <path>", "Directory for downloaded desktop release assets").option("--desktop-install-dir <path>", "Directory for the portable Desktop install").option("--no-open", "Install Desktop without launching it").option("--wait-for-active-runs", "Wait for active Rudder runs to finish before replacing Desktop", false).option("--desktop-progress-json", "Emit newline-delimited Desktop update progress events").option("--desktop-wait-for-apply", "Wait for an apply signal after downloading and verifying the Desktop update", false).option("--desktop-prepare-only", "Download and verify the Desktop update without installing or launching it", false).option("--desktop-asset-path <path>", "Use one previously staged, exact Desktop asset path").option("--desktop-asset-checksum <sha256>", "SHA-256 for the exact staged Desktop asset").option("--desktop-asset-name <name>", "Asset name bound to the exact staged Desktop candidate").option("--desktop-asset-kind <kind>", "Asset kind bound to the exact staged Desktop candidate (full or shell)").option("--desktop-release-digest <sha256>", "Release digest bound to the exact staged Desktop candidate").option("--no-version-check", "Skip checking npm for a newer Rudder CLI version").option("--dry-run", "Print the start actions without changing the machine", false).action(startCommand);
21753
22436
  program.command("onboard").description("Interactive first-run setup wizard").option("-c, --config <path>", "Path to config file").option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP).option("-y, --yes", "Accept defaults (quickstart + start immediately)", false).option("--run", "Start Rudder immediately after saving config", false).action(onboard);
21754
22437
  program.command("doctor").description("Run diagnostic checks on your Rudder setup").option("-c, --config <path>", "Path to config file").option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP).option("--repair", "Attempt to repair issues automatically").alias("--fix").option("-y, --yes", "Skip repair confirmation prompts").action(async (opts) => {
21755
22438
  await doctor(opts);
@@ -21779,6 +22462,7 @@ function createProgram() {
21779
22462
  ).option("--trigger <trigger>", "Trigger detail (manual | ping | callback | system)", "manual").option("--timeout-ms <ms>", "Max time to wait before giving up", "0").option("--json", "Output raw JSON where applicable").option("--debug", "Show raw adapter stdout/stderr JSON chunks").action(heartbeatRun);
21780
22463
  registerContextCommands(program);
21781
22464
  registerCompanyCommands(program);
22465
+ registerGoalCommands(program);
21782
22466
  registerIssueCommands(program);
21783
22467
  registerProjectCommands(program);
21784
22468
  registerAgentCommands(program);