@work-shape/catalyst-cli 0.8.0-rc.35 → 0.8.0-rc.37
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.d.ts +99 -0
- package/dist/index.js +340 -315
- package/package.json +4 -4
- package/skills/catalyst/SKILL.md +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8117,6 +8117,11 @@ declare const assetOperations: {
|
|
|
8117
8117
|
administrators: zod.ZodArray<zod.ZodString>;
|
|
8118
8118
|
}, zod_v4_core.$strip>>;
|
|
8119
8119
|
canSetAvailability: zod.ZodOptional<zod.ZodBoolean>;
|
|
8120
|
+
listedBy: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
8121
|
+
name: zod.ZodString;
|
|
8122
|
+
title: zod.ZodString;
|
|
8123
|
+
}, zod_v4_core.$strip>>>;
|
|
8124
|
+
listedByUnread: zod.ZodOptional<zod.ZodNumber>;
|
|
8120
8125
|
agentUse: zod.ZodOptional<zod.ZodEnum<{
|
|
8121
8126
|
everyone: "everyone";
|
|
8122
8127
|
granted: "granted";
|
|
@@ -11959,6 +11964,11 @@ declare const collaborationWorkspaceOperations: {
|
|
|
11959
11964
|
withdraw: "withdraw";
|
|
11960
11965
|
}>>;
|
|
11961
11966
|
requestId: z.ZodOptional<z.ZodString>;
|
|
11967
|
+
coveredBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11968
|
+
id: z.ZodString;
|
|
11969
|
+
name: z.ZodString;
|
|
11970
|
+
builtIn: z.ZodBoolean;
|
|
11971
|
+
}, z.core.$strip>>>;
|
|
11962
11972
|
}, z.core.$strip>;
|
|
11963
11973
|
publisher: z.ZodObject<{
|
|
11964
11974
|
state: z.ZodEnum<{
|
|
@@ -11974,6 +11984,11 @@ declare const collaborationWorkspaceOperations: {
|
|
|
11974
11984
|
withdraw: "withdraw";
|
|
11975
11985
|
}>>;
|
|
11976
11986
|
requestId: z.ZodOptional<z.ZodString>;
|
|
11987
|
+
coveredBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11988
|
+
id: z.ZodString;
|
|
11989
|
+
name: z.ZodString;
|
|
11990
|
+
builtIn: z.ZodBoolean;
|
|
11991
|
+
}, z.core.$strip>>>;
|
|
11977
11992
|
}, z.core.$strip>;
|
|
11978
11993
|
}, z.core.$strip>>;
|
|
11979
11994
|
}, z.core.$strip>;
|
|
@@ -12011,6 +12026,11 @@ declare const collaborationWorkspaceOperations: {
|
|
|
12011
12026
|
withdraw: "withdraw";
|
|
12012
12027
|
}>>;
|
|
12013
12028
|
requestId: z.ZodOptional<z.ZodString>;
|
|
12029
|
+
coveredBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12030
|
+
id: z.ZodString;
|
|
12031
|
+
name: z.ZodString;
|
|
12032
|
+
builtIn: z.ZodBoolean;
|
|
12033
|
+
}, z.core.$strip>>>;
|
|
12014
12034
|
}, z.core.$strip>;
|
|
12015
12035
|
};
|
|
12016
12036
|
readonly errors: readonly ["NOT_FOUND", "CONFLICT"];
|
|
@@ -12178,6 +12198,11 @@ declare const collaborationWorkspaceOperations: {
|
|
|
12178
12198
|
withdraw: "withdraw";
|
|
12179
12199
|
}>>;
|
|
12180
12200
|
requestId: z.ZodOptional<z.ZodString>;
|
|
12201
|
+
coveredBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12202
|
+
id: z.ZodString;
|
|
12203
|
+
name: z.ZodString;
|
|
12204
|
+
builtIn: z.ZodBoolean;
|
|
12205
|
+
}, z.core.$strip>>>;
|
|
12181
12206
|
}, z.core.$strip>;
|
|
12182
12207
|
};
|
|
12183
12208
|
readonly errors: readonly ["NOT_FOUND", "CONFLICT"];
|
|
@@ -12345,6 +12370,11 @@ declare const collaborationWorkspaceOperations: {
|
|
|
12345
12370
|
withdraw: "withdraw";
|
|
12346
12371
|
}>>;
|
|
12347
12372
|
requestId: z.ZodOptional<z.ZodString>;
|
|
12373
|
+
coveredBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12374
|
+
id: z.ZodString;
|
|
12375
|
+
name: z.ZodString;
|
|
12376
|
+
builtIn: z.ZodBoolean;
|
|
12377
|
+
}, z.core.$strip>>>;
|
|
12348
12378
|
}, z.core.$strip>;
|
|
12349
12379
|
};
|
|
12350
12380
|
readonly errors: readonly ["NOT_FOUND"];
|
|
@@ -19083,6 +19113,32 @@ declare const conversationOperations: {
|
|
|
19083
19113
|
readonly errors: readonly ["NOT_FOUND"];
|
|
19084
19114
|
readonly rateClass: "read";
|
|
19085
19115
|
}>;
|
|
19116
|
+
readonly "conversations.cost.get": Operation<{
|
|
19117
|
+
readonly id: "conversations.cost.get";
|
|
19118
|
+
readonly method: "GET";
|
|
19119
|
+
readonly path: "/api/v1/conversations/:conversationId/cost";
|
|
19120
|
+
readonly summary: "Read the settled cost of a conversation so far: the caller's own calls, or the whole chat for a holder of usage.view in a chat more people read";
|
|
19121
|
+
readonly tag: "Conversations";
|
|
19122
|
+
readonly auth: "user";
|
|
19123
|
+
readonly scope: "conversation:read";
|
|
19124
|
+
readonly requires: readonly [];
|
|
19125
|
+
readonly effect: "reading";
|
|
19126
|
+
readonly response: {
|
|
19127
|
+
readonly kind: "json";
|
|
19128
|
+
readonly schema: z.ZodObject<{
|
|
19129
|
+
scope: z.ZodEnum<{
|
|
19130
|
+
conversation: "conversation";
|
|
19131
|
+
own: "own";
|
|
19132
|
+
}>;
|
|
19133
|
+
shared: z.ZodBoolean;
|
|
19134
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
19135
|
+
costMicros: z.ZodNumber;
|
|
19136
|
+
complete: z.ZodBoolean;
|
|
19137
|
+
}, z.core.$strip>;
|
|
19138
|
+
};
|
|
19139
|
+
readonly errors: readonly ["NOT_FOUND"];
|
|
19140
|
+
readonly rateClass: "read";
|
|
19141
|
+
}>;
|
|
19086
19142
|
readonly "conversations.structured_data.get": Operation<{
|
|
19087
19143
|
readonly id: "conversations.structured_data.get";
|
|
19088
19144
|
readonly method: "GET";
|
|
@@ -20580,6 +20636,33 @@ declare const conversationOperations: {
|
|
|
20580
20636
|
readonly errors: readonly ["NOT_FOUND", "CONFLICT", "GUARDRAIL_BLOCKED"];
|
|
20581
20637
|
readonly rateClass: "write";
|
|
20582
20638
|
}>;
|
|
20639
|
+
readonly "transcriptions.create": Operation<{
|
|
20640
|
+
readonly id: "transcriptions.create";
|
|
20641
|
+
readonly method: "POST";
|
|
20642
|
+
readonly path: "/api/v1/transcriptions";
|
|
20643
|
+
readonly summary: "Turn a recording from the composer into text, which is not stored";
|
|
20644
|
+
readonly tag: "Conversations";
|
|
20645
|
+
readonly auth: "user";
|
|
20646
|
+
readonly scope: "conversation:write";
|
|
20647
|
+
readonly requires: readonly [];
|
|
20648
|
+
readonly effect: "reading";
|
|
20649
|
+
readonly multipart: true;
|
|
20650
|
+
readonly query: z.ZodObject<{
|
|
20651
|
+
language: z.ZodOptional<z.ZodString>;
|
|
20652
|
+
conversationId: z.ZodOptional<z.ZodString>;
|
|
20653
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
20654
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
20655
|
+
}, z.core.$strip>;
|
|
20656
|
+
readonly response: {
|
|
20657
|
+
readonly kind: "json";
|
|
20658
|
+
readonly schema: z.ZodObject<{
|
|
20659
|
+
text: z.ZodString;
|
|
20660
|
+
durationSeconds: z.ZodNumber;
|
|
20661
|
+
}, z.core.$strip>;
|
|
20662
|
+
};
|
|
20663
|
+
readonly errors: readonly ["NOT_FOUND", "TIMEOUT"];
|
|
20664
|
+
readonly rateClass: "write";
|
|
20665
|
+
}>;
|
|
20583
20666
|
readonly "conversations.runs.create": Operation<{
|
|
20584
20667
|
readonly id: "conversations.runs.create";
|
|
20585
20668
|
readonly method: "POST";
|
|
@@ -25828,6 +25911,7 @@ declare const instanceOperations: {
|
|
|
25828
25911
|
tokensPerDay: z.ZodOptional<z.ZodNumber>;
|
|
25829
25912
|
tokensPerMonth: z.ZodOptional<z.ZodNumber>;
|
|
25830
25913
|
}, z.core.$strip>;
|
|
25914
|
+
showConversationCost: z.ZodOptional<z.ZodBoolean>;
|
|
25831
25915
|
}, z.core.$strip>;
|
|
25832
25916
|
views: z.ZodDefault<z.ZodObject<{
|
|
25833
25917
|
allowedScriptSrc: z.ZodArray<z.ZodString>;
|
|
@@ -25847,6 +25931,9 @@ declare const instanceOperations: {
|
|
|
25847
25931
|
knowledge: z.ZodOptional<z.ZodObject<{
|
|
25848
25932
|
semanticSearch: z.ZodBoolean;
|
|
25849
25933
|
}, z.core.$strip>>;
|
|
25934
|
+
transcription: z.ZodOptional<z.ZodObject<{
|
|
25935
|
+
enabled: z.ZodBoolean;
|
|
25936
|
+
}, z.core.$strip>>;
|
|
25850
25937
|
features: z.ZodObject<{
|
|
25851
25938
|
attachments: z.ZodObject<{
|
|
25852
25939
|
enabled: z.ZodBoolean;
|
|
@@ -29818,6 +29905,8 @@ declare const personalApiKeyOperations: {
|
|
|
29818
29905
|
readonly kind: "json";
|
|
29819
29906
|
readonly schema: z.ZodObject<{
|
|
29820
29907
|
confirmed: z.ZodLiteral<true>;
|
|
29908
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29909
|
+
leftOutScopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29821
29910
|
}, z.core.$strip>;
|
|
29822
29911
|
};
|
|
29823
29912
|
readonly errors: readonly ["NOT_FOUND"];
|
|
@@ -39009,6 +39098,11 @@ declare const assetSchema: z.ZodObject<{
|
|
|
39009
39098
|
administrators: z.ZodArray<z.ZodString>;
|
|
39010
39099
|
}, z.core.$strip>>;
|
|
39011
39100
|
canSetAvailability: z.ZodOptional<z.ZodBoolean>;
|
|
39101
|
+
listedBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
39102
|
+
name: z.ZodString;
|
|
39103
|
+
title: z.ZodString;
|
|
39104
|
+
}, z.core.$strip>>>;
|
|
39105
|
+
listedByUnread: z.ZodOptional<z.ZodNumber>;
|
|
39012
39106
|
agentUse: z.ZodOptional<z.ZodEnum<{
|
|
39013
39107
|
everyone: "everyone";
|
|
39014
39108
|
granted: "granted";
|
|
@@ -39660,6 +39754,11 @@ interface PublishReview {
|
|
|
39660
39754
|
}
|
|
39661
39755
|
declare function publishReview(candidate: Asset, live: Asset | undefined): PublishReview;
|
|
39662
39756
|
|
|
39757
|
+
/**
|
|
39758
|
+
* `config push`: writes every changed asset that is still at the revision of its last pull, and
|
|
39759
|
+
* skips each one that changed on the instance since, without writing it. The skipped ones are
|
|
39760
|
+
* listed with the scoped pull that reads them, and the push then ends with exit code 1.
|
|
39761
|
+
*/
|
|
39663
39762
|
declare function pushConfig(options: ConfigCommandOptions): Promise<number>;
|
|
39664
39763
|
|
|
39665
39764
|
type ConfigCommandName = "pull" | "push" | "diff" | "validate" | "list" | "show";
|
package/dist/index.js
CHANGED
|
@@ -1432,17 +1432,27 @@ var knowledgeIngestOutputSchema = operationBatchResultSchema.extend({
|
|
|
1432
1432
|
});
|
|
1433
1433
|
var knowledgeWithdrawInputSchema = z3.strictObject({ itemIds: z3.array(id).min(1) });
|
|
1434
1434
|
var knowledgeWithdrawOutputSchema = z3.strictObject({ withdrawn: count });
|
|
1435
|
+
var KNOWLEDGE_PENDING_MAX_LIMIT = 1e3;
|
|
1435
1436
|
var knowledgePendingInputSchema = z3.strictObject({
|
|
1436
1437
|
type: id.optional(),
|
|
1438
|
+
/** Only documents whose `changedAt` is after this time. */
|
|
1437
1439
|
since: z3.iso.datetime({ offset: true }).optional(),
|
|
1438
|
-
limit: z3.number().int().positive()
|
|
1440
|
+
limit: z3.number().int().positive().max(KNOWLEDGE_PENDING_MAX_LIMIT)
|
|
1439
1441
|
});
|
|
1440
1442
|
var knowledgePendingRowSchema = z3.strictObject({
|
|
1441
1443
|
id,
|
|
1442
1444
|
type: id,
|
|
1443
1445
|
contentHash: hash,
|
|
1446
|
+
source: z3.string().min(1).nullable(),
|
|
1447
|
+
path: z3.string().startsWith("/"),
|
|
1448
|
+
name: z3.string().min(1),
|
|
1449
|
+
changedAt: z3.iso.datetime({ offset: true }),
|
|
1444
1450
|
pages: workflowDatasetReferenceSchema
|
|
1445
1451
|
});
|
|
1452
|
+
var knowledgePendingPageRowSchema = z3.strictObject({
|
|
1453
|
+
page: z3.number().int().positive(),
|
|
1454
|
+
text: z3.string()
|
|
1455
|
+
});
|
|
1446
1456
|
var knowledgePendingOutputSchema = z3.strictObject({
|
|
1447
1457
|
documents: workflowDatasetReferenceSchema
|
|
1448
1458
|
});
|
|
@@ -2839,7 +2849,7 @@ import { z as z68 } from "zod";
|
|
|
2839
2849
|
// ../api-contract/package.json
|
|
2840
2850
|
var package_default = {
|
|
2841
2851
|
name: "@work-shape/catalyst-api-contract",
|
|
2842
|
-
version: "0.8.0-rc.
|
|
2852
|
+
version: "0.8.0-rc.37",
|
|
2843
2853
|
license: "MIT",
|
|
2844
2854
|
repository: {
|
|
2845
2855
|
type: "git",
|
|
@@ -3820,7 +3830,9 @@ var safeConfigSchema = z25.object({
|
|
|
3820
3830
|
modelCallsPerDay: z25.number().optional(),
|
|
3821
3831
|
tokensPerDay: z25.number().optional(),
|
|
3822
3832
|
tokensPerMonth: z25.number().optional()
|
|
3823
|
-
})
|
|
3833
|
+
}),
|
|
3834
|
+
/** The context indicator shows what the conversation has cost so far (LU-7). Absent before. */
|
|
3835
|
+
showConversationCost: z25.boolean().optional()
|
|
3824
3836
|
}),
|
|
3825
3837
|
/** What a generated view may load besides the instance's own view runtime. */
|
|
3826
3838
|
views: z25.object({ allowedScriptSrc: z25.array(z25.string()) }).default(() => ({ allowedScriptSrc: [] })),
|
|
@@ -3842,6 +3854,11 @@ var safeConfigSchema = z25.object({
|
|
|
3842
3854
|
* one made in the interface then starts with `[semantic, keyword]`, else with `[keyword]`.
|
|
3843
3855
|
*/
|
|
3844
3856
|
knowledge: z25.object({ semanticSearch: z25.boolean() }).optional(),
|
|
3857
|
+
/**
|
|
3858
|
+
* Speech to text in the composer (STT-1): on where release config has a transcription
|
|
3859
|
+
* binding. Absent in the answer of an API from before it; the interface reads that as off.
|
|
3860
|
+
*/
|
|
3861
|
+
transcription: z25.object({ enabled: z25.boolean() }).optional(),
|
|
3845
3862
|
/** Derived from `modules` for one transition release. */
|
|
3846
3863
|
features: z25.object({
|
|
3847
3864
|
attachments: z25.object({
|
|
@@ -4267,6 +4284,13 @@ var ownUsageSchema = z28.object({
|
|
|
4267
4284
|
/** The instance; amounts only for admins. */
|
|
4268
4285
|
instance: usageSpendLevelSchema
|
|
4269
4286
|
});
|
|
4287
|
+
var conversationCostSchema = z28.object({
|
|
4288
|
+
scope: z28.enum(["own", "conversation"]),
|
|
4289
|
+
shared: z28.boolean(),
|
|
4290
|
+
currency: z28.string().optional(),
|
|
4291
|
+
costMicros: z28.number(),
|
|
4292
|
+
complete: z28.boolean()
|
|
4293
|
+
});
|
|
4270
4294
|
var ownUsageQuerySchema = z28.object({
|
|
4271
4295
|
workspaceId: z28.string().trim().min(1).max(200).optional()
|
|
4272
4296
|
});
|
|
@@ -4770,6 +4794,14 @@ var assetSchema = z30.object({
|
|
|
4770
4794
|
availability: agentAvailabilitySchema.optional(),
|
|
4771
4795
|
dependencyAvailability: dependencyAvailabilitySchema.optional(),
|
|
4772
4796
|
canSetAvailability: z30.boolean().optional(),
|
|
4797
|
+
/**
|
|
4798
|
+
* Only on skill reads, for a caller who may delete the skill: the agents it may read that
|
|
4799
|
+
* list it, in their draft, their live revision or their pending shared draft, sorted by name.
|
|
4800
|
+
* Its delete is refused while any agent does (SKILL-DEL-1). Absent where none does.
|
|
4801
|
+
*/
|
|
4802
|
+
listedBy: z30.array(z30.object({ name: z30.string(), title: z30.string() })).optional(),
|
|
4803
|
+
/** Of those agents, how many the caller may not read: counted, never named. */
|
|
4804
|
+
listedByUnread: z30.number().int().positive().optional(),
|
|
4773
4805
|
/** Only on agent reads: who uses the agent where it is available (AGENT-USE-1). */
|
|
4774
4806
|
agentUse: agentUseSchema.optional(),
|
|
4775
4807
|
/** Only on agent reads. The stored config stays intact; these references cannot run. */
|
|
@@ -6584,6 +6616,16 @@ var cancelRunRequestSchema = z33.object({
|
|
|
6584
6616
|
var cancelRunResponseSchema = z33.object({
|
|
6585
6617
|
run: agentRunSchema
|
|
6586
6618
|
});
|
|
6619
|
+
var transcriptionQuerySchema = z33.object({
|
|
6620
|
+
language: z33.string().regex(/^[a-z]{2,3}$/u).optional(),
|
|
6621
|
+
conversationId: z33.string().min(1).optional(),
|
|
6622
|
+
projectId: z33.string().min(1).optional(),
|
|
6623
|
+
workspaceId: z33.string().min(1).optional()
|
|
6624
|
+
});
|
|
6625
|
+
var transcriptionResponseSchema = z33.object({
|
|
6626
|
+
text: z33.string(),
|
|
6627
|
+
durationSeconds: z33.number().nonnegative()
|
|
6628
|
+
});
|
|
6587
6629
|
|
|
6588
6630
|
// ../api-contract/src/agent-proposals.ts
|
|
6589
6631
|
var revisionNumberSchema2 = z34.number().int().positive();
|
|
@@ -8198,7 +8240,9 @@ var memberBundleSchema = z39.object({
|
|
|
8198
8240
|
*/
|
|
8199
8241
|
change: z39.enum(MEMBER_BUNDLE_CHANGES).optional(),
|
|
8200
8242
|
/** The pending request, while one is open. */
|
|
8201
|
-
requestId: z39.string().optional()
|
|
8243
|
+
requestId: z39.string().optional(),
|
|
8244
|
+
/** For `inherited`: the roles that give it, where roles alone do. */
|
|
8245
|
+
coveredBy: z39.array(accessOriginRoleSchema).optional()
|
|
8202
8246
|
});
|
|
8203
8247
|
var workspaceMemberBundlesSchema = z39.object({
|
|
8204
8248
|
userId: z39.string(),
|
|
@@ -10651,6 +10695,20 @@ var conversationOperations = {
|
|
|
10651
10695
|
errors: ["NOT_FOUND"],
|
|
10652
10696
|
rateClass: "read"
|
|
10653
10697
|
}),
|
|
10698
|
+
"conversations.cost.get": defineOperation({
|
|
10699
|
+
id: "conversations.cost.get",
|
|
10700
|
+
method: "GET",
|
|
10701
|
+
path: "/api/v1/conversations/:conversationId/cost",
|
|
10702
|
+
summary: "Read the settled cost of a conversation so far: the caller's own calls, or the whole chat for a holder of usage.view in a chat more people read",
|
|
10703
|
+
tag: "Conversations",
|
|
10704
|
+
auth: "user",
|
|
10705
|
+
scope: "conversation:read",
|
|
10706
|
+
requires: [],
|
|
10707
|
+
effect: "reading",
|
|
10708
|
+
response: json(conversationCostSchema),
|
|
10709
|
+
errors: ["NOT_FOUND"],
|
|
10710
|
+
rateClass: "read"
|
|
10711
|
+
}),
|
|
10654
10712
|
"conversations.structured_data.get": defineOperation({
|
|
10655
10713
|
id: "conversations.structured_data.get",
|
|
10656
10714
|
method: "GET",
|
|
@@ -10746,6 +10804,24 @@ var conversationOperations = {
|
|
|
10746
10804
|
errors: ["NOT_FOUND", "CONFLICT", "GUARDRAIL_BLOCKED"],
|
|
10747
10805
|
rateClass: "write"
|
|
10748
10806
|
}),
|
|
10807
|
+
"transcriptions.create": defineOperation({
|
|
10808
|
+
id: "transcriptions.create",
|
|
10809
|
+
method: "POST",
|
|
10810
|
+
path: "/api/v1/transcriptions",
|
|
10811
|
+
summary: "Turn a recording from the composer into text, which is not stored",
|
|
10812
|
+
tag: "Conversations",
|
|
10813
|
+
auth: "user",
|
|
10814
|
+
scope: "conversation:write",
|
|
10815
|
+
requires: [],
|
|
10816
|
+
// It changes nothing: the recording and its text are not stored. The provider call is
|
|
10817
|
+
// metered as every model call is.
|
|
10818
|
+
effect: "reading",
|
|
10819
|
+
multipart: true,
|
|
10820
|
+
query: transcriptionQuerySchema,
|
|
10821
|
+
response: json(transcriptionResponseSchema),
|
|
10822
|
+
errors: ["NOT_FOUND", "TIMEOUT"],
|
|
10823
|
+
rateClass: "write"
|
|
10824
|
+
}),
|
|
10749
10825
|
"conversations.runs.create": defineOperation({
|
|
10750
10826
|
id: "conversations.runs.create",
|
|
10751
10827
|
method: "POST",
|
|
@@ -11466,7 +11542,7 @@ var shippedGuardrailSchema = z52.object({
|
|
|
11466
11542
|
* admin set it to ask on every publish. Absent on a guardrail without that setting.
|
|
11467
11543
|
*/
|
|
11468
11544
|
alwaysAsk: z52.boolean().optional(),
|
|
11469
|
-
/** Who switched it last and when. Absent while nobody has: it is
|
|
11545
|
+
/** Who switched it last and when. Absent while nobody has: it is as the release ships it. */
|
|
11470
11546
|
switchedBy: z52.object({ id: z52.string(), label: z52.string() }).optional(),
|
|
11471
11547
|
switchedAt: timestampSchema.optional(),
|
|
11472
11548
|
/** The caller holds `guardrail.publish` at instance scope and may switch it. */
|
|
@@ -12591,7 +12667,11 @@ var connectCodeSchema = z59.object({
|
|
|
12591
12667
|
var confirmConnectCodeRequestSchema = keyFieldsSchema;
|
|
12592
12668
|
|
|
12593
12669
|
// ../api-contract/src/operations/personal-api-keys.ts
|
|
12594
|
-
var confirmedConnectCodeSchema = z60.object({
|
|
12670
|
+
var confirmedConnectCodeSchema = z60.object({
|
|
12671
|
+
confirmed: z60.literal(true),
|
|
12672
|
+
scopes: z60.array(z60.string()).optional(),
|
|
12673
|
+
leftOutScopes: z60.array(z60.string()).optional()
|
|
12674
|
+
});
|
|
12595
12675
|
var personalApiKeyOperations = {
|
|
12596
12676
|
"me.api_keys.list": defineOperation({
|
|
12597
12677
|
id: "me.api_keys.list",
|
|
@@ -16871,10 +16951,18 @@ ${error.issues.map((issue) => `- ${issue.file}${issue.path ? ` (${issue.path})`
|
|
|
16871
16951
|
if (error.status === 404 && reason === UNKNOWN_OPERATION_REASON) {
|
|
16872
16952
|
return "This instance does not serve the asset operations this CLI uses. Upgrade the instance, or use the CLI of its release.";
|
|
16873
16953
|
}
|
|
16874
|
-
|
|
16954
|
+
const hint = keyScopeHint(error);
|
|
16955
|
+
return `${error.code ? `${error.code}: ` : ""}${error.message}${hint ? `
|
|
16956
|
+
${hint}` : ""}`;
|
|
16875
16957
|
}
|
|
16876
16958
|
return error instanceof Error ? error.message : String(error);
|
|
16877
16959
|
}
|
|
16960
|
+
function keyScopeHint(error) {
|
|
16961
|
+
const details = isRecord(error.details) ? error.details : void 0;
|
|
16962
|
+
if (error.status !== 403 || details?.reason !== "outside_key_scope") return void 0;
|
|
16963
|
+
const right = typeof details.action === "string" ? ` '${details.action}'` : "";
|
|
16964
|
+
return `Your account holds the right${right}, but this API key does not carry it: a key carries only the rights ticked when it was issued, so a right you were given after that is missing from it. Run 'catalyst login' and confirm a new key with the right ticked; it replaces the saved key. Where CATALYST_API_KEY is set, create a new key in Settings > API keys and set that instead.`;
|
|
16965
|
+
}
|
|
16878
16966
|
function writeOutput(options, text2) {
|
|
16879
16967
|
(options.stdout ?? ((value) => process.stdout.write(value)))(`${text2}
|
|
16880
16968
|
`);
|
|
@@ -17113,33 +17201,6 @@ import { parseArgs as parseArgs2 } from "util";
|
|
|
17113
17201
|
import { resolve as resolve5 } from "path";
|
|
17114
17202
|
import yaml6 from "js-yaml";
|
|
17115
17203
|
|
|
17116
|
-
// src/publish-file-changes.ts
|
|
17117
|
-
function publishFileChanges(next, live) {
|
|
17118
|
-
const after = filesOf(next);
|
|
17119
|
-
const before = filesOf(live);
|
|
17120
|
-
return [.../* @__PURE__ */ new Set([...after.keys(), ...before.keys()])].sort().flatMap((path) => {
|
|
17121
|
-
if (after.get(path) === before.get(path)) return [];
|
|
17122
|
-
return [`${path} (${!before.has(path) ? "added" : !after.has(path) ? "removed" : "changed"})`];
|
|
17123
|
-
});
|
|
17124
|
-
}
|
|
17125
|
-
function filesOf(asset) {
|
|
17126
|
-
if (asset?.files) return new Map(asset.files.map((file) => [file.path, file.sha256]));
|
|
17127
|
-
const result = /* @__PURE__ */ new Map();
|
|
17128
|
-
const config = asset?.config;
|
|
17129
|
-
if (!isRecord(config)) return result;
|
|
17130
|
-
if (Array.isArray(config.files)) {
|
|
17131
|
-
for (const file of config.files) {
|
|
17132
|
-
if (isRecord(file) && typeof file.path === "string" && typeof file.content === "string") {
|
|
17133
|
-
result.set(file.path, file.content);
|
|
17134
|
-
}
|
|
17135
|
-
}
|
|
17136
|
-
}
|
|
17137
|
-
if (asset?.kind === "workflow" && config.manifest !== void 0) {
|
|
17138
|
-
result.set("workflow.yaml", JSON.stringify(config.manifest));
|
|
17139
|
-
}
|
|
17140
|
-
return result;
|
|
17141
|
-
}
|
|
17142
|
-
|
|
17143
17204
|
// src/app-publish-data.ts
|
|
17144
17205
|
async function appPublishData(api, app, candidate, audienceLabel) {
|
|
17145
17206
|
const config = candidate.config;
|
|
@@ -17473,7 +17534,8 @@ function formatWarnings(warnings) {
|
|
|
17473
17534
|
}
|
|
17474
17535
|
function formatRefusal(error) {
|
|
17475
17536
|
const head = `Refused by the instance (HTTP ${error.status}${error.code ? ` ${error.code}` : ""}): ${error.message}`;
|
|
17476
|
-
|
|
17537
|
+
const hint = keyScopeHint(error);
|
|
17538
|
+
return [head, ...detailLines(error.details), ...hint ? [hint] : []].join("\n");
|
|
17477
17539
|
}
|
|
17478
17540
|
function detailLines(details) {
|
|
17479
17541
|
if (!isRecord(details)) return [];
|
|
@@ -17538,28 +17600,6 @@ function formatDryRun(name2, answer) {
|
|
|
17538
17600
|
}
|
|
17539
17601
|
|
|
17540
17602
|
// src/publish-question.ts
|
|
17541
|
-
async function askBeforePublish(options, publish2) {
|
|
17542
|
-
const { kind, command, name: name2, revision } = publish2;
|
|
17543
|
-
if (publish2.yes) return "unattended";
|
|
17544
|
-
if (!options.prompt) {
|
|
17545
|
-
writeError(
|
|
17546
|
-
options,
|
|
17547
|
-
`Publishing ${/^[aeiou]/u.test(kind) ? "an" : "a"} ${kind} needs your answer here, so a run without a terminal to ask publishes nothing. Run 'catalyst ${command} publish ${name2} --revision ${revision}' in a terminal and answer its question, add --yes to confirm it in your Inbox, or publish it in the interface.`
|
|
17548
|
-
);
|
|
17549
|
-
return "refused";
|
|
17550
|
-
}
|
|
17551
|
-
let answer;
|
|
17552
|
-
do {
|
|
17553
|
-
answer = await options.prompt(
|
|
17554
|
-
`Publish revision ${revision} of ${kind} '${name2}'? If approval is required, this files a request in the Inbox. ${publish2.details ? "[y/N; d=Details]" : "[y/N]"} `
|
|
17555
|
-
);
|
|
17556
|
-
if (/^d(?:etails)?$/iu.test(answer.trim()) && publish2.details) await publish2.details();
|
|
17557
|
-
else break;
|
|
17558
|
-
} while (true);
|
|
17559
|
-
if (/^y(?:es)?$/iu.test(answer.trim())) return "answered";
|
|
17560
|
-
writeError(options, "Nothing was published.");
|
|
17561
|
-
return "refused";
|
|
17562
|
-
}
|
|
17563
17603
|
var OVERTAKEN_LINE = "If another version goes live before it is decided, this request is settled as superseded: it can do nothing then and never overwrites that version.";
|
|
17564
17604
|
function isAlreadyLive(error) {
|
|
17565
17605
|
return error instanceof ConfigApiError && error.status === 409 && isRecord(error.details) && error.details.reason === "already_live";
|
|
@@ -17577,7 +17617,8 @@ function waitingPublishLine(run, approvalHint, note) {
|
|
|
17577
17617
|
function agentPublishRefusalHint(error) {
|
|
17578
17618
|
if (!(error instanceof ConfigApiError) || error.status !== 403) return void 0;
|
|
17579
17619
|
const reason = isRecord(error.details) ? error.details.reason : void 0;
|
|
17580
|
-
|
|
17620
|
+
if (reason === "outside_key_scope") return void 0;
|
|
17621
|
+
const keyRefused = reason === "user_only" || error.message.includes(`'${PUBLISH_SCOPE}'`);
|
|
17581
17622
|
return keyRefused ? `This key publishes no agent. A service principal's key, such as the release key of an operated instance, writes agent drafts and publishes none (AP-10); a personal key publishes only with the publish right, scope ${PUBLISH_SCOPE}. Publish the draft with such a personal key or on the agent page.` : "Publishing an agent needs the right agent.publish on it, which an instance admin holds.";
|
|
17582
17623
|
}
|
|
17583
17624
|
var PUBLISH_SCOPE = "config_assets:publish";
|
|
@@ -17598,7 +17639,7 @@ var APP_VERBS = {
|
|
|
17598
17639
|
},
|
|
17599
17640
|
publish: {
|
|
17600
17641
|
usage: "publish <app> [--revision <n>] [--audience self|workspace|instance] [--yes]",
|
|
17601
|
-
summary: "Choose who may use the App, show what the revision makes live,
|
|
17642
|
+
summary: "Choose who may use the App, show what the revision makes live, and publish it at once (assets.publish); --yes changes nothing. A publish that hands a source's data to people who may not use the source waits in the Inbox until a person who may change the source approves it"
|
|
17602
17643
|
},
|
|
17603
17644
|
status: {
|
|
17604
17645
|
usage: "status <app> [dir]",
|
|
@@ -17835,14 +17876,13 @@ async function publish(app, values, options) {
|
|
|
17835
17876
|
if (values.revision !== void 0) revisionNumber(values.revision);
|
|
17836
17877
|
const target = await openRepository(options, values, void 0, REPOSITORY_KINDS.app);
|
|
17837
17878
|
let audience = readAudience(values.audience);
|
|
17838
|
-
const get = (revision
|
|
17879
|
+
const get = (revision) => target.api.read(
|
|
17839
17880
|
(client) => client.assets.get({
|
|
17840
17881
|
params: { kind: APP_KIND, name: app },
|
|
17841
17882
|
query: {
|
|
17842
17883
|
workspaceId: target.workspaceId,
|
|
17843
17884
|
...audience ? { audience } : {},
|
|
17844
|
-
revision
|
|
17845
|
-
...files ? { files: "true" } : {}
|
|
17885
|
+
revision
|
|
17846
17886
|
}
|
|
17847
17887
|
})
|
|
17848
17888
|
);
|
|
@@ -17894,31 +17934,10 @@ async function publish(app, values, options) {
|
|
|
17894
17934
|
const together = number === (candidate.draftRevision ?? candidate.revision) && (startsWorkflows(candidate.config) || dataStoresOf(manifestOf(candidate.config)).length > 0) ? await appPublishTogether(target.api, app) : { workflows: [], dataStores: [], lines: [] };
|
|
17895
17935
|
const question = [formatReview(app, review), storedData, together.lines.join("\n")].filter(Boolean).join("\n");
|
|
17896
17936
|
const say = (text2) => values.json ? writeErr(options, text2) : writeOut(options, text2);
|
|
17897
|
-
const narrative =
|
|
17937
|
+
const narrative = candidate.publishNarrative;
|
|
17898
17938
|
say(
|
|
17899
17939
|
narrative ? [narrative.summary, ...narrative.warnings, ...together.lines].join("\n") : question
|
|
17900
17940
|
);
|
|
17901
|
-
const answer = await askBeforePublish(options, {
|
|
17902
|
-
kind: APP_KIND,
|
|
17903
|
-
command: APP_KIND,
|
|
17904
|
-
name: app,
|
|
17905
|
-
revision: number,
|
|
17906
|
-
yes: values.yes,
|
|
17907
|
-
...narrative ? {
|
|
17908
|
-
details: async () => {
|
|
17909
|
-
const detailed = await get(String(number), true);
|
|
17910
|
-
const before = candidate.publishedRevision === void 0 ? void 0 : await get(String(candidate.publishedRevision), true);
|
|
17911
|
-
say(
|
|
17912
|
-
[
|
|
17913
|
-
question,
|
|
17914
|
-
...publishFileChanges(detailed, before),
|
|
17915
|
-
...detailed.filesOmitted || before?.filesOmitted ? ["Some files are omitted from this review."] : []
|
|
17916
|
-
].join("\n")
|
|
17917
|
-
);
|
|
17918
|
-
}
|
|
17919
|
-
} : {}
|
|
17920
|
-
});
|
|
17921
|
-
if (answer === "refused") return EXIT.refused;
|
|
17922
17941
|
const outcome = await target.api.change(
|
|
17923
17942
|
(client, idempotencyKey2) => client.assets.publish({
|
|
17924
17943
|
params: { kind: APP_KIND, name: app },
|
|
@@ -17929,8 +17948,7 @@ async function publish(app, values, options) {
|
|
|
17929
17948
|
...together.workflows.length > 0 ? { workflows: together.workflows } : {},
|
|
17930
17949
|
...together.dataStores.length > 0 ? { dataStores: together.dataStores } : {}
|
|
17931
17950
|
},
|
|
17932
|
-
idempotencyKey: idempotencyKey2
|
|
17933
|
-
...answer === "unattended" ? { unattended: true } : {}
|
|
17951
|
+
idempotencyKey: idempotencyKey2
|
|
17934
17952
|
}),
|
|
17935
17953
|
`It may have been applied: run 'catalyst app status ${app}' before sending it again.`
|
|
17936
17954
|
);
|
|
@@ -18288,7 +18306,7 @@ A Workflow as a folder (workflow.yaml at its root, scripts in steps/):
|
|
|
18288
18306
|
catalyst workflow pull <workflow> [dir] [--published | --revision <n>] Write a revision into a folder (assets.get)
|
|
18289
18307
|
catalyst workflow push [dir] Send a changed folder as the next draft, or create the Workflow (assets.put)
|
|
18290
18308
|
catalyst workflow status <workflow> [dir] Show draft, published revision and local changes
|
|
18291
|
-
catalyst workflow publish <workflow> --revision <n>
|
|
18309
|
+
catalyst workflow publish <workflow> --revision <n> Review and publish at once (assets.publish)
|
|
18292
18310
|
catalyst workflow history <workflow> List revisions (assets.revisions.list)
|
|
18293
18311
|
catalyst workflow revert <workflow> --to <n> --if-revision <n> Restore a revision (assets.revert)
|
|
18294
18312
|
|
|
@@ -18304,8 +18322,8 @@ Options:
|
|
|
18304
18322
|
|
|
18305
18323
|
The instance decides every right and every check, and a refusal is printed as it gave it.
|
|
18306
18324
|
A write names the revision it was made against: read it with 'show' or 'history'.
|
|
18307
|
-
A publish
|
|
18308
|
-
|
|
18325
|
+
A publish is your own and goes live at once; it asks nothing, and --yes changes nothing. Where
|
|
18326
|
+
a guardrail of the instance asks for an approval, it waits for an approver instead.
|
|
18309
18327
|
A publish, an availability change or a move that hands a source's data to people who may not
|
|
18310
18328
|
use the source waits in the Inbox until a person who may change the source approves it. A key
|
|
18311
18329
|
never confirms that hand-over, whatever rights it holds.
|
|
@@ -18317,7 +18335,8 @@ agent asks first and then waits in the Inbox for a holder of agent.approve, and
|
|
|
18317
18335
|
publish offers it in its workspace. A workspace's agent made by someone without agent.approve
|
|
18318
18336
|
starts offered nowhere; 'catalyst agent publish <name> --revision 1' publishes it as made,
|
|
18319
18337
|
without a draft. A service principal's key publishes no agent. 'catalyst agent discard
|
|
18320
|
-
<name> --revision <n>' drops the draft.
|
|
18338
|
+
<name> --revision <n>' drops the draft. 'catalyst agent show <name> --revision draft' prints the
|
|
18339
|
+
draft; --revision published prints the live revision, and a number one of its history.
|
|
18321
18340
|
A skill has no draft: a put, a push or a revert is live. A skill of the instance or of a Shared
|
|
18322
18341
|
Workspace asks for skill.publish on a person's account or key with config_assets:publish;
|
|
18323
18342
|
without it the write files a request a holder of skill.approve decides in the Inbox, says so
|
|
@@ -18335,19 +18354,17 @@ import { resolve as resolve6 } from "path";
|
|
|
18335
18354
|
|
|
18336
18355
|
// src/push-guardrail-preflight.ts
|
|
18337
18356
|
async function preflightGuardrails(api, input) {
|
|
18357
|
+
const stale = [];
|
|
18338
18358
|
for (const asset of [...input.puts, ...input.deletes]) {
|
|
18339
18359
|
const base = input.baseOf(asset.key);
|
|
18340
18360
|
const current = input.listing.get(asset.key);
|
|
18341
18361
|
const revision = current?.revision ?? (base === void 0 ? void 0 : (await api.getLatestRevision(asset.kind, asset.name))?.revision);
|
|
18342
18362
|
if ((revision ?? null) !== (base?.revision ?? null)) {
|
|
18343
|
-
|
|
18344
|
-
input.options,
|
|
18345
|
-
`Push refused; nothing was applied. ${asset.key} changed since the last pull. Run 'catalyst config pull --only ${asset.key}'.`
|
|
18346
|
-
);
|
|
18347
|
-
return false;
|
|
18363
|
+
stale.push({ kind: asset.kind, name: asset.name, currentRevision: revision ?? null });
|
|
18348
18364
|
}
|
|
18349
18365
|
}
|
|
18350
|
-
|
|
18366
|
+
const staleKeys = new Set(stale.map((asset) => `${asset.kind}:${asset.name}`));
|
|
18367
|
+
for (const asset of input.puts.filter((put) => !staleKeys.has(put.key))) {
|
|
18351
18368
|
const checked = await api.read(
|
|
18352
18369
|
(client) => client.assets.validate({
|
|
18353
18370
|
params: { kind: asset.kind },
|
|
@@ -18363,14 +18380,27 @@ async function preflightGuardrails(api, input) {
|
|
|
18363
18380
|
input.options,
|
|
18364
18381
|
`Validation failed for ${asset.key}: ${checked.issues.length} ${checked.issues.length === 1 ? "issue" : "issues"}${paths.length ? ` (${paths.join(", ")})` : ""}; nothing was applied.`
|
|
18365
18382
|
);
|
|
18366
|
-
return
|
|
18383
|
+
return void 0;
|
|
18367
18384
|
}
|
|
18368
18385
|
}
|
|
18369
|
-
return
|
|
18386
|
+
return { stale };
|
|
18370
18387
|
}
|
|
18371
18388
|
|
|
18372
18389
|
// src/push.ts
|
|
18373
18390
|
async function pushConfig(options) {
|
|
18391
|
+
const skipped = { conflicts: [], defaultAgent: false };
|
|
18392
|
+
const code = await pushChanges(options, skipped);
|
|
18393
|
+
if (skipped.conflicts.length === 0 && !skipped.defaultAgent) return code;
|
|
18394
|
+
writeError(
|
|
18395
|
+
options,
|
|
18396
|
+
formatPushConflict(skipped.conflicts, skipped.defaultAgent, options, SKIPPED_HEADER)
|
|
18397
|
+
);
|
|
18398
|
+
return code === 0 || code === 3 ? 1 : code;
|
|
18399
|
+
}
|
|
18400
|
+
var SKIPPED_HEADER = "Skipped; these changed on the instance since the last pull and were not written:";
|
|
18401
|
+
async function pushChanges(options, skipped) {
|
|
18402
|
+
const skip = (conflicts) => skipped.conflicts.push(...conflicts);
|
|
18403
|
+
const isSkipped = (key2) => skipped.conflicts.some((conflict) => `${conflict.kind}:${conflict.name}` === key2);
|
|
18374
18404
|
const workingDir = resolveWorkingDir(options);
|
|
18375
18405
|
const manifest = await readManifest(workingDir);
|
|
18376
18406
|
const instance = await resolveInstance(manifest, options);
|
|
@@ -18434,7 +18464,7 @@ async function pushConfig(options) {
|
|
|
18434
18464
|
}
|
|
18435
18465
|
const touchedKeys = new Set(touched.map((asset) => asset.key));
|
|
18436
18466
|
const localKeys = new Set(assetEntries(local).map((asset) => asset.key));
|
|
18437
|
-
const
|
|
18467
|
+
const pruned = options.prune ? [...listing.values()].filter((asset) => !localKeys.has(asset.key)) : [];
|
|
18438
18468
|
const changesDefault = holdsWholeInstance(instance) && selectors.length === 0 && (bundle.defaultAgentName ?? null) !== baseline.defaultAgentName;
|
|
18439
18469
|
if (changesDefault && baseline.defaultAgentName === void 0) {
|
|
18440
18470
|
throw new Error(
|
|
@@ -18451,24 +18481,14 @@ async function pushConfig(options) {
|
|
|
18451
18481
|
touched.filter((asset) => asset.kind === "guardrail").map((asset) => asset.key)
|
|
18452
18482
|
)
|
|
18453
18483
|
);
|
|
18454
|
-
if (!touched.length && !
|
|
18484
|
+
if (!touched.length && !pruned.length && !changesDefault) {
|
|
18455
18485
|
writeOutput(options, "No local changes to push.");
|
|
18456
18486
|
return 0;
|
|
18457
18487
|
}
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
formatPushConflict(
|
|
18463
|
-
unseen.map((asset) => ({ ...asset, currentRevision: asset.revision })),
|
|
18464
|
-
false,
|
|
18465
|
-
options
|
|
18466
|
-
)
|
|
18467
|
-
);
|
|
18468
|
-
return 1;
|
|
18469
|
-
}
|
|
18470
|
-
const written = [...touched, ...deleteAssets];
|
|
18471
|
-
const foreign = written.flatMap((asset) => {
|
|
18488
|
+
skip(
|
|
18489
|
+
pruned.filter((asset) => baselineAssets[asset.key] === void 0).map((asset) => ({ kind: asset.kind, name: asset.name, currentRevision: asset.revision }))
|
|
18490
|
+
);
|
|
18491
|
+
const foreign = [...touched, ...pruned].flatMap((asset) => {
|
|
18472
18492
|
const base = baseOf(asset.key);
|
|
18473
18493
|
if (base === void 0) return [];
|
|
18474
18494
|
const address = { kind: asset.kind, name: asset.name };
|
|
@@ -18476,16 +18496,25 @@ async function pushConfig(options) {
|
|
|
18476
18496
|
const remote = listing.get(asset.key);
|
|
18477
18497
|
return remote !== void 0 && remote.id !== base.id ? [{ ...address, baseline: "replaced" }] : [];
|
|
18478
18498
|
});
|
|
18479
|
-
|
|
18480
|
-
writeError(options, formatPushConflict(foreign, false, options));
|
|
18481
|
-
return 1;
|
|
18482
|
-
}
|
|
18499
|
+
skip(foreign);
|
|
18483
18500
|
const isGuardrail = (asset) => asset.kind === "guardrail";
|
|
18484
|
-
const
|
|
18501
|
+
const guardrailCheck = await preflightGuardrails(api, {
|
|
18502
|
+
puts: touched.filter((asset) => isGuardrail(asset) && !isSkipped(asset.key)),
|
|
18503
|
+
deletes: pruned.filter((asset) => isGuardrail(asset) && !isSkipped(asset.key)),
|
|
18504
|
+
listing,
|
|
18505
|
+
baseOf,
|
|
18506
|
+
...instance.workspace === void 0 ? {} : { workspaceId: instance.workspace },
|
|
18507
|
+
options
|
|
18508
|
+
});
|
|
18509
|
+
if (guardrailCheck === void 0) return 1;
|
|
18510
|
+
skip(await describeStale(api, guardrailCheck.stale));
|
|
18511
|
+
const writable = touched.filter((asset) => !isSkipped(asset.key));
|
|
18512
|
+
const deleteAssets = pruned.filter((asset) => !isSkipped(asset.key));
|
|
18513
|
+
const fileSkillCandidates = writable.flatMap(
|
|
18485
18514
|
(asset) => asset.kind === "skill" && asset.folderFiles !== void 0 && JSON.stringify(extraHashes(folderHashes(asset.folderFiles))) !== JSON.stringify(extraHashes(baselineAssets[asset.key]?.files)) ? [{ ...asset, folderFiles: asset.folderFiles }] : []
|
|
18486
18515
|
);
|
|
18487
|
-
const fileSkillKeys = new Set(
|
|
18488
|
-
const syncTouched =
|
|
18516
|
+
const fileSkillKeys = new Set(fileSkillCandidates.map((asset) => asset.key));
|
|
18517
|
+
const syncTouched = writable.filter(
|
|
18489
18518
|
(asset) => !isGuardrail(asset) && !fileSkillKeys.has(asset.key)
|
|
18490
18519
|
);
|
|
18491
18520
|
const syncDeletes = deleteAssets.filter((asset) => !isGuardrail(asset));
|
|
@@ -18524,30 +18553,20 @@ async function pushConfig(options) {
|
|
|
18524
18553
|
`This push changes ${items.length} assets, and one push holds at most ${ASSET_RELEASE_SYNC_MAX_ITEMS}. Push in parts with --only.`
|
|
18525
18554
|
);
|
|
18526
18555
|
}
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
deletes: deleteAssets.filter(isGuardrail),
|
|
18530
|
-
listing,
|
|
18531
|
-
baseOf,
|
|
18532
|
-
...instance.workspace === void 0 ? {} : { workspaceId: instance.workspace },
|
|
18533
|
-
options
|
|
18534
|
-
}))
|
|
18535
|
-
return 1;
|
|
18536
|
-
for (const asset of fileSkills) {
|
|
18556
|
+
const fileSkills = [];
|
|
18557
|
+
for (const asset of fileSkillCandidates) {
|
|
18537
18558
|
const current = listing.get(asset.key);
|
|
18538
18559
|
const base = baseOf(asset.key);
|
|
18539
18560
|
const revision = current?.revision ?? (base === void 0 ? void 0 : (await api.getLatestRevision("skill", asset.name))?.revision);
|
|
18540
18561
|
if ((revision ?? null) !== (base?.revision ?? null)) {
|
|
18541
|
-
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
false,
|
|
18546
|
-
options
|
|
18547
|
-
)
|
|
18562
|
+
skip(
|
|
18563
|
+
await describeStale(api, [
|
|
18564
|
+
{ kind: "skill", name: asset.name, currentRevision: revision ?? null }
|
|
18565
|
+
])
|
|
18548
18566
|
);
|
|
18549
|
-
|
|
18567
|
+
continue;
|
|
18550
18568
|
}
|
|
18569
|
+
fileSkills.push(asset);
|
|
18551
18570
|
const checked = await api.read(
|
|
18552
18571
|
(client) => client.assets.validate({
|
|
18553
18572
|
params: { kind: "skill" },
|
|
@@ -18564,19 +18583,25 @@ async function pushConfig(options) {
|
|
|
18564
18583
|
}
|
|
18565
18584
|
const drafted = [];
|
|
18566
18585
|
const filed = [];
|
|
18567
|
-
|
|
18568
|
-
|
|
18586
|
+
const synced = items.length > 0 || changesDefault ? await syncBatch(
|
|
18587
|
+
api,
|
|
18588
|
+
{
|
|
18569
18589
|
...batchScope(instance),
|
|
18570
18590
|
items,
|
|
18571
18591
|
...changesDefault ? {
|
|
18572
18592
|
defaultAgentName: bundle.defaultAgentName ?? null,
|
|
18573
18593
|
expectedDefaultAgentName: baseline.defaultAgentName ?? null
|
|
18574
18594
|
} : {}
|
|
18575
|
-
}
|
|
18576
|
-
|
|
18577
|
-
|
|
18578
|
-
|
|
18579
|
-
|
|
18595
|
+
},
|
|
18596
|
+
options,
|
|
18597
|
+
skipped
|
|
18598
|
+
) : "empty";
|
|
18599
|
+
if (synced === void 0) {
|
|
18600
|
+
return 1;
|
|
18601
|
+
}
|
|
18602
|
+
const defaultWritten = changesDefault && !skipped.defaultAgent;
|
|
18603
|
+
const batchWritten = synced !== "empty";
|
|
18604
|
+
if (synced !== "empty") {
|
|
18580
18605
|
const result = synced;
|
|
18581
18606
|
const revisions = {};
|
|
18582
18607
|
const filedInSync = /* @__PURE__ */ new Set();
|
|
@@ -18608,7 +18633,9 @@ async function pushConfig(options) {
|
|
|
18608
18633
|
});
|
|
18609
18634
|
}
|
|
18610
18635
|
}
|
|
18611
|
-
const pushed = bundleOf(
|
|
18636
|
+
const pushed = bundleOf(
|
|
18637
|
+
syncTouched.filter((asset) => !filedInSync.has(asset.key) && !isSkipped(asset.key))
|
|
18638
|
+
);
|
|
18612
18639
|
await recordBaseline(
|
|
18613
18640
|
workingDir,
|
|
18614
18641
|
instance.key,
|
|
@@ -18616,7 +18643,7 @@ async function pushConfig(options) {
|
|
|
18616
18643
|
pushed,
|
|
18617
18644
|
revisions,
|
|
18618
18645
|
false,
|
|
18619
|
-
|
|
18646
|
+
defaultWritten ? bundle.defaultAgentName ?? null : baseline.defaultAgentName,
|
|
18620
18647
|
Object.fromEntries(
|
|
18621
18648
|
result.items.flatMap(
|
|
18622
18649
|
(item) => item.status === "applied" && item.type === "delete" ? [[`${item.kind}:${item.name}`, { id: item.id, revision: item.revision }]] : []
|
|
@@ -18663,11 +18690,7 @@ async function pushConfig(options) {
|
|
|
18663
18690
|
if (outcome.status === "pending_approval") {
|
|
18664
18691
|
writeError(
|
|
18665
18692
|
options,
|
|
18666
|
-
waitingGuardrail(
|
|
18667
|
-
asset.key,
|
|
18668
|
-
outcome.run.id,
|
|
18669
|
-
skillsWritten || items.length > 0 || changesDefault
|
|
18670
|
-
)
|
|
18693
|
+
waitingGuardrail(asset.key, outcome.run.id, skillsWritten || batchWritten)
|
|
18671
18694
|
);
|
|
18672
18695
|
return 1;
|
|
18673
18696
|
}
|
|
@@ -18722,21 +18745,14 @@ async function pushConfig(options) {
|
|
|
18722
18745
|
if (!(error instanceof ConfigApiError)) throw error;
|
|
18723
18746
|
const draftConflict = readDraftConflict(error);
|
|
18724
18747
|
const conflicts = draftConflict ? [{ ...draftConflict, kind: "skill", name: asset.name }] : error.code === "REVISION_CONFLICT" || error.code === "CONFLICT" ? readConflicts(error.details) : [];
|
|
18725
|
-
if (conflicts.length)
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
)
|
|
18734
|
-
);
|
|
18735
|
-
else
|
|
18736
|
-
writeError(
|
|
18737
|
-
options,
|
|
18738
|
-
`${asset.key}: ${error.code ?? "refused"}: ${error.message}. ${skillsWritten || items.length > 0 || changesDefault ? "What is reported above was applied; nothing after it." : "Nothing was applied."}`
|
|
18739
|
-
);
|
|
18748
|
+
if (conflicts.length > 0 || error.code === "REVISION_CONFLICT") {
|
|
18749
|
+
skip(conflicts.length > 0 ? conflicts : [{ kind: "skill", name: asset.name }]);
|
|
18750
|
+
continue;
|
|
18751
|
+
}
|
|
18752
|
+
writeError(
|
|
18753
|
+
options,
|
|
18754
|
+
`${asset.key}: ${error.code ?? "refused"}: ${error.message}. ${skillsWritten || batchWritten ? "What is reported above was applied; nothing after it." : "Nothing was applied."}`
|
|
18755
|
+
);
|
|
18740
18756
|
return 1;
|
|
18741
18757
|
}
|
|
18742
18758
|
}
|
|
@@ -18744,11 +18760,12 @@ async function pushConfig(options) {
|
|
|
18744
18760
|
workingDir,
|
|
18745
18761
|
instanceKey: instance.key,
|
|
18746
18762
|
version: baseline.lastPulledVersion,
|
|
18747
|
-
puts:
|
|
18763
|
+
puts: writable.filter(isGuardrail),
|
|
18748
18764
|
deletes: deleteAssets.filter(isGuardrail),
|
|
18749
18765
|
baseOf,
|
|
18750
18766
|
listing,
|
|
18751
|
-
|
|
18767
|
+
skip,
|
|
18768
|
+
afterSync: batchWritten || skillsWritten,
|
|
18752
18769
|
...instance.workspace === void 0 ? {} : { workspaceId: instance.workspace },
|
|
18753
18770
|
options
|
|
18754
18771
|
});
|
|
@@ -18778,19 +18795,6 @@ async function publishDrafts(api, drafts, input) {
|
|
|
18778
18795
|
}
|
|
18779
18796
|
};
|
|
18780
18797
|
for (const [index, draft] of drafts.entries()) {
|
|
18781
|
-
if (input.workspaceId !== void 0 && draft.kind === "agent") {
|
|
18782
|
-
const answer = await askBeforePublish(options, {
|
|
18783
|
-
kind: "agent",
|
|
18784
|
-
command: "agent",
|
|
18785
|
-
name: draft.name,
|
|
18786
|
-
revision: draft.draftRevision,
|
|
18787
|
-
yes: false
|
|
18788
|
-
});
|
|
18789
|
-
if (answer !== "answered") {
|
|
18790
|
-
unpublished(index);
|
|
18791
|
-
return 1;
|
|
18792
|
-
}
|
|
18793
|
-
}
|
|
18794
18798
|
let outcome;
|
|
18795
18799
|
try {
|
|
18796
18800
|
outcome = await api.change(
|
|
@@ -18847,53 +18851,75 @@ function publishRefusal(draft, error) {
|
|
|
18847
18851
|
...hint === void 0 ? [] : [hint]
|
|
18848
18852
|
].join("\n");
|
|
18849
18853
|
}
|
|
18850
|
-
async function syncBatch(api,
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
warnings
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18854
|
+
async function syncBatch(api, initial, options, skipped) {
|
|
18855
|
+
let batch = initial;
|
|
18856
|
+
for (; ; ) {
|
|
18857
|
+
if (batch.items.length === 0 && batch.defaultAgentName === void 0) return "empty";
|
|
18858
|
+
try {
|
|
18859
|
+
const checked = await checkSyncOnThisRelease(api, batch);
|
|
18860
|
+
const outcome = await api.syncAssets(batch);
|
|
18861
|
+
if (outcome.status === "pending_approval") {
|
|
18862
|
+
writeError(
|
|
18863
|
+
options,
|
|
18864
|
+
`The push waits for an approval on the instance and nothing was applied yet (Operation Run ${outcome.operationRunId}). When it is approved, run 'catalyst config pull' to record the new revisions.`
|
|
18865
|
+
);
|
|
18866
|
+
return void 0;
|
|
18867
|
+
}
|
|
18868
|
+
const warnings = [...checked.warnings ?? [], ...outcome.output.warnings];
|
|
18869
|
+
return {
|
|
18870
|
+
...outcome.output,
|
|
18871
|
+
warnings: warnings.filter(
|
|
18872
|
+
(warning, index) => warnings.findIndex(
|
|
18873
|
+
(other) => other.code === warning.code && other.message === warning.message
|
|
18874
|
+
) === index
|
|
18875
|
+
)
|
|
18876
|
+
};
|
|
18877
|
+
} catch (error) {
|
|
18878
|
+
if (!(error instanceof ConfigApiError)) throw error;
|
|
18879
|
+
const draftConflict = readDraftConflict(error);
|
|
18880
|
+
const refusal = draftConflict ? void 0 : readRefusedBatch(error);
|
|
18881
|
+
const conflicts = draftConflict ? [draftConflict] : refusal?.conflicts ?? [];
|
|
18882
|
+
const defaultAgentConflict = refusal?.defaultAgentConflict === true;
|
|
18883
|
+
const rest = withoutConflicts(batch, conflicts, defaultAgentConflict, skipped);
|
|
18884
|
+
if (rest !== void 0) {
|
|
18885
|
+
batch = rest;
|
|
18886
|
+
continue;
|
|
18887
|
+
}
|
|
18888
|
+
if (conflicts.length > 0 || defaultAgentConflict) {
|
|
18889
|
+
writeError(
|
|
18890
|
+
options,
|
|
18891
|
+
formatPushConflict(conflicts, defaultAgentConflict, options, NOTHING_APPLIED_HEADER)
|
|
18892
|
+
);
|
|
18893
|
+
return void 0;
|
|
18894
|
+
}
|
|
18895
|
+
if (!refusal) throw error;
|
|
18881
18896
|
writeError(
|
|
18882
18897
|
options,
|
|
18883
|
-
|
|
18898
|
+
formatRefusal2(
|
|
18899
|
+
refusal.validation ? "Validation failed" : "Push refused; nothing was applied",
|
|
18900
|
+
refusal
|
|
18901
|
+
)
|
|
18884
18902
|
);
|
|
18885
18903
|
return void 0;
|
|
18886
18904
|
}
|
|
18887
|
-
writeError(
|
|
18888
|
-
options,
|
|
18889
|
-
formatRefusal2(
|
|
18890
|
-
refusal.validation ? "Validation failed" : "Push refused; nothing was applied",
|
|
18891
|
-
refusal
|
|
18892
|
-
)
|
|
18893
|
-
);
|
|
18894
|
-
return void 0;
|
|
18895
18905
|
}
|
|
18896
18906
|
}
|
|
18907
|
+
function withoutConflicts(batch, conflicts, defaultAgentConflict, skipped) {
|
|
18908
|
+
const named = new Map(
|
|
18909
|
+
conflicts.map((conflict) => [`${conflict.kind}:${conflict.name}`, conflict])
|
|
18910
|
+
);
|
|
18911
|
+
const keyOf2 = (item) => `${item.kind}:${item.type === "put" ? String(item.config.name) : item.name}`;
|
|
18912
|
+
const left = batch.items.filter((item) => !named.has(keyOf2(item)));
|
|
18913
|
+
const dropsDefault = defaultAgentConflict && batch.defaultAgentName !== void 0;
|
|
18914
|
+
if (left.length === batch.items.length && !dropsDefault) return void 0;
|
|
18915
|
+
skipped.conflicts.push(...batch.items.flatMap((item) => named.get(keyOf2(item)) ?? []));
|
|
18916
|
+
if (!dropsDefault) return { ...batch, items: left };
|
|
18917
|
+
skipped.defaultAgent = true;
|
|
18918
|
+
return {
|
|
18919
|
+
...batch.workspaceId === void 0 ? {} : { workspaceId: batch.workspaceId },
|
|
18920
|
+
items: left
|
|
18921
|
+
};
|
|
18922
|
+
}
|
|
18897
18923
|
async function writeGuardrails(api, input) {
|
|
18898
18924
|
const { options } = input;
|
|
18899
18925
|
const owner = input.workspaceId === void 0 ? {} : { workspaceId: input.workspaceId };
|
|
@@ -18908,21 +18934,33 @@ async function writeGuardrails(api, input) {
|
|
|
18908
18934
|
void 0,
|
|
18909
18935
|
tombstones
|
|
18910
18936
|
);
|
|
18937
|
+
const skipped = (error, asset) => {
|
|
18938
|
+
if (!(error instanceof ConfigApiError) || error.code !== "REVISION_CONFLICT") return false;
|
|
18939
|
+
const conflicts = readConflicts(error.details);
|
|
18940
|
+
input.skip(conflicts.length > 0 ? conflicts : [{ kind: asset.kind, name: asset.name }]);
|
|
18941
|
+
return true;
|
|
18942
|
+
};
|
|
18911
18943
|
try {
|
|
18912
18944
|
for (const asset of input.puts) {
|
|
18913
18945
|
const base = input.baseOf(asset.key);
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18946
|
+
let outcome;
|
|
18947
|
+
try {
|
|
18948
|
+
outcome = await api.change(
|
|
18949
|
+
(client, idempotencyKey2) => client.assets.put({
|
|
18950
|
+
params: { kind: asset.kind, name: asset.name },
|
|
18951
|
+
body: {
|
|
18952
|
+
config: { ...asset.config },
|
|
18953
|
+
expectedRevision: base?.revision ?? null,
|
|
18954
|
+
...owner
|
|
18955
|
+
},
|
|
18956
|
+
idempotencyKey: idempotencyKey2
|
|
18957
|
+
}),
|
|
18958
|
+
"It may have been written: run 'catalyst config diff' before pushing again."
|
|
18959
|
+
);
|
|
18960
|
+
} catch (error) {
|
|
18961
|
+
if (skipped(error, asset)) continue;
|
|
18962
|
+
throw error;
|
|
18963
|
+
}
|
|
18926
18964
|
if (outcome.status === "pending_approval") {
|
|
18927
18965
|
writeError(options, waitingGuardrail(asset.key, outcome.run.id, written));
|
|
18928
18966
|
return 1;
|
|
@@ -18940,14 +18978,20 @@ async function writeGuardrails(api, input) {
|
|
|
18940
18978
|
for (const asset of input.deletes) {
|
|
18941
18979
|
const base = input.baseOf(asset.key);
|
|
18942
18980
|
if (base === void 0) continue;
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18981
|
+
let outcome;
|
|
18982
|
+
try {
|
|
18983
|
+
outcome = await api.change(
|
|
18984
|
+
(client, idempotencyKey2) => client.assets.delete({
|
|
18985
|
+
params: { kind: asset.kind, name: asset.name },
|
|
18986
|
+
body: { expectedRevision: base.revision, ...owner },
|
|
18987
|
+
idempotencyKey: idempotencyKey2
|
|
18988
|
+
}),
|
|
18989
|
+
"It may have been applied: run 'catalyst config diff' before pushing again."
|
|
18990
|
+
);
|
|
18991
|
+
} catch (error) {
|
|
18992
|
+
if (skipped(error, asset)) continue;
|
|
18993
|
+
throw error;
|
|
18994
|
+
}
|
|
18951
18995
|
if (outcome.status === "pending_approval") {
|
|
18952
18996
|
writeError(options, waitingGuardrail(asset.key, outcome.run.id, written));
|
|
18953
18997
|
return 1;
|
|
@@ -18964,11 +19008,6 @@ async function writeGuardrails(api, input) {
|
|
|
18964
19008
|
return 0;
|
|
18965
19009
|
} catch (error) {
|
|
18966
19010
|
if (!(error instanceof ConfigApiError)) throw error;
|
|
18967
|
-
const conflicts = error.code === "REVISION_CONFLICT" ? readConflicts(error.details) : [];
|
|
18968
|
-
if (conflicts.length > 0) {
|
|
18969
|
-
writeError(options, formatPushConflict(conflicts, false, options, written));
|
|
18970
|
-
return 1;
|
|
18971
|
-
}
|
|
18972
19011
|
const refusal = readRefusedBatch(error);
|
|
18973
19012
|
if (!refusal) throw error;
|
|
18974
19013
|
writeError(
|
|
@@ -19140,8 +19179,12 @@ function formatRefusal2(title, refusal) {
|
|
|
19140
19179
|
return `${title}:
|
|
19141
19180
|
${refusal.lines.map((line) => `- ${line}`).join("\n")}`;
|
|
19142
19181
|
}
|
|
19143
|
-
|
|
19144
|
-
|
|
19182
|
+
var NOTHING_APPLIED_HEADER = "Push conflict; nothing was applied.";
|
|
19183
|
+
function formatPushConflict(conflicts, defaultAgentConflict, options, header) {
|
|
19184
|
+
const sorted = [...conflicts].sort(
|
|
19185
|
+
(left, right) => `${left.kind}:${left.name}`.localeCompare(`${right.kind}:${right.name}`)
|
|
19186
|
+
);
|
|
19187
|
+
const selectors = sorted.map((asset) => `${asset.kind}:${asset.name}`);
|
|
19145
19188
|
const argumentsList = [
|
|
19146
19189
|
"catalyst config pull",
|
|
19147
19190
|
...options.dir ? ["--dir", shellQuote(options.dir)] : [],
|
|
@@ -19150,14 +19193,27 @@ function formatPushConflict(conflicts, defaultAgentConflict, options, applied =
|
|
|
19150
19193
|
...defaultAgentConflict ? [] : selectors.flatMap((selector) => ["--only", shellQuote(selector)])
|
|
19151
19194
|
];
|
|
19152
19195
|
return [
|
|
19153
|
-
|
|
19154
|
-
...
|
|
19196
|
+
header,
|
|
19197
|
+
...sorted.map((asset) => `- ${asset.kind}:${asset.name}: ${describeConflict(asset)}`),
|
|
19155
19198
|
...defaultAgentConflict ? ["- default agent changed on the instance; a full pull is required."] : [],
|
|
19156
19199
|
defaultAgentConflict ? "Commit or stash local edits in git first: a full pull overwrites the local working copy." : "Commit or stash local edits in git first: pull overwrites the local files for these assets.",
|
|
19157
19200
|
argumentsList.join(" "),
|
|
19158
|
-
"
|
|
19201
|
+
"Merge your edits into the pulled files, review with 'catalyst config diff', and push again."
|
|
19159
19202
|
].join("\n");
|
|
19160
19203
|
}
|
|
19204
|
+
async function describeStale(api, stale) {
|
|
19205
|
+
return mapConcurrently(stale, async (asset) => {
|
|
19206
|
+
const latest = await api.getLatestRevision(asset.kind, asset.name).catch(() => void 0);
|
|
19207
|
+
return {
|
|
19208
|
+
kind: asset.kind,
|
|
19209
|
+
name: asset.name,
|
|
19210
|
+
currentRevision: latest?.revision ?? asset.currentRevision,
|
|
19211
|
+
...latest?.operation === "delete" ? { deleted: true } : {},
|
|
19212
|
+
...latest?.actor ? { changedBy: latest.actor.displayLabel } : {},
|
|
19213
|
+
...latest ? { changedAt: latest.createdAt } : {}
|
|
19214
|
+
};
|
|
19215
|
+
});
|
|
19216
|
+
}
|
|
19161
19217
|
function describeConflict(asset) {
|
|
19162
19218
|
if (asset.draft !== void 0) {
|
|
19163
19219
|
return asset.draft.revision === null ? "the draft this working copy last saw was published or discarded since" : `its draft changed since the last pull: draft revision ${asset.draft.revision}, written by ${asset.changedBy ?? "unknown actor"} at ${asset.changedAt ?? "unknown time"}. A pull records it, and the push after it writes over that draft`;
|
|
@@ -19686,13 +19742,12 @@ var putVerb = {
|
|
|
19686
19742
|
// src/workflow-publish-review.ts
|
|
19687
19743
|
async function workflowPublishReview(input) {
|
|
19688
19744
|
const { api, options, scope, name: name2, revision, json: json2 } = input;
|
|
19689
|
-
const
|
|
19745
|
+
const asset = await api.read(
|
|
19690
19746
|
(client) => client.assets.get({
|
|
19691
19747
|
params: { kind: "workflow", name: name2 },
|
|
19692
|
-
query: { revision:
|
|
19748
|
+
query: { revision: String(revision), ...scope }
|
|
19693
19749
|
})
|
|
19694
19750
|
);
|
|
19695
|
-
const asset = await get(String(revision));
|
|
19696
19751
|
if ((asset.contentRevision ?? asset.revision) !== revision) {
|
|
19697
19752
|
throw new Error("The publish review does not describe this revision. Nothing was published.");
|
|
19698
19753
|
}
|
|
@@ -19702,27 +19757,14 @@ async function workflowPublishReview(input) {
|
|
|
19702
19757
|
"Publishes together: the Data Stores and their migrations first, then the Workflow, or neither:",
|
|
19703
19758
|
...stores.map(dataStoreLine)
|
|
19704
19759
|
];
|
|
19705
|
-
const narrative =
|
|
19760
|
+
const narrative = asset.publishNarrative;
|
|
19706
19761
|
const lead = narrative ? [narrative.summary, ...narrative.warnings, ...together] : [...together, ...asset.publishQuestion ?? []];
|
|
19707
19762
|
if (lead.length > 0) say(lead.join("\n"));
|
|
19708
|
-
const dataStores = stores.map(({ name: store, revision: draft }) => ({
|
|
19709
|
-
name: store,
|
|
19710
|
-
revision: draft
|
|
19711
|
-
}));
|
|
19712
|
-
if (!narrative) return { dataStores };
|
|
19713
19763
|
return {
|
|
19714
|
-
dataStores,
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
[
|
|
19719
|
-
"Details",
|
|
19720
|
-
...publishFileChanges(asset, live),
|
|
19721
|
-
...asset.filesOmitted || live?.filesOmitted ? ["Some files are omitted from this review."] : [],
|
|
19722
|
-
...asset.publishQuestion ?? []
|
|
19723
|
-
].join("\n")
|
|
19724
|
-
);
|
|
19725
|
-
}
|
|
19764
|
+
dataStores: stores.map(({ name: store, revision: draft }) => ({
|
|
19765
|
+
name: store,
|
|
19766
|
+
revision: draft
|
|
19767
|
+
}))
|
|
19726
19768
|
};
|
|
19727
19769
|
}
|
|
19728
19770
|
|
|
@@ -19781,7 +19823,7 @@ async function guardrailDryRunBeforePublish(session2, name2, revision) {
|
|
|
19781
19823
|
var ALREADY_LIVE = /* @__PURE__ */ Symbol("already live");
|
|
19782
19824
|
var publishVerb = {
|
|
19783
19825
|
usage: "publish <name> --revision <n> [--yes] [--confirm <blocked>]",
|
|
19784
|
-
summary: "Make one revision the one its users are served (assets.publish). A guardrail shows its dry run first;
|
|
19826
|
+
summary: "Make one revision the one its users are served (assets.publish), live at once. A guardrail shows its dry run first; --yes is accepted and changes nothing. A guardrail of the instance can hold a publish for an approval, and a publish that hands a source's data to people who may not use the source waits in the Inbox until a person who may change the source approves it",
|
|
19785
19827
|
named: true,
|
|
19786
19828
|
options: {
|
|
19787
19829
|
revision: { type: "string" },
|
|
@@ -19806,41 +19848,16 @@ var publishVerb = {
|
|
|
19806
19848
|
);
|
|
19807
19849
|
for (const line of asset.publishQuestion ?? []) writeOutput(session2.options, line);
|
|
19808
19850
|
}
|
|
19809
|
-
|
|
19810
|
-
|
|
19851
|
+
const review = session2.kind.kind === "workflow" ? await workflowPublishReview({
|
|
19852
|
+
api: session2.api,
|
|
19853
|
+
options: session2.options,
|
|
19854
|
+
scope: session2.scope,
|
|
19855
|
+
name: name2,
|
|
19856
|
+
revision,
|
|
19857
|
+
json: values.json
|
|
19858
|
+
}) : void 0;
|
|
19859
|
+
const dataStores = review?.dataStores ?? [];
|
|
19811
19860
|
const agent = session2.kind.kind === AGENT_KIND;
|
|
19812
|
-
const asks = agent ? session2.scope.workspaceId !== void 0 : session2.kind.actions.approve !== void 0;
|
|
19813
|
-
if (asks) {
|
|
19814
|
-
const review = session2.kind.kind === "workflow" && (values.yes || session2.options.prompt) ? await workflowPublishReview({
|
|
19815
|
-
api: session2.api,
|
|
19816
|
-
options: session2.options,
|
|
19817
|
-
scope: session2.scope,
|
|
19818
|
-
name: name2,
|
|
19819
|
-
revision,
|
|
19820
|
-
json: values.json,
|
|
19821
|
-
yes: values.yes
|
|
19822
|
-
}) : void 0;
|
|
19823
|
-
dataStores = review?.dataStores ?? [];
|
|
19824
|
-
const asked = {
|
|
19825
|
-
kind: session2.kind.kind,
|
|
19826
|
-
command: kindNoun(session2.kind),
|
|
19827
|
-
name: name2,
|
|
19828
|
-
revision
|
|
19829
|
-
};
|
|
19830
|
-
const answer = await askBeforePublish(session2.options, {
|
|
19831
|
-
...asked,
|
|
19832
|
-
yes: values.yes,
|
|
19833
|
-
...review?.details ? { details: review.details } : {}
|
|
19834
|
-
});
|
|
19835
|
-
if (answer === "refused") return EXIT3.refused;
|
|
19836
|
-
unattended = answer === "unattended";
|
|
19837
|
-
} else if (values.yes && session2.kind.kind === "data_store") {
|
|
19838
|
-
unattended = true;
|
|
19839
|
-
} else if (values.yes) {
|
|
19840
|
-
throw new UsageError(
|
|
19841
|
-
agent ? "An instance's own agent is published without a question; --yes answers none." : `A ${session2.kind.kind} is published without a question; --yes answers none.`
|
|
19842
|
-
);
|
|
19843
|
-
}
|
|
19844
19861
|
const outcome = await session2.api.change(
|
|
19845
19862
|
(client, idempotencyKey2) => client.assets.publish({
|
|
19846
19863
|
params: { kind: session2.kind.kind, name: name2 },
|
|
@@ -19850,8 +19867,7 @@ var publishVerb = {
|
|
|
19850
19867
|
...dataStores.length > 0 ? { dataStores } : {},
|
|
19851
19868
|
...session2.kind.kind === "knowledge_base" && values.confirm ? { confirmProcessing: values.confirm } : {}
|
|
19852
19869
|
},
|
|
19853
|
-
idempotencyKey: idempotencyKey2
|
|
19854
|
-
...unattended ? { unattended } : {}
|
|
19870
|
+
idempotencyKey: idempotencyKey2
|
|
19855
19871
|
}),
|
|
19856
19872
|
"It may have been applied: run 'show' before sending it again."
|
|
19857
19873
|
).catch((error) => {
|
|
@@ -19881,7 +19897,7 @@ var publishVerb = {
|
|
|
19881
19897
|
// An agent's first version without a draft replaces nothing: it is offered as made.
|
|
19882
19898
|
output.replacedRevision !== void 0 && (agent || session2.kind.kind === "skill") ? `Published draft revision ${output.draftRevision} of ${session2.kind.kind} '${name2}' as live revision ${output.publishedRevision}${output.replacedRevision === void 0 ? "" : ` in place of revision ${output.replacedRevision}`}.` : `Published revision ${output.publishedRevision} of ${session2.kind.kind} '${name2}'${output.replacedRevision === void 0 ? "" : ` in place of revision ${output.replacedRevision}`}.`
|
|
19883
19899
|
],
|
|
19884
|
-
|
|
19900
|
+
session2.kind.actions.approve !== void 0 || agent ? "If you are an instance approver, you can approve it in the Inbox." : void 0,
|
|
19885
19901
|
OVERTAKEN_LINE
|
|
19886
19902
|
);
|
|
19887
19903
|
};
|
|
@@ -22769,6 +22785,11 @@ var PROVIDER_KINDS = {
|
|
|
22769
22785
|
flag: "label",
|
|
22770
22786
|
question: "Name people read for the model, such as Claude Sonnet 4.6",
|
|
22771
22787
|
required: true
|
|
22788
|
+
},
|
|
22789
|
+
{
|
|
22790
|
+
flag: "cache-write-price",
|
|
22791
|
+
question: "Price of a million input tokens written to the prompt cache",
|
|
22792
|
+
required: false
|
|
22772
22793
|
}
|
|
22773
22794
|
],
|
|
22774
22795
|
entry: (values) => ({
|
|
@@ -23166,6 +23187,8 @@ Options of add:
|
|
|
23166
23187
|
--region eu The only region this command writes
|
|
23167
23188
|
--input-price <n> Price of a million uncached input tokens
|
|
23168
23189
|
--cached-input-price <n> Price of a million cached input tokens
|
|
23190
|
+
--cache-write-price <n> bedrock: price of a million input tokens written to the prompt
|
|
23191
|
+
cache (default: the input price)
|
|
23169
23192
|
--output-price <n> Price of a million output tokens
|
|
23170
23193
|
--currency <ABC> The rate card's currency where the config has none yet (EUR)
|
|
23171
23194
|
|
|
@@ -23210,6 +23233,7 @@ async function runModelsCommand(argv, base) {
|
|
|
23210
23233
|
region: { type: "string" },
|
|
23211
23234
|
"input-price": { type: "string" },
|
|
23212
23235
|
"cached-input-price": { type: "string" },
|
|
23236
|
+
"cache-write-price": { type: "string" },
|
|
23213
23237
|
"output-price": { type: "string" },
|
|
23214
23238
|
currency: { type: "string" },
|
|
23215
23239
|
config: { type: "string" },
|
|
@@ -23361,6 +23385,7 @@ async function addProvider(kind, flags, options) {
|
|
|
23361
23385
|
model,
|
|
23362
23386
|
uncachedInputPricePerMillionTokens: Number(values["input-price"]),
|
|
23363
23387
|
cachedInputPricePerMillionTokens: Number(values["cached-input-price"]),
|
|
23388
|
+
...values["cache-write-price"] === void 0 ? {} : { cacheWriteInputPricePerMillionTokens: Number(values["cache-write-price"]) },
|
|
23364
23389
|
outputPricePerMillionTokens: Number(values["output-price"])
|
|
23365
23390
|
};
|
|
23366
23391
|
const prices = valueAt(config.merged, PRICES);
|
|
@@ -23409,7 +23434,7 @@ async function addProvider(kind, flags, options) {
|
|
|
23409
23434
|
],
|
|
23410
23435
|
[
|
|
23411
23436
|
PRICES.join("."),
|
|
23412
|
-
`${price.uncachedInputPricePerMillionTokens} input, ${price.cachedInputPricePerMillionTokens} cached input, ${price.outputPricePerMillionTokens} output per million tokens (${currency})`
|
|
23437
|
+
`${price.uncachedInputPricePerMillionTokens} input, ${price.cachedInputPricePerMillionTokens} cached input, ${price.cacheWriteInputPricePerMillionTokens === void 0 ? "" : `${price.cacheWriteInputPricePerMillionTokens} cache write, `}${price.outputPricePerMillionTokens} output per million tokens (${currency})`
|
|
23413
23438
|
]
|
|
23414
23439
|
];
|
|
23415
23440
|
const width = Math.max(...written.map(([where]) => where.length));
|
|
@@ -23438,8 +23463,8 @@ function fallbackRefusal(fallbackId, bindings, models) {
|
|
|
23438
23463
|
const fallback = Array.isArray(bindings) ? bindings.find((binding) => isRecord(binding) && binding.id === fallbackId) : void 0;
|
|
23439
23464
|
if (!isRecord(fallback))
|
|
23440
23465
|
return `The release config has no model binding '${fallbackId}' to fall back to. Name one of its chat bindings with --fallback.`;
|
|
23441
|
-
if (fallback.kind === "embedding")
|
|
23442
|
-
return `'${fallbackId}' is an embedding binding; a fallback answers chat calls. Name a chat binding with --fallback.`;
|
|
23466
|
+
if (fallback.kind === "embedding" || fallback.kind === "transcription")
|
|
23467
|
+
return `'${fallbackId}' is ${fallback.kind === "embedding" ? "an embedding" : "a transcription"} binding; a fallback answers chat calls. Name a chat binding with --fallback.`;
|
|
23443
23468
|
const entry = isPlainConfigObject(models) && typeof fallback.providerId === "string" ? models[fallback.providerId] : void 0;
|
|
23444
23469
|
const region = isPlainConfigObject(entry) ? entry.region : void 0;
|
|
23445
23470
|
if (region !== "eu")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@work-shape/catalyst-cli",
|
|
3
|
-
"version": "0.8.0-rc.
|
|
3
|
+
"version": "0.8.0-rc.37",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"@types/node": "^24.13.1",
|
|
41
41
|
"tsup": "^8.5.1",
|
|
42
42
|
"typescript": "^6.0.3",
|
|
43
|
-
"@work-shape/catalyst-api-client": "0.8.0-rc.
|
|
44
|
-
"@work-shape/catalyst-api-contract": "0.8.0-rc.
|
|
45
|
-
"@work-shape/catalyst-asset-schemas": "0.8.0-rc.
|
|
43
|
+
"@work-shape/catalyst-api-client": "0.8.0-rc.37",
|
|
44
|
+
"@work-shape/catalyst-api-contract": "0.8.0-rc.37",
|
|
45
|
+
"@work-shape/catalyst-asset-schemas": "0.8.0-rc.37"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsup",
|
package/skills/catalyst/SKILL.md
CHANGED
|
@@ -60,7 +60,7 @@ Only when the person asks to use a skill locally, run `catalyst skill pull <name
|
|
|
60
60
|
|
|
61
61
|
A write names the revision it was made against. When the instance says the asset moved on, read it again and redo the change on the new revision; do not overwrite another person's work. Publish (`catalyst app publish offers --revision 5`) only when the person asks for it.
|
|
62
62
|
|
|
63
|
-
An App publish first asks who may use it: only its builder, its owning workspace, or the whole instance where allowed. The person chooses the audience. Pass their stated choice with `--audience` (`self`, `workspace` or `instance`); never choose it for them or widen a live App's audience on your own.
|
|
63
|
+
An App publish first asks who may use it: only its builder, its owning workspace, or the whole instance where allowed. The person chooses the audience. Pass their stated choice with `--audience` (`self`, `workspace` or `instance`); never choose it for them or widen a live App's audience on your own. A publish run without a terminal needs that explicit flag. A publish goes live at once and asks nothing, so run it only when the person asked for it.
|
|
64
64
|
|
|
65
65
|
## App and Workflow folders
|
|
66
66
|
|