@koda-sl/baker-cli 0.372.0 → 0.374.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/cli.js +294 -163
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7143,37 +7143,10 @@ function parseConditionsExpression(expression) {
|
|
|
7143
7143
|
}
|
|
7144
7144
|
|
|
7145
7145
|
// ../api/src/scheduledAgents.ts
|
|
7146
|
-
import { z as
|
|
7147
|
-
var scheduledAgentRunsAsSchema = z24.object({
|
|
7148
|
-
/** The person each run acts as; null when nobody owns it, so only the company's tools load. */
|
|
7149
|
-
name: z24.string().nullable(),
|
|
7150
|
-
/** That person's own connected tools. */
|
|
7151
|
-
personalTools: z24.array(z24.string()),
|
|
7152
|
-
/** The company's and organization's tools, and the platforms Baker connects to directly. */
|
|
7153
|
-
companyTools: z24.array(z24.string()),
|
|
7154
|
-
/** Set up, but nobody has signed in to them, so a run gets nothing from them. */
|
|
7155
|
-
notSignedIn: z24.array(z24.string()).optional(),
|
|
7156
|
-
/** The company switched connected tools off: only the platforms load. */
|
|
7157
|
-
toolsOff: z24.literal(true).optional()
|
|
7158
|
-
});
|
|
7159
|
-
var AUTO_PUBLISH_REFUSAL = 'Publishing every run unreviewed is a standing authorization only the user can grant, on the item itself, so it is recorded against their name. Stage the item without it, and once this chat is published ask the user to switch on "Publish its work on its own" (under "When a run finishes") on the item in Scheduled agents.';
|
|
7160
|
-
var scheduledAgentsUnstageRequestSchema = z24.object({
|
|
7161
|
-
chatId: z24.string().min(1),
|
|
7162
|
-
/** The item: a published id or a temp_agent_* id this chat staged. */
|
|
7163
|
-
ref: z24.string().min(1),
|
|
7164
|
-
/** One change of it, by its `index` in `list`'s draft. Left out, every change staged on it. */
|
|
7165
|
-
index: z24.number().int().min(0).optional()
|
|
7166
|
-
});
|
|
7167
|
-
var scheduledAgentsUnstageResponseSchema = z24.object({
|
|
7168
|
-
ok: z24.literal(true),
|
|
7169
|
-
data: z24.object({ ref: z24.string(), removed: z24.number().int().min(1) })
|
|
7170
|
-
});
|
|
7171
|
-
|
|
7172
|
-
// ../api/src/scheduledAgentTriggerCatalog.ts
|
|
7173
|
-
import { z as z26 } from "zod";
|
|
7146
|
+
import { z as z25 } from "zod";
|
|
7174
7147
|
|
|
7175
7148
|
// ../api/src/scheduledAgentTriggers.ts
|
|
7176
|
-
import { z as
|
|
7149
|
+
import { z as z24 } from "zod";
|
|
7177
7150
|
var TRIGGER_GROUPS = {
|
|
7178
7151
|
time: { label: "Time", blurb: "On a clock you set." },
|
|
7179
7152
|
incoming: { label: "Incoming", blurb: "Another tool or your site calls in." },
|
|
@@ -7539,152 +7512,233 @@ var TRIGGER_TARGETS = {
|
|
|
7539
7512
|
"review.received": [target("sourceId", { open: false })],
|
|
7540
7513
|
"advertiser.new_ads": [target("advertiserId", { open: false })]
|
|
7541
7514
|
};
|
|
7542
|
-
var triggerTargetOptionSchema =
|
|
7543
|
-
value:
|
|
7544
|
-
label:
|
|
7515
|
+
var triggerTargetOptionSchema = z24.object({
|
|
7516
|
+
value: z24.string(),
|
|
7517
|
+
label: z24.string(),
|
|
7545
7518
|
/** A second line: a status, a tag list, where it comes from. */
|
|
7546
|
-
detail:
|
|
7519
|
+
detail: z24.string().optional(),
|
|
7547
7520
|
/** A mark: a path under the dashboard's `/logos/`, or an absolute image URL. */
|
|
7548
|
-
logo:
|
|
7521
|
+
logo: z24.string().optional()
|
|
7549
7522
|
});
|
|
7550
|
-
var scheduledAgentTriggerSchema =
|
|
7551
|
-
|
|
7552
|
-
kind:
|
|
7523
|
+
var scheduledAgentTriggerSchema = z24.discriminatedUnion("kind", [
|
|
7524
|
+
z24.object({
|
|
7525
|
+
kind: z24.literal("time.once"),
|
|
7553
7526
|
/** Epoch ms. Must still be in the future when the item is written. */
|
|
7554
|
-
runAt:
|
|
7527
|
+
runAt: z24.number(),
|
|
7555
7528
|
/** IANA zone. Defaults to the company's. */
|
|
7556
|
-
tz:
|
|
7529
|
+
tz: z24.string()
|
|
7557
7530
|
}),
|
|
7558
|
-
|
|
7559
|
-
kind:
|
|
7531
|
+
z24.object({
|
|
7532
|
+
kind: z24.literal("time.cron"),
|
|
7560
7533
|
/** Five-field cron expression. */
|
|
7561
|
-
cronspec:
|
|
7562
|
-
tz:
|
|
7534
|
+
cronspec: z24.string(),
|
|
7535
|
+
tz: z24.string()
|
|
7563
7536
|
}),
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
kind:
|
|
7537
|
+
z24.object({ kind: z24.literal("webhook.received") }),
|
|
7538
|
+
z24.object({
|
|
7539
|
+
kind: z24.literal("app.event"),
|
|
7567
7540
|
/** The connected tool, by its toolkit slug: `gmail`, `slack`. */
|
|
7568
|
-
toolkit:
|
|
7541
|
+
toolkit: z24.string(),
|
|
7569
7542
|
/** What happens in it, by the tool's own trigger id: `GMAIL_NEW_GMAIL_MESSAGE`. */
|
|
7570
|
-
appEvent:
|
|
7543
|
+
appEvent: z24.string(),
|
|
7571
7544
|
/** Which connected account — a tool can be connected more than once. */
|
|
7572
|
-
account:
|
|
7545
|
+
account: z24.string(),
|
|
7573
7546
|
/** The tool's own settings for the event (a label, a channel, a repository), as JSON text. */
|
|
7574
|
-
configJson:
|
|
7547
|
+
configJson: z24.string().optional()
|
|
7575
7548
|
}),
|
|
7576
|
-
|
|
7577
|
-
kind:
|
|
7549
|
+
z24.object({
|
|
7550
|
+
kind: z24.literal("event.received"),
|
|
7578
7551
|
/** Absent = any event. */
|
|
7579
|
-
eventName:
|
|
7552
|
+
eventName: z24.string().optional()
|
|
7580
7553
|
}),
|
|
7581
|
-
|
|
7582
|
-
kind:
|
|
7554
|
+
z24.object({
|
|
7555
|
+
kind: z24.literal("connection.created"),
|
|
7583
7556
|
/** Absent = any tool. An OAuth provider type, or a Composio toolkit slug. */
|
|
7584
|
-
provider:
|
|
7557
|
+
provider: z24.string().optional()
|
|
7585
7558
|
}),
|
|
7586
|
-
|
|
7587
|
-
kind:
|
|
7588
|
-
provider:
|
|
7559
|
+
z24.object({
|
|
7560
|
+
kind: z24.literal("connection.removed"),
|
|
7561
|
+
provider: z24.string().optional()
|
|
7589
7562
|
}),
|
|
7590
|
-
|
|
7591
|
-
kind:
|
|
7563
|
+
z24.object({
|
|
7564
|
+
kind: z24.literal("form.submitted"),
|
|
7592
7565
|
/** Absent = any Form. */
|
|
7593
|
-
flowId:
|
|
7566
|
+
flowId: z24.string().optional()
|
|
7594
7567
|
}),
|
|
7595
|
-
|
|
7596
|
-
kind:
|
|
7597
|
-
flowId:
|
|
7598
|
-
stepId:
|
|
7568
|
+
z24.object({
|
|
7569
|
+
kind: z24.literal("flow.step.submitted"),
|
|
7570
|
+
flowId: z24.string(),
|
|
7571
|
+
stepId: z24.string()
|
|
7599
7572
|
}),
|
|
7600
|
-
|
|
7601
|
-
kind:
|
|
7573
|
+
z24.object({
|
|
7574
|
+
kind: z24.literal("landing.created"),
|
|
7602
7575
|
/** Absent = any page. A page's slug. */
|
|
7603
|
-
page:
|
|
7576
|
+
page: z24.string().optional(),
|
|
7604
7577
|
/** Absent = any tag. */
|
|
7605
|
-
tag:
|
|
7578
|
+
tag: z24.string().optional()
|
|
7606
7579
|
}),
|
|
7607
|
-
|
|
7608
|
-
kind:
|
|
7609
|
-
page:
|
|
7610
|
-
tag:
|
|
7580
|
+
z24.object({
|
|
7581
|
+
kind: z24.literal("landing.published"),
|
|
7582
|
+
page: z24.string().optional(),
|
|
7583
|
+
tag: z24.string().optional()
|
|
7611
7584
|
}),
|
|
7612
|
-
|
|
7613
|
-
kind:
|
|
7585
|
+
z24.object({
|
|
7586
|
+
kind: z24.literal("experiment.started"),
|
|
7614
7587
|
/** Absent = any test. */
|
|
7615
|
-
experimentId:
|
|
7588
|
+
experimentId: z24.string().optional()
|
|
7616
7589
|
}),
|
|
7617
|
-
|
|
7618
|
-
kind:
|
|
7619
|
-
experimentId:
|
|
7590
|
+
z24.object({
|
|
7591
|
+
kind: z24.literal("experiment.decided"),
|
|
7592
|
+
experimentId: z24.string().optional()
|
|
7620
7593
|
}),
|
|
7621
|
-
|
|
7622
|
-
kind:
|
|
7623
|
-
experimentId:
|
|
7594
|
+
z24.object({
|
|
7595
|
+
kind: z24.literal("experiment.ended"),
|
|
7596
|
+
experimentId: z24.string().optional()
|
|
7624
7597
|
}),
|
|
7625
|
-
|
|
7626
|
-
kind:
|
|
7627
|
-
experimentId:
|
|
7598
|
+
z24.object({
|
|
7599
|
+
kind: z24.literal("experiment.concluded"),
|
|
7600
|
+
experimentId: z24.string().optional()
|
|
7628
7601
|
}),
|
|
7629
|
-
|
|
7630
|
-
kind:
|
|
7602
|
+
z24.object({
|
|
7603
|
+
kind: z24.literal("task.created"),
|
|
7631
7604
|
/** Absent = any Task. */
|
|
7632
|
-
tag:
|
|
7605
|
+
tag: z24.string().optional()
|
|
7633
7606
|
}),
|
|
7634
|
-
|
|
7635
|
-
kind:
|
|
7607
|
+
z24.object({
|
|
7608
|
+
kind: z24.literal("task.claimed"),
|
|
7636
7609
|
/** Absent = any Task. One Task, by id. */
|
|
7637
|
-
taskId:
|
|
7638
|
-
tag:
|
|
7610
|
+
taskId: z24.string().optional(),
|
|
7611
|
+
tag: z24.string().optional()
|
|
7639
7612
|
}),
|
|
7640
|
-
|
|
7641
|
-
kind:
|
|
7642
|
-
taskId:
|
|
7643
|
-
tag:
|
|
7613
|
+
z24.object({
|
|
7614
|
+
kind: z24.literal("task.completed"),
|
|
7615
|
+
taskId: z24.string().optional(),
|
|
7616
|
+
tag: z24.string().optional()
|
|
7644
7617
|
}),
|
|
7645
|
-
|
|
7646
|
-
kind:
|
|
7618
|
+
z24.object({
|
|
7619
|
+
kind: z24.literal("session.published"),
|
|
7647
7620
|
/** Absent = any agent. Only the runs of this Scheduled agent. */
|
|
7648
|
-
agentId:
|
|
7621
|
+
agentId: z24.string().optional()
|
|
7649
7622
|
}),
|
|
7650
|
-
|
|
7651
|
-
kind:
|
|
7652
|
-
agentId:
|
|
7623
|
+
z24.object({
|
|
7624
|
+
kind: z24.literal("session.publish_failed"),
|
|
7625
|
+
agentId: z24.string().optional()
|
|
7653
7626
|
}),
|
|
7654
|
-
|
|
7655
|
-
kind:
|
|
7627
|
+
z24.object({
|
|
7628
|
+
kind: z24.literal("knowledge.updated"),
|
|
7656
7629
|
/** Absent = any collection. */
|
|
7657
|
-
collection:
|
|
7630
|
+
collection: z24.string().optional()
|
|
7658
7631
|
}),
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
kind:
|
|
7663
|
-
provider:
|
|
7632
|
+
z24.object({ kind: z24.literal("brand.updated") }),
|
|
7633
|
+
z24.object({ kind: z24.literal("creative.created") }),
|
|
7634
|
+
z24.object({
|
|
7635
|
+
kind: z24.literal("connection.needs_reconnect"),
|
|
7636
|
+
provider: z24.string().optional()
|
|
7664
7637
|
}),
|
|
7665
|
-
|
|
7666
|
-
kind:
|
|
7638
|
+
z24.object({
|
|
7639
|
+
kind: z24.literal("session.publish_incomplete"),
|
|
7667
7640
|
/** Absent = any platform. One of `PUBLISH_PLATFORMS`. */
|
|
7668
|
-
platform:
|
|
7669
|
-
agentId:
|
|
7641
|
+
platform: z24.string().optional(),
|
|
7642
|
+
agentId: z24.string().optional()
|
|
7670
7643
|
}),
|
|
7671
|
-
|
|
7672
|
-
kind:
|
|
7644
|
+
z24.object({
|
|
7645
|
+
kind: z24.literal("review.received"),
|
|
7673
7646
|
/** Absent = any review source. */
|
|
7674
|
-
sourceId:
|
|
7647
|
+
sourceId: z24.string().optional()
|
|
7675
7648
|
}),
|
|
7676
|
-
|
|
7677
|
-
kind:
|
|
7649
|
+
z24.object({
|
|
7650
|
+
kind: z24.literal("advertiser.new_ads"),
|
|
7678
7651
|
/** Absent = any followed advertiser. */
|
|
7679
|
-
advertiserId:
|
|
7652
|
+
advertiserId: z24.string().optional()
|
|
7680
7653
|
})
|
|
7681
7654
|
]);
|
|
7682
|
-
var occurrencesSchema =
|
|
7655
|
+
var occurrencesSchema = z24.array(z24.number().int().positive()).max(32);
|
|
7683
7656
|
function firstTimes(count2) {
|
|
7684
7657
|
return Array.from({ length: Math.max(0, Math.floor(count2)) }, (_, index) => index + 1);
|
|
7685
7658
|
}
|
|
7686
7659
|
|
|
7660
|
+
// ../api/src/scheduledAgents.ts
|
|
7661
|
+
var scheduledAgentRunsAsSchema = z25.object({
|
|
7662
|
+
/** The person each run acts as; null when nobody owns it, so only the company's tools load. */
|
|
7663
|
+
name: z25.string().nullable(),
|
|
7664
|
+
/** That person's own connected tools. */
|
|
7665
|
+
personalTools: z25.array(z25.string()),
|
|
7666
|
+
/** The company's and organization's tools, and the platforms Baker connects to directly. */
|
|
7667
|
+
companyTools: z25.array(z25.string()),
|
|
7668
|
+
/** Set up, but nobody has signed in to them, so a run gets nothing from them. */
|
|
7669
|
+
notSignedIn: z25.array(z25.string()).optional(),
|
|
7670
|
+
/** The company switched connected tools off: only the platforms load. */
|
|
7671
|
+
toolsOff: z25.literal(true).optional()
|
|
7672
|
+
});
|
|
7673
|
+
var AUTO_PUBLISH_REFUSAL = 'Publishing every run unreviewed is a standing authorization only the user can grant, on the item itself, so it is recorded against their name. Stage the item without it, and once this chat is published ask the user to switch on "Publish its work on its own" (under "When a run finishes") on the item in Scheduled agents.';
|
|
7674
|
+
var scheduledAgentsUnstageRequestSchema = z25.object({
|
|
7675
|
+
chatId: z25.string().min(1),
|
|
7676
|
+
/** The item: a published id or a temp_agent_* id this chat staged. */
|
|
7677
|
+
ref: z25.string().min(1),
|
|
7678
|
+
/** One change of it, by its `index` in `list`'s draft. Left out, every change staged on it. */
|
|
7679
|
+
index: z25.number().int().min(0).optional()
|
|
7680
|
+
});
|
|
7681
|
+
var scheduledAgentsUnstageResponseSchema = z25.object({
|
|
7682
|
+
ok: z25.literal(true),
|
|
7683
|
+
data: z25.object({ ref: z25.string(), removed: z25.number().int().min(1) })
|
|
7684
|
+
});
|
|
7685
|
+
var scheduledAgentsListRequestSchema = z25.object({
|
|
7686
|
+
/** Also return what this chat staged. */
|
|
7687
|
+
chatId: z25.string().min(1).optional(),
|
|
7688
|
+
/** Every item and staged change as stored, briefs included. Left out, the compact view below. */
|
|
7689
|
+
full: z25.boolean().optional()
|
|
7690
|
+
});
|
|
7691
|
+
var scheduledAgentListItemSchema = z25.object({
|
|
7692
|
+
id: z25.string(),
|
|
7693
|
+
name: z25.string(),
|
|
7694
|
+
description: z25.string(),
|
|
7695
|
+
enabled: z25.boolean(),
|
|
7696
|
+
trigger: scheduledAgentTriggerSchema,
|
|
7697
|
+
occurrences: occurrencesSchema.optional(),
|
|
7698
|
+
conditions: conditionsSchema.optional(),
|
|
7699
|
+
cooldownMinutes: z25.number().optional(),
|
|
7700
|
+
/** ISO. Only a one-off knows its next moment. */
|
|
7701
|
+
nextRunAt: z25.string().optional(),
|
|
7702
|
+
/** ISO. */
|
|
7703
|
+
lastRunAt: z25.string().optional(),
|
|
7704
|
+
firedCount: z25.number(),
|
|
7705
|
+
totalRuns: z25.number(),
|
|
7706
|
+
templateName: z25.string().optional(),
|
|
7707
|
+
publishesOwnWork: z25.literal(true).optional(),
|
|
7708
|
+
/** Whether the connected tool is reporting to an `app.event` item. */
|
|
7709
|
+
listening: z25.object({ status: z25.string(), reason: z25.string().optional() }).optional()
|
|
7710
|
+
});
|
|
7711
|
+
var scheduledAgentStagedChangeSchema = z25.object({
|
|
7712
|
+
index: z25.number().int().min(0),
|
|
7713
|
+
kind: z25.enum(["create", "update", "delete"]),
|
|
7714
|
+
/** The published id, or the temp_agent_* id a create returned. */
|
|
7715
|
+
ref: z25.string(),
|
|
7716
|
+
name: z25.string(),
|
|
7717
|
+
description: z25.string().optional(),
|
|
7718
|
+
trigger: scheduledAgentTriggerSchema.optional(),
|
|
7719
|
+
enabled: z25.boolean().optional(),
|
|
7720
|
+
/** For an update: the fields it changes. */
|
|
7721
|
+
changes: z25.array(z25.string()).optional(),
|
|
7722
|
+
result: z25.object({
|
|
7723
|
+
status: z25.enum(["applied", "skipped", "failed"]),
|
|
7724
|
+
reason: z25.string().optional(),
|
|
7725
|
+
scheduledAgentId: z25.string().optional()
|
|
7726
|
+
}).optional()
|
|
7727
|
+
});
|
|
7728
|
+
var scheduledAgentsListResponseSchema = z25.object({
|
|
7729
|
+
ok: z25.literal(true),
|
|
7730
|
+
data: z25.object({
|
|
7731
|
+
published: z25.array(scheduledAgentListItemSchema),
|
|
7732
|
+
draft: z25.object({
|
|
7733
|
+
status: z25.enum(["active", "publishing", "discarded", "applied"]).nullable(),
|
|
7734
|
+
ops: z25.array(scheduledAgentStagedChangeSchema)
|
|
7735
|
+
}).nullable()
|
|
7736
|
+
}),
|
|
7737
|
+
hints: z25.array(z25.string()).optional()
|
|
7738
|
+
});
|
|
7739
|
+
|
|
7687
7740
|
// ../api/src/scheduledAgentTriggerCatalog.ts
|
|
7741
|
+
import { z as z26 } from "zod";
|
|
7688
7742
|
var catalogTriggerSchema = z26.object({
|
|
7689
7743
|
kind: z26.string(),
|
|
7690
7744
|
label: z26.string(),
|
|
@@ -9026,17 +9080,17 @@ function text(value) {
|
|
|
9026
9080
|
return typeof value === "string" ? value : "";
|
|
9027
9081
|
}
|
|
9028
9082
|
function draftOpNormalizer(record, full) {
|
|
9029
|
-
const
|
|
9083
|
+
const compact4 = {
|
|
9030
9084
|
kind: text(record.kind),
|
|
9031
9085
|
name: text(record.targetName),
|
|
9032
9086
|
ref: text(record.tempId) || text(record.targetActionId),
|
|
9033
9087
|
tags: Array.isArray(record.tags) ? record.tags.join(",") : ""
|
|
9034
9088
|
};
|
|
9035
9089
|
if (!full) {
|
|
9036
|
-
return
|
|
9090
|
+
return compact4;
|
|
9037
9091
|
}
|
|
9038
9092
|
return {
|
|
9039
|
-
...
|
|
9093
|
+
...compact4,
|
|
9040
9094
|
description: text(record.description),
|
|
9041
9095
|
note: text(record.note),
|
|
9042
9096
|
reason: text(record.reason),
|
|
@@ -9311,10 +9365,10 @@ var listCommand2 = defineCommand8({
|
|
|
9311
9365
|
process.stdout.write(renderMarkdown(response.data, hints2, { full: args5.full === true }));
|
|
9312
9366
|
return;
|
|
9313
9367
|
}
|
|
9314
|
-
const
|
|
9315
|
-
const shaped =
|
|
9368
|
+
const compact4 = !args5.full && response.ok;
|
|
9369
|
+
const shaped = compact4 ? { ...response, data: compactListData(response.data) } : response;
|
|
9316
9370
|
const envelope = hints2.length > 0 ? { ...shaped, hints: hints2 } : shaped;
|
|
9317
|
-
if (
|
|
9371
|
+
if (compact4) {
|
|
9318
9372
|
process.stdout.write(`${JSON.stringify(envelope)}
|
|
9319
9373
|
`);
|
|
9320
9374
|
return;
|
|
@@ -14705,8 +14759,8 @@ function normalizePhoneV1(raw) {
|
|
|
14705
14759
|
var PHONE_PUNCTUATION = /[\s()./-]/g;
|
|
14706
14760
|
var E164 = /^\+[1-9]\d{7,14}$/;
|
|
14707
14761
|
function normalizePhoneV2(raw) {
|
|
14708
|
-
const
|
|
14709
|
-
const e164 =
|
|
14762
|
+
const compact4 = raw.replace(PHONE_PUNCTUATION, "");
|
|
14763
|
+
const e164 = compact4.startsWith("00") ? `+${compact4.slice(2)}` : compact4;
|
|
14710
14764
|
return E164.test(e164) ? e164 : null;
|
|
14711
14765
|
}
|
|
14712
14766
|
|
|
@@ -31833,6 +31887,7 @@ function parseConversionsArgs(raw, argv) {
|
|
|
31833
31887
|
removeName: onlyOnce(raw["remove-name"], "--remove-name", argv),
|
|
31834
31888
|
flowSlug: onlyOnce(raw.flow, "--flow", argv),
|
|
31835
31889
|
candidates: raw.candidates === true,
|
|
31890
|
+
full: raw.full === true,
|
|
31836
31891
|
days: readDays(raw.days)
|
|
31837
31892
|
};
|
|
31838
31893
|
checkFlagShape(args5);
|
|
@@ -31899,6 +31954,72 @@ function conversionsWrite(args5, existing) {
|
|
|
31899
31954
|
return { ...set.length > 0 ? { set } : {}, ...remove.length > 0 ? { remove } : {} };
|
|
31900
31955
|
}
|
|
31901
31956
|
|
|
31957
|
+
// src/commands/analytics/conversionCandidates.ts
|
|
31958
|
+
function compact2(row) {
|
|
31959
|
+
return {
|
|
31960
|
+
eventKey: row.eventKey,
|
|
31961
|
+
events: row.events,
|
|
31962
|
+
sessions: row.sessions,
|
|
31963
|
+
...row.isCounted ? { countedAs: row.countedAs } : {}
|
|
31964
|
+
};
|
|
31965
|
+
}
|
|
31966
|
+
function foldByForm(rows) {
|
|
31967
|
+
const byForm = /* @__PURE__ */ new Map();
|
|
31968
|
+
for (const row of rows) {
|
|
31969
|
+
const form = byForm.get(row.flowSlug) ?? { form: row.flowSlug, keys: 0, countedKeys: 0, events: 0 };
|
|
31970
|
+
form.keys += 1;
|
|
31971
|
+
if (row.isCounted) form.countedKeys += 1;
|
|
31972
|
+
form.events += row.events;
|
|
31973
|
+
byForm.set(row.flowSlug, form);
|
|
31974
|
+
}
|
|
31975
|
+
return [...byForm.values()];
|
|
31976
|
+
}
|
|
31977
|
+
function candidatesForFlow(catalogue, flowSlug) {
|
|
31978
|
+
return flowSlug === void 0 ? [...catalogue] : catalogue.filter((row) => row.flowSlug === flowSlug);
|
|
31979
|
+
}
|
|
31980
|
+
var FOLDED_FORMS_HINT = "A Form's candidates are folded into its `flows` row (`keys` fired, `events`; no `counted` means it counts nothing), or a `formCandidates` row when not listed. `--candidates --flow <slug>` lists that Form's keys; `--full` adds every field of every key.";
|
|
31981
|
+
function candidatesView(rows, options) {
|
|
31982
|
+
if (options.full) return { candidates: rows };
|
|
31983
|
+
if (options.flowSlug !== void 0) return { candidates: rows.map(compact2) };
|
|
31984
|
+
const forms = foldByForm(rows.filter((row) => row.flowSlug !== ""));
|
|
31985
|
+
return {
|
|
31986
|
+
candidates: rows.filter((row) => row.flowSlug === "").map(compact2),
|
|
31987
|
+
...forms.length > 0 ? { formCandidates: forms } : {}
|
|
31988
|
+
};
|
|
31989
|
+
}
|
|
31990
|
+
function fullFlagHints(args5, format) {
|
|
31991
|
+
if (!args5.full || args5.candidates && format !== "md") return [];
|
|
31992
|
+
return ["`--full` only applies to `--candidates --output json`, so it changed nothing here."];
|
|
31993
|
+
}
|
|
31994
|
+
function compactConversionsEnvelope(envelope, options) {
|
|
31995
|
+
const { candidates, flows, ...data } = envelope.data;
|
|
31996
|
+
if (candidates === void 0) return { ...envelope };
|
|
31997
|
+
const { formCandidates, ...view } = candidatesView(candidates, options);
|
|
31998
|
+
const traffic = new Map(formCandidates?.map((form) => [form.form, form]));
|
|
31999
|
+
const merged = flows?.map(({ slug, counted, noConversion }) => {
|
|
32000
|
+
const form = traffic.get(slug);
|
|
32001
|
+
traffic.delete(slug);
|
|
32002
|
+
return {
|
|
32003
|
+
slug,
|
|
32004
|
+
...counted.length > 0 ? { counted } : {},
|
|
32005
|
+
...noConversion !== null ? { noConversion } : {},
|
|
32006
|
+
keys: form?.keys ?? 0,
|
|
32007
|
+
events: form?.events ?? 0
|
|
32008
|
+
};
|
|
32009
|
+
});
|
|
32010
|
+
const hints2 = [...envelope.hints ?? [], ...formCandidates ? [FOLDED_FORMS_HINT] : []];
|
|
32011
|
+
return {
|
|
32012
|
+
...envelope,
|
|
32013
|
+
data: {
|
|
32014
|
+
...data,
|
|
32015
|
+
...merged ? { flows: merged } : {},
|
|
32016
|
+
...view,
|
|
32017
|
+
...traffic.size > 0 ? { formCandidates: [...traffic.values()] } : {}
|
|
32018
|
+
},
|
|
32019
|
+
...hints2.length > 0 ? { hints: hints2 } : {}
|
|
32020
|
+
};
|
|
32021
|
+
}
|
|
32022
|
+
|
|
31902
32023
|
// src/commands/analytics/conversionHints.ts
|
|
31903
32024
|
var NAMED_CANDIDATES = 3;
|
|
31904
32025
|
function conversionHints(definitions, candidates, askedForCandidates) {
|
|
@@ -32224,7 +32345,7 @@ function trafficByForm(candidates) {
|
|
|
32224
32345
|
return byForm;
|
|
32225
32346
|
}
|
|
32226
32347
|
var NO_TRAFFIC = { "endings seen": 0, "endings counted": 0, events: 0, lastSeen: "" };
|
|
32227
|
-
var FORM_KEYS_HINT = "A Form's candidates are one row per Form: `baker analytics conversions --flow <slug>` lists that Form's event keys, and `--candidates --output json` lists every key.";
|
|
32348
|
+
var FORM_KEYS_HINT = "A Form's candidates are one row per Form: `baker analytics conversions --flow <slug>` lists that Form's event keys, and `--candidates --full --output json` lists every key with every field.";
|
|
32228
32349
|
function renderConversionsMarkdown(envelope) {
|
|
32229
32350
|
const { definitions, flow, flows, candidates } = envelope.data;
|
|
32230
32351
|
const data = {
|
|
@@ -32261,7 +32382,7 @@ function renderConversionsMarkdown(envelope) {
|
|
|
32261
32382
|
return renderMarkdown3({ data, ...hints2.length > 0 ? { hints: hints2 } : {} });
|
|
32262
32383
|
}
|
|
32263
32384
|
function withFormatHint(envelope, format) {
|
|
32264
|
-
const hints2 = [...envelope.hints ?? [], ...formatHint(envelope.data, format)];
|
|
32385
|
+
const hints2 = [...envelope.hints ?? [], ...formatHint({ ...envelope.data }, format)];
|
|
32265
32386
|
return { ...envelope, ...hints2.length > 0 ? { hints: hints2 } : {} };
|
|
32266
32387
|
}
|
|
32267
32388
|
|
|
@@ -34419,13 +34540,13 @@ function readFlowConversions2(slug, definitions) {
|
|
|
34419
34540
|
endings: joinFlowConversions(flowEventKeys(tree, slug), definitions)
|
|
34420
34541
|
};
|
|
34421
34542
|
}
|
|
34422
|
-
function conversionsEnvelope(args5, definitions, candidates,
|
|
34543
|
+
function conversionsEnvelope(args5, definitions, candidates, leadingHints = []) {
|
|
34423
34544
|
const flow = args5.flowSlug === void 0 ? null : readFlowConversions2(args5.flowSlug, definitions);
|
|
34424
34545
|
const forms = flow === null ? readWorkspaceFlows() : [];
|
|
34425
34546
|
const coverage = flowCoverage(forms, definitions);
|
|
34426
34547
|
const page = pageCandidates(definitions, candidates, args5.candidates);
|
|
34427
34548
|
const hints2 = [
|
|
34428
|
-
...
|
|
34549
|
+
...leadingHints,
|
|
34429
34550
|
...flow ? flowConversionHints(flow.slug, flow.endings, flow.noConversionReason) : [],
|
|
34430
34551
|
...flowCoverageHints(coverage),
|
|
34431
34552
|
...stagedHints(definitions),
|
|
@@ -34438,7 +34559,7 @@ function conversionsEnvelope(args5, definitions, candidates, serverHints = []) {
|
|
|
34438
34559
|
definitions,
|
|
34439
34560
|
...flow ? { flow } : {},
|
|
34440
34561
|
...coverage.length > 0 ? { flows: coverage } : {},
|
|
34441
|
-
...args5.candidates ? { candidates: page.candidates } : {}
|
|
34562
|
+
...args5.candidates ? { candidates: candidatesForFlow(page.candidates, args5.flowSlug) } : {}
|
|
34442
34563
|
},
|
|
34443
34564
|
...hints2.length > 0 ? { hints: hints2 } : {}
|
|
34444
34565
|
};
|
|
@@ -34482,12 +34603,17 @@ var conversionsCommand3 = (() => {
|
|
|
34482
34603
|
},
|
|
34483
34604
|
candidates: {
|
|
34484
34605
|
type: "boolean",
|
|
34485
|
-
description: "Also list every event these pages actually produced, ranked by volume, with whether it is already counted. This is where an event key comes from \u2014 do not invent one.
|
|
34606
|
+
description: "Also list every event these pages actually produced, ranked by volume, with whether it is already counted. This is where an event key comes from \u2014 do not invent one. Compact by default in JSON: each page or system event is one line (eventKey, events, sessions, countedAs when counted) and a Form's keys fold onto its `flows` row as `keys` and `events` (or a `formCandidates` row for a Form not in `flows`). Add --flow <slug> for that Form's keys only, and --full --output json for every field of every row",
|
|
34607
|
+
required: false
|
|
34608
|
+
},
|
|
34609
|
+
full: {
|
|
34610
|
+
type: "boolean",
|
|
34611
|
+
description: "With --candidates: every field of every candidate (origin, nodeType, flowSlug, lastSeen, sources, doors) and every Form key unfolded. Large on a busy company \u2014 narrow it with --flow first",
|
|
34486
34612
|
required: false
|
|
34487
34613
|
},
|
|
34488
34614
|
flow: {
|
|
34489
34615
|
type: "string",
|
|
34490
|
-
description: "A Form slug. Lists that Form's own endings already spelled as event keys, each with the name Baker counts it under or nothing \u2014 read off the Form's file, so it works on a Form built minutes ago that has never been visited, which is exactly when --candidates is empty. Use it whenever you create or edit a Form: it is the only way to see that the Form counts nothing before it is published counting nothing",
|
|
34616
|
+
description: "A Form slug. Lists that Form's own endings already spelled as event keys, each with the name Baker counts it under or nothing \u2014 read off the Form's file, so it works on a Form built minutes ago that has never been visited, which is exactly when --candidates is empty. With --candidates, narrows the candidates to that Form's keys. Use it whenever you create or edit a Form: it is the only way to see that the Form counts nothing before it is published counting nothing",
|
|
34491
34617
|
required: false
|
|
34492
34618
|
},
|
|
34493
34619
|
days: {
|
|
@@ -34505,7 +34631,7 @@ var conversionsCommand3 = (() => {
|
|
|
34505
34631
|
return defineCommand99({
|
|
34506
34632
|
meta: {
|
|
34507
34633
|
name: "conversions",
|
|
34508
|
-
description: "What this company counts as a conversion \u2014 the numerator of every conversion rate on Measure. A page event (a Form ending, a data-baker-* event) and an event one of the client's systems sends (a HubSpot event made with `baker analytics sources --create-hubspot`, an order the server posts) both count; a system's event is credited to the last landing its person viewed. A HubSpot event is `page:<its name>` here \u2014 `--event 'page:Deal won' --name 'Deal won'`. Run with no flags first: an empty `definitions` list means every conversion number in every other report is zero \u2014 not because nobody converted, but because nothing is marked as converting, and Baker never guesses. Add `--candidates` to see everything these pages actually do (every Form step, every data-baker-* event, every outbound destination) with counts and whether it is already counted; that list is where an event key comes from, so never invent one. Then `--event <key> --name 'Booked a call'` to count it. Inside a chat a change is STAGED: the person sees it under Sources in the chat's changes, on the event's own row and it applies when they publish, retroactively \u2014 the whole history is rescored, so a company that has been running for a month gets a month of correct numbers. A read shows a proposal marked `staged`. Call an event by its name when you talk to the person, never by its key. Two events given the SAME --name are one row and one number. `--remove <key>` stops counting one. `--flow <slug>` answers the other direction \u2014 what one Form counts, with every ending it has already spelled as an event key, read from the Form itself so it works before a single visitor has seen it. Run it whenever you create or edit a Form: a Form nobody named an outcome for is published converting nobody, and no report says so."
|
|
34634
|
+
description: "What this company counts as a conversion \u2014 the numerator of every conversion rate on Measure. A page event (a Form ending, a data-baker-* event) and an event one of the client's systems sends (a HubSpot event made with `baker analytics sources --create-hubspot`, an order the server posts) both count; a system's event is credited to the last landing its person viewed. A HubSpot event is `page:<its name>` here \u2014 `--event 'page:Deal won' --name 'Deal won'`. Run with no flags first: an empty `definitions` list means every conversion number in every other report is zero \u2014 not because nobody converted, but because nothing is marked as converting, and Baker never guesses. Add `--candidates` to see everything these pages actually do (every Form step, every data-baker-* event, every outbound destination) with counts and whether it is already counted; that list is where an event key comes from, so never invent one. It is compact: a Form's keys fold onto its `flows` row, `--candidates --flow <slug>` lists one Form's keys, and `--full --output json` returns every field of every row. Then `--event <key> --name 'Booked a call'` to count it. Inside a chat a change is STAGED: the person sees it under Sources in the chat's changes, on the event's own row and it applies when they publish, retroactively \u2014 the whole history is rescored, so a company that has been running for a month gets a month of correct numbers. A read shows a proposal marked `staged`. Call an event by its name when you talk to the person, never by its key. Two events given the SAME --name are one row and one number. `--remove <key>` stops counting one. `--flow <slug>` answers the other direction \u2014 what one Form counts, with every ending it has already spelled as an event key, read from the Form itself so it works before a single visitor has seen it. Run it whenever you create or edit a Form: a Form nobody named an outcome for is published converting nobody, and no report says so."
|
|
34509
34635
|
},
|
|
34510
34636
|
args: args5,
|
|
34511
34637
|
run: async ({ args: raw }) => {
|
|
@@ -34525,10 +34651,10 @@ var conversionsCommand3 = (() => {
|
|
|
34525
34651
|
args6,
|
|
34526
34652
|
mergeStoredWithCounts(stored, report.data.conversions ?? []),
|
|
34527
34653
|
report.data.eventCatalog ?? [],
|
|
34528
|
-
answer.hints ?? []
|
|
34654
|
+
[...answer.hints ?? [], ...fullFlagHints(args6, format)]
|
|
34529
34655
|
);
|
|
34530
34656
|
if (format === "md") process.stdout.write(renderConversionsMarkdown(envelope));
|
|
34531
|
-
else writeJsonEnvelope(withFormatHint(envelope, format));
|
|
34657
|
+
else writeJsonEnvelope(withFormatHint(compactConversionsEnvelope(envelope, args6), format));
|
|
34532
34658
|
} catch (err) {
|
|
34533
34659
|
if (err instanceof ConversionArgsError) {
|
|
34534
34660
|
handleError3(new ApiError("VALIDATION_ERROR", err.message));
|
|
@@ -54441,13 +54567,13 @@ function compactHit(hit) {
|
|
|
54441
54567
|
};
|
|
54442
54568
|
}
|
|
54443
54569
|
function providerHitNormalizer(record, full) {
|
|
54444
|
-
const
|
|
54570
|
+
const compact4 = compactHit(record);
|
|
54445
54571
|
if (!full) {
|
|
54446
|
-
return
|
|
54572
|
+
return compact4;
|
|
54447
54573
|
}
|
|
54448
54574
|
const group = asRecord2(record.group);
|
|
54449
54575
|
return {
|
|
54450
|
-
...
|
|
54576
|
+
...compact4,
|
|
54451
54577
|
externalUrl: str(record.externalUrl),
|
|
54452
54578
|
externalId: str(record.externalId),
|
|
54453
54579
|
description: str(record.description),
|
|
@@ -55209,7 +55335,7 @@ registerSchema({
|
|
|
55209
55335
|
}
|
|
55210
55336
|
});
|
|
55211
55337
|
var POLL_INTERVAL_MS3 = 4e3;
|
|
55212
|
-
function
|
|
55338
|
+
function compact3(doc) {
|
|
55213
55339
|
return {
|
|
55214
55340
|
layeredImageId: doc.layeredImageId,
|
|
55215
55341
|
imageId: doc.imageId,
|
|
@@ -55299,7 +55425,7 @@ var layerizeCommand = defineCommand157({
|
|
|
55299
55425
|
});
|
|
55300
55426
|
process.exit(1);
|
|
55301
55427
|
}
|
|
55302
|
-
writeJson({ ok: true, data: full ? settled :
|
|
55428
|
+
writeJson({ ok: true, data: full ? settled : compact3(settled), hints: hintsFor3(settled) });
|
|
55303
55429
|
} catch (err) {
|
|
55304
55430
|
if (err instanceof ApiError) {
|
|
55305
55431
|
writeJson({ ok: false, error: { code: err.code, message: err.message } });
|
|
@@ -55338,7 +55464,7 @@ var layersCommand = defineCommand157({
|
|
|
55338
55464
|
process.exit(1);
|
|
55339
55465
|
}
|
|
55340
55466
|
const doc = await apiGet("/api/images/layers", { imageId });
|
|
55341
|
-
writeJson({ ok: true, data: args5.full ? doc :
|
|
55467
|
+
writeJson({ ok: true, data: args5.full ? doc : compact3(doc), hints: hintsFor3(doc) });
|
|
55342
55468
|
} catch (err) {
|
|
55343
55469
|
if (err instanceof ApiError) {
|
|
55344
55470
|
writeJson({
|
|
@@ -64254,27 +64380,32 @@ var getCommand4 = defineCommand199({
|
|
|
64254
64380
|
|
|
64255
64381
|
// src/commands/scheduled-agents/list.ts
|
|
64256
64382
|
import { defineCommand as defineCommand200 } from "citty";
|
|
64383
|
+
var FULL_DESCRIPTION = "Return every item and staged change as stored, briefs included (tens of KB). Prefer `get <id>` for one item.";
|
|
64257
64384
|
registerSchema({
|
|
64258
64385
|
command: "scheduled-agents.list",
|
|
64259
|
-
description: "List published
|
|
64386
|
+
description: "List scheduled agents compactly: each published item's id, name, trigger, enabled and run counts, and each change this chat staged (index, kind, ref, name, trigger). Briefs are left out \u2014 `get <id>` returns one item in full, --full returns everything as stored. Includes draft state when BAKER_CHAT_ID is set, or --chat <id> to read an earlier chat's staged items instead.",
|
|
64260
64387
|
args: {
|
|
64261
|
-
chat: { type: "string", description: CHAT_READ_ARG.description, required: false }
|
|
64388
|
+
chat: { type: "string", description: CHAT_READ_ARG.description, required: false },
|
|
64389
|
+
full: { type: "boolean", description: FULL_DESCRIPTION, required: false }
|
|
64262
64390
|
}
|
|
64263
64391
|
});
|
|
64264
64392
|
var listCommand17 = defineCommand200({
|
|
64265
64393
|
meta: {
|
|
64266
64394
|
name: "list",
|
|
64267
|
-
description: "List scheduled agents
|
|
64395
|
+
description: "List scheduled agents: id, name, trigger and status for each, plus this chat's staged changes when BAKER_CHAT_ID is set (or --chat <id> for an earlier chat's). Briefs are left out. Start here: baker scheduled-agents list; then baker scheduled-agents get <id> for one item's brief."
|
|
64396
|
+
},
|
|
64397
|
+
args: {
|
|
64398
|
+
chat: CHAT_READ_ARG,
|
|
64399
|
+
full: { type: "boolean", description: FULL_DESCRIPTION, required: false, default: false }
|
|
64268
64400
|
},
|
|
64269
|
-
args: { chat: CHAT_READ_ARG },
|
|
64270
64401
|
run: async ({ args: args5 }) => {
|
|
64271
64402
|
try {
|
|
64272
64403
|
const env = getEnv();
|
|
64273
|
-
const body = {};
|
|
64274
64404
|
const chatId = typeof args5.chat === "string" && args5.chat.length > 0 ? args5.chat : env.BAKER_CHAT_ID;
|
|
64275
|
-
|
|
64276
|
-
|
|
64277
|
-
|
|
64405
|
+
const body = {
|
|
64406
|
+
...chatId ? { chatId } : {},
|
|
64407
|
+
...args5.full === true ? { full: true } : {}
|
|
64408
|
+
};
|
|
64278
64409
|
const response = await apiPost("/api/scheduled-agents/list", body);
|
|
64279
64410
|
writeJson(response);
|
|
64280
64411
|
} catch (err) {
|
|
@@ -64962,7 +65093,7 @@ function adByHandHint(input) {
|
|
|
64962
65093
|
|
|
64963
65094
|
// src/commands/studio/batch.ts
|
|
64964
65095
|
function projectBatch(generation, full) {
|
|
64965
|
-
const
|
|
65096
|
+
const compact4 = {
|
|
64966
65097
|
generationId: generation.generationId,
|
|
64967
65098
|
kind: generation.kind,
|
|
64968
65099
|
status: generation.status,
|
|
@@ -64979,9 +65110,9 @@ function projectBatch(generation, full) {
|
|
|
64979
65110
|
...variant.error ? { error: variant.error } : {}
|
|
64980
65111
|
}))
|
|
64981
65112
|
};
|
|
64982
|
-
if (!full) return
|
|
65113
|
+
if (!full) return compact4;
|
|
64983
65114
|
return {
|
|
64984
|
-
...
|
|
65115
|
+
...compact4,
|
|
64985
65116
|
...generation.skillId ? { skillId: generation.skillId } : {},
|
|
64986
65117
|
...generation.imageSettings ? { imageSettings: generation.imageSettings } : {},
|
|
64987
65118
|
...generation.clipSettings ? { clipSettings: generation.clipSettings } : {},
|
|
@@ -68181,12 +68312,12 @@ function compactAdvertiser(record) {
|
|
|
68181
68312
|
};
|
|
68182
68313
|
}
|
|
68183
68314
|
function advertiserNormalizer(record, full) {
|
|
68184
|
-
const
|
|
68315
|
+
const compact4 = compactAdvertiser(record);
|
|
68185
68316
|
if (!full) {
|
|
68186
|
-
return
|
|
68317
|
+
return compact4;
|
|
68187
68318
|
}
|
|
68188
68319
|
return {
|
|
68189
|
-
...
|
|
68320
|
+
...compact4,
|
|
68190
68321
|
scraped_name: record.scraped_name ?? null,
|
|
68191
68322
|
image_url: record.image_url ?? null,
|
|
68192
68323
|
platforms: Array.isArray(record.platforms) ? record.platforms : [],
|
|
@@ -68747,12 +68878,12 @@ function followingHints(records) {
|
|
|
68747
68878
|
return hints2;
|
|
68748
68879
|
}
|
|
68749
68880
|
function followingNormalizer(record, full) {
|
|
68750
|
-
const
|
|
68881
|
+
const compact4 = compactFollowed(record);
|
|
68751
68882
|
if (!full) {
|
|
68752
|
-
return
|
|
68883
|
+
return compact4;
|
|
68753
68884
|
}
|
|
68754
68885
|
return {
|
|
68755
|
-
...
|
|
68886
|
+
...compact4,
|
|
68756
68887
|
image_url: record.image_url ?? null,
|
|
68757
68888
|
platforms: Array.isArray(record.platforms) ? record.platforms : []
|
|
68758
68889
|
};
|