@todoist/automations-cli 2.2.0 → 2.3.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/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
collectSkillStatus,
|
|
8
8
|
getInstaller,
|
|
9
9
|
updateAllInstalledSkills
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BAXDCDIS.js";
|
|
11
11
|
|
|
12
12
|
// ../../node_modules/jsonify/lib/parse.js
|
|
13
13
|
var require_parse = __commonJS({
|
|
@@ -8553,7 +8553,7 @@ import { fileURLToPath } from "node:url";
|
|
|
8553
8553
|
// package.json
|
|
8554
8554
|
var package_default = {
|
|
8555
8555
|
name: "@todoist/automations-cli",
|
|
8556
|
-
version: "2.
|
|
8556
|
+
version: "2.3.0",
|
|
8557
8557
|
description: "Command-line client for Todoist Automations",
|
|
8558
8558
|
type: "module",
|
|
8559
8559
|
bin: {
|
|
@@ -29871,6 +29871,39 @@ var AutomationDraftConnectionsClient = class extends BaseClient {
|
|
|
29871
29871
|
}
|
|
29872
29872
|
};
|
|
29873
29873
|
|
|
29874
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/automation-loop-review.schema.js
|
|
29875
|
+
var automationLoopFindingSchema = external_exports.object({
|
|
29876
|
+
triggerIndex: external_exports.int().nonnegative(),
|
|
29877
|
+
stepIds: external_exports.array(external_exports.string().min(1).max(100)).min(1).max(20),
|
|
29878
|
+
feedbackPath: external_exports.string().min(1).max(1500),
|
|
29879
|
+
evidence: external_exports.string().min(1).max(1500),
|
|
29880
|
+
uncertainty: external_exports.string().max(1e3),
|
|
29881
|
+
suggestedCorrection: external_exports.string().min(1).max(1500)
|
|
29882
|
+
});
|
|
29883
|
+
var automationLoopReviewSchema = external_exports.discriminatedUnion("state", [
|
|
29884
|
+
external_exports.object({
|
|
29885
|
+
state: external_exports.literal("not-applicable"),
|
|
29886
|
+
fingerprint: external_exports.string().min(1)
|
|
29887
|
+
}),
|
|
29888
|
+
external_exports.object({
|
|
29889
|
+
state: external_exports.literal("reviewed"),
|
|
29890
|
+
fingerprint: external_exports.string().min(1),
|
|
29891
|
+
findings: external_exports.array(automationLoopFindingSchema).max(8),
|
|
29892
|
+
limitations: external_exports.array(external_exports.string().min(1).max(1e3)).max(8)
|
|
29893
|
+
}),
|
|
29894
|
+
external_exports.object({
|
|
29895
|
+
state: external_exports.literal("unavailable"),
|
|
29896
|
+
fingerprint: external_exports.string().min(1),
|
|
29897
|
+
reason: external_exports.enum([
|
|
29898
|
+
"incomplete",
|
|
29899
|
+
"input-limit",
|
|
29900
|
+
"definitions",
|
|
29901
|
+
"provider",
|
|
29902
|
+
"revision-changed"
|
|
29903
|
+
])
|
|
29904
|
+
})
|
|
29905
|
+
]);
|
|
29906
|
+
|
|
29874
29907
|
// ../../packages/sdk/dist/core/dist/esm/schemas/shared.schema.js
|
|
29875
29908
|
var RolloutCompatibleNullableStringSchema = external_exports.string().nullish().transform((value) => value ?? null);
|
|
29876
29909
|
|
|
@@ -29975,31 +30008,101 @@ var ReadUsageSummaryResponseSchema = external_exports.object({
|
|
|
29975
30008
|
|
|
29976
30009
|
// ../../packages/sdk/dist/core/dist/esm/types/failure-category.types.js
|
|
29977
30010
|
var FAILURE_CATEGORY_REGISTRY = {
|
|
29978
|
-
ai_quota_exceeded: {
|
|
29979
|
-
|
|
29980
|
-
|
|
29981
|
-
|
|
29982
|
-
|
|
29983
|
-
|
|
29984
|
-
|
|
29985
|
-
|
|
29986
|
-
|
|
29987
|
-
|
|
29988
|
-
|
|
29989
|
-
|
|
29990
|
-
|
|
29991
|
-
|
|
29992
|
-
|
|
29993
|
-
|
|
29994
|
-
|
|
29995
|
-
|
|
29996
|
-
|
|
29997
|
-
|
|
29998
|
-
|
|
29999
|
-
|
|
30000
|
-
|
|
30011
|
+
ai_quota_exceeded: {
|
|
30012
|
+
reliabilityLabel: "AI usage quota exceeded",
|
|
30013
|
+
countsAgainstReliability: false
|
|
30014
|
+
},
|
|
30015
|
+
mcp_upstream_unavailable: {
|
|
30016
|
+
reliabilityLabel: "Mcp Upstream Unavailable",
|
|
30017
|
+
countsAgainstReliability: true
|
|
30018
|
+
},
|
|
30019
|
+
mcp_client_missing: {
|
|
30020
|
+
reliabilityLabel: "Mcp Client Missing",
|
|
30021
|
+
countsAgainstReliability: true
|
|
30022
|
+
},
|
|
30023
|
+
mcp_tool_missing: {
|
|
30024
|
+
reliabilityLabel: "Mcp Tool Missing",
|
|
30025
|
+
countsAgainstReliability: true
|
|
30026
|
+
},
|
|
30027
|
+
mcp_tool_call_failed: {
|
|
30028
|
+
reliabilityLabel: "Mcp Tool Call Failed",
|
|
30029
|
+
countsAgainstReliability: true
|
|
30030
|
+
},
|
|
30031
|
+
llm_schema_validation: {
|
|
30032
|
+
reliabilityLabel: "Llm Schema Validation",
|
|
30033
|
+
countsAgainstReliability: true
|
|
30034
|
+
},
|
|
30035
|
+
llm_empty_response: {
|
|
30036
|
+
reliabilityLabel: "Llm Empty Response",
|
|
30037
|
+
countsAgainstReliability: true
|
|
30038
|
+
},
|
|
30039
|
+
llm_provider_error: {
|
|
30040
|
+
reliabilityLabel: "Llm Provider Error",
|
|
30041
|
+
countsAgainstReliability: true
|
|
30042
|
+
},
|
|
30043
|
+
prompt_too_large: {
|
|
30044
|
+
reliabilityLabel: "Prompt Too Large",
|
|
30045
|
+
countsAgainstReliability: true
|
|
30046
|
+
},
|
|
30047
|
+
json_parse_error: {
|
|
30048
|
+
reliabilityLabel: "Json Parse Error",
|
|
30049
|
+
countsAgainstReliability: true
|
|
30050
|
+
},
|
|
30051
|
+
code_execution_error: {
|
|
30052
|
+
reliabilityLabel: "Code Execution Error",
|
|
30053
|
+
countsAgainstReliability: true
|
|
30054
|
+
},
|
|
30055
|
+
code_generation_error: {
|
|
30056
|
+
reliabilityLabel: "Code Generation Error",
|
|
30057
|
+
countsAgainstReliability: true
|
|
30058
|
+
},
|
|
30059
|
+
step_execution_error: {
|
|
30060
|
+
reliabilityLabel: "Step Execution Error",
|
|
30061
|
+
countsAgainstReliability: true
|
|
30062
|
+
},
|
|
30063
|
+
step_failure_pattern: {
|
|
30064
|
+
reliabilityLabel: "Step Failure Pattern",
|
|
30065
|
+
countsAgainstReliability: true
|
|
30066
|
+
},
|
|
30067
|
+
schema_validation: {
|
|
30068
|
+
reliabilityLabel: "Schema Validation",
|
|
30069
|
+
countsAgainstReliability: true
|
|
30070
|
+
},
|
|
30071
|
+
template_variable_error: {
|
|
30072
|
+
reliabilityLabel: "Template Variable Error",
|
|
30073
|
+
countsAgainstReliability: true
|
|
30074
|
+
},
|
|
30075
|
+
invalid_configuration: {
|
|
30076
|
+
reliabilityLabel: "Invalid Configuration",
|
|
30077
|
+
countsAgainstReliability: true
|
|
30078
|
+
},
|
|
30079
|
+
invalid_manifest: {
|
|
30080
|
+
reliabilityLabel: "Invalid Manifest",
|
|
30081
|
+
countsAgainstReliability: true
|
|
30082
|
+
},
|
|
30083
|
+
automation_not_found: {
|
|
30084
|
+
reliabilityLabel: "Automation Not Found",
|
|
30085
|
+
countsAgainstReliability: true
|
|
30086
|
+
},
|
|
30087
|
+
timeout: {
|
|
30088
|
+
reliabilityLabel: "Timeout",
|
|
30089
|
+
countsAgainstReliability: true
|
|
30090
|
+
},
|
|
30091
|
+
runtime_error: {
|
|
30092
|
+
reliabilityLabel: "Runtime Error",
|
|
30093
|
+
countsAgainstReliability: true
|
|
30094
|
+
},
|
|
30095
|
+
billing_unavailable: {
|
|
30096
|
+
reliabilityLabel: "Billing Unavailable",
|
|
30097
|
+
countsAgainstReliability: true
|
|
30098
|
+
},
|
|
30099
|
+
unknown: {
|
|
30100
|
+
reliabilityLabel: "Unknown",
|
|
30101
|
+
countsAgainstReliability: true
|
|
30102
|
+
}
|
|
30001
30103
|
};
|
|
30002
30104
|
var FAILURE_CATEGORIES = Object.keys(FAILURE_CATEGORY_REGISTRY);
|
|
30105
|
+
Object.freeze(FAILURE_CATEGORIES.filter((category) => !FAILURE_CATEGORY_REGISTRY[category].countsAgainstReliability));
|
|
30003
30106
|
var SKIP_CATEGORIES = USAGE_BILLING_AUTHORIZATION_DENIAL_REASONS;
|
|
30004
30107
|
|
|
30005
30108
|
// ../../packages/sdk/dist/core/dist/esm/schemas/query-param.schema.js
|
|
@@ -30568,7 +30671,8 @@ var automationSchema = external_exports.object({
|
|
|
30568
30671
|
workspaceId: external_exports.string().nullable(),
|
|
30569
30672
|
visibility: external_exports.enum(AUTOMATION_VISIBILITIES),
|
|
30570
30673
|
isOwner: external_exports.boolean(),
|
|
30571
|
-
disabledReason: external_exports.enum(AUTOMATION_DISABLED_REASONS).nullable()
|
|
30674
|
+
disabledReason: external_exports.enum(AUTOMATION_DISABLED_REASONS).nullable(),
|
|
30675
|
+
loopReview: automationLoopReviewSchema.optional()
|
|
30572
30676
|
});
|
|
30573
30677
|
var automationListResponseSchema = external_exports.object({
|
|
30574
30678
|
data: external_exports.array(automationSchema),
|
|
@@ -30715,7 +30819,8 @@ var automationDraftSchema = external_exports.object({
|
|
|
30715
30819
|
var automationDraftValidationSchema = external_exports.object({
|
|
30716
30820
|
state: external_exports.enum(["incomplete", "ready"]),
|
|
30717
30821
|
issues: external_exports.array(external_exports.string()),
|
|
30718
|
-
modified: external_exports.boolean()
|
|
30822
|
+
modified: external_exports.boolean(),
|
|
30823
|
+
loopReview: automationLoopReviewSchema.optional()
|
|
30719
30824
|
});
|
|
30720
30825
|
var automationDraftWithValidationSchema = automationDraftValidationSchema.extend({ draft: automationDraftSchema });
|
|
30721
30826
|
var automationDraftListResponseSchema = external_exports.object({
|
|
@@ -30724,7 +30829,10 @@ var automationDraftListResponseSchema = external_exports.object({
|
|
|
30724
30829
|
});
|
|
30725
30830
|
var listAutomationDraftsQuerySchema = CursorPaginationSchema.extend({ conversationId: external_exports.string().min(1).optional() });
|
|
30726
30831
|
external_exports.object({ enabled: external_exports.boolean().optional() }).meta({ id: "FinalizeAutomationDraftRequest" });
|
|
30727
|
-
var finalizeAutomationDraftResponseSchema = external_exports.object({
|
|
30832
|
+
var finalizeAutomationDraftResponseSchema = external_exports.object({
|
|
30833
|
+
automation: automationSchema,
|
|
30834
|
+
loopReview: automationLoopReviewSchema.optional()
|
|
30835
|
+
});
|
|
30728
30836
|
var draftTestTriggerSelectorSchema = external_exports.union([external_exports.object({ index: external_exports.int().min(0) }), external_exports.object({ event: external_exports.string().min(1) })]);
|
|
30729
30837
|
var testAutomationDraftRequestSchema = external_exports.object({
|
|
30730
30838
|
trigger: draftTestTriggerSelectorSchema.optional(),
|
|
@@ -32790,6 +32898,7 @@ var UsageBillingClient = class extends BaseClient {
|
|
|
32790
32898
|
var WEBHOOK_EVENT_TYPES = [
|
|
32791
32899
|
"automation:run:started",
|
|
32792
32900
|
"automation:run:finished",
|
|
32901
|
+
"automation:run:input_required",
|
|
32793
32902
|
"automation:created",
|
|
32794
32903
|
"automation:updated",
|
|
32795
32904
|
"automation:deleted",
|
|
@@ -32889,6 +32998,24 @@ var AutomationRunFinishedEventSchema = external_exports.object({
|
|
|
32889
32998
|
data: AutomationRunFinishedDataSchema
|
|
32890
32999
|
});
|
|
32891
33000
|
|
|
33001
|
+
// ../../packages/sdk/dist/core/dist/esm/schemas/webhook-events/automation-run-input-required.event.js
|
|
33002
|
+
var AutomationRunInputRequiredDataSchema = external_exports.object({
|
|
33003
|
+
automationRunId: external_exports.string(),
|
|
33004
|
+
automationId: external_exports.string(),
|
|
33005
|
+
stepId: external_exports.string(),
|
|
33006
|
+
notificationId: external_exports.string(),
|
|
33007
|
+
message: external_exports.string(),
|
|
33008
|
+
details: external_exports.string().nullable(),
|
|
33009
|
+
options: external_exports.array(PromptOptionSchema),
|
|
33010
|
+
askedAt: external_exports.iso.datetime(),
|
|
33011
|
+
expiresAt: external_exports.iso.datetime().nullable()
|
|
33012
|
+
});
|
|
33013
|
+
var AutomationRunInputRequiredEventSchema = external_exports.object({
|
|
33014
|
+
type: external_exports.literal("automation:run:input_required"),
|
|
33015
|
+
timestamp: external_exports.iso.datetime(),
|
|
33016
|
+
data: AutomationRunInputRequiredDataSchema
|
|
33017
|
+
});
|
|
33018
|
+
|
|
32892
33019
|
// ../../packages/sdk/dist/core/dist/esm/schemas/webhook-events/automation-run-started.event.js
|
|
32893
33020
|
var AutomationRunStartedDataSchema = external_exports.object({
|
|
32894
33021
|
automationRunId: external_exports.string(),
|
|
@@ -32941,6 +33068,7 @@ var WEBHOOK_EVENT_SUBSCRIPTION_DESCRIPTION_MAX_LENGTH = 200;
|
|
|
32941
33068
|
external_exports.discriminatedUnion("type", [
|
|
32942
33069
|
AutomationRunStartedEventSchema,
|
|
32943
33070
|
AutomationRunFinishedEventSchema,
|
|
33071
|
+
AutomationRunInputRequiredEventSchema,
|
|
32944
33072
|
AutomationCreatedEventSchema,
|
|
32945
33073
|
AutomationUpdatedEventSchema,
|
|
32946
33074
|
AutomationDeletedEventSchema,
|
|
@@ -34571,6 +34699,7 @@ async function publishDraft(draftApi, { draftId, confirmed, submittedManifest })
|
|
|
34571
34699
|
action: "published",
|
|
34572
34700
|
summary,
|
|
34573
34701
|
automation: published.automation,
|
|
34702
|
+
...published.loopReview ? { loopReview: published.loopReview } : {},
|
|
34574
34703
|
verification: {
|
|
34575
34704
|
status: "unavailable",
|
|
34576
34705
|
reason: getErrorMessage(error62)
|
|
@@ -34586,7 +34715,8 @@ async function publishDraft(draftApi, { draftId, confirmed, submittedManifest })
|
|
|
34586
34715
|
return {
|
|
34587
34716
|
action: "published",
|
|
34588
34717
|
summary,
|
|
34589
|
-
automation,
|
|
34718
|
+
automation: published.automation,
|
|
34719
|
+
...published.loopReview ? { loopReview: published.loopReview } : {},
|
|
34590
34720
|
verification: isDeepEqual(expected, actual) ? {
|
|
34591
34721
|
status: "matched",
|
|
34592
34722
|
against
|
|
@@ -34606,6 +34736,7 @@ async function previewPublish(draftApi, draftId, submittedManifest) {
|
|
|
34606
34736
|
const diff = published ? diffManifests(normaliseManifest(published.manifest), savedDraft) : null;
|
|
34607
34737
|
return {
|
|
34608
34738
|
summary: {
|
|
34739
|
+
...detail.loopReview ? { loopReview: detail.loopReview } : {},
|
|
34609
34740
|
draftId,
|
|
34610
34741
|
name: readManifestName(draft.partialManifest),
|
|
34611
34742
|
scope: draft.workspaceId === null ? { kind: "personal" } : {
|
|
@@ -35571,31 +35702,68 @@ var ReadUsageSummaryResponseSchema2 = external_exports.object({
|
|
|
35571
35702
|
|
|
35572
35703
|
// ../../packages/core/dist/esm/types/failure-category.types.js
|
|
35573
35704
|
var FAILURE_CATEGORY_REGISTRY2 = {
|
|
35574
|
-
ai_quota_exceeded: {
|
|
35575
|
-
|
|
35576
|
-
|
|
35577
|
-
|
|
35578
|
-
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
|
|
35582
|
-
|
|
35583
|
-
|
|
35584
|
-
|
|
35585
|
-
|
|
35586
|
-
|
|
35587
|
-
|
|
35588
|
-
|
|
35589
|
-
|
|
35590
|
-
|
|
35591
|
-
|
|
35592
|
-
|
|
35593
|
-
|
|
35594
|
-
|
|
35595
|
-
|
|
35596
|
-
|
|
35705
|
+
ai_quota_exceeded: {
|
|
35706
|
+
reliabilityLabel: "AI usage quota exceeded",
|
|
35707
|
+
countsAgainstReliability: false
|
|
35708
|
+
},
|
|
35709
|
+
mcp_upstream_unavailable: {
|
|
35710
|
+
reliabilityLabel: "Mcp Upstream Unavailable",
|
|
35711
|
+
countsAgainstReliability: true
|
|
35712
|
+
},
|
|
35713
|
+
mcp_client_missing: { reliabilityLabel: "Mcp Client Missing", countsAgainstReliability: true },
|
|
35714
|
+
mcp_tool_missing: { reliabilityLabel: "Mcp Tool Missing", countsAgainstReliability: true },
|
|
35715
|
+
mcp_tool_call_failed: {
|
|
35716
|
+
reliabilityLabel: "Mcp Tool Call Failed",
|
|
35717
|
+
countsAgainstReliability: true
|
|
35718
|
+
},
|
|
35719
|
+
llm_schema_validation: {
|
|
35720
|
+
reliabilityLabel: "Llm Schema Validation",
|
|
35721
|
+
countsAgainstReliability: true
|
|
35722
|
+
},
|
|
35723
|
+
llm_empty_response: { reliabilityLabel: "Llm Empty Response", countsAgainstReliability: true },
|
|
35724
|
+
llm_provider_error: { reliabilityLabel: "Llm Provider Error", countsAgainstReliability: true },
|
|
35725
|
+
prompt_too_large: { reliabilityLabel: "Prompt Too Large", countsAgainstReliability: true },
|
|
35726
|
+
json_parse_error: { reliabilityLabel: "Json Parse Error", countsAgainstReliability: true },
|
|
35727
|
+
code_execution_error: {
|
|
35728
|
+
reliabilityLabel: "Code Execution Error",
|
|
35729
|
+
countsAgainstReliability: true
|
|
35730
|
+
},
|
|
35731
|
+
code_generation_error: {
|
|
35732
|
+
reliabilityLabel: "Code Generation Error",
|
|
35733
|
+
countsAgainstReliability: true
|
|
35734
|
+
},
|
|
35735
|
+
step_execution_error: {
|
|
35736
|
+
reliabilityLabel: "Step Execution Error",
|
|
35737
|
+
countsAgainstReliability: true
|
|
35738
|
+
},
|
|
35739
|
+
step_failure_pattern: {
|
|
35740
|
+
reliabilityLabel: "Step Failure Pattern",
|
|
35741
|
+
countsAgainstReliability: true
|
|
35742
|
+
},
|
|
35743
|
+
schema_validation: { reliabilityLabel: "Schema Validation", countsAgainstReliability: true },
|
|
35744
|
+
template_variable_error: {
|
|
35745
|
+
reliabilityLabel: "Template Variable Error",
|
|
35746
|
+
countsAgainstReliability: true
|
|
35747
|
+
},
|
|
35748
|
+
invalid_configuration: {
|
|
35749
|
+
reliabilityLabel: "Invalid Configuration",
|
|
35750
|
+
countsAgainstReliability: true
|
|
35751
|
+
},
|
|
35752
|
+
invalid_manifest: { reliabilityLabel: "Invalid Manifest", countsAgainstReliability: true },
|
|
35753
|
+
automation_not_found: {
|
|
35754
|
+
reliabilityLabel: "Automation Not Found",
|
|
35755
|
+
countsAgainstReliability: true
|
|
35756
|
+
},
|
|
35757
|
+
timeout: { reliabilityLabel: "Timeout", countsAgainstReliability: true },
|
|
35758
|
+
runtime_error: { reliabilityLabel: "Runtime Error", countsAgainstReliability: true },
|
|
35759
|
+
billing_unavailable: {
|
|
35760
|
+
reliabilityLabel: "Billing Unavailable",
|
|
35761
|
+
countsAgainstReliability: true
|
|
35762
|
+
},
|
|
35763
|
+
unknown: { reliabilityLabel: "Unknown", countsAgainstReliability: true }
|
|
35597
35764
|
};
|
|
35598
35765
|
var FAILURE_CATEGORIES2 = Object.keys(FAILURE_CATEGORY_REGISTRY2);
|
|
35766
|
+
var RELIABILITY_EXCLUDED_FAILURE_CATEGORIES = Object.freeze(FAILURE_CATEGORIES2.filter((category) => !FAILURE_CATEGORY_REGISTRY2[category].countsAgainstReliability));
|
|
35599
35767
|
var SKIP_CATEGORIES2 = USAGE_BILLING_AUTHORIZATION_DENIAL_REASONS2;
|
|
35600
35768
|
function isSkipCategory(category) {
|
|
35601
35769
|
return SKIP_CATEGORIES2.includes(category);
|
|
@@ -38164,6 +38332,7 @@ var PublishDraftOutputSchema = external_exports.union([external_exports.object({
|
|
|
38164
38332
|
draftId: external_exports.string().min(1),
|
|
38165
38333
|
action: CompleteAutomationDraftActionSchema,
|
|
38166
38334
|
automationId: external_exports.string().min(1),
|
|
38335
|
+
loopReview: automationLoopReviewSchema.optional(),
|
|
38167
38336
|
previewArtifact: automationPreviewArtifactSchema.optional()
|
|
38168
38337
|
}), external_exports.object({
|
|
38169
38338
|
success: external_exports.literal(false),
|
|
@@ -38171,6 +38340,7 @@ var PublishDraftOutputSchema = external_exports.union([external_exports.object({
|
|
|
38171
38340
|
instructions: external_exports.string().min(1),
|
|
38172
38341
|
draftId: external_exports.string().min(1),
|
|
38173
38342
|
action: CompleteAutomationDraftActionSchema.optional(),
|
|
38343
|
+
loopReview: automationLoopReviewSchema.optional(),
|
|
38174
38344
|
previewArtifact: automationPreviewArtifactSchema.optional()
|
|
38175
38345
|
})]);
|
|
38176
38346
|
external_exports.object({
|
|
@@ -38589,22 +38759,25 @@ function classifyChatTurnFailure(error62) {
|
|
|
38589
38759
|
|
|
38590
38760
|
// ../../packages/sdk/dist/chat-turn/transport.js
|
|
38591
38761
|
import { DefaultChatTransport, readUIMessageStream } from "ai";
|
|
38762
|
+
function getChatTurnUrl(apiRoot, workspaceId) {
|
|
38763
|
+
return workspaceId ? `${apiRoot}/workspaces/${encodeURIComponent(workspaceId)}/chat` : `${apiRoot}/chat`;
|
|
38764
|
+
}
|
|
38592
38765
|
var ChatTurnTransport = class {
|
|
38593
38766
|
transport;
|
|
38594
38767
|
constructor({ token, baseUrl, headers, fetch: fetch2 }) {
|
|
38595
38768
|
const apiRoot = `${baseUrl.replace(/\/+$/, "")}/v1`;
|
|
38596
38769
|
this.transport = new DefaultChatTransport({
|
|
38597
|
-
api:
|
|
38770
|
+
api: getChatTurnUrl(apiRoot, null),
|
|
38598
38771
|
headers: {
|
|
38599
38772
|
Authorization: `Bearer ${token}`,
|
|
38600
38773
|
...headers
|
|
38601
38774
|
},
|
|
38602
38775
|
credentials: "include",
|
|
38603
38776
|
fetch: fetch2,
|
|
38604
|
-
prepareSendMessagesRequest({ messages, body
|
|
38777
|
+
prepareSendMessagesRequest({ messages, body }) {
|
|
38605
38778
|
const { workspaceId, ...rest } = body ?? {};
|
|
38606
38779
|
return {
|
|
38607
|
-
api:
|
|
38780
|
+
api: getChatTurnUrl(apiRoot, workspaceId),
|
|
38608
38781
|
body: {
|
|
38609
38782
|
...rest,
|
|
38610
38783
|
message: messages.at(-1)
|
|
@@ -42140,6 +42313,7 @@ function formatDraftPublish(result) {
|
|
|
42140
42313
|
return [
|
|
42141
42314
|
`Published draft ${summary.draftId} as automation ${automation.id} (${how}).`,
|
|
42142
42315
|
...describeVerification(verification),
|
|
42316
|
+
...describeLoopReview(result.loopReview),
|
|
42143
42317
|
`Open: ${result.url}`,
|
|
42144
42318
|
...describeQuestionDelivery(summary.questions)
|
|
42145
42319
|
].join("\n");
|
|
@@ -42174,6 +42348,7 @@ function summarizeDraftPublish(result) {
|
|
|
42174
42348
|
}
|
|
42175
42349
|
function describePublishSummary(summary) {
|
|
42176
42350
|
const lines = [
|
|
42351
|
+
...describeLoopReview(summary.loopReview),
|
|
42177
42352
|
`Draft: ${summary.name} (${summary.draftId})`,
|
|
42178
42353
|
summary.scope.kind === "personal" ? "Scope: personal" : `Scope: workspace ${summary.scope.workspaceId} (${describeVisibility2(summary)})`,
|
|
42179
42354
|
summary.target.kind === "new" ? "Action: create a new automation" : `Action: update automation ${summary.target.automationId}`,
|
|
@@ -42193,6 +42368,17 @@ function describePublishSummary(summary) {
|
|
|
42193
42368
|
}
|
|
42194
42369
|
return lines;
|
|
42195
42370
|
}
|
|
42371
|
+
function describeLoopReview(review) {
|
|
42372
|
+
if (review?.state === "unavailable")
|
|
42373
|
+
return ["Warning: loop review is unavailable; no safety conclusion was reached."];
|
|
42374
|
+
if (review?.state !== "reviewed") return [];
|
|
42375
|
+
return [
|
|
42376
|
+
...review.findings.map(
|
|
42377
|
+
(finding) => `Loop warning: ${finding.feedbackPath}. ${finding.suggestedCorrection}`
|
|
42378
|
+
),
|
|
42379
|
+
...review.limitations.map((limitation) => `Loop review limitation: ${limitation}`)
|
|
42380
|
+
];
|
|
42381
|
+
}
|
|
42196
42382
|
function describeVisibility2(summary) {
|
|
42197
42383
|
if (summary.scope.kind !== "workspace") return "";
|
|
42198
42384
|
const visibility = summary.scope.visibility === "workspace" ? "visible to the workspace" : "private";
|