@rudderhq/cli 0.7.4-canary.0 → 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 +692 -54
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -438,6 +438,11 @@ var init_constants = __esm({
|
|
|
438
438
|
"rudder_agent_skills_create",
|
|
439
439
|
"rudder_agent_skills_enable",
|
|
440
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",
|
|
441
446
|
"rudder_issue_get",
|
|
442
447
|
"rudder_issue_list",
|
|
443
448
|
"rudder_issue_search",
|
|
@@ -656,7 +661,7 @@ var init_constants = __esm({
|
|
|
656
661
|
"system_event"
|
|
657
662
|
];
|
|
658
663
|
CHAT_MESSAGE_STATUSES = ["streaming", "completed", "stopped", "failed", "interrupted"];
|
|
659
|
-
CHAT_CONTEXT_ENTITY_TYPES = ["issue", "project", "agent"];
|
|
664
|
+
CHAT_CONTEXT_ENTITY_TYPES = ["issue", "project", "agent", "goal"];
|
|
660
665
|
GOAL_OBJECTIVE_MODES = ["target", "maximize", "maintain", "decide"];
|
|
661
666
|
GOAL_EVALUATOR_KINDS = ["artifact", "metric", "policy", "human"];
|
|
662
667
|
GOAL_CONTINUATION_KINDS = ["commitment", "wait", "decision", "verification"];
|
|
@@ -2052,7 +2057,9 @@ var init_chat = __esm({
|
|
|
2052
2057
|
body: z5.string().trim().max(2e4).default(""),
|
|
2053
2058
|
inlineAnnotations: chatInlineAnnotationsInputSchema.optional(),
|
|
2054
2059
|
editUserMessageId: z5.string().uuid().optional().nullable(),
|
|
2055
|
-
queuedMessageId: z5.string().uuid().optional().nullable()
|
|
2060
|
+
queuedMessageId: z5.string().uuid().optional().nullable(),
|
|
2061
|
+
modelOverride: chatModelOverrideSchema.optional().nullable(),
|
|
2062
|
+
effortOverride: chatEffortOverrideSchema.optional().nullable()
|
|
2056
2063
|
}).superRefine((value, ctx) => {
|
|
2057
2064
|
if (value.body.length === 0 && (value.inlineAnnotations?.length ?? 0) === 0) {
|
|
2058
2065
|
ctx.addIssue({
|
|
@@ -4020,6 +4027,7 @@ var init_goal = __esm({
|
|
|
4020
4027
|
"../packages/shared/dist/validators/goal.js"() {
|
|
4021
4028
|
"use strict";
|
|
4022
4029
|
init_constants();
|
|
4030
|
+
init_issue();
|
|
4023
4031
|
jsonRecord = z27.record(z27.string(), z27.unknown());
|
|
4024
4032
|
evidenceRefSchema = z27.string().trim().min(1).regex(/^[a-z][a-z0-9+.-]*:[^\s]+$/i, "Evidence references must use a URI-like scheme");
|
|
4025
4033
|
sha256HexSchema = z27.string().regex(/^[a-f0-9]{64}$/, "Expected a SHA-256 hex digest");
|
|
@@ -4047,16 +4055,20 @@ var init_goal = __esm({
|
|
|
4047
4055
|
title: z27.string().trim().min(1),
|
|
4048
4056
|
description: z27.string().optional().nullable(),
|
|
4049
4057
|
alignmentQuestion: z27.string().trim().min(1).optional().nullable(),
|
|
4050
|
-
|
|
4058
|
+
targetTime: z27.coerce.date().optional().nullable(),
|
|
4051
4059
|
level: z27.string().optional(),
|
|
4052
4060
|
status: z27.string().optional(),
|
|
4053
4061
|
parentId: z27.string().uuid().optional().nullable(),
|
|
4054
|
-
ownerAgentId: z27.string().uuid().optional().nullable()
|
|
4062
|
+
ownerAgentId: z27.string().uuid().optional().nullable(),
|
|
4063
|
+
ownerAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable()
|
|
4055
4064
|
});
|
|
4056
4065
|
updateGoalSchema = z27.object({
|
|
4057
4066
|
title: z27.string().trim().min(1).optional(),
|
|
4058
4067
|
description: z27.string().optional().nullable(),
|
|
4059
|
-
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()
|
|
4060
4072
|
}).strict();
|
|
4061
4073
|
activateGoalSchema = z27.object({
|
|
4062
4074
|
confirmed: z27.literal(true),
|
|
@@ -4108,6 +4120,7 @@ var init_goal = __esm({
|
|
|
4108
4120
|
requestKey: z27.string().trim().min(1),
|
|
4109
4121
|
packetHash: sha256HexSchema,
|
|
4110
4122
|
packet: goalStartPacketSchema,
|
|
4123
|
+
allowCapabilityMismatch: z27.boolean().optional(),
|
|
4111
4124
|
draftGoalId: z27.string().uuid().optional()
|
|
4112
4125
|
}).strict();
|
|
4113
4126
|
createGoalActivitySchema = z27.object({
|
|
@@ -9243,6 +9256,51 @@ var RUDDER_MCP_TOOL_DESCRIPTORS = [
|
|
|
9243
9256
|
"requiresAgentId": false,
|
|
9244
9257
|
"attachesRunIdWhenAvailable": true
|
|
9245
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
|
+
},
|
|
9246
9304
|
{
|
|
9247
9305
|
"capabilityId": "issue.get",
|
|
9248
9306
|
"name": "rudder_issue_get",
|
|
@@ -10271,6 +10329,7 @@ function coreMcpInputSchema(id) {
|
|
|
10271
10329
|
...required.length > 0 ? { required } : {}
|
|
10272
10330
|
});
|
|
10273
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 });
|
|
10274
10333
|
const project = string("Project UUID or shortname.", { maxLength: 200 });
|
|
10275
10334
|
const approval = string("Approval UUID or short reference.", { maxLength: 200 });
|
|
10276
10335
|
const automation = string("Automation UUID or short reference.", { maxLength: 200 });
|
|
@@ -10311,6 +10370,120 @@ function coreMcpInputSchema(id) {
|
|
|
10311
10370
|
return schema({ selectionRefs: strings("Skill selection references.", 100) }, ["selectionRefs"]);
|
|
10312
10371
|
case "agent.skills.sync":
|
|
10313
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"]);
|
|
10314
10487
|
case "issue.list":
|
|
10315
10488
|
return schema({
|
|
10316
10489
|
status: string("Comma-separated issue statuses.", { maxLength: 500 }),
|
|
@@ -10852,6 +11025,66 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
10852
11025
|
requiresRunId: false,
|
|
10853
11026
|
attachesRunIdWhenAvailable: true
|
|
10854
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
|
+
},
|
|
10855
11088
|
{
|
|
10856
11089
|
id: "agent.hire",
|
|
10857
11090
|
command: "rudder agent hire --org-id <id> --payload <json>",
|
|
@@ -12033,6 +12266,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
12033
12266
|
// src/agent-v1-registry.ts
|
|
12034
12267
|
var CATEGORY_TITLES = {
|
|
12035
12268
|
agent: "Agent",
|
|
12269
|
+
goal: "Goal",
|
|
12036
12270
|
issue: "Issue",
|
|
12037
12271
|
project: "Project",
|
|
12038
12272
|
automation: "Automation",
|
|
@@ -12323,6 +12557,10 @@ var LEGACY_ARGUMENT_ALIASES = {
|
|
|
12323
12557
|
selections: "selectionRefs",
|
|
12324
12558
|
skills: "selectionRefs"
|
|
12325
12559
|
},
|
|
12560
|
+
"goal.context": { goalId: "goal" },
|
|
12561
|
+
"goal.progress": { goalId: "goal" },
|
|
12562
|
+
"goal.change.propose": { goalId: "goal" },
|
|
12563
|
+
"goal.result.propose": { goalId: "goal" },
|
|
12326
12564
|
"issue.get": { issueId: "issue" },
|
|
12327
12565
|
"issue.context": { issueId: "issue" },
|
|
12328
12566
|
"issue.checkout": { issueId: "issue" },
|
|
@@ -12751,6 +12989,64 @@ async function callToolDirectlyIfSupported(toolName, rawArgs, env, signal) {
|
|
|
12751
12989
|
return success(await api.get("/api/agents/me"));
|
|
12752
12990
|
case "agent.inbox":
|
|
12753
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
|
+
}
|
|
12754
13050
|
case "issue.get":
|
|
12755
13051
|
return success(await api.get(`/api/issues/${encodeURIComponent(requiredAnyString(input, ["issue", "issueId"]))}`));
|
|
12756
13052
|
case "issue.context": {
|
|
@@ -13095,6 +13391,73 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
13095
13391
|
pushOptional(args, "--desired-skills", input.desiredSkills);
|
|
13096
13392
|
return args;
|
|
13097
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
|
+
}
|
|
13098
13461
|
case "issue.get":
|
|
13099
13462
|
return ["issue", "get", requiredAnyString(input, ["issue", "issueId"])];
|
|
13100
13463
|
case "issue.list": {
|
|
@@ -14634,6 +14997,89 @@ function asString(value, fallback) {
|
|
|
14634
14997
|
}
|
|
14635
14998
|
|
|
14636
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.`;
|
|
14637
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.";
|
|
14638
15084
|
var ISSUE_ASSIGN_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). You have been assigned to work on an issue.
|
|
14639
15085
|
|
|
@@ -17847,6 +18293,124 @@ function registerDashboardCommands(program) {
|
|
|
17847
18293
|
);
|
|
17848
18294
|
}
|
|
17849
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
|
+
|
|
17850
18414
|
// src/commands/client/issue.ts
|
|
17851
18415
|
init_dist();
|
|
17852
18416
|
import { readFile as readFile4, stat as stat4 } from "node:fs/promises";
|
|
@@ -20125,7 +20689,7 @@ import * as p15 from "@clack/prompts";
|
|
|
20125
20689
|
import { spawn as spawn3, spawnSync as spawnSync4 } from "node:child_process";
|
|
20126
20690
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
20127
20691
|
import { createWriteStream, constants as fsConstants, mkdirSync, readFileSync as readFileSync2 } from "node:fs";
|
|
20128
|
-
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";
|
|
20129
20693
|
import { homedir, tmpdir } from "node:os";
|
|
20130
20694
|
import path22 from "node:path";
|
|
20131
20695
|
import { Readable, Transform } from "node:stream";
|
|
@@ -21473,6 +22037,21 @@ async function startCommand(opts) {
|
|
|
21473
22037
|
const version = opts.targetVersion?.trim() || opts.version?.trim() || resolveCurrentCliVersion();
|
|
21474
22038
|
const dryRun = opts.dryRun === true;
|
|
21475
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
|
+
}
|
|
21476
22055
|
let runtimeSupportsShellAssets = false;
|
|
21477
22056
|
if (desktopProgressJson) {
|
|
21478
22057
|
process.stdout.on("error", (error) => {
|
|
@@ -21559,49 +22138,86 @@ async function startCommand(opts) {
|
|
|
21559
22138
|
return;
|
|
21560
22139
|
}
|
|
21561
22140
|
await withDesktopInstallLock(installPaths, async () => {
|
|
21562
|
-
const directReleaseVersion = resolveDesktopReleaseVersion(tag);
|
|
21563
22141
|
const progressFactory = desktopProgressJson ? createDesktopProgressFactory() : createByteProgress;
|
|
21564
|
-
let
|
|
21565
|
-
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
|
|
21569
|
-
|
|
21570
|
-
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
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
|
|
21576
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;
|
|
21577
22220
|
}
|
|
21578
|
-
const releaseTag = release?.tag_name ?? (directReleaseVersion ? tag : null);
|
|
21579
|
-
if (!releaseTag) {
|
|
21580
|
-
throw new Error(`Unable to resolve Rudder Desktop release tag for ${repo}@${tag}.`);
|
|
21581
|
-
}
|
|
21582
|
-
const assetCandidates = resolveDesktopAssetCandidates({
|
|
21583
|
-
releaseAssets: release?.assets ?? [],
|
|
21584
|
-
target,
|
|
21585
|
-
repo,
|
|
21586
|
-
tag,
|
|
21587
|
-
directReleaseVersion,
|
|
21588
|
-
allowShellAssets: runtimeSupportsShellAssets
|
|
21589
|
-
});
|
|
21590
|
-
if (assetCandidates.length === 0) {
|
|
21591
|
-
throw new Error(`No Rudder Desktop portable asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
|
|
21592
|
-
}
|
|
21593
|
-
const checksumAsset = selectChecksumAsset(release?.assets ?? []) ?? (directReleaseVersion ? buildGithubReleaseAsset(repo, tag, DESKTOP_CHECKSUM_ASSET_NAME) : null);
|
|
21594
|
-
const checksums = await downloadChecksums(checksumAsset, outputDir, progressFactory);
|
|
21595
|
-
let selectedCandidate;
|
|
21596
|
-
try {
|
|
21597
|
-
selectedCandidate = selectChecksummedDesktopAssetCandidate(assetCandidates, checksums);
|
|
21598
|
-
} catch (error) {
|
|
21599
|
-
throw new Error(`No checksummed Rudder Desktop asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
|
|
21600
|
-
}
|
|
21601
|
-
for (const warning of selectedCandidate.warnings) p15.log.warn(warning);
|
|
21602
|
-
let selectedAsset = selectedCandidate.asset;
|
|
21603
|
-
let selectedAssetKind = selectedCandidate.kind;
|
|
21604
|
-
let expectedChecksum = selectedCandidate.expectedChecksum;
|
|
21605
22221
|
const metadata = await readInstallMetadata(installPaths.metadataPath);
|
|
21606
22222
|
if (isInstalledDesktopCurrent(metadata, releaseTag, selectedAsset.name, expectedChecksum) && await pathExists2(installPaths.executablePath)) {
|
|
21607
22223
|
p15.log.success(`Rudder Desktop is already installed at ${pc14.cyan(installPaths.appPath)}.`);
|
|
@@ -21615,8 +22231,7 @@ async function startCommand(opts) {
|
|
|
21615
22231
|
desktopProgressJson ? "preparing_restart" : null
|
|
21616
22232
|
);
|
|
21617
22233
|
} else {
|
|
21618
|
-
|
|
21619
|
-
try {
|
|
22234
|
+
if (!exactDesktopAssetPath) try {
|
|
21620
22235
|
cachedAsset = await downloadDesktopAssetWithCache(selectedAsset, expectedChecksum, {
|
|
21621
22236
|
outputDir,
|
|
21622
22237
|
progressFactory
|
|
@@ -21635,8 +22250,10 @@ async function startCommand(opts) {
|
|
|
21635
22250
|
progressFactory
|
|
21636
22251
|
});
|
|
21637
22252
|
}
|
|
21638
|
-
if (cachedAsset
|
|
21639
|
-
|
|
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)}.`);
|
|
21640
22257
|
if (desktopProgressJson) {
|
|
21641
22258
|
writeDesktopProgress({
|
|
21642
22259
|
phase: "downloading_asset",
|
|
@@ -21647,10 +22264,30 @@ async function startCommand(opts) {
|
|
|
21647
22264
|
}
|
|
21648
22265
|
const checksum = await runStartPhase(
|
|
21649
22266
|
"Verifying Desktop checksum...",
|
|
21650
|
-
`Verified ${pc14.cyan(path22.basename(
|
|
21651
|
-
() => assertChecksumMatch(
|
|
22267
|
+
`Verified ${pc14.cyan(path22.basename(verifiedAsset.path))}.`,
|
|
22268
|
+
() => assertChecksumMatch(verifiedAsset.path, expectedChecksum),
|
|
21652
22269
|
desktopProgressJson ? "verifying_checksum" : null
|
|
21653
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
|
+
}
|
|
21654
22291
|
let applySignal = null;
|
|
21655
22292
|
let applySignalController = null;
|
|
21656
22293
|
if (desktopProgressJson && opts.desktopWaitForApply === true) {
|
|
@@ -21688,7 +22325,7 @@ async function startCommand(opts) {
|
|
|
21688
22325
|
await runStartPhase(
|
|
21689
22326
|
"Installing portable Desktop app...",
|
|
21690
22327
|
`Installed Rudder Desktop to ${pc14.cyan(installPaths.appPath)}.`,
|
|
21691
|
-
() => installPortableDesktop(
|
|
22328
|
+
() => installPortableDesktop(verifiedAsset.path, installPaths, target),
|
|
21692
22329
|
desktopProgressJson ? "preparing_restart" : null
|
|
21693
22330
|
);
|
|
21694
22331
|
await runStartPhase(
|
|
@@ -21795,7 +22432,7 @@ function createProgram() {
|
|
|
21795
22432
|
});
|
|
21796
22433
|
loadRudderEnvFile(options.config);
|
|
21797
22434
|
});
|
|
21798
|
-
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);
|
|
21799
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);
|
|
21800
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) => {
|
|
21801
22438
|
await doctor(opts);
|
|
@@ -21825,6 +22462,7 @@ function createProgram() {
|
|
|
21825
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);
|
|
21826
22463
|
registerContextCommands(program);
|
|
21827
22464
|
registerCompanyCommands(program);
|
|
22465
|
+
registerGoalCommands(program);
|
|
21828
22466
|
registerIssueCommands(program);
|
|
21829
22467
|
registerProjectCommands(program);
|
|
21830
22468
|
registerAgentCommands(program);
|